Files
kernel-agent/patches/board/coolpi-cm5-genbook/0005-arm64-dts-rockchip-rk3588-coolpi-cm5-genbook-Enable-USB-C-PD-charging-via-FUSB302.patch
T
claude-noether a6549605f0 phase 2 ask #1: bootstrap ampere kernel-agent recipe (CoolPi GenBook RK3588)
Brings the second customized fleet host into kernel-agent's
scope-tagged tree. Sibling PR coming in marfrit-packages with the
arch/linux-ampere-fourier/ PKGBUILD + flat patch + config + extlinux
hook (build-tree-ready form).

Issue #6 ask #1 only — VP9 enablement (ask #2) and AV1 dec integration
(ask #3) are explicitly deferred to a separate session per the user's
direction. The ampere.yaml manifest documents what's excluded and why.

## Patches promoted

Six patches from boltzmann:~/src/misc_patches/genbook/kernel/ get
scope-tagged into kernel-agent's tree:

  soc/rockchip/rk3588/
    0001-...Add-pwm15-pinctrl-entries.patch         (prereq for 0002)
  module/coolpi-cm5/
    0003-...Fix-power-off-by-enabling-RK806-as-system-power-controller.patch
  board/coolpi-cm5-genbook/
    0002-...Add-pwm-fan.patch
    0004-...Enable-speaker-output-via-audio-graph-card.patch
    0005-...Enable-USB-C-PD-charging-via-FUSB302.patch
    0008-...Add-lid-switch-and-USB3-PHY-lane-config.patch

Each new scope dir gets a README.md documenting what it carries and
why the scope-level granularity makes sense (pwm15 is SoC-wide,
RK806 power-off is SoM-level not board-level, the rest are
board-specific GenBook quirks).

Note on uncommitted-modifications flag in issue body: patches 0001-0004
have working-tree-only changes in misc_patches that fix malformed
'From: PATCH 000X/000Y' headers (placeholder text instead of an
RFC-2822 author identity). The working-tree versions with proper
'From: Markus Fritsche <mfritsche@localhost>' headers are what we ship
here — the unfixed-on-disk variants would fail patch -i header parsing
on stricter implementations and are user-side cleanup that hasn't been
committed back to misc_patches yet. Markus can commit the cleanup
to that personal repo separately; this PR's ingestion does not depend
on it.

Patches 0006 (HAVE_GCC_PLUGINS Kconfig), 0009 (Bluetooth btrtl),
0010 (multi-driver suspend/wakeup) from the misc_patches series are
intentionally NOT promoted here — they need different scope tags
(arch/arm64/, driver/bluetooth/, soc/rockchip/rk3588/ + driver/ split)
and will follow when their respective campaigns demand them. The
ampere.yaml manifest documents the explicit-defer for each.

## fleet/ampere.yaml manifest

Same shape as fleet/fresnel.yaml. Baseline pinned at marfrit/linux-rockchip
branch linux-rk3588-marfrit @ f8f3ad934433 (the working tree on
boltzmann; 18 commits ahead of v7.0-rc3, current 2026-05-15 tip).
Six scope-tagged patch includes per the apply-order in the package
(pwm15 pinctrl must precede the pwm-fan node consumer).

## ampere-specific bootloader path

Documented in manifest. ampere boots from /boot/firmware/ (vfat
partition on mmcblk0p1), not /boot/ (root partition) like fresnel.
The marfrit-packages PKGBUILD's extlinux-add hook needs to write to
/boot/firmware/extlinux/extlinux.conf, not /boot/extlinux/.

## ampere as 2nd aarch64 build host

Per the README update in PR #7, ampere is now a secondary aarch64
build host. The manifest's build_host: section pins ampere as
self-hosting primary for its own kernel, with boltzmann as secondary
and fermi as fallback. This is the first manifest that has its own
host listed as the primary build target — not ideologically pretty,
but pragmatic: native arch, same uarch, full RAM, no cross-compile
step, no need to wake another host.
2026-05-15 16:03:00 +00:00

227 lines
6.1 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: Markus Fritsche <mfritsche@localhost>
Date: Tue, 24 Mar 2026 00:00:00 +0000
Subject: [PATCH] arm64: dts: rockchip: rk3588-coolpi-cm5-genbook: add USB-C PD charging
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>
---
1 file changed, 106 insertions(+), 6 deletions(-)
--- 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 @@
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 @@
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 @@
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 @@
};
&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 @@
/* 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 */