aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2007-10-08 17:08:51 -0400
committerKumar Gala <galak@kernel.crashing.org>2007-10-11 10:14:31 -0400
commit8abc8f5f1eda7a34394c8006fe1cb4c13ffca682 (patch)
tree2fc088a89679cde38bcf7b78c70699c1e1f4cf2d /arch/powerpc
parent52aff9f93e452b3a55be74018dc90eb0ddde0a9c (diff)
[POWERPC] 85xx: Convert mpc8560ads to the new CPM binding.
Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/boot/dts/mpc8560ads.dts82
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig1
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ads.c167
3 files changed, 134 insertions, 116 deletions
diff --git a/arch/powerpc/boot/dts/mpc8560ads.dts b/arch/powerpc/boot/dts/mpc8560ads.dts
index 5577ec1f312b..6b362f8222c1 100644
--- a/arch/powerpc/boot/dts/mpc8560ads.dts
+++ b/arch/powerpc/boot/dts/mpc8560ads.dts
@@ -138,15 +138,31 @@
138 device_type = "open-pic"; 138 device_type = "open-pic";
139 }; 139 };
140 140
141 cpm@e0000000 { 141 cpm@919c0 {
142 #address-cells = <1>; 142 #address-cells = <1>;
143 #size-cells = <1>; 143 #size-cells = <1>;
144 device_type = "cpm"; 144 compatible = "fsl,mpc8560-cpm", "fsl,cpm2";
145 model = "CPM2"; 145 reg = <919c0 30>;
146 ranges = <0 0 c0000>; 146 ranges;
147 reg = <80000 40000>; 147
148 command-proc = <919c0>; 148 muram@80000 {
149 brg-frequency = <9d5b340>; 149 #address-cells = <1>;
150 #size-cells = <1>;
151 ranges = <0 80000 10000>;
152
153 data@0 {
154 compatible = "fsl,cpm-muram-data";
155 reg = <0 4000 9000 2000>;
156 };
157 };
158
159 brg@919f0 {
160 compatible = "fsl,mpc8560-brg",
161 "fsl,cpm2-brg",
162 "fsl,cpm-brg";
163 reg = <919f0 10 915f0 10>;
164 clock-frequency = <d#165000000>;
165 };
150 166
151 cpmpic: pic@90c00 { 167 cpmpic: pic@90c00 {
152 interrupt-controller; 168 interrupt-controller;
@@ -155,43 +171,38 @@
155 interrupts = <2e 2>; 171 interrupts = <2e 2>;
156 interrupt-parent = <&mpic>; 172 interrupt-parent = <&mpic>;
157 reg = <90c00 80>; 173 reg = <90c00 80>;
158 device_type = "cpm-pic"; 174 compatible = "fsl,mpc8560-cpm-pic", "fsl,cpm2-pic";
159 }; 175 };
160 176
161 scc@91a00 { 177 serial@91a00 {
162 device_type = "serial"; 178 device_type = "serial";
163 compatible = "cpm_uart"; 179 compatible = "fsl,mpc8560-scc-uart",
164 model = "SCC"; 180 "fsl,cpm2-scc-uart";
165 device-id = <1>;
166 reg = <91a00 20 88000 100>; 181 reg = <91a00 20 88000 100>;
167 clock-setup = <00ffffff 0>; 182 fsl,cpm-brg = <1>;
168 rx-clock = <1>; 183 fsl,cpm-command = <00800000>;
169 tx-clock = <1>;
170 current-speed = <1c200>; 184 current-speed = <1c200>;
171 interrupts = <28 8>; 185 interrupts = <28 8>;
172 interrupt-parent = <&cpmpic>; 186 interrupt-parent = <&cpmpic>;
173 }; 187 };
174 188
175 scc@91a20 { 189 serial@91a20 {
176 device_type = "serial"; 190 device_type = "serial";
177 compatible = "cpm_uart"; 191 compatible = "fsl,mpc8560-scc-uart",
178 model = "SCC"; 192 "fsl,cpm2-scc-uart";
179 device-id = <2>;
180 reg = <91a20 20 88100 100>; 193 reg = <91a20 20 88100 100>;
181 clock-setup = <ff00ffff 90000>; 194 fsl,cpm-brg = <2>;
182 rx-clock = <2>; 195 fsl,cpm-command = <04a00000>;
183 tx-clock = <2>;
184 current-speed = <1c200>; 196 current-speed = <1c200>;
185 interrupts = <29 8>; 197 interrupts = <29 8>;
186 interrupt-parent = <&cpmpic>; 198 interrupt-parent = <&cpmpic>;
187 }; 199 };
188 200
189 fcc@91320 { 201 ethernet@91320 {
190 device_type = "network"; 202 device_type = "network";
191 compatible = "fs_enet"; 203 compatible = "fsl,mpc8560-fcc-enet",
192 model = "FCC"; 204 "fsl,cpm2-fcc-enet";
193 device-id = <2>; 205 reg = <91320 20 88500 100 913b0 1>;
194 reg = <91320 20 88500 100 913a0 30>;
195 /* 206 /*
196 * mac-address is deprecated and will be removed 207 * mac-address is deprecated and will be removed
197 * in 2.6.25. Only recent versions of 208 * in 2.6.25. Only recent versions of
@@ -199,20 +210,17 @@
199 */ 210 */
200 mac-address = [ 00 00 00 00 00 00 ]; 211 mac-address = [ 00 00 00 00 00 00 ];
201 local-mac-address = [ 00 00 00 00 00 00 ]; 212 local-mac-address = [ 00 00 00 00 00 00 ];
202 clock-setup = <ff00ffff 250000>; 213 fsl,cpm-command = <16200300>;
203 rx-clock = <15>;
204 tx-clock = <16>;
205 interrupts = <21 8>; 214 interrupts = <21 8>;
206 interrupt-parent = <&cpmpic>; 215 interrupt-parent = <&cpmpic>;
207 phy-handle = <&phy2>; 216 phy-handle = <&phy2>;
208 }; 217 };
209 218
210 fcc@91340 { 219 ethernet@91340 {
211 device_type = "network"; 220 device_type = "network";
212 compatible = "fs_enet"; 221 compatible = "fsl,mpc8560-fcc-enet",
213 model = "FCC"; 222 "fsl,cpm2-fcc-enet";
214 device-id = <3>; 223 reg = <91340 20 88600 100 913d0 1>;
215 reg = <91340 20 88600 100 913d0 30>;
216 /* 224 /*
217 * mac-address is deprecated and will be removed 225 * mac-address is deprecated and will be removed
218 * in 2.6.25. Only recent versions of 226 * in 2.6.25. Only recent versions of
@@ -220,9 +228,7 @@
220 */ 228 */
221 mac-address = [ 00 00 00 00 00 00 ]; 229 mac-address = [ 00 00 00 00 00 00 ];
222 local-mac-address = [ 00 00 00 00 00 00 ]; 230 local-mac-address = [ 00 00 00 00 00 00 ];
223 clock-setup = <ffff00ff 3700>; 231 fsl,cpm-command = <1a400300>;
224 rx-clock = <17>;
225 tx-clock = <18>;
226 interrupts = <22 8>; 232 interrupts = <22 8>;
227 interrupt-parent = <&cpmpic>; 233 interrupt-parent = <&cpmpic>;
228 phy-handle = <&phy3>; 234 phy-handle = <&phy3>;
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index cf815b22b9fb..7748a3a426db 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -12,6 +12,7 @@ config MPC8540_ADS
12config MPC8560_ADS 12config MPC8560_ADS
13 bool "Freescale MPC8560 ADS" 13 bool "Freescale MPC8560 ADS"
14 select DEFAULT_UIMAGE 14 select DEFAULT_UIMAGE
15 select PPC_CPM_NEW_BINDING
15 help 16 help
16 This option enables support for the MPC 8560 ADS board 17 This option enables support for the MPC 8560 ADS board
17 18
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index 378a244b3bac..509d46beee11 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -17,13 +17,13 @@
17#include <linux/kdev_t.h> 17#include <linux/kdev_t.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/seq_file.h> 19#include <linux/seq_file.h>
20#include <linux/of_platform.h>
20 21
21#include <asm/system.h> 22#include <asm/system.h>
22#include <asm/time.h> 23#include <asm/time.h>
23#include <asm/machdep.h> 24#include <asm/machdep.h>
24#include <asm/pci-bridge.h> 25#include <asm/pci-bridge.h>
25#include <asm/mpc85xx.h> 26#include <asm/mpc85xx.h>
26#include <asm/prom.h>
27#include <asm/mpic.h> 27#include <asm/mpic.h>
28#include <mm/mmu_decl.h> 28#include <mm/mmu_decl.h>
29#include <asm/udbg.h> 29#include <asm/udbg.h>
@@ -32,10 +32,8 @@
32#include <sysdev/fsl_pci.h> 32#include <sysdev/fsl_pci.h>
33 33
34#ifdef CONFIG_CPM2 34#ifdef CONFIG_CPM2
35#include <linux/fs_enet_pd.h>
36#include <asm/cpm2.h> 35#include <asm/cpm2.h>
37#include <sysdev/cpm2_pic.h> 36#include <sysdev/cpm2_pic.h>
38#include <asm/fs_pd.h>
39#endif 37#endif
40 38
41#ifdef CONFIG_PCI 39#ifdef CONFIG_PCI
@@ -95,10 +93,10 @@ static void __init mpc85xx_ads_pic_init(void)
95 93
96#ifdef CONFIG_CPM2 94#ifdef CONFIG_CPM2
97 /* Setup CPM2 PIC */ 95 /* Setup CPM2 PIC */
98 np = of_find_node_by_type(NULL, "cpm-pic"); 96 np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic");
99 if (np == NULL) { 97 if (np == NULL) {
100 printk(KERN_ERR "PIC init: can not find cpm-pic node\n"); 98 printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n");
101 return; 99 return;
102 } 100 }
103 irq = irq_of_parse_and_map(np, 0); 101 irq = irq_of_parse_and_map(np, 0);
104 102
@@ -111,81 +109,75 @@ static void __init mpc85xx_ads_pic_init(void)
111 * Setup the architecture 109 * Setup the architecture
112 */ 110 */
113#ifdef CONFIG_CPM2 111#ifdef CONFIG_CPM2
114void init_fcc_ioports(struct fs_platform_info *fpi) 112struct cpm_pin {
113 int port, pin, flags;
114};
115
116static struct cpm_pin mpc8560_ads_pins[] = {
117 /* SCC1 */
118 {3, 29, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
119 {3, 30, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
120 {3, 31, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
121
122 /* SCC2 */
123 {3, 26, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
124 {3, 27, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
125 {3, 28, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
126
127 /* FCC2 */
128 {1, 18, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
129 {1, 19, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
130 {1, 20, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
131 {1, 21, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
132 {1, 22, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
133 {1, 23, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
134 {1, 24, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
135 {1, 25, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
136 {1, 26, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
137 {1, 27, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
138 {1, 28, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
139 {1, 29, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
140 {1, 30, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
141 {1, 31, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
142 {2, 18, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK14 */
143 {2, 19, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK13 */
144
145 /* FCC3 */
146 {1, 4, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
147 {1, 5, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
148 {1, 6, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
149 {1, 7, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
150 {1, 8, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
151 {1, 9, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
152 {1, 10, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
153 {1, 11, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
154 {1, 12, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
155 {1, 13, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
156 {1, 14, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
157 {1, 15, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
158 {1, 16, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
159 {1, 17, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
160 {2, 16, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* CLK16 */
161 {2, 17, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* CLK15 */
162};
163
164static void __init init_ioports(void)
115{ 165{
116 struct io_port *io = cpm2_map(im_ioport); 166 int i;
117 int fcc_no = fs_get_fcc_index(fpi->fs_no); 167
118 int target; 168 for (i = 0; i < ARRAY_SIZE(mpc8560_ads_pins); i++) {
119 u32 tempval; 169 struct cpm_pin *pin = &mpc8560_ads_pins[i];
120 170 cpm2_set_pin(pin->port, pin->pin, pin->flags);
121 switch(fcc_no) {
122 case 1:
123 tempval = in_be32(&io->iop_pdirb);
124 tempval &= ~PB2_DIRB0;
125 tempval |= PB2_DIRB1;
126 out_be32(&io->iop_pdirb, tempval);
127
128 tempval = in_be32(&io->iop_psorb);
129 tempval &= ~PB2_PSORB0;
130 tempval |= PB2_PSORB1;
131 out_be32(&io->iop_psorb, tempval);
132
133 tempval = in_be32(&io->iop_pparb);
134 tempval |= (PB2_DIRB0 | PB2_DIRB1);
135 out_be32(&io->iop_pparb, tempval);
136
137 target = CPM_CLK_FCC2;
138 break;
139 case 2:
140 tempval = in_be32(&io->iop_pdirb);
141 tempval &= ~PB3_DIRB0;
142 tempval |= PB3_DIRB1;
143 out_be32(&io->iop_pdirb, tempval);
144
145 tempval = in_be32(&io->iop_psorb);
146 tempval &= ~PB3_PSORB0;
147 tempval |= PB3_PSORB1;
148 out_be32(&io->iop_psorb, tempval);
149
150 tempval = in_be32(&io->iop_pparb);
151 tempval |= (PB3_DIRB0 | PB3_DIRB1);
152 out_be32(&io->iop_pparb, tempval);
153
154 tempval = in_be32(&io->iop_pdirc);
155 tempval |= PC3_DIRC1;
156 out_be32(&io->iop_pdirc, tempval);
157
158 tempval = in_be32(&io->iop_pparc);
159 tempval |= PC3_DIRC1;
160 out_be32(&io->iop_pparc, tempval);
161
162 target = CPM_CLK_FCC3;
163 break;
164 default:
165 printk(KERN_ERR "init_fcc_ioports: invalid FCC number\n");
166 return;
167 } 171 }
168 172
169 /* Port C has clocks...... */ 173 cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_RX);
170 tempval = in_be32(&io->iop_psorc); 174 cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_TX);
171 tempval &= ~(PC_CLK(fpi->clk_rx - 8) | PC_CLK(fpi->clk_tx - 8)); 175 cpm2_clk_setup(CPM_CLK_SCC2, CPM_BRG2, CPM_CLK_RX);
172 out_be32(&io->iop_psorc, tempval); 176 cpm2_clk_setup(CPM_CLK_SCC2, CPM_BRG2, CPM_CLK_TX);
173 177 cpm2_clk_setup(CPM_CLK_FCC2, CPM_CLK13, CPM_CLK_RX);
174 tempval = in_be32(&io->iop_pdirc); 178 cpm2_clk_setup(CPM_CLK_FCC2, CPM_CLK14, CPM_CLK_TX);
175 tempval &= ~(PC_CLK(fpi->clk_rx - 8) | PC_CLK(fpi->clk_tx - 8)); 179 cpm2_clk_setup(CPM_CLK_FCC3, CPM_CLK15, CPM_CLK_RX);
176 out_be32(&io->iop_pdirc, tempval); 180 cpm2_clk_setup(CPM_CLK_FCC3, CPM_CLK16, CPM_CLK_TX);
177 tempval = in_be32(&io->iop_pparc);
178 tempval |= (PC_CLK(fpi->clk_rx - 8) | PC_CLK(fpi->clk_tx - 8));
179 out_be32(&io->iop_pparc, tempval);
180
181 cpm2_unmap(io);
182
183 /* Configure Serial Interface clock routing.
184 * First, clear FCC bits to zero,
185 * then set the ones we want.
186 */
187 cpm2_clk_setup(target, fpi->clk_rx, CPM_CLK_RX);
188 cpm2_clk_setup(target, fpi->clk_tx, CPM_CLK_TX);
189} 181}
190#endif 182#endif
191 183
@@ -200,6 +192,7 @@ static void __init mpc85xx_ads_setup_arch(void)
200 192
201#ifdef CONFIG_CPM2 193#ifdef CONFIG_CPM2
202 cpm2_reset(); 194 cpm2_reset();
195 init_ioports();
203#endif 196#endif
204 197
205#ifdef CONFIG_PCI 198#ifdef CONFIG_PCI
@@ -231,6 +224,24 @@ static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
231 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024)); 224 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
232} 225}
233 226
227static struct of_device_id __initdata of_bus_ids[] = {
228 { .name = "soc", },
229 { .type = "soc", },
230 { .name = "cpm", },
231 { .name = "localbus", },
232 {},
233};
234
235static int __init declare_of_platform_devices(void)
236{
237 if (!machine_is(mpc85xx_ads))
238 return 0;
239
240 of_platform_bus_probe(NULL, of_bus_ids, NULL);
241 return 0;
242}
243device_initcall(declare_of_platform_devices);
244
234/* 245/*
235 * Called very early, device-tree isn't unflattened 246 * Called very early, device-tree isn't unflattened
236 */ 247 */