Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps

2015-02-09 Thread Bin Liu
On Mon, Feb 9, 2015 at 12:39 PM, Tony Lindgren  wrote:
> * Bin Liu  [150206 10:21]:
>> Tony,
>>
>> On Fri, Feb 6, 2015 at 11:23 AM, Tony Lindgren  wrote:
>> > * George Cherian  [150206 05:05]:
>> >> Hi Tony,
>> >>
>> >> You also need to add similar things in dsps_musb_reset();
>> >>
>> >> Otherwise you might not recover from a BABBLE condition.
>> >
>> > Thank I totally missed that, updated patch below.
>> >
>> > Do you have some testcase that easily triggers BABBLE
>> > on MUSB?
>>
>> I normally just shorten DP or DM to VBUS to trigger babble. No device
>> is connected to the port, if I remembered correctly.
>
> Oh OK, that sounds a bit risky with 5V on the VBUS if a
> device is detected? I think I'll wait on that :)

Sorry, 'shorten' is not a good work for what I did. Just use a wire to
quickly touch DP or DM to VBUS, which pulls up DP/DM shortly, but long
enough to cross SOF to generate a babble.

Regards,
-Bin.

>
> Regards,
>
> Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps

2015-02-09 Thread Tony Lindgren
* George Cherian  [150208 22:02]:
> Hi Tony,
> On 02/06/2015 10:53 PM, Tony Lindgren wrote:
> >* George Cherian  [150206 05:05]:
> >>Hi Tony,
> >>
> >>You also need to add similar things in dsps_musb_reset();
> >>
> >>Otherwise you might not recover from a BABBLE condition.
> >Thank I totally missed that, updated patch below.
> >
> >Do you have some testcase that easily triggers BABBLE
> >on MUSB?
> On a BBB or BBW you can connect a HUB with multiple device connected on HUB.
> Then do a repeated Connect and Disconnect of the HUB, This should trigger a
> BABBLE interrupt.
> Not all HUB's might not lead you to a BABBLE condition.

OK thanks will keep my eyes open, so far have not been able
to trigger it here with the two hubs I've tried.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps

2015-02-09 Thread Tony Lindgren
* Bin Liu  [150206 10:21]:
> Tony,
> 
> On Fri, Feb 6, 2015 at 11:23 AM, Tony Lindgren  wrote:
> > * George Cherian  [150206 05:05]:
> >> Hi Tony,
> >>
> >> You also need to add similar things in dsps_musb_reset();
> >>
> >> Otherwise you might not recover from a BABBLE condition.
> >
> > Thank I totally missed that, updated patch below.
> >
> > Do you have some testcase that easily triggers BABBLE
> > on MUSB?
> 
> I normally just shorten DP or DM to VBUS to trigger babble. No device
> is connected to the port, if I remembered correctly.

Oh OK, that sounds a bit risky with 5V on the VBUS if a
device is detected? I think I'll wait on that :)

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps

2015-02-08 Thread George Cherian

Hi Tony,
On 02/06/2015 10:53 PM, Tony Lindgren wrote:

* George Cherian  [150206 05:05]:

Hi Tony,

You also need to add similar things in dsps_musb_reset();

Otherwise you might not recover from a BABBLE condition.

Thank I totally missed that, updated patch below.

Do you have some testcase that easily triggers BABBLE
on MUSB?

On a BBB or BBW you can connect a HUB with multiple device connected on HUB.
Then do a repeated Connect and Disconnect of the HUB, This should 
trigger a BABBLE interrupt.

Not all HUB's might not lead you to a BABBLE condition.


Regards,

Tony

8< --
From: Tony Lindgren 
Date: Wed, 4 Feb 2015 06:28:49 -0800
Subject: [PATCH] usb: musb: Fix getting a generic phy for musb_dsps

We still have a combination of legacy phys and generic phys in
use so we need to support both types of phy for musb_dsps.c.

Cc: Brian Hutchinson 
Signed-off-by: Tony Lindgren 

--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -457,12 +457,27 @@ static int dsps_musb_init(struct musb *musb)
if (IS_ERR(musb->xceiv))
return PTR_ERR(musb->xceiv);
  
