aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/dwc2/platform.c
AgeCommit message (Collapse)AuthorFilesLines
2015-12-22usb: dwc2: reset dwc2 core before dwc2_get_hwparams()Yunzhi Li1-0/+6
We initiate dwc2 usb controller in BIOS, dwc2_core_reset() should be called before dwc2_get_hwparams() to reset core registers to default value. Without this the FIFO setting might be incorrect because calculating FIFO size need power-on value of GRXFSIZ/GNPTXFSIZ/HPTXFSIZ registers. This patch could avoid warnning massage like in rk3288 platform: [ 2.074764] dwc2 ff580000.usb: 256 invalid for host_perio_tx_fifo_size. Check HW configuration. Signed-off-by: Yunzhi Li <[email protected]> Signed-off-by: Douglas Anderson <[email protected]> Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: add support of hi6220Zhangfei Gao1-0/+33
Support hisilicon,hi6220-usb for HiKey board Acked-by: Rob Herring <[email protected]> Acked-by: John Youn <[email protected]> Signed-off-by: Zhangfei Gao <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-12-15usb: dwc2: host: enable descriptor dma for fs devicesMian Yousaf Kaukab1-0/+4
As descriptor dma mode does not support split transfers, it can't be enabled for high speed devices. Add a core parameter to enable it for full speed devices. Ensure frame list and descriptor list are correctly freed during disconnect. Acked-by: John Youn <[email protected]> Signed-off-by: Mian Yousaf Kaukab <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-11-20usb: dwc2: fix kernel oops during driver probeStefan Wahren1-14/+14
This patch make sure that all necessary members of dwc2_hsotg are initialized before the irq handler is requested. So the kernel oops triggered by dwc2_handle_common_intr has been fixed. dwc2 20980000.usb: Configuration mismatch. Forcing host mode dwc2 20980000.usb: no platform data or transceiver defined Unable to handle kernel paging request at virtual address cc860040 pgd = c0004000 [cc860040] *pgd=0b41e811, *pte=00000000, *ppte=00000000 Internal error: Oops: 7 [#1] ARM CPU: 0 PID: 1 Comm: swapper Not tainted 4.3.0-rc3+ #19 Hardware name: BCM2835 task: cb494000 ti: cb4d0000 task.ti: cb4d0000 PC is at dwc2_is_controller_alive+0x18/0x34 LR is at dwc2_handle_common_intr+0x24/0xb60 Acked-by: John Youn <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Signed-off-by: Stefan Wahren <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-11-19usb: dwc2: make otg clk optionalStefan Wahren1-4/+7
Fixes commit 09a75e857790 ("usb: dwc2: refactor common low-level hw code to platform.c") The above commit consolidated the low-level phy access into a common location. This change made the otg clk a requirement and broke some platforms when it was moved into platform.c. So make clk handling optional again. Acked-by: Eric Anholt <[email protected]> Signed-off-by: Stefan Wahren <[email protected]> Cc: Marek Szyprowski <[email protected]> Acked-by: John Youn <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Fixes: 09a75e857790 ("usb: dwc2: refactor common low-level hw code to platform.c") Signed-off-by: Felipe Balbi <[email protected]>
2015-11-19usb: dwc2: Return errors from PHYStefan Wahren1-5/+32
When searching for PHYs, any error was treated as if the PHY did not exist or was not specified. Thus the probe function did not correctly return error conditions such as -EPROBE_DEFER. Fixed so that only a non-existing PHY is ignored and any other error is returned. Acked-by: Eric Anholt <[email protected]> Reported-by: Alexander Aring <[email protected]> Signed-off-by: John Youn <[email protected]> Signed-off-by: Stefan Wahren <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-11-19usb: dwc2: Make PHY optionalJohn Youn1-5/+0
Fixes commit 09a75e857790 ("usb: dwc2: refactor common low-level hw code to platform.c") The above commit consolidated the low-level phy access into a common location. This change introduced a check from the gadget requiring that a PHY is specified. This requirement never existed on the host side and broke some platforms when it was moved into platform.c. The gadget doesn't require the PHY either so remove the check. Acked-by: Eric Anholt <[email protected]> Reported-by: Stefan Wahren <[email protected]> Cc: Marek Szyprowski <[email protected]> Signed-off-by: John Youn <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Fixes: 09a75e857790 ("usb: dwc2: refactor common low-level hw code to platform.c") Signed-off-by: Felipe Balbi <[email protected]>
2015-11-17usb: dwc2: host: Fix ahbcfg for rk3066Douglas Anderson1-1/+2
The comment for ahbcfg for rk3066 parameters (also used for rk3288) claimed that ahbcfg was INCR16, but it wasn't. Since the bits weren't shifted properly, the 0x7 ended up being masked and we ended up programming 0x3 for the HBstLen. Let's set it to INCR16 properly. As per Wu Liang Feng at Rockchip this may increase transmission efficiency. I did blackbox tests with writing 0s to a USB-based SD reader (forcefully capping CPU Freq to try to measure efficiency): cd /sys/devices/system/cpu/cpu0/cpufreq echo userspace > scaling_governor echo 126000 > scaling_setspeed for i in $(seq 10); do dd if=/dev/zero of=/dev/sdb bs=1M count=750 done With the above tests I found that speeds went from ~15MB/s to ~18MB/s. Note that most other tests I did (including reading from the same USB reader) didn't show any difference in performance. Tested-by: Heiko Stuebner <[email protected]> Acked-by: John Youn <[email protected]> Reviewed-by: Liangfeng Wu <[email protected]> Signed-off-by: Douglas Anderson <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-10-14usb: dwc2: refactor common low-level hw code to platform.cMarek Szyprowski1-37/+179
DWC2 module on some platforms needs three additional hardware resources: phy controller, clock and power supply. All of them must be enabled/activated to properly initialize and operate. This was initially handled in s3c-hsotg driver, which has been converted to 'gadget' part of dwc2 driver. Unfortunately, not all of this code got moved to common platform code, what resulted in accessing DWC2 registers without enabling low-level hardware resources. This fails for example on Exynos SoCs. This patch moves all the code for managing those resources to common platform.c file and provides convenient wrappers for controlling them. Signed-off-by: Marek Szyprowski <[email protected]> Acked-by: John Youn <[email protected]> Tested-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-10-14usb: dwc2: remove no longer needed init_mutexMarek Szyprowski1-1/+0
init_mutex is a leftover from the time, when s3c-hsotg driver did not implement proper pull up/down control and emulated it by enabling enabling/disabling usb phy. Proper pull up/down control has been added by commit 5b9451f8c4fbaf0549139755fb45ff2b57975b7f ("usb: dwc2: gadget: use soft-disconnect udc feature in pullup() method"), so init_muxtex can be removed now to avoid potential deadlocks with other locks. Signed-off-by: Marek Szyprowski <[email protected]> Acked-by: John Youn <[email protected]> Tested-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-10-01usb: dwc2: fix unbalanced phy controlMarek Szyprowski1-2/+0
Even when DWC2 is in (internal) suspended state, it should disable PHY in suspend and then enable it in resume. This patch fixes unbalanced PHY control sequence. Tested-by: John Youn <[email protected]> Acked-by: John Youn <[email protected]> Signed-off-by: Marek Szyprowski <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-10-01usb: dwc2: force dr_mode in case of configuration mismatchMian Yousaf Kaukab1-0/+11
If dual role configuration is not selected, check and force dr_mode based on the selected configuration. Signed-off-by: Mian Yousaf Kaukab <[email protected]> Tested-by: Robert Baldyga <[email protected]> Tested-by: Dinh Nguyen <[email protected]> Tested-by: John Youn <[email protected]> Acked-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-09-27usb: common: of_usb_get_dr_mode to usb_get_dr_modeHeikki Krogerus1-1/+1
By using the unified device property interface, the function can be made available for all platforms and not just the ones using DT. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-09-27usb: dwc2: rename all s3c_* to dwc2_*Felipe Balbi1-4/+4
this driver has long ago became dwc2.ko with both peripheral and host roles, there's no point in keeping the old function names. Acked-by: John Youn <[email protected]> Tested-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-04-29usb: dwc2: add hibernation core parameterGregory Herrero1-0/+2
dwc2 may not be able to exit from hibernation if the hardware does not provide a way to detect resume signalling in this state. Thus, add the possibility to disable hibernation feature. Acked-by: John Youn <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-04-29usb: dwc2: set parameter values in probe functionMian Yousaf Kaukab1-1/+16
So the parameters can be used in both host and gadget modes. Also consolidate param functions in the core.h Acked-by: John Youn <[email protected]> Signed-off-by: Mian Yousaf Kaukab <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-04-29usb: dwc2: add external_id_pin_ctl core parameterGregory Herrero1-0/+2
This is required due to an Intel specific hardware issue. Where id- pin setup causes glitches on the interrupt line when CONIDSTSCHG interrupt is enabled. Specify external_id_pin_ctl when an external driver (for example phy) can handle id change, so that CONIDSTSCHG interrupt can be disabled from the controller. Acked-by: John Youn <[email protected]> Signed-off-by: Gregory Herrero <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-04-29usb: dwc2: move debugfs code to a separate fileMian Yousaf Kaukab1-0/+4
Prepare to add more debug code. Moreover, don't save dentry * for each file in struct dwc2_hsotg as clean up is done with debugfs_remove_recursive(). s3c_hsotg_delete_debug() is removed altogether for the same reason. Acked-by: John Youn <[email protected]> Signed-off-by: Mian Yousaf Kaukab <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-03-12usb: dwc2: rework initialization of host and gadget in dual-role modeMarek Szyprowski1-8/+21
If device is configured to work only in HOST or DEVICE mode, there is no point in initializing both subdrivers. This patch also fixes resource leakage if host subdriver fails to initialize. Acked-by: John Youn <[email protected]> Signed-off-by: Marek Szyprowski <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-01-12usb: dwc2: platform: add generic PHY framework supportYunzhi Li1-2/+34
Get PHY parameters from devicetree and power off usb PHY during system suspend. Acked-by: Paul Zimmerman <[email protected]> Signed-off-by: Yunzhi Li <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-11-25usb: dwc2: Fix build warning when CONFIG_PM_SLEEP=nFabio Estevam1-2/+2
Building with bcm2835_defconfig, which has CONFIG_PM_SLEEP=n causes the following build warning: drivers/usb/dwc2/platform.c:227:12: warning: 'dwc2_suspend' defined but not used [-Wunused-function] drivers/usb/dwc2/platform.c:237:12: warning: 'dwc2_resume' defined but not used [-Wunused-function] Annotate these functions with '__maybe_unused' to prevent the warnings. Reported-by: Olof's autobuilder <[email protected]> Signed-off-by: Fabio Estevam <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-11-21usb: dwc2: gadget: add mutex to serialize init/deinit callsMarek Szyprowski1-0/+2
This patch adds mutex, which protects initialization and deinitialization procedures against suspend/resume methods. This mutex will be needed by the updated suspend/resume calls, which tracks gadget state. Signed-off-by: Marek Szyprowski <[email protected]> Acked-by: Paul Zimmerman <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-11-14usb: dwc2: move usb_disabled() call to host driver onlyDinh Nguyen1-3/+0
Since platform.c will get built for both Host and Gadget, if we leave the usb_disabled() call in platform.c, it results in the following build error when (!USB && USB_GADGET) condition is met. ERROR: "usb_disabled" [drivers/usb/dwc2/dwc2_platform.ko] undefined! Since usb_disabled() is mostly used to disable USB host functionality, move the call the host portion for the DWC2 driver. Acked-by: Paul Zimmerman <[email protected]> Signed-off-by: Dinh Nguyen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-11-14usb: dwc2: Update common interrupt handler to call gadget interrupt handlerDinh Nguyen1-0/+8
Make dwc2_handle_common_intr call the gadget interrupt function when operating in peripheral mode. Remove the spinlock functions in s3c_hsotg_irq as dwc2_handle_common_intr() already has the spinlocks. Move the registeration of the IRQ to common code for platform and PCI. Remove duplicate interrupt conditions that was in gadget, as those are handled by dwc2 common interrupt handler. Acked-by: Paul Zimmerman <[email protected]> Signed-off-by: Dinh Nguyen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-11-14usb: dwc2: convert to use dev_pm_ops APIDinh Nguyen1-6/+9
Update suspend/resume to use dev_pm_ops API. Acked-by: Paul Zimmerman <[email protected]> Signed-off-by: Dinh Nguyen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-11-14usb: dwc2: Move gadget probe function into platform codeDinh Nguyen1-0/+28
This patch will aggregate the probing of gadget/hcd driver into platform.c. The gadget probe funtion is converted into gadget_init that is now only responsible for gadget only initialization. All the gadget resources are now handled by platform.c Since the host workqueue will not get initialized if the driver is configured for peripheral mode only. Thus we need to check for wq_otg before calling queue_work(). Also, we move spin_lock_init to common location for both host and gadget that is either in platform.c or pci.c. We also move suspend/resume code to common platform code. Lastly, move the "samsung,s3c6400-hsotg" binding into dwc2_of_match_table. Signed-off-by: Dinh Nguyen <[email protected]> Acked-by: Paul Zimmerman <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-09-11Revert "usb: dwc2: move "samsung,s3c6400-hsotg" into common platform"Robert Baldyga1-1/+0
This reverts commit 8df438571cdbd5c4fcd1b25b19eea1ad5c3cf777. This patch breaks building dwc2 driver in gadget mode at samsung platforms. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-09-08usb: dwc2: move "samsung,s3c6400-hsotg" into common platformDinh Nguyen1-0/+1
Move the "samsung,s3c6400-hsotg" binding as the probe function in the gadget driver will get removed when the dual-role driver is implemented. Signed-off-by: Dinh Nguyen <[email protected]> Acked-by: Paul Zimmerman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-09-08usb: dwc2: add 'mode' which based on Kconfig select or dts settingKever Yang1-0/+4
According to the "dr_mode", the otg controller can work as device role and host role. Some boards always want to use host mode and some other boards want to use gadget mode. We use the dts setting to set dwc2's mode, rather than fixing it to whatever hardware says. Signed-off-by: Kever Yang <[email protected]> Acked-by: Paul Zimmerman <[email protected]> Tested-by: Doug Anderson <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-09-08usb: dwc2: add compatible data for rockchip socKever Yang1-0/+29
This patch add compatible data for dwc2 controller found on rk3066, rk3188 and rk3288 processors from rockchip. Signed-off-by: Kever Yang <[email protected]> Acked-by: Paul Zimmerman <[email protected]> Reviewed-by: Doug Anderson <[email protected]> Tested-by: Doug Anderson <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-27usb: dwc2: Disable descriptor dma mode by defaultDinh Nguyen1-0/+6
Even though the IP supports Descriptor DMA mode, it does not support SPLIT transactions in this mode. So the driver, in its currently form, will not support LS/FS devices when connected to a HS Hub if Descriptor DMA mode is enabled. So we should just default to disable descriptor dma mode. Signed-off-by: Dinh Nguyen <[email protected]> Acked-by: Paul Zimmerman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-02-04usb: dwc2: bail out early when booting with "nousb"Andre Heider1-0/+3
Add usb_disabled() check to prevent kernel oops when booting with "nousb" in the cmdline: Unable to handle kernel NULL pointer dereference at virtual address 00000030 ... PC is at bus_add_device+0xe0/0x18c LR is at device_add_groups+0x1c/0x20 ... [<c02191c0>] (bus_add_device) from [<c0217130>] (device_add+0x41c/0x538) [<c0217130>] (device_add) from [<c023b1d4>] (usb_new_device+0x270/0x35c) [<c023b1d4>] (usb_new_device) from [<c0241174>] (usb_add_hcd+0x4fc/0x760) [<c0241174>] (usb_add_hcd) from [<c0254ce0>] (dwc2_hcd_init+0x434/0x510) [<c0254ce0>] (dwc2_hcd_init) from [<c02594f4>] (dwc2_driver_probe+0x130/0x170) [<c02594f4>] (dwc2_driver_probe) from [<c021bbd0>] (platform_drv_probe+0x28/0x58) Signed-off-by: Andre Heider <[email protected]> Acked-by: Paul Zimmerman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-01-13Move DWC2 driver out of stagingPaul Zimmerman1-0/+187
The DWC2 driver should now be in good enough shape to move out of staging. I have stress tested it overnight on RPI running mass storage and Ethernet transfers in parallel, and for several days on our proprietary PCI-based platform. Signed-off-by: Paul Zimmerman <[email protected]> Cc: Felipe Balbi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>