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#include <dt-bindings/leds/common.h>
14
15/ {
16	model = "SiPeed MAIX BiT";
17	compatible = "sipeed,maix-bit", "sipeed,maix-bitm",
18		     "canaan,kendryte-k210";
19
20	chosen {
21		bootargs = "earlycon console=ttySIF0";
22		stdout-path = "serial0:115200n8";
23	};
24
25	gpio-leds {
26		compatible = "gpio-leds";
27
28		led0 {
29			color = <LED_COLOR_ID_GREEN>;
30			label = "green";
31			gpios = <&gpio1_0 4 GPIO_ACTIVE_LOW>;
32		};
33
34		led1 {
35			color = <LED_COLOR_ID_RED>;
36			label = "red";
37			gpios = <&gpio1_0 5 GPIO_ACTIVE_LOW>;
38		};
39
40		led2 {
41			color = <LED_COLOR_ID_BLUE>;
42			label = "blue";
43			gpios = <&gpio1_0 6 GPIO_ACTIVE_LOW>;
44		};
45	};
46
47	gpio-keys {
48		compatible = "gpio-keys";
49
50		boot {
51			label = "BOOT";
52			linux,code = <BTN_0>;
53			gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
54		};
55	};
56};
57
58&fpioa {
59	pinctrl-names = "default";
60	pinctrl-0 = <&jtag_pinctrl>;
61	status = "okay";
62
63	jtag_pinctrl: jtag-pinmux {
64		pinmux = <K210_FPIOA(0, K210_PCF_JTAG_TCLK)>,
65			 <K210_FPIOA(1, K210_PCF_JTAG_TDI)>,
66			 <K210_FPIOA(2, K210_PCF_JTAG_TMS)>,
67			 <K210_FPIOA(3, K210_PCF_JTAG_TDO)>;
68	};
69
70	uarths_pinctrl: uarths-pinmux {
71		pinmux = <K210_FPIOA(4, K210_PCF_UARTHS_RX)>,
72			 <K210_FPIOA(5, K210_PCF_UARTHS_TX)>;
73	};
74
75	gpio_pinctrl: gpio-pinmux {
76		pinmux = <K210_FPIOA(8, K210_PCF_GPIO0)>,
77			 <K210_FPIOA(9, K210_PCF_GPIO1)>,
78			 <K210_FPIOA(10, K210_PCF_GPIO2)>,
79			 <K210_FPIOA(11, K210_PCF_GPIO3)>,
80			 <K210_FPIOA(12, K210_PCF_GPIO4)>,
81			 <K210_FPIOA(13, K210_PCF_GPIO5)>,
82			 <K210_FPIOA(14, K210_PCF_GPIO6)>,
83			 <K210_FPIOA(15, K210_PCF_GPIO7)>;
84	};
85
86	gpiohs_pinctrl: gpiohs-pinmux {
87		pinmux = <K210_FPIOA(16, K210_PCF_GPIOHS0)>,
88			 <K210_FPIOA(17, K210_PCF_GPIOHS1)>,
89			 <K210_FPIOA(21, K210_PCF_GPIOHS5)>,
90			 <K210_FPIOA(22, K210_PCF_GPIOHS6)>,
91			 <K210_FPIOA(23, K210_PCF_GPIOHS7)>,
92			 <K210_FPIOA(24, K210_PCF_GPIOHS8)>,
93			 <K210_FPIOA(25, K210_PCF_GPIOHS9)>,
94			 <K210_FPIOA(32, K210_PCF_GPIOHS16)>,
95			 <K210_FPIOA(33, K210_PCF_GPIOHS17)>,
96			 <K210_FPIOA(34, K210_PCF_GPIOHS18)>,
97			 <K210_FPIOA(35, K210_PCF_GPIOHS19)>;
98	};
99
100	i2s0_pinctrl: i2s0-pinmux {
101		pinmux = <K210_FPIOA(18, K210_PCF_I2S0_SCLK)>,
102			 <K210_FPIOA(19, K210_PCF_I2S0_WS)>,
103			 <K210_FPIOA(20, K210_PCF_I2S0_IN_D0)>;
104	};
105
106	dvp_pinctrl: dvp-pinmux {
107		pinmux = <K210_FPIOA(40, K210_PCF_SCCB_SDA)>,
108			 <K210_FPIOA(41, K210_PCF_SCCB_SCLK)>,
109			 <K210_FPIOA(42, K210_PCF_DVP_RST)>,
110			 <K210_FPIOA(43, K210_PCF_DVP_VSYNC)>,
111			 <K210_FPIOA(44, K210_PCF_DVP_PWDN)>,
112			 <K210_FPIOA(45, K210_PCF_DVP_HSYNC)>,
113			 <K210_FPIOA(46, K210_PCF_DVP_XCLK)>,
114			 <K210_FPIOA(47, K210_PCF_DVP_PCLK)>;
115	};
116
117	spi0_pinctrl: spi0-pinmux {
118		pinmux = <K210_FPIOA(36, K210_PCF_GPIOHS20)>,  /* cs */
119			 <K210_FPIOA(37, K210_PCF_GPIOHS21)>,  /* rst */
120			 <K210_FPIOA(38, K210_PCF_GPIOHS22)>,  /* dc */
121			 <K210_FPIOA(39, K210_PCF_SPI0_SCLK)>; /* wr */
122	};
123
124	spi1_pinctrl: spi1-pinmux {
125		pinmux = <K210_FPIOA(26, K210_PCF_SPI1_D1)>,
126			 <K210_FPIOA(27, K210_PCF_SPI1_SCLK)>,
127			 <K210_FPIOA(28, K210_PCF_SPI1_D0)>,
128			 <K210_FPIOA(29, K210_PCF_GPIOHS13)>; /* cs */
129	};
130
131	i2c1_pinctrl: i2c1-pinmux {
132		pinmux = <K210_FPIOA(30, K210_PCF_I2C1_SCLK)>,
133			 <K210_FPIOA(31, K210_PCF_I2C1_SDA)>;
134	};
135};
136
137&uarths0 {
138	pinctrl-0 = <&uarths_pinctrl>;
139	pinctrl-names = "default";
140	status = "okay";
141};
142
143&gpio0 {
144	pinctrl-0 = <&gpiohs_pinctrl>;
145	pinctrl-names = "default";
146	status = "okay";
147};
148
149&gpio1 {
150	pinctrl-0 = <&gpio_pinctrl>;
151	pinctrl-names = "default";
152	status = "okay";
153};
154
155&i2s0 {
156	#sound-dai-cells = <1>;
157	pinctrl-0 = <&i2s0_pinctrl>;
158	pinctrl-names = "default";
159};
160
161&i2c1 {
162	pinctrl-0 = <&i2c1_pinctrl>;
163	pinctrl-names = "default";
164	clock-frequency = <400000>;
165	status = "okay";
166};
167
168&spi0 {
169	pinctrl-0 = <&spi0_pinctrl>;
170	pinctrl-names = "default";
171	num-cs = <1>;
172	cs-gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
173
174	panel@0 {
175		compatible = "sitronix,st7789v";
176		reg = <0>;
177		reset-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
178		dc-gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
179		spi-max-frequency = <15000000>;
180		spi-cs-high;
181		status = "disabled";
182	};
183};
184
185&spi1 {
186	pinctrl-0 = <&spi1_pinctrl>;
187	pinctrl-names = "default";
188	num-cs = <1>;
189	cs-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
190	status = "okay";
191
192	slot@0 {
193		compatible = "mmc-spi-slot";
194		reg = <0>;
195		voltage-ranges = <3300 3300>;
196		spi-max-frequency = <25000000>;
197		broken-cd;
198	};
199};
200
201&spi3 {
202	flash@0 {
203		compatible = "jedec,spi-nor";
204		reg = <0>;
205		spi-max-frequency = <50000000>;
206		spi-tx-bus-width = <4>;
207		spi-rx-bus-width = <4>;
208		m25p,fast-read;
209		broken-flash-reset;
210	};
211};
212