+	musb->phy = devm_phy_get(dev->parent, "usb2-phy");

+
/* Returns zero if e.g. not clocked */
rev = dsps_readl(reg_base, wrp->revision);
if (!rev)
return -ENODEV;
  
  	usb_phy_init(musb->xceiv);

+   if (IS_ERR(musb->phy))  {
+   musb->phy = NULL;
+   } else {
+   ret = phy_init(musb->phy);
+   if (ret < 0)
+   return ret;
+   ret = phy_power_on(musb->phy);
+   if (ret) {
+   phy_exit(musb->phy);
+   return ret;
+   }
+   }
+
setup_timer(&glue->timer, otg_timer, (unsigned long) musb);
  
  	/* Reset the musb */

@@ -502,6 +517,8 @@ static int dsps_musb_exit(struct musb *musb)
  
  	del_timer_sync(&glue->timer);

usb_phy_shutdown(musb->xceiv);
+   phy_power_off(musb->phy);
+   phy_exit(musb->phy);
debugfs_remove_recursive(glue->dbgfs_root);
  
  	return 0;

@@ -610,7 +627,7 @@ static int dsps_musb_reset(struct musb *musb)
struct device *dev = musb->controller;
struct dsps_glue *glue = dev_get_drvdata(dev->parent);
const struct dsps_musb_wrapper *wrp = glue->wrp;
-   int session_restart = 0;
+   int session_restart = 0, error;
  
  	if (glue->sw_babble_enabled)

session_restart = sw_babble_control(musb);
@@ -624,8 +641,14 @@ static int dsps_musb_reset(struct musb *musb)
dsps_writel(musb->ctrl_base, wrp->control, (1 << wrp->reset));
usleep_range(100, 200);
usb_phy_shutdown(musb->xceiv);
+   error = phy_power_off(musb->phy);
+   if (error)
+   dev_err(dev, "phy shutdown failed: %i\n", error);
usleep_range(100, 200);
usb_phy_init(musb->xceiv);
+   error = phy_power_on(musb->phy);
+   if (error)
+   dev_err(dev, "phy powerup failed: %i\n", error);
session_restart = 1;
}
  


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps

2015-02-06 Thread Tony Lindgren
* George Cherian  [150206 05:05]:
> Hi Tony,
> 
> You also need to add similar things in dsps_musb_reset();
> 
> Otherwise you might not recover from a BABBLE condition.

Thank I totally missed that, updated patch below.

Do you have some testcase that easily triggers BABBLE
on MUSB?

Regards,

Tony

8< --
From: Tony Lindgren 
Date: Wed, 4 Feb 2015 06:28:49 -0800
Subject: [PATCH] usb: musb: Fix getting a generic phy for musb_dsps

We still have a combination of legacy phys and generic phys in
use so we need to support both types of phy for musb_dsps.c.

Cc: Brian Hutchinson 
Signed-off-by: Tony Lindgren 

--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -457,12 +457,27 @@ static int dsps_musb_init(struct musb *musb)
if (IS_ERR(musb->xceiv))
return PTR_ERR(musb->xceiv);
 
+   musb->phy = devm_phy_get(dev->parent, "usb2-phy");
+
/* Returns zero if e.g. not clocked */
rev = dsps_readl(reg_base, wrp->revision);
if (!rev)
return -ENODEV;
 
usb_phy_init(musb->xceiv);
+   if (IS_ERR(musb->phy))  {
+   musb->phy = NULL;
+   } else {
+   ret = phy_init(musb->phy);
+   if (ret < 0)
+   return ret;
+   ret = phy_power_on(musb->phy);
+   if (ret) {
+   phy_exit(musb->phy);
+   return ret;
+   }
+   }
+
setup_timer(&glue->timer, otg_timer, (unsigned long) musb);
 
/* Reset the musb */
@@ -502,6 +517,8 @@ static int dsps_musb_exit(struct musb *musb)
 
del_timer_sync(&glue->timer);
usb_phy_shutdown(musb->xceiv);
+   phy_power_off(musb->phy);
+   phy_exit(musb->phy);
debugfs_remove_recursive(glue->dbgfs_root);
 
