diff options
author | Matteo Facchinetti <matteo.facchinetti@sirius-es.it> | 2013-04-03 23:57:30 -0400 |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2013-04-10 14:37:43 -0400 |
commit | a9b6aae496801236cb65d9d5786dba797680cbea (patch) | |
tree | dd6c7be3512aa5c13267ea669d1f420d95daeded /arch | |
parent | b9e7196ecdf6d7cd7a41b560e596c9af94413c05 (diff) |
powerpc/mpc512x: add platform code for MPC5125.
Tested on MPC5125 Tower evaluation board with
mpc512x_defconfig compile configuration.
In detail, supports for:
- PSC / UART
- RTC
- ETH
- DIU
- I2C
Signed-off-by: Matteo Facchinetti <matteo.facchinetti@sirius-es.it>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/boot/dts/mpc5121ads.dts | 2 | ||||
-rw-r--r-- | arch/powerpc/boot/dts/mpc5125twr.dts | 233 | ||||
-rw-r--r-- | arch/powerpc/boot/dts/pdm360ng.dts | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/512x/clock.c | 9 | ||||
-rw-r--r-- | arch/powerpc/platforms/512x/mpc512x.h | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/512x/mpc512x_generic.c | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/512x/mpc512x_shared.c | 20 |
7 files changed, 264 insertions, 4 deletions
diff --git a/arch/powerpc/boot/dts/mpc5121ads.dts b/arch/powerpc/boot/dts/mpc5121ads.dts index f269b1382ef7..7d3cb79185cb 100644 --- a/arch/powerpc/boot/dts/mpc5121ads.dts +++ b/arch/powerpc/boot/dts/mpc5121ads.dts | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | / { | 14 | / { |
15 | model = "mpc5121ads"; | 15 | model = "mpc5121ads"; |
16 | compatible = "fsl,mpc5121ads"; | 16 | compatible = "fsl,mpc5121ads", "fsl,mpc5121"; |
17 | 17 | ||
18 | nfc@40000000 { | 18 | nfc@40000000 { |
19 | /* | 19 | /* |
diff --git a/arch/powerpc/boot/dts/mpc5125twr.dts b/arch/powerpc/boot/dts/mpc5125twr.dts new file mode 100644 index 000000000000..4177b62240c2 --- /dev/null +++ b/arch/powerpc/boot/dts/mpc5125twr.dts | |||
@@ -0,0 +1,233 @@ | |||
1 | /* | ||
2 | * STx/Freescale ADS5125 MPC5125 silicon | ||
3 | * | ||
4 | * Copyright (C) 2009 Freescale Semiconductor Inc. All rights reserved. | ||
5 | * | ||
6 | * Reworked by Matteo Facchinetti (engineering@sirius-es.it) | ||
7 | * Copyright (C) 2013 Sirius Electronic Systems | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | */ | ||
14 | |||
15 | /dts-v1/; | ||
16 | |||
17 | / { | ||
18 | model = "mpc5125twr"; // In BSP "mpc5125ads" | ||
19 | compatible = "fsl,mpc5125ads", "fsl,mpc5125"; | ||
20 | #address-cells = <1>; | ||
21 | #size-cells = <1>; | ||
22 | interrupt-parent = <&ipic>; | ||
23 | |||
24 | aliases { | ||
25 | gpio0 = &gpio0; | ||
26 | gpio1 = &gpio1; | ||
27 | ethernet0 = ð0; | ||
28 | }; | ||
29 | |||
30 | cpus { | ||
31 | #address-cells = <1>; | ||
32 | #size-cells = <0>; | ||
33 | |||
34 | PowerPC,5125@0 { | ||
35 | device_type = "cpu"; | ||
36 | reg = <0>; | ||
37 | d-cache-line-size = <0x20>; // 32 bytes | ||
38 | i-cache-line-size = <0x20>; // 32 bytes | ||
39 | d-cache-size = <0x8000>; // L1, 32K | ||
40 | i-cache-size = <0x8000>; // L1, 32K | ||
41 | timebase-frequency = <49500000>;// 49.5 MHz (csb/4) | ||
42 | bus-frequency = <198000000>; // 198 MHz csb bus | ||
43 | clock-frequency = <396000000>; // 396 MHz ppc core | ||
44 | }; | ||
45 | }; | ||
46 | |||
47 | memory { | ||
48 | device_type = "memory"; | ||
49 | reg = <0x00000000 0x10000000>; // 256MB at 0 | ||
50 | }; | ||
51 | |||
52 | sram@30000000 { | ||
53 | compatible = "fsl,mpc5121-sram"; | ||
54 | reg = <0x30000000 0x08000>; // 32K at 0x30000000 | ||
55 | }; | ||
56 | |||
57 | soc@80000000 { | ||
58 | compatible = "fsl,mpc5121-immr"; | ||
59 | #address-cells = <1>; | ||
60 | #size-cells = <1>; | ||
61 | #interrupt-cells = <2>; | ||
62 | ranges = <0x0 0x80000000 0x400000>; | ||
63 | reg = <0x80000000 0x400000>; | ||
64 | bus-frequency = <66000000>; // 66 MHz ips bus | ||
65 | |||
66 | // IPIC | ||
67 | // interrupts cell = <intr #, sense> | ||
68 | // sense values match linux IORESOURCE_IRQ_* defines: | ||
69 | // sense == 8: Level, low assertion | ||
70 | // sense == 2: Edge, high-to-low change | ||
71 | // | ||
72 | ipic: interrupt-controller@c00 { | ||
73 | compatible = "fsl,mpc5121-ipic", "fsl,ipic"; | ||
74 | interrupt-controller; | ||
75 | #address-cells = <0>; | ||
76 | #interrupt-cells = <2>; | ||
77 | reg = <0xc00 0x100>; | ||
78 | }; | ||
79 | |||
80 | rtc@a00 { // Real time clock | ||
81 | compatible = "fsl,mpc5121-rtc"; | ||
82 | reg = <0xa00 0x100>; | ||
83 | interrupts = <79 0x8 80 0x8>; | ||
84 | }; | ||
85 | |||
86 | reset@e00 { // Reset module | ||
87 | compatible = "fsl,mpc5125-reset"; | ||
88 | reg = <0xe00 0x100>; | ||
89 | }; | ||
90 | |||
91 | clock@f00 { // Clock control | ||
92 | compatible = "fsl,mpc5121-clock"; | ||
93 | reg = <0xf00 0x100>; | ||
94 | }; | ||
95 | |||
96 | pmc@1000{ // Power Management Controller | ||
97 | compatible = "fsl,mpc5121-pmc"; | ||
98 | reg = <0x1000 0x100>; | ||
99 | interrupts = <83 0x2>; | ||
100 | }; | ||
101 | |||
102 | gpio0: gpio@1100 { | ||
103 | compatible = "fsl,mpc5125-gpio"; | ||
104 | reg = <0x1100 0x080>; | ||
105 | interrupts = <78 0x8>; | ||
106 | }; | ||
107 | |||
108 | gpio1: gpio@1180 { | ||
109 | compatible = "fsl,mpc5125-gpio"; | ||
110 | reg = <0x1180 0x080>; | ||
111 | interrupts = <86 0x8>; | ||
112 | }; | ||
113 | |||
114 | can@1300 { // CAN rev.2 | ||
115 | compatible = "fsl,mpc5121-mscan"; | ||
116 | interrupts = <12 0x8>; | ||
117 | reg = <0x1300 0x80>; | ||
118 | }; | ||
119 | |||
120 | can@1380 { | ||
121 | compatible = "fsl,mpc5121-mscan"; | ||
122 | interrupts = <13 0x8>; | ||
123 | reg = <0x1380 0x80>; | ||
124 | }; | ||
125 | |||
126 | sdhc@1500 { | ||
127 | compatible = "fsl,mpc5121-sdhc"; | ||
128 | interrupts = <8 0x8>; | ||
129 | reg = <0x1500 0x100>; | ||
130 | }; | ||
131 | |||
132 | i2c@1700 { | ||
133 | #address-cells = <1>; | ||
134 | #size-cells = <0>; | ||
135 | compatible = "fsl,mpc5121-i2c", "fsl-i2c"; | ||
136 | reg = <0x1700 0x20>; | ||
137 | interrupts = <0x9 0x8>; | ||
138 | }; | ||
139 | |||
140 | i2c@1720 { | ||
141 | #address-cells = <1>; | ||
142 | #size-cells = <0>; | ||
143 | compatible = "fsl,mpc5121-i2c", "fsl-i2c"; | ||
144 | reg = <0x1720 0x20>; | ||
145 | interrupts = <0xa 0x8>; | ||
146 | }; | ||
147 | |||
148 | i2c@1740 { | ||
149 | #address-cells = <1>; | ||
150 | #size-cells = <0>; | ||
151 | compatible = "fsl,mpc5121-i2c", "fsl-i2c"; | ||
152 | reg = <0x1740 0x20>; | ||
153 | interrupts = <0xb 0x8>; | ||
154 | }; | ||
155 | |||
156 | i2ccontrol@1760 { | ||
157 | compatible = "fsl,mpc5121-i2c-ctrl"; | ||
158 | reg = <0x1760 0x8>; | ||
159 | }; | ||
160 | |||
161 | diu@2100 { | ||
162 | compatible = "fsl,mpc5121-diu"; | ||
163 | reg = <0x2100 0x100>; | ||
164 | interrupts = <64 0x8>; | ||
165 | }; | ||
166 | |||
167 | mdio@2800 { | ||
168 | compatible = "fsl,mpc5121-fec-mdio"; | ||
169 | reg = <0x2800 0x800>; | ||
170 | #address-cells = <1>; | ||
171 | #size-cells = <0>; | ||
172 | phy0: ethernet-phy@0 { | ||
173 | reg = <1>; | ||
174 | }; | ||
175 | }; | ||
176 | |||
177 | eth0: ethernet@2800 { | ||
178 | compatible = "fsl,mpc5125-fec"; | ||
179 | reg = <0x2800 0x800>; | ||
180 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
181 | interrupts = <4 0x8>; | ||
182 | phy-handle = < &phy0 >; | ||
183 | phy-connection-type = "rmii"; | ||
184 | }; | ||
185 | |||
186 | // IO control | ||
187 | ioctl@a000 { | ||
188 | compatible = "fsl,mpc5125-ioctl"; | ||
189 | reg = <0xA000 0x1000>; | ||
190 | }; | ||
191 | |||
192 | usb@3000 { | ||
193 | compatible = "fsl,mpc5121-usb2-dr"; | ||
194 | reg = <0x3000 0x400>; | ||
195 | #address-cells = <1>; | ||
196 | #size-cells = <0>; | ||
197 | interrupts = <43 0x8>; | ||
198 | dr_mode = "host"; | ||
199 | phy_type = "ulpi"; | ||
200 | }; | ||
201 | |||
202 | // 5125 PSCs are not 52xx or 5121 PSC compatible | ||
203 | // PSC1 uart0 aka ttyPSC0 | ||
204 | serial@11100 { | ||
205 | compatible = "fsl,mpc5125-psc-uart", "fsl,mpc5125-psc"; | ||
206 | reg = <0x11100 0x100>; | ||
207 | interrupts = <40 0x8>; | ||
208 | fsl,rx-fifo-size = <16>; | ||
209 | fsl,tx-fifo-size = <16>; | ||
210 | }; | ||
211 | |||
212 | // PSC9 uart1 aka ttyPSC1 | ||
213 | serial@11900 { | ||
214 | compatible = "fsl,mpc5125-psc-uart", "fsl,mpc5125-psc"; | ||
215 | reg = <0x11900 0x100>; | ||
216 | interrupts = <40 0x8>; | ||
217 | fsl,rx-fifo-size = <16>; | ||
218 | fsl,tx-fifo-size = <16>; | ||
219 | }; | ||
220 | |||
221 | pscfifo@11f00 { | ||
222 | compatible = "fsl,mpc5121-psc-fifo"; | ||
223 | reg = <0x11f00 0x100>; | ||
224 | interrupts = <40 0x8>; | ||
225 | }; | ||
226 | |||
227 | dma@14000 { | ||
228 | compatible = "fsl,mpc5121-dma"; // BSP name: "mpc512x-dma2" | ||
229 | reg = <0x14000 0x1800>; | ||
230 | interrupts = <65 0x8>; | ||
231 | }; | ||
232 | }; | ||
233 | }; | ||
diff --git a/arch/powerpc/boot/dts/pdm360ng.dts b/arch/powerpc/boot/dts/pdm360ng.dts index 0b069477838a..74337403faee 100644 --- a/arch/powerpc/boot/dts/pdm360ng.dts +++ b/arch/powerpc/boot/dts/pdm360ng.dts | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | / { | 18 | / { |
19 | model = "pdm360ng"; | 19 | model = "pdm360ng"; |
20 | compatible = "ifm,pdm360ng"; | 20 | compatible = "ifm,pdm360ng", "fsl,mpc5121"; |
21 | #address-cells = <1>; | 21 | #address-cells = <1>; |
22 | #size-cells = <1>; | 22 | #size-cells = <1>; |
23 | interrupt-parent = <&ipic>; | 23 | interrupt-parent = <&ipic>; |
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c index 52d57d281724..e504166e089a 100644 --- a/arch/powerpc/platforms/512x/clock.c +++ b/arch/powerpc/platforms/512x/clock.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include <asm/mpc5121.h> | 29 | #include <asm/mpc5121.h> |
30 | #include <asm/clk_interface.h> | 30 | #include <asm/clk_interface.h> |
31 | 31 | ||
32 | #include "mpc512x.h" | ||
33 | |||
32 | #undef CLK_DEBUG | 34 | #undef CLK_DEBUG |
33 | 35 | ||
34 | static int clocks_initialized; | 36 | static int clocks_initialized; |
@@ -683,8 +685,13 @@ static void psc_clks_init(void) | |||
683 | struct device_node *np; | 685 | struct device_node *np; |
684 | struct platform_device *ofdev; | 686 | struct platform_device *ofdev; |
685 | u32 reg; | 687 | u32 reg; |
688 | const char *psc_compat; | ||
689 | |||
690 | psc_compat = mpc512x_select_psc_compat(); | ||
691 | if (!psc_compat) | ||
692 | return; | ||
686 | 693 | ||
687 | for_each_compatible_node(np, NULL, "fsl,mpc5121-psc") { | 694 | for_each_compatible_node(np, NULL, psc_compat) { |
688 | if (!of_property_read_u32(np, "reg", ®)) { | 695 | if (!of_property_read_u32(np, "reg", ®)) { |
689 | int pscnum = (reg & 0xf00) >> 8; | 696 | int pscnum = (reg & 0xf00) >> 8; |
690 | struct clk *clk = psc_dev_clk(pscnum); | 697 | struct clk *clk = psc_dev_clk(pscnum); |
diff --git a/arch/powerpc/platforms/512x/mpc512x.h b/arch/powerpc/platforms/512x/mpc512x.h index c32b399eb952..0a8e60023944 100644 --- a/arch/powerpc/platforms/512x/mpc512x.h +++ b/arch/powerpc/platforms/512x/mpc512x.h | |||
@@ -15,6 +15,7 @@ extern void __init mpc512x_init_IRQ(void); | |||
15 | extern void __init mpc512x_init(void); | 15 | extern void __init mpc512x_init(void); |
16 | extern int __init mpc5121_clk_init(void); | 16 | extern int __init mpc5121_clk_init(void); |
17 | void __init mpc512x_declare_of_platform_devices(void); | 17 | void __init mpc512x_declare_of_platform_devices(void); |
18 | extern const char *mpc512x_select_psc_compat(void); | ||
18 | extern void mpc512x_restart(char *cmd); | 19 | extern void mpc512x_restart(char *cmd); |
19 | 20 | ||
20 | #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) | 21 | #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) |
diff --git a/arch/powerpc/platforms/512x/mpc512x_generic.c b/arch/powerpc/platforms/512x/mpc512x_generic.c index d53fa4fdff26..6dfcb5138990 100644 --- a/arch/powerpc/platforms/512x/mpc512x_generic.c +++ b/arch/powerpc/platforms/512x/mpc512x_generic.c | |||
@@ -28,6 +28,7 @@ | |||
28 | */ | 28 | */ |
29 | static const char * const board[] __initconst = { | 29 | static const char * const board[] __initconst = { |
30 | "prt,prtlvt", | 30 | "prt,prtlvt", |
31 | "fsl,mpc5125ads", | ||
31 | NULL | 32 | NULL |
32 | }; | 33 | }; |
33 | 34 | ||
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c index 2765cd1c7678..7642cd7aad73 100644 --- a/arch/powerpc/platforms/512x/mpc512x_shared.c +++ b/arch/powerpc/platforms/512x/mpc512x_shared.c | |||
@@ -347,6 +347,17 @@ void __init mpc512x_declare_of_platform_devices(void) | |||
347 | 347 | ||
348 | #define DEFAULT_FIFO_SIZE 16 | 348 | #define DEFAULT_FIFO_SIZE 16 |
349 | 349 | ||
350 | const char *mpc512x_select_psc_compat(void) | ||
351 | { | ||
352 | if (of_machine_is_compatible("fsl,mpc5121")) | ||
353 | return "fsl,mpc5121-psc"; | ||
354 | |||
355 | if (of_machine_is_compatible("fsl,mpc5125")) | ||
356 | return "fsl,mpc5125-psc"; | ||
357 | |||
358 | return NULL; | ||
359 | } | ||
360 | |||
350 | static unsigned int __init get_fifo_size(struct device_node *np, | 361 | static unsigned int __init get_fifo_size(struct device_node *np, |
351 | char *prop_name) | 362 | char *prop_name) |
352 | { | 363 | { |
@@ -372,9 +383,16 @@ void __init mpc512x_psc_fifo_init(void) | |||
372 | void __iomem *psc; | 383 | void __iomem *psc; |
373 | unsigned int tx_fifo_size; | 384 | unsigned int tx_fifo_size; |
374 | unsigned int rx_fifo_size; | 385 | unsigned int rx_fifo_size; |
386 | const char *psc_compat; | ||
375 | int fifobase = 0; /* current fifo address in 32 bit words */ | 387 | int fifobase = 0; /* current fifo address in 32 bit words */ |
376 | 388 | ||
377 | for_each_compatible_node(np, NULL, "fsl,mpc5121-psc") { | 389 | psc_compat = mpc512x_select_psc_compat(); |
390 | if (!psc_compat) { | ||
391 | pr_err("%s: no compatible devices found\n", __func__); | ||
392 | return; | ||
393 | } | ||
394 | |||
395 | for_each_compatible_node(np, NULL, psc_compat) { | ||
378 | tx_fifo_size = get_fifo_size(np, "fsl,tx-fifo-size"); | 396 | tx_fifo_size = get_fifo_size(np, "fsl,tx-fifo-size"); |
379 | rx_fifo_size = get_fifo_size(np, "fsl,rx-fifo-size"); | 397 | rx_fifo_size = get_fifo_size(np, "fsl,rx-fifo-size"); |
380 | 398 | ||