Files
kernel-agent/patches/board/coolpi-genbook/0005-arm64-dts-rockchip-rk3588-coolpi-cm5-genbook-add-USB.patch
T
claude-noether 1d805ef70d fleet/ampere: extend baseline with lid+USB-C PD+speaker (all 6 patches verified)
After verifying the minimal v7.0-rc3+pwm15+pwm-fan+RK806 baseline boots
with display on ampere, extended via bisect-by-addition to include 3
more from linux-rk3588-marfrit's pre-cherry-pick set:

  0004 enable speaker output      (genbook dts + cm5 dtsi)
  0005 USB-C PD charging          (genbook dts: FUSB302, vcc5v0_otg)
  0006 lid switch + USB3 lane mux (genbook dts: gpio-keys SW_LID, usbdp_phy1)

ampere-minimal-devices branch on git.reauktion.de/marfrit/linux-rk3588-marfrit
@ 7c241f2e2835 = the verified-working state with all 6 patches.

Display continues to work — confirms regression source is in one of
the 12 remaining linux-rk3588-marfrit commits (Shawn Lin pcie3 phy
series, Cristian Ciocaltea clk/dts/dw-dp, Sebastian Reichel hdmirx,
Pedro Alves btrtl, plus the WIP suspend/resume patch 0010).

Generated-by: Claude Opus 4.7 <claude@reauktion.de>
2026-05-16 06:02:28 +00:00