return 0;
@@ -610,7 +627,7 @@ static int dsps_musb_reset(struct musb *musb)
struct device *dev = musb->controller;
struct dsps_glue *glue = dev_get_drvdata(dev->parent);
const struct dsps_musb_wrapper *wrp = glue->wrp;
-   int session_restart = 0;
+   int session_restart = 0, error;
 
if (glue->sw_babble_enabled)
session_restart = sw_babble_control(musb);
@@ -624,8 +641,14 @@ static int dsps_musb_reset(struct musb *musb)
dsps_writel(musb->ctrl_base, wrp->control, (1 << wrp->reset));
usleep_range(100, 200);
usb_phy_shutdown(musb->xceiv);
+   error = phy_power_off(musb->phy);
+   if (error)
+   dev_err(dev, "phy shutdown failed: %i\n", error);
usleep_range(100, 200);
usb_phy_init(musb->xceiv);
+   error = phy_power_on(musb->phy);
+   if (error)
+   dev_err(dev, "phy powerup failed: %i\n", error);
session_restart = 1;
}
 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps

2015-02-06 Thread Bin Liu
Tony,

On Fri, Feb 6, 2015 at 11:23 AM, Tony Lindgren  wrote:
> * George Cherian  [150206 05:05]:
>> Hi Tony,
>>
>> You also need to add similar things in dsps_musb_reset();
>>
>> Otherwise you might not recover from a BABBLE condition.
>
> Thank I totally missed that, updated patch below.
>
> Do you have some testcase that easily triggers BABBLE
> on MUSB?

I normally just shorten DP or DM to VBUS to trigger babble. No device
is connected to the port, if I remembered correctly.

Regards,
-Bin.

>
> Regards,
>
> Tony
>
> 8< --
> From: Tony Lindgren 
> Date: Wed, 4 Feb 2015 06:28:49 -0800
> Subject: [PATCH] usb: musb: Fix getting a generic phy for musb_dsps
>
> We still have a combination of legacy phys and generic phys in
> use so we need to support both types of phy for musb_dsps.c.
>
> Cc: Brian Hutchinson 
> Signed-off-by: Tony Lindgren 
>
> --- a/drivers/usb/musb/musb_dsps.c
> +++ b/drivers/usb/musb/musb_dsps.c
> @@ -457,12 +457,27 @@ static int dsps_musb_init(struct musb *musb)
> if (IS_ERR(musb->xceiv))
> return PTR_ERR(musb->xceiv);
>
> +   musb->phy = devm_phy_get(dev->parent, "usb2-phy");
> +
> /* Returns zero if e.g. not clocked */
> rev = dsps_readl(reg_base, wrp->revision);
> if (!rev)
> return -ENODEV;
>
> usb_phy_init(musb->xceiv);
> +   if (IS_ERR(musb->phy))  {
> +   musb->phy = NULL;
> +   } else {
> +   ret = phy_init(musb->phy);
> +   if (ret < 0)
> +   return ret;
> +   ret = phy_power_on(musb->phy);
> +   if (ret) {
> +   phy_exit(musb->phy);
> +   return ret;
> +   }
> +   }
> +
> setup_timer(&glue->timer, otg_timer, (unsigned long) musb);
>
> /* Reset the musb */
> @@ -502,6 +517,8 @@ static int dsps_musb_exit(struct musb *musb)
>
> del_timer_sync(&glue->timer);
> usb_phy_shutdown(musb->xceiv);
> +   phy_power_off(musb->phy);
> +   phy_exit(musb->phy);
> debugfs_remove_recursive(glue->dbgfs_root);
>
> return 0;
> @@ -610,7 +627,7 @@ static int dsps_musb_reset(struct musb *musb)
> struct device *dev = musb->controller;
> struct dsps_glue *glue = dev_get_drvdata(dev->parent);
> const struct dsps_musb_wrapper *wrp = glue->wrp;
> -   int session_restart = 0;
> +   int session_restart = 0, error;
>
> if (glue->sw_babble_enabled)
> session_restart = sw_babble_control(musb);
> @@ -624,8 +641,14 @@ static int dsps_musb_reset(struct musb *musb)
> dsps_writel(musb->ctrl_base, wrp->control, (1 << wrp->reset));
> usleep_range(100, 200);
> usb_phy_shutdown(musb->xceiv);
> +   error = phy_power_off(musb->phy);
> +   if (error)
> +   dev_err(dev, "phy shutdown failed: %i\n", error);
> usleep_range(100, 200);
> usb_phy_init(musb->xceiv);
> +   error = phy_power_on(musb->phy);
> +   if (error)
> +   dev_err(dev, "phy powerup failed: %i\n", error);
> session_restart = 1;
> }
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps

2015-02-06 Thread George Cherian

Hi Tony,

You also need to add similar things in dsps_musb_reset();

Otherwise you might not recover from a BABBLE condition.

On 02/05/2015 10:05 PM, Tony Lindgren wrote:

We still have a combination of legacy phys and generic phys in
use so we need to support both types of phy for musb_dsps.c.

Cc: Brian Hutchinson 
Signed-off-by: Tony Lindgren 
---
  drivers/usb/musb/musb_dsps.c | 17 +
  1 file changed, 17 insertions(+)

--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -457,12 +457,25 @@ static int dsps_musb_init(struct musb *musb)
if (IS_ERR(musb->xceiv))
return PTR_ERR(musb->xceiv);
  
+	musb->phy = devm_phy_get(dev->parent, "usb2-phy");

+
/* Returns zero if e.g. not clocked */
rev = dsps_readl(reg_base, wrp->revision);
if (!rev)
return -ENODEV;
  
  	usb_phy_init(musb->xceiv);

+   if (IS_ERR(musb->phy))  {
+   musb->phy = NULL;
+   } else {
+   ret = phy_init(musb->phy);
+   if (ret < 0)
+   return ret;
+   ret = phy_power_on(musb->phy);
+   if (ret)
+   return ret;
+   }
+
setup_timer(&glue->timer, otg_timer, (unsigned long) musb);
  
  	/* Reset the musb */

@@ -502,6 +515,10 @@ static int dsps_musb_exit(struct musb *musb)
  
  	del_timer_sync(&glue->timer);

usb_phy_shutdown(musb->xceiv);
+   if (musb->phy) {
+   phy_power_off(musb->phy);
+   phy_exit(musb->phy);
+   }
debugfs_remove_recursive(glue->dbgfs_root);
  
  	return 0;

-George

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps

2015-02-05 Thread Tony Lindgren
We still have a combination of legacy phys and generic phys in
use so we need to support both types of phy for musb_dsps.c.

Cc: Brian Hutchinson 
Signed-off-by: Tony Lindgren 
---
 drivers/usb/musb/musb_dsps.c | 17 +
 1 file changed, 17 insertions(+)

--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -457,12 +457,25 @@ static int dsps_musb_init(struct musb *musb)
if (IS_ERR(musb->xceiv))
return PTR_ERR(musb->xceiv);
 
+   musb->phy = devm_phy_get(dev->parent, "usb2-phy");
+
/* Returns zero if e.g. not clocked */
rev = dsps_readl(reg_base, wrp->revision);
if (!rev)
return -ENODEV;
 
usb_phy_init(musb->xceiv);
+   if (IS_ERR(musb->phy))  {
+   musb->phy = NULL;
+   } else {
+   ret = phy_init(musb->phy);
+   if (ret < 0)
+   return ret;
+   ret = phy_power_on(musb->phy);
+   if (ret)
+   return ret;
+   }
+
setup_timer(&glue->timer, otg_timer, (unsigned long) musb);
 
/* Reset the musb */
@@ -502,6 +515,10 @@ static int dsps_musb_exit(struct musb *musb)
 
del_timer_sync(&glue->timer);
usb_phy_shutdown(musb->xceiv);
+   if (musb->phy) {
+   phy_power_off(musb->phy);
+   phy_exit(musb->phy);
+   }
debugfs_remove_recursive(glue->dbgfs_root);
 
return 0;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html