[U-Boot] [RFC 01/10] New board-specific USB initialization interface

Marek Vasut
2013-08-11T18:04:51Z

Dear Mateusz Zalega,

> This commit unifies board-specific USB initialization implementations
> under one symbol (usb_board_init), declaration of which is available in
> usb.h.
>
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>
> ---
> common/cmd_dfu.c | 5 ++---
> common/cmd_usb_mass_storage.c | 3 ++-
> common/usb.c | 5 +++++
> drivers/usb/host/ehci-omap.c | 8 +-------
> drivers/usb/host/ehci-tegra.c | 2 +-
> drivers/usb/host/ohci-hcd.c | 4 ++--
> drivers/usb/host/ohci.h | 12 +++++-------
> include/g_dnl.h | 2 --
> include/usb.h | 17 ++++++++++++++++-
> include/usb_mass_storage.h | 12 +++++-------
> 10 files changed, 39 insertions(+), 31 deletions(-)

[...]

> --- a/include/usb.h
> +++ b/include/usb.h
> @@ -165,10 +165,25 @@ int submit_int_msg(struct usb_device *dev, unsigned
> long pipe, void *buffer,
>
> extern void udc_disconnect(void);
>
> -#else
> +#elif !defined(CONFIG_USB_GADGET)
> #error USB Lowlevel not defined
> #endif
>
> +/* You can initialize platform's USB host, device or both
> + * capabilities by passing this enum as an argument to
> + * board_usb_init().
> + */

The comment style is wrong, please fix. Did the patchset pass checkpatch ?

/*
* multi
* line
* comment
*/

> +enum board_usb_init_type {
> + USB_INIT_ALL,
> + USB_INIT_HOST,
> + USB_INIT_DEVICE
> +};
> +
> +/* board-specific hardware initialization, called by
> + * usb drivers and u-boot commands
> + */
> +int board_usb_init(enum board_usb_init_type what_to_init);
> +
> #ifdef CONFIG_USB_STORAGE
>
> #define USB_MAX_STOR_DEV 5
> diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h
> index 35cdcc3..de31b0e 100644
> --- a/include/usb_mass_storage.h
> +++ b/include/usb_mass_storage.h
> @@ -30,13 +30,11 @@ struct ums_board_info {
> struct ums_device ums_dev;
> };
>
> -extern void board_usb_init(void);
> -
> -extern int fsg_init(struct ums_board_info *);
> -extern void fsg_cleanup(void);
> -extern struct ums_board_info *board_ums_init(unsigned int,
> +int fsg_init(struct ums_board_info *);
> +void fsg_cleanup(void);
> +struct ums_board_info *board_ums_init(unsigned int,
> unsigned int, unsigned int);
> -extern int usb_gadget_handle_interrupts(void);
> -extern int fsg_main_thread(void *);
> +int usb_gadget_handle_interrupts(void);
> +int fsg_main_thread(void *);
>
> #endif /* __USB_MASS_STORAGE_H__ */

Best regards,
Marek Vasut