[PATCH 13/13] usb: ehci-mx6: Improve the bind function

peng.fan at nxp.com peng.fan at nxp.com
Wed Sep 16 14:57:05 CEST 2020


From: Ye Li <ye.li at nxp.com>

To avoid calling devfdt_get_addr_index in bind, which introduces
much overhead, checks the req_seq and only call the devfdt_get_addr_index
when the req_seq (usb alias) is not set in DTS

Signed-off-by: Ye Li <ye.li at nxp.com>
Reviewed-by: Peng Fan <peng.fan at nxp.com>
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 drivers/usb/host/ehci-mx6.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index 080bde71d3..20617850f3 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -735,13 +735,16 @@ static int ehci_usb_bind(struct udevice *dev)
 	 * the driver is fully converted to DT probing.
 	 */
 	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;
+	if (dev->req_seq == -1) {
+		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;
+	}
 
 	return 0;
 }
-- 
2.28.0



More information about the U-Boot mailing list