237 lines
6.6 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
From 3e42ab69173dc33ffc07307a5ae2f83153d6894d Mon Sep 17 00:00:00 2001
From: Markus Fritsche <mfritsche@localhost>
Date: Tue, 24 Mar 2026 00:00:00 +0000
Subject: [PATCH 5/6] arm64: dts: rockchip: rk3588-coolpi-cm5-genbook: add
USB-C PD charging
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The GenBook carrier board exposes a USB Type-C port driven by the
RK3588 USB3OTG0 controller (usb_host0_xhci / usbdp_phy0 combo). The
port uses a Fairchild FUSB302 (I²C address 0x22, bus i2c4) for USB
Power Delivery negotiation. Hardware signals:
GPIO0_PD5 FUSB302 interrupt (active-low, shared with CC logic)
GPIO0_PA0 VBUS switch enable (active-high)
Without these changes the kernel registers usb_host0_xhci in
peripheral-only, high-speed mode, which prevents PD negotiation and
leaves the port unable to charge the battery.
Changes:
* Add #include <dt-bindings/usb/pd.h> for PDO_FIXED macros.
* Add vcc5v0_otg regulator: GPIO0_PA0 active-high switch that gates
VBUS; used as vbus-supply for the FUSB302 and connected via the new
typec5v_pwren pinctrl entry. The previously defined but unreferenced
usb_otg_pwren entry (same pin, wrong pull direction) is removed.
* Add usbc0 (FUSB302) node inside &i2c4:
- compatible "fcs,fusb302", reg 0x22
- interrupt GPIO0_PD5 (IRQ_TYPE_LEVEL_LOW), pinctrl usbc0_int
- usb-c-connector child with:
data-role / power-role "dual", try-power-role "sink"
pd-revision 2.0 Ver 1.2 (maximum supported by FUSB302)
sink-pdos: 5 V/3 A, 9 V/3 A, 12 V/3 A, 15 V/3 A
source-pdos: 5 V/3 A
DisplayPort alt-mode (SVID 0xff01) declared for orientation
switching; three connector ports linking HS (→ usb_host0_xhci),
SS (→ usbdp_phy0) and SBU (→ usbdp_phy0) endpoints.
* Expand &usbdp_phy0 to add mode-switch and orientation-switch
capabilities; register endpoint@0 (SS, linked to usbc0_ss) and
endpoint@1 (SBU, linked to usbc0_sbu).
* Replace the &usb_host0_xhci override:
- remove dr_mode "peripheral" and maximum-speed "high-speed"
(the base DTSI already sets dr_mode "otg")
- add usb-role-switch and the port endpoint linked to usbc0_hs
This allows the TCPM stack to switch the controller between host
and device role as the PD contract dictates.
* Add pinctrl group usb-typec with:
- usbc0_int: GPIO0_PD5 pull-up (FUSB302 /INT)
- typec5v_pwren: GPIO0_PA0 pull-down (VBUS switch, default off)
DAPM / power flow:
USB-C charger → FUSB302 CC negotiation → TCPM requests VBUS →
vcc5v0_otg regulator enables GPIO0_PA0 → VBUS present on port →
DWC3 OTG detects VBUS, enters device/host mode per PD data-role.
Generated-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Markus Fritsche <mfritsche@localhost>
---
.../rockchip/rk3588-coolpi-cm5-genbook.dts | 112 +++++++++++++++++-
1 file changed, 106 insertions(+), 6 deletions(-)
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-coolpi-cm5-genbook.dts b/arch/arm64/boot/dts/rockchip/rk3588-coolpi-cm5-genbook.dts
index 070f5dde715c..7c577a603cb5 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-coolpi-cm5-genbook.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3588-coolpi-cm5-genbook.dts
@@ -8,6 +8,7 @@
#include <dt-bindings/leds/common.h>
#include <dt-bindings/soc/rockchip,vop2.h>
+#include <dt-bindings/usb/pd.h>
#include "rk3588-coolpi-cm5.dtsi"
/ {
@@ -153,6 +154,18 @@ vcc5v0_usb_host0: vcc5v0_usb30_host: regulator-vcc5v0-usb-host {
pinctrl-0 = <&usb_host_pwren>;
vin-supply = <&vcc5v0_usb>;
};
+
+ vcc5v0_otg: regulator-vcc5v0-otg {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc5v0_otg";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ enable-active-high;
+ gpio = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&typec5v_pwren>;
+ vin-supply = <&vcc5v0_sys>;
+ };
};
&edp1 {
@@ -239,6 +252,65 @@ cw2015@62 {
monitored-battery = <&battery>;
power-supplies = <&charger>;
};
+
+ usbc0: usb-typec@22 {
+ compatible = "fcs,fusb302";
+ reg = <0x22>;
+ interrupt-parent = <&gpio0>;
+ interrupts = <RK_PD5 IRQ_TYPE_LEVEL_LOW>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&usbc0_int>;
+ vbus-supply = <&vcc5v0_otg>;
+
+ usb_con: connector {
+ compatible = "usb-c-connector";
+ label = "USB-C";
+ data-role = "dual";
+ power-role = "dual";
+ try-power-role = "sink";
+ op-sink-microwatt = <1000000>;
+ /* FUSB302 supports PD Rev 2.0 Ver 1.2 */
+ pd-revision = /bits/ 8 <0x2 0x0 0x1 0x2>;
+ sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>,
+ <PDO_FIXED(9000, 3000, PDO_FIXED_USB_COMM)>,
+ <PDO_FIXED(12000, 3000, PDO_FIXED_USB_COMM)>,
+ <PDO_FIXED(15000, 3000, PDO_FIXED_USB_COMM)>;
+ source-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
+
+ altmodes {
+ displayport {
+ svid = /bits/ 16 <0xff01>;
+ vdo = <0xffffffff>;
+ };
+ };
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ usbc0_hs: endpoint {
+ remote-endpoint = <&usb_host0_xhci_to_usbc0>;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ usbc0_ss: endpoint {
+ remote-endpoint = <&usbdp_phy0_ss>;
+ };
+ };
+
+ port@2 {
+ reg = <2>;
+ usbc0_sbu: endpoint {
+ remote-endpoint = <&usbdp_phy0_sbu>;
+ };
+ };
+ };
+ };
+ };
};
&i2c5 {
@@ -323,15 +395,21 @@ usb_pwren: usb-pwren {
rockchip,pins = <1 RK_PD5 RK_FUNC_GPIO &pcfg_pull_up>;
};
- usb_otg_pwren: usb-otg-pwren {
- rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
- };
-
usb_host_pwren: usb-host-pwren {
rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
+ usb-typec {
+ usbc0_int: usbc0-int {
+ rockchip,pins = <0 RK_PD5 RK_FUNC_GPIO &pcfg_pull_up>;
+ };
+
+ typec5v_pwren: typec5v-pwren {
+ rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_down>;
+ };
+ };
+
wifi {
bt_pwron: bt-pwron {
rockchip,pins = <3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;
@@ -387,7 +465,24 @@ &u2phy0_otg {
};
&usbdp_phy0 {
+ mode-switch;
+ orientation-switch;
status = "okay";
+
+ port {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ usbdp_phy0_ss: endpoint@0 {
+ reg = <0>;
+ remote-endpoint = <&usbc0_ss>;
+ };
+
+ usbdp_phy0_sbu: endpoint@1 {
+ reg = <1>;
+ remote-endpoint = <&usbc0_sbu>;
+ };
+ };
};
&u2phy1 {
@@ -431,9 +526,14 @@ &usb_host0_ohci {
/* Type C port */
&usb_host0_xhci {
- dr_mode = "peripheral";
- maximum-speed = "high-speed";
+ usb-role-switch;
status = "okay";
+
+ port {
+ usb_host0_xhci_to_usbc0: endpoint {
+ remote-endpoint = <&usbc0_hs>;
+ };
+ };
};
/* connected to a HUB for camera and BT */
--
2.54.0