Since the musb-gadget code now calls the dma engine properly it is
possible to enable it for the TX path in device mode.
AM335x Advisory 1.0.13 says that we may lose the toggle bit on multiple
RX transfers. There is a workaround in host mode but none in device mode
and therefore RX transfers are disabled.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: musb: Use is_cppi_enabled() and tusb_dma_omap() instead of the ifdef
This patch makes use of the two function is_cppi_enabled() and
tusb_dma_omap() instead of the ifdef for the proper DMA implementation
setup code. It basically shifts the code right by one indention level
and adds a few line breaks once the chars are crossed.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tuomas Tynkkynen [Mon, 12 Aug 2013 13:06:54 +0000 (16:06 +0300)]
usb: host: tegra: Tegra30 support
The Tegra30 EHCI controller is mostly compatible with the Tegra20
controller, except Tegra30 includes the HOSTPC register extension.
The has_hostpc capability bit must be set in the ehci_hcd structure if
the controller has such extensions. The new tegra_ehci_soc_config
structure is added to describe the differences between the SoCs.
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tuomas Tynkkynen [Mon, 12 Aug 2013 13:06:53 +0000 (16:06 +0300)]
usb: phy: tegra: Program new PHY parameters
The Tegra30 TRM recommends configuration of certain PHY parameters for
optimal quality. Program the following registers based on device tree
parameters:
These registers exist in Tegra20, but programming them hasn't been
necessary, so these parameters won't be set on Tegra20 to keep the
device trees backward compatible.
Additionally, the UTMIP_XCVR_SETUP parameter can be set from fuses
instead of a software-programmed value, as the optimal value can
vary between invidual boards. The boolean property
nvidia,xcvr-setup-use-fuses can be used to enable this behaviour.
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tuomas Tynkkynen [Mon, 12 Aug 2013 13:06:52 +0000 (16:06 +0300)]
Documentation: New DT parameters for tegra30-usb-phy
Document the new device tree parameters for Tegra30 USB PHY.
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tuomas Tynkkynen [Mon, 12 Aug 2013 13:06:51 +0000 (16:06 +0300)]
usb: phy: tegra: Tegra30 support
The Tegra30 USB PHY is a bit different than the Tegra20 PHY:
- The EHCI controller supports the HOSTPC register extension, and some
of the fields that the PHY needs to modify (PHCD and PTS) have moved
to the new HOSTPC register.
- Some of the UTMI PLL configuration registers have moved from the USB
register space to the Clock-And-Reset controller space. In Tegra30
the clock driver is responsible for configuring the UTMI PLL.
- The USBMODE register must be explicitly written to enter host mode.
- Certain PHY parameters need to be programmed for optimal signal
quality. Support for this will be added in the next patch.
The new tegra_phy_soc_config structure is added to describe the
differences between the SoCs.
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tuomas Tynkkynen [Mon, 12 Aug 2013 13:06:50 +0000 (16:06 +0300)]
usb: phy: tegra: Fix wrong PHY parameters
Some of the PHY parameters are not set according to the TRMs:
- UTMIP_FS_PREABMLE_J should be set, not cleared
- UTMIP_XCVR_LSBIAS_SEL should be cleared, not set
- UTMIP_PD_CHRG should be set in host mode and cleared in device mode
- UTMIP_XCVR_SETUP is a two-part field; the upper bits were not set
properly
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tuomas Tynkkynen [Mon, 12 Aug 2013 13:06:49 +0000 (16:06 +0300)]
usb: host: add has_tdi_phy_lpm capability bit
The has_hostpc capability bit indicates that the host controller has the
HOSTPC register extensions, but at the same time enables clock disabling
power saving features with the PHY Low Power Clock Disable (PHCD) bit.
However, some host controllers have the HOSTPC extensions but don't
support the low-power feature, so the PHCD bit must not be set on those
controllers. Add a separate capability bit for the low-power feature
instead, and change all existing users of has_hostpc to use this new
capability bit.
The idea for this commit is taken from an old 2012 commit that never got
merged ("disociate chipidea PHY low power suspend control from hostpc")
Inspired-by: Matthieu CASTET <matthieu.castet@parrot.com> Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Tested-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Kumar Gala [Fri, 9 Aug 2013 15:40:32 +0000 (10:40 -0500)]
usb: dwc3: core: clarify usb-phy array binding
The binding spec wasn't clear that the order of the phandles in the
usb-phy array has meaning. Clarify this point in the binding that
it should be <USB2-HS-PHY, USB3-SS-PHY>.
Signed-off-by: Kumar Gala <galak@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
This driver is currently used by musb' cppi41 couter part. I may merge
both dma engine user of musb at some point but not just yet.
The driver seems to work in RX/TX mode in host mode, tested on mass
storage. I increaed the size of the TX / RX transfers and waited for the
core code to cancel a transfers and it seems to recover.
v2..3:
- use mall transfers on RX side and check data toggle.
- use rndis mode on tx side so we haveon interrupt for 4096 transfers.
- remove custom "transferred" hack and use dmaengine_tx_status() to
compute the total amount of data that has been transferred.
- cancel transfers and reclaim descriptors
v1..v2:
- RX path added
- dma mode 0 & 1 is working
- device tree nodes re-created.
Cc: Vinod Koul <vinod.koul@intel.com> Cc: Dan Williams <djbw@fb.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
This moves the two instances from the big node into two child nodes. The
glue layer ontop does almost nothing.
There is one devices containing the control module for USB (2) phy,
(2) usb and later the dma engine. The usb device is the "glue device"
which contains the musb device as a child. This is what we do ever since.
The new file musb_am335x is just here to prob the new bus and populate
child devices.
There are a lot of changes to the dsps file as a result of the changes:
- musb_core_offset
This is gone. The device tree provides memory ressources information
for the device there is no need to "fix" things
- instances
This is gone as well. If we have two instances then we have have two
child enabled nodes in the device tree. For instance the SoC in beagle
bone has two USB instances but only one has been wired up so there is
no need to load and init the second instance since it won't be used.
- dsps_glue is now per glue device
In the past there was one of this structs but with an array of two and
each instance accessed its variable depending on the platform device
id.
- no unneeded copy of structs
I do not know why struct dsps_musb_wrapper is copied but it is not
necessary. The same goes for musb_hdrc_platform_data which allocated
on demand and then again by platform_device_add_data(). One copy is
enough.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
dsps uses a nop driver which is added in dsps itself and does the PHY
on/off calls within dsps. Since those calls are now moved the nop driver
itself, we can now request the phy proper phy and remove those calls.
Currently only the first musb interface is used so we only add one phy
node for now.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
This driver is a redo of my earlier attempt. It uses parts of the
generic PHY driver and uses the new control driver for the register
the phy needs to power on/off the phy. It also enables easy access for
the wakeup register which is not yet implemented.
The difference between the omap attempt is:
- no static holding variable
- one global visible function which exports a struct with callbacks to
access the "control" registers.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
The "nop" driver isn't a do-nothing-stub but supports a couple functions
like clock on/off or is able to use a voltage regulator. This patch
simply renames the driver to "generic" since it is easy possible to
extend it by a simple function istead of writing a complete driver.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Jingoo Han [Mon, 5 Aug 2013 03:15:27 +0000 (12:15 +0900)]
usb: gadget: f_uac1: Staticize local functions
control_selector_init() is used only in this file.
audio_bind_config() is used only in audio.c file to which
f_uac1.c is included. Thus, these functions are staticized
to fix the following warnings.
drivers/usb/gadget/f_uac1.c:698:12: warning: symbol 'control_selector_init' was not declared. Should it be static?
drivers/usb/gadget/f_uac1.c:722:12: warning: symbol 'audio_bind_config' was not declared. Should it be static?
Acked-by: Jassi Brar <jaswinder.singh@linaro.org> Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
rndis_init() and rndis_exit() are used only in this file.
Fix the following sparse warnings:
drivers/usb/gadget/rndis.c:1145:5: warning: symbol 'rndis_init' was not declared. Should it be static?
drivers/usb/gadget/rndis.c:1179:6: warning: symbol 'rndis_exit' was not declared. Should it be static?
Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Jingoo Han [Mon, 5 Aug 2013 03:11:05 +0000 (12:11 +0900)]
usb: gadget: f_mass_storage: use NULL instead of 0
The local variables such as 'filename', 'vendor_name', and
'product_name' are pointers; thus, use NULL instead of 0 to fix
the following sparse warnings
drivers/usb/gadget/f_mass_storage.c:3046:27: warning: Using plain integer as NULL pointer
drivers/usb/gadget/f_mass_storage.c:3050:28: warning: Using plain integer as NULL pointer
drivers/usb/gadget/f_mass_storage.c:3051:29: warning: Using plain integer as NULL pointer
Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Boris BREZILLON [Fri, 2 Aug 2013 08:37:34 +0000 (10:37 +0200)]
usb: gadget: at91_udc: add usb_clk for transition to common clk framework
The AT91 PMC (Power Management Controller) provides an USB clock used by
USB Full Speed host (ohci) and USB Full Speed device (udc).
The usb drivers (ohci and udc) must configure this clock to 48Mhz.
This configuration was formely done in mach-at91/clock.c, but this
implementation will be removed when moving to common clk framework.
This patch adds support for usb clock retrieval and configuration, and is
backward compatible with the current at91 clk implementation (if usb clk
is not found, it does not configure/enable it).
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Jingoo Han [Fri, 2 Aug 2013 08:13:17 +0000 (17:13 +0900)]
usb: dwc3: pci: add CONFIG_PM_SLEEP to suspend/resume functions
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/dwc3-pci.c:215:12: warning: 'dwc3_pci_suspend' defined but not used [-Wunused-function]
drivers/usb/dwc3/dwc3-pci.c:224:12: warning: 'dwc3_pci_resume' defined but not used [-Wunused-function]
Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Mikko Perttunen [Tue, 30 Jul 2013 06:47:57 +0000 (09:47 +0300)]
usb: tegra: Fix typo in tegra20-usb-phy documentation
The device tree binding documentation for tegra20-usb-phy used to claim
that the vbus-supply property is required for host phys and optional
for otg phys. This should be the other way around.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Tue, 30 Jul 2013 06:09:15 +0000 (09:09 +0300)]
usb: of: fix build breakage caused by recent patches
commit 052a11d (usb: phy: make PHY driver selection
possible by controller drivers) changed the rules
on how drivers/usb/phy/of.c would be compiled and
failed to update include/linux/usb/of.h accordingly.
Because of that, we can fall into situations where
of_usb_get_phy_mode() is redefined. In order to fix
the error, we update the IS_ENABLED() check in
include/linux/usb/of.h to reflect the condition
where of.c is built.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Felipe Balbi <balbi@ti.com>
When deferred probe happens driver will try to ioremap multiple times
and will fail. Memory resource.start variable is a global variable,
modifications in this field will be accumulated on every probe.
Fix this by moving the above operations after driver hold all
required PHY's.
Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
The EOI register is not present in the AM335x memory space according to
the TRM and thus removed.
Should any platform using the EOI register get merged then it may be
used again if the register address is not zero.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tuomas Tynkkynen [Thu, 25 Jul 2013 18:38:09 +0000 (21:38 +0300)]
usb: phy: tegra: Use DT helpers for dr_mode
Use the new of_usb_get_dr_mode helper function for parsing dr_mode
from the device tree. Also replace the usage of the custom
tegra_usb_phy_mode enum with the standard enum.
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tuomas Tynkkynen [Thu, 25 Jul 2013 18:38:08 +0000 (21:38 +0300)]
usb: phy: tegra: Use DT helpers for phy_type
Use the new of_usb_get_phy_mode helper function for parsing phy_type
from the device tree.
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tuomas Tynkkynen [Thu, 25 Jul 2013 18:38:07 +0000 (21:38 +0300)]
usb: phy: tegra: Remove custom PHY locating APIs
The Tegra EHCI driver is no longer using these custom functions, so they
can be removed.
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tuomas Tynkkynen [Thu, 25 Jul 2013 18:38:06 +0000 (21:38 +0300)]
usb: host: tegra: Locate a PHY via standard API
Use devm_get_phy_by_phandle to get a PHY device instead of the custom
Tegra functions.
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tuomas Tynkkynen [Thu, 25 Jul 2013 18:38:05 +0000 (21:38 +0300)]
usb: phy: tegra: Register as an USB PHY.
Register the Tegra PHY device instances with the PHY subsystem so that
the Tegra EHCI driver can locate a PHY via the standard APIs.
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tuomas Tynkkynen [Thu, 25 Jul 2013 18:38:04 +0000 (21:38 +0300)]
ARM: tegra: Remove USB platform data
USB-related platform data is not used anymore in the Tegra USB drivers,
so remove all of it.
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tuomas Tynkkynen [Thu, 25 Jul 2013 18:38:03 +0000 (21:38 +0300)]
usb: tegra: host: Remove references to plat data
Platform data is not used in tegra-ehci anymore, so remove all
references to it.
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tuomas Tynkkynen [Thu, 25 Jul 2013 18:38:02 +0000 (21:38 +0300)]
usb: host: tegra: Remove leftover code
ehci-tegra calls devm_usb_get_phy, which will never succeed since the Tegra
PHY does not register itself with the PHY subsystem. It is also completely
redundant since the code has already located a PHY via an internal API.
Call otg_set_host unconditionally to simplify the code since it should
be safe to do so.
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Tuomas Tynkkynen [Thu, 25 Jul 2013 18:38:01 +0000 (21:38 +0300)]
usb: phy: tegra: Remove unnecessary 'dev' field
struct usb_phy already has a field for the device pointer, so this
unnecessary field can be removed.
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
USB VBUS regulators are now specified with the vbus-supply property
instead of nvidia,vbus-gpio, so remove the obsolete properties.
The equivalent vbus-supply properties were already added in patch
"ARM: tegra: update device trees for USB binding rework".
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Acked-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Mikko Perttunen [Wed, 17 Jul 2013 07:37:50 +0000 (10:37 +0300)]
usb: tegra: Add vbus-supply property for host mode PHYs
Document vbus-supply as an optional property for host mode phy-tegra-usb PHYs.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Mikko Perttunen [Wed, 17 Jul 2013 07:37:49 +0000 (10:37 +0300)]
usb: tegra: Use regulators instead of GPIOs for USB PHY VBUS
The tegra ehci driver has enabled USB vbus regulators directly using
GPIOs and the device tree attribute nvidia,vbus-gpio. This is ugly
and causes error messages on boot when both the regulator driver
and the ehci driver want access to the same GPIO.
After this patch, usb vbus regulators for tegra usb phy devices are specified
with the device tree attribute vbus-supply = <&x> where x is a regulator defined
in the device tree. The old nvidia,vbus-gpio property is no longer supported.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Mikko Perttunen [Wed, 17 Jul 2013 06:31:01 +0000 (09:31 +0300)]
usb: phy: tegra: Read UTMIP parameters from device tree
UTMIP parameters used to be hardcoded into tables in the
PHY driver. This patch reads them from the device tree instead
in accordance with the phy-tegra-usb DT documentation.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Mikko Perttunen [Wed, 17 Jul 2013 06:31:00 +0000 (09:31 +0300)]
arm: dts: tegra20: Rename USB UTMI parameters according to new definitions
This patch changes the Tegra20 USB PHY nodes to use the UTMI configuration
parameter names as specified in the device tree binding documentation
after patch "ARM: tegra: finalize USB EHCI and PHY bindings".
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Acked-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Commit 8d2421e ("usb: musb: kill global and static for multi instance")
removed the global dma_mask copy and replaced by parent's DMA mask. The
problem here is that if the parent does not have a dma_mask then
musb_remove() goes kaboom.
Instead trying to fix this I was thinking we do we need to erase
dma_mask in the first place?
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
ti81xx does not have a baseport mainline i.e. it should not boot. The
amount of rework that is required makes it easier to simply remove that
platform (i.e. that possible platform device) and add it later once it
comes back with DT support.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
If the init / shutdown function of the phy moves out of dsps into the
phy driver, then dsps needs to call the callbacks of the phy driver to
ensure that this happens.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: renesas_usbhs: tidyup original usbhsx_for_each_xxx macro
Current usbhsx_for_each_xxx macro will read out-of-array's
memory after last loop operation.
It was not good C language operation, and the binary which was
compiled by (at least) gcc 4.8.1 is broken
This patch tidyup these issues
Reported-by: Yusuke Goda <yusuke.goda.sx@renesas.com> Reviewed-by: Takashi Yoshii <takashi.yoshii.zj@renesas.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Roger Quadros [Fri, 14 Jun 2013 09:51:42 +0000 (12:51 +0300)]
usb: ehci-omap: select NOP_USB_XCEIV PHY driver
ehci-omap needs NOP_USB_XCEIV PHY driver to function
properly, so select it. As the USB PHY drivers no longer
depend on USB_PHY, it is safe to select the PHY drivers.
Roger Quadros [Fri, 14 Jun 2013 09:51:41 +0000 (12:51 +0300)]
usb: phy: make PHY driver selection possible by controller drivers
Convert PHY Drivers from menuconfig to menu so that the PHY drivers
can be explicitely selected by the controller drivers.
USB_PHY is no longer a user visible option. It is upto to the PHY
drivers to select it if needed. This patch does so for the existing
PHY drivers that use the USB_PHY library.
Doing so moves the USB_PHY and PHY driver selection problem from the
end user to the PHY and controller driver developer.
e.g.
Earlier, a controller driver (e.g. EHCI_OMAP) that needs to select
a PHY driver (e.g. NOP_PHY) couldn't do so because the PHY driver
depended on USB_PHY. Making the controller driver depend on USB_PHY
has a negative effect i.e. it becomes invisible to the user till
USB_PHY is enabled. Most end users will not familiar with this.
With this patch, the end user just needs to select the controller driver
needed for his/her platform without worrying about which PHY driver to
select.
Also update USB_EHCI_MSM, USB_LPC32XX and USB_OMAP to not depend
on USB_PHY any more. They can safely select the necessary PHY drivers.
[ balbi@ti.com : refreshed on top of my next branch. Changed bool
followed by default n into def_bool n ]
CC: Pavankumar Kondeti <pkondeti@codeaurora.org> Acked-by: Roland Stigge <stigge@antcom.de> Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Mon, 22 Jul 2013 09:31:31 +0000 (12:31 +0300)]
usb: dwc3: ep0: only change to ADDRESS if set_config() succeeds
In case we're switching back to USB_STATE_ADDRESS
from USB_STATE_CONFIGURED (if host sends
a set configuration command for configuration
zero), we should only switch if the request
is successfully processed by the gadget driver.
Reported-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Wed, 17 Jul 2013 08:09:49 +0000 (11:09 +0300)]
usb: gadget: udc-core: move sysfs_notify() to a workqueue
usb_gadget_set_state() will call sysfs_notify()
which might sleep. Some users might want to call
usb_gadget_set_state() from the very IRQ handler
which actually changes the gadget state.
Instead of having every UDC driver add their own
workqueue for such a simple notification, we're
adding it generically to our struct usb_gadget,
so the details are hidden from all UDC drivers.
Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Wed, 12 Jun 2013 18:11:14 +0000 (21:11 +0300)]
usb: dwc3: gadget: get rid of IRQF_ONESHOT
We can make use of bit 31 of the GEVNTSIZ(n)
registers to mask/unmask interrupts from that
particular interrupter.
With that feature, we can easily drop IRQF_ONESHOT
from our driver which makes it possible to
properly change IRQ priorities when using RT
patchset *and* it allows us to make use of the
scheduler to choose the proper time to handle
this IRQ thread.
Felipe Balbi [Fri, 12 Jul 2013 10:19:52 +0000 (13:19 +0300)]
usb: dwc3: gadget: drop dwc3 manual phy control
Recent versions of the core, can suspend and resume
the PHYs automatically, so we don't need to fiddle
with dwc3's Global PHY registers at all.
On versions prior to 1.94a this patch will mean
that we will never ask dwc3 to suspend the PHY.
This is an acceptable behavior or such old versions
of the core, specially considering that the only
chip known to have a version prior to 1.94a was
OMAP5 ES1.0 and that's not supported in mainline
kernel, because it was just a test spin of OMAP5.
Felipe Balbi [Tue, 2 Jul 2013 18:20:24 +0000 (21:20 +0300)]
usb: dwc3: core: switch to snps,dwc3
all other drivers using Synopsys IPs with DT
have a compatible of snps,$driver, in order
to add consistency, we are switching over to
snps,dwc3 but keeping synopsys,dwc3 in the core
driver to maintain backwards compatibility.
Felipe Balbi [Sun, 30 Jun 2013 11:29:51 +0000 (14:29 +0300)]
usb: dwc3: make maximum-speed a per-instance attribute
in order to allow different instances of the
core work in different maximum speeds, we will
move the maximum_speed module_parameter to
both DeviceTree (making use the new maximum-speed
DT property) and platform_data.
Felipe Balbi [Sun, 30 Jun 2013 11:15:11 +0000 (14:15 +0300)]
usb: dwc3: switch to GPL v2 only
This is a Linux-only driver which makes use
of GPL-only symbols. It makes no sense to
maintain Dual BSD/GPL licensing for this driver.
Considering that the amount of work to use this
driver in any different operating system would likely
be as large as developing the driver from scratch and
considering that we depend on GPL-only symbols, we
will switch over to a GPL v2-only license.
Cc: Anton Tikhomirov <av.tikhomirov@samsung.com> Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Thu, 27 Jun 2013 07:20:44 +0000 (10:20 +0300)]
usb: gadget: remove imx_udc
That driver hasn't been really maintained for
a long time. It doesn't compile in any way, it
includes non-existent headers, has no users,
and is just plain broken.
The person who used to work with that driver
has publicly stated that he has no plans to
touch that driver again and is ok with removal[1].
Due to these factors, imx_udc is now removed from
the tree, if someone really believe it needs to
be kept, please fix the bugs in that driver.
Felipe Balbi [Wed, 26 Jun 2013 12:14:06 +0000 (15:14 +0300)]
usb: dwc3: make glue layers selectable
Glue layers are starting to have separate
requirements. For example, OMAP's glue layer
is starting to use extcon framework which
no one else needs.
In order to make it clear the proper dependencies,
we are now allowing glue layers to be selectable
so that each glue layer can list their own dependencies
without messing with the core IP driver.
usb: musb: unmap reqs in musb_gadget_queue()'s error case
If the descriptor is missing the reqeust is never unmapped. This patch
changes this and renames the cleanup label to unlock since there is no
cleanup done. The cleanup would revert the allocation of ressource (i.e.
this dma mapping) but it does not, it simply unlocks and returns.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: musb: core: call dma_controller_destroy() in the err path
The cleanup in the error is missing the dma controller. The structure is
allocated at runtime and ux500 allocates even a little more than just
this struct. So cleanup!
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: musb: remove a few is_dma_capable() in init/exit code
This patch removes is_dma_capable() and an ifdef in the init/exit path
around init/de-init of the dma_controller. Since we have the empty stubs
in the PIO code we can call it without gcc trouble. Earlier we had an
ifdef and the is_dma_capable() macro where gcc ignored the if (0) path
even that the function was not around :)
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: musb: dma: merge ->start/stop into create/destroy
The core code creates a controller and immediately after that it calls
the ->start() callback. This one might drop an error but nobody cares.
The same thing happens in the destroy corner: First ->stop() called
followed by destroy callback. So why not merge those two into the same
function since there is no difference.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>