]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
7 years agostaging: typec: USB Type-C Port Manager (tcpm)
Guenter Roeck [Thu, 27 Apr 2017 21:09:56 +0000 (14:09 -0700)]
staging: typec: USB Type-C Port Manager (tcpm)

This driver implements the USB Type-C Power Delivery state machine
for both source and sink ports. Alternate mode support is not
fully implemented.

The driver attaches to the USB Type-C class code implemented in
the following patches.

usb: typec: add driver for Intel Whiskey Cove PMIC USB Type-C PHY
usb: USB Type-C connector class

This driver only implements the state machine. Lower level drivers are
responsible for
- Reporting VBUS status and activating VBUS
- Setting CC lines and providing CC line status
- Setting line polarity
- Activating and deactivating VCONN
- Setting the current limit
- Activating and deactivating PD message transfers
- Sending and receiving PD messages

The driver provides both a functional API as well as callbacks for
lower level drivers.

Signed-off-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agousb: host: xhci: remove #ifdef around PM functions
Arnd Bergmann [Fri, 21 Apr 2017 21:42:54 +0000 (23:42 +0200)]
usb: host: xhci: remove #ifdef around PM functions

The #ifdef is slightly wrong as it doesn't cover the xhci_priv_resume_quirk()
function, causing a harmless warning:

drivers/usb/host/xhci-plat.c:58:12: error: 'xhci_priv_resume_quirk' defined but not used [-Werror=unused-function]
 static int xhci_priv_resume_quirk(struct usb_hcd *hcd)

A simpler way to do this correctly is to use __maybe_unused annotations
that let the compiler silently drop the functions when there is no
reference.

Fixes: b0c69b4bace3 ("usb: host: plat: Enable xHCI plat runtime PM")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agousb: musb: don't mark of_dev_auxdata as initdata
Arnd Bergmann [Tue, 25 Apr 2017 20:04:53 +0000 (22:04 +0200)]
usb: musb: don't mark of_dev_auxdata as initdata

The probe function is not __init since it can be called for deferred
probing or when unbinding/rebinding the device, and therefore it must
not reference objects in __initdata, as pointed out by this link
time warning:

WARNING: drivers/usb/musb/da8xx.o(.text+0x9d4): Section mismatch in reference from the function da8xx_probe() to the (unknown reference) .init.data:(unknown)

This removes the annotation.

