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