0001 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
0002 /*
0003 * Copyright (c) 2017 Andreas Färber
0004 */
0005
0006 /dts-v1/;
0007
0008 #include "meson-gxbb.dtsi"
0009 #include <dt-bindings/gpio/gpio.h>
0010 #include <dt-bindings/sound/meson-aiu.h>
0011
0012 / {
0013 compatible = "friendlyarm,nanopi-k2", "amlogic,meson-gxbb";
0014 model = "FriendlyARM NanoPi K2";
0015
0016 aliases {
0017 serial0 = &uart_AO;
0018 ethernet0 = ðmac;
0019 };
0020
0021 chosen {
0022 stdout-path = "serial0:115200n8";
0023 };
0024
0025 memory@0 {
0026 device_type = "memory";
0027 reg = <0x0 0x0 0x0 0x80000000>;
0028 };
0029
0030 leds {
0031 compatible = "gpio-leds";
0032
0033 led-stat {
0034 label = "nanopi-k2:blue:stat";
0035 gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>;
0036 default-state = "on";
0037 panic-indicator;
0038 };
0039 };
0040
0041 vdd_5v: regulator-vdd-5v {
0042 compatible = "regulator-fixed";
0043 regulator-name = "VDD_5V";
0044 regulator-min-microvolt = <5000000>;
0045 regulator-max-microvolt = <5000000>;
0046 };
0047
0048 vddio_ao18: regulator-vddio-ao18 {
0049 compatible = "regulator-fixed";
0050 regulator-name = "VDDIO_AO18";
0051 regulator-min-microvolt = <1800000>;
0052 regulator-max-microvolt = <1800000>;
0053 };
0054
0055 vddio_ao3v3: regulator-vddio-ao3v3 {
0056 compatible = "regulator-fixed";
0057 regulator-name = "VDDIO_AO3.3V";
0058 regulator-min-microvolt = <3300000>;
0059 regulator-max-microvolt = <3300000>;
0060 };
0061
0062 vddio_tf: regulator-vddio-tf {
0063 compatible = "regulator-gpio";
0064
0065 regulator-name = "VDDIO_TF";
0066 regulator-min-microvolt = <1800000>;
0067 regulator-max-microvolt = <3300000>;
0068
0069 gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
0070 gpios-states = <0>;
0071
0072 states = <3300000 0>,
0073 <1800000 1>;
0074
0075 regulator-settling-time-up-us = <100>;
0076 regulator-settling-time-down-us = <5000>;
0077 };
0078
0079 wifi_32k: wifi-32k {
0080 compatible = "pwm-clock";
0081 #clock-cells = <0>;
0082 clock-frequency = <32768>;
0083 pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
0084 };
0085
0086 sdio_pwrseq: sdio-pwrseq {
0087 compatible = "mmc-pwrseq-simple";
0088 reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
0089 clocks = <&wifi_32k>;
0090 clock-names = "ext_clock";
0091 };
0092
0093 vcc1v8: regulator-vcc1v8 {
0094 compatible = "regulator-fixed";
0095 regulator-name = "VCC1.8V";
0096 regulator-min-microvolt = <1800000>;
0097 regulator-max-microvolt = <1800000>;
0098 };
0099
0100 vcc3v3: regulator-vcc3v3 {
0101 compatible = "regulator-fixed";
0102 regulator-name = "VCC3.3V";
0103 regulator-min-microvolt = <3300000>;
0104 regulator-max-microvolt = <3300000>;
0105 };
0106
0107 emmc_pwrseq: emmc-pwrseq {
0108 compatible = "mmc-pwrseq-emmc";
0109 reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
0110 };
0111
0112 /* CVBS is available on CON1 pin 36, disabled by default */
0113 cvbs-connector {
0114 compatible = "composite-video-connector";
0115 status = "disabled";
0116
0117 port {
0118 cvbs_connector_in: endpoint {
0119 remote-endpoint = <&cvbs_vdac_out>;
0120 };
0121 };
0122 };
0123
0124 hdmi-connector {
0125 compatible = "hdmi-connector";
0126 type = "a";
0127
0128 port {
0129 hdmi_connector_in: endpoint {
0130 remote-endpoint = <&hdmi_tx_tmds_out>;
0131 };
0132 };
0133 };
0134
0135 sound {
0136 compatible = "amlogic,gx-sound-card";
0137 model = "NANOPI-K2";
0138 assigned-clocks = <&clkc CLKID_MPLL0>,
0139 <&clkc CLKID_MPLL1>,
0140 <&clkc CLKID_MPLL2>;
0141 assigned-clock-parents = <0>, <0>, <0>;
0142 assigned-clock-rates = <294912000>,
0143 <270950400>,
0144 <393216000>;
0145 status = "okay";
0146
0147 dai-link-0 {
0148 sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
0149 };
0150
0151 dai-link-1 {
0152 sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
0153 dai-format = "i2s";
0154 mclk-fs = <256>;
0155
0156 codec-0 {
0157 sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
0158 };
0159 };
0160
0161 dai-link-2 {
0162 sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
0163
0164 codec-0 {
0165 sound-dai = <&hdmi_tx>;
0166 };
0167 };
0168 };
0169 };
0170
0171 &aiu {
0172 status = "okay";
0173 };
0174
0175 &cec_AO {
0176 status = "okay";
0177 pinctrl-0 = <&ao_cec_pins>;
0178 pinctrl-names = "default";
0179 hdmi-phandle = <&hdmi_tx>;
0180 };
0181
0182 &cvbs_vdac_port {
0183 cvbs_vdac_out: endpoint {
0184 remote-endpoint = <&cvbs_connector_in>;
0185 };
0186 };
0187
0188 ðmac {
0189 status = "okay";
0190 pinctrl-0 = <ð_rgmii_pins>;
0191 pinctrl-names = "default";
0192
0193 phy-handle = <ð_phy0>;
0194 phy-mode = "rgmii";
0195
0196 amlogic,tx-delay-ns = <2>;
0197
0198 mdio {
0199 compatible = "snps,dwmac-mdio";
0200 #address-cells = <1>;
0201 #size-cells = <0>;
0202
0203 eth_phy0: ethernet-phy@0 {
0204 /* Realtek RTL8211F (0x001cc916) */
0205 reg = <0>;
0206
0207 reset-assert-us = <10000>;
0208 reset-deassert-us = <80000>;
0209 reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;
0210
0211 interrupt-parent = <&gpio_intc>;
0212 /* MAC_INTR on GPIOZ_15 */
0213 interrupts = <29 IRQ_TYPE_LEVEL_LOW>;
0214 };
0215 };
0216 };
0217
0218 &hdmi_tx {
0219 status = "okay";
0220 pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
0221 pinctrl-names = "default";
0222 };
0223
0224 &hdmi_tx_tmds_port {
0225 hdmi_tx_tmds_out: endpoint {
0226 remote-endpoint = <&hdmi_connector_in>;
0227 };
0228 };
0229
0230 &ir {
0231 status = "okay";
0232 pinctrl-0 = <&remote_input_ao_pins>;
0233 pinctrl-names = "default";
0234 };
0235
0236 &gpio_ao {
0237 gpio-line-names = "UART TX", "UART RX", "Power Control", "Power Key In",
0238 "VCCK En", "CON1 Header Pin31",
0239 "I2S Header Pin6", "IR In", "I2S Header Pin7",
0240 "I2S Header Pin3", "I2S Header Pin4",
0241 "I2S Header Pin5", "HDMI CEC", "SYS LED",
0242 /* GPIO_TEST_N */
0243 "";
0244 };
0245
0246 &gpio {
0247 gpio-line-names = /* Bank GPIOZ */
0248 "Eth MDIO", "Eth MDC", "Eth RGMII RX Clk",
0249 "Eth RX DV", "Eth RX D0", "Eth RX D1", "Eth RX D2",
0250 "Eth RX D3", "Eth RGMII TX Clk", "Eth TX En",
0251 "Eth TX D0", "Eth TX D1", "Eth TX D2", "Eth TX D3",
0252 "Eth PHY nRESET", "Eth PHY Intc",
0253 /* Bank GPIOH */
0254 "HDMI HPD", "HDMI DDC SDA", "HDMI DDC SCL",
0255 "CON1 Header Pin33",
0256 /* Bank BOOT */
0257 "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3", "eMMC D4",
0258 "eMMC D5", "eMMC D6", "eMMC D7", "eMMC Clk",
0259 "eMMC Reset", "eMMC CMD",
0260 "", "", "", "", "eMMC DS",
0261 "", "",
0262 /* Bank CARD */
0263 "SDCard D1", "SDCard D0", "SDCard CLK", "SDCard CMD",
0264 "SDCard D3", "SDCard D2", "SDCard Det",
0265 /* Bank GPIODV */
0266 "", "", "", "", "", "", "", "", "", "", "", "", "",
0267 "", "", "", "", "", "", "", "", "", "", "",
0268 "I2C A SDA", "I2C A SCK", "I2C B SDA", "I2C B SCK",
0269 "VDDEE Regulator", "VCCK Regulator",
0270 /* Bank GPIOY */
0271 "CON1 Header Pin7", "CON1 Header Pin11",
0272 "CON1 Header Pin13", "CON1 Header Pin15",
0273 "CON1 Header Pin18", "CON1 Header Pin19",
0274 "CON1 Header Pin22", "CON1 Header Pin21",
0275 "CON1 Header Pin24", "CON1 Header Pin23",
0276 "CON1 Header Pin26", "CON1 Header Pin29",
0277 "CON1 Header Pin32", "CON1 Header Pin8",
0278 "CON1 Header Pin10", "CON1 Header Pin16",
0279 "CON1 Header Pin12",
0280 /* Bank GPIOX */
0281 "WIFI SDIO D0", "WIFI SDIO D1", "WIFI SDIO D2",
0282 "WIFI SDIO D3", "WIFI SDIO CLK", "WIFI SDIO CMD",
0283 "WIFI Power Enable", "WIFI WAKE HOST",
0284 "Bluetooth PCM DOUT", "Bluetooth PCM DIN",
0285 "Bluetooth PCM SYNC", "Bluetooth PCM CLK",
0286 "Bluetooth UART TX", "Bluetooth UART RX",
0287 "Bluetooth UART CTS", "Bluetooth UART RTS",
0288 "", "", "", "WIFI 32K", "Bluetooth Enable",
0289 "Bluetooth WAKE HOST", "",
0290 /* Bank GPIOCLK */
0291 "", "CON1 Header Pin35", "", "";
0292 };
0293
0294 &pwm_ef {
0295 status = "okay";
0296 pinctrl-0 = <&pwm_e_pins>;
0297 pinctrl-names = "default";
0298 clocks = <&clkc CLKID_FCLK_DIV4>;
0299 clock-names = "clkin0";
0300 };
0301
0302 &saradc {
0303 status = "okay";
0304 vref-supply = <&vddio_ao18>;
0305 };
0306
0307 /* SDIO */
0308 &sd_emmc_a {
0309 status = "okay";
0310 pinctrl-0 = <&sdio_pins>, <&sdio_irq_pins>;
0311 pinctrl-1 = <&sdio_clk_gate_pins>;
0312 pinctrl-names = "default", "clk-gate";
0313 #address-cells = <1>;
0314 #size-cells = <0>;
0315
0316 bus-width = <4>;
0317 cap-sd-highspeed;
0318 max-frequency = <50000000>;
0319
0320 non-removable;
0321 disable-wp;
0322
0323 /* WiFi firmware requires power to be kept while in suspend */
0324 keep-power-in-suspend;
0325
0326 mmc-pwrseq = <&sdio_pwrseq>;
0327
0328 vmmc-supply = <&vddio_ao3v3>;
0329 vqmmc-supply = <&vddio_ao18>;
0330
0331 brcmf: wifi@1 {
0332 compatible = "brcm,bcm4329-fmac";
0333 reg = <1>;
0334 };
0335 };
0336
0337 /* SD */
0338 &sd_emmc_b {
0339 status = "okay";
0340 pinctrl-0 = <&sdcard_pins>;
0341 pinctrl-1 = <&sdcard_clk_gate_pins>;
0342 pinctrl-names = "default", "clk-gate";
0343
0344 bus-width = <4>;
0345 cap-sd-highspeed;
0346 sd-uhs-sdr12;
0347 sd-uhs-sdr25;
0348 sd-uhs-sdr50;
0349 sd-uhs-ddr50;
0350 max-frequency = <100000000>;
0351 disable-wp;
0352
0353 cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
0354
0355 vmmc-supply = <&vddio_ao3v3>;
0356 vqmmc-supply = <&vddio_tf>;
0357 };
0358
0359 /* eMMC */
0360 &sd_emmc_c {
0361 status = "disabled";
0362 pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
0363 pinctrl-1 = <&emmc_clk_gate_pins>;
0364 pinctrl-names = "default", "clk-gate";
0365
0366 bus-width = <8>;
0367 max-frequency = <200000000>;
0368 non-removable;
0369 disable-wp;
0370 cap-mmc-highspeed;
0371 mmc-ddr-1_8v;
0372 mmc-hs200-1_8v;
0373
0374 mmc-pwrseq = <&emmc_pwrseq>;
0375 vmmc-supply = <&vcc3v3>;
0376 vqmmc-supply = <&vcc1v8>;
0377 };
0378
0379 /* DBG_UART */
0380 &uart_AO {
0381 status = "okay";
0382 pinctrl-0 = <&uart_ao_a_pins>;
0383 pinctrl-names = "default";
0384 };
0385
0386 /* Bluetooth on AP6212 */
0387 &uart_A {
0388 status = "okay";
0389 pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
0390 pinctrl-names = "default";
0391 uart-has-rtscts;
0392
0393 bluetooth {
0394 compatible = "brcm,bcm43438-bt";
0395 clocks = <&wifi_32k>;
0396 clock-names = "lpo";
0397 vbat-supply = <&vddio_ao3v3>;
0398 vddio-supply = <&vddio_ao18>;
0399 host-wakeup-gpios = <&gpio GPIOX_21 GPIO_ACTIVE_HIGH>;
0400 shutdown-gpios = <&gpio GPIOX_20 GPIO_ACTIVE_HIGH>;
0401 };
0402 };
0403
0404 /* 40-pin CON1 */
0405 &uart_C {
0406 status = "disabled";
0407 pinctrl-0 = <&uart_c_pins>;
0408 pinctrl-names = "default";
0409 };
0410
0411 &usb0_phy {
0412 status = "okay";
0413 phy-supply = <&vdd_5v>;
0414 };
0415
0416 &usb1_phy {
0417 status = "okay";
0418 };
0419
0420 &usb0 {
0421 status = "okay";
0422 };
0423
0424 &usb1 {
0425 status = "okay";
0426 };