linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] MUSB fix for disabled multipoint and generic phy
@ 2015-02-05 16:35 Tony Lindgren
  2015-02-05 16:35 ` [PATCH 1/2] usb: musb: Fix use for of_property_read_bool for disabled multipoint Tony Lindgren
  2015-02-05 16:35 ` [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps Tony Lindgren
  0 siblings, 2 replies; 12+ messages in thread
From: Tony Lindgren @ 2015-02-05 16:35 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-usb, linux-omap

Hi,

Here are two fixes, the first one probably should be Cc stable.

Regards,

Tony


Tony Lindgren (2):
  usb: musb: Fix use for of_property_read_bool for disabled multipoint
  usb: musb: Fix getting a generic phy for musb_dsps

 drivers/usb/musb/musb_dsps.c | 24 ++++++++++++++++++++++--
 drivers/usb/musb/omap2430.c  |  7 +++++--
 2 files changed, 27 insertions(+), 4 deletions(-)

-- 
2.1.4


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

* [PATCH 1/2] usb: musb: Fix use for of_property_read_bool for disabled multipoint
  2015-02-05 16:35 [PATCH 0/2] MUSB fix for disabled multipoint and generic phy Tony Lindgren
@ 2015-02-05 16:35 ` Tony Lindgren
  2015-02-05 18:09   ` Felipe Balbi
  2015-02-05 16:35 ` [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps Tony Lindgren
  1 sibling, 1 reply; 12+ messages in thread
From: Tony Lindgren @ 2015-02-05 16:35 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-usb, linux-omap, Brian Hutchinson

The value for the multipoint dts property is ignored when parsing with
of_property_read_bool, so we currently have multipoint always set as 1
even if value 0 is specified in the dts file.

Let's fix this to read the value too instead of just the property like
the binding documentation says as otherwise MUSB will fail to work
on devices with Mentor configuration that does not support multipoint.

Cc: Brian Hutchinson <b.hutchman@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/usb/musb/musb_dsps.c | 7 +++++--
 drivers/usb/musb/omap2430.c  | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -687,7 +687,7 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
 	struct musb_hdrc_config	*config;
 	struct platform_device *musb;
 	struct device_node *dn = parent->dev.of_node;
-	int ret;
+	int ret, val;
 
 	memset(resources, 0, sizeof(resources));
 	res = platform_get_resource_byname(parent, IORESOURCE_MEM, "mc");
@@ -739,7 +739,10 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
 	pdata.mode = get_musb_port_mode(dev);
 	/* DT keeps this entry in mA, musb expects it as per USB spec */
 	pdata.power = get_int_prop(dn, "mentor,power") / 2;
-	config->multipoint = of_property_read_bool(dn, "mentor,multipoint");
+
+	ret = of_property_read_u8(dn, "mentor,multipoint", &val);
+	if (!ret && val)
+		config->multipoint = true;
 
 	ret = platform_device_add_data(musb, &pdata, sizeof(pdata));
 	if (ret) {
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -516,7 +516,7 @@ static int omap2430_probe(struct platform_device *pdev)
 	struct omap2430_glue		*glue;
 	struct device_node		*np = pdev->dev.of_node;
 	struct musb_hdrc_config		*config;
-	int				ret = -ENOMEM;
+	int				ret = -ENOMEM, val;
 
 	glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL);
 	if (!glue)
@@ -559,7 +559,10 @@ static int omap2430_probe(struct platform_device *pdev)
 		of_property_read_u32(np, "num-eps", (u32 *)&config->num_eps);
 		of_property_read_u32(np, "ram-bits", (u32 *)&config->ram_bits);
 		of_property_read_u32(np, "power", (u32 *)&pdata->power);
-		config->multipoint = of_property_read_bool(np, "multipoint");
+
+		ret = of_property_read_u8(np, "multipoint", &val);
+		if (!ret && val)
+			config->multipoint = true;
 
 		pdata->board_data	= data;
 		pdata->config		= config;
-- 
2.1.4


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

* [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps
  2015-02-05 16:35 [PATCH 0/2] MUSB fix for disabled multipoint and generic phy Tony Lindgren
  2015-02-05 16:35 ` [PATCH 1/2] usb: musb: Fix use for of_property_read_bool for disabled multipoint Tony Lindgren
@ 2015-02-05 16:35 ` Tony Lindgren
       [not found]   ` <1423154113-23463-3-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  1 sibling, 1 reply; 12+ messages in thread
From: Tony Lindgren @ 2015-02-05 16:35 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-usb, linux-omap, Brian Hutchinson

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 <b.hutchman@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 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


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

* Re: [PATCH 1/2] usb: musb: Fix use for of_property_read_bool for disabled multipoint
  2015-02-05 16:35 ` [PATCH 1/2] usb: musb: Fix use for of_property_read_bool for disabled multipoint Tony Lindgren
@ 2015-02-05 18:09   ` Felipe Balbi
  2015-02-05 19:13     ` Tony Lindgren
  0 siblings, 1 reply; 12+ messages in thread
From: Felipe Balbi @ 2015-02-05 18:09 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Felipe Balbi, linux-usb, linux-omap, Brian Hutchinson

[-- Attachment #1: Type: text/plain, Size: 805 bytes --]

On Thu, Feb 05, 2015 at 08:35:12AM -0800, Tony Lindgren wrote:
> The value for the multipoint dts property is ignored when parsing with
> of_property_read_bool, so we currently have multipoint always set as 1
> even if value 0 is specified in the dts file.
> 
> Let's fix this to read the value too instead of just the property like
> the binding documentation says as otherwise MUSB will fail to work
> on devices with Mentor configuration that does not support multipoint.
> 
> Cc: Brian Hutchinson <b.hutchman@gmail.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

do you mind waiting a little bit to see if my boolean properties with
value patch is accepted ?

http://marc.info/?l=linux-omap&m=142315930232743&w=2

At least let's see where the discussion moves.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 1/2] usb: musb: Fix use for of_property_read_bool for disabled multipoint
  2015-02-05 18:09   ` Felipe Balbi
@ 2015-02-05 19:13     ` Tony Lindgren
  0 siblings, 0 replies; 12+ messages in thread
From: Tony Lindgren @ 2015-02-05 19:13 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-usb, linux-omap, Brian Hutchinson

* Felipe Balbi <balbi@ti.com> [150205 10:12]:
> On Thu, Feb 05, 2015 at 08:35:12AM -0800, Tony Lindgren wrote:
> > The value for the multipoint dts property is ignored when parsing with
> > of_property_read_bool, so we currently have multipoint always set as 1
> > even if value 0 is specified in the dts file.
> > 
> > Let's fix this to read the value too instead of just the property like
> > the binding documentation says as otherwise MUSB will fail to work
> > on devices with Mentor configuration that does not support multipoint.
> > 
> > Cc: Brian Hutchinson <b.hutchman@gmail.com>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> do you mind waiting a little bit to see if my boolean properties with
> value patch is accepted ?

This can wait for v3.20-rc1 for sure but cc stable would be nice to
avoid more pointless debugging by somebody else.
 
> http://marc.info/?l=linux-omap&m=142315930232743&w=2
> 
> At least let's see where the discussion moves.

Cool yeah at least a warning should be printed, sounds like it may
not be usable for fixing $subject though.

I also noticed that a last minute change I did from read_u32 to
read_u8 in $subject patch broke things and introduced new build
warnings. Here's a fixed version back to using read_u32 instead
of read_u8 so we don't need to specify the storage size with
/bits/ 8 values in the dts files.

Regards,

Tony

8< ------------------------
From: Tony Lindgren <tony@atomide.com>
Date: Wed, 4 Feb 2015 06:28:49 -0800
Subject: [PATCH] usb: musb: Fix use for of_property_read_bool for disabled multipoint

The value for the multipoint dts property is ignored when parsing with
of_property_read_bool, so we currently have multipoint always set as 1
even if value 0 is specified in the dts file.

Let's fix this to read the value too instead of just the property like
the binding documentation says as otherwise MUSB will fail to work
on devices with Mentor configuration that does not support multipoint.

Cc: Brian Hutchinson <b.hutchman@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>

--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -687,7 +687,7 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
 	struct musb_hdrc_config	*config;
 	struct platform_device *musb;
 	struct device_node *dn = parent->dev.of_node;
-	int ret;
+	int ret, val;
 
 	memset(resources, 0, sizeof(resources));
 	res = platform_get_resource_byname(parent, IORESOURCE_MEM, "mc");
@@ -739,7 +739,10 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
 	pdata.mode = get_musb_port_mode(dev);
 	/* DT keeps this entry in mA, musb expects it as per USB spec */
 	pdata.power = get_int_prop(dn, "mentor,power") / 2;
-	config->multipoint = of_property_read_bool(dn, "mentor,multipoint");
+
+	ret = of_property_read_u32(dn, "mentor,multipoint", &val);
+	if (!ret && val)
+		config->multipoint = true;
 
 	ret = platform_device_add_data(musb, &pdata, sizeof(pdata));
 	if (ret) {
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -516,7 +516,7 @@ static int omap2430_probe(struct platform_device *pdev)
 	struct omap2430_glue		*glue;
 	struct device_node		*np = pdev->dev.of_node;
 	struct musb_hdrc_config		*config;
-	int				ret = -ENOMEM;
+	int				ret = -ENOMEM, val;
 
 	glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL);
 	if (!glue)
@@ -559,7 +559,10 @@ static int omap2430_probe(struct platform_device *pdev)
 		of_property_read_u32(np, "num-eps", (u32 *)&config->num_eps);
 		of_property_read_u32(np, "ram-bits", (u32 *)&config->ram_bits);
 		of_property_read_u32(np, "power", (u32 *)&pdata->power);
-		config->multipoint = of_property_read_bool(np, "multipoint");
+
+		ret = of_property_read_u32(np, "multipoint", &val);
+		if (!ret && val)
+			config->multipoint = true;
 
 		pdata->board_data	= data;
 		pdata->config		= config;

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

* Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps
       [not found]   ` <1423154113-23463-3-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
@ 2015-02-06 12:58     ` George Cherian
  2015-02-06 17:23       ` Tony Lindgren
  0 siblings, 1 reply; 12+ messages in thread
From: George Cherian @ 2015-02-06 12:58 UTC (permalink / raw)
  To: Tony Lindgren, Felipe Balbi
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Brian Hutchinson

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 <b.hutchman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
> ---
>   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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps
  2015-02-06 12:58     ` George Cherian
@ 2015-02-06 17:23       ` Tony Lindgren
  2015-02-06 18:18         ` Bin Liu
       [not found]         ` <20150206172313.GF25235-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 2 replies; 12+ messages in thread
From: Tony Lindgren @ 2015-02-06 17:23 UTC (permalink / raw)
  To: George Cherian; +Cc: Felipe Balbi, linux-usb, linux-omap, Brian Hutchinson

* George Cherian <george.cherian@ti.com> [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 <tony@atomide.com>
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 <b.hutchman@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>

--- 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;
 	}
 

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

* Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps
  2015-02-06 17:23       ` Tony Lindgren
@ 2015-02-06 18:18         ` Bin Liu
       [not found]           ` <CADYTM3brwenr4706Xqp91Vg7OVxT0CENy8aHhyzJ+vOGxxvRVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
       [not found]         ` <20150206172313.GF25235-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  1 sibling, 1 reply; 12+ messages in thread
From: Bin Liu @ 2015-02-06 18:18 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: George Cherian, Felipe Balbi, linux-usb, linux-omap,
	Brian Hutchinson

Tony,

On Fri, Feb 6, 2015 at 11:23 AM, Tony Lindgren <tony@atomide.com> wrote:
> * George Cherian <george.cherian@ti.com> [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 <tony@atomide.com>
> 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 <b.hutchman@gmail.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
>
> --- 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps
       [not found]         ` <20150206172313.GF25235-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
@ 2015-02-09  5:56           ` George Cherian
       [not found]             ` <54D84BF3.7060801-l0cyMroinI0@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: George Cherian @ 2015-02-09  5:56 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Felipe Balbi, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Brian Hutchinson

Hi Tony,
On 02/06/2015 10:53 PM, Tony Lindgren wrote:
> * George Cherian <george.cherian-l0cyMroinI0@public.gmane.org> [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 <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
> 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 <b.hutchman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
>
> --- 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps
       [not found]           ` <CADYTM3brwenr4706Xqp91Vg7OVxT0CENy8aHhyzJ+vOGxxvRVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-02-09 18:39             ` Tony Lindgren
  2015-02-09 19:02               ` Bin Liu
  0 siblings, 1 reply; 12+ messages in thread
From: Tony Lindgren @ 2015-02-09 18:39 UTC (permalink / raw)
  To: Bin Liu
  Cc: George Cherian, Felipe Balbi, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Brian Hutchinson

* Bin Liu <binmlist-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> [150206 10:21]:
> Tony,
> 
> On Fri, Feb 6, 2015 at 11:23 AM, Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> wrote:
> > * George Cherian <george.cherian-l0cyMroinI0@public.gmane.org> [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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps
       [not found]             ` <54D84BF3.7060801-l0cyMroinI0@public.gmane.org>
@ 2015-02-09 18:40               ` Tony Lindgren
  0 siblings, 0 replies; 12+ messages in thread
From: Tony Lindgren @ 2015-02-09 18:40 UTC (permalink / raw)
  To: George Cherian
  Cc: Felipe Balbi, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Brian Hutchinson

* George Cherian <george.cherian-l0cyMroinI0@public.gmane.org> [150208 22:02]:
> Hi Tony,
> On 02/06/2015 10:53 PM, Tony Lindgren wrote:
> >* George Cherian <george.cherian-l0cyMroinI0@public.gmane.org> [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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps
  2015-02-09 18:39             ` Tony Lindgren
@ 2015-02-09 19:02               ` Bin Liu
  0 siblings, 0 replies; 12+ messages in thread
From: Bin Liu @ 2015-02-09 19:02 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: George Cherian, Felipe Balbi, linux-usb, linux-omap,
	Brian Hutchinson

On Mon, Feb 9, 2015 at 12:39 PM, Tony Lindgren <tony@atomide.com> wrote:
> * Bin Liu <binmlist@gmail.com> [150206 10:21]:
>> Tony,
>>
>> On Fri, Feb 6, 2015 at 11:23 AM, Tony Lindgren <tony@atomide.com> wrote:
>> > * George Cherian <george.cherian@ti.com> [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

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

end of thread, other threads:[~2015-02-09 19:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-05 16:35 [PATCH 0/2] MUSB fix for disabled multipoint and generic phy Tony Lindgren
2015-02-05 16:35 ` [PATCH 1/2] usb: musb: Fix use for of_property_read_bool for disabled multipoint Tony Lindgren
2015-02-05 18:09   ` Felipe Balbi
2015-02-05 19:13     ` Tony Lindgren
2015-02-05 16:35 ` [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps Tony Lindgren
     [not found]   ` <1423154113-23463-3-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2015-02-06 12:58     ` George Cherian
2015-02-06 17:23       ` Tony Lindgren
2015-02-06 18:18         ` Bin Liu
     [not found]           ` <CADYTM3brwenr4706Xqp91Vg7OVxT0CENy8aHhyzJ+vOGxxvRVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-02-09 18:39             ` Tony Lindgren
2015-02-09 19:02               ` Bin Liu
     [not found]         ` <20150206172313.GF25235-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2015-02-09  5:56           ` George Cherian
     [not found]             ` <54D84BF3.7060801-l0cyMroinI0@public.gmane.org>
2015-02-09 18:40               ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).