Reported-by: Olof's autobuilder <olof@lixom.net>
Fixes: d6299b6efbf6 ("usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agousb: misc: legousbtower: Fix buffers on stack
Maksim Salau [Tue, 25 Apr 2017 19:49:21 +0000 (22:49 +0300)]
usb: misc: legousbtower: Fix buffers on stack

Allocate buffers on HEAP instead of STACK for local structures
that are to be received using usb_control_msg().

Signed-off-by: Maksim Salau <maksim.salau@gmail.com>
Tested-by: Alfredo Rafael Vicente Boix <alviboi@gmail.com>;
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoUSB: Revert "cdc-wdm: fix "out-of-sync" due to missing notifications"
Bjørn Mork [Fri, 21 Apr 2017 08:01:29 +0000 (10:01 +0200)]
USB: Revert "cdc-wdm: fix "out-of-sync" due to missing notifications"

This reverts commit 833415a3e781 ("cdc-wdm: fix "out-of-sync" due to
missing notifications")

There have been several reports of wdm_read returning unexpected EIO
errors with QMI devices using the qmi_wwan driver. The reporters
confirm that reverting prevents these errors. I have been unable to
reproduce the bug myself, and have no explanation to offer either. But
reverting is the safe choice here, given that the commit was an
attempt to work around a firmware problem.  Living with a firmware
problem is still better than adding driver bugs.

Reported-by: Kasper Holtze <kasper@holtze.dk>
Reported-by: Aleksander Morgado <aleksander@aleksander.es>
Reported-by: Daniele Palmas <dnlplm@gmail.com>
Cc: <stable@vger.kernel.org> # v4.9+
Fixes: 833415a3e781 ("cdc-wdm: fix "out-of-sync" due to missing notifications")
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Acked-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agousb: Make sure usb/phy/of gets built-in
Alexey Brodkin [Thu, 13 Apr 2017 12:33:34 +0000 (15:33 +0300)]
usb: Make sure usb/phy/of gets built-in

DWC3 driver uses of_usb_get_phy_mode() which is
implemented in drivers/usb/phy/of.c and in bare minimal
configuration it might not be pulled in kernel binary.

In case of ARC or ARM this could be easily reproduced with
"allnodefconfig" +CONFIG_USB=m +CONFIG_USB_DWC3=m.

On building all ends-up with:
---------------------->8------------------
  Kernel: arch/arm/boot/Image is ready
  Kernel: arch/arm/boot/zImage is ready
  Building modules, stage 2.
  MODPOST 5 modules
ERROR: "of_usb_get_phy_mode" [drivers/usb/dwc3/dwc3.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
---------------------->8------------------

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Felix Fietkau <nbd@nbd.name>
Cc: Jeremy Kerr <jk@ozlabs.org>
Cc: linux-snps-arc@lists.infradead.org
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoUSB: storage: e-mail update in drivers/usb/storage/unusual_devs.h
Phillip Potter [Thu, 20 Apr 2017 19:53:48 +0000 (20:53 +0100)]
USB: storage: e-mail update in drivers/usb/storage/unusual_devs.h

Updates the e-mail address of Phillip Potter, updater of the Nokia 6288
entry in drivers/usb/storage/unusual_devs.h

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMerge tag 'usb-serial-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Thu, 20 Apr 2017 15:22:51 +0000 (17:22 +0200)]
Merge tag 'usb-serial-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-next

Johan writes:

USB-serial updates for v4.12-rc1

Here are the USB-serial updates for 4.12, including:

 - support for devices with up to 16 ports (e.g. some Moxa devices)

 - support for endpoint sanity checks in core, which allows for code sharing
   and avoids allocating resources for rejected interfaces

 - support for endpoint-port remapping, which allows some driver hacks to
   be removed as well as omninet to use the generic write implementation

 - removal of an obsolete tty open-race workaround which prevented a
   port from being opened immediately after having been registered

 - generic-driver support for interfaces with just a bulk-in endpoint

 - improved ftdi_sio event-char and latency-timer handling

 - improved ftdi_sio support for some broken BM chips

Included are also various clean ups and a new ftdi_sio device id.

All have been in linux-next with no reported issues.

Signed-off-by: Johan Hovold <johan@kernel.org>
7 years agousb: host: xhci: print correct command ring address
Peter Chen [Wed, 19 Apr 2017 13:55:52 +0000 (16:55 +0300)]
usb: host: xhci: print correct command ring address

Print correct command ring address using 'val_64'.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agousb: host: xhci: delete sp_dma_buffers for scratchpad
Peter Chen [Wed, 19 Apr 2017 13:55:51 +0000 (16:55 +0300)]
usb: host: xhci: delete sp_dma_buffers for scratchpad

We already have sp_array to store each scratch buffer address for xHC,
it doesn't need another sp_dma_buffers array to store it.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agousb: host: xhci: using correct specification chapter reference for DCBAAP
Peter Chen [Wed, 19 Apr 2017 13:55:50 +0000 (16:55 +0300)]
usb: host: xhci: using correct specification chapter reference for DCBAAP

Using correct specification chapter reference for DCBAAP
(Device Context Base Address Array Pointer).

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoxhci: switch to pci_alloc_irq_vectors
Christoph Hellwig [Wed, 19 Apr 2017 13:55:49 +0000 (16:55 +0300)]
xhci: switch to pci_alloc_irq_vectors

Use the modern API to request MSI or MSI-X interrupts, which allows us to
get rid of the msix_entries array, as well as cleaning up the cleanup
code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agousb: host: xhci-plat: set resume_quirk() for R-Car controllers
Yoshihiro Shimoda [Wed, 19 Apr 2017 13:55:48 +0000 (16:55 +0300)]
usb: host: xhci-plat: set resume_quirk() for R-Car controllers

This patch sets resume_quirk() for R-Car controllers to re-download
the firmware in resume timing. Otherwise, if the controller's power
is down in suspend timing, the firmware in the controller goes away,
and then the controller doesn't work after resume.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agousb: host: xhci-plat: add resume_quirk()
Yoshihiro Shimoda [Wed, 19 Apr 2017 13:55:47 +0000 (16:55 +0300)]
usb: host: xhci-plat: add resume_quirk()

This patch adds resume_quirk() to do platform specific process in
resume timing.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agousb: host: xhci-plat: enable clk in resume timing
Yoshihiro Shimoda [Wed, 19 Apr 2017 13:55:46 +0000 (16:55 +0300)]
usb: host: xhci-plat: enable clk in resume timing

This patch enables the clk in resume timing when device_may_wakeup()
is false. Otherwise, kernel panic happens when R-Car resumes the system
from Suspend-to-RAM because the clk is disabled.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agousb: host: plat: Enable xHCI plat runtime PM
Baolin Wang [Wed, 19 Apr 2017 13:55:45 +0000 (16:55 +0300)]
usb: host: plat: Enable xHCI plat runtime PM

Enable the xHCI plat runtime PM for parent device to suspend/resume
xHCI. Also call pm_runtime_forbid() in probe() function to force users
to explicitly enable runtime pm using power/control in sysfs, in case
some parent devices didn't implement runtime PM callbacks.

[set do_wakeup to true when runtime suspending -Mathias]
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoUSB: serial: ftdi_sio: add device ID for Microsemi/Arrow SF2PLUS Dev Kit
Marek Vasut [Tue, 18 Apr 2017 18:07:56 +0000 (20:07 +0200)]
USB: serial: ftdi_sio: add device ID for Microsemi/Arrow SF2PLUS Dev Kit

This development kit has an FT4232 on it with a custom USB VID/PID.
The FT4232 provides four UARTs, but only two are used. The UART 0
is used by the FlashPro5 programmer and UART 2 is connected to the
SmartFusion2 CortexM3 SoC UART port.

Note that the USB VID is registered to Actel according to Linux USB
VID database, but that was acquired by Microsemi.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
7 years agoUSB: serial: constify static arrays
Johan Hovold [Tue, 18 Apr 2017 12:42:28 +0000 (14:42 +0200)]
USB: serial: constify static arrays

Declare three immutable static driver arrays as const.

Signed-off-by: Johan Hovold <johan@kernel.org>
7 years agousb: fix some references for /proc/bus/usb
Mauro Carvalho Chehab [Mon, 17 Apr 2017 00:51:07 +0000 (21:51 -0300)]
usb: fix some references for /proc/bus/usb

Since when we got rid of usbfs, the /proc/bus/usb is now
elsewhere. Fix references for it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMerge tag 'usb-ci-v4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/peter...
Greg Kroah-Hartman [Tue, 18 Apr 2017 14:52:20 +0000 (16:52 +0200)]
Merge tag 'usb-ci-v4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next

Peter writes:

Two changes for this v4.12-rc1:
- Add sysfs entry for role switch
- Update gadget state after gadget back from suspend

7 years agousb: musb: musb_cppi41: Workaround DMA stall issue during teardown
Alexandre Bailon [Mon, 17 Apr 2017 04:21:18 +0000 (23:21 -0500)]
usb: musb: musb_cppi41: Workaround DMA stall issue during teardown

The DMA may hang up if a teardown is initiated while an endpoint is still
active (Advisory 2.3.27 of DA8xx errata).
To workaround this issue, add a delay before to initiate the teardown.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agousb: musb: Add support of CPPI 4.1 DMA controller to DA8xx
Alexandre Bailon [Mon, 17 Apr 2017 04:21:17 +0000 (23:21 -0500)]
usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx

Currently, only the PIO mode is supported.
This add support of CPPI 4.1 to DA8xx.
As in DA8xx the CPPI 4.1 DMA is a part of the USBSS, create the CPPI 4.1
device as a child of USB.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
[b-liu@ti.com: minor tweak in the commit log]
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agousb: musb: Use shared irq
Alexandre Bailon [Mon, 17 Apr 2017 04:21:16 +0000 (23:21 -0500)]
usb: musb: Use shared irq

In the DA8xx, USB and CPPI 4.1 are sharing the same interrupt line.
Update the driver to request a shared irq.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agousb: musb: cppi_dma.c: use DIV_ROUND_UP macro in cppi_next_(r|t)x_segment()
Ivan Safonov [Mon, 17 Apr 2017 04:21:15 +0000 (23:21 -0500)]
usb: musb: cppi_dma.c: use DIV_ROUND_UP macro in cppi_next_(r|t)x_segment()

DIV_ROUND_UP is bit useful than series of "/" and "%" operations.
Replace "/%" sequence with DIV_ROUND_UP macro.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoxhci: use correct flags for spin_lock_irqrestore() when setting port power
Mathias Nyman [Thu, 13 Apr 2017 11:01:04 +0000 (14:01 +0300)]
xhci: use correct flags for spin_lock_irqrestore() when setting port power

commit a6ff6cbf1fab ("usb: xhci: Add helper function xhci_set_power_on().")
created a helper to control port power that needs to be called with
xhci->lock held and interrupts disabled.
It released the lock with spin_unlock_irqrestore using a new zero flag
variable instead of the original flag from spin_lock_irqsave.
This regression triggered a static checker warning about bogus flags, and
a null pointer dereference on armada-385.

Fix it by passing a pointer to the correct flags and using it instead

Fixes: a6ff6cbf1fab ("usb: xhci: Add helper function xhci_set_power_on().")
Cc: Guoqing Zhang <guoqing.zhang@intel.com>
Reported-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Tested-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agousb: chipidea: core: add sysfs group
Peter Chen [Mon, 27 Mar 2017 02:54:27 +0000 (10:54 +0800)]
usb: chipidea: core: add sysfs group

Sometimes, the user needs to adjust some properties for controllers, eg
the role for controller, we add sysfs group for them.

The attribute 'role' is used to switch host/gadget role dynamically, the
uewr can read the current role, and write the other role compare to
current one to finish the switch.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
7 years agoMerge tag 'usb-for-v4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Tue, 11 Apr 2017 14:47:26 +0000 (16:47 +0200)]
Merge tag 'usb-for-v4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:

usb: changes for v4.12

With 51 non-merge commits, this is one of the smallest USB Gadget pull
requests. Apart from your expected set of non-critical fixes, and
other miscellaneous items, we have most of the changes in dwc3 (52.5%)
with all other UDCs following with 34.8%.

As for the actual changes, the most important of them are all the
recent changes to reduce memory footprint of dwc3, bare minimum
dual-role support on dwc3 and reworked endpoint count and
initialization routines.

7 years agousb: gadget: udc: atmel: Update Kconfig help for fifo_mode = 0
Cristian Birsan [Fri, 7 Apr 2017 16:07:22 +0000 (19:07 +0300)]
usb: gadget: udc: atmel: Update Kconfig help for fifo_mode = 0

Update Kconfig help for fifo_mode = 0 to explain the behavior better.

Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: udc: atmel: Use dev_err() to display EP configuration error
Cristian Birsan [Fri, 7 Apr 2017 16:07:21 +0000 (19:07 +0300)]
usb: gadget: udc: atmel: Use dev_err() to display EP configuration error

Use dev_err() to display EP configuration error to avoid silent failure.

Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: Add dual-role support
Roger Quadros [Wed, 5 Apr 2017 10:39:31 +0000 (13:39 +0300)]
usb: dwc3: Add dual-role support

If dr_mode is "otg" then support dual role mode of operation.
Currently this mode is only supported when an extcon handle is
present in the dwc3 device tree node. This is needed to
get the ID status events of the port.

We're using a workqueue to manage the dual-role state transitions
as the extcon notifier (dwc3_drd_notifier) is called in an atomic
context by extcon_sync() and this doesn't go well with
usb_del_gadget_udc() causing a lockdep and softirq warning.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: core: make dwc3_set_mode() work properly
Roger Quadros [Tue, 4 Apr 2017 09:49:18 +0000 (12:49 +0300)]
usb: dwc3: core: make dwc3_set_mode() work properly

We can't have both Host and Peripheral roles active at the same time
because of one detail on DWC3: it shares the same memory area for both
Host and Peripheral registers.

When swapping roles we must reinitialize the new role every
time. Let's make sure this works for our debugfs interface.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: debugfs: remove unnecessary | operator
Roger Quadros [Tue, 4 Apr 2017 08:27:57 +0000 (11:27 +0300)]
usb: dwc3: debugfs: remove unnecessary | operator

Each role is mutually exclusive, the | operator is unnecessary. Remove
it.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: core: add current_dr_role member
Roger Quadros [Tue, 4 Apr 2017 08:25:27 +0000 (11:25 +0300)]
usb: dwc3: core: add current_dr_role member

We're going to use this member to track which role we're currently
playing, that way we can more easily implement dual-role swap in
upcoming patches.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: udc: allow adding and removing the same gadget device
Roger Quadros [Mon, 3 Apr 2017 12:20:29 +0000 (15:20 +0300)]
usb: udc: allow adding and removing the same gadget device

allow usb_del_gadget_udc() and usb add_gadget_udc() to be called
repeatedly on the same gadget->dev structure.

We need to clear the gadget->dev structure so that kobject_init()
doesn't complain about already initialized object.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: simplify ZLP handling
Felipe Balbi [Fri, 7 Apr 2017 13:34:38 +0000 (16:34 +0300)]
usb: dwc3: simplify ZLP handling

It's much simpler to just add one extra TRB chained to previous TRB to
handle ZLP. This helps us reduce pointless allocations and simplifies
the code a little bit.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: ep0: improve handling of unaligned OUT requests
Felipe Balbi [Fri, 7 Apr 2017 11:09:13 +0000 (14:09 +0300)]
usb: dwc3: ep0: improve handling of unaligned OUT requests

Just like we did for all other endpoint types, let's rely on a chained
TRB pointing to ep0_bounce_addr in order to align transfer size. This
will make the code simpler.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: ep0: pass dep as argument to internal functions
Felipe Balbi [Fri, 7 Apr 2017 10:47:49 +0000 (13:47 +0300)]
usb: dwc3: ep0: pass dep as argument to internal functions

Instead of constantly recomputing how dwc and epnum relate to dep,
just pass dep as argument.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: ep0: use immediate SETUP on TRB
Felipe Balbi [Fri, 7 Apr 2017 10:34:21 +0000 (13:34 +0300)]
usb: dwc3: ep0: use immediate SETUP on TRB

If we pass TRB's own address on bpl/bph fields, we can get our SETUP
packet as immediate data on the TRB itself, without having to allocate
extra memory for it.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: mv_u3d: fix error handling in mv_u3d_probe()
Alexey Khoroshilov [Fri, 31 Mar 2017 21:07:18 +0000 (00:07 +0300)]
usb: gadget: mv_u3d: fix error handling in mv_u3d_probe()

There are several inconsistencies in the error handling code.
1. If clk_get() fails, it goes to clk_put().
2. If pdata->phy_init() fails, it does not disable u3d->clk.
3. In case of failure after stopping u3d, it does pdata->phy_deinit()
   and clk_disable(u3d->clk) twice.
4. It ignores failures in clk_enable().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: udc: atmel: Check fifo configuration values against device tree
Cristian Birsan [Mon, 3 Apr 2017 07:19:51 +0000 (10:19 +0300)]
usb: gadget: udc: atmel: Check fifo configuration values against device tree

Check fifo configuration values against device tree values for endpoint fifo
in auto configuration mode (fifo_mode=0).

Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agofsl_udc_core: add support for devices provided by fsl-mph-dr-of
Michael Grzeschik [Tue, 4 Apr 2017 14:41:54 +0000 (16:41 +0200)]
fsl_udc_core: add support for devices provided by fsl-mph-dr-of

Currently the of glue code in fsl-mph-dr-of will create the platform
device fsl-usb2-udc. As this driver should also be probed by this name,
this patch adds it to the devtypes list.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: expose dwc3_trb_type_string()
Felipe Balbi [Fri, 31 Mar 2017 11:44:09 +0000 (14:44 +0300)]
usb: dwc3: expose dwc3_trb_type_string()

That helper can be used from our tracepoint interface with very minor
edits. Let's do so.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: debugfs: return strings that match tracepoints
Felipe Balbi [Fri, 31 Mar 2017 11:37:21 +0000 (14:37 +0300)]
usb: dwc3: debugfs: return strings that match tracepoints

In order to improve usability a tiny bit, we will return strings that
match what our tracepoints return.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: debugfs: make use of dwc3_gadget_link_string()
Felipe Balbi [Fri, 31 Mar 2017 11:28:33 +0000 (14:28 +0300)]
usb: dwc3: debugfs: make use of dwc3_gadget_link_string()

Instead of redecoding link state into a string, use our helper.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: debugfs: downcase OTG on 'mode' file
Felipe Balbi [Fri, 31 Mar 2017 11:10:40 +0000 (14:10 +0300)]
usb: dwc3: debugfs: downcase OTG on 'mode' file

When writing, we expect the "otg" string. When showing, we return
"OTG". Let's downcase that word to avoid confusion.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: udc: amd5536: split core and PCI layer
Raviteja Garimella [Tue, 28 Mar 2017 11:02:03 +0000 (16:32 +0530)]
usb: gadget: udc: amd5536: split core and PCI layer

This patch splits the amd5536udc driver into two -- one that does
pci device registration and the other file that does the rest of
the driver tasks like the gadget/ep ops etc for Synopsys UDC.

This way of splitting helps in exporting core driver symbols which
can be used by any other platform/pci driver that is written for
the same Synopsys USB device controller.

The current patch also includes a change in the Kconfig and Makefile.
A new config option USB_SNP_CORE will be selected automatically when
any one of the platform or pci driver for the same UDC is selected.

Main changes:
- amd5536udc_pci.c: PCI device registration is moved to this file.

- amd5536udc.c:
  This file does rest of the core UDC fucntionality.
  9 symbols are exported so as to be used by amd5536udc_pci.c.
  Module parameter definitions are moved to header file.

- amd5536udc.h:
  Function declarations, module parameters definitions and few common
  header file includes are added to this file

- Kconfig:
  New USB_SNP_CORE option is added which will be auto selected when
  any pci or platform driver config option for the UDC is chosen.

- Makefile:
  Compiles the core and pci files separately.

Signed-off-by: Raviteja Garimella <raviteja.garimella@broadcom.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: udc: renesas_usb3: add support for usb role swap
Yoshihiro Shimoda [Fri, 31 Mar 2017 03:58:05 +0000 (12:58 +0900)]
usb: gadget: udc: renesas_usb3: add support for usb role swap

This patch adds support for usb role swap via sysfs "role".

For example:
 1) Connect a usb cable using 2 Salvator-X boards.
  - For A-Device, the cable is connected to CN11 (USB3.0 ch0).
  - For B-Device, the cable is connected to CN9 (USB2.0 ch0).
 2) On A-Device, you input the following command:
  # echo peripheral > /sys/devices/platform/soc/ee020000.usb/role
 3) On B-Device, you input the following command:
  # echo host > /sys/devices/platform/soc/ee080200.usb-phy/role

