[U-Boot] [PATCH] usb: ehci-mx6: Fix bus enumeration for DM case

Peng Fan peng.fan at nxp.com
Fri Jun 21 01:45:10 UTC 2019


Hi Marek,

> -----Original Message-----
> From: Marek Vasut [mailto:marex at denx.de]
> Sent: 2019年6月21日 4:54
> To: u-boot at lists.denx.de
> Cc: Marek Vasut <marex at denx.de>; Abel Vesa <abel.vesa at nxp.com>; Adam
> Ford <aford173 at gmail.com>; Fabio Estevam <festevam at gmail.com>;
> Ludwig Zenz <lzenz at dh-electronics.com>; Peng Fan <peng.fan at nxp.com>;
> Stefano Babic <sbabic at denx.de>; Vagrant Cascadian <vagrant at debian.org>
> Subject: [PATCH] usb: ehci-mx6: Fix bus enumeration for DM case
> 
> It is likely that the DM conversion of EHCI iMX6 driver was a derivative of EHCI
> VF, however the conversion is incomplete and is missing the bind workaround,
> which updates dev->seq number. Without this, all controllers have dev->seq
> number 0 . Add this bind workaround into EHCI iMX6 driver as well.
> 
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Abel Vesa <abel.vesa at nxp.com>
> Cc: Adam Ford <aford173 at gmail.com>
> Cc: Fabio Estevam <festevam at gmail.com>
> Cc: Ludwig Zenz <lzenz at dh-electronics.com>
> Cc: Peng Fan <peng.fan at nxp.com>
> Cc: Stefano Babic <sbabic at denx.de>
> Cc: Vagrant Cascadian <vagrant at debian.org>
> ---
>  drivers/usb/host/ehci-mx6.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index
> 33abfeada0..109ed7ed4a 100644
> --- a/drivers/usb/host/ehci-mx6.c
> +++ b/drivers/usb/host/ehci-mx6.c
> @@ -503,6 +503,22 @@ static int ehci_usb_ofdata_to_platdata(struct
> udevice *dev)
>  	return 0;
>  }
> 
> +static int ehci_usb_bind(struct udevice *dev) {
> +	static int num_controllers;
> +
> +	/*
> +	 * Without this hack, if we return ENODEV for USB Controller 0, on
> +	 * probe for the next controller, USB Controller 1 will be given a
> +	 * sequence number of 0. This conflicts with our requirement of
> +	 * sequence numbers while initialising the peripherals.
> +	 */
> +	dev->req_seq = num_controllers;

With alias in dts, no need this, right?

Regards,
Peng.

> +	num_controllers++;
> +
> +	return 0;
> +}
> +
>  static int ehci_usb_probe(struct udevice *dev)  {
>  	struct usb_platdata *plat = dev_get_platdata(dev); @@ -564,6 +580,7
> @@ U_BOOT_DRIVER(usb_mx6) = {
>  	.id	= UCLASS_USB,
>  	.of_match = mx6_usb_ids,
>  	.ofdata_to_platdata = ehci_usb_ofdata_to_platdata,
> +	.bind	= ehci_usb_bind,
>  	.probe	= ehci_usb_probe,
>  	.remove = ehci_deregister,
>  	.ops	= &ehci_usb_ops,
> --
> 2.20.1



More information about the U-Boot mailing list