aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/m68k/include/asm/m532xsim.h104
-rw-r--r--arch/m68k/platform/coldfire/m532x.c183
2 files changed, 139 insertions, 148 deletions
diff --git a/arch/m68k/include/asm/m532xsim.h b/arch/m68k/include/asm/m532xsim.h
index d4092fa7e5f4..8668e47ced0e 100644
--- a/arch/m68k/include/asm/m532xsim.h
+++ b/arch/m68k/include/asm/m532xsim.h
@@ -15,10 +15,6 @@
15 15
16#include <asm/m53xxacr.h> 16#include <asm/m53xxacr.h>
17 17
18#define MCF_REG32(x) (*(volatile unsigned long *)(x))
19#define MCF_REG16(x) (*(volatile unsigned short *)(x))
20#define MCF_REG08(x) (*(volatile unsigned char *)(x))
21
22#define MCFINT_VECBASE 64 18#define MCFINT_VECBASE 64
23#define MCFINT_UART0 26 /* Interrupt number for UART0 */ 19#define MCFINT_UART0 26 /* Interrupt number for UART0 */
24#define MCFINT_UART1 27 /* Interrupt number for UART1 */ 20#define MCFINT_UART1 27 /* Interrupt number for UART1 */
@@ -38,7 +34,7 @@
38 34
39#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI) 35#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI)
40 36
41#define MCF_WTM_WCR MCF_REG16(0xFC098000) 37#define MCF_WTM_WCR 0xFC098000
42 38
43/* 39/*
44 * Define the 532x SIM register set addresses. 40 * Define the 532x SIM register set addresses.
@@ -181,13 +177,13 @@
181 *********************************************************************/ 177 *********************************************************************/
182 178
183/* Register read/write macros */ 179/* Register read/write macros */
184#define MCF_CCM_CCR MCF_REG16(0xFC0A0004) 180#define MCF_CCM_CCR 0xFC0A0004
185#define MCF_CCM_RCON MCF_REG16(0xFC0A0008) 181#define MCF_CCM_RCON 0xFC0A0008
186#define MCF_CCM_CIR MCF_REG16(0xFC0A000A) 182#define MCF_CCM_CIR 0xFC0A000A
187#define MCF_CCM_MISCCR MCF_REG16(0xFC0A0010) 183#define MCF_CCM_MISCCR 0xFC0A0010
188#define MCF_CCM_CDR MCF_REG16(0xFC0A0012) 184#define MCF_CCM_CDR 0xFC0A0012
189#define MCF_CCM_UHCSR MCF_REG16(0xFC0A0014) 185#define MCF_CCM_UHCSR 0xFC0A0014
190#define MCF_CCM_UOCSR MCF_REG16(0xFC0A0016) 186#define MCF_CCM_UOCSR 0xFC0A0016
191 187
192/* Bit definitions and macros for MCF_CCM_CCR */ 188/* Bit definitions and macros for MCF_CCM_CCR */
193#define MCF_CCM_CCR_RESERVED (0x0001) 189#define MCF_CCM_CCR_RESERVED (0x0001)
@@ -256,27 +252,24 @@
256 *********************************************************************/ 252 *********************************************************************/
257 253
258/* Register read/write macros */ 254/* Register read/write macros */
259#define MCF_FBCS0_CSAR MCF_REG32(0xFC008000) 255#define MCF_FBCS0_CSAR 0xFC008000
260#define MCF_FBCS0_CSMR MCF_REG32(0xFC008004) 256#define MCF_FBCS0_CSMR 0xFC008004
261#define MCF_FBCS0_CSCR MCF_REG32(0xFC008008) 257#define MCF_FBCS0_CSCR 0xFC008008
262#define MCF_FBCS1_CSAR MCF_REG32(0xFC00800C) 258#define MCF_FBCS1_CSAR 0xFC00800C
263#define MCF_FBCS1_CSMR MCF_REG32(0xFC008010) 259#define MCF_FBCS1_CSMR 0xFC008010
264#define MCF_FBCS1_CSCR MCF_REG32(0xFC008014) 260#define MCF_FBCS1_CSCR 0xFC008014
265#define MCF_FBCS2_CSAR MCF_REG32(0xFC008018) 261#define MCF_FBCS2_CSAR 0xFC008018
266#define MCF_FBCS2_CSMR MCF_REG32(0xFC00801C) 262#define MCF_FBCS2_CSMR 0xFC00801C
267#define MCF_FBCS2_CSCR MCF_REG32(0xFC008020) 263#define MCF_FBCS2_CSCR 0xFC008020
268#define MCF_FBCS3_CSAR MCF_REG32(0xFC008024) 264#define MCF_FBCS3_CSAR 0xFC008024
269#define MCF_FBCS3_CSMR MCF_REG32(0xFC008028) 265#define MCF_FBCS3_CSMR 0xFC008028
270#define MCF_FBCS3_CSCR MCF_REG32(0xFC00802C) 266#define MCF_FBCS3_CSCR 0xFC00802C
271#define MCF_FBCS4_CSAR MCF_REG32(0xFC008030) 267#define MCF_FBCS4_CSAR 0xFC008030
272#define MCF_FBCS4_CSMR MCF_REG32(0xFC008034) 268#define MCF_FBCS4_CSMR 0xFC008034
273#define MCF_FBCS4_CSCR MCF_REG32(0xFC008038) 269#define MCF_FBCS4_CSCR 0xFC008038
274#define MCF_FBCS5_CSAR MCF_REG32(0xFC00803C) 270#define MCF_FBCS5_CSAR 0xFC00803C
275#define MCF_FBCS5_CSMR MCF_REG32(0xFC008040) 271#define MCF_FBCS5_CSMR 0xFC008040
276#define MCF_FBCS5_CSCR MCF_REG32(0xFC008044) 272#define MCF_FBCS5_CSCR 0xFC008044
277#define MCF_FBCS_CSAR(x) MCF_REG32(0xFC008000+((x)*0x00C))
278#define MCF_FBCS_CSMR(x) MCF_REG32(0xFC008004+((x)*0x00C))
279#define MCF_FBCS_CSCR(x) MCF_REG32(0xFC008008+((x)*0x00C))
280 273
281/* Bit definitions and macros for MCF_FBCS_CSAR */ 274/* Bit definitions and macros for MCF_FBCS_CSAR */
282#define MCF_FBCS_CSAR_BA(x) ((x)&0xFFFF0000) 275#define MCF_FBCS_CSAR_BA(x) ((x)&0xFFFF0000)
@@ -1114,10 +1107,10 @@
1114 *********************************************************************/ 1107 *********************************************************************/
1115 1108
1116/* Register read/write macros */ 1109/* Register read/write macros */
1117#define MCF_PLL_PODR MCF_REG08(0xFC0C0000) 1110#define MCF_PLL_PODR 0xFC0C0000
1118#define MCF_PLL_PLLCR MCF_REG08(0xFC0C0004) 1111#define MCF_PLL_PLLCR 0xFC0C0004
1119#define MCF_PLL_PMDR MCF_REG08(0xFC0C0008) 1112#define MCF_PLL_PMDR 0xFC0C0008
1120#define MCF_PLL_PFDR MCF_REG08(0xFC0C000C) 1113#define MCF_PLL_PFDR 0xFC0C000C
1121 1114
1122/* Bit definitions and macros for MCF_PLL_PODR */ 1115/* Bit definitions and macros for MCF_PLL_PODR */
1123#define MCF_PLL_PODR_BUSDIV(x) (((x)&0x0F)<<0) 1116#define MCF_PLL_PODR_BUSDIV(x) (((x)&0x0F)<<0)
@@ -1140,15 +1133,15 @@
1140 *********************************************************************/ 1133 *********************************************************************/
1141 1134
1142/* Register read/write macros */ 1135/* Register read/write macros */
1143#define MCF_SCM_MPR MCF_REG32(0xFC000000) 1136#define MCF_SCM_MPR 0xFC000000
1144#define MCF_SCM_PACRA MCF_REG32(0xFC000020) 1137#define MCF_SCM_PACRA 0xFC000020
1145#define MCF_SCM_PACRB MCF_REG32(0xFC000024) 1138#define MCF_SCM_PACRB 0xFC000024
1146#define MCF_SCM_PACRC MCF_REG32(0xFC000028) 1139#define MCF_SCM_PACRC 0xFC000028
1147#define MCF_SCM_PACRD MCF_REG32(0xFC00002C) 1140#define MCF_SCM_PACRD 0xFC00002C
1148#define MCF_SCM_PACRE MCF_REG32(0xFC000040) 1141#define MCF_SCM_PACRE 0xFC000040
1149#define MCF_SCM_PACRF MCF_REG32(0xFC000044) 1142#define MCF_SCM_PACRF 0xFC000044
1150 1143
1151#define MCF_SCM_BCR MCF_REG32(0xFC040024) 1144#define MCF_SCM_BCR 0xFC040024
1152 1145
1153/********************************************************************* 1146/*********************************************************************
1154 * 1147 *
@@ -1157,17 +1150,16 @@
1157 *********************************************************************/ 1150 *********************************************************************/
1158 1151
1159/* Register read/write macros */ 1152/* Register read/write macros */
1160#define MCF_SDRAMC_SDMR MCF_REG32(0xFC0B8000) 1153#define MCF_SDRAMC_SDMR 0xFC0B8000
1161#define MCF_SDRAMC_SDCR MCF_REG32(0xFC0B8004) 1154#define MCF_SDRAMC_SDCR 0xFC0B8004
1162#define MCF_SDRAMC_SDCFG1 MCF_REG32(0xFC0B8008) 1155#define MCF_SDRAMC_SDCFG1 0xFC0B8008
1163#define MCF_SDRAMC_SDCFG2 MCF_REG32(0xFC0B800C) 1156#define MCF_SDRAMC_SDCFG2 0xFC0B800C
1164#define MCF_SDRAMC_LIMP_FIX MCF_REG32(0xFC0B8080) 1157#define MCF_SDRAMC_LIMP_FIX 0xFC0B8080
1165#define MCF_SDRAMC_SDDS MCF_REG32(0xFC0B8100) 1158#define MCF_SDRAMC_SDDS 0xFC0B8100
1166#define MCF_SDRAMC_SDCS0 MCF_REG32(0xFC0B8110) 1159#define MCF_SDRAMC_SDCS0 0xFC0B8110
1167#define MCF_SDRAMC_SDCS1 MCF_REG32(0xFC0B8114) 1160#define MCF_SDRAMC_SDCS1 0xFC0B8114
1168#define MCF_SDRAMC_SDCS2 MCF_REG32(0xFC0B8118) 1161#define MCF_SDRAMC_SDCS2 0xFC0B8118
1169#define MCF_SDRAMC_SDCS3 MCF_REG32(0xFC0B811C) 1162#define MCF_SDRAMC_SDCS3 0xFC0B811C
1170#define MCF_SDRAMC_SDCS(x) MCF_REG32(0xFC0B8110+((x)*0x004))
1171 1163
1172/* Bit definitions and macros for MCF_SDRAMC_SDMR */ 1164/* Bit definitions and macros for MCF_SDRAMC_SDMR */
1173#define MCF_SDRAMC_SDMR_CMD (0x00010000) 1165#define MCF_SDRAMC_SDMR_CMD (0x00010000)
diff --git a/arch/m68k/platform/coldfire/m532x.c b/arch/m68k/platform/coldfire/m532x.c
index 0adeef17fd41..7951d1d43357 100644
--- a/arch/m68k/platform/coldfire/m532x.c
+++ b/arch/m68k/platform/coldfire/m532x.c
@@ -304,7 +304,7 @@ asmlinkage void __init sysinit(void)
304void wtm_init(void) 304void wtm_init(void)
305{ 305{
306 /* Disable watchdog timer */ 306 /* Disable watchdog timer */
307 MCF_WTM_WCR = 0; 307 writew(0, MCF_WTM_WCR);
308} 308}
309 309
310#define MCF_SCM_BCR_GBW (0x00000100) 310#define MCF_SCM_BCR_GBW (0x00000100)
@@ -313,19 +313,19 @@ void wtm_init(void)
313void scm_init(void) 313void scm_init(void)
314{ 314{
315 /* All masters are trusted */ 315 /* All masters are trusted */
316 MCF_SCM_MPR = 0x77777777; 316 writel(0x77777777, MCF_SCM_MPR);
317 317
318 /* Allow supervisor/user, read/write, and trusted/untrusted 318 /* Allow supervisor/user, read/write, and trusted/untrusted
319 access to all slaves */ 319 access to all slaves */
320 MCF_SCM_PACRA = 0; 320 writel(0, MCF_SCM_PACRA);
321 MCF_SCM_PACRB = 0; 321 writel(0, MCF_SCM_PACRB);
322 MCF_SCM_PACRC = 0; 322 writel(0, MCF_SCM_PACRC);
323 MCF_SCM_PACRD = 0; 323 writel(0, MCF_SCM_PACRD);
324 MCF_SCM_PACRE = 0; 324 writel(0, MCF_SCM_PACRE);
325 MCF_SCM_PACRF = 0; 325 writel(0, MCF_SCM_PACRF);
326 326
327 /* Enable bursts */ 327 /* Enable bursts */
328 MCF_SCM_BCR = (MCF_SCM_BCR_GBR | MCF_SCM_BCR_GBW); 328 writel(MCF_SCM_BCR_GBR | MCF_SCM_BCR_GBW, MCF_SCM_BCR);
329} 329}
330 330
331 331
@@ -334,32 +334,32 @@ void fbcs_init(void)
334 writeb(0x3E, MCFGPIO_PAR_CS); 334 writeb(0x3E, MCFGPIO_PAR_CS);
335 335
336 /* Latch chip select */ 336 /* Latch chip select */
337 MCF_FBCS1_CSAR = 0x10080000; 337 writel(0x10080000, MCF_FBCS1_CSAR);
338 338
339 MCF_FBCS1_CSCR = 0x002A3780; 339 writel(0x002A3780, MCF_FBCS1_CSCR);
340 MCF_FBCS1_CSMR = (MCF_FBCS_CSMR_BAM_2M | MCF_FBCS_CSMR_V); 340 writel(MCF_FBCS_CSMR_BAM_2M | MCF_FBCS_CSMR_V, MCF_FBCS1_CSMR);
341 341
342 /* Initialize latch to drive signals to inactive states */ 342 /* Initialize latch to drive signals to inactive states */
343 *((u16 *)(0x10080000)) = 0xFFFF; 343 writew(0xffff, 0x10080000);
344 344
345 /* External SRAM */ 345 /* External SRAM */
346 MCF_FBCS1_CSAR = EXT_SRAM_ADDRESS; 346 writel(EXT_SRAM_ADDRESS, MCF_FBCS1_CSAR);
347 MCF_FBCS1_CSCR = (MCF_FBCS_CSCR_PS_16 347 writel(MCF_FBCS_CSCR_PS_16 |
348 | MCF_FBCS_CSCR_AA 348 MCF_FBCS_CSCR_AA |
349 | MCF_FBCS_CSCR_SBM 349 MCF_FBCS_CSCR_SBM |
350 | MCF_FBCS_CSCR_WS(1)); 350 MCF_FBCS_CSCR_WS(1),
351 MCF_FBCS1_CSMR = (MCF_FBCS_CSMR_BAM_512K 351 MCF_FBCS1_CSCR);
352 | MCF_FBCS_CSMR_V); 352 writel(MCF_FBCS_CSMR_BAM_512K | MCF_FBCS_CSMR_V, MCF_FBCS1_CSMR);
353 353
354 /* Boot Flash connected to FBCS0 */ 354 /* Boot Flash connected to FBCS0 */
355 MCF_FBCS0_CSAR = FLASH_ADDRESS; 355 writel(FLASH_ADDRESS, MCF_FBCS0_CSAR);
356 MCF_FBCS0_CSCR = (MCF_FBCS_CSCR_PS_16 356 writel(MCF_FBCS_CSCR_PS_16 |
357 | MCF_FBCS_CSCR_BEM 357 MCF_FBCS_CSCR_BEM |
358 | MCF_FBCS_CSCR_AA 358 MCF_FBCS_CSCR_AA |
359 | MCF_FBCS_CSCR_SBM 359 MCF_FBCS_CSCR_SBM |
360 | MCF_FBCS_CSCR_WS(7)); 360 MCF_FBCS_CSCR_WS(7),
361 MCF_FBCS0_CSMR = (MCF_FBCS_CSMR_BAM_32M 361 MCF_FBCS0_CSCR);
362 | MCF_FBCS_CSMR_V); 362 writel(MCF_FBCS_CSMR_BAM_32M | MCF_FBCS_CSMR_V, MCF_FBCS0_CSMR);
363} 363}
364 364
365void sdramc_init(void) 365void sdramc_init(void)
@@ -368,86 +368,86 @@ void sdramc_init(void)
368 * Check to see if the SDRAM has already been initialized 368 * Check to see if the SDRAM has already been initialized
369 * by a run control tool 369 * by a run control tool
370 */ 370 */
371 if (!(MCF_SDRAMC_SDCR & MCF_SDRAMC_SDCR_REF)) { 371 if (!(readl(MCF_SDRAMC_SDCR) & MCF_SDRAMC_SDCR_REF)) {
372 /* SDRAM chip select initialization */ 372 /* SDRAM chip select initialization */
373 373
374 /* Initialize SDRAM chip select */ 374 /* Initialize SDRAM chip select */
375 MCF_SDRAMC_SDCS0 = (0 375 writel(MCF_SDRAMC_SDCS_BA(SDRAM_ADDRESS) |
376 | MCF_SDRAMC_SDCS_BA(SDRAM_ADDRESS) 376 MCF_SDRAMC_SDCS_CSSZ(MCF_SDRAMC_SDCS_CSSZ_32MBYTE),
377 | MCF_SDRAMC_SDCS_CSSZ(MCF_SDRAMC_SDCS_CSSZ_32MBYTE)); 377 MCF_SDRAMC_SDCS0);
378 378
379 /* 379 /*
380 * Basic configuration and initialization 380 * Basic configuration and initialization
381 */ 381 */
382 MCF_SDRAMC_SDCFG1 = (0 382 writel(MCF_SDRAMC_SDCFG1_SRD2RW((int)((SDRAM_CASL + 2) + 0.5)) |
383 | MCF_SDRAMC_SDCFG1_SRD2RW((int)((SDRAM_CASL + 2) + 0.5 )) 383 MCF_SDRAMC_SDCFG1_SWT2RD(SDRAM_TWR + 1) |
384 | MCF_SDRAMC_SDCFG1_SWT2RD(SDRAM_TWR + 1) 384 MCF_SDRAMC_SDCFG1_RDLAT((int)((SDRAM_CASL * 2) + 2)) |
385 | MCF_SDRAMC_SDCFG1_RDLAT((int)((SDRAM_CASL*2) + 2)) 385 MCF_SDRAMC_SDCFG1_ACT2RW((int)(SDRAM_TRCD + 0.5)) |
386 | MCF_SDRAMC_SDCFG1_ACT2RW((int)((SDRAM_TRCD ) + 0.5)) 386 MCF_SDRAMC_SDCFG1_PRE2ACT((int)(SDRAM_TRP + 0.5)) |
387 | MCF_SDRAMC_SDCFG1_PRE2ACT((int)((SDRAM_TRP ) + 0.5)) 387 MCF_SDRAMC_SDCFG1_REF2ACT((int)(SDRAM_TRFC + 0.5)) |
388 | MCF_SDRAMC_SDCFG1_REF2ACT((int)(((SDRAM_TRFC) ) + 0.5)) 388 MCF_SDRAMC_SDCFG1_WTLAT(3),
389 | MCF_SDRAMC_SDCFG1_WTLAT(3)); 389 MCF_SDRAMC_SDCFG1);
390 MCF_SDRAMC_SDCFG2 = (0 390 writel(MCF_SDRAMC_SDCFG2_BRD2PRE(SDRAM_BL / 2 + 1) |
391 | MCF_SDRAMC_SDCFG2_BRD2PRE(SDRAM_BL/2 + 1) 391 MCF_SDRAMC_SDCFG2_BWT2RW(SDRAM_BL / 2 + SDRAM_TWR) |
392 | MCF_SDRAMC_SDCFG2_BWT2RW(SDRAM_BL/2 + SDRAM_TWR) 392 MCF_SDRAMC_SDCFG2_BRD2WT((int)((SDRAM_CASL + SDRAM_BL / 2 - 1.0) + 0.5)) |
393 | MCF_SDRAMC_SDCFG2_BRD2WT((int)((SDRAM_CASL+SDRAM_BL/2-1.0)+0.5)) 393 MCF_SDRAMC_SDCFG2_BL(SDRAM_BL - 1),
394 | MCF_SDRAMC_SDCFG2_BL(SDRAM_BL-1)); 394 MCF_SDRAMC_SDCFG2);
395 395
396 396
397 /* 397 /*
398 * Precharge and enable write to SDMR 398 * Precharge and enable write to SDMR
399 */ 399 */
400 MCF_SDRAMC_SDCR = (0 400 writel(MCF_SDRAMC_SDCR_MODE_EN |
401 | MCF_SDRAMC_SDCR_MODE_EN 401 MCF_SDRAMC_SDCR_CKE |
402 | MCF_SDRAMC_SDCR_CKE 402 MCF_SDRAMC_SDCR_DDR |
403 | MCF_SDRAMC_SDCR_DDR 403 MCF_SDRAMC_SDCR_MUX(1) |
404 | MCF_SDRAMC_SDCR_MUX(1) 404 MCF_SDRAMC_SDCR_RCNT((int)(((SDRAM_TREFI / (SYSTEM_PERIOD * 64)) - 1) + 0.5)) |
405 | MCF_SDRAMC_SDCR_RCNT((int)(((SDRAM_TREFI/(SYSTEM_PERIOD*64)) - 1) + 0.5)) 405 MCF_SDRAMC_SDCR_PS_16 |
406 | MCF_SDRAMC_SDCR_PS_16 406 MCF_SDRAMC_SDCR_IPALL,
407 | MCF_SDRAMC_SDCR_IPALL); 407 MCF_SDRAMC_SDCR);
408 408
409 /* 409 /*
410 * Write extended mode register 410 * Write extended mode register
411 */ 411 */
412 MCF_SDRAMC_SDMR = (0 412 writel(MCF_SDRAMC_SDMR_BNKAD_LEMR |
413 | MCF_SDRAMC_SDMR_BNKAD_LEMR 413 MCF_SDRAMC_SDMR_AD(0x0) |
414 | MCF_SDRAMC_SDMR_AD(0x0) 414 MCF_SDRAMC_SDMR_CMD,
415 | MCF_SDRAMC_SDMR_CMD); 415 MCF_SDRAMC_SDMR);
416 416
417 /* 417 /*
418 * Write mode register and reset DLL 418 * Write mode register and reset DLL
419 */ 419 */
420 MCF_SDRAMC_SDMR = (0 420 writel(MCF_SDRAMC_SDMR_BNKAD_LMR |
421 | MCF_SDRAMC_SDMR_BNKAD_LMR 421 MCF_SDRAMC_SDMR_AD(0x163) |
422 | MCF_SDRAMC_SDMR_AD(0x163) 422 MCF_SDRAMC_SDMR_CMD,
423 | MCF_SDRAMC_SDMR_CMD); 423 MCF_SDRAMC_SDMR);
424 424
425 /* 425 /*
426 * Execute a PALL command 426 * Execute a PALL command
427 */ 427 */
428 MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_IPALL; 428 writel(readl(MCF_SDRAMC_SDCR) | MCF_SDRAMC_SDCR_IPALL, MCF_SDRAMC_SDCR);
429 429
430 /* 430 /*
431 * Perform two REF cycles 431 * Perform two REF cycles
432 */ 432 */
433 MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_IREF; 433 writel(readl(MCF_SDRAMC_SDCR) | MCF_SDRAMC_SDCR_IREF, MCF_SDRAMC_SDCR);
434 MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_IREF; 434 writel(readl(MCF_SDRAMC_SDCR) | MCF_SDRAMC_SDCR_IREF, MCF_SDRAMC_SDCR);
435 435
436 /* 436 /*
437 * Write mode register and clear reset DLL 437 * Write mode register and clear reset DLL
438 */ 438 */
439 MCF_SDRAMC_SDMR = (0 439 writel(MCF_SDRAMC_SDMR_BNKAD_LMR |
440 | MCF_SDRAMC_SDMR_BNKAD_LMR 440 MCF_SDRAMC_SDMR_AD(0x063) |
441 | MCF_SDRAMC_SDMR_AD(0x063) 441 MCF_SDRAMC_SDMR_CMD,
442 | MCF_SDRAMC_SDMR_CMD); 442 MCF_SDRAMC_SDMR);
443 443
444 /* 444 /*
445 * Enable auto refresh and lock SDMR 445 * Enable auto refresh and lock SDMR
446 */ 446 */
447 MCF_SDRAMC_SDCR &= ~MCF_SDRAMC_SDCR_MODE_EN; 447 writel(readl(MCF_SDRAMC_SDCR) & ~MCF_SDRAMC_SDCR_MODE_EN,
448 MCF_SDRAMC_SDCR |= (0 448 MCF_SDRAMC_SDCR);
449 | MCF_SDRAMC_SDCR_REF 449 writel(MCF_SDRAMC_SDCR_REF | MCF_SDRAMC_SDCR_DQS_OE(0xC),
450 | MCF_SDRAMC_SDCR_DQS_OE(0xC)); 450 MCF_SDRAMC_SDCR);
451 } 451 }
452} 452}
453 453
@@ -475,7 +475,7 @@ int clock_pll(int fsys, int flags)
475 475
476 if (fsys == 0) { 476 if (fsys == 0) {
477 /* Return current PLL output */ 477 /* Return current PLL output */
478 mfd = MCF_PLL_PFDR; 478 mfd = readb(MCF_PLL_PFDR);
479 479
480 return (fref * mfd / (BUSDIV * 4)); 480 return (fref * mfd / (BUSDIV * 4));
481 } 481 }
@@ -501,9 +501,10 @@ int clock_pll(int fsys, int flags)
501 * If it has then the SDRAM needs to be put into self refresh 501 * If it has then the SDRAM needs to be put into self refresh
502 * mode before reprogramming the PLL. 502 * mode before reprogramming the PLL.
503 */ 503 */
504 if (MCF_SDRAMC_SDCR & MCF_SDRAMC_SDCR_REF) 504 if (readl(MCF_SDRAMC_SDCR) & MCF_SDRAMC_SDCR_REF)
505 /* Put SDRAM into self refresh mode */ 505 /* Put SDRAM into self refresh mode */
506 MCF_SDRAMC_SDCR &= ~MCF_SDRAMC_SDCR_CKE; 506 writel(readl(MCF_SDRAMC_SDCR) & ~MCF_SDRAMC_SDCR_CKE,
507 MCF_SDRAMC_SDCR);
507 508
508 /* 509 /*
509 * Initialize the PLL to generate the new system clock frequency. 510 * Initialize the PLL to generate the new system clock frequency.
@@ -514,11 +515,10 @@ int clock_pll(int fsys, int flags)
514 clock_limp(DEFAULT_LPD); 515 clock_limp(DEFAULT_LPD);
515 516
516 /* Reprogram PLL for desired fsys */ 517 /* Reprogram PLL for desired fsys */
517 MCF_PLL_PODR = (0 518 writeb(MCF_PLL_PODR_CPUDIV(BUSDIV/3) | MCF_PLL_PODR_BUSDIV(BUSDIV),
518 | MCF_PLL_PODR_CPUDIV(BUSDIV/3) 519 MCF_PLL_PODR);
519 | MCF_PLL_PODR_BUSDIV(BUSDIV));
520 520
521 MCF_PLL_PFDR = mfd; 521 writeb(mfd, MCF_PLL_PFDR);
522 522
523 /* Exit LIMP mode */ 523 /* Exit LIMP mode */
524 clock_exit_limp(); 524 clock_exit_limp();
@@ -526,12 +526,13 @@ int clock_pll(int fsys, int flags)
526 /* 526 /*
527 * Return the SDRAM to normal operation if it is in use. 527 * Return the SDRAM to normal operation if it is in use.
528 */ 528 */
529 if (MCF_SDRAMC_SDCR & MCF_SDRAMC_SDCR_REF) 529 if (readl(MCF_SDRAMC_SDCR) & MCF_SDRAMC_SDCR_REF)
530 /* Exit self refresh mode */ 530 /* Exit self refresh mode */
531 MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_CKE; 531 writel(readl(MCF_SDRAMC_SDCR) | MCF_SDRAMC_SDCR_CKE,
532 MCF_SDRAMC_SDCR);
532 533
533 /* Errata - workaround for SDRAM opeartion after exiting LIMP mode */ 534 /* Errata - workaround for SDRAM opeartion after exiting LIMP mode */
534 MCF_SDRAMC_LIMP_FIX = MCF_SDRAMC_REFRESH; 535 writel(MCF_SDRAMC_REFRESH, MCF_SDRAMC_LIMP_FIX);
535 536
536 /* wait for DQS logic to relock */ 537 /* wait for DQS logic to relock */
537 for (i = 0; i < 0x200; i++) 538 for (i = 0; i < 0x200; i++)
@@ -552,14 +553,12 @@ int clock_limp(int div)
552 553
553 /* Save of the current value of the SSIDIV so we don't 554 /* Save of the current value of the SSIDIV so we don't
554 overwrite the value*/ 555 overwrite the value*/
555 temp = (MCF_CCM_CDR & MCF_CCM_CDR_SSIDIV(0xF)); 556 temp = readw(MCF_CCM_CDR) & MCF_CCM_CDR_SSIDIV(0xF);
556 557
557 /* Apply the divider to the system clock */ 558 /* Apply the divider to the system clock */
558 MCF_CCM_CDR = ( 0 559 writew(MCF_CCM_CDR_LPDIV(div) | MCF_CCM_CDR_SSIDIV(temp), MCF_CCM_CDR);
559 | MCF_CCM_CDR_LPDIV(div)
560 | MCF_CCM_CDR_SSIDIV(temp));
561 560
562 MCF_CCM_MISCCR |= MCF_CCM_MISCCR_LIMP; 561 writew(readw(MCF_CCM_MISCCR) | MCF_CCM_MISCCR_LIMP, MCF_CCM_MISCCR);
563 562
564 return (FREF/(3*(1 << div))); 563 return (FREF/(3*(1 << div)));
565} 564}
@@ -569,10 +568,10 @@ int clock_exit_limp(void)
569 int fout; 568 int fout;
570 569
571 /* Exit LIMP mode */ 570 /* Exit LIMP mode */
572 MCF_CCM_MISCCR = (MCF_CCM_MISCCR & ~ MCF_CCM_MISCCR_LIMP); 571 writew(readw(MCF_CCM_MISCCR) & ~MCF_CCM_MISCCR_LIMP, MCF_CCM_MISCCR);
573 572
574 /* Wait for PLL to lock */ 573 /* Wait for PLL to lock */
575 while (!(MCF_CCM_MISCCR & MCF_CCM_MISCCR_PLL_LOCK)) 574 while (!(readw(MCF_CCM_MISCCR) & MCF_CCM_MISCCR_PLL_LOCK))
576 ; 575 ;
577 576
578 fout = get_sys_clock(); 577 fout = get_sys_clock();
@@ -585,10 +584,10 @@ int get_sys_clock(void)
585 int divider; 584 int divider;
586 585
587 /* Test to see if device is in LIMP mode */ 586 /* Test to see if device is in LIMP mode */
588 if (MCF_CCM_MISCCR & MCF_CCM_MISCCR_LIMP) { 587 if (readw(MCF_CCM_MISCCR) & MCF_CCM_MISCCR_LIMP) {
589 divider = MCF_CCM_CDR & MCF_CCM_CDR_LPDIV(0xF); 588 divider = readw(MCF_CCM_CDR) & MCF_CCM_CDR_LPDIV(0xF);
590 return (FREF/(2 << divider)); 589 return (FREF/(2 << divider));
591 } 590 }
592 else 591 else
593 return ((FREF * MCF_PLL_PFDR) / (BUSDIV * 4)); 592 return (FREF * readb(MCF_PLL_PFDR)) / (BUSDIV * 4);
594} 593}