phy: cpcap-usb: Add CPCAP PMIC USB support
Subsystems (2)
PATCH 1/1 phy: cpcap-usb: Add CPCAP PMIC USB support
Some Motorola phones like droid 4 use a custom CPCAP PMIC that has a multiplexing USB PHY.
This USB PHY can operate at least in four modes using pin multiplexing and two control GPIOS:
- Pass through companion PHY for the SoC USB PHY
- ULPI PHY for the SoC
- Pass through USB for the modem
- UART debug console for the SoC
This patch adds support for droid 4 USB PHY and debug UART modes, support for other modes can be added later on as needed.
Both peripheral and host mode are working for the USB. The host mode depends on the cpcap-charger driver for VBUS.
VBUS and ID pin detection are done using cpcap-adc IIO ADC driver.
--- .../devicetree/bindings/phy/phy-cpcap-usb.txt | 40 ++ drivers/phy/Kconfig | 8 + drivers/phy/Makefile | 1 + drivers/phy/phy-cpcap-usb.c | 695 +++++++++++++++++++++ 4 files changed, 744 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/phy-cpcap-usb.txt create mode 100644 drivers/phy/phy-cpcap-usb.c
Documentation/devicetree/bindings/phy/phy-cpcap-usb.txt new file +40 -0
@@ -0,0 +1,40 @@ +Motorola CPCAP PMIC USB PHY binding + +Required properties: +compatible: Shall be either "motorola,cpcap-usb-phy" or + "motorola,mapphone-cpcap-usb-phy" +#phy-cells: Shall be 0 +interrupts: CPCAP PMIC interrupts used by the USB PHY +interrupt-names: Interrupt names +io-channels: IIO ADC channels used by the USB PHY +io-channel-names: IIO ADC channel names +vusb-supply: Regulator for the PHY + +Optional properties: +pinctrl: Optional alternate pin modes for the PHY +pinctrl-names: Names for optional pin modes +mode-gpios: Optional GPIOs for configuring alternate modes + +Example: +cpcap_usb2_phy: phy { + compatible = "motorola,mapphone-cpcap-usb-phy"; + pinctrl-0 = <&usb_gpio_mux_sel1 &usb_gpio_mux_sel2>; + pinctrl-1 = <&usb_ulpi_pins>; + pinctrl-2 = <&usb_utmi_pins>; + pinctrl-3 = <&uart3_pins>; + pinctrl-names = "default", "ulpi", "utmi", "uart"; + #phy-cells = <0>; + interrupts-extended = < + &cpcap 15 0 &cpcap 14 0 &cpcap 28 0 &cpcap 19 0 + &cpcap 18 0 &cpcap 17 0 &cpcap 16 0 &cpcap 49 0 + &cpcap 48 1 + >; + interrupt-names = + "id_ground", "id_float", "se0conn", "vbusvld", + "sessvld", "sessend", "se1", "dm", "dp"; + mode-gpios = <&gpio2 28 GPIO_ACTIVE_HIGH + &gpio1 0 GPIO_ACTIVE_HIGH>; + io-channels = <&cpcap_adc 2>, <&cpcap_adc 7>; + io-channel-names = "vbus", "id"; + vusb-supply = <&vusb>; +};
drivers/phy/Kconfig +8 -0
@@ -47,6 +47,14 @@ config PHY_BERLIN_SATA help Enable this to support the SATA PHY on Marvell Berlin SoCs. +config PHY_CPCAP_USB + tristate "CPCAP USB PHY driver" + depends on USB_SUPPORT + select GENERIC_PHY + select USB_PHY + help + Enable this for CPCAP USB to work. + config ARMADA375_USBCLUSTER_PHY def_bool y depends on MACH_ARMADA_375 || COMPILE_TEST
drivers/phy/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_PHY_BCM_NS_USB2) += phy-bcm-ns-usb2.o obj-$(CONFIG_PHY_BCM_NS_USB3) += phy-bcm-ns-usb3.o obj-$(CONFIG_PHY_BERLIN_USB) += phy-berlin-usb.o obj-$(CONFIG_PHY_BERLIN_SATA) += phy-berlin-sata.o +obj-$(CONFIG_PHY_CPCAP_USB) += phy-cpcap-usb.o obj-$(CONFIG_PHY_DA8XX_USB) += phy-da8xx-usb.o obj-$(CONFIG_PHY_DM816X_USB) += phy-dm816x-usb.o obj-$(CONFIG_ARMADA375_USBCLUSTER_PHY) += phy-armada375-usb2.o
drivers/phy/phy-cpcap-usb.c new file +695 -0
695 lines not on this page · raw message
Signature · 1 line
2.11.1
Hi,
Quoted 11 lines · Tony Lindgren
Some Motorola phones like droid 4 use a custom CPCAP PMIC that has a multiplexing USB PHY.
This USB PHY can operate at least in four modes using pin multiplexing and two control GPIOS:
- Pass through companion PHY for the SoC USB PHY
- ULPI PHY for the SoC
- Pass through USB for the modem
- UART debug console for the SoC
Quoted 8 lines
This patch adds support for droid 4 USB PHY and debug UART modes, support for other modes can be added later on as needed.
Both peripheral and host mode are working for the USB. The host mode depends on the cpcap-charger driver for VBUS.
VBUS and ID pin detection are done using cpcap-adc IIO ADC driver.
I tested UART, USB slave (cdc-ether) & USB host (keyboard & touchpad from Atrix lapdock) mode with Droid 4:
-- Sebastian
Quoted 20 lines · Sebastian Reichel
Hi,
Quoted 17 lines · Tony Lindgren
Some Motorola phones like droid 4 use a custom CPCAP PMIC that has a multiplexing USB PHY.
This USB PHY can operate at least in four modes using pin multiplexing and two control GPIOS:
- Pass through companion PHY for the SoC USB PHY
- ULPI PHY for the SoC
- Pass through USB for the modem
- UART debug console for the SoCThis patch adds support for droid 4 USB PHY and debug UART modes, support for other modes can be added later on as needed.
Both peripheral and host mode are working for the USB. The host mode depends on the cpcap-charger driver for VBUS.
Quoted 7 lines
Quoted 2 lines
VBUS and ID pin detection are done using cpcap-adc IIO ADC driver.
I tested UART, USB slave (cdc-ether) & USB host (keyboard & touchpad from Atrix lapdock) mode with Droid 4:
Tested-by Sebastian Reichel <[email protected]>
Thanks for testing. I'll repost v2 shortly with a minor change to use iio_read_channel_processed() instead of iio_read_channel_scale() as the ADC values are processed in the driver and not scaled by the IIO framework.
Regards,
Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html