[U-Boot] [RFC 1/6] odroid: exynos: USB initialization on the U3/X2

Lukasz Majewski lukma at denx.de
Mon Apr 1 12:57:08 UTC 2019


Hi Anand,

> From: Tobias Jakobi <tjakobi at math.uni-bielefeld.de>
> 
> Rename board_usb_init() to exynos_usb_init() and call it
> early in the Exynos EHCI driver when probing.
> 
> This kind of works. After a 'usb start; usb stop; usb start'
> cycle the attached devices are recognized.
> 
> Add small delay between gpio_direction_output to stable
> initialization of usb gpio pins.
> 
> Signed-off-by: Tobias Jakobi <tjakobi at math.uni-bielefeld.de>
> Signed-off-by: Anand Moon <linux.amoon at gmail.com>
> ---
> Reoder the exynos_usb_init so that "usb start" command initialization
> correcly.
> ---
> ---
>  board/samsung/odroid/odroid.c  | 14 +++++++++-----
>  drivers/usb/host/ehci-exynos.c |  7 +++++++
>  2 files changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/board/samsung/odroid/odroid.c
> b/board/samsung/odroid/odroid.c index 3e594fd850..79d14ead01 100644
> --- a/board/samsung/odroid/odroid.c
> +++ b/board/samsung/odroid/odroid.c
> @@ -468,8 +468,6 @@ struct dwc2_plat_otg_data s5pc210_otg_data = {
>  };
>  #endif
>  
> -#if defined(CONFIG_USB_GADGET) || defined(CONFIG_CMD_USB)
> -
>  static void set_usb3503_ref_clk(void)
>  {
>  #ifdef CONFIG_BOARD_TYPES
> @@ -490,9 +488,8 @@ static void set_usb3503_ref_clk(void)
>  #endif /* CONFIG_BOARD_TYPES */
>  }
>  
> -int board_usb_init(int index, enum usb_init_type init)
> +int exynos_usb_init(void)
>  {
> -#ifdef CONFIG_CMD_USB
>  	struct udevice *dev;
>  	int ret;
>  
> @@ -501,6 +498,7 @@ int board_usb_init(int index, enum usb_init_type
> init) /* Disconnect, Reset, Connect */
>  	gpio_direction_output(EXYNOS4X12_GPIO_X34, 0);
>  	gpio_direction_output(EXYNOS4X12_GPIO_X35, 0);
> +	sdelay(200000);
>  	gpio_direction_output(EXYNOS4X12_GPIO_X35, 1);
>  	gpio_direction_output(EXYNOS4X12_GPIO_X34, 1);
>  
> @@ -530,7 +528,13 @@ int board_usb_init(int index, enum usb_init_type
> init) pr_err("Regulator %s value setting error: %d\n", dev->name,
> ret); return ret;
>  	}
> -#endif
> +
> +	return 0;
> +}
> +
> +#ifdef CONFIG_USB_GADGET
> +int board_usb_init(int index, enum usb_init_type init)

We are not allowed to add board_usb_* code anymore. The _only_ way to
update/fix the USB gadget code is to convert it to driver model [DM] and
describe it via DTS.

Please consider converting this code to DM/DTS.

> +{
>  	debug("USB_udc_probe\n");
>  	return dwc2_udc_probe(&s5pc210_otg_data);
>  }
> diff --git a/drivers/usb/host/ehci-exynos.c
> b/drivers/usb/host/ehci-exynos.c index fabc662eb6..b0f7bd4936 100644
> --- a/drivers/usb/host/ehci-exynos.c
> +++ b/drivers/usb/host/ehci-exynos.c
> @@ -31,6 +31,8 @@ struct exynos_ehci_platdata {
>  	struct gpio_desc vbus_gpio;
>  };
>  
> +extern int exynos_usb_init(void);
> +
>  /**
>   * Contains pointers to register base addresses
>   * for the usb controller.
> @@ -152,6 +154,11 @@ static void exynos4412_setup_usb_phy(struct
> exynos4412_usb_phy *usb) setbits_le32(&usb->usbphyrstcon,
> (RSTCON_HOSTPHY_SWRST | RSTCON_SWRST)); udelay(10);
>  	clrbits_le32(&usb->usbphyrstcon, (RSTCON_HOSTPHY_SWRST |
> RSTCON_SWRST)); +
> +	/*
> +	 * "usb start" initialize the usb driver
> +	 */
> +	exynos_usb_init();
>  }
>  
>  static void setup_usb_phy(struct exynos_usb_phy *usb)




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190401/9935a596/attachment.sig>


More information about the U-Boot mailing list