[U-Boot] [RFC 02/10] nvidia, tegra: new USB hardware init interface

Stephen Warren
2013-08-07T16:26:18Z

On 08/06/2013 04:50 AM, Mateusz Zalega wrote:
> This commit postpones initialization of USB hardware until
> usb_board_init() is called by a command implementation
> (ie. do_dfu()) or a driver.

> diff --git a/arch/arm/include/asm/arch-tegra/usb.h b/arch/arm/include/asm/arch-tegra/usb.h

> /* Setup USB on the board */
> -int board_usb_init(const void *blob);
> +int usb_process_devicetree(const void *blob);

This needs to be part of the previous patch (or part of that patch needs
to be split out and put into this patch) so that this prototype change
happens in the same patch that the implementation is renamed. Perhaps
this can happen before the current patch 1?

> diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c

> @@ -151,10 +152,6 @@ int board_init(void)
> # endif /* CONFIG_TEGRA_PMU */
> #endif /* CONFIG_SYS_I2C_TEGRA */
>
> -#ifdef CONFIG_USB_EHCI_TEGRA
> - pin_mux_usb();
> - board_usb_init(gd->fdt_blob);
> -#endif

> +#ifdef CONFIG_USB_EHCI_TEGRA
> +int board_usb_init(enum board_usb_init_type what_to_init)
> +{
> + pin_mux_usb();
> + usb_process_devicetree(gd->fdt_blob);
> + return 0;
> +}
> +#endif

Moving the pinmux initialization might be dangerous; pin_mux_usb() might
prevent the pins used for USB having a mux function selected that
conflicts with some other pins selected mux function. We really do need
to initialize all of the pinmux early, and not defer it.