Then, the A-Device acts as a peripheral and the B-Device acts as
a host. Please note that A-Device must input the following command
if you want the board to act as a host again.
 # echo host > /sys/devices/platform/soc/ee020000.usb/role

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: udc: atmel: Minor code cleanup
Cristian Birsan [Tue, 28 Mar 2017 16:07:37 +0000 (19:07 +0300)]
usb: gadget: udc: atmel: Minor code cleanup

Minor code cleanup based on feedback received on mailinglist.

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: udc: renesas_usb3: add extcon support
Yoshihiro Shimoda [Thu, 30 Mar 2017 02:16:05 +0000 (11:16 +0900)]
usb: gadget: udc: renesas_usb3: add extcon support

This patch adds extcon support to see VBUS/ID signal states.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: udc: renesas_usb3: add USB ID signal monitoring
Yoshihiro Shimoda [Thu, 30 Mar 2017 02:16:04 +0000 (11:16 +0900)]
usb: gadget: udc: renesas_usb3: add USB ID signal monitoring

This usb 3.0 peripheral controller has a register (USB_OTG_STA) to monitor
the USB ID signal. So, this patch adds the ID signal monitoring to change
the mode to host (A-Host) or peripheral (B-Peripheral).
This patch also removes hardcoded setting as B-Peripheral mode.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: otg-fsm: Prevent build warning "VDBG" redefined
Roger Quadros [Thu, 30 Mar 2017 06:46:41 +0000 (09:46 +0300)]
usb: otg-fsm: Prevent build warning "VDBG" redefined

