* [U-Boot] [PATCH v2] usb: ehci-mx6: Fix bus enumeration for iMX7 SoCs
@ 2019-10-10 13:09 Igor Opaniuk
2019-10-11 15:50 ` Marcel Ziswiler
2019-10-12 11:07 ` Marek Vasut
0 siblings, 2 replies; 3+ messages in thread
From: Igor Opaniuk @ 2019-10-10 13:09 UTC (permalink / raw)
To: u-boot
From: Igor Opaniuk <igor.opaniuk@toradex.com>
This fixes the issues with calculation of controller indexes in
ehci_usb_bind() for iMX7, as USB controllers on iMX7 SoCs aren't
placed next to each other, and their addresses incremented by 0x10000.
Example of USB nodes for iMX7S/D:
usbotg1: usb at 30b10000 {
compatible = "fsl,imx7d-usb", "fsl,imx27-usb";
reg = <0x30b10000 0x200>;
^^^^^^^^^^
....
usbotg2: usb at 30b20000 {
compatible = "fsl,imx7d-usb", "fsl,imx27-usb";
reg = <0x30b20000 0x200>;
^^^^^^^^^^
....
usbh: usb at 30b30000 {
compatible = "fsl,imx7d-usb", "fsl,imx27-usb";
reg = <0x30b30000 0x200>;
^^^^^^^^^^
....
Which was leading to usb enumeration issues:
Colibri iMX7 # usb start
starting USB...
Bus usb at 30b10000: USB EHCI 1.00
Bus usb at 30b20000: probe failed, error -22
scanning bus usb at 30b10000 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Fixes: 501547cec1("usb: ehci-mx6: Fix bus enumeration for DM case")
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
---
v2:
- removed ifdefs and used runtime check of SoC
drivers/usb/host/ehci-mx6.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index e9e6ed596d..7d46091f94 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -513,10 +513,11 @@ static int ehci_usb_bind(struct udevice *dev)
* from which it derives offsets in the PHY and ANATOP register sets.
*
* Here we attempt to calculate these indexes from DT information as
- * well as we can. The USB controllers on all existing iMX6/iMX7 SoCs
- * are placed next to each other, at addresses incremented by 0x200.
- * Thus, the index is derived from the multiple of 0x200 offset from
- * the first controller address.
+ * well as we can. The USB controllers on all existing iMX6 SoCs
+ * are placed next to each other, at addresses incremented by 0x200,
+ * and iMX7 their addresses are shifted by 0x10000.
+ * Thus, the index is derived from the multiple of 0x200 (0x10000 for
+ * iMX7) offset from the first controller address.
*
* However, to complete conversion of this driver to DT probing, the
* following has to be done:
@@ -531,10 +532,10 @@ 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.
*/
- fdt_size_t size;
- fdt_addr_t addr = devfdt_get_addr_size_index(dev, 0, &size);
+ u32 controller_spacing = is_mx7() ? 0x10000 : 0x200;
+ fdt_addr_t addr = devfdt_get_addr_index(dev, 0);
- dev->req_seq = (addr - USB_BASE_ADDR) / size;
+ dev->req_seq = (addr - USB_BASE_ADDR) / controller_spacing;
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v2] usb: ehci-mx6: Fix bus enumeration for iMX7 SoCs
2019-10-10 13:09 [U-Boot] [PATCH v2] usb: ehci-mx6: Fix bus enumeration for iMX7 SoCs Igor Opaniuk
@ 2019-10-11 15:50 ` Marcel Ziswiler
2019-10-12 11:07 ` Marek Vasut
1 sibling, 0 replies; 3+ messages in thread
From: Marcel Ziswiler @ 2019-10-11 15:50 UTC (permalink / raw)
To: u-boot
On Thu, 2019-10-10 at 16:09 +0300, Igor Opaniuk wrote:
> From: Igor Opaniuk <igor.opaniuk@toradex.com>
>
> This fixes the issues with calculation of controller indexes in
> ehci_usb_bind() for iMX7, as USB controllers on iMX7 SoCs aren't
> placed next to each other, and their addresses incremented by
> 0x10000.
>
> Example of USB nodes for iMX7S/D:
>
> usbotg1: usb at 30b10000 {
> compatible = "fsl,imx7d-usb", "fsl,imx27-usb";
> reg = <0x30b10000 0x200>;
> ^^^^^^^^^^
> ....
> usbotg2: usb at 30b20000 {
> compatible = "fsl,imx7d-usb", "fsl,imx27-usb";
> reg = <0x30b20000 0x200>;
> ^^^^^^^^^^
> ....
>
> usbh: usb at 30b30000 {
> compatible = "fsl,imx7d-usb", "fsl,imx27-usb";
> reg = <0x30b30000 0x200>;
> ^^^^^^^^^^
> ....
>
> Which was leading to usb enumeration issues:
> Colibri iMX7 # usb start
> starting USB...
> Bus usb at 30b10000: USB EHCI 1.00
> Bus usb at 30b20000: probe failed, error -22
> scanning bus usb at 30b10000 for devices... 1 USB Device(s) found
> scanning usb for storage devices... 0 Storage Device(s) found
>
> Fixes: 501547cec1("usb: ehci-mx6: Fix bus enumeration for DM case")
> Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
> ---
>
> v2:
> - removed ifdefs and used runtime check of SoC
>
> drivers/usb/host/ehci-mx6.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-
> mx6.c
> index e9e6ed596d..7d46091f94 100644
> --- a/drivers/usb/host/ehci-mx6.c
> +++ b/drivers/usb/host/ehci-mx6.c
> @@ -513,10 +513,11 @@ static int ehci_usb_bind(struct udevice *dev)
> * from which it derives offsets in the PHY and ANATOP register
> sets.
> *
> * Here we attempt to calculate these indexes from DT
> information as
> - * well as we can. The USB controllers on all existing
> iMX6/iMX7 SoCs
> - * are placed next to each other, at addresses incremented by
> 0x200.
> - * Thus, the index is derived from the multiple of 0x200 offset
> from
> - * the first controller address.
> + * well as we can. The USB controllers on all existing iMX6
> SoCs
> + * are placed next to each other, at addresses incremented by
> 0x200,
> + * and iMX7 their addresses are shifted by 0x10000.
> + * Thus, the index is derived from the multiple of 0x200
> (0x10000 for
> + * iMX7) offset from the first controller address.
> *
> * However, to complete conversion of this driver to DT
> probing, the
> * following has to be done:
> @@ -531,10 +532,10 @@ 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.
> */
> - fdt_size_t size;
> - fdt_addr_t addr = devfdt_get_addr_size_index(dev, 0, &size);
> + u32 controller_spacing = is_mx7() ? 0x10000 : 0x200;
> + fdt_addr_t addr = devfdt_get_addr_index(dev, 0);
>
> - dev->req_seq = (addr - USB_BASE_ADDR) / size;
> + dev->req_seq = (addr - USB_BASE_ADDR) / controller_spacing;
>
> return 0;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v2] usb: ehci-mx6: Fix bus enumeration for iMX7 SoCs
2019-10-10 13:09 [U-Boot] [PATCH v2] usb: ehci-mx6: Fix bus enumeration for iMX7 SoCs Igor Opaniuk
2019-10-11 15:50 ` Marcel Ziswiler
@ 2019-10-12 11:07 ` Marek Vasut
1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2019-10-12 11:07 UTC (permalink / raw)
To: u-boot
On 10/10/19 3:09 PM, Igor Opaniuk wrote:
> From: Igor Opaniuk <igor.opaniuk@toradex.com>
>
> This fixes the issues with calculation of controller indexes in
> ehci_usb_bind() for iMX7, as USB controllers on iMX7 SoCs aren't
> placed next to each other, and their addresses incremented by 0x10000.
>
> Example of USB nodes for iMX7S/D:
[...]
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-12 11:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-10 13:09 [U-Boot] [PATCH v2] usb: ehci-mx6: Fix bus enumeration for iMX7 SoCs Igor Opaniuk
2019-10-11 15:50 ` Marcel Ziswiler
2019-10-12 11:07 ` Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox