linux/drivers/usb
Stephan Gerhold c4a68b4da6 usb: phy: ab8500-usb: Keep PHY turned on in UART mode
AB8505 supports an "UART carkit mode" which makes UART accessible
through the USB connector. Upon detection of the UART cable,
this mode has to be manually enabled by:

  1. Turning on the PHY in peripheral mode
  2. Reconfiguring PHY/pins to route UART signals to USB pins

At the moment, we do not handle the UART link statuses at all,
which means that UART stops working as soon as phy-ab8500-usb is loaded
(since we disable the PHY after initialization).

Keeping UART working if the cable is inserted before turning on the device
is quite simple: In this case, early boot firmware has already set up
the necessary PHY/pin configuration. The presence of the UART cable
is reported by a special value in the USB link status register.

We can check for that value in ab8505_usb_link_status_update()
and set the PHY back to peripheral mode to restore UART.
(Note: This will result in some minor garbage since we still
 temporarily disable the PHY during initialization...)

Fully implementing this feature is more complicated:
For some reason, AB8505 does not update UART link status after bootup.
Regular USB cables work fine, but the link status register does not change
its state if an UART cable is inserted/removed.

It seems likely that the hardware is not actually capable of detecting
UART cables autonomously. In addition to the USB link status register,
implementations in the vendor kernel also manually measure
the ID resistance to detect additional cable types. For UART cables,
the USB link status register might simply reflect the PHY configuration
instead of the actual link status.

Implementing that functionality requires significant additions,
so for now just implement the simple case. This allows using UART
when inserting the cable before turning on the device.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20191218203450.71037-1-stephan@gerhold.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-30 20:11:31 +01:00
..
atm USB driver fixes for 5.5-rc2 2019-12-14 12:40:39 -08:00
c67x00
cdns3 usb: cdns3: gadget: Remove unneeded variable ret 2019-12-30 20:11:30 +01:00
chipidea usb: chipidea: imx: pinctrl for HSIC is optional 2019-11-18 17:40:27 +08:00
class compat_ioctl: remove most of fs/compat_ioctl.c 2019-12-01 13:46:15 -08:00
common usb: common: usb-conn-gpio: Don't log an error on probe deferral 2019-12-10 11:41:20 +01:00
core USB: Fix incorrect DMA allocations for local memory pool drivers 2019-12-11 09:06:41 +01:00
dwc2 USB: changes for v5.5 2019-11-18 08:24:12 +01:00
dwc3 usb: dwc3: pci: add ID for the Intel Comet Lake -H variant 2019-12-12 14:02:37 +01:00
early drivers: Remove explicit invocations of mmiowb() 2019-04-08 12:01:02 +01:00
gadget usb: gadget: move choice ... endchoice to legacy/Kconfig 2019-12-17 16:24:13 +01:00
host USB: EHCI: ehci-mv: add HSIC support 2019-12-30 20:11:29 +01:00
image Merge 5.4-rc3 into usb-next 2019-10-14 07:09:59 +02:00
isp1760 usb: isp1760: isp1760-hcd.c: Drop condition with no effect 2019-10-07 13:01:47 +02:00
misc USB: adutux: fix interface sanity check 2019-12-10 13:11:22 +01:00
mon usb: mon: Fix a deadlock in usbmon between mmap and read 2019-12-10 11:41:20 +01:00
mtu3 Merge 5.4-rc6 into usb-next 2019-11-04 06:41:09 +01:00
musb usb: musb: create debugfs directory under usb root 2019-11-21 18:20:29 +01:00
phy usb: phy: ab8500-usb: Keep PHY turned on in UART mode 2019-12-30 20:11:31 +01:00
renesas_usbhs usb: renesas_usbhs: Use dma_request_chan() directly for channel request 2019-11-14 11:12:31 +08:00
roles usb: roles: fix a potential use after free 2019-12-10 11:41:18 +01:00
serial Merge 5.5-rc2 into usb-next 2019-12-16 09:02:03 +01:00
storage USB: Fix incorrect DMA allocations for local memory pool drivers 2019-12-11 09:06:41 +01:00
typec usb: typec: fusb302: Fix an undefined reference to 'extcon_get_state' 2019-12-17 16:02:49 +01:00
usbip usbip: Fix error path of vhci_recv_ret_submit() 2019-12-17 16:36:33 +01:00
Kconfig usb: common: create Kconfig file 2019-09-03 19:00:39 +02:00
Makefile USB: Changes for v5.4 merge window 2019-09-02 19:20:57 +02:00
usb-skeleton.c USB: usb-skeleton: drop redundant in-urb check 2019-10-10 12:41:19 +02:00