1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2019-20 Sean Anderson <seanga2@gmail.com>
4  * Copyright (C) 2020 Western Digital Corporation or its affiliates.
5  */
6 
7 /dts-v1/;
8 
9 #include "k210.dtsi"
10 
11 #include <dt-bindings/gpio/gpio.h>
12 #include <dt-bindings/input/input.h>
13 
14 / {
15 	model = "SiPeed MAIXDUINO";
16 	compatible = "sipeed,maixduino", "canaan,kendryte-k210";
17 
18 	aliases {
19 		serial0 = &uarths0;
20 	};
21 
22 	chosen {
23 		bootargs = "earlycon console=ttySIF0";
24 		stdout-path = "serial0:115200n8";
25 	};
26 
27 	gpio-keys {
28 		compatible = "gpio-keys";
29 
30 		key-boot {
31 			label = "BOOT";
32 			linux,code = <BTN_0>;
33 			gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
34 		};
35 	};
36 
37 	vcc_3v3: regulator-3v3 {
38 		compatible = "regulator-fixed";
39 		regulator-name = "3v3";
40 		regulator-min-microvolt = <3300000>;
41 		regulator-max-microvolt = <3300000>;
42 	};
43 };
44 
45 &fpioa {
46 	uarths_pinctrl: uarths-pinmux {
47 		pinmux = <K210_FPIOA(4, K210_PCF_UARTHS_RX)>, /* Header "0" */
48 			 <K210_FPIOA(5, K210_PCF_UARTHS_TX)>; /* Header "1" */
49 	};
50 
51 	gpio_pinctrl: gpio-pinmux {
52 		pinmux = <K210_FPIOA(8, K210_PCF_GPIO0)>,
53 			 <K210_FPIOA(9, K210_PCF_GPIO1)>;
54 	};
55 
56 	gpiohs_pinctrl: gpiohs-pinmux {
57 		pinmux = <K210_FPIOA(16, K210_PCF_GPIOHS0)>,  /* BOOT */
58 			 <K210_FPIOA(21, K210_PCF_GPIOHS2)>,  /* Header "2" */
59 			 <K210_FPIOA(22, K210_PCF_GPIOHS3)>,  /* Header "3" */
60 			 <K210_FPIOA(23, K210_PCF_GPIOHS4)>,  /* Header "4" */
61 			 <K210_FPIOA(24, K210_PCF_GPIOHS5)>,  /* Header "5" */
62 			 <K210_FPIOA(32, K210_PCF_GPIOHS6)>,  /* Header "6" */
63 			 <K210_FPIOA(15, K210_PCF_GPIOHS7)>,  /* Header "7" */
64 			 <K210_FPIOA(14, K210_PCF_GPIOHS8)>,  /* Header "8" */
65 			 <K210_FPIOA(13, K210_PCF_GPIOHS9)>,  /* Header "9" */
66 			 <K210_FPIOA(12, K210_PCF_GPIOHS10)>, /* Header "10" */
67 			 <K210_FPIOA(11, K210_PCF_GPIOHS11)>, /* Header "11" */
68 			 <K210_FPIOA(10, K210_PCF_GPIOHS12)>, /* Header "12" */
69 			 <K210_FPIOA(3,  K210_PCF_GPIOHS13)>; /* Header "13" */
70 	};
71 
72 	i2s0_pinctrl: i2s0-pinmux {
73 		pinmux = <K210_FPIOA(18, K210_PCF_I2S0_SCLK)>,
74 			 <K210_FPIOA(19, K210_PCF_I2S0_WS)>,
75 			 <K210_FPIOA(20, K210_PCF_I2S0_IN_D0)>;
76 	};
77 
78 	spi1_pinctrl: spi1-pinmux {
79 		pinmux = <K210_FPIOA(26, K210_PCF_SPI1_D1)>,
80 			 <K210_FPIOA(27, K210_PCF_SPI1_SCLK)>,
81 			 <K210_FPIOA(28, K210_PCF_SPI1_D0)>,
82 			 <K210_FPIOA(29, K210_PCF_GPIO2)>; /* cs */
83 	};
84 
85 	i2c1_pinctrl: i2c1-pinmux {
86 		pinmux = <K210_FPIOA(30, K210_PCF_I2C1_SCLK)>, /* Header "scl" */
87 			 <K210_FPIOA(31, K210_PCF_I2C1_SDA)>;  /* Header "sda" */
88 	};
89 
90 	i2s1_pinctrl: i2s1-pinmux {
91 		pinmux = <K210_FPIOA(33, K210_PCF_I2S1_WS)>,
92 			 <K210_FPIOA(34, K210_PCF_I2S1_IN_D0)>,
93 			 <K210_FPIOA(35, K210_PCF_I2S1_SCLK)>;
94 	};
95 
96 	spi0_pinctrl: spi0-pinmux {
97 		pinmux = <K210_FPIOA(36, K210_PCF_GPIOHS20)>,  /* cs */
98 			 <K210_FPIOA(37, K210_PCF_GPIOHS21)>,  /* rst */
99 			 <K210_FPIOA(38, K210_PCF_GPIOHS22)>,  /* dc */
100 			 <K210_FPIOA(39, K210_PCF_SPI0_SCLK)>; /* wr */
101 	};
102 
103 	dvp_pinctrl: dvp-pinmux {
104 		pinmux = <K210_FPIOA(40, K210_PCF_SCCB_SDA)>,
105 			 <K210_FPIOA(41, K210_PCF_SCCB_SCLK)>,
106 			 <K210_FPIOA(42, K210_PCF_DVP_RST)>,
107 			 <K210_FPIOA(43, K210_PCF_DVP_VSYNC)>,
108 			 <K210_FPIOA(44, K210_PCF_DVP_PWDN)>,
109 			 <K210_FPIOA(45, K210_PCF_DVP_HSYNC)>,
110 			 <K210_FPIOA(46, K210_PCF_DVP_XCLK)>,
111 			 <K210_FPIOA(47, K210_PCF_DVP_PCLK)>;
112 	};
113 };
114 
115 &uarths0 {
116 	pinctrl-0 = <&uarths_pinctrl>;
117 	pinctrl-names = "default";
118 	status = "okay";
119 };
120 
121 &gpio0 {
122 	pinctrl-0 = <&gpiohs_pinctrl>;
123 	pinctrl-names = "default";
124 	status = "okay";
125 };
126 
127 &gpio1 {
128 	pinctrl-0 = <&gpio_pinctrl>;
129 	pinctrl-names = "default";
130 	status = "okay";
131 };
132 
133 &i2s0 {
134 	#sound-dai-cells = <1>;
135 	pinctrl-0 = <&i2s0_pinctrl>;
136 	pinctrl-names = "default";
137 	status = "okay";
138 };
139 
140 &i2c1 {
141 	pinctrl-0 = <&i2c1_pinctrl>;
142 	pinctrl-names = "default";
143 	clock-frequency = <400000>;
144 	status = "okay";
145 };
146 
147 &spi0 {
148 	pinctrl-0 = <&spi0_pinctrl>;
149 	pinctrl-names = "default";
150 	num-cs = <1>;
151 	cs-gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
152 	status = "okay";
153 
154 	panel@0 {
155 		compatible = "sitronix,st7789v";
156 		reg = <0>;
157 		reset-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
158 		dc-gpios = <&gpio0 22 0>;
159 		spi-max-frequency = <15000000>;
160 		power-supply = <&vcc_3v3>;
161 	};
162 };
163 
164 &spi1 {
165 	pinctrl-0 = <&spi1_pinctrl>;
166 	pinctrl-names = "default";
167 	num-cs = <1>;
168 	cs-gpios = <&gpio1_0 2 GPIO_ACTIVE_LOW>;
169 	status = "okay";
170 
171 	mmc@0 {
172 		compatible = "mmc-spi-slot";
173 		reg = <0>;
174 		voltage-ranges = <3300 3300>;
175 		spi-max-frequency = <25000000>;
176 		broken-cd;
177 	};
178 };
179 
180 &spi3 {
181 	status = "okay";
182 
183 	flash@0 {
184 		compatible = "jedec,spi-nor";
185 		reg = <0>;
186 		spi-max-frequency = <50000000>;
187 		spi-tx-bus-width = <4>;
188 		spi-rx-bus-width = <4>;
189 		m25p,fast-read;
190 		broken-flash-reset;
191 	};
192 };
193