linux/drivers/usb/phy
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
..
Kconfig usb: gadget: fsl: fix link error against usb-gadget module 2019-05-03 09:13:47 +03:00
Makefile usb: phy: Add Kconfig entry for Tegra PHY driver 2018-04-23 09:50:57 +02:00
of.c USB: phy: Remove redundant license text 2017-11-07 15:45:01 +01:00
phy-ab8500-usb.c usb: phy: ab8500-usb: Keep PHY turned on in UART mode 2019-12-30 20:11:31 +01:00
phy-am335x-control.c bus_find_device: Unify the match callback with class_find_device 2019-06-24 05:22:31 +02:00
phy-am335x-control.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
phy-am335x.c usb: phy: am335x: fix race condition in _probe 2019-01-28 15:31:43 +02:00
phy-fsl-usb.c USB: Changes for v5.4 merge window 2019-09-02 19:20:57 +02:00
phy-fsl-usb.h USB: phy: Remove redundant license text 2017-11-07 15:45:01 +01:00
phy-generic.c usb: phy-generic: Use gpiod_set_value_cansleep 2018-03-13 10:47:52 +02:00
phy-generic.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
phy-gpio-vbus-usb.c USB: phy: Remove redundant license text 2017-11-07 15:45:01 +01:00
phy-isp1301-omap.c USB: phy: Remove redundant license text 2017-11-07 15:45:01 +01:00
phy-isp1301.c bus_find_device: Unify the match callback with class_find_device 2019-06-24 05:22:31 +02:00
phy-keystone.c usb: phy: keystone: use devm_platform_ioremap_resource() to simplify code 2019-10-04 14:09:41 +02:00
phy-mv-usb.c USB: phy: mv-usb: convert platform driver to use dev_groups 2019-08-09 07:55:44 +02:00
phy-mv-usb.h USB: phy: Remove redundant license text 2017-11-07 15:45:01 +01:00
phy-mxs-usb.c usb: phy: mxs: use devm_platform_ioremap_resource() to simplify code 2019-10-04 14:09:41 +02:00
phy-omap-otg.c USB: phy: Remove redundant license text 2017-11-07 15:45:01 +01:00
phy-tahvo.c USB: phy: tahvo: convert platform driver to use dev_groups 2019-08-09 07:55:44 +02:00
phy-tegra-usb.c usb: tegra: Move utmi-pads reset from ehci-tegra to tegra-phy 2018-04-23 09:50:57 +02:00
phy-twl6030-usb.c USB: phy: twl6030: convert platform driver to use dev_groups 2019-08-09 07:55:44 +02:00
phy-ulpi-viewport.c USB: phy: Remove redundant license text 2017-11-07 15:45:01 +01:00
phy-ulpi.c USB: phy: Remove redundant license text 2017-11-07 15:45:01 +01:00
phy.c USB: phy: drop legacy board-file support 2018-04-22 15:58:24 +02:00