usb: Fix linker errors during build
Subsystems (2)
PATCH 1/4 usb: Fix linker errors during build
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.
--- drivers/usb/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/Makefile +1 -1
@@ -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/
Signature · 1 line
1.7.10.4
PATCH 2/4 usb: musb: gadget: do *unmap_dma_buffer* only for valid DMA addr
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.
--- drivers/usb/musb/musb_gadget.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/musb/musb_gadget.c +4 -1
@@ -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,
Signature · 1 line
1.7.10.4
Re: [PATCH 2/4] usb: musb: gadget: do *unmap_dma_buffer* only for valid DMA addr
Quoted 16 lines · 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 <[email protected]>--- drivers/usb/musb/musb_gadget.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/usb/musb/musb_gadget.c +0
-0
drivers/usb/musb/musb_gadget.c __acquires(ep->musb->lock) · line 111
Quoted 6 lines
drivers/usb/musb/musb_gadget.c +2
-1@@ -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 ?
Signature · 1 line
balbi
PATCH 3/4 usb: otg: twl4030: use devres API for regulator get and request irq
In reply to Kishon Vijay Abraham IUsed devres APIs devm_request_threaded_irq and devm_regulator_get for requesting irq and for getting regulator respectively.
--- drivers/usb/phy/phy-twl4030-usb.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)
drivers/usb/phy/phy-twl4030-usb.c +8 -20
@@ -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 ; }
Signature · 1 line
1.7.10.4
PATCH 4/4 usb: otg: twl4030: fix cold plug on OMAP3
In reply to Kishon Vijay Abraham IHaving 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.
--- drivers/usb/phy/phy-twl4030-usb.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/usb/phy/phy-twl4030-usb.c +4 -5
@@ -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);
Quoted 5 lines · Kishon Vijay Abraham I
commit 63378a (usb: phy: remove
CONFIG_USB_OTG_UTILS) removedCONFIG_USB_OTG_UTILSfromKconfigbut failed to removed fromMakefile. Fixed it here.Signed-off-by Kishon Vijay Abraham I <[email protected]>
I can fold it in original commit since that's not in mainline yet, thanks
Signature · 1 line
balbi
Quoted 9 lines · Felipe Balbi
Quoted 5 lines · Kishon Vijay Abraham I
commit 63378a (usb: phy: remove
CONFIG_USB_OTG_UTILS) removedCONFIG_USB_OTG_UTILSfromKconfigbut failed to removed fromMakefile. Fixed it here.Signed-off-by Kishon Vijay Abraham I <[email protected]>I can fold it in original commit since that's not in mainline yet, thanks
Sure.
Thanks
Kishon