From: peng.fan at nxp.com Date: Wed, 16 Sep 2020 20:57:05 +0800 Subject: [PATCH 13/13] usb: ehci-mx6: Improve the bind function In-Reply-To: <20200916125705.4341-1-peng.fan@nxp.com> References: <20200916125705.4341-1-peng.fan@nxp.com> Message-ID: <20200916125705.4341-14-peng.fan@nxp.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Ye Li 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 Reviewed-by: Peng Fan Signed-off-by: Peng Fan --- 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