If usb/otg-fsm.h and usb/composite.h are included together
then it results in the build warning [1].

Prevent that by defining VDBG locally.

Also get rid of MPC_LOC which doesn't seem to be used
by anyone.

[1] - warning fixed by this patch:

In file included from drivers/usb/dwc3/core.h:33,
   from drivers/usb/dwc3/ep0.c:33:
   include/linux/usb/otg-fsm.h:30:1: warning: "VDBG" redefined
   In file included from drivers/usb/dwc3/ep0.c:31:
   include/linux/usb/composite.h:615:1: warning: this is the location
   of the previous definition

Signed-off-by: Roger Quadros <rogerq@ti.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: use BIT() macro where possible
Roger Quadros [Thu, 30 Mar 2017 06:46:40 +0000 (09:46 +0300)]
usb: dwc3: use BIT() macro where possible

To avoid checkpatch warnings with new patches let's
start using the BIT() macro wherever possible.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: f_fs: simplify ffs_dev name handling
Michal Nazarewicz [Fri, 10 Mar 2017 21:45:58 +0000 (22:45 +0100)]
usb: gadget: f_fs: simplify ffs_dev name handling

Currently ffs_dev::name can be either allocated by the client of
the ffs_dev structure or by the f_fs.c core itself.  The former
is used by g_ffs while the latter happens with configfs.

