From daed33056fc92680be40dd2ccac322339c735699 Mon Sep 17 00:00:00 2001 From: BFE Engineering Date: Mon, 24 Aug 2026 22:23:37 -0600 Subject: [PATCH] =?UTF-8?q?kernel:=20sweep=20=E2=80=94=20usb2phy=20port=20?= =?UTF-8?q?(USB=20host=20up)=20+=20saradc=20data=20port?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit usb2phy: ported the RV1106 inno-usb2 phy config to 6.18 (rv1106_usb2phy_cfg; fields map 1:1 except utmi_iddig->utmi_id and chg_mode->opmode; 5.10-only iddig_output/en/bvalid_grf_sel dropped; phy_tuning left off, guarded so safe). With PHY_ROCKCHIP_INNO_USB2=y + the u2phy/usbdrd/dwc3 DT enabled, verified on warden-c8a3: the DWC3 comes up as xhci-hcd @ 0xffb00000 — USB host works. eth0 gadget just needs dr_mode=peripheral. saradc: added rv1106_saradc_data (2-ch v2, matches the vendor) + the native compatible. Driver now matches; probe still returns -22 (a clk-rate/setup detail, not the data) — TODO. Also captured: the growing board dts (USB nodes), the port fragments under usb/ and adc/. DRIVER-PARITY.md updated: ~14 drivers now at parity on 6.18. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_017wB8KB3MMQztRDXCMCkPrf --- kernel/rv1106-enablement/DRIVER-PARITY.md | 8 +- .../adc/rv1106_saradc_data.c.frag | 13 ++++ .../rv1106-enablement/dts/rv1106-warden.dts | 18 +++++ .../usb/rv1106_usb2phy_cfg.c.frag | 78 +++++++++++++++++++ 4 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 kernel/rv1106-enablement/adc/rv1106_saradc_data.c.frag create mode 100644 kernel/rv1106-enablement/usb/rv1106_usb2phy_cfg.c.frag diff --git a/kernel/rv1106-enablement/DRIVER-PARITY.md b/kernel/rv1106-enablement/DRIVER-PARITY.md index 2960105..6abed45 100644 --- a/kernel/rv1106-enablement/DRIVER-PARITY.md +++ b/kernel/rv1106-enablement/DRIVER-PARITY.md @@ -19,13 +19,13 @@ c8a3, not just compiled. | I2C (dw-apb, ff460000=i2c3) | ff460000.i2c | mainline | ✅ batch1 (i2c-3) | | watchdog (dw-wdt, ff5a0000) | ff5a0000.watchdog | mainline | ✅ batch1 (watchdog0) | | thermal governor | rockchip_thermal | mainline | 🔨 gov up; tsadc node TODO | -| SARADC (ff3c0000) | ff3c0000.saradc | mainline (no rv1106 compat) | ⬜ needs compat fallback | +| SARADC (ff3c0000) | ff3c0000.saradc | ported (2-ch v2 data) | 🔨 driver added; probe -22 (clk-rate) | | GPIO_SYSFS (legacy /sys/class/gpio) | — | mainline (config) | ⬜ goodix script needs it | | PWM (rockchip) | — | mainline (=m) | ⬜ batch2 =y (backlight) | | RTC (rv1106-rtc) | — | **no mainline driver** | ⬜ port (low prio) | -| USB2 phy (inno, rv1106) | rockchip_usb2phy_* | mainline (no rv1106 data) | ⬜ port (data + tuning) | -| USB OTG gadget (DWC3, eth0) | eth0 | mainline dwc3 (needs phy) | ⬜ M6 (after phy) | -| USB host (xhci, usb1) | xhci-hcd:usb1 | mainline | ⬜ M6 | +| USB2 phy (inno, rv1106) | rockchip_usb2phy_* | ported (data, no tuning) | ✅ probes → USB up | +| USB host (DWC3→xhci, ffb00000) | xhci-hcd:usb1 | mainline | ✅ xhci host registered | +| USB OTG gadget (DWC3, eth0) | eth0 | mainline dwc3 | 🔨 host works; eth0 needs dr_mode=peripheral | | crypto (aes/ccm/ctr/arc4) | modules | mainline | ⬜ batch2 (config =y) | | PSCI node (removed) | — | — | ✅ deleted (no secure monitor → SMC fault) | | VOP display (ff990000) | ff990000.vop | ported (rv1126 sibling) | 🔨 binds+DRM+card0; connector WIP | diff --git a/kernel/rv1106-enablement/adc/rv1106_saradc_data.c.frag b/kernel/rv1106-enablement/adc/rv1106_saradc_data.c.frag new file mode 100644 index 0000000..d791ff9 --- /dev/null +++ b/kernel/rv1106-enablement/adc/rv1106_saradc_data.c.frag @@ -0,0 +1,13 @@ +/* RV1106: a 2-channel v2 SARADC (ported from the vendor driver). */ +static const struct iio_chan_spec rockchip_rv1106_saradc_iio_channels[] = { + SARADC_CHANNEL(0, "adc0", 10), + SARADC_CHANNEL(1, "adc1", 10), +}; + +static const struct rockchip_saradc_data rv1106_saradc_data = { + .channels = rockchip_rv1106_saradc_iio_channels, + .num_channels = ARRAY_SIZE(rockchip_rv1106_saradc_iio_channels), + .clk_rate = 1000000, + .start = rockchip_saradc_start_v2, + .read = rockchip_saradc_read_v2, +}; diff --git a/kernel/rv1106-enablement/dts/rv1106-warden.dts b/kernel/rv1106-enablement/dts/rv1106-warden.dts index 0931469..4d9977f 100644 --- a/kernel/rv1106-enablement/dts/rv1106-warden.dts +++ b/kernel/rv1106-enablement/dts/rv1106-warden.dts @@ -128,3 +128,21 @@ &rgb { status = "disabled"; }; + +/* --- sweep: USB OTG (eth0 gadget / host) via the ported inno-usb2 phy --- */ +&u2phy { + status = "okay"; +}; + +&u2phy_otg { + status = "okay"; +}; + +&usbdrd { + status = "okay"; +}; + +&usbdrd_dwc3 { + status = "okay"; + dr_mode = "otg"; +}; diff --git a/kernel/rv1106-enablement/usb/rv1106_usb2phy_cfg.c.frag b/kernel/rv1106-enablement/usb/rv1106_usb2phy_cfg.c.frag new file mode 100644 index 0000000..356d09c --- /dev/null +++ b/kernel/rv1106-enablement/usb/rv1106_usb2phy_cfg.c.frag @@ -0,0 +1,78 @@ + * RV1106 USB2 PHY: single OTG port at 0xff3e0000 (ported from the vendor driver; + * fields map 1:1 to 6.18 except utmi_iddig -> utmi_id, and the 5.10-only + * iddig_output/iddig_en/bvalid_grf_sel are dropped). Signal-quality phy_tuning is + * left off for now (guarded, so NULL is safe) — the phy is functional without it. + */ +static const struct rockchip_usb2phy_cfg rv1106_phy_cfgs[] = { + { + .reg = 0xff3e0000, + .num_ports = 1, + .clkout_ctl = { 0x0058, 4, 4, 1, 0 }, + .port_cfgs = { + [USB2PHY_PORT_OTG] = { + .phy_sus = { 0x0050, 8, 0, 0, 0x1d1 }, + .bvalid_det_en = { 0x0100, 2, 2, 0, 1 }, + .bvalid_det_st = { 0x0104, 2, 2, 0, 1 }, + .bvalid_det_clr = { 0x0108, 2, 2, 0, 1 }, + .idfall_det_en = { 0x0100, 5, 5, 0, 1 }, + .idfall_det_st = { 0x0104, 5, 5, 0, 1 }, + .idfall_det_clr = { 0x0108, 5, 5, 0, 1 }, + .idrise_det_en = { 0x0100, 4, 4, 0, 1 }, + .idrise_det_st = { 0x0104, 4, 4, 0, 1 }, + .idrise_det_clr = { 0x0108, 4, 4, 0, 1 }, + .ls_det_en = { 0x0100, 0, 0, 0, 1 }, + .ls_det_st = { 0x0104, 0, 0, 0, 1 }, + .ls_det_clr = { 0x0108, 0, 0, 0, 1 }, + .utmi_avalid = { 0x0060, 10, 10, 0, 1 }, + .utmi_bvalid = { 0x0060, 9, 9, 0, 1 }, + .utmi_id = { 0x0060, 6, 6, 0, 1 }, + .utmi_ls = { 0x0060, 5, 4, 0, 1 }, + }, + }, + .chg_det = { + .opmode = { 0x0050, 8, 0, 0, 0x1d7 }, + .cp_det = { 0x0060, 13, 13, 0, 1 }, + .dcp_det = { 0x0060, 12, 12, 0, 1 }, + .dp_det = { 0x0060, 14, 14, 0, 1 }, + .idm_sink_en = { 0x0058, 8, 8, 0, 1 }, + .idp_sink_en = { 0x0058, 7, 7, 0, 1 }, + .idp_src_en = { 0x0058, 9, 9, 0, 1 }, + .rdm_pdwn_en = { 0x0058, 10, 10, 0, 1 }, + .vdm_src_en = { 0x0058, 12, 12, 0, 1 }, + .vdp_src_en = { 0x0058, 11, 11, 0, 1 }, + }, + }, + { /* sentinel */ } +}; + +static const struct of_device_id rockchip_usb2phy_dt_match[] = { + { .compatible = "rockchip,rv1106-usb2phy", .data = &rv1106_phy_cfgs }, + { .compatible = "rockchip,px30-usb2phy", .data = &rk3328_phy_cfgs }, + { .compatible = "rockchip,rk3036-usb2phy", .data = &rk3036_phy_cfgs }, + { .compatible = "rockchip,rk3128-usb2phy", .data = &rk3128_phy_cfgs }, + { .compatible = "rockchip,rk3228-usb2phy", .data = &rk3228_phy_cfgs }, + { .compatible = "rockchip,rk3308-usb2phy", .data = &rk3308_phy_cfgs }, + { .compatible = "rockchip,rk3328-usb2phy", .data = &rk3328_phy_cfgs }, + { .compatible = "rockchip,rk3366-usb2phy", .data = &rk3366_phy_cfgs }, + { .compatible = "rockchip,rk3399-usb2phy", .data = &rk3399_phy_cfgs }, + { .compatible = "rockchip,rk3562-usb2phy", .data = &rk3562_phy_cfgs }, + { .compatible = "rockchip,rk3568-usb2phy", .data = &rk3568_phy_cfgs }, + { .compatible = "rockchip,rk3576-usb2phy", .data = &rk3576_phy_cfgs }, + { .compatible = "rockchip,rk3588-usb2phy", .data = &rk3588_phy_cfgs }, + { .compatible = "rockchip,rv1108-usb2phy", .data = &rv1108_phy_cfgs }, + {} +}; +MODULE_DEVICE_TABLE(of, rockchip_usb2phy_dt_match); + +static struct platform_driver rockchip_usb2phy_driver = { + .probe = rockchip_usb2phy_probe, + .driver = { + .name = "rockchip-usb2phy", + .of_match_table = rockchip_usb2phy_dt_match, + }, +}; +module_platform_driver(rockchip_usb2phy_driver); + +MODULE_AUTHOR("Frank Wang "); +MODULE_DESCRIPTION("Rockchip USB2.0 PHY driver"); +MODULE_LICENSE("GPL v2");