aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/4xx.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-12-20 23:39:26 -0500
committerJosh Boyer <jwboyer@linux.vnet.ibm.com>2007-12-23 14:13:14 -0500
commit619740384cebe2601a8d307654a22d9ed85f2fcb (patch)
treea354c4b83554f2c718afea3ba6aa91d50702e03d /arch/powerpc/boot/4xx.c
parent9dae8afdf212d39bc7c25f1b1ca9b10f10f6beaa (diff)
[POWERPC] 4xx: EP405 boards support for arch/powerpc
Brings EP405 support to arch/powerpc. The IRQ routing for the CPLD comes from a device-tree property, PCI is working to the point where I can see the video card, USB device, and south bridge. This should work with both EP405 and EP405PC. I've not totally figured out how IRQs are wired on this hardware though, thus at this stage, expect only USB interrupts working, pretty much the same as what arch/ppc did. Also, the flash, nvram, rtc and temp control still have to be wired. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Diffstat (limited to 'arch/powerpc/boot/4xx.c')
-rw-r--r--arch/powerpc/boot/4xx.c55
1 files changed, 54 insertions, 1 deletions
diff --git a/arch/powerpc/boot/4xx.c b/arch/powerpc/boot/4xx.c
index 3d0e4f921f1d..852992b146e3 100644
--- a/arch/powerpc/boot/4xx.c
+++ b/arch/powerpc/boot/4xx.c
@@ -179,13 +179,16 @@ void ibm40x_dbcr_reset(void)
179#define EMAC_RESET 0x20000000 179#define EMAC_RESET 0x20000000
180void ibm4xx_quiesce_eth(u32 *emac0, u32 *emac1) 180void ibm4xx_quiesce_eth(u32 *emac0, u32 *emac1)
181{ 181{
182 /* Quiesce the MAL and EMAC(s) since PIBS/OpenBIOS don't do this for us */ 182 /* Quiesce the MAL and EMAC(s) since PIBS/OpenBIOS don't
183 * do this for us
184 */
183 if (emac0) 185 if (emac0)
184 *emac0 = EMAC_RESET; 186 *emac0 = EMAC_RESET;
185 if (emac1) 187 if (emac1)
186 *emac1 = EMAC_RESET; 188 *emac1 = EMAC_RESET;
187 189
188 mtdcr(DCRN_MAL0_CFG, MAL_RESET); 190 mtdcr(DCRN_MAL0_CFG, MAL_RESET);
191 while (mfdcr(DCRN_MAL0_CFG) & MAL_RESET) {};
189} 192}
190 193
191/* Read 4xx EBC bus bridge registers to get mappings of the peripheral 194/* Read 4xx EBC bus bridge registers to get mappings of the peripheral
@@ -298,3 +301,53 @@ void ibm440ep_fixup_clocks(unsigned int sysclk, unsigned int ser_clk)
298 dt_fixup_clock("/plb/opb/serial@ef600500", uart0); 301 dt_fixup_clock("/plb/opb/serial@ef600500", uart0);
299 dt_fixup_clock("/plb/opb/serial@ef600600", uart0); 302 dt_fixup_clock("/plb/opb/serial@ef600600", uart0);
300} 303}
304
305void ibm405gp_fixup_clocks(unsigned int sysclk, unsigned int ser_clk)
306{
307 u32 pllmr = mfdcr(DCRN_CPC0_PLLMR);
308 u32 cpc0_cr0 = mfdcr(DCRN_405_CPC0_CR0);
309 u32 cpc0_cr1 = mfdcr(DCRN_405_CPC0_CR1);
310 u32 cpu, plb, opb, ebc, tb, uart0, uart1, m;
311 u32 fwdv, fbdv, cbdv, opdv, epdv, udiv;
312
313 fwdv = (8 - ((pllmr & 0xe0000000) >> 29));
314 fbdv = (pllmr & 0x1e000000) >> 25;
315 cbdv = ((pllmr & 0x00060000) >> 17) + 1;
316 opdv = ((pllmr & 0x00018000) >> 15) + 1;
317 epdv = ((pllmr & 0x00001800) >> 13) + 2;
318 udiv = ((cpc0_cr0 & 0x3e) >> 1) + 1;
319
320 m = fwdv * fbdv * cbdv;
321
322 cpu = sysclk * m / fwdv;
323 plb = cpu / cbdv;
324 opb = plb / opdv;
325 ebc = plb / epdv;
326
327 if (cpc0_cr0 & 0x80) {
328 /* uart0 uses the external clock */
329 uart0 = ser_clk;
330 } else {
331 uart0 = cpu / udiv;
332 }
333
334 if (cpc0_cr0 & 0x40) {
335 /* uart1 uses the external clock */
336 uart1 = ser_clk;
337 } else {
338 uart1 = cpu / udiv;
339 }
340
341 /* setup the timebase clock to tick at the cpu frequency */
342 cpc0_cr1 = cpc0_cr1 & ~0x00800000;
343 mtdcr(DCRN_405_CPC0_CR1, cpc0_cr1);
344 tb = cpu;
345
346 dt_fixup_cpu_clocks(cpu, tb, 0);
347 dt_fixup_clock("/plb", plb);
348 dt_fixup_clock("/plb/opb", opb);
349 dt_fixup_clock("/plb/ebc", ebc);
350 dt_fixup_clock("/plb/opb/serial@ef600300", uart0);
351 dt_fixup_clock("/plb/opb/serial@ef600400", uart1);
352}
353