1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * at91-sama5d27_wlsom1.dtsi - Device Tree file for SAMA5D27 WLSOM1
4 *
5 * Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries
6 *
7 * Author: Nicolas Ferre <nicolas.ferre@microcihp.com>
8 * Author: Eugen Hristev <eugen.hristev@microcihp.com>
9 */
10#include "sama5d2.dtsi"
11#include "sama5d2-pinfunc.h"
12#include <dt-bindings/gpio/gpio.h>
13#include <dt-bindings/mfd/atmel-flexcom.h>
14#include <dt-bindings/pinctrl/at91.h>
15
16/ {
17	model = "Microchip SAMA5D27 WLSOM1";
18	compatible = "microchip,sama5d27-wlsom1", "atmel,sama5d27", "atmel,sama5d2", "atmel,sama5";
19
20	aliases {
21		i2c0 = &i2c0;
22	};
23
24	clocks {
25		slow_xtal {
26			clock-frequency = <32768>;
27		};
28
29		main_xtal {
30			clock-frequency = <24000000>;
31		};
32	};
33
34	wifi_pwrseq: wifi_pwrseq {
35		compatible = "mmc-pwrseq-wilc1000";
36		reset-gpios = <&pioA PIN_PA27 GPIO_ACTIVE_HIGH>;
37		powerdown-gpios = <&pioA PIN_PA29 GPIO_ACTIVE_HIGH>;
38		pinctrl-0 = <&pinctrl_wilc_pwrseq>;
39		pinctrl-names = "default";
40	};
41};
42
43&flx1 {
44	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
45
46	uart6: serial@200 {
47		pinctrl-0 = <&pinctrl_flx1_default>;
48		pinctrl-names = "default";
49	};
50};
51
52&i2c0 {
53	pinctrl-0 = <&pinctrl_i2c0_default>;
54	pinctrl-1 = <&pinctrl_i2c0_gpio>;
55	pinctrl-names = "default", "gpio";
56	sda-gpios = <&pioA PIN_PD21 GPIO_ACTIVE_HIGH>;
57	scl-gpios = <&pioA PIN_PD22 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
58	status = "okay";
59};
60
61&i2c1 {
62	dmas = <0>, <0>;
63	pinctrl-names = "default", "gpio";
64	pinctrl-0 = <&pinctrl_i2c1_default>;
65	pinctrl-1 = <&pinctrl_i2c1_gpio>;
66	sda-gpios = <&pioA PIN_PD19 GPIO_ACTIVE_HIGH>;
67	scl-gpios = <&pioA PIN_PD20 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
68	status = "okay";
69
70	mcp16502@5b {
71		compatible = "microchip,mcp16502";
72		reg = <0x5b>;
73		status = "okay";
74		lpm-gpios = <&pioBU 0 GPIO_ACTIVE_LOW>;
75
76		regulators {
77			vdd_3v3: VDD_IO {
78				regulator-name = "VDD_IO";
79				regulator-min-microvolt = <3300000>;
80				regulator-max-microvolt = <3300000>;
81				regulator-initial-mode = <2>;
82				regulator-allowed-modes = <2>, <4>;
83				regulator-always-on;
84
85				regulator-state-standby {
86					regulator-on-in-suspend;
87					regulator-mode = <4>;
88				};
89
90				regulator-state-mem {
91					regulator-off-in-suspend;
92					regulator-mode = <4>;
93				};
94			};
95
96			vddio_ddr: VDD_DDR {
97				regulator-name = "VDD_DDR";
98				regulator-min-microvolt = <1200000>;
99				regulator-max-microvolt = <1200000>;
100				regulator-initial-mode = <2>;
101				regulator-allowed-modes = <2>, <4>;
102				regulator-always-on;
103
104				regulator-state-standby {
105					regulator-on-in-suspend;
106					regulator-suspend-microvolt = <1200000>;
107					regulator-changeable-in-suspend;
108					regulator-mode = <4>;
109				};
110
111				regulator-state-mem {
112					regulator-on-in-suspend;
113					regulator-suspend-microvolt = <1200000>;
114					regulator-changeable-in-suspend;
115					regulator-mode = <4>;
116				};
117			};
118
119			vdd_core: VDD_CORE {
120				regulator-name = "VDD_CORE";
121				regulator-min-microvolt = <1250000>;
122				regulator-max-microvolt = <1250000>;
123				regulator-initial-mode = <2>;
124				regulator-allowed-modes = <2>, <4>;
125				regulator-always-on;
126
127				regulator-state-standby {
128					regulator-on-in-suspend;
129					regulator-mode = <4>;
130				};
131
132				regulator-state-mem {
133					regulator-off-in-suspend;
134					regulator-mode = <4>;
135				};
136			};
137
138			vdd_ddr: VDD_OTHER {
139				regulator-name = "VDD_OTHER";
140				regulator-min-microvolt = <1800000>;
141				regulator-max-microvolt = <1800000>;
142				regulator-initial-mode = <2>;
143				regulator-allowed-modes = <2>, <4>;
144				regulator-always-on;
145
146				regulator-state-standby {
147					regulator-on-in-suspend;
148					regulator-suspend-microvolt = <1800000>;
149					regulator-changeable-in-suspend;
150					regulator-mode = <4>;
151				};
152
153				regulator-state-mem {
154					regulator-on-in-suspend;
155					regulator-suspend-microvolt = <1800000>;
156					regulator-changeable-in-suspend;
157					regulator-mode = <4>;
158				};
159			};
160
161			LDO1 {
162				regulator-name = "LDO1";
163				regulator-min-microvolt = <3300000>;
164				regulator-max-microvolt = <3300000>;
165				regulator-always-on;
166
167				regulator-state-standby {
168					regulator-on-in-suspend;
169				};
170
171				regulator-state-mem {
172					regulator-off-in-suspend;
173				};
174			};
175
176			LDO2 {
177				regulator-name = "LDO2";
178				regulator-min-microvolt = <1800000>;
179				regulator-max-microvolt = <3300000>;
180
181				regulator-state-standby {
182					regulator-on-in-suspend;
183				};
184
185				regulator-state-mem {
186					regulator-off-in-suspend;
187				};
188			};
189		};
190	};
191};
192
193&macb0 {
194	pinctrl-names = "default";
195	pinctrl-0 = <&pinctrl_macb0_default>;
196	#address-cells = <1>;
197	#size-cells = <0>;
198	phy-mode = "rmii";
199
200	ethernet-phy@0 {
201		reg = <0x0>;
202		interrupt-parent = <&pioA>;
203		interrupts = <PIN_PB24 IRQ_TYPE_LEVEL_LOW>;
204		pinctrl-names = "default";
205		pinctrl-0 = <&pinctrl_macb0_phy_irq>;
206	};
207};
208
209&pmc {
210	atmel,osc-bypass;
211};
212
213&qspi1 {
214	pinctrl-names = "default";
215	pinctrl-0 = <&pinctrl_qspi1_default>;
216	status = "disabled";
217
218	qspi1_flash: flash@0 {
219		#address-cells = <1>;
220		#size-cells = <1>;
221		compatible = "jedec,spi-nor";
222		reg = <0>;
223		spi-max-frequency = <80000000>;
224		spi-rx-bus-width = <4>;
225		spi-tx-bus-width = <4>;
226		m25p,fast-read;
227		status = "disabled";
228
229		at91bootstrap@0 {
230			label = "at91bootstrap";
231			reg = <0x0 0x40000>;
232		};
233
234		bootloader@40000 {
235			label = "bootloader";
236			reg = <0x40000 0xc0000>;
237		};
238
239		bootloaderenvred@100000 {
240			label = "bootloader env redundant";
241			reg = <0x100000 0x40000>;
242		};
243
244		bootloaderenv@140000 {
245			label = "bootloader env";
246			reg = <0x140000 0x40000>;
247		};
248
249		dtb@180000 {
250			label = "device tree";
251			reg = <0x180000 0x80000>;
252		};
253
254		kernel@200000 {
255			label = "kernel";
256			reg = <0x200000 0x600000>;
257		};
258	};
259};
260
261&pioA {
262	pinctrl_flx1_default: flx1_usart_default {
263		pinmux = <PIN_PA24__FLEXCOM1_IO0>,
264			 <PIN_PA23__FLEXCOM1_IO1>,
265			 <PIN_PA25__FLEXCOM1_IO3>,
266			 <PIN_PA26__FLEXCOM1_IO4>;
267		bias-disable;
268	};
269
270	pinctrl_i2c0_default: i2c0_default {
271		pinmux = <PIN_PD21__TWD0>,
272			 <PIN_PD22__TWCK0>;
273		bias-disable;
274	};
275
276	pinctrl_i2c0_gpio: i2c0_gpio {
277		pinmux = <PIN_PD21__GPIO>,
278			 <PIN_PD22__GPIO>;
279		bias-disable;
280	};
281
282	pinctrl_i2c1_default: i2c1_default {
283		pinmux = <PIN_PD19__TWD1>,
284			 <PIN_PD20__TWCK1>;
285		bias-disable;
286	};
287
288	pinctrl_i2c1_gpio: i2c1_gpio {
289		pinmux = <PIN_PD19__GPIO>,
290			 <PIN_PD20__GPIO>;
291		bias-disable;
292	};
293
294	pinctrl_macb0_default: macb0_default {
295		pinmux = <PIN_PB14__GTXCK>,
296			 <PIN_PB15__GTXEN>,
297			 <PIN_PB16__GRXDV>,
298			 <PIN_PB17__GRXER>,
299			 <PIN_PB18__GRX0>,
300			 <PIN_PB19__GRX1>,
301			 <PIN_PB20__GTX0>,
302			 <PIN_PB21__GTX1>,
303			 <PIN_PB22__GMDC>,
304			 <PIN_PB23__GMDIO>;
305		bias-disable;
306	};
307
308	pinctrl_macb0_phy_irq: macb0_phy_irq {
309		pinmux = <PIN_PB24__GPIO>;
310		bias-disable;
311	};
312
313	pinctrl_qspi1_default: qspi1_default {
314		pinmux = <PIN_PB5__QSPI1_SCK>,
315			 <PIN_PB6__QSPI1_CS>,
316			 <PIN_PB7__QSPI1_IO0>,
317			 <PIN_PB8__QSPI1_IO1>,
318			 <PIN_PB9__QSPI1_IO2>,
319			 <PIN_PB10__QSPI1_IO3>;
320		bias-pull-up;
321	};
322
323	pinctrl_sdmmc1_default: sdmmc1_default {
324		cmd-data {
325			pinmux = <PIN_PA28__SDMMC1_CMD>,
326				 <PIN_PA18__SDMMC1_DAT0>,
327				 <PIN_PA19__SDMMC1_DAT1>,
328				 <PIN_PA20__SDMMC1_DAT2>,
329				 <PIN_PA21__SDMMC1_DAT3>;
330			bias-disable;
331		};
332
333		conf-ck {
334			pinmux = <PIN_PA22__SDMMC1_CK>;
335			bias-disable;
336		};
337	};
338
339	pinctrl_wilc_default: wilc_default {
340		conf-irq {
341			pinmux = <PIN_PB25__GPIO>;
342			bias-disable;
343		};
344	};
345
346	pinctrl_wilc_pwrseq: wilc_pwrseq {
347		conf-ce-nrst {
348			pinmux = <PIN_PA27__GPIO>,
349				 <PIN_PA29__GPIO>;
350			bias-disable;
351		};
352
353		conf-rtcclk {
354			pinmux = <PIN_PB13__PCK1>;
355			bias-disable;
356		};
357	};
358};
359
360&sdmmc1 {
361	#address-cells = <1>;
362	#size-cells = <0>;
363	bus-width = <4>;
364	pinctrl-names = "default";
365	pinctrl-0 = <&pinctrl_sdmmc1_default>;
366	mmc-pwrseq = <&wifi_pwrseq>;
367	no-1-8-v;
368	non-removable;
369	bus-width = <4>;
370	status = "okay";
371
372	wilc: wifi@0 {
373		reg = <0>;
374		compatible = "microchip,wilc1000";
375		pinctrl-names = "default";
376		pinctrl-0 = <&pinctrl_wilc_default>;
377		clocks = <&pmc PMC_TYPE_SYSTEM 9>;
378		clock-names = "rtc";
379		interrupts = <PIN_PB25 IRQ_TYPE_NONE>;
380		interrupt-parent = <&pioA>;
381		assigned-clocks = <&pmc PMC_TYPE_SYSTEM 9>;
382		assigned-clock-rates = <32768>;
383	};
384};
385
386