Historically, g_ffs did not need to allocate separate buffer for
the name so what is now f_fs.c core never cared about freeing
that space.  With configfs the name needs to be copied since the
memory is not guaranteed to be availeble after ffs_set_inst_name
finishes.

The complication is therefore here to avoid allocations in the
g_ffs case but it complicates the code inproportinally to
benefits it provides.  In particular, g_ffs is considered
‘legacy’ so optimising for its sake is unlikely to be worth the
effort.

With that observation in mind, simplify the code by unifying the
code paths in g_ffs and configfs paths.  Furthermore, instead of
allocating a new buffer for the name, simply embed it in the
ffs_dev structure.  This further makes the memory management
less convoluted and error-prone.

The configfs interface for functionfs imposed a limit of 40
characters for the name so this results in a 41-byte buffer
added to the structure.  (For short names this may lead to
wasted memory but the actual amount is not immediately obvious
and depends on pointer size and which slab buckets the structure
and name would fall into).

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc2: simplify optional reset handling
Philipp Zabel [Wed, 15 Mar 2017 11:31:53 +0000 (12:31 +0100)]
usb: dwc2: simplify optional reset handling

As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.

This allows to return errors from devm_reset_control_get_optional and to
call reset_control_(de)assert unconditionally.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: phy: Remove unused config
Baolin Wang [Thu, 23 Mar 2017 06:08:31 +0000 (14:08 +0800)]
usb: phy: Remove unused config

Since the old common Samsung USB PHY code has been removed by commit ea2fdf8423
("usb: phy: samsung: remove old common USB PHY code"), thus remove the unused
config.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: dummy_hcd: Fix wrong power status bit clear/reset in dummy_hub_control()
Yuyang Du [Thu, 23 Mar 2017 20:06:11 +0000 (04:06 +0800)]
usb: gadget: dummy_hcd: Fix wrong power status bit clear/reset in dummy_hub_control()

