public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] usb: host: ehci: samsung: Move hcor initialization after usb phy setup
@ 2015-12-10 15:32 Lukasz Majewski
  2015-12-10 16:20 ` Marek Vasut
  2015-12-10 17:39 ` Simon Glass
  0 siblings, 2 replies; 3+ messages in thread
From: Lukasz Majewski @ 2015-12-10 15:32 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
---
 drivers/usb/host/ehci-exynos.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index 18e9251..bede04b 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -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);
 }
-- 
2.0.0.rc2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] usb: host: ehci: samsung: Move hcor initialization after usb phy setup
  2015-12-10 15:32 [U-Boot] [PATCH] usb: host: ehci: samsung: Move hcor initialization after usb phy setup Lukasz Majewski
@ 2015-12-10 16:20 ` Marek Vasut
  2015-12-10 17:39 ` Simon Glass
  1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2015-12-10 16:20 UTC (permalink / raw)
  To: u-boot

On Thursday, December 10, 2015 at 04:32:25 PM, Lukasz Majewski wrote:
> 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.
> 
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> ---
>  drivers/usb/host/ehci-exynos.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-exynos.c
> b/drivers/usb/host/ehci-exynos.c index 18e9251..bede04b 100644
> --- a/drivers/usb/host/ehci-exynos.c
> +++ b/drivers/usb/host/ehci-exynos.c
> @@ -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)));

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] usb: host: ehci: samsung: Move hcor initialization after usb phy setup
  2015-12-10 15:32 [U-Boot] [PATCH] usb: host: ehci: samsung: Move hcor initialization after usb phy setup Lukasz Majewski
  2015-12-10 16:20 ` Marek Vasut
@ 2015-12-10 17:39 ` Simon Glass
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2015-12-10 17:39 UTC (permalink / raw)
  To: u-boot

On 10 December 2015 at 08:32, Lukasz Majewski <l.majewski@samsung.com> wrote:
> 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.
>
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> ---
>  drivers/usb/host/ehci-exynos.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-10 17:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-10 15:32 [U-Boot] [PATCH] usb: host: ehci: samsung: Move hcor initialization after usb phy setup Lukasz Majewski
2015-12-10 16:20 ` Marek Vasut
2015-12-10 17:39 ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox