1// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2/*
3 * Broadcom BCM470X / BCM5301X ARM platform code.
4 * DTS for Meraki MR32 / Codename: Espresso
5 *
6 * Copyright (C) 2018-2020 Christian Lamparter <chunkeey@gmail.com>
7 */
8
9/dts-v1/;
10
11#include "bcm4708.dtsi"
12#include "bcm5301x-nand-cs0-bch8.dtsi"
13#include <dt-bindings/leds/common.h>
14
15/ {
16	compatible = "meraki,mr32", "brcm,brcm53016", "brcm,bcm4708";
17	model = "Meraki MR32";
18
19	chosen {
20		bootargs = " console=ttyS0,115200n8 earlycon";
21	};
22
23	memory@0 {
24		reg = <0x00000000 0x08000000>;
25		device_type = "memory";
26	};
27
28	aliases {
29		serial1 = &uart2;
30	};
31
32	leds {
33		compatible = "gpio-leds";
34
35		sysled3 {
36			function = LED_FUNCTION_FAULT;
37			color = <LED_COLOR_ID_AMBER>;
38			gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>;
39			panic-indicator;
40		};
41		sysled2 {
42			function = LED_FUNCTION_INDICATOR;
43			color = <LED_COLOR_ID_WHITE>;
44			gpios = <&chipcommon 19 GPIO_ACTIVE_HIGH>;
45		};
46	};
47
48	keys {
49		compatible = "gpio-keys";
50		#address-cells = <1>;
51		#size-cells = <0>;
52
53		restart {
54			label = "Reset";
55			linux,code = <KEY_RESTART>;
56			gpios = <&chipcommon 21 GPIO_ACTIVE_LOW>;
57		};
58	};
59
60	pwm-leds {
61		compatible = "pwm-leds";
62
63		red {
64			/* SYS-LED 1 - Tricolor */
65			function = LED_FUNCTION_INDICATOR;
66			color = <LED_COLOR_ID_RED>;
67			pwms = <&pwm 0 50000 0>;
68			max-brightness = <255>;
69		};
70
71		green {
72			/* SYS-LED 1 - Tricolor */
73			function = LED_FUNCTION_POWER;
74			color = <LED_COLOR_ID_GREEN>;
75			pwms = <&pwm 1 50000 0>;
76			max-brightness = <255>;
77		};
78
79		blue {
80			/* SYS-LED 1 - Tricolor */
81			function = LED_FUNCTION_INDICATOR;
82			color = <LED_COLOR_ID_BLUE>;
83			pwms = <&pwm 2 50000 0>;
84			max-brightness = <255>;
85		};
86	};
87
88	i2c {
89		/*
90		 * The platform provided I2C does not budge.
91		 * This is a replacement until I can figure
92		 * out what are the missing bits...
93		 */
94
95		compatible = "i2c-gpio";
96		sda-gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>;
97		scl-gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>;
98		i2c-gpio,delay-us = <10>; /* close to 100 kHz */
99		#address-cells = <1>;
100		#size-cells = <0>;
101
102		current_sense: ina219@45 {
103			compatible = "ti,ina219";
104			reg = <0x45>;
105			shunt-resistor = <60000>; /* = 60 mOhms */
106		};
107
108		eeprom: eeprom@50 {
109			compatible = "atmel,24c64";
110			reg = <0x50>;
111			pagesize = <32>;
112			read-only;
113			#address-cells = <1>;
114			#size-cells = <1>;
115
116			mac_address: mac-address@66 {
117				reg = <0x66 0x6>;
118			};
119		};
120	};
121};
122
123&uart0 {
124	clock-frequency = <62500000>;
125	/delete-property/ clocks;
126};
127
128&uart1 {
129	status = "disabled";
130};
131
132&uart2 {
133	status = "okay";
134	/*
135	 * bluetooth-le {
136	 *	compatible = "brcm,bcm20732";
137	 *	enable-gpios = <&chipcommon 20 GPIO_ACTIVE_HIGH>;
138	 *};
139	 */
140};
141
142&gmac0 {
143	nvmem-cell-names = "mac-address";
144	nvmem-cells = <&mac_address>;
145};
146
147&gmac1 {
148	status = "disabled";
149};
150&gmac2 {
151	status = "disabled";
152};
153&gmac3 {
154	status = "disabled";
155};
156
157&pwm {
158	status = "okay";
159	pinctrl-names = "default";
160	pinctrl-0 = <&pinmux_pwm>;
161};
162
163&nandcs {
164	nand-ecc-algo = "hw";
165
166	partitions {
167		/*
168		 * The partition autodetection does not work for this device.
169		 * It will only detect the "nvram" partition with an incorrect size.
170		 *	[    1.721667] 1 bcm47xxpart partitions found on MTD device brcmnand.0
171		 *	[    1.727962] Creating 1 MTD partitions on "brcmnand.0":
172		 *	[    1.733117] 0x000000400000-0x000008000000 : "nvram"
173		 */
174
175		compatible = "fixed-partitions";
176		#address-cells = <0x1>;
177		#size-cells = <0x1>;
178
179		partition0@0 {
180			label = "u-boot";
181			reg = <0x0 0x100000>;
182			read-only;
183		};
184
185		partition1@100000 {
186			label = "bootkernel1";
187			reg = <0x100000 0x300000>;
188			read-only;
189		};
190
191		partition2@400000 {
192			label = "nvram";
193			reg = <0x400000 0x100000>;
194			read-only;
195		};
196
197		partition3@500000 {
198			label = "bootkernel2";
199			reg = <0x500000 0x300000>;
200			read-only;
201		};
202
203		partition4@800000 {
204			label = "ubi";
205			reg = <0x800000 0x7780000>;
206		};
207	};
208};
209
210&srab {
211	status = "okay";
212
213	ports {
214		port@0 {
215			reg = <0>;
216			label = "poe";
217		};
218
219		port@5 {
220			reg = <5>;
221			label = "cpu";
222			ethernet = <&gmac0>;
223
224			fixed-link {
225				speed = <1000>;
226				duplex-full;
227			};
228		};
229	};
230};
231