This fixes the commit: 1cd8fd2887e1 ("usb: gadget: dummy_hcd: add
SuperSpeed support").

In the case of ClearPortFeature and USB_PORT_FEAT_POWER, simply clear
the right bit regardless of what the wValue is.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Yuyang Du <yuyang.du@intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: mtu3: Replace the extcon API
Chanwoo Choi [Tue, 28 Mar 2017 04:42:02 +0000 (13:42 +0900)]
usb: mtu3: Replace the extcon API

This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>
Cc: linux-usb@vger.kernel.org
Tested-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: u_ether: conditionally align transfer size
Felipe Balbi [Wed, 22 Mar 2017 11:25:18 +0000 (13:25 +0200)]
usb: gadget: u_ether: conditionally align transfer size

Unless HW sets quirk_ep_out_aligned_size, gadget driver shouldn't make
any efforts towards aligning transfers. If the UDC needs, it *must*
set the quirk flag.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: u_ether: use better list accessors
Felipe Balbi [Wed, 22 Mar 2017 11:24:34 +0000 (13:24 +0200)]
usb: gadget: u_ether: use better list accessors

We have helpers for some of these, let's rely on them instead of open
coding what they do in u_ether.c

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: trace: change format for string to cmd trace
Felipe Balbi [Wed, 22 Mar 2017 11:03:13 +0000 (13:03 +0200)]
usb: dwc3: trace: change format for string to cmd trace

a %x is much easier for a human to parse when reading tracepoint
output. Let's change it.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: reword configuration choices
Romain Izard [Fri, 10 Mar 2017 13:11:42 +0000 (14:11 +0100)]
usb: gadget: reword configuration choices

As USB_CONFIGFS is not a part of the "USB Gadget Drivers" choice
anymore, the name for the option and its attached description needs to
be more descriptive. It appears one level higher in the configuration
menu, and without the context provided by the comments for the choice
entry, it needs to make sense on its own.

Conversely, the "USB Gadget Drivers" entry now only introduces the
legacy drivers, where one or more functions are combined in a single
driver. As the configfs option can be used as a full-fledged
alternative, rename the choice entry to show that it is not the only
way to provice service as an USB gadget.

Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: legacy gadgets are optional
Romain Izard [Fri, 10 Mar 2017 13:11:41 +0000 (14:11 +0100)]
usb: gadget: legacy gadgets are optional

With commit bc49d1d17dcf ("usb: gadget: don't couple configfs to legacy
gadgets"),it is possible to build a modular kernel with both built-in
configfs support and modular legacy gadget drivers.

But when building a kernel without modules, it is also necessary to be
able to build with configfs but without any legacy gadget driver. This
was a possible configuration when the USB_CONFIGFS was a part of the
choice options, but not anymore.

Mark the choice for legacy gadget drivers as optional restores this.

Fixes: bc49d1d17dcf ("usb: gadget: don't couple configfs to legacy gadgets")
Cc: <stable@vger.kernel.org> # 4.9+
Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: gadget: Fix starting microframe for ISOC
John Youn [Thu, 26 Jan 2017 19:58:40 +0000 (11:58 -0800)]
usb: dwc3: gadget: Fix starting microframe for ISOC

The gadget wants to set the starting microframe for the first ISOC TRB
to 4 microframes in the future, but it does so by multiplying the
dep->interval. This only works if dep->interval = 1. For other intervals
it will put it 4 *intervals* in the future which may be way too much.

Fix so that it always adds just one interval or at least 4 microframes.

Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: exynos: change goto labels to meaningful names
Shuah Khan [Mon, 30 Jan 2017 19:25:04 +0000 (12:25 -0700)]
usb: dwc3: exynos: change goto labels to meaningful names

Change goto labels to meaningful names from a series of errNs.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: remove dwc3_gadget_init_hw_endpoints
Bryan O'Donoghue [Tue, 31 Jan 2017 20:58:11 +0000 (20:58 +0000)]
usb: dwc3: remove dwc3_gadget_init_hw_endpoints

A previous patch in the series reduces the number of  callsites of
dwc3_gadget_init_hw_endpoints from two to one. This patch removes the
redundant step of wrappering one function in the other, which can be done
by adding a parameter to dwc3_gadget_init_endpoints and moving the
linked-list initialization of dwc->gadet.ep_list.

Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: refactor gadget endpoint count calculation
Bryan O'Donoghue [Tue, 31 Jan 2017 20:58:10 +0000 (20:58 +0000)]
usb: dwc3: refactor gadget endpoint count calculation

- DWC_USB3_NUM indicates the number of Device mode single directional
  endpoints, including OUT and IN endpoint 0.

- DWC_USB3_NUM_IN_EPS indicates the maximum number of Device mode IN
  endpoints active at any time, including control endpoint 0.

It's possible to configure RTL such that DWC_USB3_NUM_EPS is equal to
DWC_USB3_NUM_IN_EPS.

dwc3-core calculates the number of OUT endpoints as DWC_USB3_NUM minus
DWC_USB3_NUM_IN_EPS. If RTL has been configured with DWC_USB3_NUM_IN_EPS
equal to DWC_USB3_NUM then dwc3-core will calculate the number of OUT
endpoints as zero.

For example a from dwc3_core_num_eps() shows:
[    1.565000]  /usb0@f01d0000: found 8 IN and 0 OUT endpoints

This patch refactors the endpoint calculation down to one variable
dwc->num_eps taking care to maintain the current mapping of endpoints for
fixed FPGA configurations as described in Table 4-7 of version 2.60a of the
DWC USB3 databook.

The endpoint mapping will then be EP-OUT, EP-IN etc, up to DWC_USB3_NUM.
If DWC_USB3_NUM is odd then OUT will take the extra endpoint.

Suggested-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc3: make macros safe to expression arguments
Roger Quadros [Thu, 6 Apr 2017 10:14:28 +0000 (13:14 +0300)]
usb: dwc3: make macros safe to expression arguments

We must make sure that our macros are safe against expressions passed
as arguments. We have seen one problem where GTXFIFOSIZ(n) was failing
when passed the expression (epnum >> 1) as argument. The problem was
caused by operator precedence between >> and *.

To make sure macros are safe, we just wrap argument with () when using
it.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc2: Add support for STM32F429/439/469 USB OTG HS/FS in FS mode (internal PHY)
Bruno Herrera [Wed, 1 Feb 2017 01:25:43 +0000 (23:25 -0200)]
usb: dwc2: Add support for STM32F429/439/469 USB OTG HS/FS in FS mode (internal PHY)

This patch introduces a new parameter to activate USB OTG HS/FS core
embedded phy transceiver. The STM32F4x9 SoC uses the GGPIO register
to enable the transceiver.
Also add the dwc2_set_params function for stm32f4 otg fs.

Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Bruno Herrera <bruherrera@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: udc: remove unnecessary variable and update function prototype
Gustavo A. R. Silva [Tue, 14 Feb 2017 22:03:02 +0000 (16:03 -0600)]
usb: gadget: udc: remove unnecessary variable and update function prototype

Remove unnecessary variable and update function prototype.

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: udc: avoid use of freed pointer
Gustavo A. R. Silva [Tue, 14 Feb 2017 21:58:33 +0000 (15:58 -0600)]
usb: gadget: udc: avoid use of freed pointer

Rewrite udc_free_dma_chain() function to avoid use of pointer after free.

Addresses-Coverity-ID: 1091172
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: dwc2: Make sure we disconnect the gadget state
John Stultz [Tue, 14 Feb 2017 04:08:08 +0000 (20:08 -0800)]
usb: dwc2: Make sure we disconnect the gadget state

I had seen some odd behavior with HiKey's usb-gadget interface
that I finally seemed to have chased down. Basically every other
time I plugged in the OTG port, the gadget interface would
properly initialize. The other times, I'd get a big WARN_ON
in dwc2_hsotg_init_fifo() about the fifo_map not being clear.

Ends up if we don't disconnect the gadget state, the fifo-map
doesn't get cleared properly, which causes WARN_ON messages and
also results in the device not properly being setup as a gadget
every other time the OTG port is connected.

So this patch adds a call to dwc2_hsotg_disconnect() in the
reset path so the state is properly cleared.

With it, the gadget interface initializes properly on every
plug in.

Cc: Wei Xu <xuwei5@hisilicon.com>
Cc: Guodong Xu <guodong.xu@linaro.org>
Cc: Amit Pundir <amit.pundir@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: John Youn <johnyoun@synopsys.com>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Chen Yu <chenyu56@huawei.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: f_fs: Fix ExtCompat documentation in uapi header
Vincent Pelletier [Fri, 17 Feb 2017 11:20:38 +0000 (11:20 +0000)]
usb: gadget: f_fs: Fix ExtCompat documentation in uapi header

The code was fixed in
commit 53642399aa71 ("usb: gadget: f_fs: Fix wrong check on reserved1 wof OS_DESC_EXT_COMPAT")
but the in-header documentation kept referencing 0 as the expected value.
Reference 1 instead as per original commit message.

Signed-off-by: Vincent Pelletier <plr.vincent@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agotools/usb: Add .gitignore file
Prarit Bhargava [Mon, 20 Feb 2017 14:04:44 +0000 (09:04 -0500)]
tools/usb: Add .gitignore file

Add .gitignore file for untracked files in tools/usb.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agousb: gadget: uvc: Missing files for configfs interface
Petr Cvek [Mon, 6 Mar 2017 23:57:20 +0000 (00:57 +0100)]
usb: gadget: uvc: Missing files for configfs interface

Commit 76e0da34c7ce ("usb-gadget/uvc: use per-attribute show and store
methods") caused a stringification of an undefined macro argument "aname",
so three UVC parameters (streaming_interval, streaming_maxpacket and
streaming_maxburst) were named "aname".

Add the definition of "aname" to the main macro and name the filenames as
originaly intended.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
7 years agoMerge tag 'phy-for-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/kishon...
Greg Kroah-Hartman [Mon, 10 Apr 2017 13:45:52 +0000 (15:45 +0200)]
Merge tag 'phy-for-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy into usb-next

Kishon writes:

phy: for 4.12

 *) Add new PHY driver for Qualcomm's QMP PHY (used by PCIe, UFS and USB)
 *) Add new PHY driver for Qualcomm's QUSB2 PHY
 *) Add support for vbus regulator in rockchip-usb driver
 *) Add support for usb2-phy in rk3328 to rockchip-inno-usb2 driver
 *) Add support for a new version of PHY in phy-mt65xx-usb3 driver
 *) Add support for Allwinner A64 PHY to switch between MUSB and EHCI/OHCI
 *) Cleanups in Exynos driver and phy-mt65xx-usb3 driver

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: qcom-qusb2: add NVMEM dependency
Tobias Regnery [Mon, 10 Apr 2017 09:52:42 +0000 (11:52 +0200)]
phy: qcom-qusb2: add NVMEM dependency

