Skip to content

Commit

Permalink
ARM: dts: stm32: add STUSB1600 Type-C using I2C4 on stm32mp15xx-dkx
Browse files Browse the repository at this point in the history
This patch adds support for STUSB1600 USB Type-C port controller, used on
I2C4 on stm32mp15xx-dkx.
The default configuration on this board, on Type-C connector, is:
- Dual Power Role (DRP), so set power-role to "dual";
- Vbus limited to 500mA, so set typec-power-opmode to "default" (it means
  500mA in USB 2.0).
typec-power-opmode is used to reconfigure the STUSB1600 advertising of
current capability when its NVM is not in line with the board layout.
On stm32mp15xx-dkx, Vbus power source of STUSB1600 is 5V_VIN. So power
operation mode depends on the power supply used. To avoid any power
issues, it is better to limit Vbus to 500mA on this board.
ALERT# is the interrupt pin of STUSB1600. It needs an external pull-up, and
signal is active low.

USB OTG controller ID and Vbus signals are not connected on stm32mp15xx-dkx
boards, so disconnection are not detected.
Without DWC2 usb-role-switch:
- if you unplug the USB cable from the Type-C port, you have to manually
disconnect the USB gadget:
echo disconnect > /sys/devices/platform/soc/49000000.usb-otg/udc/49000000.usb-otg/soft_connect
- Then you can plug the USB cable again in the Type-C port, and manually
reconnect the USB gadget:
echo connect > /sys/devices/platform/soc/49000000.usb-otg/udc/49000000.usb-otg/soft_connect
With DWC2 usb-role-switch, USB gadget is dynamically disconnected or connected.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
  • Loading branch information
Amelie Delaunay authored and Alexandre Torgue committed Nov 26, 2020
1 parent 7096672 commit 8368616
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/arm/boot/dts/stm32mp15-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,13 @@
};
};

stusb1600_pins_a: stusb1600-0 {
pins {
pinmux = <STM32_PINMUX('I', 11, ANALOG)>;
bias-pull-up;
};
};

uart4_pins_a: uart4-0 {
pins1 {
pinmux = <STM32_PINMUX('G', 11, AF6)>; /* UART4_TX */
Expand Down
30 changes: 30 additions & 0 deletions arch/arm/boot/dts/stm32mp15xx-dkx.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,30 @@
/delete-property/dmas;
/delete-property/dma-names;

stusb1600@28 {
compatible = "st,stusb1600";
reg = <0x28>;
interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
interrupt-parent = <&gpioi>;
pinctrl-names = "default";
pinctrl-0 = <&stusb1600_pins_a>;
status = "okay";
vdd-supply = <&vin>;

connector {
compatible = "usb-c-connector";
label = "USB-C";
power-role = "dual";
typec-power-opmode = "default";

port {
con_usbotg_hs_ep: endpoint {
remote-endpoint = <&usbotg_hs_ep>;
};
};
};
};

pmic: stpmic@33 {
compatible = "st,stpmic1";
reg = <0x33>;
Expand Down Expand Up @@ -656,6 +680,12 @@
phy-names = "usb2-phy";
usb-role-switch;
status = "okay";

port {
usbotg_hs_ep: endpoint {
remote-endpoint = <&con_usbotg_hs_ep>;
};
};
};

&usbphyc {
Expand Down

0 comments on commit 8368616

Please sign in to comment.