Patchwork [U-Boot,3/3] HACK: ehci-omap: do gpio toggle after port power is set

login
register
mail settings
Submitter Dan Murphy
Date July 8, 2013, 8:59 p.m.
Message ID <1373317175-28926-4-git-send-email-dmurphy@ti.com>
Download mbox | patch
Permalink /patch/257604/
State Superseded
Delegated to: Tom Rini
Headers show

Comments

Dan Murphy - July 8, 2013, 8:59 p.m.
Need to check why gpio toggling in ehci-omap is not
working and works only from ehci-hcd.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 drivers/usb/host/ehci-hcd.c  |    7 ++++++-
 drivers/usb/host/ehci-omap.c |    2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)
Roger Quadros - July 9, 2013, 9:59 a.m.
On 07/08/2013 11:59 PM, Dan Murphy wrote:
> Need to check why gpio toggling in ehci-omap is not
> working and works only from ehci-hcd.

do you mean HSIC detection is not working?

GPIO toggling has to work from anywhere.

> 
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
>  drivers/usb/host/ehci-hcd.c  |    7 ++++++-
>  drivers/usb/host/ehci-omap.c |    2 +-
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> index 706cf0c..17d0c9c 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -29,7 +29,7 @@
>  #include <malloc.h>
>  #include <watchdog.h>
>  #include <linux/compiler.h>
> -
> +#include <asm/ehci-omap.h>
>  #include "ehci.h"
>  
>  #ifndef CONFIG_USB_MAX_CONTROLLER_COUNT
> @@ -776,6 +776,11 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
>  			if (HCS_PPC(ehci_readl(&ctrl->hccr->cr_hcsparams))) {
>  				reg |= EHCI_PS_PP;
>  				ehci_writel(status_reg, reg);
> +#ifdef CONFIG_USB_EHCI_OMAP
> +				omap_ehci_phy_reset(1, 1000);
> +				mdelay(10);
> +				omap_ehci_phy_reset(0, 1000);
> +#endif

Did you try to first keep the PHY in reset, start the EHCI controller
and then release the reset?

At least this is what is done in the Linux kernel to get it to work.

>  			}
>  			break;
>  		case USB_PORT_FEAT_RESET:
> diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
> index 17f2214..68add44 100644
> --- a/drivers/usb/host/ehci-omap.c
> +++ b/drivers/usb/host/ehci-omap.c
> @@ -109,7 +109,7 @@ int board_usb_init(void) __attribute__((weak, alias("__board_usb_init")));
>  #if defined(CONFIG_OMAP_EHCI_PHY1_RESET_GPIO) || \
>  	defined(CONFIG_OMAP_EHCI_PHY2_RESET_GPIO)
>  /* controls PHY(s) reset signal(s) */
> -static inline void omap_ehci_phy_reset(int on, int delay)
> +void omap_ehci_phy_reset(int on, int delay)
>  {
>  	/*
>  	 * Refer ISSUE1:
> 

cheers,
-roger
Dan Murphy - July 10, 2013, 6:47 p.m.
On 07/09/2013 04:59 AM, Roger Quadros wrote:
> On 07/08/2013 11:59 PM, Dan Murphy wrote:
>> Need to check why gpio toggling in ehci-omap is not
>> working and works only from ehci-hcd.
> do you mean HSIC detection is not working?
>
> GPIO toggling has to work from anywhere.
GPIO toggling does work.  I have confirmed that.
The issue seems to be that the Ethernet controller does not enumerate after the power power has been set.

It seems like the IC needs to be reset once the port power is set so it can enumerate.

The USB3530 on port 2 does not seem to have an issue.  Need to find out if this is a 9730 IC quirk.
>
>> Signed-off-by: Dan Murphy <dmurphy@ti.com>
>> ---
>>  drivers/usb/host/ehci-hcd.c  |    7 ++++++-
>>  drivers/usb/host/ehci-omap.c |    2 +-
>>  2 files changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
>> index 706cf0c..17d0c9c 100644
>> --- a/drivers/usb/host/ehci-hcd.c
>> +++ b/drivers/usb/host/ehci-hcd.c
>> @@ -29,7 +29,7 @@
>>  #include <malloc.h>
>>  #include <watchdog.h>
>>  #include <linux/compiler.h>
>> -
>> +#include <asm/ehci-omap.h>
>>  #include "ehci.h"
>>  
>>  #ifndef CONFIG_USB_MAX_CONTROLLER_COUNT
>> @@ -776,6 +776,11 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
>>  			if (HCS_PPC(ehci_readl(&ctrl->hccr->cr_hcsparams))) {
>>  				reg |= EHCI_PS_PP;
>>  				ehci_writel(status_reg, reg);
>> +#ifdef CONFIG_USB_EHCI_OMAP
>> +				omap_ehci_phy_reset(1, 1000);
>> +				mdelay(10);
>> +				omap_ehci_phy_reset(0, 1000);
>> +#endif
> Did you try to first keep the PHY in reset, start the EHCI controller
> and then release the reset?
Yes I have and thats what uBoot already does.  No dice there.
>
> At least this is what is done in the Linux kernel to get it to work.
>
>>  			}
>>  			break;
>>  		case USB_PORT_FEAT_RESET:
>> diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
>> index 17f2214..68add44 100644
>> --- a/drivers/usb/host/ehci-omap.c
>> +++ b/drivers/usb/host/ehci-omap.c
>> @@ -109,7 +109,7 @@ int board_usb_init(void) __attribute__((weak, alias("__board_usb_init")));
>>  #if defined(CONFIG_OMAP_EHCI_PHY1_RESET_GPIO) || \
>>  	defined(CONFIG_OMAP_EHCI_PHY2_RESET_GPIO)
>>  /* controls PHY(s) reset signal(s) */
>> -static inline void omap_ehci_phy_reset(int on, int delay)
>> +void omap_ehci_phy_reset(int on, int delay)
>>  {
>>  	/*
>>  	 * Refer ISSUE1:
>>
> cheers,
> -roger

Patch

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 706cf0c..17d0c9c 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -29,7 +29,7 @@ 
 #include <malloc.h>
 #include <watchdog.h>
 #include <linux/compiler.h>
-
+#include <asm/ehci-omap.h>
 #include "ehci.h"
 
 #ifndef CONFIG_USB_MAX_CONTROLLER_COUNT
@@ -776,6 +776,11 @@  ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
 			if (HCS_PPC(ehci_readl(&ctrl->hccr->cr_hcsparams))) {
 				reg |= EHCI_PS_PP;
 				ehci_writel(status_reg, reg);
+#ifdef CONFIG_USB_EHCI_OMAP
+				omap_ehci_phy_reset(1, 1000);
+				mdelay(10);
+				omap_ehci_phy_reset(0, 1000);
+#endif
 			}
 			break;
 		case USB_PORT_FEAT_RESET:
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 17f2214..68add44 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -109,7 +109,7 @@  int board_usb_init(void) __attribute__((weak, alias("__board_usb_init")));
 #if defined(CONFIG_OMAP_EHCI_PHY1_RESET_GPIO) || \
 	defined(CONFIG_OMAP_EHCI_PHY2_RESET_GPIO)
 /* controls PHY(s) reset signal(s) */
-static inline void omap_ehci_phy_reset(int on, int delay)
+void omap_ehci_phy_reset(int on, int delay)
 {
 	/*
 	 * Refer ISSUE1: