linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] usb: Fix linker errors during build
@ 2013-03-15 13:28 Kishon Vijay Abraham I
  2013-03-15 13:28 ` [PATCH 2/4] usb: musb: gadget: do *unmap_dma_buffer* only for valid DMA addr Kishon Vijay Abraham I
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Kishon Vijay Abraham I @ 2013-03-15 13:28 UTC (permalink / raw)
  To: balbi, gregkh, linux-usb, linux-omap, linux-kernel
  Cc: tony, notasas, Kishon Vijay Abraham I

commit 63378a (usb: phy: remove CONFIG_USB_OTG_UTILS) removed
CONFIG_USB_OTG_UTILS from Kconfig but failed to removed from Makefile.
Fixed it here.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/usb/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index 860306b..c41feba 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -44,7 +44,7 @@ obj-$(CONFIG_USB_MICROTEK)	+= image/
 obj-$(CONFIG_USB_SERIAL)	+= serial/
 
 obj-$(CONFIG_USB)		+= misc/
-obj-$(CONFIG_USB_OTG_UTILS)	+= phy/
+obj-$(CONFIG_USB_PHY)		+= phy/
 obj-$(CONFIG_EARLY_PRINTK_DBGP)	+= early/
 
 obj-$(CONFIG_USB_ATM)		+= atm/
-- 
1.7.10.4

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

* [PATCH 2/4] usb: musb: gadget: do *unmap_dma_buffer* only for valid DMA addr
  2013-03-15 13:28 [PATCH 1/4] usb: Fix linker errors during build Kishon Vijay Abraham I
@ 2013-03-15 13:28 ` Kishon Vijay Abraham I
  2013-03-15 14:30   ` Felipe Balbi
  2013-03-15 13:28 ` [PATCH 3/4] usb: otg: twl4030: use devres API for regulator get and request irq Kishon Vijay Abraham I
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Kishon Vijay Abraham I @ 2013-03-15 13:28 UTC (permalink / raw)
  To: balbi, gregkh, linux-usb, linux-omap, linux-kernel
  Cc: tony, notasas, Kishon Vijay Abraham I

musb does not use DMA buffer for ep0 but it uses the same giveback
function *musb_g_giveback* for all endpoints (*musb_g_ep0_giveback* calls
*musb_g_giveback*). So for ep0 case request.dma will be '0'
and will result in kernel OOPS if tried to *unmap_dma_buffer* for requests in
ep0. Fixed it by doing *unmap_dma_buffer* only for valid DMA addr.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/usb/musb/musb_gadget.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index c454375..ec3cf29 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -107,7 +107,10 @@ __acquires(ep->musb->lock)
 
 	ep->busy = 1;
 	spin_unlock(&musb->lock);
-	unmap_dma_buffer(req, musb);
+
+	if (request->dma)
+		unmap_dma_buffer(req, musb);
+
 	if (request->status == 0)
 		dev_dbg(musb->controller, "%s done request %p,  %d/%d\n",
 				ep->end_point.name, request,
-- 
1.7.10.4

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

* [PATCH 3/4] usb: otg: twl4030: use devres API for regulator get and request irq
  2013-03-15 13:28 [PATCH 1/4] usb: Fix linker errors during build Kishon Vijay Abraham I
  2013-03-15 13:28 ` [PATCH 2/4] usb: musb: gadget: do *unmap_dma_buffer* only for valid DMA addr Kishon Vijay Abraham I
@ 2013-03-15 13:28 ` Kishon Vijay Abraham I
       [not found] ` <1363354132-27523-1-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
  2013-03-15 14:25 ` [PATCH 1/4] usb: Fix linker errors during build Felipe Balbi
  3 siblings, 0 replies; 7+ messages in thread
From: Kishon Vijay Abraham I @ 2013-03-15 13:28 UTC (permalink / raw)
  To: balbi, gregkh, linux-usb, linux-omap, linux-kernel
  Cc: tony, notasas, Kishon Vijay Abraham I

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 <kishon@ti.com>
Tested-by: Grazvydas Ignotas <notasas@gmail.com>
---
 drivers/usb/phy/phy-twl4030-usb.c |   28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/phy/phy-twl4030-usb.c b/drivers/usb/phy/phy-twl4030-usb.c
index a994715..e14b03e 100644
--- a/drivers/usb/phy/phy-twl4030-usb.c
+++ b/drivers/usb/phy/phy-twl4030-usb.c
@@ -432,7 +432,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;
 
@@ -441,18 +441,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);
 
@@ -461,14 +461,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,
@@ -640,9 +632,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);
@@ -663,7 +655,6 @@ static int __exit twl4030_usb_remove(struct platform_device *pdev)
 	struct twl4030_usb *twl = platform_get_drvdata(pdev);
 	int val;
 
-	free_irq(twl->irq, twl);
 	device_remove_file(twl->dev, &dev_attr_vbus);
 
 	/* set transceiver mode to power on defaults */
@@ -685,9 +676,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


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

* [PATCH 4/4] usb: otg: twl4030: fix cold plug on OMAP3
       [not found] ` <1363354132-27523-1-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
@ 2013-03-15 13:28   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 7+ messages in thread
From: Kishon Vijay Abraham I @ 2013-03-15 13:28 UTC (permalink / raw)
  To: balbi-l0cyMroinI0, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ, notasas-Re5JQEeQqe8AvxtiuMwx3w,
	Kishon Vijay Abraham I

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 <kishon-l0cyMroinI0@public.gmane.org>
Tested-by: Grazvydas Ignotas <notasas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/usb/phy/phy-twl4030-usb.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/phy/phy-twl4030-usb.c b/drivers/usb/phy/phy-twl4030-usb.c
index e14b03e..1986c78 100644
--- a/drivers/usb/phy/phy-twl4030-usb.c
+++ b/drivers/usb/phy/phy-twl4030-usb.c
@@ -510,8 +510,9 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
 	return IRQ_HANDLED;
 }
 
-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;
 
 	status = twl4030_usb_linkstat(twl);
@@ -528,6 +529,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)
@@ -604,6 +606,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;
@@ -641,11 +644,6 @@ static int twl4030_usb_probe(struct platform_device *pdev)
 		return status;
 	}
 
-	/* Power down phy or make it work according to
-	 * current link state.
-	 */
-	twl4030_usb_phy_init(twl);

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

* Re: [PATCH 1/4] usb: Fix linker errors during build
  2013-03-15 13:28 [PATCH 1/4] usb: Fix linker errors during build Kishon Vijay Abraham I
                   ` (2 preceding siblings ...)
       [not found] ` <1363354132-27523-1-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
@ 2013-03-15 14:25 ` Felipe Balbi
  2013-03-15 15:52   ` kishon
  3 siblings, 1 reply; 7+ messages in thread
From: Felipe Balbi @ 2013-03-15 14:25 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: balbi, gregkh, linux-usb, linux-omap, linux-kernel, tony, notasas

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

On Fri, Mar 15, 2013 at 06:58:49PM +0530, Kishon Vijay Abraham I wrote:
> commit 63378a (usb: phy: remove CONFIG_USB_OTG_UTILS) removed
> CONFIG_USB_OTG_UTILS from Kconfig but failed to removed from Makefile.
> Fixed it here.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

I can fold it in original commit since that's not in mainline yet,
thanks

-- 
balbi

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

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

* Re: [PATCH 2/4] usb: musb: gadget: do *unmap_dma_buffer* only for valid DMA addr
  2013-03-15 13:28 ` [PATCH 2/4] usb: musb: gadget: do *unmap_dma_buffer* only for valid DMA addr Kishon Vijay Abraham I
@ 2013-03-15 14:30   ` Felipe Balbi
  0 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2013-03-15 14:30 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: balbi, gregkh, linux-usb, linux-omap, linux-kernel, tony, notasas

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

On Fri, Mar 15, 2013 at 06:58:50PM +0530, Kishon Vijay Abraham I wrote:
> musb does not use DMA buffer for ep0 but it uses the same giveback
> function *musb_g_giveback* for all endpoints (*musb_g_ep0_giveback* calls
> *musb_g_giveback*). So for ep0 case request.dma will be '0'
> and will result in kernel OOPS if tried to *unmap_dma_buffer* for requests in
> ep0. Fixed it by doing *unmap_dma_buffer* only for valid DMA addr.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  drivers/usb/musb/musb_gadget.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
> index c454375..ec3cf29 100644
> --- a/drivers/usb/musb/musb_gadget.c
> +++ b/drivers/usb/musb/musb_gadget.c
> @@ -107,7 +107,10 @@ __acquires(ep->musb->lock)
>  
>  	ep->busy = 1;
>  	spin_unlock(&musb->lock);
> -	unmap_dma_buffer(req, musb);
> +
> +	if (request->dma)

I have changed to if (!dma_mapping_error(request->dma)), is it alright ?

-- 
balbi

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

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

* Re: [PATCH 1/4] usb: Fix linker errors during build
  2013-03-15 14:25 ` [PATCH 1/4] usb: Fix linker errors during build Felipe Balbi
@ 2013-03-15 15:52   ` kishon
  0 siblings, 0 replies; 7+ messages in thread
From: kishon @ 2013-03-15 15:52 UTC (permalink / raw)
  To: balbi; +Cc: gregkh, linux-usb, linux-omap, linux-kernel, tony, notasas

On Friday 15 March 2013 07:55 PM, Felipe Balbi wrote:
> On Fri, Mar 15, 2013 at 06:58:49PM +0530, Kishon Vijay Abraham I wrote:
>> commit 63378a (usb: phy: remove CONFIG_USB_OTG_UTILS) removed
>> CONFIG_USB_OTG_UTILS from Kconfig but failed to removed from Makefile.
>> Fixed it here.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>
> I can fold it in original commit since that's not in mainline yet,
> thanks

Sure.

Thanks
Kishon

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

end of thread, other threads:[~2013-03-15 15:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-15 13:28 [PATCH 1/4] usb: Fix linker errors during build Kishon Vijay Abraham I
2013-03-15 13:28 ` [PATCH 2/4] usb: musb: gadget: do *unmap_dma_buffer* only for valid DMA addr Kishon Vijay Abraham I
2013-03-15 14:30   ` Felipe Balbi
2013-03-15 13:28 ` [PATCH 3/4] usb: otg: twl4030: use devres API for regulator get and request irq Kishon Vijay Abraham I
     [not found] ` <1363354132-27523-1-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
2013-03-15 13:28   ` [PATCH 4/4] usb: otg: twl4030: fix cold plug on OMAP3 Kishon Vijay Abraham I
2013-03-15 14:25 ` [PATCH 1/4] usb: Fix linker errors during build Felipe Balbi
2013-03-15 15:52   ` kishon

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).