aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/83xx/Kconfig8
-rw-r--r--arch/powerpc/platforms/83xx/Makefile1
-rw-r--r--arch/powerpc/platforms/83xx/mpc830x_rdb.c94
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig8
-rw-r--r--arch/powerpc/platforms/85xx/Makefile1
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c279
-rw-r--r--arch/powerpc/platforms/85xx/p1022_ds.c148
-rw-r--r--arch/powerpc/platforms/85xx/smp.c63
-rw-r--r--arch/powerpc/platforms/85xx/tqm85xx.c21
-rw-r--r--arch/powerpc/platforms/8xx/Kconfig6
-rw-r--r--arch/powerpc/platforms/8xx/Makefile1
-rw-r--r--arch/powerpc/platforms/8xx/tqm8xx_setup.c156
12 files changed, 669 insertions, 117 deletions
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig
index f49a2548c5f..021763a32c2 100644
--- a/arch/powerpc/platforms/83xx/Kconfig
+++ b/arch/powerpc/platforms/83xx/Kconfig
@@ -9,6 +9,14 @@ menuconfig PPC_83xx
9 9
10if PPC_83xx 10if PPC_83xx
11 11
12config MPC830x_RDB
13 bool "Freescale MPC830x RDB"
14 select DEFAULT_UIMAGE
15 select PPC_MPC831x
16 select FSL_GTM
17 help
18 This option enables support for the MPC8308 RDB board.
19
12config MPC831x_RDB 20config MPC831x_RDB
13 bool "Freescale MPC831x RDB" 21 bool "Freescale MPC831x RDB"
14 select DEFAULT_UIMAGE 22 select DEFAULT_UIMAGE
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
index e139c36572e..6e8bbbbcfdf 100644
--- a/arch/powerpc/platforms/83xx/Makefile
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -4,6 +4,7 @@
4obj-y := misc.o usb.o 4obj-y := misc.o usb.o
5obj-$(CONFIG_SUSPEND) += suspend.o suspend-asm.o 5obj-$(CONFIG_SUSPEND) += suspend.o suspend-asm.o
6obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o 6obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o
7obj-$(CONFIG_MPC830x_RDB) += mpc830x_rdb.o
7obj-$(CONFIG_MPC831x_RDB) += mpc831x_rdb.o 8obj-$(CONFIG_MPC831x_RDB) += mpc831x_rdb.o
8obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o 9obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o
9obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o 10obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o
diff --git a/arch/powerpc/platforms/83xx/mpc830x_rdb.c b/arch/powerpc/platforms/83xx/mpc830x_rdb.c
new file mode 100644
index 00000000000..ac102ee9abe
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/mpc830x_rdb.c
@@ -0,0 +1,94 @@
1/*
2 * arch/powerpc/platforms/83xx/mpc830x_rdb.c
3 *
4 * Description: MPC830x RDB board specific routines.
5 * This file is based on mpc831x_rdb.c
6 *
7 * Copyright (C) Freescale Semiconductor, Inc. 2009. All rights reserved.
8 * Copyright (C) 2010. Ilya Yanok, Emcraft Systems, yanok@emcraft.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/pci.h>
17#include <linux/of_platform.h>
18#include <asm/time.h>
19#include <asm/ipic.h>
20#include <asm/udbg.h>
21#include <sysdev/fsl_pci.h>
22#include <sysdev/fsl_soc.h>
23#include "mpc83xx.h"
24
25/*
26 * Setup the architecture
27 */
28static void __init mpc830x_rdb_setup_arch(void)
29{
30#ifdef CONFIG_PCI
31 struct device_node *np;
32#endif
33
34 if (ppc_md.progress)
35 ppc_md.progress("mpc830x_rdb_setup_arch()", 0);
36
37#ifdef CONFIG_PCI
38 for_each_compatible_node(np, "pci", "fsl,mpc8308-pcie")
39 mpc83xx_add_bridge(np);
40#endif
41 mpc831x_usb_cfg();
42}
43
44static void __init mpc830x_rdb_init_IRQ(void)
45{
46 struct device_node *np;
47
48 np = of_find_node_by_type(NULL, "ipic");
49 if (!np)
50 return;
51
52 ipic_init(np, 0);
53
54 /* Initialize the default interrupt mapping priorities,
55 * in case the boot rom changed something on us.
56 */
57 ipic_set_default_priority();
58}
59
60/*
61 * Called very early, MMU is off, device-tree isn't unflattened
62 */
63static int __init mpc830x_rdb_probe(void)
64{
65 unsigned long root = of_get_flat_dt_root();
66
67 return of_flat_dt_is_compatible(root, "MPC8308RDB") ||
68 of_flat_dt_is_compatible(root, "fsl,mpc8308rdb");
69}
70
71static struct of_device_id __initdata of_bus_ids[] = {
72 { .compatible = "simple-bus" },
73 { .compatible = "gianfar" },
74 {},
75};
76
77static int __init declare_of_platform_devices(void)
78{
79 of_platform_bus_probe(NULL, of_bus_ids, NULL);
80 return 0;
81}
82machine_device_initcall(mpc830x_rdb, declare_of_platform_devices);
83
84define_machine(mpc830x_rdb) {
85 .name = "MPC830x RDB",
86 .probe = mpc830x_rdb_probe,
87 .setup_arch = mpc830x_rdb_setup_arch,
88 .init_IRQ = mpc830x_rdb_init_IRQ,
89 .get_irq = ipic_get_irq,
90 .restart = mpc83xx_restart,
91 .time_init = mpc83xx_time_init,
92 .calibrate_decr = generic_calibrate_decr,
93 .progress = udbg_progress,
94};
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index 3a2ade2e443..bea1f5905ad 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -65,6 +65,14 @@ config MPC85xx_RDB
65 help 65 help
66 This option enables support for the MPC85xx RDB (P2020 RDB) board 66 This option enables support for the MPC85xx RDB (P2020 RDB) board
67 67
68config P1022_DS
69 bool "Freescale P1022 DS"
70 select DEFAULT_UIMAGE
71 select CONFIG_PHYS_64BIT # The DTS has 36-bit addresses
72 select SWIOTLB
73 help
74 This option enables support for the Freescale P1022DS reference board.
75
68config SOCRATES 76config SOCRATES
69 bool "Socrates" 77 bool "Socrates"
70 select DEFAULT_UIMAGE 78 select DEFAULT_UIMAGE
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index 387c128f2c8..a2ec3f8f4d0 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_MPC8536_DS) += mpc8536_ds.o
10obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o 10obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o
11obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o 11obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
12obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o 12obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o
13obj-$(CONFIG_P1022_DS) += p1022_ds.o
13obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o 14obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o
14obj-$(CONFIG_STX_GP3) += stx_gp3.o 15obj-$(CONFIG_STX_GP3) += stx_gp3.o
15obj-$(CONFIG_TQM85xx) += tqm85xx.o 16obj-$(CONFIG_TQM85xx) += tqm85xx.o
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 494513682d7..da64be19d09 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -158,51 +158,108 @@ static int mpc8568_mds_phy_fixups(struct phy_device *phydev)
158extern void __init mpc85xx_smp_init(void); 158extern void __init mpc85xx_smp_init(void);
159#endif 159#endif
160 160
161static void __init mpc85xx_mds_setup_arch(void) 161#ifdef CONFIG_QUICC_ENGINE
162static struct of_device_id mpc85xx_qe_ids[] __initdata = {
163 { .type = "qe", },
164 { .compatible = "fsl,qe", },
165 { },
166};
167
168static void __init mpc85xx_publish_qe_devices(void)
162{ 169{
163 struct device_node *np; 170 struct device_node *np;
164 static u8 __iomem *bcsr_regs = NULL;
165#ifdef CONFIG_PCI
166 struct pci_controller *hose;
167#endif
168 dma_addr_t max = 0xffffffff;
169 171
170 if (ppc_md.progress) 172 np = of_find_compatible_node(NULL, NULL, "fsl,qe");
171 ppc_md.progress("mpc85xx_mds_setup_arch()", 0); 173 if (!of_device_is_available(np)) {
174 of_node_put(np);
175 return;
176 }
177
178 of_platform_bus_probe(NULL, mpc85xx_qe_ids, NULL);
179}
180
181static void __init mpc85xx_mds_reset_ucc_phys(void)
182{
183 struct device_node *np;
184 static u8 __iomem *bcsr_regs;
172 185
173 /* Map BCSR area */ 186 /* Map BCSR area */
174 np = of_find_node_by_name(NULL, "bcsr"); 187 np = of_find_node_by_name(NULL, "bcsr");
175 if (np != NULL) { 188 if (!np)
176 struct resource res; 189 return;
177 190
178 of_address_to_resource(np, 0, &res); 191 bcsr_regs = of_iomap(np, 0);
179 bcsr_regs = ioremap(res.start, res.end - res.start +1); 192 of_node_put(np);
180 of_node_put(np); 193 if (!bcsr_regs)
181 } 194 return;
182 195
183#ifdef CONFIG_PCI 196 if (machine_is(mpc8568_mds)) {
184 for_each_node_by_type(np, "pci") { 197#define BCSR_UCC1_GETH_EN (0x1 << 7)
185 if (of_device_is_compatible(np, "fsl,mpc8540-pci") || 198#define BCSR_UCC2_GETH_EN (0x1 << 7)
186 of_device_is_compatible(np, "fsl,mpc8548-pcie")) { 199#define BCSR_UCC1_MODE_MSK (0x3 << 4)
187 struct resource rsrc; 200#define BCSR_UCC2_MODE_MSK (0x3 << 0)
188 of_address_to_resource(np, 0, &rsrc);
189 if ((rsrc.start & 0xfffff) == 0x8000)
190 fsl_add_bridge(np, 1);
191 else
192 fsl_add_bridge(np, 0);
193 201
194 hose = pci_find_hose_for_OF_device(np); 202 /* Turn off UCC1 & UCC2 */
195 max = min(max, hose->dma_window_base_cur + 203 clrbits8(&bcsr_regs[8], BCSR_UCC1_GETH_EN);
196 hose->dma_window_size); 204 clrbits8(&bcsr_regs[9], BCSR_UCC2_GETH_EN);
205
206 /* Mode is RGMII, all bits clear */
207 clrbits8(&bcsr_regs[11], BCSR_UCC1_MODE_MSK |
208 BCSR_UCC2_MODE_MSK);
209
210 /* Turn UCC1 & UCC2 on */
211 setbits8(&bcsr_regs[8], BCSR_UCC1_GETH_EN);
212 setbits8(&bcsr_regs[9], BCSR_UCC2_GETH_EN);
213 } else if (machine_is(mpc8569_mds)) {
214#define BCSR7_UCC12_GETHnRST (0x1 << 2)
215#define BCSR8_UEM_MARVELL_RST (0x1 << 1)
216#define BCSR_UCC_RGMII (0x1 << 6)
217#define BCSR_UCC_RTBI (0x1 << 5)
218 /*
219 * U-Boot mangles interrupt polarity for Marvell PHYs,
220 * so reset built-in and UEM Marvell PHYs, this puts
221 * the PHYs into their normal state.
222 */
223 clrbits8(&bcsr_regs[7], BCSR7_UCC12_GETHnRST);
224 setbits8(&bcsr_regs[8], BCSR8_UEM_MARVELL_RST);
225
226 setbits8(&bcsr_regs[7], BCSR7_UCC12_GETHnRST);
227 clrbits8(&bcsr_regs[8], BCSR8_UEM_MARVELL_RST);
228
229 for (np = NULL; (np = of_find_compatible_node(np,
230 "network",
231 "ucc_geth")) != NULL;) {
232 const unsigned int *prop;
233 int ucc_num;
234
235 prop = of_get_property(np, "cell-index", NULL);
236 if (prop == NULL)
237 continue;
238
239 ucc_num = *prop - 1;
240
241 prop = of_get_property(np, "phy-connection-type", NULL);
242 if (prop == NULL)
243 continue;
244
245 if (strcmp("rtbi", (const char *)prop) == 0)
246 clrsetbits_8(&bcsr_regs[7 + ucc_num],
247 BCSR_UCC_RGMII, BCSR_UCC_RTBI);
197 } 248 }
249 } else if (machine_is(p1021_mds)) {
250#define BCSR11_ENET_MICRST (0x1 << 5)
251 /* Reset Micrel PHY */
252 clrbits8(&bcsr_regs[11], BCSR11_ENET_MICRST);
253 setbits8(&bcsr_regs[11], BCSR11_ENET_MICRST);
198 } 254 }
199#endif
200 255
201#ifdef CONFIG_SMP 256 iounmap(bcsr_regs);
202 mpc85xx_smp_init(); 257}
203#endif 258
259static void __init mpc85xx_mds_qe_init(void)
260{
261 struct device_node *np;
204 262
205#ifdef CONFIG_QUICC_ENGINE
206 np = of_find_compatible_node(NULL, NULL, "fsl,qe"); 263 np = of_find_compatible_node(NULL, NULL, "fsl,qe");
207 if (!np) { 264 if (!np) {
208 np = of_find_node_by_name(NULL, "qe"); 265 np = of_find_node_by_name(NULL, "qe");
@@ -210,6 +267,11 @@ static void __init mpc85xx_mds_setup_arch(void)
210 return; 267 return;
211 } 268 }
212 269
270 if (!of_device_is_available(np)) {
271 of_node_put(np);
272 return;
273 }
274
213 qe_reset(); 275 qe_reset();
214 of_node_put(np); 276 of_node_put(np);
215 277
@@ -224,70 +286,7 @@ static void __init mpc85xx_mds_setup_arch(void)
224 par_io_of_config(ucc); 286 par_io_of_config(ucc);
225 } 287 }
226 288
227 if (bcsr_regs) { 289 mpc85xx_mds_reset_ucc_phys();
228 if (machine_is(mpc8568_mds)) {
229#define BCSR_UCC1_GETH_EN (0x1 << 7)
230#define BCSR_UCC2_GETH_EN (0x1 << 7)
231#define BCSR_UCC1_MODE_MSK (0x3 << 4)
232#define BCSR_UCC2_MODE_MSK (0x3 << 0)
233
234 /* Turn off UCC1 & UCC2 */
235 clrbits8(&bcsr_regs[8], BCSR_UCC1_GETH_EN);
236 clrbits8(&bcsr_regs[9], BCSR_UCC2_GETH_EN);
237
238 /* Mode is RGMII, all bits clear */
239 clrbits8(&bcsr_regs[11], BCSR_UCC1_MODE_MSK |
240 BCSR_UCC2_MODE_MSK);
241
242 /* Turn UCC1 & UCC2 on */
243 setbits8(&bcsr_regs[8], BCSR_UCC1_GETH_EN);
244 setbits8(&bcsr_regs[9], BCSR_UCC2_GETH_EN);
245 } else if (machine_is(mpc8569_mds)) {
246#define BCSR7_UCC12_GETHnRST (0x1 << 2)
247#define BCSR8_UEM_MARVELL_RST (0x1 << 1)
248#define BCSR_UCC_RGMII (0x1 << 6)
249#define BCSR_UCC_RTBI (0x1 << 5)
250 /*
251 * U-Boot mangles interrupt polarity for Marvell PHYs,
252 * so reset built-in and UEM Marvell PHYs, this puts
253 * the PHYs into their normal state.
254 */
255 clrbits8(&bcsr_regs[7], BCSR7_UCC12_GETHnRST);
256 setbits8(&bcsr_regs[8], BCSR8_UEM_MARVELL_RST);
257
258 setbits8(&bcsr_regs[7], BCSR7_UCC12_GETHnRST);
259 clrbits8(&bcsr_regs[8], BCSR8_UEM_MARVELL_RST);
260
261 for (np = NULL; (np = of_find_compatible_node(np,
262 "network",
263 "ucc_geth")) != NULL;) {
264 const unsigned int *prop;
265 int ucc_num;
266
267 prop = of_get_property(np, "cell-index", NULL);
268 if (prop == NULL)
269 continue;
270
271 ucc_num = *prop - 1;
272
273 prop = of_get_property(np, "phy-connection-type", NULL);
274 if (prop == NULL)
275 continue;
276
277 if (strcmp("rtbi", (const char *)prop) == 0)
278 clrsetbits_8(&bcsr_regs[7 + ucc_num],
279 BCSR_UCC_RGMII, BCSR_UCC_RTBI);
280 }
281
282 } else if (machine_is(p1021_mds)) {
283#define BCSR11_ENET_MICRST (0x1 << 5)
284 /* Reset Micrel PHY */
285 clrbits8(&bcsr_regs[11], BCSR11_ENET_MICRST);
286 setbits8(&bcsr_regs[11], BCSR11_ENET_MICRST);
287 }
288
289 iounmap(bcsr_regs);
290 }
291 290
292 if (machine_is(p1021_mds)) { 291 if (machine_is(p1021_mds)) {
293#define MPC85xx_PMUXCR_OFFSET 0x60 292#define MPC85xx_PMUXCR_OFFSET 0x60
@@ -322,8 +321,72 @@ static void __init mpc85xx_mds_setup_arch(void)
322 } 321 }
323 322
324 } 323 }
324}
325
326static void __init mpc85xx_mds_qeic_init(void)
327{
328 struct device_node *np;
329
330 np = of_find_compatible_node(NULL, NULL, "fsl,qe");
331 if (!of_device_is_available(np)) {
332 of_node_put(np);
333 return;
334 }
335
336 np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
337 if (!np) {
338 np = of_find_node_by_type(NULL, "qeic");
339 if (!np)
340 return;
341 }
342
343 if (machine_is(p1021_mds))
344 qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
345 qe_ic_cascade_high_mpic);
346 else
347 qe_ic_init(np, 0, qe_ic_cascade_muxed_mpic, NULL);
348 of_node_put(np);
349}
350#else
351static void __init mpc85xx_publish_qe_devices(void) { }
352static void __init mpc85xx_mds_qe_init(void) { }
353static void __init mpc85xx_mds_qeic_init(void) { }
325#endif /* CONFIG_QUICC_ENGINE */ 354#endif /* CONFIG_QUICC_ENGINE */
326 355
356static void __init mpc85xx_mds_setup_arch(void)
357{
358#ifdef CONFIG_PCI
359 struct pci_controller *hose;
360#endif
361 dma_addr_t max = 0xffffffff;
362
363 if (ppc_md.progress)
364 ppc_md.progress("mpc85xx_mds_setup_arch()", 0);
365
366#ifdef CONFIG_PCI
367 for_each_node_by_type(np, "pci") {
368 if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
369 of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
370 struct resource rsrc;
371 of_address_to_resource(np, 0, &rsrc);
372 if ((rsrc.start & 0xfffff) == 0x8000)
373 fsl_add_bridge(np, 1);
374 else
375 fsl_add_bridge(np, 0);
376
377 hose = pci_find_hose_for_OF_device(np);
378 max = min(max, hose->dma_window_base_cur +
379 hose->dma_window_size);
380 }
381 }
382#endif
383
384#ifdef CONFIG_SMP
385 mpc85xx_smp_init();
386#endif
387
388 mpc85xx_mds_qe_init();
389
327#ifdef CONFIG_SWIOTLB 390#ifdef CONFIG_SWIOTLB
328 if (memblock_end_of_DRAM() > max) { 391 if (memblock_end_of_DRAM() > max) {
329 ppc_swiotlb_enable = 1; 392 ppc_swiotlb_enable = 1;
@@ -369,8 +432,6 @@ static struct of_device_id mpc85xx_ids[] = {
369 { .type = "soc", }, 432 { .type = "soc", },
370 { .compatible = "soc", }, 433 { .compatible = "soc", },
371 { .compatible = "simple-bus", }, 434 { .compatible = "simple-bus", },
372 { .type = "qe", },
373 { .compatible = "fsl,qe", },
374 { .compatible = "gianfar", }, 435 { .compatible = "gianfar", },
375 { .compatible = "fsl,rapidio-delta", }, 436 { .compatible = "fsl,rapidio-delta", },
376 { .compatible = "fsl,mpc8548-guts", }, 437 { .compatible = "fsl,mpc8548-guts", },
@@ -382,8 +443,6 @@ static struct of_device_id p1021_ids[] = {
382 { .type = "soc", }, 443 { .type = "soc", },
383 { .compatible = "soc", }, 444 { .compatible = "soc", },
384 { .compatible = "simple-bus", }, 445 { .compatible = "simple-bus", },
385 { .type = "qe", },
386 { .compatible = "fsl,qe", },
387 { .compatible = "gianfar", }, 446 { .compatible = "gianfar", },
388 {}, 447 {},
389}; 448};
@@ -395,16 +454,16 @@ static int __init mpc85xx_publish_devices(void)
395 if (machine_is(mpc8569_mds)) 454 if (machine_is(mpc8569_mds))
396 simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio"); 455 simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio");
397 456
398 /* Publish the QE devices */
399 of_platform_bus_probe(NULL, mpc85xx_ids, NULL); 457 of_platform_bus_probe(NULL, mpc85xx_ids, NULL);
458 mpc85xx_publish_qe_devices();
400 459
401 return 0; 460 return 0;
402} 461}
403 462
404static int __init p1021_publish_devices(void) 463static int __init p1021_publish_devices(void)
405{ 464{
406 /* Publish the QE devices */
407 of_platform_bus_probe(NULL, p1021_ids, NULL); 465 of_platform_bus_probe(NULL, p1021_ids, NULL);
466 mpc85xx_publish_qe_devices();
408 467
409 return 0; 468 return 0;
410} 469}
@@ -441,21 +500,7 @@ static void __init mpc85xx_mds_pic_init(void)
441 of_node_put(np); 500 of_node_put(np);
442 501
443 mpic_init(mpic); 502 mpic_init(mpic);
444 503 mpc85xx_mds_qeic_init();
445#ifdef CONFIG_QUICC_ENGINE
446 np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
447 if (!np) {
448 np = of_find_node_by_type(NULL, "qeic");
449 if (!np)
450 return;
451 }
452 if (machine_is(p1021_mds))
453 qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
454 qe_ic_cascade_high_mpic);
455 else
456 qe_ic_init(np, 0, qe_ic_cascade_muxed_mpic, NULL);
457 of_node_put(np);
458#endif /* CONFIG_QUICC_ENGINE */
459} 504}
460 505
461static int __init mpc85xx_mds_probe(void) 506static int __init mpc85xx_mds_probe(void)
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
new file mode 100644
index 00000000000..e1467c93745
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -0,0 +1,148 @@
1/*
2 * P1022DS board specific routines
3 *
4 * Authors: Travis Wheatley <travis.wheatley@freescale.com>
5 * Dave Liu <daveliu@freescale.com>
6 * Timur Tabi <timur@freescale.com>
7 *
8 * Copyright 2010 Freescale Semiconductor, Inc.
9 *
10 * This file is taken from the Freescale P1022DS BSP, with modifications:
11 * 1) No DIU support (pending rewrite of DIU code)
12 * 2) No AMP support
13 * 3) No PCI endpoint support
14 *
15 * This file is licensed under the terms of the GNU General Public License
16 * version 2. This program is licensed "as is" without any warranty of any
17 * kind, whether express or implied.
18 */
19
20#include <linux/pci.h>
21#include <linux/of_platform.h>
22#include <linux/lmb.h>
23
24#include <asm/mpic.h>
25#include <asm/swiotlb.h>
26
27#include <sysdev/fsl_soc.h>
28#include <sysdev/fsl_pci.h>
29
30void __init p1022_ds_pic_init(void)
31{
32 struct mpic *mpic;
33 struct resource r;
34 struct device_node *np;
35
36 np = of_find_node_by_type(NULL, "open-pic");
37 if (!np) {
38 pr_err("Could not find open-pic node\n");
39 return;
40 }
41
42 if (of_address_to_resource(np, 0, &r)) {
43 pr_err("Failed to map mpic register space\n");
44 of_node_put(np);
45 return;
46 }
47
48 mpic = mpic_alloc(np, r.start,
49 MPIC_PRIMARY | MPIC_WANTS_RESET |
50 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
51 MPIC_SINGLE_DEST_CPU,
52 0, 256, " OpenPIC ");
53
54 BUG_ON(mpic == NULL);
55 of_node_put(np);
56
57 mpic_init(mpic);
58}
59
60#ifdef CONFIG_SMP
61void __init mpc85xx_smp_init(void);
62#endif
63
64/*
65 * Setup the architecture
66 */
67static void __init p1022_ds_setup_arch(void)
68{
69#ifdef CONFIG_PCI
70 struct device_node *np;
71#endif
72 dma_addr_t max = 0xffffffff;
73
74 if (ppc_md.progress)
75 ppc_md.progress("p1022_ds_setup_arch()", 0);
76
77#ifdef CONFIG_PCI
78 for_each_compatible_node(np, "pci", "fsl,p1022-pcie") {
79 struct resource rsrc;
80 struct pci_controller *hose;
81
82 of_address_to_resource(np, 0, &rsrc);
83
84 if ((rsrc.start & 0xfffff) == 0x8000)
85 fsl_add_bridge(np, 1);
86 else
87 fsl_add_bridge(np, 0);
88
89 hose = pci_find_hose_for_OF_device(np);
90 max = min(max, hose->dma_window_base_cur +
91 hose->dma_window_size);
92 }
93#endif
94
95#ifdef CONFIG_SMP
96 mpc85xx_smp_init();
97#endif
98
99#ifdef CONFIG_SWIOTLB
100 if (lmb_end_of_DRAM() > max) {
101 ppc_swiotlb_enable = 1;
102 set_pci_dma_ops(&swiotlb_dma_ops);
103 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
104 }
105#endif
106
107 pr_info("Freescale P1022 DS reference board\n");
108}
109
110static struct of_device_id __initdata p1022_ds_ids[] = {
111 { .type = "soc", },
112 { .compatible = "soc", },
113 { .compatible = "simple-bus", },
114 { .compatible = "gianfar", },
115 {},
116};
117
118static int __init p1022_ds_publish_devices(void)
119{
120 return of_platform_bus_probe(NULL, p1022_ds_ids, NULL);
121}
122machine_device_initcall(p1022_ds, p1022_ds_publish_devices);
123
124machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier);
125
126/*
127 * Called very early, device-tree isn't unflattened
128 */
129static int __init p1022_ds_probe(void)
130{
131 unsigned long root = of_get_flat_dt_root();
132
133 return of_flat_dt_is_compatible(root, "fsl,p1022ds");
134}
135
136define_machine(p1022_ds) {
137 .name = "P1022 DS",
138 .probe = p1022_ds_probe,
139 .setup_arch = p1022_ds_setup_arch,
140 .init_IRQ = p1022_ds_pic_init,
141#ifdef CONFIG_PCI
142 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
143#endif
144 .get_irq = mpic_get_irq,
145 .restart = fsl_rstcr_restart,
146 .calibrate_decr = generic_calibrate_decr,
147 .progress = udbg_progress,
148};
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index 4c3cde911c7..a6b106557be 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/of.h> 17#include <linux/of.h>
18#include <linux/kexec.h>
18 19
19#include <asm/machdep.h> 20#include <asm/machdep.h>
20#include <asm/pgtable.h> 21#include <asm/pgtable.h>
@@ -24,6 +25,7 @@
24#include <asm/dbell.h> 25#include <asm/dbell.h>
25 26
26#include <sysdev/fsl_soc.h> 27#include <sysdev/fsl_soc.h>
28#include <sysdev/mpic.h>
27 29
28extern void __early_start(void); 30extern void __early_start(void);
29 31
@@ -105,8 +107,64 @@ smp_85xx_setup_cpu(int cpu_nr)
105 107
106struct smp_ops_t smp_85xx_ops = { 108struct smp_ops_t smp_85xx_ops = {
107 .kick_cpu = smp_85xx_kick_cpu, 109 .kick_cpu = smp_85xx_kick_cpu,
110#ifdef CONFIG_KEXEC
111 .give_timebase = smp_generic_give_timebase,
112 .take_timebase = smp_generic_take_timebase,
113#endif
108}; 114};
109 115
116#ifdef CONFIG_KEXEC
117static int kexec_down_cpus = 0;
118
119void mpc85xx_smp_kexec_cpu_down(int crash_shutdown, int secondary)
120{
121 mpic_teardown_this_cpu(1);
122
123 /* When crashing, this gets called on all CPU's we only
124 * take down the non-boot cpus */
125 if (smp_processor_id() != boot_cpuid)
126 {
127 local_irq_disable();
128 kexec_down_cpus++;
129
130 while (1);
131 }
132}
133
134static void mpc85xx_smp_kexec_down(void *arg)
135{
136 if (ppc_md.kexec_cpu_down)
137 ppc_md.kexec_cpu_down(0,1);
138}
139
140static void mpc85xx_smp_machine_kexec(struct kimage *image)
141{
142 int timeout = 2000;
143 int i;
144
145 set_cpus_allowed(current, cpumask_of_cpu(boot_cpuid));
146
147 smp_call_function(mpc85xx_smp_kexec_down, NULL, 0);
148
149 while ( (kexec_down_cpus != (num_online_cpus() - 1)) &&
150 ( timeout > 0 ) )
151 {
152 timeout--;
153 }
154
155 if ( !timeout )
156 printk(KERN_ERR "Unable to bring down secondary cpu(s)");
157
158 for (i = 0; i < num_present_cpus(); i++)
159 {
160 if ( i == smp_processor_id() ) continue;
161 mpic_reset_core(i);
162 }
163
164 default_machine_kexec(image);
165}
166#endif /* CONFIG_KEXEC */
167
110void __init mpc85xx_smp_init(void) 168void __init mpc85xx_smp_init(void)
111{ 169{
112 struct device_node *np; 170 struct device_node *np;
@@ -124,4 +182,9 @@ void __init mpc85xx_smp_init(void)
124 BUG_ON(!smp_85xx_ops.message_pass); 182 BUG_ON(!smp_85xx_ops.message_pass);
125 183
126 smp_ops = &smp_85xx_ops; 184 smp_ops = &smp_85xx_ops;
185
186#ifdef CONFIG_KEXEC
187 ppc_md.kexec_cpu_down = mpc85xx_smp_kexec_cpu_down;
188 ppc_md.machine_kexec = mpc85xx_smp_machine_kexec;
189#endif
127} 190}
diff --git a/arch/powerpc/platforms/85xx/tqm85xx.c b/arch/powerpc/platforms/85xx/tqm85xx.c
index 5b0ab9966e9..8f29bbce536 100644
--- a/arch/powerpc/platforms/85xx/tqm85xx.c
+++ b/arch/powerpc/platforms/85xx/tqm85xx.c
@@ -151,6 +151,27 @@ static void tqm85xx_show_cpuinfo(struct seq_file *m)
151 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 151 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
152} 152}
153 153
154static void __init tqm85xx_ti1520_fixup(struct pci_dev *pdev)
155{
156 unsigned int val;
157
158 /* Do not do the fixup on other platforms! */
159 if (!machine_is(tqm85xx))
160 return;
161
162 dev_info(&pdev->dev, "Using TI 1520 fixup on TQM85xx\n");
163
164 /*
165 * Enable P2CCLK bit in system control register
166 * to enable CLOCK output to power chip
167 */
168 pci_read_config_dword(pdev, 0x80, &val);
169 pci_write_config_dword(pdev, 0x80, val | (1 << 27));
170
171}
172DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520,
173 tqm85xx_ti1520_fixup);
174
154static struct of_device_id __initdata of_bus_ids[] = { 175static struct of_device_id __initdata of_bus_ids[] = {
155 { .compatible = "simple-bus", }, 176 { .compatible = "simple-bus", },
156 { .compatible = "gianfar", }, 177 { .compatible = "gianfar", },
diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig
index 48a920a98e7..dd35ce081cf 100644
--- a/arch/powerpc/platforms/8xx/Kconfig
+++ b/arch/powerpc/platforms/8xx/Kconfig
@@ -55,6 +55,12 @@ config PPC_MGSUVD
55 help 55 help
56 This enables support for the Keymile MGSUVD board. 56 This enables support for the Keymile MGSUVD board.
57 57
58config TQM8XX
59 bool "TQM8XX"
60 select CPM1
61 help
62 support for the mpc8xx based boards from TQM.
63
58endchoice 64endchoice
59 65
60menu "Freescale Ethernet driver platform-specific options" 66menu "Freescale Ethernet driver platform-specific options"
diff --git a/arch/powerpc/platforms/8xx/Makefile b/arch/powerpc/platforms/8xx/Makefile
index bdbfd749601..a491fe6b94f 100644
--- a/arch/powerpc/platforms/8xx/Makefile
+++ b/arch/powerpc/platforms/8xx/Makefile
@@ -7,3 +7,4 @@ obj-$(CONFIG_MPC86XADS) += mpc86xads_setup.o
7obj-$(CONFIG_PPC_EP88XC) += ep88xc.o 7obj-$(CONFIG_PPC_EP88XC) += ep88xc.o
8obj-$(CONFIG_PPC_ADDER875) += adder875.o 8obj-$(CONFIG_PPC_ADDER875) += adder875.o
9obj-$(CONFIG_PPC_MGSUVD) += mgsuvd.o 9obj-$(CONFIG_PPC_MGSUVD) += mgsuvd.o
10obj-$(CONFIG_TQM8XX) += tqm8xx_setup.o
diff --git a/arch/powerpc/platforms/8xx/tqm8xx_setup.c b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
new file mode 100644
index 00000000000..b71c650fbb1
--- /dev/null
+++ b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
@@ -0,0 +1,156 @@
1/*
2 * Platform setup for the MPC8xx based boards from TQM.
3 *
4 * Heiko Schocher <hs@denx.de>
5 * Copyright 2010 DENX Software Engineering GmbH
6 *
7 * based on:
8 * Vitaly Bordug <vbordug@ru.mvista.com>
9 *
10 * Copyright 2005 MontaVista Software Inc.
11 *
12 * Heavily modified by Scott Wood <scottwood@freescale.com>
13 * Copyright 2007 Freescale Semiconductor, Inc.
14 *
15 * This file is licensed under the terms of the GNU General Public License
16 * version 2. This program is licensed "as is" without any warranty of any
17 * kind, whether express or implied.
18 */
19
20#include <linux/init.h>
21#include <linux/module.h>
22#include <linux/param.h>
23#include <linux/string.h>
24#include <linux/ioport.h>
25#include <linux/device.h>
26#include <linux/delay.h>
27
28#include <linux/fs_enet_pd.h>
29#include <linux/fs_uart_pd.h>
30#include <linux/fsl_devices.h>
31#include <linux/mii.h>
32#include <linux/of_platform.h>
33
34#include <asm/delay.h>
35#include <asm/io.h>
36#include <asm/machdep.h>
37#include <asm/page.h>
38#include <asm/processor.h>
39#include <asm/system.h>
40#include <asm/time.h>
41#include <asm/mpc8xx.h>
42#include <asm/8xx_immap.h>
43#include <asm/cpm1.h>
44#include <asm/fs_pd.h>
45#include <asm/udbg.h>
46
47#include "mpc8xx.h"
48
49struct cpm_pin {
50 int port, pin, flags;
51};
52
53static struct __initdata cpm_pin tqm8xx_pins[] = {
54 /* SMC1 */
55 {CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */
56 {CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */
57
58 /* SCC1 */
59 {CPM_PORTA, 5, CPM_PIN_INPUT}, /* CLK1 */
60 {CPM_PORTA, 7, CPM_PIN_INPUT}, /* CLK2 */
61 {CPM_PORTA, 14, CPM_PIN_INPUT}, /* TX */
62 {CPM_PORTA, 15, CPM_PIN_INPUT}, /* RX */
63 {CPM_PORTC, 15, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TENA */
64 {CPM_PORTC, 10, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO},
65 {CPM_PORTC, 11, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO},
66};
67
68static struct __initdata cpm_pin tqm8xx_fec_pins[] = {
69 /* MII */
70 {CPM_PORTD, 3, CPM_PIN_OUTPUT},
71 {CPM_PORTD, 4, CPM_PIN_OUTPUT},
72 {CPM_PORTD, 5, CPM_PIN_OUTPUT},
73 {CPM_PORTD, 6, CPM_PIN_OUTPUT},
74 {CPM_PORTD, 7, CPM_PIN_OUTPUT},
75 {CPM_PORTD, 8, CPM_PIN_OUTPUT},
76 {CPM_PORTD, 9, CPM_PIN_OUTPUT},
77 {CPM_PORTD, 10, CPM_PIN_OUTPUT},
78 {CPM_PORTD, 11, CPM_PIN_OUTPUT},
79 {CPM_PORTD, 12, CPM_PIN_OUTPUT},
80 {CPM_PORTD, 13, CPM_PIN_OUTPUT},
81 {CPM_PORTD, 14, CPM_PIN_OUTPUT},
82 {CPM_PORTD, 15, CPM_PIN_OUTPUT},
83};
84
85static void __init init_pins(int n, struct cpm_pin *pin)
86{
87 int i;
88
89 for (i = 0; i < n; i++) {
90 cpm1_set_pin(pin->port, pin->pin, pin->flags);
91 pin++;
92 }
93}
94
95static void __init init_ioports(void)
96{
97 struct device_node *dnode;
98 struct property *prop;
99 int len;
100
101 init_pins(ARRAY_SIZE(tqm8xx_pins), &tqm8xx_pins[0]);
102
103 cpm1_clk_setup(CPM_CLK_SMC1, CPM_BRG1, CPM_CLK_RTX);
104
105 dnode = of_find_node_by_name(NULL, "aliases");
106 if (dnode == NULL)
107 return;
108 prop = of_find_property(dnode, "ethernet1", &len);
109 if (prop == NULL)
110 return;
111
112 /* init FEC pins */
113 init_pins(ARRAY_SIZE(tqm8xx_fec_pins), &tqm8xx_fec_pins[0]);
114}
115
116static void __init tqm8xx_setup_arch(void)
117{
118 cpm_reset();
119 init_ioports();
120}
121
122static int __init tqm8xx_probe(void)
123{
124 unsigned long node = of_get_flat_dt_root();
125
126 return of_flat_dt_is_compatible(node, "tqc,tqm8xx");
127}
128
129static struct of_device_id __initdata of_bus_ids[] = {
130 { .name = "soc", },
131 { .name = "cpm", },
132 { .name = "localbus", },
133 { .compatible = "simple-bus" },
134 {},
135};
136
137static int __init declare_of_platform_devices(void)
138{
139 of_platform_bus_probe(NULL, of_bus_ids, NULL);
140
141 return 0;
142}
143machine_device_initcall(tqm8xx, declare_of_platform_devices);
144
145define_machine(tqm8xx) {
146 .name = "TQM8xx",
147 .probe = tqm8xx_probe,
148 .setup_arch = tqm8xx_setup_arch,
149 .init_IRQ = mpc8xx_pics_init,
150 .get_irq = mpc8xx_get_irq,
151 .restart = mpc8xx_restart,
152 .calibrate_decr = mpc8xx_calibrate_decr,
153 .set_rtc_time = mpc8xx_set_rtc_time,
154 .get_rtc_time = mpc8xx_get_rtc_time,
155 .progress = udbg_progress,
156};