Skip to contentSkip to conversation

usb: host: ehci: samsung: Move hcor initialization after usb phy setup

PATCH New Lukasz Majewski 3 participants 3 messages Dec 10, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: host: ehci: samsung: Move hcor initialization after usb phy setup

With the old order of initialization the hcor pointer has been setup to the same address as Exynos EHCI base address (0x12110000 instead of 0x12110010).
Such behaviour was caused by reading value of 0 instead of 0x10 from EHCI HCCPBASE register without doing proper clock initialization before.

To fix this problem hcor initialization has been moved after USB PHY setup. Now ehci_readl(&ctx->hcd->cr_capbase) returns correct value.

---
 drivers/usb/host/ehci-exynos.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-exynos.c +2 -2
index 18e9251..bede04b 100644
@@ -219,14 +219,14 @@ static int ehci_usb_probe(struct udevice *dev)
 
 	ctx->hcd = (struct ehci_hccr *)plat->hcd_base;
 	ctx->usb = (struct exynos_usb_phy *)plat->phy_base;
-	hcor = (struct ehci_hcor *)((uint32_t)ctx->hcd +
-			HC_LENGTH(ehci_readl(&ctx->hcd->cr_capbase)));
 
 	/* setup the Vbus gpio here */
 	if (dm_gpio_is_valid(&plat->vbus_gpio))
 		dm_gpio_set_value(&plat->vbus_gpio, 1);
 
 	setup_usb_phy(ctx->usb);
+	hcor = (struct ehci_hcor *)((uint32_t)ctx->hcd +
+			HC_LENGTH(ehci_readl(&ctx->hcd->cr_capbase)));
 
 	return ehci_register(dev, ctx->hcd, hcor, NULL, 0, USB_INIT_HOST);
 }
Signature · 1 line
2.0.0.rc2
#1 lore raw

PATCH 1/1 usb: host: ehci: samsung: Move hcor initialization after usb phy setup

Quoted 22 lines · Lukasz Majewski

With the old order of initialization the hcor pointer has been setup to the same address as Exynos EHCI base address (0x12110000 instead of 0x12110010).
Such behaviour was caused by reading value of 0 instead of 0x10 from EHCI HCCPBASE register without doing proper clock initialization before.

To fix this problem hcor initialization has been moved after USB PHY setup. Now ehci_readl(&ctx->hcd->cr_capbase) returns correct value.

---
 drivers/usb/host/ehci-exynos.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/usb/host/ehci-exynos.c index 18e9251..bede04b 100644

drivers/usb/host/ehci-exynos.c +0 -0
@@ -219,14 +219,14 @@ static int ehci_usb_probe(struct udevice *dev)
 
 	ctx->hcd = (struct ehci_hccr *)plat->hcd_base;
 	ctx->usb = (struct exynos_usb_phy *)plat->phy_base;

drivers/usb/host/ehci-exynos.c static int ehci_usb_probe(struct udevice *dev) · line 229

Quoted 10 lines
drivers/usb/host/ehci-exynos.c +2 -2
-	hcor = (struct ehci_hcor *)((uint32_t)ctx->hcd +
-			HC_LENGTH(ehci_readl(&ctx->hcd->cr_capbase)));
 
 	/* setup the Vbus gpio here */
 	if (dm_gpio_is_valid(&plat->vbus_gpio))
 		dm_gpio_set_value(&plat->vbus_gpio, 1);
 
 	setup_usb_phy(ctx->usb);
+	hcor = (struct ehci_hcor *)((uint32_t)ctx->hcd +
+			HC_LENGTH(ehci_readl(&ctx->hcd->cr_capbase)));

Best regards,
Marek Vasut

#2 lore raw

PATCH 1/1 usb: host: ehci: samsung: Move hcor initialization after usb phy setup

In reply to Lukasz Majewski
Quoted 6 lines · Lukasz Majewski

With the old order of initialization the hcor pointer has been setup to the same address as Exynos EHCI base address (0x12110000 instead of 0x12110010).
Such behaviour was caused by reading value of 0 instead of 0x10 from EHCI HCCPBASE register without doing proper clock initialization before.

Quoted 7 lines

To fix this problem hcor initialization has been moved after USB PHY setup. Now ehci_readl(&ctx->hcd->cr_capbase) returns correct value.

---
 drivers/usb/host/ehci-exynos.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)