From be18a251892ab85d1bc10d87d336ee25f8dba615 Mon Sep 17 00:00:00 2001 From: Per Forlin Date: Wed, 17 Aug 2011 11:03:40 +0200 Subject: usb: musb: ux500: optimize DMA callback routine Skip the use of work queue and call musb_dma_completion() directly from DMA callback context. Here follows measurements on a Snowball board with ondemand governor active. Performance using work queue: (105 MB) copied, 6.23758 s, 16.8 MB/s (105 MB) copied, 5.7151 s, 18.3 MB/s (105 MB) copied, 5.83583 s, 18.0 MB/s (105 MB) copied, 5.93611 s, 17.7 MB/s Performance without work queue (105 MB) copied, 5.62173 s, 18.7 MB/s (105 MB) copied, 5.61811 s, 18.7 MB/s (105 MB) copied, 5.57817 s, 18.8 MB/s (105 MB) copied, 5.58549 s, 18.8 MB/s Signed-off-by: Per Forlin Acked-by: Mian Yousaf Kaukab Signed-off-by: Felipe Balbi --- drivers/usb/musb/ux500_dma.c | 39 +++------------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) (limited to 'drivers/usb/musb') diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c index ef4333f4bbe0..a163632877af 100644 --- a/drivers/usb/musb/ux500_dma.c +++ b/drivers/usb/musb/ux500_dma.c @@ -37,7 +37,6 @@ struct ux500_dma_channel { struct dma_channel channel; struct ux500_dma_controller *controller; struct musb_hw_ep *hw_ep; - struct work_struct channel_work; struct dma_chan *dma_chan; unsigned int cur_len; dma_cookie_t cookie; @@ -56,31 +55,11 @@ struct ux500_dma_controller { dma_addr_t phy_base; }; -/* Work function invoked from DMA callback to handle tx transfers. */ -static void ux500_tx_work(struct work_struct *data) -{ - struct ux500_dma_channel *ux500_channel = container_of(data, - struct ux500_dma_channel, channel_work); - struct musb_hw_ep *hw_ep = ux500_channel->hw_ep; - struct musb *musb = hw_ep->musb; - unsigned long flags; - - dev_dbg(musb->controller, "DMA tx transfer done on hw_ep=%d\n", - hw_ep->epnum); - - spin_lock_irqsave(&musb->lock, flags); - ux500_channel->channel.actual_len = ux500_channel->cur_len; - ux500_channel->channel.status = MUSB_DMA_STATUS_FREE; - musb_dma_completion(musb, hw_ep->epnum, - ux500_channel->is_tx); - spin_unlock_irqrestore(&musb->lock, flags); -} - /* Work function invoked from DMA callback to handle rx transfers. */ -static void ux500_rx_work(struct work_struct *data) +void ux500_dma_callback(void *private_data) { - struct ux500_dma_channel *ux500_channel = container_of(data, - struct ux500_dma_channel, channel_work); + struct dma_channel *channel = private_data; + struct ux500_dma_channel *ux500_channel = channel->private_data; struct musb_hw_ep *hw_ep = ux500_channel->hw_ep; struct musb *musb = hw_ep->musb; unsigned long flags; @@ -94,14 +73,7 @@ static void ux500_rx_work(struct work_struct *data) musb_dma_completion(musb, hw_ep->epnum, ux500_channel->is_tx); spin_unlock_irqrestore(&musb->lock, flags); -} - -void ux500_dma_callback(void *private_data) -{ - struct dma_channel *channel = (struct dma_channel *)private_data; - struct ux500_dma_channel *ux500_channel = channel->private_data; - schedule_work(&ux500_channel->channel_work); } static bool ux500_configure_channel(struct dma_channel *channel, @@ -330,7 +302,6 @@ static int ux500_dma_controller_start(struct dma_controller *c) void **param_array; struct ux500_dma_channel *channel_array; u32 ch_count; - void (*musb_channel_work)(struct work_struct *); dma_cap_mask_t mask; if ((data->num_rx_channels > UX500_MUSB_DMA_NUM_RX_CHANNELS) || @@ -347,7 +318,6 @@ static int ux500_dma_controller_start(struct dma_controller *c) channel_array = controller->rx_channel; ch_count = data->num_rx_channels; param_array = data->dma_rx_param_array; - musb_channel_work = ux500_rx_work; for (dir = 0; dir < 2; dir++) { for (ch_num = 0; ch_num < ch_count; ch_num++) { @@ -374,15 +344,12 @@ static int ux500_dma_controller_start(struct dma_controller *c) return -EBUSY; } - INIT_WORK(&ux500_channel->channel_work, - musb_channel_work); } /* Prepare the loop for TX channels */ channel_array = controller->tx_channel; ch_count = data->num_tx_channels; param_array = data->dma_tx_param_array; - musb_channel_work = ux500_tx_work; is_tx = 1; } -- cgit v1.2.1 From ea737554451d9fae1207e84a3d2c495bbfcd3f08 Mon Sep 17 00:00:00 2001 From: Vikram Pandita Date: Wed, 7 Sep 2011 09:19:23 -0700 Subject: usb: musb: omap2+: fix context api's RxFifoSz, TxFifoSz, RxFifoAddr, TxFifoAddr are all indexed registers. So before doing a context save or restore, INDEX register should be set, then only one gets to the right register offset. Signed-off-by: Vikram Pandita Signed-off-by: Anand Gadiyar Signed-off-by: Felipe Balbi --- drivers/usb/musb/musb_core.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/usb/musb') diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index b63ab1570103..2141976d423c 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2158,6 +2158,7 @@ static void musb_save_context(struct musb *musb) if (!epio) continue; + musb_writeb(musb_base, MUSB_INDEX, i); musb->context.index_regs[i].txmaxp = musb_readw(epio, MUSB_TXMAXP); musb->context.index_regs[i].txcsr = @@ -2233,6 +2234,7 @@ static void musb_restore_context(struct musb *musb) if (!epio) continue; + musb_writeb(musb_base, MUSB_INDEX, i); musb_writew(epio, MUSB_TXMAXP, musb->context.index_regs[i].txmaxp); musb_writew(epio, MUSB_TXCSR, -- cgit v1.2.1 From e25bec160158abe86c276d7d206264afc3646281 Mon Sep 17 00:00:00 2001 From: Hema HK Date: Wed, 7 Sep 2011 09:19:24 -0700 Subject: usb: musb: omap2+: save and restore OTG_INTERFSEL we need to save and restore OTG_INTERFSEL register else we will be unable to function on resume after OFF mode. Reported-by: Devaraj Rangasamy Signed-off-by: Hema HK Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Vikram Pandita Signed-off-by: Felipe Balbi --- drivers/usb/musb/musb_core.h | 1 + drivers/usb/musb/omap2430.c | 6 ++++++ 2 files changed, 7 insertions(+) (limited to 'drivers/usb/musb') diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index b3c065ab9dbc..3259a6bbaba3 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -311,6 +311,7 @@ struct musb_context_registers { u8 index, testmode; u8 devctl, busctl, misc; + u32 otg_interfsel; struct musb_csr_regs index_regs[MUSB_C_NUM_EPS]; }; diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index ba85f273e487..78eb13a33796 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -491,6 +491,9 @@ static int omap2430_runtime_suspend(struct device *dev) struct omap2430_glue *glue = dev_get_drvdata(dev); struct musb *musb = glue_to_musb(glue); + musb->context.otg_interfsel = musb_readl(musb->mregs, + OTG_INTERFSEL); + omap2430_low_level_exit(musb); otg_set_suspend(musb->xceiv, 1); @@ -503,6 +506,9 @@ static int omap2430_runtime_resume(struct device *dev) struct musb *musb = glue_to_musb(glue); omap2430_low_level_init(musb); + musb_writel(musb->mregs, OTG_INTERFSEL, + musb->context.otg_interfsel); + otg_set_suspend(musb->xceiv, 0); return 0; -- cgit v1.2.1 From 2e7fc3ba68e28acbcc9f4ee753be12be84533ba2 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Sun, 2 Oct 2011 16:45:45 +0200 Subject: usb: musb: use a Kconfig choice to pick the right DMA method The logic to allow only one DMA driver in MUSB is currently flawed, because it also allows picking no DMA driver at all and also not selecting PIO mode. Using a choice statement makes this foolproof for now and also simplifies the Makefile. Unfortunately, we will have to revisit this when we start supporting multiple ARM platforms in a single kernel binary, because at that point we will actually need to select multiple DMA drivers and pick the right one at run-time. Signed-off-by: Arnd Bergmann Cc: Felipe Balbi Signed-off-by: Felipe Balbi --- drivers/usb/musb/Kconfig | 57 ++++++++++++++++++++++++++++------------------- drivers/usb/musb/Makefile | 26 ++++----------------- 2 files changed, 38 insertions(+), 45 deletions(-) (limited to 'drivers/usb/musb') diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 07a03460a598..b1c8a839799c 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig @@ -65,46 +65,57 @@ config USB_MUSB_UX500 endchoice -config MUSB_PIO_ONLY - bool 'Disable DMA (always use PIO)' - depends on USB_MUSB_HDRC - default USB_MUSB_TUSB6010 || USB_MUSB_DA8XX || USB_MUSB_AM35X +choice + prompt 'MUSB DMA mode' + default USB_UX500_DMA if USB_MUSB_UX500 + default USB_INVENTRA_DMA if USB_MUSB_OMAP2PLUS || USB_MUSB_BLACKFIN + default USB_TI_CPPI_DMA if USB_MUSB_DAVINCI + default USB_TUSB_OMAP_DMA if USB_MUSB_TUSB6010 + default MUSB_PIO_ONLY if USB_MUSB_TUSB6010 || USB_MUSB_DA8XX || USB_MUSB_AM35X help - All data is copied between memory and FIFO by the CPU. - DMA controllers are ignored. - - Do not select 'n' here unless DMA support for your SOC or board - is unavailable (or unstable). When DMA is enabled at compile time, - you can still disable it at run time using the "use_dma=n" module - parameter. + Unfortunately, only one option can be enabled here. Ideally one + should be able to build all these drivers into one kernel to + allow using DMA on multiplatform kernels. config USB_UX500_DMA - bool - depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY - default USB_MUSB_UX500 + bool 'ST Ericsson U8500 and U5500' + depends on USB_MUSB_HDRC + depends on USB_MUSB_UX500 help Enable DMA transfers on UX500 platforms. config USB_INVENTRA_DMA - bool - depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY - default USB_MUSB_OMAP2PLUS || USB_MUSB_BLACKFIN + bool 'Inventra' + depends on USB_MUSB_HDRC + depends on USB_MUSB_OMAP2PLUS || USB_MUSB_BLACKFIN help Enable DMA transfers using Mentor's engine. config USB_TI_CPPI_DMA - bool - depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY - default USB_MUSB_DAVINCI + bool 'TI CPPI (Davinci)' + depends on USB_MUSB_HDRC + depends on USB_MUSB_DAVINCI help Enable DMA transfers when TI CPPI DMA is available. config USB_TUSB_OMAP_DMA - bool - depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY + bool 'TUSB 6010' + depends on USB_MUSB_HDRC depends on USB_MUSB_TUSB6010 depends on ARCH_OMAP - default y help Enable DMA transfers on TUSB 6010 when OMAP DMA is available. +config MUSB_PIO_ONLY + bool 'Disable DMA (always use PIO)' + depends on USB_MUSB_HDRC + help + All data is copied between memory and FIFO by the CPU. + DMA controllers are ignored. + + Do not choose this unless DMA support for your SOC or board + is unavailable (or unstable). When DMA is enabled at compile time, + you can still disable it at run time using the "use_dma=n" module + parameter. + +endchoice diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile index d8fd9d092dec..88bfb9dee4bf 100644 --- a/drivers/usb/musb/Makefile +++ b/drivers/usb/musb/Makefile @@ -24,25 +24,7 @@ obj-$(CONFIG_USB_MUSB_UX500) += ux500.o # PIO only, or DMA (several potential schemes). # though PIO is always there to back up DMA, and for ep0 -ifneq ($(CONFIG_MUSB_PIO_ONLY),y) - - ifeq ($(CONFIG_USB_INVENTRA_DMA),y) - musb_hdrc-y += musbhsdma.o - - else - ifeq ($(CONFIG_USB_TI_CPPI_DMA),y) - musb_hdrc-y += cppi_dma.o - - else - ifeq ($(CONFIG_USB_TUSB_OMAP_DMA),y) - musb_hdrc-y += tusb6010_omap.o - - else - ifeq ($(CONFIG_USB_UX500_DMA),y) - musb_hdrc-y += ux500_dma.o - - endif - endif - endif - endif -endif +musb_hdrc-$(CONFIG_USB_INVENTRA_DMA) += musbhsdma.o +musb_hdrc-$(CONFIG_USB_TI_CPPI_DMA) += cppi_dma.o +musb_hdrc-$(CONFIG_USB_TUSB_OMAP_DMA) += tusb6010_omap.o +musb_hdrc-$(CONFIG_USB_UX500_DMA) += ux500_dma.o -- cgit v1.2.1 From 9a35f8767a568bdbb21ba7c3276fdc5321e3960d Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Sun, 2 Oct 2011 16:45:47 +0200 Subject: usb: musb: allow building USB_MUSB_TUSB6010 as a module Commit 1376d92f9 "usb: musb: allow musb and glue layers to be modules" made the USB_MUSB_TUSB6010 option modular, but actually building the driver as a module does not work, so various randconfig builds actually fail. This changes all code that depends on the option to also check for modular builds, and exports the necessary symbols. Signed-off-by: Arnd Bergmann Acked-by: Tony Lindgren Signed-off-by: Felipe Balbi --- drivers/usb/musb/musb_core.c | 3 ++- drivers/usb/musb/musb_io.h | 2 +- drivers/usb/musb/tusb6010.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/usb/musb') diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 2141976d423c..90b9da1428b4 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1432,7 +1432,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) struct musb_hw_ep *hw_ep = musb->endpoints + i; hw_ep->fifo = MUSB_FIFO_OFFSET(i) + mbase; -#ifdef CONFIG_USB_MUSB_TUSB6010 +#if defined(CONFIG_USB_MUSB_TUSB6010) || defined (CONFIG_USB_MUSB_TUSB6010_MODULE) hw_ep->fifo_async = musb->async + 0x400 + MUSB_FIFO_OFFSET(i); hw_ep->fifo_sync = musb->sync + 0x400 + MUSB_FIFO_OFFSET(i); hw_ep->fifo_sync_va = @@ -1631,6 +1631,7 @@ void musb_dma_completion(struct musb *musb, u8 epnum, u8 transmit) } } } +EXPORT_SYMBOL_GPL(musb_dma_completion); #else #define use_dma 0 diff --git a/drivers/usb/musb/musb_io.h b/drivers/usb/musb/musb_io.h index 03c6ccdbb3be..e61aa95f2d2a 100644 --- a/drivers/usb/musb/musb_io.h +++ b/drivers/usb/musb/musb_io.h @@ -74,7 +74,7 @@ static inline void musb_writel(void __iomem *addr, unsigned offset, u32 data) { __raw_writel(data, addr + offset); } -#ifdef CONFIG_USB_MUSB_TUSB6010 +#if defined(CONFIG_USB_MUSB_TUSB6010) || defined (CONFIG_USB_MUSB_TUSB6010_MODULE) /* * TUSB6010 doesn't allow 8-bit access; 16-bit access is the minimum. diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index ec1480191f78..1f405616e6cd 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -56,6 +56,7 @@ u8 tusb_get_revision(struct musb *musb) return rev; } +EXPORT_SYMBOL_GPL(tusb_get_revision); static int tusb_print_revision(struct musb *musb) { -- cgit v1.2.1 From 7d5b49a202c4201a8afc36f9e55624894aba9fb5 Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Fri, 14 Oct 2011 10:45:15 +0300 Subject: usb: musb: headers cleanup Remove a few unnecessary headers from a few files. Signed-off-by: Felipe Balbi --- drivers/usb/musb/musb_core.h | 1 - drivers/usb/musb/musb_debugfs.c | 8 -------- drivers/usb/musb/musb_gadget.c | 2 -- drivers/usb/musb/musb_gadget_ep0.c | 1 - drivers/usb/musb/omap2430.c | 1 - 5 files changed, 13 deletions(-) (limited to 'drivers/usb/musb') diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 3259a6bbaba3..bd2e6b8b814e 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 61f4ee466df7..13d9af9bf920 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -33,11 +33,7 @@ #include #include -#include #include -#include -#include -#include #include #include @@ -46,10 +42,6 @@ #include "musb_core.h" #include "musb_debug.h" -#ifdef CONFIG_ARCH_DAVINCI -#include "davinci.h" -#endif - struct musb_register_map { char *name; unsigned offset; diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 922148ff8d29..f2c5bcbf2541 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -40,8 +40,6 @@ #include #include #include -#include -#include #include #include diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c index 6a0d0467ec74..e40d7647caf1 100644 --- a/drivers/usb/musb/musb_gadget_ep0.c +++ b/drivers/usb/musb/musb_gadget_ep0.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 78eb13a33796..2f6cd431fb1c 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.1 From 1e546aa6c4cfe83050fc78487c8aa78b6947006c Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Fri, 14 Oct 2011 10:22:29 +0300 Subject: usb: musb: drop ARCH dependency musb core driver and tusb6010 glue layer don't depend on anything which is ARCH-specific. It builds fine on x86 and ARM. Dropping the dependency so we can compile-test on linux-next. Signed-off-by: Felipe Balbi --- drivers/usb/musb/Kconfig | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/usb/musb') diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index b1c8a839799c..84a022411e38 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig @@ -6,7 +6,6 @@ # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller config USB_MUSB_HDRC depends on USB && USB_GADGET - depends on (ARM || (BF54x && !BF544) || (BF52x && !BF522 && !BF523)) select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN) select TWL4030_USB if MACH_OMAP_3430SDP select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA @@ -45,7 +44,6 @@ config USB_MUSB_DA8XX config USB_MUSB_TUSB6010 tristate "TUSB6010" - depends on ARCH_OMAP config USB_MUSB_OMAP2PLUS tristate "OMAP2430 and onwards" -- cgit v1.2.1 From 712d8efafbbcbe617f9ad706f6ca1ffea4bbf2e8 Mon Sep 17 00:00:00 2001 From: Vikram Pandita Date: Fri, 12 Aug 2011 07:38:51 -0700 Subject: usb: musb: fix pm_runtime calls while atomic musb pm_runtime_get_sync call happens in intrrupt context on cable attach case That can result in re-enabling the interrupts and cause side affects. So move the code to a work queue. Following is the error path hit on cable attach: BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:802 in_atomic(): 0, irqs_disabled(): 0, pid: 18, name: irq/378-twl6030 Backtrace: [] (dump_backtrace+0x0/0x110) from [] (dump_stack+0x18/0x1c) [] (dump_stack+0x0/0x1c) from [] (__might_sleep+0x130/0x134) [] (__might_sleep+0x0/0x134) from [] (__pm_runtime_resume+0x94/0x98) [] (__pm_runtime_resume+0x0/0x98) from [] (musb_otg_notifications+0x9c/0x164) [] (musb_otg_notifications+0x0/0x164) from [] (notifier_call_chain+0x4c/0x8c) [] (notifier_call_chain+0x0/0x8c) from [] (__atomic_notifier_call_chain+0x40/0x54) [] (__atomic_notifier_call_chain+0x0/0x54) from [] (atomic_notifier_call_chain+0x20/0x28) [] (atomic_notifier_call_chain+0x0/0x28) from [] (twl6030_usb_irq+0xc8/0xdc) [] (twl6030_usb_irq+0x0/0xdc) from [] (irq_thread_fn+0x24/0x40) [] (irq_thread_fn+0x0/0x40) from [] (irq_thread+0x150/0x1d8) [] (irq_thread+0x0/0x1d8) from [] (kthread+0x94/0x98) [] (kthread+0x0/0x98) from [] (do_exit+0x0/0x720) Tested with: MUSB Device mode: Cold boot / Hot plug MUSB Host mode: Cold boot / Hot plug Signed-off-by: Vikram Pandita Signed-off-by: Moiz Sonasath Signed-off-by: Vikram Pandita Signed-off-by: Felipe Balbi --- drivers/usb/musb/musb_core.h | 2 ++ drivers/usb/musb/omap2430.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'drivers/usb/musb') diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index bd2e6b8b814e..3d28fb8a2dc9 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -327,6 +327,7 @@ struct musb { irqreturn_t (*isr)(int, void *); struct work_struct irq_work; + struct work_struct otg_notifier_work; u16 hwvers; /* this hub status bit is reserved by USB 2.0 and not seen by usbcore */ @@ -372,6 +373,7 @@ struct musb { u16 int_tx; struct otg_transceiver *xceiv; + u8 xceiv_event; int nIrq; unsigned irq_wake:1; diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 2f6cd431fb1c..fd5dd46039ad 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -227,11 +227,21 @@ static int musb_otg_notifications(struct notifier_block *nb, unsigned long event, void *unused) { struct musb *musb = container_of(nb, struct musb, nb); + + musb->xceiv_event = event; + schedule_work(&musb->otg_notifier_work); + + return 0; +} + +static void musb_otg_notifier_work(struct work_struct *data_notifier_work) +{ + struct musb *musb = container_of(data_notifier_work, struct musb, otg_notifier_work); struct device *dev = musb->controller; struct musb_hdrc_platform_data *pdata = dev->platform_data; struct omap_musb_board_data *data = pdata->board_data; - switch (event) { + switch (musb->xceiv_event) { case USB_EVENT_ID: dev_dbg(musb->controller, "ID GND\n"); @@ -296,6 +306,8 @@ static int omap2430_musb_init(struct musb *musb) return -ENODEV; } + INIT_WORK(&musb->otg_notifier_work, musb_otg_notifier_work); + status = pm_runtime_get_sync(dev); if (status < 0) { dev_err(dev, "pm_runtime_get_sync FAILED"); -- cgit v1.2.1 From e7f4e73287d2915499c821b884f70f42187e2a74 Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Thu, 24 Nov 2011 15:42:10 +0200 Subject: usb: musb: omap2430: fix compile warning fix the following compile warning: drivers/usb/musb/omap2430.c: In function 'musb_otg_notifier_work': drivers/usb/musb/omap2430.c:279:3: warning: 'return' with a value, in function returning void drivers/usb/musb/omap2430.c:282:2: warning: 'return' with a value, in function returning void Signed-off-by: Felipe Balbi --- drivers/usb/musb/omap2430.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/usb/musb') diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index fd5dd46039ad..c24dc26b9be2 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -283,10 +283,7 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work) break; default: dev_dbg(musb->controller, "ID float\n"); - return NOTIFY_DONE; } - - return NOTIFY_OK; } static int omap2430_musb_init(struct musb *musb) -- cgit v1.2.1