]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/m5271evb/m5271evb.c
2 * (C) Copyright 2000-2006
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 #include <asm/immap.h>
27 int checkboard (void) {
28 puts ("Board: Freescale M5271EVB\n");
32 long int initdram (int board_type
) {
36 /* Enable Address lines 23-21 and lower 16bits of data path */
37 mbar_writeByte(MCF_GPIO_PAR_AD
, MCF_GPIO_AD_ADDR23
|
38 MCF_GPIO_AD_ADDR22
| MCF_GPIO_AD_ADDR21
|
41 /* Set CS2 pin to be SD_CS0 */
42 mbar_writeByte(MCF_GPIO_PAR_CS
, mbar_readByte(MCF_GPIO_PAR_CS
)
43 | MCF_GPIO_PAR_CS_PAR_CS2
);
45 /* Configure SDRAM Control Pin Assignemnt Register */
46 mbar_writeByte(MCF_GPIO_PAR_SDRAM
, MCF_GPIO_SDRAM_CSSDCS_00
|
47 MCF_GPIO_SDRAM_SDWE
| MCF_GPIO_SDRAM_SCAS
|
48 MCF_GPIO_SDRAM_SRAS
| MCF_GPIO_SDRAM_SCKE
|
49 MCF_GPIO_SDRAM_SDCS_11
);
52 * Check to see if the SDRAM has already been initialized
53 * by a run control tool
55 if (!(mbar_readLong(MCF_SDRAMC_DACR0
) & MCF_SDRAMC_DACRn_RE
)) {
56 /* Initialize DRAM Control Register: DCR */
57 mbar_writeShort(MCF_SDRAMC_DCR
,
58 MCF_SDRAMC_DCR_RTIM(0x01)
59 | MCF_SDRAMC_DCR_RC(0x30));
65 * CBM: cmd at A20, bank select bits 21 and up
68 mbar_writeLong(MCF_SDRAMC_DACR0
,
69 MCF_SDRAMC_DACRn_BA(CFG_SDRAM_BASE
>>18)
70 | MCF_SDRAMC_DACRn_CASL(1)
71 | MCF_SDRAMC_DACRn_CBM(3)
72 | MCF_SDRAMC_DACRn_PS(0));
75 mbar_writeLong(MCF_SDRAMC_DMR0
,
76 MCF_SDRAMC_DMRn_BAM_16M
79 /* Set IP bit in DACR */
80 mbar_writeLong(MCF_SDRAMC_DACR0
, mbar_readLong(MCF_SDRAMC_DACR0
)
81 | MCF_SDRAMC_DACRn_IP
);
83 /* Wait at least 20ns to allow banks to precharge */
84 for (i
= 0; i
< 5; i
++)
87 /* Write to this block to initiate precharge */
88 *(u32
*)(CFG_SDRAM_BASE
) = 0xa5a5a5a5;
90 /* Set RE bit in DACR */
91 mbar_writeLong(MCF_SDRAMC_DACR0
, mbar_readLong(MCF_SDRAMC_DACR0
)
92 | MCF_SDRAMC_DACRn_RE
);
94 /* Wait for at least 8 auto refresh cycles to occur */
95 for (i
= 0; i
< 2000; i
++)
98 /* Finish the configuration by issuing the MRS */
99 mbar_writeLong(MCF_SDRAMC_DACR0
, mbar_readLong(MCF_SDRAMC_DACR0
)
100 | MCF_SDRAMC_DACRn_MRS
);
103 * Write to the SDRAM Mode Register A0-A11 = 0x400
105 * Write Burst Mode = Programmed Burst Length
106 * Op Mode = Standard Op
108 * Burst Type = Sequential
111 *(u32
*)(CFG_SDRAM_BASE
+ 0x400) = 0xa5a5a5a5;
114 return CFG_SDRAM_SIZE
* 1024 * 1024;
117 int testdram (void) {
119 /* TODO: XXX XXX XXX */
120 printf ("DRAM test not implemented!\n");