With CONFIG_NVMEM=m and CONFIG_PHY_QCOM_QUSB2=y we get a link error from
calls to devm_nvmem_cell_get and nvmem_cell_read:

drivers/built-in.o: In function `qusb2_phy_probe':
binder.c:(.text+0x4750): undefined reference to `devm_nvmem_cell_get'
drivers/built-in.o: In function `qusb2_phy_init':
binder.c:(.text+0x489c): undefined reference to `nvmem_cell_read'

Fix this by adding a Kconfig dependency to ensure we can only have this
driver built in when the nvmem functions are also built in or we see the
empty stub functions. We can still build this driver as a module when the
nvmem core is build as module, too.

Fixes: deffad633413 ("phy: qcom-qusb2: New driver for QUSB2 PHY on Qcom chips")
Signed-off-by: Tobias Regnery <tobias.regnery@gmail.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: rockchip-usb: Add vbus regulator support.
Sjoerd Simons [Wed, 5 Apr 2017 14:06:10 +0000 (16:06 +0200)]
phy: rockchip-usb: Add vbus regulator support.

On rockchip devices vbus is supplied by a separate power supply, often
through a regulator. Add support for describing the the regulator in
device-tree following the same convention as several other usb phy's.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: bcm-ns-usb3: split all writes into reg & val pairs
Rafał Miłecki [Sun, 2 Apr 2017 16:55:22 +0000 (18:55 +0200)]
phy: bcm-ns-usb3: split all writes into reg & val pairs

So far all the PHY initialization was implemented using some totally
magic values. There was some pattern there but it wasn't clear what is
it about.

Thanks to the patch submitted by Broadcom:
[PATCH 5/6] phy: Add USB3 PHY support for Broadcom NSP SoC
and the upstream "iproc-mdio" driver we now know there is a MDIO bus
underneath with PHY(s) and their registers.

It allows us to clean the driver a bit by making all these values less
magical. The next step is switching to using a proper MDIO layer.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Jon Mason <jon.mason@broadcom.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: qcom-qmp: new qmp phy driver for qcom-chipsets
Vivek Gautam [Thu, 6 Apr 2017 05:51:25 +0000 (11:21 +0530)]
phy: qcom-qmp: new qmp phy driver for qcom-chipsets

Qualcomm SOCs have QMP phy controller that provides support
to a number of controller, viz. PCIe, UFS, and USB.
Add a new driver, based on generic phy framework, for this
phy controller.

Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agodt-bindings: phy: Add support for QMP phy
Vivek Gautam [Thu, 6 Apr 2017 05:51:24 +0000 (11:21 +0530)]
dt-bindings: phy: Add support for QMP phy

Qualcomm chipsets have QMP phy controller that provides
support to a number of controller, viz. PCIe, UFS, and USB.
Adding dt binding information for the same.

Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: qcom-qusb2: New driver for QUSB2 PHY on Qcom chips
Vivek Gautam [Thu, 6 Apr 2017 05:51:23 +0000 (11:21 +0530)]
phy: qcom-qusb2: New driver for QUSB2 PHY on Qcom chips

PHY transceiver driver for QUSB2 phy controller that provides
HighSpeed functionality for DWC3 controller present on
Qualcomm chipsets.

Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agodt-bindings: phy: Add support for QUSB2 phy
Vivek Gautam [Thu, 6 Apr 2017 05:51:22 +0000 (11:21 +0530)]
dt-bindings: phy: Add support for QUSB2 phy

Qualcomm chipsets have QUSB2 phy controller that provides
HighSpeed functionality for DWC3 controller.
Adding dt binding information for the same.

Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: rockchip-inno-usb2: add support of usb2-phy for rk3328
Meng Dongyang [Mon, 6 Mar 2017 01:29:38 +0000 (09:29 +0800)]
phy: rockchip-inno-usb2: add support of usb2-phy for rk3328

Add usb2-phy config information in the data of match table for
rk3328.

Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agodt-bindings: add DT bindings for usb2-phy grf
Meng Dongyang [Mon, 6 Mar 2017 01:29:37 +0000 (09:29 +0800)]
dt-bindings: add DT bindings for usb2-phy grf

Adds the device tree bindings description for usb2-phy grf
of RK3328 platform.

Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agodt-bindings: phy-rockchip-inno-usb2: add assign clock property in usb2-phy node
Meng Dongyang [Mon, 6 Mar 2017 01:29:36 +0000 (09:29 +0800)]
dt-bindings: phy-rockchip-inno-usb2: add assign clock property in usb2-phy node

On some platform such as RK3328, the 480m clock may need to assign
clock parent in dts in stead of clock driver. So this patch add
property of assigned-clocks and assigned-clock-parents to assign
parent for 480m clock.

Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agodt-bindings: phy-mt65xx-usb: add support for new version phy
Chunfeng Yun [Fri, 31 Mar 2017 07:35:35 +0000 (15:35 +0800)]
dt-bindings: phy-mt65xx-usb: add support for new version phy

add a new compatible string for "mt2712", and move reference clock
into each port node;

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: phy-mt65xx-usb3: disable 100uA extraction from SS port to HS port
Chunfeng Yun [Fri, 31 Mar 2017 07:35:32 +0000 (15:35 +0800)]
phy: phy-mt65xx-usb3: disable 100uA extraction from SS port to HS port

