| 1 |
// SPDX-License-Identifier: (GPL-2.0+ OR MIT) |
| 2 |
// Copyright (C) 2021-2022 Samuel Holland <[email protected]> |
| 3 |
|
| 4 |
/* |
| 5 |
* gpio line names |
| 6 |
* |
| 7 |
* The Nezha-D1 has a 40-pin IO header. Some of these pins are routed |
| 8 |
* directly to pads on the SoC, others come from an 8-bit pcf857x IO |
| 9 |
* expander. Therefore, these line names are specified in two places: |
| 10 |
* one set for the pcf857x, and one set for the pio controller. |
| 11 |
* |
| 12 |
* Lines which are routed to the 40-pin header are named as follows: |
| 13 |
* <pin#> [<pin name>] |
| 14 |
* where: |
| 15 |
* <pin#> is the actual pin number of the 40-pin header |
| 16 |
* <pin name> is the name of the pin by function/gpio# |
| 17 |
* |
| 18 |
* For details regarding pin numbers and names see the schematics (under |
| 19 |
* "IO EXPAND"): |
| 20 |
* http://dl.linux-sunxi.org/D1/D1_Nezha_development_board_schematic_diagram_20210224.pdf |
| 21 |
*/ |
| 22 |
|
| 23 |
#include <dt-bindings/gpio/gpio.h> |
| 24 |
#include <dt-bindings/input/input.h> |
| 25 |
#include <dt-bindings/leds/common.h> |
| 26 |
|
| 27 |
/dts-v1/; |
| 28 |
|
| 29 |
#include "sun20i-d1.dtsi" |
| 30 |
#include "sun20i-common-regulators.dtsi" |
| 31 |
|
| 32 |
/ { |
| 33 |
model = "Allwinner D1 Nezha"; |
| 34 |
compatible = "allwinner,d1-nezha", "allwinner,sun20i-d1"; |
| 35 |
|
| 36 |
aliases { |
| 37 |
ethernet0 = &emac; |
| 38 |
ethernet1 = &xr829; |
| 39 |
serial0 = &uart0; |
| 40 |
}; |
| 41 |
|
| 42 |
chosen { |
| 43 |
stdout-path = "serial0:115200n8"; |
| 44 |
}; |
| 45 |
|
| 46 |
reg_usbvbus: usbvbus { |
| 47 |
compatible = "regulator-fixed"; |
| 48 |
regulator-name = "usbvbus"; |
| 49 |
regulator-min-microvolt = <5000000>; |
| 50 |
regulator-max-microvolt = <5000000>; |
| 51 |
gpio = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */ |
| 52 |
enable-active-high; |
| 53 |
vin-supply = <®_vcc>; |
| 54 |
}; |
| 55 |
|
| 56 |
/* |
| 57 |
* This regulator is PWM-controlled, but the PWM controller is not |
| 58 |
* yet supported, so fix the regulator to its default voltage. |
| 59 |
*/ |
| 60 |
reg_vdd_cpu: vdd-cpu { |
| 61 |
compatible = "regulator-fixed"; |
| 62 |
regulator-name = "vdd-cpu"; |
| 63 |
regulator-min-microvolt = <1100000>; |
| 64 |
regulator-max-microvolt = <1100000>; |
| 65 |
vin-supply = <®_vcc>; |
| 66 |
}; |
| 67 |
|
| 68 |
wifi_pwrseq: wifi-pwrseq { |
| 69 |
compatible = "mmc-pwrseq-simple"; |
| 70 |
reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */ |
| 71 |
}; |
| 72 |
}; |
| 73 |
|
| 74 |
&cpu0 { |
| 75 |
cpu-supply = <®_vdd_cpu>; |
| 76 |
}; |
| 77 |
|
| 78 |
&dcxo { |
| 79 |
clock-frequency = <24000000>; |
| 80 |
}; |
| 81 |
|
| 82 |
&ehci0 { |
| 83 |
status = "okay"; |
| 84 |
}; |
| 85 |
|
| 86 |
&ehci1 { |
| 87 |
status = "okay"; |
| 88 |
}; |
| 89 |
|
| 90 |
&emac { |
| 91 |
pinctrl-0 = <&rgmii_pe_pins>; |
| 92 |
pinctrl-names = "default"; |
| 93 |
phy-handle = <&ext_rgmii_phy>; |
| 94 |
phy-mode = "rgmii-id"; |
| 95 |
phy-supply = <®_vcc_3v3>; |
| 96 |
status = "okay"; |
| 97 |
}; |
| 98 |
|
| 99 |
&i2c2 { |
| 100 |
pinctrl-0 = <&i2c2_pb0_pins>; |
| 101 |
pinctrl-names = "default"; |
| 102 |
status = "okay"; |
| 103 |
|
| 104 |
pcf8574a: gpio@38 { |
| 105 |
compatible = "nxp,pcf8574a"; |
| 106 |
reg = <0x38>; |
| 107 |
interrupt-parent = <&pio>; |
| 108 |
interrupts = <1 2 IRQ_TYPE_LEVEL_LOW>; /* PB2 */ |
| 109 |
interrupt-controller; |
| 110 |
gpio-controller; |
| 111 |
#gpio-cells = <2>; |
| 112 |
#interrupt-cells = <2>; |
| 113 |
gpio-line-names = |
| 114 |
"pin13 [gpio8]", |
| 115 |
"pin16 [gpio10]", |
| 116 |
"pin18 [gpio11]", |
| 117 |
"pin26 [gpio17]", |
| 118 |
"pin22 [gpio14]", |
| 119 |
"pin28 [gpio19]", |
| 120 |
"pin37 [gpio23]", |
| 121 |
"pin11 [gpio6]"; |
| 122 |
}; |
| 123 |
}; |
| 124 |
|
| 125 |
&ledc { |
| 126 |
pinctrl-0 = <&ledc_pc0_pin>; |
| 127 |
pinctrl-names = "default"; |
| 128 |
status = "okay"; |
| 129 |
|
| 130 |
multi-led@0 { |
| 131 |
reg = <0x0>; |
| 132 |
color = <LED_COLOR_ID_RGB>; |
| 133 |
function = LED_FUNCTION_STATUS; |
| 134 |
}; |
| 135 |
}; |
| 136 |
|
| 137 |
&mdio { |
| 138 |
ext_rgmii_phy: ethernet-phy@1 { |
| 139 |
compatible = "ethernet-phy-ieee802.3-c22"; |
| 140 |
reg = <1>; |
| 141 |
}; |
| 142 |
}; |
| 143 |
|
| 144 |
&mmc0 { |
| 145 |
bus-width = <4>; |
| 146 |
cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */ |
| 147 |
disable-wp; |
| 148 |
vmmc-supply = <®_vcc_3v3>; |
| 149 |
vqmmc-supply = <®_vcc_3v3>; |
| 150 |
pinctrl-0 = <&mmc0_pins>; |
| 151 |
pinctrl-names = "default"; |
| 152 |
status = "okay"; |
| 153 |
}; |
| 154 |
|
| 155 |
&mmc1 { |
| 156 |
bus-width = <4>; |
| 157 |
mmc-pwrseq = <&wifi_pwrseq>; |
| 158 |
non-removable; |
| 159 |
vmmc-supply = <®_vcc_3v3>; |
| 160 |
vqmmc-supply = <®_vcc_3v3>; |
| 161 |
pinctrl-0 = <&mmc1_pins>; |
| 162 |
pinctrl-names = "default"; |
| 163 |
status = "okay"; |
| 164 |
|
| 165 |
xr829: wifi@1 { |
| 166 |
reg = <1>; |
| 167 |
interrupt-parent = <&pio>; |
| 168 |
interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 */ |
| 169 |
interrupt-names = "host-wake"; |
| 170 |
}; |
| 171 |
}; |
| 172 |
|
| 173 |
&ohci0 { |
| 174 |
status = "okay"; |
| 175 |
}; |
| 176 |
|
| 177 |
&ohci1 { |
| 178 |
status = "okay"; |
| 179 |
}; |
| 180 |
|
| 181 |
&uart0 { |
| 182 |
pinctrl-0 = <&uart0_pb8_pins>; |
| 183 |
pinctrl-names = "default"; |
| 184 |
status = "okay"; |
| 185 |
}; |
| 186 |
|
| 187 |
&uart1 { |
| 188 |
uart-has-rtscts; |
| 189 |
pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>; |
| 190 |
pinctrl-names = "default"; |
| 191 |
status = "okay"; |
| 192 |
|
| 193 |
/* XR829 bluetooth is connected here */ |
| 194 |
}; |
| 195 |
|
| 196 |
&usb_otg { |
| 197 |
dr_mode = "otg"; |
| 198 |
status = "okay"; |
| 199 |
}; |
| 200 |
|
| 201 |
&usbphy { |
| 202 |
usb0_id_det-gpios = <&pio 3 21 GPIO_ACTIVE_HIGH>; /* PD21 */ |
| 203 |
usb0_vbus_det-gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */ |
| 204 |
usb0_vbus-supply = <®_usbvbus>; |
| 205 |
usb1_vbus-supply = <®_vcc>; |
| 206 |
status = "okay"; |
| 207 |
}; |
| 208 |
|
| 209 |
&pio { |
| 210 |
gpio-line-names = |
| 211 |
/* Port A */ |
| 212 |
"", "", "", "", "", "", "", "", |
| 213 |
"", "", "", "", "", "", "", "", |
| 214 |
"", "", "", "", "", "", "", "", |
| 215 |
"", "", "", "", "", "", "", "", |
| 216 |
/* Port B */ |
| 217 |
"pin5 [gpio2/twi2-sck]", |
| 218 |
"pin3 [gpio1/twi2-sda]", |
| 219 |
"", |
| 220 |
"pin38 [gpio24/i2s2-din]", |
| 221 |
"pin40 [gpio25/i2s2-dout]", |
| 222 |
"pin12 [gpio7/i2s-clk]", |
| 223 |
"pin35 [gpio22/i2s2-lrck]", |
| 224 |
"", |
| 225 |
"pin8 [gpio4/uart0-txd]", |
| 226 |
"pin10 [gpio5/uart0-rxd]", |
| 227 |
"", |
| 228 |
"", |
| 229 |
"pin15 [gpio9]", |
| 230 |
"", "", "", "", |
| 231 |
"", "", "", "", "", "", "", "", |
| 232 |
"", "", "", "", "", "", "", "", |
| 233 |
/* Port C */ |
| 234 |
"", |
| 235 |
"pin31 [gpio21]", |
| 236 |
"", "", "", "", "", "", |
| 237 |
"", "", "", "", "", "", "", "", |
| 238 |
"", "", "", "", "", "", "", "", |
| 239 |
"", "", "", "", "", "", "", "", |
| 240 |
/* Port D */ |
| 241 |
"", "", "", "", "", "", "", "", |
| 242 |
"", "", |
| 243 |
"pin24 [gpio16/spi1-ce0]", |
| 244 |
"pin23 [gpio15/spi1-clk]", |
| 245 |
"pin19 [gpio12/spi1-mosi]", |
| 246 |
"pin21 [gpio13/spi1-miso]", |
| 247 |
"pin27 [gpio18/spi1-hold]", |
| 248 |
"pin29 [gpio20/spi1-wp]", |
| 249 |
"", "", "", "", "", "", |
| 250 |
"pin7 [gpio3/pwm]"; |
| 251 |
}; |