From fd50c186b02442b59790c1a31fc4f10f542e22d6 Mon Sep 17 00:00:00 2001 From: Paolo Sabatino Date: Sun, 9 Feb 2025 21:48:44 +0100 Subject: [PATCH] Added Linux device tree for Rock S0 * original author Brent Roman , reworked for kernel 6.12.13 by Paolo Sabatino --- .../boot/dts/rockchip/rk3308-rock-s0.dts | 338 +++++++++++------- 1 file changed, 199 insertions(+), 139 deletions(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3308-rock-s0.dts b/arch/arm64/boot/dts/rockchip/rk3308-rock-s0.dts index 8311af4c8689..58eacc68fc61 100644 --- a/arch/arm64/boot/dts/rockchip/rk3308-rock-s0.dts +++ b/arch/arm64/boot/dts/rockchip/rk3308-rock-s0.dts @@ -1,21 +1,17 @@ // SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Akash Gajjar + * Copyright (c) 2019 Jagan Teki + * Revised: 2024 Brent Roman + */ /dts-v1/; - -#include #include "rk3308.dtsi" / { model = "Radxa ROCK S0"; compatible = "radxa,rock-s0", "rockchip,rk3308"; - aliases { - ethernet0 = &gmac; - mmc0 = &emmc; - mmc1 = &sdmmc; - mmc2 = &sdio; - }; - chosen { stdout-path = "serial0:1500000n8"; }; @@ -23,38 +19,70 @@ chosen { leds { compatible = "gpio-leds"; pinctrl-names = "default"; - pinctrl-0 = <&pwr_led>; + pinctrl-0 = <&green_led_gio>; - led-green { - color = ; - default-state = "on"; - function = LED_FUNCTION_HEARTBEAT; + green-led { + label = "rock-s0:green:power"; gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>; linux,default-trigger = "heartbeat"; + default-state = "on"; }; }; - vdd_log: regulator-1v04-vdd-log { - compatible = "regulator-fixed"; - regulator-name = "vdd_log"; - regulator-always-on; - regulator-boot-on; - regulator-min-microvolt = <1040000>; - regulator-max-microvolt = <1040000>; - vin-supply = <&vcc5v0_sys>; + acodec-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "rockchip,rk3308-acodec"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,codec-hp-det; + simple-audio-card,widgets = + "Headphone", "Headphones"; + simple-audio-card,cpu { + sound-dai = <&i2s_8ch_2>; + }; + simple-audio-card,codec { + sound-dai = <&codec>; + }; }; - vcc_ddr: regulator-1v5-vcc-ddr { - compatible = "regulator-fixed"; - regulator-name = "vcc_ddr"; - regulator-always-on; - regulator-boot-on; - regulator-min-microvolt = <1500000>; - regulator-max-microvolt = <1500000>; - vin-supply = <&vcc5v0_sys>; + sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,name = "i2s_8ch_0"; + + simple-audio-card,dai-link@1 { + format = "i2s"; + cpu { + sound-dai = <&i2s_8ch_0>; + }; + + codec { + sound-dai = <&pcm5102a>; + }; + }; }; - vcc_1v8: regulator-1v8-vcc { + pcm5102a: pcm5102a { + #sound-dai-cells = <0>; + compatible = "ti,pcm5102a"; + pcm510x,format = "i2s"; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-0 = <&wifi_enable_h>; + pinctrl-names = "default"; + /* + * On the module itself this is one of these (depending + * on the actual card populated): + * - SDIO_RESET_L_WL_REG_ON + * - PDN (power down when low) + */ + reset-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>; + }; + + vcc_1v8: vcc-1v8 { compatible = "regulator-fixed"; regulator-name = "vcc_1v8"; regulator-always-on; @@ -64,7 +92,7 @@ vcc_1v8: regulator-1v8-vcc { vin-supply = <&vcc_io>; }; - vcc_io: regulator-3v3-vcc-io { + vcc_io: vcc-io { compatible = "regulator-fixed"; regulator-name = "vcc_io"; regulator-always-on; @@ -91,7 +119,28 @@ vcc_sd: regulator-3v3-vcc-sd { vin-supply = <&vcc_io>; }; - vcc5v0_sys: regulator-5v0-vcc-sys { + vcc_ddr: vcc-ddr { + compatible = "regulator-fixed"; + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_otg: vcc5v0-otg { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&otg_vbus_drv>; + regulator-name = "vcc5v0_otg"; + regulator-always-on; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_sys: vcc5v0-sys { compatible = "regulator-fixed"; regulator-name = "vcc5v0_sys"; regulator-always-on; @@ -100,24 +149,46 @@ vcc5v0_sys: regulator-5v0-vcc-sys { regulator-max-microvolt = <5000000>; }; - vdd_core: regulator-vdd-core { + vdd_core: vdd-core { compatible = "pwm-regulator"; pwms = <&pwm0 0 5000 1>; pwm-supply = <&vcc5v0_sys>; regulator-name = "vdd_core"; regulator-always-on; regulator-boot-on; + regulator-init-microvolt = <1015000>; regulator-min-microvolt = <827000>; regulator-max-microvolt = <1340000>; regulator-settling-time-up-us = <250>; }; - sdio_pwrseq: sdio-pwrseq { - compatible = "mmc-pwrseq-simple"; + vdd_log: vdd-log { + compatible = "regulator-fixed"; + regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1050000>; + regulator-max-microvolt = <1050000>; + vin-supply = <&vcc5v0_sys>; + }; + + board_antenna: board-antenna { + status = "okay"; + compatible = "regulator-fixed"; + enable-active-low; + gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; + regulator-always-on; + regulator-boot-on; + pinctrl-0 = <&ant_1>; pinctrl-names = "default"; - pinctrl-0 = <&wifi_reg_on>; - reset-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>; + regulator-name = "board_antenna"; }; + +}; + +&codec { + status = "okay"; + #sound-dai-cells = <0>; }; &cpu0 { @@ -126,75 +197,84 @@ &cpu0 { &emmc { cap-mmc-highspeed; - no-sd; - no-sdio; non-removable; - pinctrl-names = "default"; - pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_pwren>; - vmmc-supply = <&vcc_io>; + mmc-hs200-1_8v; + vmmc-supply = <&vcc_io>; //was vin-supply + status = "okay"; +}; + +&sdmmc { + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + card-detect-delay = <800>; status = "okay"; }; +&sdio { + #address-cells = <1>; + #size-cells = <0>; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + no-mmc; + status = "okay"; + + AP6212: wifi@1 { + compatible = "brcm,bcm4329-fmac"; + reg = <1>; + interrupt-parent = <&gpio0>; + interrupts = ; + interrupt-names = "host-wake"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake>; + }; +}; + &gmac { clock_in_out = "output"; - phy-handle = <&rtl8201f>; phy-supply = <&vcc_io>; + assigned-clocks = <&cru SCLK_MAC>; + assigned-clock-parents = <&cru SCLK_MAC_SRC>; + snps,reset-gpio = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 50000 50000>; status = "okay"; +}; - mdio { - compatible = "snps,dwmac-mdio"; - #address-cells = <1>; - #size-cells = <0>; - - rtl8201f: ethernet-phy@1 { - compatible = "ethernet-phy-ieee802.3-c22"; - reg = <1>; - pinctrl-names = "default"; - pinctrl-0 = <&mac_rst>; - reset-assert-us = <20000>; - reset-deassert-us = <50000>; - reset-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; - }; - }; +&i2s_8ch_0 { + assigned-clocks = <&cru SCLK_I2S0_8CH_RX>; + assigned-clock-parents = <&cru SCLK_I2S0_8CH_TX_MUX>; + rockchip,clk-trcm = <1>; + #sound-dai-cells = <0>; }; -&io_domains { - vccio0-supply = <&vcc_io>; - vccio1-supply = <&vcc_io>; - vccio2-supply = <&vcc_io>; - vccio3-supply = <&vcc_io>; - vccio4-supply = <&vcc_1v8>; - vccio5-supply = <&vcc_io>; +&i2s_8ch_2 { status = "okay"; + #sound-dai-cells = <0>; }; &pinctrl { pinctrl-names = "default"; pinctrl-0 = <&rtc_32k>; - bluetooth { - bt_reg_on: bt-reg-on { - rockchip,pins = <4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; - }; - - bt_wake_host: bt-wake-host { - rockchip,pins = <4 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>; - }; - - host_wake_bt: host-wake-bt { - rockchip,pins = <4 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; + leds { + green_led_gio: green-led-gpio { + rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>; }; }; - gmac { - mac_rst: mac-rst { - rockchip,pins = <0 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; + usb { + otg_vbus_drv: otg-vbus-drv { + rockchip,pins = <0 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; }; }; - leds { - pwr_led: pwr-led { - rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>; + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; }; }; @@ -205,14 +285,21 @@ sdmmc_2030: sdmmc-2030 { }; wifi { - wifi_reg_on: wifi-reg-on { - rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + wifi_host_wake: wifi-host-wake { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_down>; }; wifi_wake_host: wifi-wake-host { rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_down>; }; }; + + antenna { + ant_1: ant-1 { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + }; &pwm0 { @@ -226,88 +313,61 @@ &saradc { status = "okay"; }; -&sdio { - #address-cells = <1>; - #size-cells = <0>; - cap-sd-highspeed; - cap-sdio-irq; - keep-power-in-suspend; - max-frequency = <50000000>; - mmc-pwrseq = <&sdio_pwrseq>; - no-mmc; - no-sd; - non-removable; - vmmc-supply = <&vcc_io>; - vqmmc-supply = <&vcc_1v8>; +&tsadc { + rockchip,hw-tshut-mode = <0>; /* 0:CRU */ + rockchip,hw-tshut-polarity = <1>; /* 1:HIGH */ status = "okay"; - - brcmf: wifi@1 { - compatible = "brcm,bcm43430a1-fmac", "brcm,bcm4329-fmac"; - reg = <1>; - interrupt-parent = <&gpio0>; - interrupts = ; - interrupt-names = "host-wake"; - pinctrl-names = "default"; - pinctrl-0 = <&wifi_wake_host>; - }; }; -&sdmmc { - cap-mmc-highspeed; - cap-sd-highspeed; - disable-wp; - vmmc-supply = <&vcc_sd>; +&i2c1 { status = "okay"; }; -&u2phy { - status = "okay"; +&spi2 { +// status = "okay"; //conflicts with UART2 + max-freq = <10000000>; }; -&u2phy_host { +&uart0 { status = "okay"; }; -&u2phy_otg { +&uart2 { status = "okay"; }; -&uart0 { - pinctrl-names = "default"; - pinctrl-0 = <&uart0_xfer>; +&uart4 { status = "okay"; + + bluetooth { + compatible = "realtek,rtl8723bs-bt"; + device-wake-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>; + host-wake-gpios = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; + }; }; -&uart4 { - uart-has-rtscts; +&u2phy { status = "okay"; - bluetooth { - compatible = "brcm,bcm43430a1-bt"; - clocks = <&cru SCLK_RTC32K>; - clock-names = "lpo"; - interrupt-parent = <&gpio4>; - interrupts = ; - interrupt-names = "host-wakeup"; - device-wakeup-gpios = <&gpio4 RK_PB2 GPIO_ACTIVE_HIGH>; - shutdown-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>; - pinctrl-names = "default"; - pinctrl-0 = <&bt_reg_on &bt_wake_host &host_wake_bt>; - vbat-supply = <&vcc_io>; - vddio-supply = <&vcc_1v8>; + u2phy_host: host-port { + phy-supply = <&vcc5v0_otg>; + status = "okay"; + }; + + u2phy_otg: otg-port { + status = "okay"; }; }; -&usb_host_ehci { +&usb20_otg { status = "okay"; }; -&usb_host_ohci { +&usb_host_ehci { status = "okay"; }; -&usb20_otg { - dr_mode = "peripheral"; +&usb_host_ohci{ status = "okay"; }; -- 2.43.0