2013-03-14 06:24:15

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: [PATCH v2 0/4] usb: musb/otg: cleanup and fixes

This series has some misc cleanup and fixes. The fix solves the cold
plug issue in omap3 which some have reported. Developed these patches on
fixes-for-v3.9-rc3 after applying
http://www.spinics.net/lists/linux-usb/msg81563.html
(Grazvydas Ignotas patch series)

Tested for g_zero enumeration in pandaboard and beagleboard in both
cold plug and hot plug case. Any kind of testing for this series is welcome.

Changes from v1:
* removed *usb: musb: omap: remove the check before calling otg_set_vbus*
a similar patch is already merged.

Kishon Vijay Abraham I (4):
usb: musb: omap: remove the check before calling otg_set_vbus
usb: otg: twl4030: use devres API for regulator get and request irq
usb: musb: omap: add usb_phy_init in omap2430_musb_init
usb: otg: twl4030: fix cold plug on OMAP3

drivers/usb/musb/omap2430.c | 11 +++++------
drivers/usb/otg/twl4030-usb.c | 35 ++++++++++++-----------------------
2 files changed, 17 insertions(+), 29 deletions(-)

--
1.7.10.4


2013-03-14 06:24:17

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: [PATCH v2 3/4] usb: musb: omap: add usb_phy_init in omap2430_musb_init

Some PHYs load too early (twl4030) making omap glue to miss cable connect events
if the board is booted with cable connected. So adding usb_phy_init in
omap2430_musb_init lets PHYs to report events once glue is ready.

Signed-off-by: Kishon Vijay Abraham I <[email protected]>
---
drivers/usb/musb/omap2430.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 6071484..8876741 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -391,6 +391,8 @@ static int omap2430_musb_init(struct musb *musb)
if (glue->status != OMAP_MUSB_UNKNOWN)
omap_musb_set_mailbox(glue);

+ usb_phy_init(musb->xceiv);
+
pm_runtime_put_noidle(musb->controller);
return 0;

--
1.7.10.4

2013-03-14 06:24:16

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: [PATCH v2 4/4] usb: otg: twl4030: fix cold plug on OMAP3

Having twl4030_usb_phy_init() (detects if a cable is connected before
twl4030 is probed) in twl4030 probe makes cable connect events to be
missed by musb glue, since it gets loaded after twl4030. Having
twl4030_usb_phy_init as a usb_phy ops lets twl4030_usb_phy_init to be
called when glue is ready.

Signed-off-by: Kishon Vijay Abraham I <[email protected]>
---
drivers/usb/otg/twl4030-usb.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 5b20bb4..4040124 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -565,8 +565,9 @@ static void twl4030_id_workaround_work(struct work_struct *work)
}
}

-static void twl4030_usb_phy_init(struct twl4030_usb *twl)
+static int twl4030_usb_phy_init(struct usb_phy *phy)
{
+ struct twl4030_usb *twl = phy_to_twl(phy);
enum omap_musb_vbus_id_status status;

/*
@@ -581,6 +582,7 @@ static void twl4030_usb_phy_init(struct twl4030_usb *twl)
omap_musb_mailbox(twl->linkstat);

sysfs_notify(&twl->dev->kobj, NULL, "vbus");
+ return 0;
}

static int twl4030_set_suspend(struct usb_phy *x, int suspend)
@@ -657,6 +659,7 @@ static int twl4030_usb_probe(struct platform_device *pdev)
twl->phy.otg = otg;
twl->phy.type = USB_PHY_TYPE_USB2;
twl->phy.set_suspend = twl4030_set_suspend;
+ twl->phy.init = twl4030_usb_phy_init;

otg->phy = &twl->phy;
otg->set_host = twl4030_set_host;
@@ -696,8 +699,6 @@ static int twl4030_usb_probe(struct platform_device *pdev)
return status;
}

- twl4030_usb_phy_init(twl);
-
dev_info(&pdev->dev, "Initialized TWL4030 USB module\n");
return 0;
}
--
1.7.10.4

2013-03-14 06:24:13

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: [PATCH v2 1/4] usb: musb: omap: remove the check before calling otg_set_vbus

No functional change. otg_set_vbus is already protected so removed the
check before calling otg_set_vbus.

Signed-off-by: Kishon Vijay Abraham I <[email protected]>
---
drivers/usb/musb/omap2430.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 29014c0..6071484 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -174,8 +174,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
}
}

- if (otg->set_vbus)
- otg_set_vbus(otg, 1);
+ otg_set_vbus(otg, 1);
} else {
musb->is_active = 1;
otg->default_a = 1;
@@ -297,10 +296,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
}

omap2430_musb_set_vbus(musb, 0);
- if (data->interface_type == MUSB_INTERFACE_UTMI) {
- if (musb->xceiv->otg->set_vbus)
- otg_set_vbus(musb->xceiv->otg, 0);
- }
+ if (data->interface_type == MUSB_INTERFACE_UTMI)
+ otg_set_vbus(musb->xceiv->otg, 0);
omap_control_usb_set_mode(glue->control_otghs,
USB_MODE_DISCONNECT);
break;
--
1.7.10.4

2013-03-14 06:24:12

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: [PATCH v2 2/4] usb: otg: twl4030: use devres API for regulator get and request irq

Used devres APIs devm_request_threaded_irq and devm_regulator_get for
requesting irq and for getting regulator respectively.

Signed-off-by: Kishon Vijay Abraham I <[email protected]>
---
drivers/usb/otg/twl4030-usb.c | 28 ++++++++--------------------
1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 04b732e2..5b20bb4 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -470,7 +470,7 @@ static int twl4030_usb_ldo_init(struct twl4030_usb *twl)
/* Initialize 3.1V regulator */
twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB3V1_DEV_GRP);

- twl->usb3v1 = regulator_get(twl->dev, "usb3v1");
+ twl->usb3v1 = devm_regulator_get(twl->dev, "usb3v1");
if (IS_ERR(twl->usb3v1))
return -ENODEV;

@@ -479,18 +479,18 @@ static int twl4030_usb_ldo_init(struct twl4030_usb *twl)
/* Initialize 1.5V regulator */
twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB1V5_DEV_GRP);

- twl->usb1v5 = regulator_get(twl->dev, "usb1v5");
+ twl->usb1v5 = devm_regulator_get(twl->dev, "usb1v5");
if (IS_ERR(twl->usb1v5))
- goto fail1;
+ return -ENODEV;

twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB1V5_TYPE);

/* Initialize 1.8V regulator */
twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB1V8_DEV_GRP);

- twl->usb1v8 = regulator_get(twl->dev, "usb1v8");
+ twl->usb1v8 = devm_regulator_get(twl->dev, "usb1v8");
if (IS_ERR(twl->usb1v8))
- goto fail2;
+ return -ENODEV;

twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB1V8_TYPE);

@@ -499,14 +499,6 @@ static int twl4030_usb_ldo_init(struct twl4030_usb *twl)
TWL4030_PM_MASTER_PROTECT_KEY);

return 0;
-
-fail2:
- regulator_put(twl->usb1v5);
- twl->usb1v5 = NULL;
-fail1:
- regulator_put(twl->usb3v1);
- twl->usb3v1 = NULL;
- return -ENODEV;
}

static ssize_t twl4030_usb_vbus_show(struct device *dev,
@@ -695,9 +687,9 @@ static int twl4030_usb_probe(struct platform_device *pdev)
* need both handles, otherwise just one suffices.
*/
twl->irq_enabled = true;
- status = request_threaded_irq(twl->irq, NULL, twl4030_usb_irq,
- IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
- IRQF_ONESHOT, "twl4030_usb", twl);
+ status = devm_request_threaded_irq(twl->dev, twl->irq, NULL,
+ twl4030_usb_irq, IRQF_TRIGGER_FALLING |
+ IRQF_TRIGGER_RISING | IRQF_ONESHOT, "twl4030_usb", twl);
if (status < 0) {
dev_dbg(&pdev->dev, "can't get IRQ %d, err %d\n",
twl->irq, status);
@@ -716,7 +708,6 @@ static int __exit twl4030_usb_remove(struct platform_device *pdev)
int val;

cancel_delayed_work(&twl->id_workaround_work);
- free_irq(twl->irq, twl);
device_remove_file(twl->dev, &dev_attr_vbus);

/* set transceiver mode to power on defaults */
@@ -738,9 +729,6 @@ static int __exit twl4030_usb_remove(struct platform_device *pdev)

if (!twl->asleep)
twl4030_phy_power(twl, 0);
- regulator_put(twl->usb1v5);
- regulator_put(twl->usb1v8);
- regulator_put(twl->usb3v1);

return 0;
}
--
1.7.10.4

2013-03-14 13:33:22

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] usb: musb/otg: cleanup and fixes

On Thu, Mar 14, 2013 at 11:53:55AM +0530, Kishon Vijay Abraham I wrote:
> This series has some misc cleanup and fixes. The fix solves the cold
> plug issue in omap3 which some have reported. Developed these patches on
> fixes-for-v3.9-rc3 after applying
> http://www.spinics.net/lists/linux-usb/msg81563.html
> (Grazvydas Ignotas patch series)
>
> Tested for g_zero enumeration in pandaboard and beagleboard in both
> cold plug and hot plug case. Any kind of testing for this series is welcome.
>
> Changes from v1:
> * removed *usb: musb: omap: remove the check before calling otg_set_vbus*

it's still on your list of patches :-p

> a similar patch is already merged.
>
> Kishon Vijay Abraham I (4):
> usb: musb: omap: remove the check before calling otg_set_vbus

see ^^

please fix it up and when resending add Grazvydas' Tested-by since he
has tested this patchset

--
balbi


Attachments:
(No filename) (887.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments

2013-03-14 14:45:14

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] usb: musb/otg: cleanup and fixes

On Thursday 14 March 2013 07:03 PM, Felipe Balbi wrote:
> On Thu, Mar 14, 2013 at 11:53:55AM +0530, Kishon Vijay Abraham I wrote:
>> This series has some misc cleanup and fixes. The fix solves the cold
>> plug issue in omap3 which some have reported. Developed these patches on
>> fixes-for-v3.9-rc3 after applying
>> http://www.spinics.net/lists/linux-usb/msg81563.html
>> (Grazvydas Ignotas patch series)
>>
>> Tested for g_zero enumeration in pandaboard and beagleboard in both
>> cold plug and hot plug case. Any kind of testing for this series is welcome.
>>
>> Changes from v1:
>> * removed *usb: musb: omap: remove the check before calling otg_set_vbus*

er.. removed *usb: musb: omap: always glue have the correct vbus/id
status* since a patch similar to it is already merged.
>
> it's still on your list of patches :-p
>
>> a similar patch is already merged.
>>
>> Kishon Vijay Abraham I (4):
>> usb: musb: omap: remove the check before calling otg_set_vbus
>
> see ^^
>
> please fix it up and when resending add Grazvydas' Tested-by since he
> has tested this patchset

Ok.

Thanks
Kishon

2013-03-14 14:47:57

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] usb: musb/otg: cleanup and fixes

On Thu, Mar 14, 2013 at 08:15:00PM +0530, kishon wrote:
> On Thursday 14 March 2013 07:03 PM, Felipe Balbi wrote:
> >On Thu, Mar 14, 2013 at 11:53:55AM +0530, Kishon Vijay Abraham I wrote:
> >>This series has some misc cleanup and fixes. The fix solves the cold
> >>plug issue in omap3 which some have reported. Developed these patches on
> >>fixes-for-v3.9-rc3 after applying
> >>http://www.spinics.net/lists/linux-usb/msg81563.html
> >>(Grazvydas Ignotas patch series)
> >>
> >>Tested for g_zero enumeration in pandaboard and beagleboard in both
> >>cold plug and hot plug case. Any kind of testing for this series is welcome.
> >>
> >>Changes from v1:
> >>* removed *usb: musb: omap: remove the check before calling otg_set_vbus*
>
> er.. removed *usb: musb: omap: always glue have the correct vbus/id
> status* since a patch similar to it is already merged.

alright, I'll apply this series soonish.

--
balbi


Attachments:
(No filename) (916.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments

2013-03-14 14:49:01

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] usb: musb/otg: cleanup and fixes

On Thursday 14 March 2013 08:17 PM, Felipe Balbi wrote:
> On Thu, Mar 14, 2013 at 08:15:00PM +0530, kishon wrote:
>> On Thursday 14 March 2013 07:03 PM, Felipe Balbi wrote:
>>> On Thu, Mar 14, 2013 at 11:53:55AM +0530, Kishon Vijay Abraham I wrote:
>>>> This series has some misc cleanup and fixes. The fix solves the cold
>>>> plug issue in omap3 which some have reported. Developed these patches on
>>>> fixes-for-v3.9-rc3 after applying
>>>> http://www.spinics.net/lists/linux-usb/msg81563.html
>>>> (Grazvydas Ignotas patch series)
>>>>
>>>> Tested for g_zero enumeration in pandaboard and beagleboard in both
>>>> cold plug and hot plug case. Any kind of testing for this series is welcome.
>>>>
>>>> Changes from v1:
>>>> * removed *usb: musb: omap: remove the check before calling otg_set_vbus*
>>
>> er.. removed *usb: musb: omap: always glue have the correct vbus/id
>> status* since a patch similar to it is already merged.
>
> alright, I'll apply this series soonish.
>
Ok.

Thanks
Kishon

2013-03-14 15:48:21

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH v2 2/4] usb: otg: twl4030: use devres API for regulator get and request irq

On Thu, Mar 14, 2013 at 11:53:57AM +0530, Kishon Vijay Abraham I wrote:
> Used devres APIs devm_request_threaded_irq and devm_regulator_get for
> requesting irq and for getting regulator respectively.
>
> Signed-off-by: Kishon Vijay Abraham I <[email protected]>

please refresh this on top of my testing branch, you should be patching
drivers/usb/phy/phy-twl4030-usb.c

--
balbi


Attachments:
(No filename) (378.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments

2013-03-14 15:49:11

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] usb: otg: twl4030: fix cold plug on OMAP3

On Thu, Mar 14, 2013 at 11:53:59AM +0530, Kishon Vijay Abraham I wrote:
> Having twl4030_usb_phy_init() (detects if a cable is connected before
> twl4030 is probed) in twl4030 probe makes cable connect events to be
> missed by musb glue, since it gets loaded after twl4030. Having
> twl4030_usb_phy_init as a usb_phy ops lets twl4030_usb_phy_init to be
> called when glue is ready.
>
> Signed-off-by: Kishon Vijay Abraham I <[email protected]>

likewise. The other two I have taken

--
balbi


Attachments:
(No filename) (490.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments

2013-03-15 12:00:37

by Grazvydas Ignotas

[permalink] [raw]
Subject: Re: [PATCH v2 2/4] usb: otg: twl4030: use devres API for regulator get and request irq

On Thu, Mar 14, 2013 at 5:48 PM, Felipe Balbi <[email protected]> wrote:
> On Thu, Mar 14, 2013 at 11:53:57AM +0530, Kishon Vijay Abraham I wrote:
>> Used devres APIs devm_request_threaded_irq and devm_regulator_get for
>> requesting irq and for getting regulator respectively.
>>
>> Signed-off-by: Kishon Vijay Abraham I <[email protected]>
>
> please refresh this on top of my testing branch, you should be patching
> drivers/usb/phy/phy-twl4030-usb.c

Does that mean I need to rebase my series on your testing branch too?

>
> --
> balbi

--
Gra?vydas

2013-03-15 12:05:47

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH v2 2/4] usb: otg: twl4030: use devres API for regulator get and request irq

On Fri, Mar 15, 2013 at 02:00:33PM +0200, Grazvydas Ignotas wrote:
> On Thu, Mar 14, 2013 at 5:48 PM, Felipe Balbi <[email protected]> wrote:
> > On Thu, Mar 14, 2013 at 11:53:57AM +0530, Kishon Vijay Abraham I wrote:
> >> Used devres APIs devm_request_threaded_irq and devm_regulator_get for
> >> requesting irq and for getting regulator respectively.
> >>
> >> Signed-off-by: Kishon Vijay Abraham I <[email protected]>
> >
> > please refresh this on top of my testing branch, you should be patching
> > drivers/usb/phy/phy-twl4030-usb.c
>
> Does that mean I need to rebase my series on your testing branch too?

Oh yeah, sorry. Forgot to mention.

--
balbi


Attachments:
(No filename) (652.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments