diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-03-29 22:46:19 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-03-29 22:46:19 -0400 |
commit | 0a3108beea9143225119d5e7c72a8e2c64f3eb7d (patch) | |
tree | 89ec500c03f0704799407265db21966b721c6d3f /arch/powerpc/platforms/85xx/socrates.c | |
parent | ec78c8ac16e7a5f45e21838ab2f5573200bfcdd3 (diff) | |
parent | df4b6806d35ca6adedd5c0a7e36ac74af1c32d7a (diff) |
Merge commit 'kumar/next' into next
Diffstat (limited to 'arch/powerpc/platforms/85xx/socrates.c')
-rw-r--r-- | arch/powerpc/platforms/85xx/socrates.c | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/85xx/socrates.c b/arch/powerpc/platforms/85xx/socrates.c new file mode 100644 index 00000000000..d0e8443b12c --- /dev/null +++ b/arch/powerpc/platforms/85xx/socrates.c | |||
@@ -0,0 +1,133 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008 Emcraft Systems | ||
3 | * Sergei Poselenov <sposelenov@emcraft.com> | ||
4 | * | ||
5 | * Based on MPC8560 ADS and arch/ppc tqm85xx ports | ||
6 | * | ||
7 | * Maintained by Kumar Gala (see MAINTAINERS for contact information) | ||
8 | * | ||
9 | * Copyright 2008 Freescale Semiconductor Inc. | ||
10 | * | ||
11 | * Copyright (c) 2005-2006 DENX Software Engineering | ||
12 | * Stefan Roese <sr@denx.de> | ||
13 | * | ||
14 | * Based on original work by | ||
15 | * Kumar Gala <kumar.gala@freescale.com> | ||
16 | * Copyright 2004 Freescale Semiconductor Inc. | ||
17 | * | ||
18 | * This program is free software; you can redistribute it and/or modify it | ||
19 | * under the terms of the GNU General Public License as published by the | ||
20 | * Free Software Foundation; either version 2 of the License, or (at your | ||
21 | * option) any later version. | ||
22 | */ | ||
23 | |||
24 | #include <linux/stddef.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/pci.h> | ||
27 | #include <linux/kdev_t.h> | ||
28 | #include <linux/delay.h> | ||
29 | #include <linux/seq_file.h> | ||
30 | #include <linux/of_platform.h> | ||
31 | |||
32 | #include <asm/system.h> | ||
33 | #include <asm/time.h> | ||
34 | #include <asm/machdep.h> | ||
35 | #include <asm/pci-bridge.h> | ||
36 | #include <asm/mpic.h> | ||
37 | #include <asm/prom.h> | ||
38 | #include <mm/mmu_decl.h> | ||
39 | #include <asm/udbg.h> | ||
40 | |||
41 | #include <sysdev/fsl_soc.h> | ||
42 | #include <sysdev/fsl_pci.h> | ||
43 | |||
44 | #include "socrates_fpga_pic.h" | ||
45 | |||
46 | static void __init socrates_pic_init(void) | ||
47 | { | ||
48 | struct mpic *mpic; | ||
49 | struct resource r; | ||
50 | struct device_node *np; | ||
51 | |||
52 | np = of_find_node_by_type(NULL, "open-pic"); | ||
53 | if (!np) { | ||
54 | printk(KERN_ERR "Could not find open-pic node\n"); | ||
55 | return; | ||
56 | } | ||
57 | |||
58 | if (of_address_to_resource(np, 0, &r)) { | ||
59 | printk(KERN_ERR "Could not map mpic register space\n"); | ||
60 | of_node_put(np); | ||
61 | return; | ||
62 | } | ||
63 | |||
64 | mpic = mpic_alloc(np, r.start, | ||
65 | MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN, | ||
66 | 0, 256, " OpenPIC "); | ||
67 | BUG_ON(mpic == NULL); | ||
68 | of_node_put(np); | ||
69 | |||
70 | mpic_init(mpic); | ||
71 | |||
72 | np = of_find_compatible_node(NULL, NULL, "abb,socrates-fpga-pic"); | ||
73 | if (!np) { | ||
74 | printk(KERN_ERR "Could not find socrates-fpga-pic node\n"); | ||
75 | return; | ||
76 | } | ||
77 | socrates_fpga_pic_init(np); | ||
78 | of_node_put(np); | ||
79 | } | ||
80 | |||
81 | /* | ||
82 | * Setup the architecture | ||
83 | */ | ||
84 | static void __init socrates_setup_arch(void) | ||
85 | { | ||
86 | #ifdef CONFIG_PCI | ||
87 | struct device_node *np; | ||
88 | #endif | ||
89 | |||
90 | if (ppc_md.progress) | ||
91 | ppc_md.progress("socrates_setup_arch()", 0); | ||
92 | |||
93 | #ifdef CONFIG_PCI | ||
94 | for_each_compatible_node(np, "pci", "fsl,mpc8540-pci") | ||
95 | fsl_add_bridge(np, 1); | ||
96 | #endif | ||
97 | } | ||
98 | |||
99 | static struct of_device_id __initdata socrates_of_bus_ids[] = { | ||
100 | { .compatible = "simple-bus", }, | ||
101 | { .compatible = "gianfar", }, | ||
102 | {}, | ||
103 | }; | ||
104 | |||
105 | static void __init socrates_init(void) | ||
106 | { | ||
107 | of_platform_bus_probe(NULL, socrates_of_bus_ids, NULL); | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * Called very early, device-tree isn't unflattened | ||
112 | */ | ||
113 | static int __init socrates_probe(void) | ||
114 | { | ||
115 | unsigned long root = of_get_flat_dt_root(); | ||
116 | |||
117 | if (of_flat_dt_is_compatible(root, "abb,socrates")) | ||
118 | return 1; | ||
119 | |||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | define_machine(socrates) { | ||
124 | .name = "Socrates", | ||
125 | .probe = socrates_probe, | ||
126 | .setup_arch = socrates_setup_arch, | ||
127 | .init = socrates_init, | ||
128 | .init_IRQ = socrates_pic_init, | ||
129 | .get_irq = mpic_get_irq, | ||
130 | .restart = fsl_rstcr_restart, | ||
131 | .calibrate_decr = generic_calibrate_decr, | ||
132 | .progress = udbg_progress, | ||
133 | }; | ||