[PATCH 1/3] usb: ehci-mx6: move mode set/detect to probe

Marek Vasut marex at denx.de
Tue Apr 27 19:45:38 CEST 2021


On 4/27/21 7:08 PM, Tim Harvey wrote:
> There is no need to set and/or detect mode in of_to_plat and
> accessing phy registers at that point before device power domain and
> clock are enabled will cause hangs on platforms such as IMX8M Mini.
> 
> Move the mode set/detect from of_to_plat into the probe and remove
> the unnecessary of_to_plat.
> 
> Signed-off-by: Tim Harvey <tharvey at gateworks.com>
> ---
>   drivers/usb/host/ehci-mx6.c | 42 ++++++++++++++-----------------------
>   1 file changed, 16 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
> index 06be9deaaa..c2dfe49012 100644
> --- a/drivers/usb/host/ehci-mx6.c
> +++ b/drivers/usb/host/ehci-mx6.c
> @@ -539,28 +539,6 @@ static int ehci_usb_phy_mode(struct udevice *dev)
>   	return 0;
>   }
>   
> -static int ehci_usb_of_to_plat(struct udevice *dev)
> -{
> -	struct usb_plat *plat = dev_get_plat(dev);
> -	enum usb_dr_mode dr_mode;
> -
> -	dr_mode = usb_get_dr_mode(dev_ofnode(dev));
> -
> -	switch (dr_mode) {
> -	case USB_DR_MODE_HOST:
> -		plat->init_type = USB_INIT_HOST;
> -		break;
> -	case USB_DR_MODE_PERIPHERAL:
> -		plat->init_type = USB_INIT_DEVICE;
> -		break;
> -	case USB_DR_MODE_OTG:
> -	case USB_DR_MODE_UNKNOWN:
> -		return ehci_usb_phy_mode(dev);
> -	};
> -
> -	return 0;
> -}
> -

[...]

> @@ -764,7 +755,6 @@ U_BOOT_DRIVER(usb_mx6) = {
>   	.name	= "ehci_mx6",
>   	.id	= UCLASS_USB,
>   	.of_match = mx6_usb_ids,
> -	.of_to_plat = ehci_usb_of_to_plat,

I wonder why it was implemented in of_to_plat originally , maybe there 
is some reason for that ?


More information about the U-Boot mailing list