aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-01-21usb: musb: fix spelling mistake: "periperal" -> "peripheral"Colin Ian King1-1/+1
There is a spelling mistake in a dev_err error message. Fix it. Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200117093124.97965-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: remove dummy driver musb_am335x.cBin Liu3-51/+0
Since commit 0782e8572ce4 ("ARM: dts: Probe am335x musb with ti-sysc"), the dummy driver musb_am335x.c is no longer needed, let's drop it. Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-26-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: davinci: Convert to use GPIO descriptorLinus Walleij1-24/+33
The DaVinci MUSB glue contains an optional GPIO line to control VBUS power, convert this to use a GPIO descriptor and augment the EVM board file to provide this descriptor. I can't get this driver to compile properly and it depends on broken but when I didn get it to compile brokenly, it did at least not complain about THIS code being broken so I don't think I broke the driver any more than what it already is. I did away with the ifdefs that do not work with multiplatform anyway so the day someone decides to resurrect the code, the path to get it working should be easier as well since DaVinci is now multiplatform. Cc: Sekhar Nori <nsekhar@ti.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> [b-liu@ti.com: fixed one instance still ref to global variable vbus_state] Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-25-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: Add support for MediaTek musb controllerMin Guo3-1/+591
This adds support for MediaTek musb controller in host, peripheral and otg mode. There are some quirk of MediaTek musb controller, such as: -W1C interrupt status registers -Private data toggle registers -No dedicated DMA interrupt line Signed-off-by: Min Guo <min.guo@mediatek.com> Signed-off-by: Yonglong Wu <yonglong.wu@mediatek.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-24-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: Add musb_clearb/w() interfaceMin Guo6-28/+48
Delete the const attribute of addr parameter in readb/w/l hooks, these changes are for implementing clearing W1C registers. Replace musb_readb/w with musb_clearb/w to clear the interrupt status. While at here, change some unsigned type to u32 to fix checkpatch.pl warnings. Signed-off-by: Min Guo <min.guo@mediatek.com> [b-liu@ti.com: fix checkpatch.pl warnings.] Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-23-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: Add noirq type of dma create interfaceMin Guo2-17/+46
Add noirq type of dma create interface for platform which do not have dedicated DMA interrupt line, move musbhsdma macro definition to musb_dma.h Signed-off-by: Min Guo <min.guo@mediatek.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-22-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: Add get/set toggle hooksMin Guo4-36/+61
Add get/set toggle hooks in struct musb_io and struct musb_platform_ops for special platform; remove function musb_save_toggle, use the set/get callback to handle toggle. Signed-off-by: Min Guo <min.guo@mediatek.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-21-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb/ux500: Use dma_request_chan() instead dma_request_slave_channel()Peter Ujfalusi1-2/+2
dma_request_slave_channel() is a wrapper on top of dma_request_chan() eating up the error code. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-19-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15USB: musb: fix __iomem in trace functionsBen Dooks (Codethink)1-12/+21
The trace functions should have __iomem on the addr pointers. Add __iomem to avoid the following warnings from sparse: drivers/usb/musb/musb_core.c:253:55: warning: incorrect type in argument 2 (different address spaces) drivers/usb/musb/musb_core.c:253:55: expected void const *addr drivers/usb/musb/musb_core.c:253:55: got void const [noderef] <asn:2> *addr drivers/usb/musb/musb_core.c:259:56: warning: incorrect type in argument 2 (different address spaces) drivers/usb/musb/musb_core.c:259:56: expected void const *addr drivers/usb/musb/musb_core.c:259:56: got void [noderef] <asn:2> *addr drivers/usb/musb/musb_core.c:267:55: warning: incorrect type in argument 2 (different address spaces) drivers/usb/musb/musb_core.c:267:55: expected void const *addr drivers/usb/musb/musb_core.c:267:55: got void const [noderef] <asn:2> *addr drivers/usb/musb/musb_core.c:273:56: warning: incorrect type in argument 2 (different address spaces) drivers/usb/musb/musb_core.c:273:56: expected void const *addr drivers/usb/musb/musb_core.c:273:56: got void [noderef] <asn:2> *addr drivers/usb/musb/musb_core.c:383:55: warning: incorrect type in argument 2 (different address spaces) drivers/usb/musb/musb_core.c:383:55: expected void const *addr drivers/usb/musb/musb_core.c:383:55: got void const [noderef] <asn:2> *addr drivers/usb/musb/musb_core.c:390:56: warning: incorrect type in argument 2 (different address spaces) drivers/usb/musb/musb_core.c:390:56: expected void const *addr drivers/usb/musb/musb_core.c:390:56: got void [noderef] <asn:2> *addr Signed-off-by: Ben Dooks (Codethink) <ben.dooks@codethink.co.uk> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-18-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: jz4740: Whitespace and indentation fixesPaul Cercueil1-14/+14
Fix lines with too much or not enough indentation, and lines which were indented with spaces instead of tabs. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-17-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: jz4740: Comments fixPaul Cercueil1-2/+3
Add a /* sentinel */ comment to the sentinel entry of the devicetree ID table, and fix a multi-line comment not having its opening token on a separate line. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-16-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: jz4740: Rename platform_device field in priv structPaul Cercueil1-3/+3
Name the platform_device pointer 'pdev' instead of 'musb'. Since the driver also deal with pointers to 'struct musb', it can be very confusing to have a pointer named after this struct but with a different type. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-15-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: jz4740: Constify jz4740_musb_pdata structPaul Cercueil1-8/+7
By moving around the jz4740_musb_pdata structure, we can have the .platform_ops field initialized, so that we don't have to initialize it manually in the probe function. Therefore, the struct can be const now. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-14-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: jz4740: Add local dev variable to clean up probePaul Cercueil1-9/+10
Clean up the probe function by using a local 'struct device *dev' variable, instead of referencing &pdev->dev everytime. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-13-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: jz4740: Suppress useless field in priv structurePaul Cercueil1-2/+0
The 'dev' field was never read anywhere. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-12-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: Get rid of omap2430_musb_set_vbus()Tony Lindgren1-48/+23
Now that we've removed direct calls from interrupt handler to omap2430_musb_set_vbus(), let's make things less confusing and configure VBUS directly in omap_musb_set_mailbox(). We have omap_musb_set_mailbox() called from the PHYs, and that's all we need. Note that we can now also drop the check for MUSB_INTERFACE_UTMI, we've been already calling otg_set_vbus(musb->xceiv->otg, 0) unconditionally via omap2430_musb_set_vbus() and we should only need to call it once. And we want to disable VBUS unconditionally on disconnect even without musb->gadget_driver, so let's drop that check too. Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-11-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: omap2430: Idle musb on initTony Lindgren1-17/+3
We want to configure musb state in omap2430_musb_enable() instead of omap2430_musb_init(). Otherwise musb may not idle properly until USB cable has been connected at least once. And we already have omap_musb_set_mailbox() configure mode with omap_control_usb_set_mode() so we can remove those calls from omap2430_musb_enable(). Cc: Jacopo Mondi <jacopo@jmondi.org> Cc: Marcel Partap <mpartap@gmx.net> Cc: Merlijn Wajer <merlijn@wizzup.org> Cc: Michael Scott <hashcode0f@gmail.com> Cc: NeKit <nekit1000@gmail.com> Cc: Pavel Machek <pavel@ucw.cz> Cc: Sebastian Reichel <sre@kernel.org> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-10-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: omap2430: Clean up enable and remove devctl tinkeringTony Lindgren1-20/+0
There should be no need to tinker with devctl in enable in the SoC glue code. We have musb_start() to take care of handling it already. Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-9-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: Add musb_set_host and peripheral and use them for omap2430Tony Lindgren3-49/+128
At least some revisions of musb core need to set devctl session bit in peripheral mode to force musb to host mode. And we have places clearing the devctl session bit. Let's add a generic function to do this, and use it for omap2430. This should get us a bit closer to completely removing devctl register tinkering in the SoC glue code. Before making use of this code for the other glue layers, things need to be tested carefully as there may be a approximately a 200 ms delay needed between powering up musb and calling musb_set_host() to avoid. Otherwise the system hangs at least with omap2430 glue layer. Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Tony Lindgren <tony@atomide.com> [b-liu@ti.com: fixed "line over 80 characters" warning] Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-8-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: omap2430: Handle multiple ID ground interruptsTony Lindgren1-6/+19
We currently get "unhandled DISCONNECT transition" warnings from musb core on device disconnect as things are wrongly set to OTG_STATE_A_IDLE in host mode when enumerating devices. We can also get "Failed to write reg index" errors after enumerating. This is happening at least with cpcap phy where we get multiple ID ground interrupts. Looks like it's VBUS keeps timing out and needs to be kicked when the phy sends multiple ID ground interrupts during host mode. Cc: Jacopo Mondi <jacopo@jmondi.org> Cc: Marcel Partap <mpartap@gmx.net> Cc: Merlijn Wajer <merlijn@wizzup.org> Cc: Michael Scott <hashcode0f@gmail.com> Cc: NeKit <nekit1000@gmail.com> Cc: Pavel Machek <pavel@ucw.cz> Cc: Sebastian Reichel <sre@kernel.org> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-7-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: omap2430: Wait on enable to avoid babbleTony Lindgren1-0/+3
We can get babble interrupt if we attempt to switch to USB host mode too soon after enabling musb. Let's fix the issue by waiting a bit in runtime_resume. Cc: Jacopo Mondi <jacopo@jmondi.org> Cc: Marcel Partap <mpartap@gmx.net> Cc: Merlijn Wajer <merlijn@wizzup.org> Cc: Michael Scott <hashcode0f@gmail.com> Cc: NeKit <nekit1000@gmail.com> Cc: Pavel Machek <pavel@ucw.cz> Cc: Sebastian Reichel <sre@kernel.org> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-6-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: omap2430: Get rid of musb .set_vbus for omap2430 glueTony Lindgren1-2/+0
We currently have musb_set_vbus() called from two different paths. Mostly it gets called from the USB PHY via omap_musb_set_mailbox(), but in some cases it can get also called from musb_stage0_irq() rather via .set_vbus: (musb_set_host [musb_hdrc]) (omap2430_musb_set_vbus [omap2430]) (musb_stage0_irq [musb_hdrc]) (musb_interrupt [musb_hdrc]) (omap2430_musb_interrupt [omap2430]) This is racy and will not work with introducing generic helper functions for musb_set_host() and musb_set_peripheral(). We want to get rid of the busy loops in favor of usleep_range(). Let's just get rid of .set_vbus for omap2430 glue layer and let the PHY code handle VBUS with musb_set_vbus(). Note that in the follow-up patch we can completely remove omap2430_musb_set_vbus(), but let's do it in a separate patch as this change may actually turn out to be needed as a fix. Reported-by: Pavel Machek <pavel@ucw.cz> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-5-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: jz4740: Drop dependency on NOP_USB_XCEIVPaul Cercueil1-1/+0
The driver does not depend directly on the NOP transceiver. It can compile and work just fine without it. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-4-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: sunxi: propagate devicetree node to glue pdevMans Rullgard1-0/+2
In order for devicetree nodes to be correctly associated with attached devices, the controller node needs to be propagated to the glue device. Signed-off-by: Mans Rullgard <mans@mansr.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-3-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: musb: core: Update the function descriptionSaurav Girepunje1-1/+0
Update the function description of musb_stage0_irq() to remove unused parameter. Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com> [b-liu@ti.com: revised commit log] Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-2-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-08usb: musb: Disable pullup at initPaul Cercueil1-0/+3
The pullup may be already enabled before the driver is initialized. This happens for instance on JZ4740. It has to be disabled at init time, as we cannot guarantee that a gadget driver will be bound to the UDC. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Suggested-by: Bin Liu <b-liu@ti.com> Cc: stable@vger.kernel.org Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200107152625.857-3-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-08usb: musb: fix idling for suspend after disconnect interruptTony Lindgren1-0/+8
When disconnected as USB B-device, suspend interrupt should come before diconnect interrupt, because the DP/DM pins are shorter than the VBUS/GND pins on the USB connectors. But we sometimes get a suspend interrupt after disconnect interrupt. In that case we have devctl set to 99 with VBUS still valid and musb_pm_runtime_check_session() wrongly thinks we have an active session. We have no other interrupts after disconnect coming in this case at least with the omap2430 glue. Let's fix the issue by checking the interrupt status again with delayed work for the devctl 99 case. In the suspend after disconnect case the devctl session bit has cleared by then and musb can idle. For a typical USB B-device connect case we just continue with normal interrupts. Fixes: 467d5c980709 ("usb: musb: Implement session bit based runtime PM for musb-core") Cc: Merlijn Wajer <merlijn@wizzup.org> Cc: Pavel Machek <pavel@ucw.cz> Cc: Sebastian Reichel <sre@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200107152625.857-2-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-30usb: musb: dma: Correct parameter passed to IRQ handlerPaul Cercueil1-1/+1
The IRQ handler was passed a pointer to a struct dma_controller, but the argument was then casted to a pointer to a struct musb_dma_controller. Fixes: 427c4f333474 ("usb: struct device - replace bus_id with dev_name(), dev_set_name()") Signed-off-by: Paul Cercueil <paul@crapouillou.net> Tested-by: Artur Rojek <contact@artur-rojek.eu> Cc: stable@vger.kernel.org Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20191216161844.772-2-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-30usb: musb: jz4740: Silence error if code is -EPROBE_DEFERPaul Cercueil1-2/+5
Avoid printing any error message if the error code is -EPROBE_DEFER. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20191216162432.1256-1-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-21usb: musb: create debugfs directory under usb rootChunfeng Yun1-1/+1
Now the USB gadget subsystem can use the USB debugfs root directory, so move musb's directory from the root of the debugfs filesystem into the root of usb Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1574232183-5760-1-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-14usb: musb: dsps: create debugfs directory under usb rootChunfeng Yun1-1/+1
Now the USB gadget subsystem can use the USB debugfs root directory, so move dsps's directory from the root of the debugfs filesystem into the root of usb Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1573541519-28488-6-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-04usb: Spelling s/enpoint/endpoint/Geert Uytterhoeven1-1/+1
Fix misspellings of "endpoint". Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Li Yang <leoyang.li@nxp.com> Acked-by: Minas Harutyunyan <hminas@synopsys.com> Link: https://lore.kernel.org/r/20191024152833.30698-1-geert+renesas@glider.be Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-04usb: musb: musb_gadget.c: Remove unused variableSaurav Girepunje1-2/+1
Remove unused variable status from musb_gadget_disable(). Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com> Link: https://lore.kernel.org/r/20191002143241.GA11615@saurav Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-04USB: musb: use devm_platform_ioremap_resource() to simplify codeYueHaibing1-3/+1
Use devm_platform_ioremap_resource() to simplify the code a bit. This is detected by coccinelle. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Link: https://lore.kernel.org/r/20190904084427.18532-1-yuehaibing@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-21usb: add a HCD_DMA flag instead of guestimating DMA capabilitiesChristoph Hellwig1-1/+1
The usb core is the only major place in the kernel that checks for a non-NULL device dma_mask to see if a device is DMA capable. This is generally a bad idea, as all major busses always set up a DMA mask, even if the device is not DMA capable - in fact bus layers like PCI can't even know if a device is DMA capable at enumeration time. This leads to lots of workaround in HCD drivers, and also prevented us from setting up a DMA mask for platform devices by default last time we tried. Replace this guess with an explicit HCD_DMA that is set by drivers that appear to have DMA support. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20190816062435.881-4-hch@lst.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-08USB: musb: convert platform driver to use dev_groupsGreg Kroah-Hartman1-19/+3
Platform drivers now have the option to have the platform core create and remove any needed sysfs attribute files. So take advantage of that and do not register "by hand" any sysfs files. Acked-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20190805193636.25560-2-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-01usb: musb: remove redundant assignment to variable retColin Ian King1-1/+1
Variable ret is being initialized with a value that is never read and ret is being re-assigned a little later on. The assignment is redundant and hence can be removed. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20190731223917.16532-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-30usb: musb: dsps: Use dev_get_drvdata()Kefeng Wang1-4/+2
Using dev_get_drvdata directly. Cc: Bin Liu <b-liu@ti.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: linux-usb@vger.kernel.org Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-30usb: musb: jz4740: obtain USB PHY from devicetreePaul Cercueil1-10/+7
Fall back to devm_usb_get_phy() if devicetree is not available. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-30usb: musb: jz4740: Let the platform probe the PHYPaul Cercueil1-2/+0
By registering a generic USB PHY from within the driver, we may shadow the USB PHY registered by the platform, which might be different. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-30soc: sunxi: Fix missing dependency on REGMAP_MMIOSamuel Holland1-1/+1
When enabling ARCH_SUNXI from allnoconfig, SUNXI_SRAM is enabled, but not REGMAP_MMIO, so the kernel fails to link with an undefined reference to __devm_regmap_init_mmio_clk. Select REGMAP_MMIO, as suggested in drivers/base/regmap/Kconfig. This creates the following dependency loop: drivers/of/Kconfig:68: symbol OF_IRQ depends on IRQ_DOMAIN kernel/irq/Kconfig:63: symbol IRQ_DOMAIN is selected by REGMAP drivers/base/regmap/Kconfig:7: symbol REGMAP default is visible depending on REGMAP_MMIO drivers/base/regmap/Kconfig:39: symbol REGMAP_MMIO is selected by SUNXI_SRAM drivers/soc/sunxi/Kconfig:4: symbol SUNXI_SRAM is selected by USB_MUSB_SUNXI drivers/usb/musb/Kconfig:63: symbol USB_MUSB_SUNXI depends on GENERIC_PHY drivers/phy/Kconfig:7: symbol GENERIC_PHY is selected by PHY_BCM_NS_USB3 drivers/phy/broadcom/Kconfig:29: symbol PHY_BCM_NS_USB3 depends on MDIO_BUS drivers/net/phy/Kconfig:12: symbol MDIO_BUS default is visible depending on PHYLIB drivers/net/phy/Kconfig:181: symbol PHYLIB is selected by ARC_EMAC_CORE drivers/net/ethernet/arc/Kconfig:18: symbol ARC_EMAC_CORE is selected by ARC_EMAC drivers/net/ethernet/arc/Kconfig:24: symbol ARC_EMAC depends on OF_IRQ To fix the circular dependency, make USB_MUSB_SUNXI select GENERIC_PHY instead of depending on it. This matches the use of GENERIC_PHY by all but two other drivers. Cc: <stable@vger.kernel.org> # 4.19 Fixes: 5828729bebbb ("soc: sunxi: export a regmap for EMAC clock reg on A64") Signed-off-by: Samuel Holland <samuel@sholland.org> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-30usb: musb: omap2430: Add support for idling phy when musb is idleTony Lindgren1-0/+6
I noticed that musb is blocking core retention for omap4 unlike for omap3. This is because for omap3 we have phy-twl4030-usb implement it's own PM runtime to handle errata "VUSB3V1 VBUS overvoltage debouncer not working when the PHY is powered down". That is done in order to keep the USB PHY powered when phy-twl4030-usb is loaded. For the other USB PHYs, we need to enable and disable the PHY based on musb PM runtime. With the session bit based PM runtime for musb core, we can now idle the USB PHY always when musb is idle. Note that adding these calls will not affect the twl4030 driver as it's phy functions will just query the PHY state without powering the PHY on or off. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-30usb: musb: Silence error about blacklisting hubs if !CONFIG_USBPaul Cercueil1-4/+5
Some drivers, like jz4740-musb, don't depend on CONFIG_USB. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-13USB: musb: mark expected switch fall-throughGustavo A. R. Silva1-1/+1
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. This patch fixes the following warning: drivers/usb/musb/musb_host.c: In function ‘musb_advance_schedule’: drivers/usb/musb/musb_host.c:374:7: warning: this statement may fall through [-Wimplicit-fallthrough=] if (qh->mux == 1) { ^ drivers/usb/musb/musb_host.c:383:3: note: here case USB_ENDPOINT_XFER_ISOC: ^~~~ Warning level 3 was used: -Wimplicit-fallthrough=3 Notice that, in this particular case, the code comment is modified in accordance with what GCC is expecting to find. This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Acked-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-12usb: musb: Kconfig: Drop dependency on CONFIG_USB for jz4740Paul Cercueil1-1/+1
The Kconfig entry previously depended on USB_OTG_BLACKLIST_HUB unconditionally, which is an option that is only available when CONFIG_USB is enabled. However, the USB IP in the JZ4740 SoC does not support host mode, only gadget mode, so it makes sense to allow it to build when CONFIG_USB is not set. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-12usb: musb: Kconfig: Drop dependency on MACH_JZ4740 for jz4740Paul Cercueil1-1/+1
Depending on MACH_JZ4740 prevent us from creating a generic kernel that works on more than one MIPS board. Instead, we just depend on MIPS being set. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-12usb: musb: jz4740: Add support for devicetreePaul Cercueil1-0/+10
Add support for probing the driver from devicetree. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-12USB: musb: fix indentation issue on a return statementColin Ian King1-1/+1
A return statement is indented one level too far, fix this by removing a tab. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-11Merge 5.0-rc6 into usb-nextGreg Kroah-Hartman2-22/+12
We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-30usb: gadget: musb: fix short isoc packets with inventra dmaPaul Elder2-22/+12
Handling short packets (length < max packet size) in the Inventra DMA engine in the MUSB driver causes the MUSB DMA controller to hang. An example of a problem that is caused by this problem is when streaming video out of a UVC gadget, only the first video frame is transferred. For short packets (mode-0 or mode-1 DMA), MUSB_TXCSR_TXPKTRDY must be set manually by the driver. This was previously done in musb_g_tx (musb_gadget.c), but incorrectly (all csr flags were cleared, and only MUSB_TXCSR_MODE and MUSB_TXCSR_TXPKTRDY were set). Fixing that problem allows some requests to be transferred correctly, but multiple requests were often put together in one USB packet, and caused problems if the packet size was not a multiple of 4. Instead, set MUSB_TXCSR_TXPKTRDY in dma_controller_irq (musbhsdma.c), just like host mode transfers. This topic was originally tackled by Nicolas Boichat [0] [1] and is discussed further at [2] as part of his GSoC project [3]. [0] https://groups.google.com/forum/?hl=en#!topic/beagleboard-gsoc/k8Azwfp75CU [1] https://gitorious.org/beagleboard-usbsniffer/beagleboard-usbsniffer-kernel/commit/b0be3b6cc195ba732189b04f1d43ec843c3e54c9?p=beagleboard-usbsniffer:beagleboard-usbsniffer-kernel.git;a=patch;h=b0be3b6cc195ba732189b04f1d43ec843c3e54c9 [2] http://beagleboard-usbsniffer.blogspot.com/2010/07/musb-isochronous-transfers-fixed.html [3] http://elinux.org/BeagleBoard/GSoC/USBSniffer Fixes: 550a7375fe72 ("USB: Add MUSB and TUSB support") Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Bin Liu <b-liu@ti.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>