2 * (C) Copyright 2000-2004
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6 * Torsten Demke, FORCE Computers GmbH. torsten.demke@fci.com
8 * See file CREDITS for list of people who contributed to this
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 #include <asm/processor.h>
38 ulong busfreq = get_bus_freq (0);
41 printf ("Board: eXalion MPC824x - CHRP (MAP B)\n");
42 printf ("Built: %s at %s\n", __DATE__, __TIME__);
43 printf ("Local Bus: %s MHz\n", strmhz (buf, busfreq));
50 printf ("checkflash\n");
55 long int initdram (int board_type)
58 volatile uchar *base = CFG_SDRAM_BASE;
63 for (i = 0, cnt = (CFG_MAX_RAM_SIZE / sizeof (long)) >> 1; cnt > 0;
65 addr = (volatile ulong *) base + cnt;
70 addr = (volatile ulong *) base;
79 for (cnt = 1; cnt <= CFG_MAX_RAM_SIZE / sizeof (long); cnt <<= 1) {
80 addr = (volatile ulong *) base + cnt;
84 ulong new_bank0_end = cnt * sizeof (long) - 1;
85 ulong mear1 = mpc824x_mpc107_getreg (MEAR1);
86 ulong emear1 = mpc824x_mpc107_getreg (EMEAR1);
88 mear1 = (mear1 & 0xFFFFFF00) |
89 ((new_bank0_end & MICR_ADDR_MASK) >>
91 emear1 = (emear1 & 0xFFFFFF00) |
92 ((new_bank0_end & MICR_ADDR_MASK) >>
94 mpc824x_mpc107_setreg (MEAR1, mear1);
95 mpc824x_mpc107_setreg (EMEAR1, emear1);
97 ret = cnt * sizeof (long);
102 ret = CFG_MAX_RAM_SIZE;
107 int misc_init_r (void)
114 bdf = pci_find_device (PIIX4_VENDOR_ID, PIIX4_ISA_DEV_ID, 0);
116 puts ("Unable to find PIIX4 ISA bridge !\n");
120 /* set device for normal ISA instead EIO */
121 pci_read_config_dword (bdf, PCI_CFG_PIIX4_GENCFG, &val32);
123 pci_write_config_dword (bdf, PCI_CFG_PIIX4_GENCFG, val32);
124 printf ("PIIX4 ISA bridge (%d,%d,%d)\n", PCI_BUS (bdf),
125 PCI_DEV (bdf), PCI_FUNC (bdf));
128 bdf = pci_find_device (PIIX4_VENDOR_ID, PIIX4_IDE_DEV_ID, 0);
130 puts ("Unable to find PIIX4 IDE controller !\n");
134 /* Init BMIBA register */
135 /* pci_read_config_dword(bdf, PCI_CFG_PIIX4_BMIBA, &val32); */
136 /* val32 |= 0x1000; */
137 /* pci_write_config_dword(bdf, PCI_CFG_PIIX4_BMIBA, val32); */
139 /* Enable BUS master and IO access */
140 val32 = PCI_COMMAND_MASTER | PCI_COMMAND_IO;
141 pci_write_config_dword (bdf, PCI_COMMAND, val32);
144 pci_read_config_byte (bdf, PCI_LATENCY_TIMER, &val8);
146 pci_write_config_byte (bdf, PCI_LATENCY_TIMER, val8);
148 /* Enable Primary ATA/IDE */
149 pci_read_config_dword (bdf, PCI_CFG_PIIX4_IDETIM, &val32);
150 /* val32 = 0xa307a307; */
152 pci_write_config_dword (bdf, PCI_CFG_PIIX4_IDETIM, val32);
155 printf ("PIIX4 IDE controller (%d,%d,%d)\n", PCI_BUS (bdf),
156 PCI_DEV (bdf), PCI_FUNC (bdf));
158 /* Try to get FAT working... */
159 /* fat_register_read(ide_read); */
166 * Show/Init PCI devices on the specified bus number.
169 void pci_eXalion_fixup_irq (struct pci_controller *hose, pci_dev_t dev)
173 switch (PCI_DEV (dev)) {
186 #if defined (CONFIG_MPC8245)
201 pci_hose_write_config_byte (hose, dev, PCI_INTERRUPT_LINE, line);
206 * Initialize PCI Devices, report devices found.
208 #ifndef CONFIG_PCI_PNP
209 #if defined (CONFIG_MPC8240)
210 static struct pci_config_table pci_eXalion_config_table[] = {
212 /* Intel 82559ER ethernet controller */
213 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x00, 18, 0x00,
214 pci_cfgfunc_config_device, {PCI_ENET0_IOADDR,
217 PCI_COMMAND_MASTER}},
219 /* Intel 82371AB PIIX4 PCI to ISA bridge */
220 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x00, 20, 0x00,
221 pci_cfgfunc_config_device, {0,
223 PCI_COMMAND_IO | PCI_COMMAND_MASTER}},
225 /* Intel 82371AB PIIX4 IDE controller */
226 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x00, 20, 0x01,
227 pci_cfgfunc_config_device, {0,
229 PCI_COMMAND_IO | PCI_COMMAND_MASTER}},
232 #elif defined (CONFIG_MPC8245)
233 static struct pci_config_table pci_eXalion_config_table[] = {
235 /* Intel 82559ER ethernet controller */
236 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x00, 17, 0x00,
237 pci_cfgfunc_config_device, {PCI_ENET0_IOADDR,
240 PCI_COMMAND_MASTER}},
242 /* Intel 82559ER ethernet controller */
243 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x00, 18, 0x00,
244 pci_cfgfunc_config_device, {PCI_ENET1_IOADDR,
247 PCI_COMMAND_MASTER}},
249 /* Broadcom BCM5690 Gigabit switch */
250 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x00, 20, 0x00,
251 pci_cfgfunc_config_device, {PCI_ENET2_IOADDR,
254 PCI_COMMAND_MASTER}},
256 /* Broadcom BCM5690 Gigabit switch */
257 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x00, 21, 0x00,
258 pci_cfgfunc_config_device, {PCI_ENET3_IOADDR,
261 PCI_COMMAND_MASTER}},
263 /* Intel 82371AB PIIX4 PCI to ISA bridge */
264 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x00, 22, 0x00,
265 pci_cfgfunc_config_device, {0,
267 PCI_COMMAND_IO | PCI_COMMAND_MASTER}},
269 /* Intel 82371AB PIIX4 IDE controller */
270 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x00, 22, 0x01,
271 pci_cfgfunc_config_device, {0,
273 PCI_COMMAND_IO | PCI_COMMAND_MASTER}},
277 #error Specific type of MPC824x must be defined (i.e. CONFIG_MPC8240)
280 #endif /* #ifndef CONFIG_PCI_PNP */
282 struct pci_controller hose = {
283 #ifndef CONFIG_PCI_PNP
284 config_table:pci_eXalion_config_table,
285 fixup_irq:pci_eXalion_fixup_irq,
289 void pci_init_board (void)
291 pci_mpc824x_init (&hose);