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