aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3
AgeCommit message (Collapse)AuthorFilesLines
2013-07-15usb: dwc3: gadget: don't prevent gadget from being probed if we failFelipe Balbi1-0/+1
In case we fail our ->udc_start() callback, we should be ready to accept another modprobe following the failed one. We had forgotten to clear dwc->gadget_driver back to NULL and, because of that, we were preventing gadget driver modprobe from being retried. Cc: <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-06-12Merge tag 'usb-for-v3.11' of ↵Greg Kroah-Hartman2-60/+192
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: usb: patches for v3.11 merge window All function drivers are now converted to our new configfs-based binding. Eventually this will help us getting rid of in-kernel gadget drivers and only keep function drivers in the kernel. MUSB was taught that it needs to be built for host-only and device-only modes too. We had this support long ago but it involved a ridiculous amount of ifdefs. Now we have a much cleaner approach. Samsung Exynos4 platform now implements HSIC support. We're introducing support for AB8540 and AB9540 PHYs. MUSB module reinsertion now works as expected, before we were getting -EBUSY being returned by the resource checks done on driver core. DWC3 now has minimum support for TI's AM437x series of SoCs. OMAP5 USB3 PHY learned one extra DPLL configuration values because that PHY is reused in TI's DRA7xx devices. We're introducing support for Faraday fotg210 UDCs. Last, but not least, the usual set of non-critical fixes and cleanups ranging from usage of platform_{get,set}_drvdata to lock improvements. Signed-of-by: Felipe Balbi <[email protected]>
2013-06-12usb: dwc3: omap: Adds dwc3_omap_readl/writel wrappersGeorge Cherian1-57/+116
This patch adds wrappers to dwc3_omap_readl/writel calls to accomodate both OMAP5 and AM437x reg maps (It uses the cached register offsets). Also renames OMAP5 IRQ1 as IRQMISC and IRQ1 bits as IRQMISC bits. Signed-off-by: George Cherian <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-06-12usb: dwc3: omap: initialize the register offset values for omap5 and AM437xGeorge Cherian1-0/+57
This patch Initializes the register offset values depending on the X_MAJOR of USBOTGSS_REVISION register. Also adds register offset defines and new debug register defines. X_MAJOR is 2 for both OMAP5 and AM437x. But both have different glue register layout. Differentiate AM437x using dt compatible. Register offsets are cached in dwc3_omap struct for reg reads and writes. Signed-off-by: George Cherian <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-06-12usb: dwc3: omap: Adding am437x specific register map changesGeorge Cherian1-0/+6
AM437x and OMAP5 dwc3 subsytem have different register map. Major differences are as follows. OMAP5 has one main interrupt and one misc interrupt Aegis has four main interrupts and one misc interrupt. Miscellanous Interrupt offsets are changed. UTMI OTG Control and Status Registers offsets are changed. DEBUG Configuration and Status Registers are changed. The main intend of the patch is to re-use the same wrapper driver for both OMAP5 and AM437x, by using the x_major in revision register and adjusting the offsets. This patch adds the register map offsets and adds offset variables in struct dwc3_omap to cache the offsets Signed-off-by: George Cherian <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-06-12usb: dwc3: omap: improve error handling of dwc3_omap_probeKishon Vijay Abraham I1-3/+14
Improved the error handling of dwc3_omap_probe so that on error conditions dwc3_omap is left in the original state. Signed-off-by: Kishon Vijay Abraham I <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-06-01usb: dwc3: remove redundant D0 power state setYijing Wang1-1/+0
Pci_enable_device() will set device power state to D0, so it's no need to do it again in dwc3_pci_probe(). Signed-off-by: Yijing Wang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-05-28usb: dwc3: gadget: free trb pool only from epnum 2George Cherian1-4/+12
we never allocate a TRB pool for physical endpoints 0 and 1 so trying to free it (a invalid TRB pool pointer) will lead us in a warning while removing dwc3.ko module. In order to fix the situation, all we have to do is skip dwc3_free_trb_pool() for physical endpoints 0 and 1 just as we while deleting endpoints from the endpoints list. Cc: [email protected] Signed-off-by: George Cherian <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-05-28usb: dwc3: exynos: PHY should be deleted later than dwc3 corePeter Chen1-1/+1
If the glue layer is removed first (core layer later), it deletes the phy device first, then the core device. But at core's removal, it still uses PHY's resources, it may cause kernel's oops. It is much like the problem Paul Zimmerman reported at: http://marc.info/?l=linux-usb&m=136547502011472&w=2. Besides, it is reasonable the PHY is deleted at last as the controller is the PHY's user. Signed-off-by: Peter Chen <[email protected]> Cc: <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-05-28usb: dwc3: pci: PHY should be deleted later than dwc3 corePeter Chen1-1/+1
If the glue layer is removed first (core layer later), it deletes the phy device first, then the core device. But at core's removal, it still uses PHY's resources, it may cause kernel's oops. It is much like the problem Paul Zimmerman reported at: http://marc.info/?l=linux-usb&m=136547502011472&w=2. Besides, it is reasonable the PHY is deleted at last as the controller is the PHY's user. Signed-off-by: Peter Chen <[email protected]> Cc: <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-05-16USB: set device dma_mask without reference to global dataStephen Warren1-3/+3
Many USB host drivers contain code such as: if (!pdev->dev.dma_mask) pdev->dev.dma_mask = &tegra_ehci_dma_mask; ... where tegra_ehci_dma_mask is a global. I suspect this code originated in commit 4a53f4e "USB: ehci-tegra: add probing through device tree" and was simply copied everywhere else. This works fine when the code is built-in, but can cause a crash when the code is in a module. The first module load sets up the dma_mask pointer, but if the module is removed and re-inserted, the value is now non-NULL, and hence is not updated to point at the new location, and hence points at a stale location within the previous module load address, which in turn causes a crash if the pointer is de-referenced. The simplest way of solving this seems to be to copy the code from ehci-platform.c, which uses the coherent_dma_mask as the target for the dma_mask pointer. Suggested-by: Arnd Bergmann <[email protected]> Signed-off-by: Stephen Warren <[email protected]> Acked-by: Tony Prisk <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-05-15usb: dwc3: Fix compilation break when building with USB_DWC3_DUAL_ROLE=yVivek Gautam1-3/+3
The commit: 388e5c5 usb: dwc3: remove dwc3 dependency on host AND gadget breaks compilation when USB=y, USB_GADGET=m, USB_DWC3=y and USB_DWC3_DUAL_ROLE=y. drivers/built-in.o: In function `dwc3_gadget_giveback': drivers/usb/dwc3/gadget.c:271: undefined reference to `usb_gadget_unmap_request' drivers/built-in.o: In function `__dwc3_gadget_kick_transfer': drivers/usb/dwc3/gadget.c:1005: undefined reference to `usb_gadget_unmap_request' drivers/built-in.o: In function `__dwc3_gadget_ep_queue': drivers/usb/dwc3/gadget.c:1073: undefined reference to `usb_gadget_map_request' drivers/built-in.o: In function `dwc3_gadget_reset_interrupt': drivers/usb/dwc3/gadget.c:2165: undefined reference to `usb_gadget_set_state' drivers/built-in.o: In function `dwc3_gadget_init': drivers/usb/dwc3/gadget.c:2647: undefined reference to `usb_add_gadget_udc' drivers/built-in.o: In function `dwc3_gadget_exit': drivers/usb/dwc3/gadget.c:2681: undefined reference to `usb_del_gadget_udc' drivers/built-in.o: In function `__dwc3_ep0_do_control_data': drivers/usb/dwc3/ep0.c:929: undefined reference to `usb_gadget_map_request' drivers/usb/dwc3/ep0.c:906: undefined reference to `usb_gadget_map_request' drivers/built-in.o: In function `dwc3_ep0_set_config': drivers/usb/dwc3/ep0.c:575: undefined reference to `usb_gadget_set_state' drivers/built-in.o: In function `dwc3_ep0_set_address': drivers/usb/dwc3/ep0.c:520: undefined reference to `usb_gadget_set_state' drivers/usb/dwc3/ep0.c:522: undefined reference to `usb_gadget_set_state' drivers/built-in.o: In function `dwc3_ep0_set_config': drivers/usb/dwc3/ep0.c:556: undefined reference to `usb_gadget_set_state' Making changes similar to patch: 71a5e61 usb: chipidea: fix and improve dependencies if usb host or gadget support is built as module Let us limit the DWC3 mode to depend on corresponding usb-subsystem and USB_DWC3. Signed-off-by: Vivek Gautam <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Fengguang Wu <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-04-02usb: dwc3: add CONFIG_PM_SLEEP to suspend/resume functionsJingoo Han3-5/+5
Add CONFIG_PM_SLEEP to suspend/resume functions to fix the following build warning when CONFIG_PM_SLEEP is not selected. This is because sleep PM callbacks defined by SET_SYSTEM_SLEEP_PM_OPS are only used when the CONFIG_PM_SLEEP is enabled. Unnecessary CONFIG_PM ifdefs are removed. drivers/usb/dwc3/core.c:682:12: warning: 'dwc3_suspend' defined but not used [-Wunused-function] drivers/usb/dwc3/core.c:709:12: warning: 'dwc3_resume' defined but not used [-Wunused-function] drivers/usb/dwc3/dwc3-omap.c:430:12: warning: 'dwc3_omap_suspend' defined but not used [-Wunused-function] drivers/usb/dwc3/dwc3-omap.c:440:12: warning: 'dwc3_omap_resume' defined but not used [-Wunused-function] drivers/usb/dwc3/dwc3-exynos.c:185:12: warning: 'dwc3_exynos_suspend' defined but not used [-Wunused-function] drivers/usb/dwc3/dwc3-exynos.c:194:12: warning: 'dwc3_exynos_resume' defined but not used [-Wunused-function] Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: fix PHY error handlingFelipe Balbi1-2/+22
PHY layer no longer returns NULL. It will return -ENXIO when PHY layer isn't enabled and we can use that to bail out instead of request a probe deferral. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: omap: fix sparse warningFelipe Balbi1-1/+1
our global '_omap' pointer wasn't marked static. This patch solves the following sparse warning: warning: symbol '_omap' was not declared. \ Should it be static? Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: exynos: use clk_prepare_enable and clk_disable_unprepareVivek Gautam1-3/+3
Convert clk_enable/clk_disable to clk_prepare_enable/clk_disable_unprepare calls as required by common clock framework. Signed-off-by: Vivek Gautam <[email protected]> CC: Kukjin Kim <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: exynos: Use of_platform API to create dwc3 core pdevVivek Gautam1-31/+25
Used of_platform_populate() to create dwc3 core platform_device from device tree data. Additionally some cleanup is also done. Signed-off-by: Vivek Gautam <[email protected]> CC: Felipe Balbi <[email protected]> CC: Kukjin Kim <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: dwc3-omap: return -EPROBE_DEFER if probe has not yet executedKishon Vijay Abraham I1-2/+5
return -EPROBE_DEFER from dwc3_omap_mailbox in dwc3-omap.c, if the probe of dwc3-omap has not yet been executed or failed. Signed-off-by: Kishon Vijay Abraham I <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: set dma_mask for dwc3_omap deviceKishon Vijay Abraham I2-0/+7
*dma_mask* is not set for devices created from dt data. So filled dma_mask for dwc3_omap device here. And dwc3 core will copy the dma_mask from its parent. Signed-off-by: Kishon Vijay Abraham I <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: core: fix wrong OTG event regitser offsetGeorge Cherian2-2/+4
This patch fixes the wrong OTG_EVT,OTG_EVTEN and OTG_STS register offsets. While at that, also add a missing register to debugfs regdump utility. Signed-off-by: George Cherian <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: phy: remove CONFIG_USB_OTG_UTILSFelipe Balbi1-1/+0
there are no more users of CONFIG_USB_OTG_UTILS left in tree, we can remove it just fine. [ [email protected] : fixed a linking error due to original patch forgetting to change drivers/usb/Makefile ] Signed-off-by: Kishon Vijay Abraham I <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: gadget: use num_(in|out)_eps from HW paramsFelipe Balbi1-4/+35
that way we will only tell gadget framework about the endpoints we actually have. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: calculate the number of endpointsFelipe Balbi2-0/+28
hwparams2 holds the number of endpoints which were selected during RTL generation, we can use that on our driver. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: set 'mode' based on selected Kconfig choicesVivek Gautam1-1/+6
Now that machines may select dwc3's working mode (HOST only, GADGET only or DUAL_ROLE) via Kconfig, let's set dwc3's mode based on that, rather than fixing it to whatever hardware says. This way we can skip initializing Gadget/Host in case we are using Host-only/Gadget-only mode respectively. Signed-off-by: Vivek Gautam <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: workaround: unexpected transtion U3 -> RESUMEFelipe Balbi1-0/+28
In DWC3 versions < 2.50a configured without Hibernation mode enabled, there will be an extra link status change interrupt if device detects host-initiated U3 exit. In that case, core will generate an unnecessary U3 -> RESUME transition which should be ignored by the driver. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: core: define more revisionsFelipe Balbi1-0/+3
Some new revisions of the DWC3 core have been released, let's add our defines to help implementing known erratas. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: gadget: don't assign gadget.dev.release directlyFelipe Balbi1-6/+1
udc-core provides a better way to handle release methods, let's use it. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: gadget: don't touch gadget.dev.driverFelipe Balbi1-2/+0
udc-core now handles that for us, which means we can remove it from our driver. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: gadget: remove unnecessary initializationsFelipe Balbi1-6/+0
udc-core now sets dma-related and parent fields for us, we don't need to do it ourselves. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: core: avoid checkpatch.pl warningFelipe Balbi1-1/+2
trivial patch to avoid "over 80-chars" rule break. No functional changes. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: debugfs: improve debugfs file creationFelipe Balbi1-19/+22
when commit 388e5c5 (usb: dwc3: remove dwc3 dependency on host AND gadget.) changed the way debugfs files are created, it failed to note that 'mode' is necessary in Dual Role mode only while 'testmode' and 'link_state' are valid in Dual Role and Peripheral-only builds. Fix this while also converting pre- processor conditional to C conditionals. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: debugfs: mark our regset structure constFelipe Balbi1-1/+1
nobody should be modifying that structure and debugfs has already being fixed to take const arguments, so we won't cause any new compile warnings. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: debugfs: when unknown, print only the state valueFelipe Balbi1-1/+1
whenever we grab an unknown link_state we were printing the entire register value as a integer but that's hardly useful; instead, let's print only the bogus state value. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: debugfs: add two missing Link StatesFelipe Balbi1-0/+6
for Reset and Resume we were going to print "UNKNOWN" when we actually knew what those were. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: remove our homebrew state mechanismFelipe Balbi2-24/+17
We can reuse the generic implementation via our struct usb_gadget. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: gadget: implement gadget state trackingFelipe Balbi2-4/+13
make use of the previously introduced gadget->state field. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: gadget: move to threaded IRQFelipe Balbi1-26/+60
by moving to threaded IRQs, we allow our IRQ priorities to be configurable when running with realtime patch. Also, since we're running in thread context, we can call functions which might sleep, such as sysfs_notify() without problems. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: add count field to event bufferFelipe Balbi1-0/+2
we can cache the last read value of the event buffer count register on this field, for later handling. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: add a flags field to event bufferFelipe Balbi1-0/+5
that way we know if a particular event buffer has pending events, or not. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: core: remove bogus comment to our structureFelipe Balbi1-1/+0
that irq field has been removed already. This patch just removes its documentation. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: pci: add basic suspend/resume supportFelipe Balbi1-0/+38
this patch adds basic PM support for the PCI glue layer. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: exynos: add basic suspend/resume supportVikas Sajjan1-0/+34
Adds suspend and resume callbacks to exynos dwc3 driver as part of power management support. This change does gating of dwc3 clock during suspend/resume cycles. Signed-off-by: Abhilash Kesavan <[email protected]> Signed-off-by: Vikas C Sajjan <[email protected]> CC: Doug Anderson <[email protected]> Tested-by: Vivek Gautam <[email protected]> [ [email protected] : refreshed to current linus/master ] Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: omap: add basic suspend/resume supportFelipe Balbi1-0/+56
this patch implements basic suspend/resume functionality for the OMAP glue layer. Tested-by: Vivek Gautam <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: omap: remove unused fields from private structureFelipe Balbi1-12/+0
we're not using those fields of the structure, might as well remove them. Tested-by: Vivek Gautam <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: omap: introduce enable/disable IRQ methodsFelipe Balbi1-15/+32
they will be re-used on suspend/resume implementation. Tested-by: Vivek Gautam <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: core: add power management supportFelipe Balbi3-0/+212
Add support for basic power management on the dwc3 driver. While there is still lots to improve for full PM support, this minimal patch will already make sure that we survive suspend-to-ram and suspend-to-disk without major issues. Cc: Vikas C Sajjan <[email protected]> Tested-by: Vivek Gautam <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: gadget: save state of pullupsFelipe Balbi2-0/+3
This will be used during resume to verify if we should reconnect our pullups or not. Tested-by: Vivek Gautam <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: gadget: introduce and use enable/disable irq methodsFelipe Balbi1-35/+45
we don't need to enable IRQs until we have a gadget driver loaded and ready to work, so let's delay IRQ enable to ->udc_start() and IRQ disable to ->udc_stop(). While at that, also move the related use of request_irq() and free_irq(). Tested-by: Vivek Gautam <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: dwc3: core: explicitly setup and cleanup event buffersFelipe Balbi1-15/+17
Make the call to dwc3_event_buffers_setup() and dwc3_event_buffers_cleanup() explicit, so it's easier to implement PM. Tested-by: Vivek Gautam <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: gadget: drop now unnecessary flagFelipe Balbi1-1/+0
We don't need the ->register_my_device flag anymore because all UDC drivers have been properly converted. Let's remove every history of it. Signed-off-by: Felipe Balbi <[email protected]>