2 * (C) Copyright 2004, Freescale Inc.
3 * TsiChung Liew, Tsi-Chung.Liew@freescale.com
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,
26 #include <asm/processor.h>
29 void setupBat (ulong size
)
35 #if defined (CONFIG_SYS_AMD_BOOT)
36 batu
= CONFIG_SYS_FLASH0_BASE
| BATU_BL_512K
| BPP_RW
| BPP_RX
;
38 batu
= CONFIG_SYS_FLASH0_BASE
| BATU_BL_16M
| BPP_RW
| BPP_RX
;
40 batl
= CONFIG_SYS_FLASH0_BASE
| 0x22;
41 write_bat (IBAT0
, batu
, batl
);
42 write_bat (DBAT0
, batu
, batl
);
45 #if defined (CONFIG_SYS_AMD_BOOT)
46 batu
= CONFIG_SYS_FLASH1_BASE
| BATU_BL_16M
| BPP_RW
| BPP_RX
;
48 batu
= CONFIG_SYS_FLASH1_BASE
| BATU_BL_512K
| BPP_RW
| BPP_RX
;
50 batl
= CONFIG_SYS_FLASH1_BASE
| 0x22;
51 write_bat (IBAT1
, batu
, batl
);
52 write_bat (DBAT1
, batu
, batl
);
55 batu
= CONFIG_SYS_CPLD_BASE
| BATU_BL_512K
| BPP_RW
| BPP_RX
;
56 batl
= CONFIG_SYS_CPLD_BASE
| 0x22;
57 write_bat (IBAT2
, 0, 0);
58 write_bat (DBAT2
, batu
, batl
);
61 batu
= CONFIG_SYS_FPGA_BASE
| BATU_BL_512K
| BPP_RW
| BPP_RX
;
62 batl
= CONFIG_SYS_FPGA_BASE
| 0x22;
63 write_bat (IBAT3
, 0, 0);
64 write_bat (DBAT3
, batu
, batl
);
66 /* MBAR - Data only */
67 batu
= CONFIG_SYS_MBAR
| BPP_RW
| BPP_RX
;
68 batl
= CONFIG_SYS_MBAR
| 0x22;
75 batu
= CONFIG_SYS_SRAM_BASE
| BPP_RW
| BPP_RX
;
76 batl
= CONFIG_SYS_SRAM_BASE
| 0x42;
82 if (size
<= 0x800000) /* 8MB */
83 blocksize
= BATU_BL_8M
;
84 else if (size
<= 0x1000000) /* 16MB */
85 blocksize
= BATU_BL_16M
;
86 else if (size
<= 0x2000000) /* 32MB */
87 blocksize
= BATU_BL_32M
;
88 else if (size
<= 0x4000000) /* 64MB */
89 blocksize
= BATU_BL_64M
;
90 else if (size
<= 0x8000000) /* 128MB */
91 blocksize
= BATU_BL_128M
;
92 else if (size
<= 0x10000000) /* 256MB */
93 blocksize
= BATU_BL_256M
;
96 batu
= CONFIG_SYS_SDRAM_BASE
| blocksize
| BPP_RW
| BPP_RX
;
97 batl
= CONFIG_SYS_SDRAM_BASE
| 0x42;
100 mtspr (DBAT6L
, batl
);
101 mtspr (DBAT6U
, batu
);
103 /* memory size is less than 256MB */
104 if (size
<= 0x10000000) {
110 if (size
<= 0x800000) /* 8MB */
111 blocksize
= BATU_BL_8M
;
112 else if (size
<= 0x1000000) /* 16MB */
113 blocksize
= BATU_BL_16M
;
114 else if (size
<= 0x2000000) /* 32MB */
115 blocksize
= BATU_BL_32M
;
116 else if (size
<= 0x4000000) /* 64MB */
117 blocksize
= BATU_BL_64M
;
118 else if (size
<= 0x8000000) /* 128MB */
119 blocksize
= BATU_BL_128M
;
120 else if (size
<= 0x10000000) /* 256MB */
121 blocksize
= BATU_BL_256M
;
123 batu
= (CONFIG_SYS_SDRAM_BASE
+
124 0x10000000) | blocksize
| BPP_RW
| BPP_RX
;
125 batl
= (CONFIG_SYS_SDRAM_BASE
+ 0x10000000) | 0x42;
128 mtspr (IBAT7L
, batl
);
129 mtspr (IBAT7U
, batu
);
130 mtspr (DBAT7L
, batl
);
131 mtspr (DBAT7U
, batu
);
134 phys_size_t
initdram (int board_type
)
140 /* if iCache ad dCache is defined */
141 #if defined(CONFIG_CMD_CACHE)
148 int checkboard (void)
150 puts ("Board: Alaska MPC8220 Evaluation Board\n");