David Bauer | dcde9f6 | 2021-01-07 00:06:11 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: (GPL-2.0+ OR MIT) |
| 2 | /* |
| 3 | * Copyright (c) 2020 David Bauer <mail@david-bauer.net> |
| 4 | */ |
| 5 | |
| 6 | /dts-v1/; |
| 7 | |
| 8 | #include <dt-bindings/input/input.h> |
| 9 | #include <dt-bindings/gpio/gpio.h> |
| 10 | #include "rk3328.dtsi" |
| 11 | |
| 12 | / { |
| 13 | model = "FriendlyElec NanoPi R2S"; |
| 14 | compatible = "friendlyarm,nanopi-r2s", "rockchip,rk3328"; |
| 15 | |
Peter Robinson | 7715db3 | 2021-07-22 16:20:43 +0100 | [diff] [blame] | 16 | aliases { |
Jonas Karlman | b74552c | 2024-02-17 00:22:37 +0000 | [diff] [blame] | 17 | ethernet0 = &gmac2io; |
Peter Robinson | 7715db3 | 2021-07-22 16:20:43 +0100 | [diff] [blame] | 18 | ethernet1 = &rtl8153; |
| 19 | mmc0 = &sdmmc; |
| 20 | }; |
| 21 | |
David Bauer | dcde9f6 | 2021-01-07 00:06:11 +0100 | [diff] [blame] | 22 | chosen { |
| 23 | stdout-path = "serial2:1500000n8"; |
| 24 | }; |
| 25 | |
| 26 | gmac_clk: gmac-clock { |
| 27 | compatible = "fixed-clock"; |
| 28 | clock-frequency = <125000000>; |
| 29 | clock-output-names = "gmac_clkin"; |
| 30 | #clock-cells = <0>; |
| 31 | }; |
| 32 | |
| 33 | keys { |
| 34 | compatible = "gpio-keys"; |
| 35 | pinctrl-0 = <&reset_button_pin>; |
| 36 | pinctrl-names = "default"; |
| 37 | |
Jonas Karlman | b74552c | 2024-02-17 00:22:37 +0000 | [diff] [blame] | 38 | key-reset { |
David Bauer | dcde9f6 | 2021-01-07 00:06:11 +0100 | [diff] [blame] | 39 | label = "reset"; |
| 40 | gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>; |
| 41 | linux,code = <KEY_RESTART>; |
| 42 | debounce-interval = <50>; |
| 43 | }; |
| 44 | }; |
| 45 | |
| 46 | leds { |
| 47 | compatible = "gpio-leds"; |
| 48 | pinctrl-0 = <&lan_led_pin>, <&sys_led_pin>, <&wan_led_pin>; |
| 49 | pinctrl-names = "default"; |
| 50 | |
| 51 | lan_led: led-0 { |
| 52 | gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; |
| 53 | label = "nanopi-r2s:green:lan"; |
| 54 | }; |
| 55 | |
| 56 | sys_led: led-1 { |
| 57 | gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; |
| 58 | label = "nanopi-r2s:red:sys"; |
Peter Robinson | 7715db3 | 2021-07-22 16:20:43 +0100 | [diff] [blame] | 59 | default-state = "on"; |
David Bauer | dcde9f6 | 2021-01-07 00:06:11 +0100 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | wan_led: led-2 { |
| 63 | gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_HIGH>; |
| 64 | label = "nanopi-r2s:green:wan"; |
| 65 | }; |
| 66 | }; |
| 67 | |
| 68 | vcc_io_sdio: sdmmcio-regulator { |
| 69 | compatible = "regulator-gpio"; |
| 70 | enable-active-high; |
| 71 | gpios = <&gpio1 RK_PD4 GPIO_ACTIVE_HIGH>; |
| 72 | pinctrl-0 = <&sdio_vcc_pin>; |
| 73 | pinctrl-names = "default"; |
| 74 | regulator-name = "vcc_io_sdio"; |
| 75 | regulator-always-on; |
| 76 | regulator-min-microvolt = <1800000>; |
| 77 | regulator-max-microvolt = <3300000>; |
| 78 | regulator-settling-time-us = <5000>; |
| 79 | regulator-type = "voltage"; |
| 80 | startup-delay-us = <2000>; |
Peter Robinson | 7715db3 | 2021-07-22 16:20:43 +0100 | [diff] [blame] | 81 | states = <1800000 0x1>, |
| 82 | <3300000 0x0>; |
David Bauer | dcde9f6 | 2021-01-07 00:06:11 +0100 | [diff] [blame] | 83 | vin-supply = <&vcc_io_33>; |
| 84 | }; |
| 85 | |
| 86 | vcc_sd: sdmmc-regulator { |
| 87 | compatible = "regulator-fixed"; |
| 88 | gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; |
Peter Robinson | 7715db3 | 2021-07-22 16:20:43 +0100 | [diff] [blame] | 89 | pinctrl-0 = <&sdmmc0m1_pin>; |
David Bauer | dcde9f6 | 2021-01-07 00:06:11 +0100 | [diff] [blame] | 90 | pinctrl-names = "default"; |
| 91 | regulator-name = "vcc_sd"; |
| 92 | regulator-boot-on; |
| 93 | regulator-min-microvolt = <3300000>; |
| 94 | regulator-max-microvolt = <3300000>; |
| 95 | vin-supply = <&vcc_io_33>; |
| 96 | }; |
| 97 | |
| 98 | vdd_5v: vdd-5v { |
| 99 | compatible = "regulator-fixed"; |
| 100 | regulator-name = "vdd_5v"; |
| 101 | regulator-always-on; |
| 102 | regulator-boot-on; |
| 103 | regulator-min-microvolt = <5000000>; |
| 104 | regulator-max-microvolt = <5000000>; |
| 105 | }; |
Peter Robinson | 7715db3 | 2021-07-22 16:20:43 +0100 | [diff] [blame] | 106 | |
| 107 | vdd_5v_lan: vdd-5v-lan { |
| 108 | compatible = "regulator-fixed"; |
| 109 | enable-active-high; |
| 110 | gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>; |
| 111 | pinctrl-0 = <&lan_vdd_pin>; |
| 112 | pinctrl-names = "default"; |
| 113 | regulator-name = "vdd_5v_lan"; |
| 114 | regulator-always-on; |
| 115 | regulator-boot-on; |
| 116 | vin-supply = <&vdd_5v>; |
| 117 | }; |
David Bauer | dcde9f6 | 2021-01-07 00:06:11 +0100 | [diff] [blame] | 118 | }; |
| 119 | |
| 120 | &cpu0 { |
| 121 | cpu-supply = <&vdd_arm>; |
| 122 | }; |
| 123 | |
| 124 | &cpu1 { |
| 125 | cpu-supply = <&vdd_arm>; |
| 126 | }; |
| 127 | |
| 128 | &cpu2 { |
| 129 | cpu-supply = <&vdd_arm>; |
| 130 | }; |
| 131 | |
| 132 | &cpu3 { |
| 133 | cpu-supply = <&vdd_arm>; |
| 134 | }; |
| 135 | |
Peter Robinson | 7715db3 | 2021-07-22 16:20:43 +0100 | [diff] [blame] | 136 | &display_subsystem { |
| 137 | status = "disabled"; |
| 138 | }; |
| 139 | |
David Bauer | dcde9f6 | 2021-01-07 00:06:11 +0100 | [diff] [blame] | 140 | &gmac2io { |
| 141 | assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; |
| 142 | assigned-clock-parents = <&gmac_clk>, <&gmac_clk>; |
| 143 | clock_in_out = "input"; |
| 144 | phy-handle = <&rtl8211e>; |
| 145 | phy-mode = "rgmii"; |
| 146 | phy-supply = <&vcc_io_33>; |
| 147 | pinctrl-0 = <&rgmiim1_pins>; |
| 148 | pinctrl-names = "default"; |
| 149 | rx_delay = <0x18>; |
| 150 | snps,aal; |
| 151 | tx_delay = <0x24>; |
| 152 | status = "okay"; |
| 153 | |
| 154 | mdio { |
| 155 | compatible = "snps,dwmac-mdio"; |
| 156 | #address-cells = <1>; |
| 157 | #size-cells = <0>; |
| 158 | |
| 159 | rtl8211e: ethernet-phy@1 { |
David Bauer | dcde9f6 | 2021-01-07 00:06:11 +0100 | [diff] [blame] | 160 | reg = <1>; |
| 161 | pinctrl-0 = <ð_phy_reset_pin>; |
| 162 | pinctrl-names = "default"; |
| 163 | reset-assert-us = <10000>; |
| 164 | reset-deassert-us = <50000>; |
| 165 | reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; |
| 166 | }; |
| 167 | }; |
| 168 | }; |
| 169 | |
| 170 | &i2c1 { |
| 171 | status = "okay"; |
| 172 | |
| 173 | rk805: pmic@18 { |
| 174 | compatible = "rockchip,rk805"; |
| 175 | reg = <0x18>; |
| 176 | interrupt-parent = <&gpio1>; |
| 177 | interrupts = <24 IRQ_TYPE_LEVEL_LOW>; |
| 178 | #clock-cells = <1>; |
| 179 | clock-output-names = "xin32k", "rk805-clkout2"; |
| 180 | gpio-controller; |
| 181 | #gpio-cells = <2>; |
| 182 | pinctrl-0 = <&pmic_int_l>; |
| 183 | pinctrl-names = "default"; |
| 184 | rockchip,system-power-controller; |
| 185 | wakeup-source; |
| 186 | |
| 187 | vcc1-supply = <&vdd_5v>; |
| 188 | vcc2-supply = <&vdd_5v>; |
| 189 | vcc3-supply = <&vdd_5v>; |
| 190 | vcc4-supply = <&vdd_5v>; |
| 191 | vcc5-supply = <&vcc_io_33>; |
| 192 | vcc6-supply = <&vdd_5v>; |
| 193 | |
| 194 | regulators { |
| 195 | vdd_log: DCDC_REG1 { |
| 196 | regulator-name = "vdd_log"; |
| 197 | regulator-always-on; |
| 198 | regulator-boot-on; |
| 199 | regulator-min-microvolt = <712500>; |
| 200 | regulator-max-microvolt = <1450000>; |
| 201 | regulator-ramp-delay = <12500>; |
| 202 | |
| 203 | regulator-state-mem { |
| 204 | regulator-on-in-suspend; |
| 205 | regulator-suspend-microvolt = <1000000>; |
| 206 | }; |
| 207 | }; |
| 208 | |
| 209 | vdd_arm: DCDC_REG2 { |
| 210 | regulator-name = "vdd_arm"; |
| 211 | regulator-always-on; |
| 212 | regulator-boot-on; |
| 213 | regulator-min-microvolt = <712500>; |
| 214 | regulator-max-microvolt = <1450000>; |
| 215 | regulator-ramp-delay = <12500>; |
| 216 | |
| 217 | regulator-state-mem { |
| 218 | regulator-on-in-suspend; |
| 219 | regulator-suspend-microvolt = <950000>; |
| 220 | }; |
| 221 | }; |
| 222 | |
| 223 | vcc_ddr: DCDC_REG3 { |
| 224 | regulator-name = "vcc_ddr"; |
| 225 | regulator-always-on; |
| 226 | regulator-boot-on; |
| 227 | |
| 228 | regulator-state-mem { |
| 229 | regulator-on-in-suspend; |
| 230 | }; |
| 231 | }; |
| 232 | |
| 233 | vcc_io_33: DCDC_REG4 { |
| 234 | regulator-name = "vcc_io_33"; |
| 235 | regulator-always-on; |
| 236 | regulator-boot-on; |
| 237 | regulator-min-microvolt = <3300000>; |
| 238 | regulator-max-microvolt = <3300000>; |
| 239 | |
| 240 | regulator-state-mem { |
| 241 | regulator-on-in-suspend; |
| 242 | regulator-suspend-microvolt = <3300000>; |
| 243 | }; |
| 244 | }; |
| 245 | |
| 246 | vcc_18: LDO_REG1 { |
| 247 | regulator-name = "vcc_18"; |
| 248 | regulator-always-on; |
| 249 | regulator-boot-on; |
| 250 | regulator-min-microvolt = <1800000>; |
| 251 | regulator-max-microvolt = <1800000>; |
| 252 | |
| 253 | regulator-state-mem { |
| 254 | regulator-on-in-suspend; |
| 255 | regulator-suspend-microvolt = <1800000>; |
| 256 | }; |
| 257 | }; |
| 258 | |
| 259 | vcc18_emmc: LDO_REG2 { |
| 260 | regulator-name = "vcc18_emmc"; |
| 261 | regulator-always-on; |
| 262 | regulator-boot-on; |
| 263 | regulator-min-microvolt = <1800000>; |
| 264 | regulator-max-microvolt = <1800000>; |
| 265 | |
| 266 | regulator-state-mem { |
| 267 | regulator-on-in-suspend; |
| 268 | regulator-suspend-microvolt = <1800000>; |
| 269 | }; |
| 270 | }; |
| 271 | |
| 272 | vdd_10: LDO_REG3 { |
| 273 | regulator-name = "vdd_10"; |
| 274 | regulator-always-on; |
| 275 | regulator-boot-on; |
| 276 | regulator-min-microvolt = <1000000>; |
| 277 | regulator-max-microvolt = <1000000>; |
| 278 | |
| 279 | regulator-state-mem { |
| 280 | regulator-on-in-suspend; |
| 281 | regulator-suspend-microvolt = <1000000>; |
| 282 | }; |
| 283 | }; |
| 284 | }; |
| 285 | }; |
| 286 | }; |
| 287 | |
| 288 | &io_domains { |
| 289 | pmuio-supply = <&vcc_io_33>; |
| 290 | vccio1-supply = <&vcc_io_33>; |
| 291 | vccio2-supply = <&vcc18_emmc>; |
| 292 | vccio3-supply = <&vcc_io_sdio>; |
| 293 | vccio4-supply = <&vcc_18>; |
| 294 | vccio5-supply = <&vcc_io_33>; |
| 295 | vccio6-supply = <&vcc_io_33>; |
| 296 | status = "okay"; |
| 297 | }; |
| 298 | |
| 299 | &pinctrl { |
| 300 | button { |
| 301 | reset_button_pin: reset-button-pin { |
| 302 | rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; |
| 303 | }; |
| 304 | }; |
| 305 | |
Peter Robinson | 7715db3 | 2021-07-22 16:20:43 +0100 | [diff] [blame] | 306 | gmac2io { |
David Bauer | dcde9f6 | 2021-01-07 00:06:11 +0100 | [diff] [blame] | 307 | eth_phy_reset_pin: eth-phy-reset-pin { |
| 308 | rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; |
| 309 | }; |
| 310 | }; |
| 311 | |
| 312 | leds { |
| 313 | lan_led_pin: lan-led-pin { |
| 314 | rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; |
| 315 | }; |
| 316 | |
| 317 | sys_led_pin: sys-led-pin { |
| 318 | rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; |
| 319 | }; |
| 320 | |
| 321 | wan_led_pin: wan-led-pin { |
| 322 | rockchip,pins = <2 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; |
| 323 | }; |
| 324 | }; |
| 325 | |
Peter Robinson | 7715db3 | 2021-07-22 16:20:43 +0100 | [diff] [blame] | 326 | lan { |
| 327 | lan_vdd_pin: lan-vdd-pin { |
| 328 | rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; |
| 329 | }; |
| 330 | }; |
| 331 | |
David Bauer | dcde9f6 | 2021-01-07 00:06:11 +0100 | [diff] [blame] | 332 | pmic { |
| 333 | pmic_int_l: pmic-int-l { |
| 334 | rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; |
| 335 | }; |
| 336 | }; |
| 337 | |
| 338 | sd { |
| 339 | sdio_vcc_pin: sdio-vcc-pin { |
| 340 | rockchip,pins = <1 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>; |
| 341 | }; |
| 342 | }; |
| 343 | }; |
| 344 | |
| 345 | &pwm2 { |
| 346 | status = "okay"; |
| 347 | }; |
| 348 | |
| 349 | &sdmmc { |
| 350 | bus-width = <4>; |
| 351 | cap-sd-highspeed; |
| 352 | disable-wp; |
| 353 | pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>; |
| 354 | pinctrl-names = "default"; |
| 355 | sd-uhs-sdr12; |
| 356 | sd-uhs-sdr25; |
| 357 | sd-uhs-sdr50; |
| 358 | sd-uhs-sdr104; |
| 359 | vmmc-supply = <&vcc_sd>; |
| 360 | vqmmc-supply = <&vcc_io_sdio>; |
| 361 | status = "okay"; |
| 362 | }; |
| 363 | |
| 364 | &tsadc { |
| 365 | rockchip,hw-tshut-mode = <0>; |
| 366 | rockchip,hw-tshut-polarity = <0>; |
| 367 | status = "okay"; |
| 368 | }; |
| 369 | |
| 370 | &u2phy { |
| 371 | status = "okay"; |
| 372 | }; |
| 373 | |
| 374 | &u2phy_host { |
| 375 | status = "okay"; |
| 376 | }; |
| 377 | |
| 378 | &u2phy_otg { |
| 379 | status = "okay"; |
| 380 | }; |
| 381 | |
| 382 | &uart2 { |
| 383 | status = "okay"; |
| 384 | }; |
| 385 | |
| 386 | &usb20_otg { |
| 387 | status = "okay"; |
| 388 | dr_mode = "host"; |
Peter Robinson | 7715db3 | 2021-07-22 16:20:43 +0100 | [diff] [blame] | 389 | }; |
| 390 | |
| 391 | &usbdrd3 { |
| 392 | dr_mode = "host"; |
| 393 | status = "okay"; |
| 394 | #address-cells = <1>; |
| 395 | #size-cells = <0>; |
| 396 | |
| 397 | /* Second port is for USB 3.0 */ |
| 398 | rtl8153: device@2 { |
| 399 | compatible = "usbbda,8153"; |
| 400 | reg = <2>; |
| 401 | }; |
David Bauer | dcde9f6 | 2021-01-07 00:06:11 +0100 | [diff] [blame] | 402 | }; |
| 403 | |
| 404 | &usb_host0_ehci { |
| 405 | status = "okay"; |
| 406 | }; |
| 407 | |
| 408 | &usb_host0_ohci { |
| 409 | status = "okay"; |
| 410 | }; |