1*724ba675SRob Herring// SPDX-License-Identifier: GPL-2.0
2*724ba675SRob Herring/*
3*724ba675SRob Herring * Device Tree Source for Sunplus SP7021
4*724ba675SRob Herring *
5*724ba675SRob Herring * Copyright (C) 2021 Sunplus Technology Co.
6*724ba675SRob Herring */
7*724ba675SRob Herring
8*724ba675SRob Herring#include <dt-bindings/clock/sunplus,sp7021-clkc.h>
9*724ba675SRob Herring#include <dt-bindings/interrupt-controller/irq.h>
10*724ba675SRob Herring#include <dt-bindings/reset/sunplus,sp7021-reset.h>
11*724ba675SRob Herring#include <dt-bindings/pinctrl/sppctl-sp7021.h>
12*724ba675SRob Herring#include <dt-bindings/gpio/gpio.h>
13*724ba675SRob Herring
14*724ba675SRob Herring#define XTAL	27000000
15*724ba675SRob Herring
16*724ba675SRob Herring/ {
17*724ba675SRob Herring	compatible = "sunplus,sp7021";
18*724ba675SRob Herring	model = "Sunplus SP7021";
19*724ba675SRob Herring
20*724ba675SRob Herring	clocks {
21*724ba675SRob Herring		extclk: osc0 {
22*724ba675SRob Herring			compatible = "fixed-clock";
23*724ba675SRob Herring			#clock-cells = <0>;
24*724ba675SRob Herring			clock-frequency = <XTAL>;
25*724ba675SRob Herring			clock-output-names = "extclk";
26*724ba675SRob Herring		};
27*724ba675SRob Herring	};
28*724ba675SRob Herring
29*724ba675SRob Herring	soc@9c000000 {
30*724ba675SRob Herring		compatible = "simple-bus";
31*724ba675SRob Herring		#address-cells = <1>;
32*724ba675SRob Herring		#size-cells = <1>;
33*724ba675SRob Herring		ranges = <0 0x9c000000 0x400000>;
34*724ba675SRob Herring		interrupt-parent = <&intc>;
35*724ba675SRob Herring
36*724ba675SRob Herring		clkc: clock-controller@4 {
37*724ba675SRob Herring			compatible = "sunplus,sp7021-clkc";
38*724ba675SRob Herring			reg = <0x4 0x28>,
39*724ba675SRob Herring			      <0x200 0x44>,
40*724ba675SRob Herring			      <0x268 0x04>;
41*724ba675SRob Herring			clocks = <&extclk>;
42*724ba675SRob Herring			#clock-cells = <1>;
43*724ba675SRob Herring		};
44*724ba675SRob Herring
45*724ba675SRob Herring		intc: interrupt-controller@780 {
46*724ba675SRob Herring			compatible = "sunplus,sp7021-intc";
47*724ba675SRob Herring			reg = <0x780 0x80>, <0xa80 0x80>;
48*724ba675SRob Herring			interrupt-controller;
49*724ba675SRob Herring			#interrupt-cells = <2>;
50*724ba675SRob Herring		};
51*724ba675SRob Herring
52*724ba675SRob Herring		otp: otp@af00 {
53*724ba675SRob Herring			compatible = "sunplus,sp7021-ocotp";
54*724ba675SRob Herring			reg = <0xaf00 0x34>, <0xaf80 0x58>;
55*724ba675SRob Herring			reg-names = "hb_gpio", "otprx";
56*724ba675SRob Herring			clocks = <&clkc CLK_OTPRX>;
57*724ba675SRob Herring			resets = <&rstc RST_OTPRX>;
58*724ba675SRob Herring			#address-cells = <1>;
59*724ba675SRob Herring			#size-cells = <1>;
60*724ba675SRob Herring
61*724ba675SRob Herring			therm_calib: thermal-calibration@14 {
62*724ba675SRob Herring				reg = <0x14 0x3>;
63*724ba675SRob Herring			};
64*724ba675SRob Herring			disc_vol: disconnect-voltage@18 {
65*724ba675SRob Herring				reg = <0x18 0x2>;
66*724ba675SRob Herring			};
67*724ba675SRob Herring			mac_addr0: mac-address0@34 {
68*724ba675SRob Herring				reg = <0x34 0x6>;
69*724ba675SRob Herring			};
70*724ba675SRob Herring			mac_addr1: mac-address1@3a {
71*724ba675SRob Herring				reg = <0x3a 0x6>;
72*724ba675SRob Herring			};
73*724ba675SRob Herring		};
74*724ba675SRob Herring
75*724ba675SRob Herring		pctl: pinctrl@100 {
76*724ba675SRob Herring			compatible = "sunplus,sp7021-pctl";
77*724ba675SRob Herring			reg = <0x100 0x100>,
78*724ba675SRob Herring			      <0x300 0x100>,
79*724ba675SRob Herring			      <0x32e4 0x1C>,
80*724ba675SRob Herring			      <0x80 0x20>;
81*724ba675SRob Herring			reg-names = "moon2", "gpioxt", "first", "moon1";
82*724ba675SRob Herring			gpio-controller;
83*724ba675SRob Herring			#gpio-cells = <2>;
84*724ba675SRob Herring			clocks = <&clkc CLK_GPIO>;
85*724ba675SRob Herring			resets = <&rstc RST_GPIO>;
86*724ba675SRob Herring
87*724ba675SRob Herring			emac_pins: pinmux-emac-pins {
88*724ba675SRob Herring				sunplus,pins = <
89*724ba675SRob Herring					SPPCTL_IOPAD(49,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_CLK_OUT,0)
90*724ba675SRob Herring					SPPCTL_IOPAD(44,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_MAC_SMI_MDC,0)
91*724ba675SRob Herring					SPPCTL_IOPAD(43,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_MAC_SMI_MDIO,0)
92*724ba675SRob Herring					SPPCTL_IOPAD(52,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_TXEN,0)
93*724ba675SRob Herring					SPPCTL_IOPAD(50,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_TXD0,0)
94*724ba675SRob Herring					SPPCTL_IOPAD(51,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_TXD1,0)
95*724ba675SRob Herring					SPPCTL_IOPAD(46,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_CRSDV,0)
96*724ba675SRob Herring					SPPCTL_IOPAD(47,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_RXD0,0)
97*724ba675SRob Herring					SPPCTL_IOPAD(48,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_RXD1,0)
98*724ba675SRob Herring					SPPCTL_IOPAD(45,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_RXER,0)
99*724ba675SRob Herring					SPPCTL_IOPAD(59,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P1_MAC_RMII_TXEN,0)
100*724ba675SRob Herring					SPPCTL_IOPAD(57,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P1_MAC_RMII_TXD0,0)
101*724ba675SRob Herring					SPPCTL_IOPAD(58,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P1_MAC_RMII_TXD1,0)
102*724ba675SRob Herring					SPPCTL_IOPAD(54,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P1_MAC_RMII_CRSDV,0)
103*724ba675SRob Herring					SPPCTL_IOPAD(55,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P1_MAC_RMII_RXD0,0)
104*724ba675SRob Herring					SPPCTL_IOPAD(56,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P1_MAC_RMII_RXD1,0)
105*724ba675SRob Herring					SPPCTL_IOPAD(53,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P1_MAC_RMII_RXER,0)
106*724ba675SRob Herring				>;
107*724ba675SRob Herring				sunplus,zerofunc = <
108*724ba675SRob Herring					MUXF_L2SW_LED_FLASH0
109*724ba675SRob Herring					MUXF_L2SW_LED_FLASH1
110*724ba675SRob Herring					MUXF_L2SW_LED_ON0
111*724ba675SRob Herring					MUXF_L2SW_LED_ON1
112*724ba675SRob Herring					MUXF_DAISY_MODE
113*724ba675SRob Herring				>;
114*724ba675SRob Herring			};
115*724ba675SRob Herring
116*724ba675SRob Herring			emmc_pins: pinmux-emmc-pins {
117*724ba675SRob Herring				function = "CARD0_EMMC";
118*724ba675SRob Herring				groups = "CARD0_EMMC";
119*724ba675SRob Herring			};
120*724ba675SRob Herring
121*724ba675SRob Herring			leds_pins: pinmux-leds-pins {
122*724ba675SRob Herring				sunplus,pins = < SPPCTL_IOPAD(0,SPPCTL_PCTL_G_GPIO,0,SPPCTL_PCTL_L_OUT) >;
123*724ba675SRob Herring			};
124*724ba675SRob Herring
125*724ba675SRob Herring			sdcard_pins: pinmux-sdcard-pins {
126*724ba675SRob Herring				function = "SD_CARD";
127*724ba675SRob Herring				groups = "SD_CARD";
128*724ba675SRob Herring				sunplus,pins = < SPPCTL_IOPAD(91, SPPCTL_PCTL_G_GPIO, 0, 0) >;
129*724ba675SRob Herring			};
130*724ba675SRob Herring
131*724ba675SRob Herring			spi0_pins: pinmux-spi0-pins {
132*724ba675SRob Herring				sunplus,pins = <
133*724ba675SRob Herring					SPPCTL_IOPAD(26,SPPCTL_PCTL_G_GPIO,0,0)
134*724ba675SRob Herring					SPPCTL_IOPAD(28,SPPCTL_PCTL_G_GPIO,0,0)
135*724ba675SRob Herring					SPPCTL_IOPAD(23,SPPCTL_PCTL_G_PMUX,MUXF_SPI0S_DO,0)
136*724ba675SRob Herring					SPPCTL_IOPAD(25,SPPCTL_PCTL_G_PMUX,MUXF_SPI0S_DI,0)
137*724ba675SRob Herring					SPPCTL_IOPAD(27,SPPCTL_PCTL_G_PMUX,MUXF_SPI0S_CLK,0)
138*724ba675SRob Herring				>;
139*724ba675SRob Herring			};
140*724ba675SRob Herring
141*724ba675SRob Herring			uart0_pins: pinmux-uart0-pins {
142*724ba675SRob Herring				function = "UA0";
143*724ba675SRob Herring				groups = "UA0";
144*724ba675SRob Herring			};
145*724ba675SRob Herring
146*724ba675SRob Herring			uart1_pins: pinmux-uart1-pins {
147*724ba675SRob Herring				sunplus,pins = <
148*724ba675SRob Herring					SPPCTL_IOPAD(14,SPPCTL_PCTL_G_PMUX,MUXF_UA4_TX,0)
149*724ba675SRob Herring					SPPCTL_IOPAD(16,SPPCTL_PCTL_G_PMUX,MUXF_UA4_RX,0)
150*724ba675SRob Herring				>;
151*724ba675SRob Herring			};
152*724ba675SRob Herring
153*724ba675SRob Herring			uart2_pins: pinmux-uart2-pins {
154*724ba675SRob Herring				sunplus,pins = <
155*724ba675SRob Herring					SPPCTL_IOPAD(16,SPPCTL_PCTL_G_PMUX,MUXF_UA2_TX,0)
156*724ba675SRob Herring					SPPCTL_IOPAD(17,SPPCTL_PCTL_G_PMUX,MUXF_UA2_RX,0)
157*724ba675SRob Herring					SPPCTL_IOPAD(18,SPPCTL_PCTL_G_PMUX,MUXF_UA2_RTS,0)
158*724ba675SRob Herring					SPPCTL_IOPAD(19,SPPCTL_PCTL_G_PMUX,MUXF_UA2_CTS,0)
159*724ba675SRob Herring				>;
160*724ba675SRob Herring			};
161*724ba675SRob Herring
162*724ba675SRob Herring			uart4_pins: pinmux-uart4-pins {
163*724ba675SRob Herring				sunplus,pins = <
164*724ba675SRob Herring					SPPCTL_IOPAD(22,SPPCTL_PCTL_G_PMUX,MUXF_UA4_TX,0)
165*724ba675SRob Herring					SPPCTL_IOPAD(20,SPPCTL_PCTL_G_PMUX,MUXF_UA4_RX,0)
166*724ba675SRob Herring					SPPCTL_IOPAD(23,SPPCTL_PCTL_G_PMUX,MUXF_UA4_RTS,0)
167*724ba675SRob Herring					SPPCTL_IOPAD(21,SPPCTL_PCTL_G_PMUX,MUXF_UA4_CTS,0)
168*724ba675SRob Herring				>;
169*724ba675SRob Herring			};
170*724ba675SRob Herring		};
171*724ba675SRob Herring
172*724ba675SRob Herring		rstc: reset@54 {
173*724ba675SRob Herring			compatible = "sunplus,sp7021-reset";
174*724ba675SRob Herring			reg = <0x54 0x28>;
175*724ba675SRob Herring			#reset-cells = <1>;
176*724ba675SRob Herring		};
177*724ba675SRob Herring
178*724ba675SRob Herring		rtc: rtc@3a00 {
179*724ba675SRob Herring			compatible = "sunplus,sp7021-rtc";
180*724ba675SRob Herring			reg = <0x3a00 0x80>;
181*724ba675SRob Herring			reg-names = "rtc";
182*724ba675SRob Herring			clocks = <&clkc CLK_RTC>;
183*724ba675SRob Herring			resets = <&rstc RST_RTC>;
184*724ba675SRob Herring			interrupts = <163 IRQ_TYPE_EDGE_RISING>;
185*724ba675SRob Herring		};
186*724ba675SRob Herring
187*724ba675SRob Herring		spi_controller0: spi@2d80 {
188*724ba675SRob Herring			compatible = "sunplus,sp7021-spi";
189*724ba675SRob Herring			reg = <0x2d80 0x80>, <0x2e00 0x80>;
190*724ba675SRob Herring			reg-names = "master", "slave";
191*724ba675SRob Herring			interrupts = <144 IRQ_TYPE_LEVEL_HIGH>,
192*724ba675SRob Herring				     <146 IRQ_TYPE_LEVEL_HIGH>,
193*724ba675SRob Herring				     <145 IRQ_TYPE_LEVEL_HIGH>;
194*724ba675SRob Herring			interrupt-names = "dma_w", "master_risc", "slave_risc";
195*724ba675SRob Herring			clocks = <&clkc CLK_SPI_COMBO_0>;
196*724ba675SRob Herring			resets = <&rstc RST_SPI_COMBO_0>;
197*724ba675SRob Herring
198*724ba675SRob Herring			pinctrl-names = "default";
199*724ba675SRob Herring			pinctrl-0 = <&spi0_pins>;
200*724ba675SRob Herring			cs-gpios = <&pctl 26 GPIO_ACTIVE_LOW>,
201*724ba675SRob Herring				   <&pctl 28 GPIO_ACTIVE_LOW>;
202*724ba675SRob Herring		};
203*724ba675SRob Herring
204*724ba675SRob Herring		spi_controller1: spi@f480 {
205*724ba675SRob Herring			compatible = "sunplus,sp7021-spi";
206*724ba675SRob Herring			reg = <0xf480 0x80>, <0xf500 0x80>;
207*724ba675SRob Herring			reg-names = "master", "slave";
208*724ba675SRob Herring			interrupts = <67 IRQ_TYPE_LEVEL_HIGH>,
209*724ba675SRob Herring				     <69 IRQ_TYPE_LEVEL_HIGH>,
210*724ba675SRob Herring				     <68 IRQ_TYPE_LEVEL_HIGH>;
211*724ba675SRob Herring			interrupt-names = "dma_w", "master_risc", "slave_risc";
212*724ba675SRob Herring			clocks = <&clkc CLK_SPI_COMBO_1>;
213*724ba675SRob Herring			resets = <&rstc RST_SPI_COMBO_1>;
214*724ba675SRob Herring			status = "disabled";
215*724ba675SRob Herring		};
216*724ba675SRob Herring
217*724ba675SRob Herring		spi_controller2: spi@f600 {
218*724ba675SRob Herring			compatible = "sunplus,sp7021-spi";
219*724ba675SRob Herring			reg = <0xf600 0x80>, <0xf680 0x80>;
220*724ba675SRob Herring			reg-names = "master", "slave";
221*724ba675SRob Herring			interrupts = <70 IRQ_TYPE_LEVEL_HIGH>,
222*724ba675SRob Herring				     <72 IRQ_TYPE_LEVEL_HIGH>,
223*724ba675SRob Herring				     <71 IRQ_TYPE_LEVEL_HIGH>;
224*724ba675SRob Herring			interrupt-names = "dma_w", "master_risc", "slave_risc";
225*724ba675SRob Herring			clocks = <&clkc CLK_SPI_COMBO_2>;
226*724ba675SRob Herring			resets = <&rstc RST_SPI_COMBO_2>;
227*724ba675SRob Herring			status = "disabled";
228*724ba675SRob Herring		};
229*724ba675SRob Herring
230*724ba675SRob Herring		spi_controller3: spi@f780 {
231*724ba675SRob Herring			compatible = "sunplus,sp7021-spi";
232*724ba675SRob Herring			reg = <0xf780 0x80>, <0xf800 0x80>;
233*724ba675SRob Herring			reg-names = "master", "slave";
234*724ba675SRob Herring			interrupts = <73 IRQ_TYPE_LEVEL_HIGH>,
235*724ba675SRob Herring				     <75 IRQ_TYPE_LEVEL_HIGH>,
236*724ba675SRob Herring				     <74 IRQ_TYPE_LEVEL_HIGH>;
237*724ba675SRob Herring			interrupt-names = "dma_w", "master_risc", "slave_risc";
238*724ba675SRob Herring			clocks = <&clkc CLK_SPI_COMBO_3>;
239*724ba675SRob Herring			resets = <&rstc RST_SPI_COMBO_3>;
240*724ba675SRob Herring			status = "disabled";
241*724ba675SRob Herring		};
242*724ba675SRob Herring
243*724ba675SRob Herring		uart0: serial@900 {
244*724ba675SRob Herring			compatible = "sunplus,sp7021-uart";
245*724ba675SRob Herring			reg = <0x900 0x80>;
246*724ba675SRob Herring			interrupts = <53 IRQ_TYPE_LEVEL_HIGH>;
247*724ba675SRob Herring			clocks = <&clkc CLK_UA0>;
248*724ba675SRob Herring			resets = <&rstc RST_UA0>;
249*724ba675SRob Herring			pinctrl-names = "default";
250*724ba675SRob Herring			pinctrl-0 = <&uart0_pins>;
251*724ba675SRob Herring		};
252*724ba675SRob Herring
253*724ba675SRob Herring		uart1: serial@980 {
254*724ba675SRob Herring			compatible = "sunplus,sp7021-uart";
255*724ba675SRob Herring			reg = <0x980 0x80>;
256*724ba675SRob Herring			interrupts = <54 IRQ_TYPE_LEVEL_HIGH>;
257*724ba675SRob Herring			clocks = <&clkc CLK_UA1>;
258*724ba675SRob Herring			resets = <&rstc RST_UA1>;
259*724ba675SRob Herring			pinctrl-names = "default";
260*724ba675SRob Herring			pinctrl-0 = <&uart1_pins>;
261*724ba675SRob Herring			status = "disabled";
262*724ba675SRob Herring		};
263*724ba675SRob Herring
264*724ba675SRob Herring		uart2: serial@800 {
265*724ba675SRob Herring			compatible = "sunplus,sp7021-uart";
266*724ba675SRob Herring			reg = <0x800 0x80>;
267*724ba675SRob Herring			interrupts = <55 IRQ_TYPE_LEVEL_HIGH>;
268*724ba675SRob Herring			clocks = <&clkc CLK_UA2>;
269*724ba675SRob Herring			resets = <&rstc RST_UA2>;
270*724ba675SRob Herring			pinctrl-names = "default";
271*724ba675SRob Herring			pinctrl-0 = <&uart2_pins>;
272*724ba675SRob Herring			status = "disabled";
273*724ba675SRob Herring		};
274*724ba675SRob Herring
275*724ba675SRob Herring		uart3: serial@880 {
276*724ba675SRob Herring			compatible = "sunplus,sp7021-uart";
277*724ba675SRob Herring			reg = <0x880 0x80>;
278*724ba675SRob Herring			interrupts = <56 IRQ_TYPE_LEVEL_HIGH>;
279*724ba675SRob Herring			clocks = <&clkc CLK_UA3>;
280*724ba675SRob Herring			resets = <&rstc RST_UA3>;
281*724ba675SRob Herring			status = "disabled";
282*724ba675SRob Herring		};
283*724ba675SRob Herring
284*724ba675SRob Herring		uart4: serial@8780 {
285*724ba675SRob Herring			compatible = "sunplus,sp7021-uart";
286*724ba675SRob Herring			reg = <0x8780 0x80>;
287*724ba675SRob Herring			interrupts = <134 IRQ_TYPE_LEVEL_HIGH>;
288*724ba675SRob Herring			clocks = <&clkc CLK_UA4>;
289*724ba675SRob Herring			resets = <&rstc RST_UA4>;
290*724ba675SRob Herring			pinctrl-names = "default";
291*724ba675SRob Herring			pinctrl-0 = <&uart4_pins>;
292*724ba675SRob Herring			status = "disabled";
293*724ba675SRob Herring		};
294*724ba675SRob Herring	};
295*724ba675SRob Herring
296*724ba675SRob Herring	leds {
297*724ba675SRob Herring		compatible = "gpio-leds";
298*724ba675SRob Herring		pinctrl-names = "default";
299*724ba675SRob Herring		pinctrl-0 = <&leds_pins>;
300*724ba675SRob Herring		system-led {
301*724ba675SRob Herring			label = "system-led";
302*724ba675SRob Herring			gpios = <&pctl 0 GPIO_ACTIVE_HIGH>;
303*724ba675SRob Herring			default-state = "off";
304*724ba675SRob Herring			linux,default-trigger = "heartbeat";
305*724ba675SRob Herring		};
306*724ba675SRob Herring	};
307*724ba675SRob Herring};
308