[U-Boot] [RFC] usb: host: xhci-omap: Remove redundant board_usb_init and board_usb_cleanup functions

Marek Vasut marex at denx.de
Wed Feb 14 10:16:07 UTC 2018


On 02/14/2018 11:10 AM, Faiz Abbas wrote:
> board_usb_init()/_cleanup() should be in board files and don't have
> a place in the xhci-omap driver. Weak versions for
> board_usb_init()/_cleanup() already exist in common/usb.c
> (for host mode) and drivers/usb/gadget/g_dnl.c (for gadget mode).
> 
> Signed-off-by: Faiz Abbas <faiz_abbas at ti.com>

Reviewed-by: Marek Vasut <marex at denx.de>

I'd like some TBs from the people using those boards.

> ---
> Since 1a9a5f7 ("fix double weak board_usb_init functions") the
> board_usb_init()/_cleanup() a prefix omap_xhci_* was added to the board
> files and in omap-xhci.c because there was a duplicate implementation
> in common/usb.c. However, this broke the gadget mode path which uses the
> same board_usb_init/cleanup() in the board specific files.
> 
> I think a better way would be to just remove the functions from xhci-omap
> like in this patch. Any issues with this?
> 
>  board/ti/am43xx/board.c      |  4 ++--
>  board/ti/am57xx/board.c      |  4 ++--
>  board/ti/dra7xx/evm.c        |  4 ++--
>  drivers/usb/host/xhci-omap.c | 22 ----------------------
>  4 files changed, 6 insertions(+), 28 deletions(-)
> 
> diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
> index 06082f1..6286af4 100644
> --- a/board/ti/am43xx/board.c
> +++ b/board/ti/am43xx/board.c
> @@ -744,7 +744,7 @@ int usb_gadget_handle_interrupts(int index)
>  #endif /* CONFIG_USB_DWC3 */
>  
>  #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
> -int omap_xhci_board_usb_init(int index, enum usb_init_type init)
> +int board_usb_init(int index, enum usb_init_type init)
>  {
>  	enable_usb_clocks(index);
>  #ifdef CONFIG_USB_DWC3
> @@ -775,7 +775,7 @@ int omap_xhci_board_usb_init(int index, enum usb_init_type init)
>  	return 0;
>  }
>  
> -int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
> +int board_usb_cleanup(int index, enum usb_init_type init)
>  {
>  #ifdef CONFIG_USB_DWC3
>  	switch (index) {
> diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
> index 1128784..c3f60f6 100644
> --- a/board/ti/am57xx/board.c
> +++ b/board/ti/am57xx/board.c
> @@ -867,7 +867,7 @@ int usb_gadget_handle_interrupts(int index)
>  #endif /* CONFIG_USB_DWC3 */
>  
>  #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
> -int omap_xhci_board_usb_init(int index, enum usb_init_type init)
> +int board_usb_init(int index, enum usb_init_type init)
>  {
>  	enable_usb_clocks(index);
>  	switch (index) {
> @@ -901,7 +901,7 @@ int omap_xhci_board_usb_init(int index, enum usb_init_type init)
>  	return 0;
>  }
>  
> -int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
> +int board_usb_cleanup(int index, enum usb_init_type init)
>  {
>  #ifdef CONFIG_USB_DWC3
>  	switch (index) {
> diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
> index 6ecf971..519475e 100644
> --- a/board/ti/dra7xx/evm.c
> +++ b/board/ti/dra7xx/evm.c
> @@ -907,7 +907,7 @@ static struct ti_usb_phy_device usb_phy2_device = {
>  	.index = 1,
>  };
>  
> -int omap_xhci_board_usb_init(int index, enum usb_init_type init)
> +int board_usb_init(int index, enum usb_init_type init)
>  {
>  	enable_usb_clocks(index);
>  	switch (index) {
> @@ -944,7 +944,7 @@ int omap_xhci_board_usb_init(int index, enum usb_init_type init)
>  	return 0;
>  }
>  
> -int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
> +int board_usb_cleanup(int index, enum usb_init_type init)
>  {
>  	switch (index) {
>  	case 0:
> diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
> index d6c5744..b814500 100644
> --- a/drivers/usb/host/xhci-omap.c
> +++ b/drivers/usb/host/xhci-omap.c
> @@ -27,28 +27,6 @@ DECLARE_GLOBAL_DATA_PTR;
>  
>  static struct omap_xhci omap;
>  
> -__weak int omap_xhci_board_usb_init(int index, enum usb_init_type init)
> -{
> -	enable_usb_clocks(index);
> -	return 0;
> -}
> -
> -int board_usb_init(int index, enum usb_init_type init)
> -{
> -	return omap_xhci_board_usb_init(index, init);
> -}
> -
> -__weak int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
> -{
> -	disable_usb_clocks(index);
> -	return 0;
> -}
> -
> -int board_usb_cleanup(int index, enum usb_init_type init)
> -{
> -	return omap_xhci_board_usb_cleanup(index, init);
> -}
> -
>  static int omap_xhci_core_init(struct omap_xhci *omap)
>  {
>  	int ret = 0;
> 


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list