Message ID | 20200916125705.4341-7-peng.fan@nxp.com |
---|---|
State | New |
Headers | show |
Series | ehci-mx6: update and fix | expand |
On 9/16/20 2:56 PM, peng.fan@nxp.com wrote: [...] > +++ b/drivers/usb/host/ehci-mx6.c > @@ -665,7 +665,11 @@ static int ehci_usb_bind(struct udevice *dev) > * With these changes in place, the ad-hoc indexing goes away and > * the driver is fully converted to DT probing. > */ > - u32 controller_spacing = is_mx7() ? 0x10000 : 0x200; > + u32 controller_spacing; > + if (IS_ENABLED(CONFIG_MX6)) > + controller_spacing = 0x200; > + else > + controller_spacing = 0x10000; I suspect this changes the behavior from runtime detection to compile-time detection of the SoC ? I would much prefer if we could extract the controller-PHY binding from DT instead of this workaround, finally. I recall that was the reason why this stuff above was added originally.
diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index 1db27949c6..96dcf7655b 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -665,7 +665,11 @@ static int ehci_usb_bind(struct udevice *dev) * With these changes in place, the ad-hoc indexing goes away and * the driver is fully converted to DT probing. */ - u32 controller_spacing = is_mx7() ? 0x10000 : 0x200; + u32 controller_spacing; + if (IS_ENABLED(CONFIG_MX6)) + controller_spacing = 0x200; + else + controller_spacing = 0x10000; fdt_addr_t addr = devfdt_get_addr_index(dev, 0); dev->req_seq = (addr - USB_BASE_ADDR) / controller_spacing; @@ -692,7 +696,7 @@ static int ehci_usb_probe(struct udevice *dev) } priv->ehci = ehci; - priv->portnr = dev->seq; + priv->portnr = dev->req_seq; priv->init_type = type; ret = board_usb_init(priv->portnr, priv->init_type); @@ -744,7 +748,7 @@ int ehci_usb_remove(struct udevice *dev) ehci_deregister(dev); - return board_usb_cleanup(dev->seq, priv->init_type); + return board_usb_cleanup(dev->req_seq, priv->init_type); } static const struct udevice_id mx6_usb_ids[] = {