There will be a problem if SS port is diasbled and HS port extracts
100uA from SS port, so disable extract 100uA from SS port in the case,
when disable it, PA0_RG_USB20_INTR_EN should be set, otherwise HS port
only works on LS.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: phy-mt65xx-usb3: add support for new version phy
Chunfeng Yun [Fri, 31 Mar 2017 07:35:31 +0000 (15:35 +0800)]
phy: phy-mt65xx-usb3: add support for new version phy

There are some variations from mt2701 to mt2712:
1. banks shared by multiple ports are put back into each port,
    such as SPLLC and U2FREQ;
2. add a new bank MISC for u2port, and CHIP for u3port;
3. bank's offset in each port are also rearranged;

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: phy-mt65xx-usb3: move clock from phy node into port nodes
Chunfeng Yun [Fri, 31 Mar 2017 07:35:30 +0000 (15:35 +0800)]
phy: phy-mt65xx-usb3: move clock from phy node into port nodes

each port has its own reference clock, the HighSpeed port is 48M,
and the SuperSpeed port is usually 26M, put them into port node for
flexibility, this can close clock if the port is not used.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: phy-mt65xx-usb3: split SuperSpeed port into two ones
Chunfeng Yun [Fri, 31 Mar 2017 07:35:29 +0000 (15:35 +0800)]
phy: phy-mt65xx-usb3: split SuperSpeed port into two ones

Currently usb3 port in fact includes two sub-ports, but it is not
flexible for some cases, such as following one:
    usb3 port0 includes u2port0 and u3port0;
    usb2 port0 includes u2port1;
If wants to support only HS, we can use u2port0 or u2port1, when
select u2port0, u3port0 is not needed;
If wants to support SS, we can compound u2port0 and u3port0,
or u2port1 and u3port0, if select latter one, u2port0 is not needed.

So it's more flexible to split usb3 port into two ones and also try
best to save power by disabling unnecessary ports.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: phy-mt65xx-usb3: increase LFPS filter threshold
Chunfeng Yun [Fri, 31 Mar 2017 07:35:28 +0000 (15:35 +0800)]
phy: phy-mt65xx-usb3: increase LFPS filter threshold

Increase LFPS filter threshold to avoid some fake remote wakeup
signal which cause U3 link fail and link to U2 only at about
0.01% probability.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: phy-mt65xx-usb3: improve RX detection stable time
Chunfeng Yun [Fri, 31 Mar 2017 07:35:27 +0000 (15:35 +0800)]
phy: phy-mt65xx-usb3: improve RX detection stable time

The default value of RX detection stable time is 10us, and this
margin is too big for some critical cases which cause U3 link fail
and link to U2(probability is about 1%). So change it to 5us.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: sun4i-usb: enable PHY0 dual route switching for A64 USB PHY
Icenowy Zheng [Tue, 4 Apr 2017 18:45:16 +0000 (02:45 +0800)]
phy: sun4i-usb: enable PHY0 dual route switching for A64 USB PHY

Allwinner A64 SoC features a switchable PHY0 like the one in H3, which
can switch between a MUSB controller and a pair of OHCI/EHCI controller.

Enable PHY0 route auto switching for A64.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: rcar-gen3-usb2: fix implementation for runtime PM
Yoshihiro Shimoda [Mon, 13 Mar 2017 23:37:40 +0000 (08:37 +0900)]
phy: rcar-gen3-usb2: fix implementation for runtime PM

This patch fixes an issue that this driver doesn't take care of the runtime
PM. This code assumed that devm_phy_create() called pm_runtime_enable(dev),
but it misunderstood the dev_phy_create()'s specification.
This driver should call its own pm_runtime_enable() before
dev_phy_create().

Fixes: f3b5a8d9b50d ("phy: rcar-gen3-usb2: Add R-Car Gen3 USB2 PHY driver")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: rockchip-inno-usb2: fix spelling mistake: "connecetd" -> "connected"
Colin Ian King [Wed, 22 Feb 2017 23:30:52 +0000 (23:30 +0000)]
phy: rockchip-inno-usb2: fix spelling mistake: "connecetd" -> "connected"

trivial fix to spelling mistake in dev_dbg message, also rejoin
lines to clean up checkpatch warning

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: exynos: Use one define for enable bit
Krzysztof Kozlowski [Wed, 29 Mar 2017 08:29:57 +0000 (13:59 +0530)]
phy: exynos: Use one define for enable bit

There is no need for separate defines for Exynos4 and Exynos5 phy enable
bit and MIPI phy reset bits.  In both cases there are the same so
simplify it.

This reduces number of defines and allows removal of one header file.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agoMerge tag 'ib-mfd-phy-v4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/lee...
Kishon Vijay Abraham I [Mon, 10 Apr 2017 11:13:09 +0000 (16:43 +0530)]
Merge tag 'ib-mfd-phy-v4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd into next

Immutable branch between MFD and PHY due for the v4.12 merge window

7 years agophy: exynos-mipi-video: Use consistent method to address phy registers
Krzysztof Kozlowski [Tue, 14 Mar 2017 16:46:51 +0000 (18:46 +0200)]
phy: exynos-mipi-video: Use consistent method to address phy registers

Exynos4 MIPI phy registers are defined with macro calculating the offset
for given phyN.  Use the same method for Exynos5420 to be consistent.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: exynos5: Remove duplicated defines of PHY register defines
Krzysztof Kozlowski [Tue, 14 Mar 2017 16:46:50 +0000 (18:46 +0200)]
phy: exynos5: Remove duplicated defines of PHY register defines

Phy drivers access PMU region through regmap provided by exynos-pmu
driver.   However there is no need to duplicate defines for PMU
registers.  Instead just use whatever is defined in exynos-regs-pmu.h.

This reduces number of defines.

Suggested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
7 years agophy: exynos4: Remove duplicated defines of PHY register defines
Krzysztof Kozlowski [Wed, 29 Mar 2017 08:25:57 +0000 (13:55 +0530)]
phy: exynos4: Remove duplicated defines of PHY register defines

Phy drivers access PMU region through regmap provided by exynos-pmu
driver.   However there is no need to duplicate defines for PMU
registers.  Instead just use whatever is defined in exynos-regs-pmu.h.

Additionally MIPI PHY registers for Exynos5433 start from the same
address as Exynos4 and Exynos5250 so re-use existing defines.

This reduces number of defines and allows removal of one header file.

Suggested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>