OMAP USB and MUSB patches for Next
Subsystems (6)
cover OMAP USB and MUSB patches for Next
Hi Greg, all,
Here are the tested set of patches for the next merge window.
We have a pending fixes pull request [1] which could be integrated to this one if wanted/needed.
I'll be waiting for v2.6.38-rc5 appear on greg/usb-next before sending the pull request otherwise we will have conflicts popping.
If there are any other patches pending, you guys have just a few days remaining to send me those.
[1] http://marc.info/?l=linux-usb&m=129767766917391&w=2
Felipe Balbi (4):
usb: musb: do not error out if Kconfig doesn't match board mode
usb: musb: gadget: beautify
usb_gadget_probe_driver()/usb_gadget_unregister_driver
usb: musb: gadget: do not poke with gadget's list_head
usb: otg: notifier: switch to atomic notifier
Hema HK (8):
usb: musb: Using runtime pm APIs for musb.
usb: otg: enable regulator only on cable/device connect
usb: otg: Remove one unnecessary I2C read request.
usb: otg: OMAP4430: Add phy_suspend function pointer to
twl4030_usb_data
usb: otg: OMAP4430: Introducing suspend function for power management
usb: otg: TWL6030: Introduce the twl6030_phy_suspend function.
usb: otg: TWL6030 Save the last event in otg_transceiver
usb: musb: OMAP4430: Fix usb device detection if connected during
boot
arch/arm/mach-omap2/board-4430sdp.c | 1 + arch/arm/mach-omap2/board-omap4panda.c | 1 + arch/arm/mach-omap2/omap_phy_internal.c | 22 +++- arch/arm/plat-omap/include/plat/usb.h | 1 + drivers/usb/musb/musb_core.c | 25 ---- drivers/usb/musb/musb_core.h | 6 +- drivers/usb/musb/musb_gadget.c | 191 +++++++++++++++++-------------- drivers/usb/musb/musb_gadget.h | 7 +- drivers/usb/musb/musb_gadget_ep0.c | 24 +++-- drivers/usb/musb/omap2430.c | 134 ++++++++++++---------- drivers/usb/otg/ab8500-usb.c | 6 +- drivers/usb/otg/nop-usb-xceiv.c | 2 +- drivers/usb/otg/twl4030-usb.c | 6 +- drivers/usb/otg/twl6030-usb.c | 56 ++++++---- include/linux/i2c/twl.h | 2 + include/linux/usb/otg.h | 7 +- 16 files changed, 260 insertions(+), 231 deletions(-)
Signature · 6 lines
1.7.4.rc2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/12 usb: musb: do not error out if Kconfig doesn't match board mode
In reply to a message not in the archiveDuring development, even though board is wired
to e.g. OTG, we might want to compile host-only
or peripheral-only configurations.
Let's allow that to happen.
--- drivers/usb/musb/musb_core.c | 25 ------------------------- 1 files changed, 0 insertions(+), 25 deletions(-)
drivers/usb/musb/musb_core.c +0 -24
@@ -1949,31 +1949,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) goto fail0; } -switch (plat->mode) { -case MUSB_HOST : -#ifdef CONFIG_USB_MUSB_HDRC_HCD -break ; -#else - goto bad_config; -#endif -case MUSB_PERIPHERAL : -#ifdef CONFIG_USB_GADGET_MUSB_HDRC -break ; -#else - goto bad_config; -#endif -case MUSB_OTG : -#ifdef CONFIG_USB_MUSB_OTG -break ; -#else -bad_config: -#endif -default : -dev_err (dev,"incompatible Kconfig role setting\n" ); - status = -EINVAL ; - goto fail0; - }
PATCH 5/12 usb: otg: enable regulator only on cable/device connect
In reply to a message not in the archiveFrom: Hema HK <[email protected]>
Remove the regulator enable while driver loading and enable it only when the cable/device is connected and disable it when disconnected.
Remove the configuration of config_state and config_trans register configuration as these registers are programmed when regulator enable/disable is called.
--- drivers/usb/otg/twl6030-usb.c | 27 ++++++++++++--------------- 1 files changed, 12 insertions(+), 15 deletions(-)
drivers/usb/otg/twl6030-usb.c +12 -15
@@ -158,8 +158,6 @@ static int twl6030_phy_init(struct otg_transceiver *x) dev = twl->dev; pdata = dev->platform_data; -regulator_enable (twl->usb3v3); - hw_state =twl6030_readb (twl,TWL6030_MODULE_ID0 ,STS_HW_CONDITIONS );if (hw_state &STS_USB_ID )
@@ -180,7 +178,6 @@ static void twl6030_phy_shutdown(struct otg_transceiver *x) dev = twl->dev; pdata = dev->platform_data; pdata->phy_power (twl->dev,0 ,0 ); -regulator_disable (twl->usb3v3); }static int twl6030_usb_ldo_init (struct twl6030_usb *twl)
@@ -199,16 +196,6 @@ static int twl6030_usb_ldo_init(struct twl6030_usb *twl)if (IS_ERR (twl->usb3v3))return -ENODEV ; -regulator_enable (twl->usb3v3); - -/* Program the VUSB_CFG_TRANS for ACTIVE state. */ -twl6030_writeb (twl,TWL_MODULE_PM_RECEIVER ,0x3F , -VUSB_CFG_TRANS ); - -/* Program the VUSB_CFG_STATE register to ON on all groups. */ -twl6030_writeb (twl,TWL_MODULE_PM_RECEIVER ,0xE1 , -VUSB_CFG_STATE ); -/* Program the USB_VBUS_CTRL_SET and set VBUS_ACT_COMP bit */ twl6030_writeb (twl,TWL_MODULE_USB ,0x4 ,USB_VBUS_CTRL_SET );
@@ -261,16 +248,23 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl) CONTROLLER_STAT1);if (!(hw_state &STS_USB_ID )) {if (vbus_state &VBUS_DET ) { +regulator_enable (twl->usb3v3); + twl->asleep =1 ; status =USB_EVENT_VBUS ; twl->otg.default_a = false; twl->otg.state =OTG_STATE_B_IDLE ; + twl->linkstat = status; +blocking_notifier_call_chain (&twl->otg.notifier, + status, twl->otg.gadget); }else { status =USB_EVENT_NONE ; - } -if (status >=0 ) { twl->linkstat = status;blocking_notifier_call_chain (&twl->otg.notifier, status, twl->otg.gadget); +if (twl->asleep) { +regulator_disable (twl->usb3v3); + twl->asleep =0 ; + } } }sysfs_notify (&twl->dev->kobj,NULL ,"vbus" );
@@ -288,6 +282,8 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)if (hw_state &STS_USB_ID ) { +regulator_enable (twl->usb3v3); + twl->asleep =1 ;twl6030_writeb (twl,TWL_MODULE_USB ,USB_ID_INT_EN_HI_CLR ,0x1 );twl6030_writeb (twl,TWL_MODULE_USB ,USB_ID_INT_EN_HI_SET ,0x10 );
@@ -437,6 +433,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)return status; } + twl->asleep =0 ; pdata->phy_init (dev);twl6030_enable_irq (&twl->otg);dev_info (&pdev->dev,"Initialized TWL6030 USB module\n" );
Signature · 6 lines
1.7.4.rc2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/12 usb: otg: OMAP4430: Introducing suspend function for power management
In reply to a message not in the archiveFrom: Hema HK <[email protected]>
Introduced the suspend/resume function for the OMAP4430 internal PHY. This will be used by the twl6030-usb transceiver driver. Moved the clock enable/disable function calls and power on/off of the PHY code from power on/off functions to suspend/resume function.
Pass the suspend function through board data for OMAP4430sdp and OMAP4panda. This will be used by the twl6030-usb transceiver driver.
--- arch/arm/mach-omap2/board-4430sdp.c | 1 + arch/arm/mach-omap2/board-omap4panda.c | 1 + arch/arm/mach-omap2/omap_phy_internal.c | 22 +++++++++++++++------- arch/arm/plat-omap/include/plat/usb.h | 1 + 4 files changed, 18 insertions(+), 7 deletions(-)
arch/arm/mach-omap2/board-4430sdp.c +1 -0
@@ -272,6 +272,7 @@ static struct twl4030_usb_data omap4_usbphy_data = { .phy_exit = omap4430_phy_exit, .phy_power = omap4430_phy_power, .phy_set_clock = omap4430_phy_set_clk, + .phy_suspend = omap4430_phy_suspend, };static struct omap2_hsmmc_info mmc[] = {
arch/arm/mach-omap2/board-omap4panda.c +1 -0
@@ -153,6 +153,7 @@ static struct twl4030_usb_data omap4_usbphy_data = { .phy_exit = omap4430_phy_exit, .phy_power = omap4430_phy_power, .phy_set_clock = omap4430_phy_set_clk, + .phy_suspend = omap4430_phy_suspend, };static struct omap2_hsmmc_info mmc[] = {
arch/arm/mach-omap2/omap_phy_internal.c +15 -7
@@ -103,13 +103,6 @@ int omap4430_phy_set_clk(struct device *dev, int on)int omap4430_phy_power (struct device *dev,int ID ,int on) {if (on) { -/* enabled the clocks */ -omap4430_phy_set_clk (dev,1 ); -/* power on the phy */ -if (__raw_readl (ctrl_base +CONTROL_DEV_CONF ) &PHY_PD ) { -__raw_writel (~PHY_PD , ctrl_base +CONTROL_DEV_CONF ); -mdelay (200 ); - }if (ID )/* enable VBUS valid, IDDIG groung */ __raw_writel(AVALID | VBUSVALID, ctrl_base +
@@ -125,10 +118,25 @@ int omap4430_phy_power(struct device *dev, int ID, int on)/* Enable session END and IDIG to high impedence. */ __raw_writel (SESSEND |IDDIG , ctrl_base +USBOTGHS_CONTROL ); + } +return 0 ; +} + +int omap4430_phy_suspend (struct device *dev,int suspend) +{ +if (suspend) {/* Disable the clocks */ omap4430_phy_set_clk (dev,0 );/* Power down the phy */ __raw_writel (PHY_PD , ctrl_base +CONTROL_DEV_CONF ); + }else { +/* Enable the internel phy clcoks */ +omap4430_phy_set_clk (dev,1 ); +/* power on the phy */ +if (__raw_readl (ctrl_base +CONTROL_DEV_CONF ) &PHY_PD ) { +__raw_writel (~PHY_PD , ctrl_base +CONTROL_DEV_CONF ); +mdelay (200 ); + } }return 0 ;
arch/arm/plat-omap/include/plat/usb.h +1 -0
@@ -88,6 +88,7 @@ extern int omap4430_phy_power(struct device *dev, int ID, int on);extern int omap4430_phy_set_clk (struct device *dev,int on);extern int omap4430_phy_init (struct device *dev);extern int omap4430_phy_exit (struct device *dev); +extern int omap4430_phy_suspend (struct device *dev,int suspend);#endif
Signature · 6 lines
1.7.4.rc2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 9/12 usb: otg: TWL6030: Introduce the twl6030_phy_suspend function.
In reply to a message not in the archiveFrom: Hema HK <[email protected]>
Introduce the twl6030_phy_suspend function and assign to otg.set_suspend function pointer.
This function is used by the musb-omap2430 platform driver during suspend/resume.
--- drivers/usb/otg/twl6030-usb.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
drivers/usb/otg/twl6030-usb.c +13 -0
@@ -177,6 +177,17 @@ static void twl6030_phy_shutdown(struct otg_transceiver *x) pdata->phy_power (twl->dev,0 ,0 ); } +static int twl6030_phy_suspend (struct otg_transceiver *x,int suspend) +{ +struct twl6030_usb *twl =xceiv_to_twl (x); +struct device *dev = twl->dev; +struct twl4030_usb_data *pdata = dev->platform_data; + + pdata->phy_suspend (dev, suspend); + +return 0 ; +} +static int twl6030_usb_ldo_init (struct twl6030_usb *twl) {
@@ -388,6 +399,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev) twl->otg.set_vbus = twl6030_set_vbus; twl->otg.init = twl6030_phy_init; twl->otg.shutdown = twl6030_phy_shutdown; + twl->otg.set_suspend = twl6030_phy_suspend;/* init spinlock for workqueue */ spin_lock_init (&twl->lock);
@@ -432,6 +444,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev) twl->asleep =0 ; pdata->phy_init (dev); +twl6030_phy_suspend (&twl->otg,0 );twl6030_enable_irq (&twl->otg);dev_info (&pdev->dev,"Initialized TWL6030 USB module\n" );
Signature · 6 lines
1.7.4.rc2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 10/12 usb: otg: TWL6030 Save the last event in otg_transceiver
In reply to a message not in the archiveFrom: Hema HK <[email protected]>
Save the last event in the otg_transceiver so that it can used in the musb driver and gadget driver to configure the musb and enable the vbus for host mode and OTG mode, if the device is connected during boot.
--- drivers/usb/otg/twl6030-usb.c | 3 +++ include/linux/usb/otg.h | 1 + 2 files changed, 4 insertions(+), 0 deletions(-)
drivers/usb/otg/twl6030-usb.c +3 -0
@@ -262,11 +262,13 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl) twl->otg.default_a = false; twl->otg.state =OTG_STATE_B_IDLE ; twl->linkstat = status; + twl->otg.last_event = status;blocking_notifier_call_chain (&twl->otg.notifier, status, twl->otg.gadget); }else { status =USB_EVENT_NONE ; twl->linkstat = status; + twl->otg.last_event = status;blocking_notifier_call_chain (&twl->otg.notifier, status, twl->otg.gadget);if (twl->asleep) {
@@ -299,6 +301,7 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) twl->otg.default_a = true; twl->otg.state =OTG_STATE_A_IDLE ; twl->linkstat = status; + twl->otg.last_event = status;blocking_notifier_call_chain (&twl->otg.notifier, status, twl->otg.gadget); }else {
include/linux/usb/otg.h +1 -0
@@ -66,6 +66,7 @@ struct otg_transceiver {u8 default_a;enum usb_otg_state state; +enum usb_xceiv_events last_event;struct usb_bus *host;struct usb_gadget *gadget;
Signature · 6 lines
1.7.4.rc2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 12/12 usb: otg: notifier: switch to atomic notifier
In reply to a message not in the archivemost of our notifications, will be called from IRQ context, so an atomic notifier suits the job better.
--- drivers/usb/otg/ab8500-usb.c | 6 +++--- drivers/usb/otg/nop-usb-xceiv.c | 2 +- drivers/usb/otg/twl4030-usb.c | 6 +++--- drivers/usb/otg/twl6030-usb.c | 8 ++++---- include/linux/usb/otg.h | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-)
drivers/usb/otg/ab8500-usb.c +3 -3
@@ -212,7 +212,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab)break ; } -blocking_notifier_call_chain (&ab->otg.notifier, event, v); +atomic_notifier_call_chain (&ab->otg.notifier, event, v);return 0 ; }
@@ -281,7 +281,7 @@ static int ab8500_usb_set_power(struct otg_transceiver *otg, unsigned mA) ab->vbus_draw = mA;if (mA) -blocking_notifier_call_chain (&ab->otg.notifier, +atomic_notifier_call_chain (&ab->otg.notifier,USB_EVENT_ENUMERATED , ab->otg.gadget);return 0 ; }
@@ -500,7 +500,7 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev)platform_set_drvdata (pdev, ab); -BLOCKING_INIT_NOTIFIER_HEAD (&ab->otg.notifier); +ATOMIC_INIT_NOTIFIER_HEAD (&ab->otg.notifier);/* v1: Wait for link status to become stable. * all: Updates form set_host and set_peripheral as they are atomic.
drivers/usb/otg/nop-usb-xceiv.c +1 -1
@@ -132,7 +132,7 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev)platform_set_drvdata (pdev, nop); -BLOCKING_INIT_NOTIFIER_HEAD (&nop->otg.notifier); +ATOMIC_INIT_NOTIFIER_HEAD (&nop->otg.notifier);return 0 ; exit:
drivers/usb/otg/twl4030-usb.c +3 -3
@@ -512,7 +512,7 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl)else twl4030_phy_resume (twl); -blocking_notifier_call_chain (&twl->otg.notifier, status, +atomic_notifier_call_chain (&twl->otg.notifier, status, twl->otg.gadget); }sysfs_notify (&twl->dev->kobj,NULL ,"vbus" );
@@ -534,7 +534,7 @@ static void twl4030_usb_phy_init(struct twl4030_usb *twl) twl->asleep =0 ; } -blocking_notifier_call_chain (&twl->otg.notifier, status, +atomic_notifier_call_chain (&twl->otg.notifier, status, twl->otg.gadget); }sysfs_notify (&twl->dev->kobj,NULL ,"vbus" );
@@ -623,7 +623,7 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)if (device_create_file (&pdev->dev, &dev_attr_vbus))dev_warn (&pdev->dev,"could not create sysfs file\n" ); -BLOCKING_INIT_NOTIFIER_HEAD (&twl->otg.notifier); +ATOMIC_INIT_NOTIFIER_HEAD (&twl->otg.notifier);/* Our job is to use irqs and status from the power module * to keep the transceiver disabled when nothing's connected.
drivers/usb/otg/twl6030-usb.c +4 -4
@@ -263,13 +263,13 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl) twl->otg.state =OTG_STATE_B_IDLE ; twl->linkstat = status; twl->otg.last_event = status; -blocking_notifier_call_chain (&twl->otg.notifier, +atomic_notifier_call_chain (&twl->otg.notifier, status, twl->otg.gadget); }else { status =USB_EVENT_NONE ; twl->linkstat = status; twl->otg.last_event = status; -blocking_notifier_call_chain (&twl->otg.notifier, +atomic_notifier_call_chain (&twl->otg.notifier, status, twl->otg.gadget);if (twl->asleep) {regulator_disable (twl->usb3v3);
@@ -302,7 +302,7 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) twl->otg.state =OTG_STATE_A_IDLE ; twl->linkstat = status; twl->otg.last_event = status; -blocking_notifier_call_chain (&twl->otg.notifier, status, +atomic_notifier_call_chain (&twl->otg.notifier, status, twl->otg.gadget); }else { twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR,
@@ -419,7 +419,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)if (device_create_file (&pdev->dev, &dev_attr_vbus))dev_warn (&pdev->dev,"could not create sysfs file\n" ); -BLOCKING_INIT_NOTIFIER_HEAD (&twl->otg.notifier); +ATOMIC_INIT_NOTIFIER_HEAD (&twl->otg.notifier); twl->irq_enabled = true; status = request_threaded_irq(twl->irq1, NULL, twl6030_usbotg_irq,
include/linux/usb/otg.h +3 -3
@@ -75,7 +75,7 @@ struct otg_transceiver {void __iomem *io_priv;/* for notification of usb_xceiv_events */ -struct blocking_notifier_head notifier; +struct atomic_notifier_head notifier;/* to pass extra port status to the root hub */ u16 port_status;
@@ -235,13 +235,13 @@ otg_start_srp(struct otg_transceiver *otg)static inline int otg_register_notifier (struct otg_transceiver *otg,struct notifier_block *nb) { -return blocking_notifier_chain_register (&otg->notifier, nb); +return atomic_notifier_chain_register (&otg->notifier, nb); }static inline void otg_unregister_notifier (struct otg_transceiver *otg,struct notifier_block *nb) { -blocking_notifier_chain_unregister (&otg->notifier, nb); +atomic_notifier_chain_unregister (&otg->notifier, nb); }/* for OTG controller drivers (and maybe other stuff) */
Signature · 6 lines
1.7.4.rc2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/12 usb: musb: gadget: beautify usb_gadget_probe_driver()/usb_gadget_unregister_driver
In reply to Felipe BalbiJust a few cosmetic fixes to usb_gadget_probe_driver() and usb_gadget_unregister_driver().
Decreased a few indentation levels with goto statements.
--- drivers/usb/musb/musb_gadget.c | 150 +++++++++++++++++++++------------------- 1 files changed, 79 insertions(+), 71 deletions(-)
drivers/usb/musb/musb_gadget.c +79 -71
@@ -1801,90 +1801,95 @@ void musb_gadget_cleanup(struct musb *musb)int usb_gadget_probe_driver (struct usb_gadget_driver *driver,int (*bind)(struct usb_gadget *)) { -int retval; -unsigned long flags; -struct musb *musb = the_gadget; +struct musb *musb = the_gadget; +unsigned long flags; +int retval = -EINVAL ;if (!driver || driver->speed !=USB_SPEED_HIGH || !bind || !driver->setup) -return -EINVAL ; + goto err0;/* driver must be initialized to support peripheral mode */ if (!musb) {DBG (1 ,"%s, no dev??\n" , __func__); -return -ENODEV ; + retval = -ENODEV ; + goto err0; }DBG (3 ,"registering driver %s\n" , driver->function); -spin_lock_irqsave (&musb->lock, flags);if (musb->gadget_driver) {DBG (1 ,"%s is already bound to %s\n" , musb_driver_name, musb->gadget_driver->driver.name); retval = -EBUSY ; - }else { - musb->gadget_driver = driver; - musb->g.dev.driver = &driver->driver; - driver->driver.bus =NULL ; - musb->softconnect =1 ; - retval =0 ; + goto err0; } +spin_lock_irqsave (&musb->lock, flags); + musb->gadget_driver = driver; + musb->g.dev.driver = &driver->driver; + driver->driver.bus =NULL ; + musb->softconnect =1 ;spin_unlock_irqrestore (&musb->lock, flags); -if (retval ==0 ) { - retval =bind (&musb->g); -if (retval !=0 ) { -DBG (3 ,"bind to driver %s failed --> %d\n" , - driver->driver.name, retval); - musb->gadget_driver =NULL ; - musb->g.dev.driver =NULL ; - } + retval =bind (&musb->g); +if (retval) { +DBG (3 ,"bind to driver %s failed --> %d\n" , + driver->driver.name, retval); + goto err1; + } -spin_lock_irqsave (&musb->lock, flags); +spin_lock_irqsave (&musb->lock, flags); -otg_set_peripheral (musb->xceiv, &musb->g); - musb->xceiv->state =OTG_STATE_B_IDLE ; - musb->is_active =1 ; +otg_set_peripheral (musb->xceiv, &musb->g); + musb->xceiv->state =OTG_STATE_B_IDLE ; + musb->is_active =1 ; -/* FIXME this ignores the softconnect flag. Drivers are -* allowed hold the peripheral inactive until for example -* userspace hooks up printer hardware or DSP codecs, so -* hosts only see fully functional devices. -*/ +/* +* FIXME this ignores the softconnect flag. Drivers are +* allowed hold the peripheral inactive until for example +* userspace hooks up printer hardware or DSP codecs, so +* hosts only see fully functional devices. +*/ -if (!is_otg_enabled (musb)) -musb_start (musb); +if (!is_otg_enabled (musb)) +musb_start (musb); -otg_set_peripheral (musb->xceiv, &musb->g); +otg_set_peripheral (musb->xceiv, &musb->g); -spin_unlock_irqrestore (&musb->lock, flags); +spin_unlock_irqrestore (&musb->lock, flags); -if (is_otg_enabled (musb)) { -struct usb_hcd *hcd =musb_to_hcd (musb); +if (is_otg_enabled (musb)) { +struct usb_hcd *hcd =musb_to_hcd (musb); -DBG (3 ,"OTG startup...\n" ); +DBG (3 ,"OTG startup...\n" ); -/* REVISIT: funcall to other code, which also -* handles power budgeting ... this way also -* ensures HdrcStart is indirectly called. -*/ - retval =usb_add_hcd (musb_to_hcd (musb),-1 ,0 ); -if (retval <0 ) { -DBG (1 ,"add_hcd failed, %d\n" , retval); -spin_lock_irqsave (&musb->lock, flags); -otg_set_peripheral (musb->xceiv,NULL ); - musb->gadget_driver =NULL ; - musb->g.dev.driver =NULL ; -spin_unlock_irqrestore (&musb->lock, flags); - }else { - hcd->self.uses_pio_for_control =1 ; - } +/* REVISIT: funcall to other code, which also +* handles power budgeting ... this way also +* ensures HdrcStart is indirectly called. +*/ + retval =usb_add_hcd (musb_to_hcd (musb),-1 ,0 ); +if (retval <0 ) { +DBG (1 ,"add_hcd failed, %d\n" , retval); + goto err2; } + + hcd->self.uses_pio_for_control =1 ; } +return 0 ; + +err2: +if (!is_otg_enabled (musb)) +musb_stop (musb); + +err1: + musb->gadget_driver =NULL ; + musb->g.dev.driver =NULL ; + +err0:return retval; }EXPORT_SYMBOL (usb_gadget_probe_driver);
@@ -1939,14 +1944,17 @@ static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver)*/ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver) { -unsigned long flags; -int retval =0 ;struct musb *musb = the_gadget; +unsigned long flags;if (!driver || !driver->unbind || !musb)return -EINVAL ; -/* REVISIT always use otg_set_peripheral() here too; +if (!musb->gadget_driver) +return -EINVAL ; + +/* +* REVISIT always use otg_set_peripheral() here too; * this needs to shut down the OTG engine. */
@@ -1956,29 +1964,26 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)musb_hnp_stop (musb);#endif -if (musb->gadget_driver == driver) { + (void )musb_gadget_vbus_draw (&musb->g,0 ); - (void )musb_gadget_vbus_draw (&musb->g,0 ); + musb->xceiv->state =OTG_STATE_UNDEFINED ; +stop_activity (musb, driver); +otg_set_peripheral (musb->xceiv,NULL ); - musb->xceiv->state =OTG_STATE_UNDEFINED ; -stop_activity (musb, driver); -otg_set_peripheral (musb->xceiv,NULL ); +DBG (3 ,"unregistering driver %s\n" , driver->function); -DBG (3 ,"unregistering driver %s\n" , driver->function); -spin_unlock_irqrestore (&musb->lock, flags); - driver->unbind (&musb->g); -spin_lock_irqsave (&musb->lock, flags); +spin_unlock_irqrestore (&musb->lock, flags); + driver->unbind (&musb->g); +spin_lock_irqsave (&musb->lock, flags); - musb->gadget_driver =NULL ; - musb->g.dev.driver =NULL ; + musb->gadget_driver =NULL ; + musb->g.dev.driver =NULL ; - musb->is_active =0 ; -musb_platform_try_idle (musb,0 ); - }else - retval = -EINVAL ; + musb->is_active =0 ; +musb_platform_try_idle (musb,0 );spin_unlock_irqrestore (&musb->lock, flags); -if (is_otg_enabled (musb) && retval ==0 ) { +if (is_otg_enabled (musb)) {usb_remove_hcd (musb_to_hcd (musb));/* FIXME we need to be able to register another * gadget driver here and have everything work;
@@ -1986,7 +1991,10 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)*/ } -return retval; +if (!is_otg_enabled (musb)) +musb_stop (musb); + +return 0 ; }EXPORT_SYMBOL (usb_gadget_unregister_driver);
Signature · 1 line
1.7.4.rc2
PATCH 3/12 usb: musb: gadget: do not poke with gadget's list_head
In reply to Felipe Balbistruct usb_request's list_head is supposed to be used only by gadget drivers, but musb is abusing that. Give struct musb_request its own list_head and prevent musb from poking into other driver's business.
--- drivers/usb/musb/musb_core.h | 4 +- drivers/usb/musb/musb_gadget.c | 37 +++++++++++++++++++---------------- drivers/usb/musb/musb_gadget.h | 7 ++++- drivers/usb/musb/musb_gadget_ep0.c | 24 +++++++++++++--------- 4 files changed, 41 insertions(+), 31 deletions(-)
drivers/usb/musb/musb_core.h +2 -2
@@ -328,7 +328,7 @@ struct musb_hw_ep {#endif }; -static inline struct usb_request *next_in_request (struct musb_hw_ep *hw_ep) +static inline struct musb_request *next_in_request (struct musb_hw_ep *hw_ep) {#ifdef CONFIG_USB_GADGET_MUSB_HDRC return next_request (&hw_ep->ep_in);
@@ -337,7 +337,7 @@ static inline struct usb_request *next_in_request(struct musb_hw_ep *hw_ep)#endif } -static inline struct usb_request *next_out_request (struct musb_hw_ep *hw_ep) +static inline struct musb_request *next_out_request (struct musb_hw_ep *hw_ep) {#ifdef CONFIG_USB_GADGET_MUSB_HDRC return next_request (&hw_ep->ep_out);
drivers/usb/musb/musb_gadget.c +20 -17
@@ -189,7 +189,7 @@ __acquires(ep->musb->lock) req =to_musb_request (request); -list_del (&request->list); +list_del (&req->list);if (req->request.status == -EINPROGRESS ) req->request.status = status; musb = req->musb;
@@ -251,9 +251,8 @@ static void nuke(struct musb_ep *ep, const int status) ep->dma =NULL ; } -while (!list_empty (&(ep->req_list))) { - req = container_of(ep->req_list.next, struct musb_request, - request.list); +while (!list_empty (&ep->req_list)) { + req = list_first_entry(&ep->req_list, struct musb_request, list);musb_g_giveback (ep, &req->request, status); } }
@@ -485,6 +484,7 @@ static void txstate(struct musb *musb, struct musb_request *req)void musb_g_tx (struct musb *musb,u8 epnum) {u16 csr; +struct musb_request *req;struct usb_request *request;u8 __iomem *mbase = musb->mregs;struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_in;
@@ -492,7 +492,8 @@ void musb_g_tx(struct musb *musb, u8 epnum)struct dma_channel *dma;musb_ep_select (mbase, epnum); - request =next_request (musb_ep); + req =next_request (musb_ep); + request = &req->request; csr =musb_readw (epio,MUSB_TXCSR );DBG (4 ,"<== %s, txcsr %04x\n" , musb_ep->end_point.name, csr);
@@ -571,15 +572,15 @@ void musb_g_tx(struct musb *musb, u8 epnum)if (request->actual == request->length) {musb_g_giveback (musb_ep, request,0 ); - request = musb_ep->desc ?next_request (musb_ep) :NULL ; -if (!request) { + req = musb_ep->desc ?next_request (musb_ep) :NULL ; +if (!req) {DBG (4 ,"%s idle now\n" , musb_ep->end_point.name);return ; } } -txstate (musb,to_musb_request (request)); +txstate (musb, req); } }
@@ -821,6 +822,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)void musb_g_rx (struct musb *musb,u8 epnum) {u16 csr; +struct musb_request *req;struct usb_request *request;void __iomem *mbase = musb->mregs;struct musb_ep *musb_ep;
@@ -835,10 +837,12 @@ void musb_g_rx(struct musb *musb, u8 epnum)musb_ep_select (mbase, epnum); - request =next_request (musb_ep); -if (!request) + req =next_request (musb_ep); +if (!req)return ; + request = &req->request; + csr =musb_readw (epio,MUSB_RXCSR ); dma =is_dma_capable () ? musb_ep->dma :NULL ;
@@ -914,15 +918,15 @@ void musb_g_rx(struct musb *musb, u8 epnum)#endif musb_g_giveback (musb_ep, request,0 ); - request =next_request (musb_ep); -if (!request) + req =next_request (musb_ep); +if (!req)return ; }#if defined(CONFIG_USB_INVENTRA_DMA ) || defined(CONFIG_USB_TUSB_OMAP_DMA ) exit:#endif /* Analyze request */ -rxstate (musb,to_musb_request (request)); +rxstate (musb, req); }/* ------------------------------------------------------------ */
@@ -1171,7 +1175,6 @@ struct usb_request *musb_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)return NULL ; } -INIT_LIST_HEAD (&request->request.list); request->request.dma =DMA_ADDR_INVALID ; request->epnum = musb_ep->current_epnum; request->ep = musb_ep;
@@ -1257,10 +1260,10 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, }/* add request to the list */ -list_add_tail (&(request->request.list), &(musb_ep->req_list)); +list_add_tail (&request->list, &musb_ep->req_list);/* it this is the head of the queue, start i/o ... */ -if (!musb_ep->busy && &request->request.list == musb_ep->req_list.next) +if (!musb_ep->busy && &request->list == musb_ep->req_list.next)musb_ep_restart (musb, request); cleanup:
@@ -1349,7 +1352,7 @@ static int musb_gadget_set_halt(struct usb_ep *ep, int value)musb_ep_select (mbase, epnum); - request =to_musb_request (next_request (musb_ep)); + request =next_request (musb_ep);if (value) {if (request) { DBG(3, "request in progress, cannot halt %s\n",
drivers/usb/musb/musb_gadget.h +5 -2
@@ -35,6 +35,8 @@#ifndef __MUSB_GADGET_H#define __MUSB_GADGET_H +#include <linux/list.h> +enum buffer_map_state {UN_MAPPED =0 , PRE_MAPPED,
@@ -43,6 +45,7 @@ enum buffer_map_state {struct musb_request {struct usb_request request; +struct list_head list;struct musb_ep *ep;struct musb *musb;u8 tx;/* endpoint direction */
@@ -94,13 +97,13 @@ static inline struct musb_ep *to_musb_ep(struct usb_ep *ep) return ep ? container_of(ep, struct musb_ep, end_point) : NULL; } -static inline struct usb_request *next_request (struct musb_ep *ep) +static inline struct musb_request *next_request (struct musb_ep *ep) {struct list_head *queue = &ep->req_list;if (list_empty (queue))return NULL ; - return container_of(queue->next, struct usb_request, list); + return container_of(queue->next, struct musb_request, list); }extern void musb_g_tx (struct musb *musb,u8 epnum);
drivers/usb/musb/musb_gadget_ep0.c +14 -10
@@ -304,8 +304,7 @@ __acquires(musb->lock) }/* Maybe start the first request in the queue */ - request =to_musb_request ( -next_request (musb_ep)); + request =next_request (musb_ep);if (!musb_ep->busy && request) {DBG (3 ,"restarting the request\n" );musb_ep_restart (musb, request);
@@ -491,10 +490,12 @@ stall:static void ep0_rxstate (struct musb *musb) {void __iomem *regs = musb->control_ep->regs; +struct musb_request *request;struct usb_request *req;u16 count, csr; - req =next_ep0_request (musb); + request =next_ep0_request (musb); + req = &request->request;/* read packet and ack; or stall because of gadget driver bug: * should have provided the rx buffer before setup() returned.
@@ -544,17 +545,20 @@ static void ep0_rxstate(struct musb *musb)static void ep0_txstate (struct musb *musb) {void __iomem *regs = musb->control_ep->regs; -struct usb_request *request =next_ep0_request (musb); +struct musb_request *req =next_ep0_request (musb); +struct usb_request *request;u16 csr =MUSB_CSR0_TXPKTRDY ;u8 *fifo_src;u8 fifo_count; -if (!request) { +if (!req) {/* WARN_ON(1); */ DBG (2 ,"odd; csr0 %04x\n" ,musb_readw (regs,MUSB_CSR0 ));return ; } + request = &req->request; +/* load the data */ fifo_src = (u8 *) request->buf + request->actual; fifo_count = min((unsigned) MUSB_EP0_FIFOSIZE,
@@ -598,7 +602,7 @@ static void ep0_txstate(struct musb *musb)static void musb_read_setup (struct musb *musb,struct usb_ctrlrequest *req) { -struct usb_request *r; +struct musb_request *r;void __iomem *regs = musb->control_ep->regs;musb_read_fifo (&musb->endpoints[0 ],sizeof *req, (u8 *)req);
@@ -616,7 +620,7 @@ musb_read_setup(struct musb *musb, struct usb_ctrlrequest *req)/* clean up any leftover transfers */ r =next_ep0_request (musb);if (r) -musb_g_ep0_giveback (musb, r); +musb_g_ep0_giveback (musb, &r->request);/* For zero-data requests we want to delay the STATUS stage to * avoid SETUPEND errors. If we read data (OUT), delay accepting
@@ -758,11 +762,11 @@ irqreturn_t musb_g_ep0_irq(struct musb *musb)case MUSB_EP0_STAGE_STATUSOUT :/* end of sequence #1: write to host (TX state) */ { -struct usb_request *req; +struct musb_request *req; req =next_ep0_request (musb);if (req) -musb_g_ep0_giveback (musb, req); +musb_g_ep0_giveback (musb, &req->request); }/*
@@ -961,7 +965,7 @@ musb_g_ep0_queue(struct usb_ep *e, struct usb_request *r, gfp_t gfp_flags) }/* add request to the list */ -list_add_tail (&(req->request.list), &(ep->req_list)); +list_add_tail (&req->list, &ep->req_list); DBG(3, "queue to %s (%s), length=%d\n", ep->name, ep->is_in ? "IN/TX" : "OUT/RX",
Signature · 1 line
1.7.4.rc2
PATCH 4/12 usb: musb: Using runtime pm APIs for musb.
In reply to Felipe BalbiFrom: Hema HK <[email protected]>
Calling runtime pm APIs pm_runtime_put_sync() and pm_runtime_get_sync() for enabling/disabling the clocks, sysconfig settings.
Enable clock, configure no-idle/standby when active and configure force idle/standby and disable clock when idled. This is taken care by the runtime framework when driver calls the pm_runtime_get_sync and pm_runtime_put_sync APIs. Need to configure MUSB into force standby and force idle mode when usb not used
--- drivers/usb/musb/musb_core.h | 2 +- drivers/usb/musb/omap2430.c | 81 ++++++++++++------------------------------ 2 files changed, 24 insertions(+), 59 deletions(-)
drivers/usb/musb/musb_core.h +1 -1
@@ -360,7 +360,7 @@ struct musb_context_registers {#if defined(CONFIG_ARCH_OMAP2430 ) || defined(CONFIG_ARCH_OMAP3 ) || \ defined(CONFIG_ARCH_OMAP4 ) -u32 otg_sysconfig, otg_forcestandby; +u32 otg_forcestandby;#endif u8 power;u16 intrtxe, intrrxe;
drivers/usb/musb/omap2430.c +23 -58
180 lines not on this page · raw message
Signature · 1 line
1.7.4.rc2
PATCH 6/12 usb: otg: Remove one unnecessary I2C read request.
In reply to Felipe BalbiFrom: Hema HK <[email protected]>
To get the ID status there was an I2C read transfer. Removed this I2C read transfer as this info can be used from existing variable(linkstat).
--- drivers/usb/otg/twl6030-usb.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-)
drivers/usb/otg/twl6030-usb.c +2 -5
@@ -149,7 +149,6 @@ static int twl6030_set_phy_clk(struct otg_transceiver *x, int on)static int twl6030_phy_init (struct otg_transceiver *x) { -u8 hw_state;struct twl6030_usb *twl;struct device *dev;struct twl4030_usb_data *pdata;
@@ -158,9 +157,7 @@ static int twl6030_phy_init(struct otg_transceiver *x) dev = twl->dev; pdata = dev->platform_data; - hw_state =twl6030_readb (twl,TWL6030_MODULE_ID0 ,STS_HW_CONDITIONS ); - -if (hw_state &STS_USB_ID ) +if (twl->linkstat ==USB_EVENT_ID ) pdata->phy_power (twl->dev,1 ,1 );else pdata->phy_power (twl->dev,0 ,1 );
@@ -290,6 +287,7 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) status =USB_EVENT_ID ; twl->otg.default_a = true; twl->otg.state =OTG_STATE_A_IDLE ; + twl->linkstat = status;blocking_notifier_call_chain (&twl->otg.notifier, status, twl->otg.gadget); }else {
@@ -299,7 +297,6 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) 0x1); }twl6030_writeb (twl,TWL_MODULE_USB ,USB_ID_INT_LATCH_CLR , status); - twl->linkstat = status;return IRQ_HANDLED ; }
Signature · 1 line
1.7.4.rc2
PATCH 7/12 usb: otg: OMAP4430: Add phy_suspend function pointer to twl4030_usb_data
In reply to Felipe BalbiFrom: Hema HK <[email protected]>
Declare the .phy_suspend function pointer to twl4030_usb_data structure. OMAP internal phy suspend function will be hooked though this function pointer to use in the transceiver driver.
--- include/linux/i2c/twl.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
include/linux/i2c/twl.h +2 -0
@@ -600,6 +600,8 @@ struct twl4030_usb_data {int (*phy_power)(struct device *dev,int iD,int on);/* enable/disable phy clocks */ int (*phy_set_clock)(struct device *dev,int on); +/* suspend/resume of phy */ +int (*phy_suspend)(struct device *dev,int suspend); };struct twl4030_ins {
Signature · 1 line
1.7.4.rc2
PATCH 11/12 usb: musb: OMAP4430: Fix usb device detection if connected during boot
In reply to Felipe BalbiFrom: Hema HK <[email protected]>
OMAP4430 is embedded with UTMI PHY. This PHY does not support the OTG features like ID pin detection and VBUS detection. This function is exported to an external companion chip TWL6030. Software must retrieve the OTG HNP and SRP status from the TWL6030 and configure the bits inside the control module that drive the related USBOTGHS UTMI interface signals. It must also read back the UTMI signals needed to configure the TWL6030 OTG module.
Can find more details in the TRM[1]. [1]:http://focus.ti.com/pdfs/wtbu/OMAP4430_ES2.0_Public_TRM_vJ.pdf
In OMAP4430 musb driver VBUS and ID notifications are received from the transceiver driver. If the cable/device is connected during boot, notifications from transceiver driver will be missed till musb driver is loaded.
Patch to configure the transceiver in the platform_enable/disable functions and enable the vbus in the gadget driver based on the last_event of the otg_transceiver.
--- drivers/usb/musb/musb_gadget.c | 4 +++ drivers/usb/musb/omap2430.c | 53 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 52 insertions(+), 5 deletions(-)
drivers/usb/musb/musb_gadget.c +4 -0
@@ -1877,6 +1877,10 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,if (retval <0 ) {DBG (1 ,"add_hcd failed, %d\n" , retval); goto err2; + +if ((musb->xceiv->last_event ==USB_EVENT_ID ) + && musb->xceiv->set_vbus) +otg_set_vbus (musb->xceiv,1 ); } hcd->self.uses_pio_for_control =1 ;
drivers/usb/musb/omap2430.c +48 -5
70 lines not on this page · raw message
Signature · 1 line
1.7.4.rc2
Re: [patch-v2.6.39 08/12] usb: otg: OMAP4430: Introducing suspend function for power management
In reply to a message not in the archiveQuoted 7 lines · Felipe Balbi
From: Hema HK <[email protected]>
Introduced the suspend/resume function for the OMAP4430 internal PHY. This will be used by the twl6030-usb transceiver driver. Moved the clock enable/disable function calls and power on/off of the PHY code from power on/off functions to suspend/resume function.
Quoted 7 lines
Pass the suspend function through board data for OMAP4430sdp and OMAP4panda. This will be used by the twl6030-usb transceiver driver.
Signed-off-by Hema HK <[email protected]>Cc Tony Lindgren <[email protected]>Cc Paul Walmsley <[email protected]>Signed-off-by Felipe Balbi <[email protected]>
Tony, care to ack so I can take this via Greg's tree ?
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch-v2.6.39 08/12] usb: otg: OMAP4430: Introducing suspend function for power management
Quoted 11 lines · Felipe Balbi
Quoted 10 lines · Felipe Balbi
From: Hema HK <[email protected]>
Introduced the suspend/resume function for the OMAP4430 internal PHY. This will be used by the twl6030-usb transceiver driver. Moved the clock enable/disable function calls and power on/off of the PHY code from power on/off functions to suspend/resume function.
Pass the suspend function through board data for OMAP4430sdp and OMAP4panda. This will be used by the twl6030-usb transceiver driver.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Hema HK <[email protected]>Cc Tony Lindgren <[email protected]>Cc Paul Walmsley <[email protected]>Signed-off-by Felipe Balbi <[email protected]>Tony, care to ack so I can take this via Greg's tree ?
ping ??
Signature · 1 line
balbi
Tony Lindgren
Acked-byRe: [patch-v2.6.39 08/12] usb: otg: OMAP4430: Introducing suspend function for power management
In reply to a message not in the archiveQuoted 7 lines · Felipe Balbi
From: Hema HK <[email protected]>
Introduced the suspend/resume function for the OMAP4430 internal PHY. This will be used by the twl6030-usb transceiver driver. Moved the clock enable/disable function calls and power on/off of the PHY code from power on/off functions to suspend/resume function.
Quoted 7 lines
Pass the suspend function through board data for OMAP4430sdp and OMAP4panda. This will be used by the twl6030-usb transceiver driver.
Signed-off-by Hema HK <[email protected]>Cc Tony Lindgren <[email protected]>Cc Paul Walmsley <[email protected]>Signed-off-by Felipe Balbi <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch-v2.6.39 08/12] usb: otg: OMAP4430: Introducing suspend function for power management
In reply to a message not in the archiveQuoted 4 lines · Felipe Balbi
Quoted 2 lines
Tony, care to ack so I can take this via Greg's tree ?
ping ??
Sorry for the delay, replied to that patch.
Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier
In reply to Felipe BalbiHi Felipe,
Quoted 11 lines · ext Felipe Balbi
most of our notifications, will be called from IRQ context, so an atomic notifier suits the job better.
Signed-off-by Felipe Balbi <[email protected]>--- drivers/usb/otg/ab8500-usb.c | 6 +++--- drivers/usb/otg/nop-usb-xceiv.c | 2 +- drivers/usb/otg/twl4030-usb.c | 6 +++--- drivers/usb/otg/twl6030-usb.c | 8 ++++---- include/linux/usb/otg.h | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-)
You should fix drivers/usb/otg/ab8500-usb.c as well. Also, drivers/power/twl4030_charger.c will need to be made atomic notifier safe.
Signature · 1 line
heikki
Re: [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier
Quoted 15 lines · ext Heikki Krogerus
Hi Felipe,
Quoted 11 lines · ext Felipe Balbi
most of our notifications, will be called from IRQ context, so an atomic notifier suits the job better.
Signed-off-by Felipe Balbi <[email protected]>--- drivers/usb/otg/ab8500-usb.c | 6 +++--- drivers/usb/otg/nop-usb-xceiv.c | 2 +- drivers/usb/otg/twl4030-usb.c | 6 +++--- drivers/usb/otg/twl6030-usb.c | 8 ++++---- include/linux/usb/otg.h | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-)
Quoted 1 line
You should fix
drivers/usb/otg/ab8500-usb.cas well.
Sorry, ignore that :).
Quoted 2 lines
drivers/power/twl4030_charger.cwill need to be made atomic notifier safe.
Still valid I belive.
Signature · 5 lines
heikki -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier
Quoted 16 lines · Heikki Krogerus
Quoted 15 lines · ext Heikki Krogerus
Hi Felipe,
Quoted 11 lines · ext Felipe Balbi
most of our notifications, will be called from IRQ context, so an atomic notifier suits the job better.
Signed-off-by Felipe Balbi <[email protected]>--- drivers/usb/otg/ab8500-usb.c | 6 +++--- drivers/usb/otg/nop-usb-xceiv.c | 2 +- drivers/usb/otg/twl4030-usb.c | 6 +++--- drivers/usb/otg/twl6030-usb.c | 8 ++++---- include/linux/usb/otg.h | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-)
Quoted 8 lines
Quoted 1 line
You should fix
drivers/usb/otg/ab8500-usb.cas well.Sorry, ignore that :).
Quoted 2 lines
drivers/power/twl4030_charger.cwill need to be made atomic notifier safe.Still valid I belive.
oops, that thing is doing i2c transfers. Would you care to send a patch since you have that hardware easily available ??
Signature · 1 line
balbi
Re: [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier
In reply to a message not in the archiveQuoted 5 lines · ext Felipe Balbi
Quoted 2 lines
Quoted 2 lines
drivers/power/twl4030_charger.cwill need to be made atomic notifier safe.oops, that thing is doing i2c transfers. Would you care to send a patch since you have that hardware easily available ??
I can make a patch for this if you like, but I don't have the hw.
Signature · 5 lines
heikki -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier
Quoted 8 lines · Heikki Krogerus
Quoted 5 lines · ext Felipe Balbi
Quoted 2 lines
Quoted 2 lines
drivers/power/twl4030_charger.cwill need to be made atomic notifier safe.oops, that thing is doing i2c transfers. Would you care to send a patch since you have that hardware easily available ??
I can make a patch for this if you like, but I don't have the hw.
Aha, I got confused with the isp1710, sorry. If you can cook a patch please do and Cc Grazvydas Ignotas <[email protected]> when you send it ;-)
Signature · 1 line
balbi
Re: [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier
Quoted 5 lines · ext Felipe Balbi
Quoted 4 lines · Heikki Krogerus
Quoted 3 lines · ext Felipe Balbi
Quoted 2 lines
Quoted 2 lines
drivers/power/twl4030_charger.cwill need to be made atomic notifier safe.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
oops, that thing is doing i2c transfers. Would you care to send a patch since you have that hardware easily available ??
I can make a patch for this if you like, but I don't have the hw.
Aha, I got confused with the isp1710, sorry. If you can cook a patch please do and Cc Grazvydas Ignotas <[email protected]> when you send it ;-)
OK, np.
Signature · 1 line
heikki
Re: [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head
In reply to Felipe BalbiQuoted 6 lines · Felipe Balbi <balbi <at> ti.com> writes:
struct usb_request's
list_headis supposed to be used only by gadget drivers, but musb is abusing that. Give structmusb_requestits ownlist_headand prevent musb from poking into other driver's business.
Hi,
I think, the patch misses to fix the usage of "request->list" in musb_gadget_dequeue in musb_gadget.c.
I found out by having troubles with f_mass_storage. It needs musb_gadget_dequeue to work properly...
I backported the patch to android-2.6.35 kernel on a omap4 system and also fixed the musb_gadget_dequeue there so f_mass_storage seem to work at least there now...
Can you check this patch regarding some missing bits please?
Thanks,
Pavol.
Re: [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head
Quoted 17 lines · Pavol Kurina
Quoted 6 lines · Felipe Balbi <balbi <at> ti.com> writes:
struct usb_request's
list_headis supposed to be used only by gadget drivers, but musb is abusing that. Give structmusb_requestits ownlist_headand prevent musb from poking into other driver's business.Hi,
I think, the patch misses to fix the usage of "
request->list" inmusb_gadget_dequeueinmusb_gadget.c.I found out by having troubles with
f_mass_storage. It needsmusb_gadget_dequeueto work properly...
Quoted 7 lines
I backported the patch to android-2.6.35 kernel on a omap4 system and also fixed the
musb_gadget_dequeuethere sof_mass_storageseem to work at least there now...Can you check this patch regarding some missing bits please?
Looks like we need some extra tests to be added to g_zero, I tested with g_zero and it didn't find that problem. Anyway, here's a patch which probably fixes what you need to be fixed. Would you test it for me ?
drivers/usb/musb/musb_gadget.c +4 -3
@@ -1274,7 +1274,8 @@ cleanup:static int musb_gadget_dequeue (struct usb_ep *ep,struct usb_request *request) {struct musb_ep *musb_ep =to_musb_ep (ep); -struct usb_request *r; +struct musb_request req =to_musb_request (request); +struct musb_request *r;unsigned long flags;int status =0 ;struct musb *musb = musb_ep->musb;
@@ -1285,10 +1286,10 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)spin_lock_irqsave (&musb->lock, flags);list_for_each_entry (r, &musb_ep->req_list, list) { -if (r == request) +if (r == req)break ; } -if (r != request) { +if (r != req) {DBG (3 ,"request %p not queued to %s\n" , request, ep->name); status = -EINVAL ; goto done;
Signature · 1 line
balbi
Re: [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head
In reply to Pavol KurinaQuoted 89 lines · Pavol Kurina
Am 28.02.2011 09:43, schrieb Felipe Balbi:
Quoted 45 lines · Pavol Kurina
Quoted 15 lines
Quoted 5 lines · Felipe Balbi<balbi<at> ti.com> writes:
struct usb_request's
list_headis supposed to be used only by gadget drivers, but musb is abusing that. Give structmusb_requestits ownlist_headand prevent musb from poking into other driver's business.Hi,
I think, the patch misses to fix the usage of "
request->list" inmusb_gadget_dequeueinmusb_gadget.c.I found out by having troubles with
f_mass_storage. It needsmusb_gadget_dequeueto work properly...Quoted 7 lines
I backported the patch to android-2.6.35 kernel on a omap4 system and also fixed the
musb_gadget_dequeuethere sof_mass_storageseem to work at least there now...Can you check this patch regarding some missing bits please?
Looks like we need some extra tests to be added to
g_zero, I tested withg_zeroand it didn't find that problem. Anyway, here's a patch which probably fixes what you need to be fixed. Would you test it for me ?drivers/usb/musb/musb_gadget.c +2
-1@@ -1274,7 +1274,8 @@ cleanup:static int musb_gadget_dequeue (struct usb_ep *ep,struct usb_request *request) {struct musb_ep *musb_ep =to_musb_ep (ep); -struct usb_request *r; +struct musb_request req =to_musb_request (request); +struct musb_request *r;unsigned long flags;int status =0 ;struct musb *musb = musb_ep->musb;@@ -1285,10 +1286,10 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)spin_lock_irqsave (&musb->lock, flags);drivers/usb/musb/musb_gadget.c static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request) · line 1295
Quoted 10 lines
drivers/usb/musb/musb_gadget.c +2
-2list_for_each_entry (r,&musb_ep->req_list, list) { -if (r == request) +if (r == req)break ; } -if (r != request) { +if (r != req) {DBG (3 ,"request %p not queued to %s\n" , request, ep->name); status = -EINVAL ; goto done;I've tested this on my omap4 system with the android-2.6.35 kernel. It seems like
f_mass_storageand thef_adb
work fine.I've added one more change to your patch.
drivers/usb/musb/musb_gadget.c +2
-1@@ -1250,7 +1250,8 @@ cleanup:static int musb_gadget_dequeue (struct usb_ep *ep,struct usb_request *request) {struct musb_ep *musb_ep =to_musb_ep (ep); -struct usb_request *r; +struct musb_request *req =to_musb_request (request); +struct musb_request *r;unsigned long flags;int status =0 ;struct musb *musb = musb_ep->musb;drivers/usb/musb/musb_gadget.c +2
-2@@ -1261,17 +1262,17 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)spin_lock_irqsave (&musb->lock, flags);list_for_each_entry (r, &musb_ep->req_list, list) { -if (r == request) +if (r == req)break ; } -if (r != request) { +if (r != req) {
drivers/usb/musb/musb_gadget.c static int musb_gadget_dequeue(struct usb_ep · line 1278
Quoted 10 lines
drivers/usb/musb/musb_gadget.c +1
-1DBG (3 ,"request %p not queued to %s\n" , request, ep->name); status = -EINVAL ; goto done; }/* if the hardware doesn't have the request, easy ... */ -if (musb_ep->req_list.next != &request->list || musb_ep->busy) +if (musb_ep->req_list.next != &req->list || musb_ep->busy)musb_g_giveback (musb_ep, request, -ECONNRESET );
I'll fix it before Greg pulls, thanks
Signature · 1 line
balbi
Re: [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head
Hi,
Quoted 7 lines · Felipe Balbi
Review
Quoted 5 lines
/* if the hardware doesn't have the request, easy ... */(quoted diff) +1
-1- if (musb_ep->req_list.next != &request->list || musb_ep->busy) + if (musb_ep->req_list.next != &req->list || musb_ep->busy) musb_g_giveback(musb_ep, request, -ECONNRESET);I'll fix it before Greg pulls, thanks
fixed and pushed to for-next. Greg, now it seems to be safe to pull.
Signature · 1 line
balbi
Re: [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head
Quoted 9 lines · Felipe Balbi
Hi,
Quoted 6 lines · Felipe Balbi
Quoted 5 lines
/* if the hardware doesn't have the request, easy ... */(quoted diff) +1
-1- if (musb_ep->req_list.next != &request->list || musb_ep->busy) + if (musb_ep->req_list.next != &req->list || musb_ep->busy) musb_g_giveback(musb_ep, request, -ECONNRESET);
Quoted 3 lines
Quoted 1 line
I'll fix it before Greg pulls, thanks
fixed and pushed to for-next. Greg, now it seems to be safe to pull.
to late, please send me a patch fixing that when we're in -rc. I'm not sending pull requests for the merge window anymore :-(
Signature · 1 line
balbi
Re: [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head
In reply to Felipe BalbiAm 28.02.2011 09:43, schrieb Felipe Balbi:
Quoted 45 lines · Pavol Kurina
Quoted 15 lines
Quoted 5 lines · Felipe Balbi<balbi<at> ti.com> writes:
struct usb_request's
list_headis supposed to be used only by gadget drivers, but musb is abusing that. Give structmusb_requestits ownlist_headand prevent musb from poking into other driver's business.Hi,
I think, the patch misses to fix the usage of "
request->list" inmusb_gadget_dequeueinmusb_gadget.c.I found out by having troubles with
f_mass_storage. It needsmusb_gadget_dequeueto work properly...Quoted 7 lines
I backported the patch to android-2.6.35 kernel on a omap4 system and also fixed the
musb_gadget_dequeuethere sof_mass_storageseem to work at least there now...Can you check this patch regarding some missing bits please?
Looks like we need some extra tests to be added to
g_zero, I tested withg_zeroand it didn't find that problem. Anyway, here's a patch which probably fixes what you need to be fixed. Would you test it for me ?drivers/usb/musb/musb_gadget.c +2
-1@@ -1274,7 +1274,8 @@ cleanup:static int musb_gadget_dequeue (struct usb_ep *ep,struct usb_request *request) {struct musb_ep *musb_ep =to_musb_ep (ep); -struct usb_request *r; +struct musb_request req =to_musb_request (request); +struct musb_request *r;unsigned long flags;int status =0 ;struct musb *musb = musb_ep->musb;@@ -1285,10 +1286,10 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)spin_lock_irqsave (&musb->lock, flags);
drivers/usb/musb/musb_gadget.c static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request) · line 1295
Quoted 10 lines
drivers/usb/musb/musb_gadget.c +2
-2list_for_each_entry (r,&musb_ep->req_list, list) { -if (r == request) +if (r == req)break ; } -if (r != request) { +if (r != req) {DBG (3 ,"request %p not queued to %s\n" , request, ep->name); status = -EINVAL ; goto done;
I've tested this on my omap4 system with the android-2.6.35 kernel. It seems like f_mass_storage and the f_adb work fine.
I've added one more change to your patch.
drivers/usb/musb/musb_gadget.c +0 -0
@@ -1250,7 +1250,8 @@ cleanup: static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request
*request)
{
struct musb_ep *musb_ep = to_musb_ep(ep);
- struct usb_request *r;
+ struct musb_request *req = to_musb_request(request);
+ struct musb_request *r;
unsigned long flags;
int status = 0;
struct musb *musb = musb_ep->musb;
@@ -1261,17 +1262,17 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)
spin_lock_irqsave(&musb->lock, flags);
list_for_each_entry(r, &musb_ep->req_list, list) {
- if (r == request)
+ if (r == req)
break;
}
- if (r != request) {
+ if (r != req) {
DBG(3, "request %p not queued to %s\n", request, ep->name);
status = -EINVAL;
goto done;
}
/* if the hardware doesn't have the request, easy ... */
- if (musb_ep->req_list.next != &request->list || musb_ep->busy)
+ if (musb_ep->req_list.next != &req->list || musb_ep->busy)
musb_g_giveback(musb_ep, request, -ECONNRESET);Best regards,
Pavol.