blob: 39dc7fb77fe6015740f51c4b59f3f71e80ec74d5 [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
2 * (C) Copyright 2001
3 * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
4 *
5 * (C) Copyright 2002
6 * Gregory E. Allen, gallen@arlut.utexas.edu
7 * Matthew E. Karger, karger@arlut.utexas.edu
8 * Applied Research Laboratories, The University of Texas at Austin
9 *
10 * See file CREDITS for list of people who contributed to this
11 * project.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License as
15 * published by the Free Software Foundation; either version 2 of
16 * the License, or (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 * MA 02111-1307 USA
27 */
28
29#include <common.h>
30#include <mpc824x.h>
31#include <asm/processor.h>
32#include <asm/io.h>
wdenk7a8e9bed2003-05-31 18:35:21 +000033#include <asm/mmu.h>
wdenkc6097192002-11-03 00:24:07 +000034#include <pci.h>
35
36#define SAVE_SZ 32
37
38
39int checkboard(void)
40{
41 ulong busfreq = get_bus_freq(0);
42 char buf[32];
43
44 printf("Board: UTX8245 Local Bus at %s MHz\n", strmhz(buf, busfreq));
45 return 0;
46}
47
48
49long int initdram(int board_type)
50{
51#if 1
wdenkc83bf6a2004-01-06 22:38:14 +000052 long size;
53 long new_bank0_end;
54 long mear1;
55 long emear1;
wdenk7a8e9bed2003-05-31 18:35:21 +000056/*
57 write_bat(IBAT1, ((CFG_MAX_RAM_SIZE/2) | BATU_BL_256M | BATU_VS | BATU_VP),
58 ( (CFG_MAX_RAM_SIZE/2)| BATL_PP_10 | BATL_MEMCOHERENCE));
wdenkc6097192002-11-03 00:24:07 +000059
wdenk7a8e9bed2003-05-31 18:35:21 +000060 write_bat(DBAT1, ((CFG_MAX_RAM_SIZE/2) | BATU_BL_256M | BATU_VS | BATU_VP),
61 ( (CFG_MAX_RAM_SIZE/2)| BATL_PP_10 | BATL_MEMCOHERENCE));
62*/
wdenkc83bf6a2004-01-06 22:38:14 +000063 size = get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE);
wdenkc6097192002-11-03 00:24:07 +000064
wdenkc83bf6a2004-01-06 22:38:14 +000065 new_bank0_end = size - 1;
66 mear1 = mpc824x_mpc107_getreg(MEAR1);
67 emear1 = mpc824x_mpc107_getreg(EMEAR1);
68 mear1 = (mear1 & 0xFFFFFF00) |
69 ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
70 emear1 = (emear1 & 0xFFFFFF00) |
71 ((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
72 mpc824x_mpc107_setreg(MEAR1, mear1);
73 mpc824x_mpc107_setreg(EMEAR1, emear1);
wdenkc6097192002-11-03 00:24:07 +000074
wdenkc83bf6a2004-01-06 22:38:14 +000075 return (size);
wdenkc6097192002-11-03 00:24:07 +000076#else
77 return (CFG_MAX_RAM_SIZE);
78#endif
79
80}
81
82
83/*
84 * Initialize PCI Devices, report devices found.
85 */
86
87static struct pci_config_table pci_utx8245_config_table[] = {
88#ifndef CONFIG_PCI_PNP
wdenk7a8e9bed2003-05-31 18:35:21 +000089 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0C, PCI_ANY_ID,
wdenkc6097192002-11-03 00:24:07 +000090 pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
91 PCI_ENET0_MEMADDR,
92 PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
wdenk7a8e9bed2003-05-31 18:35:21 +000093 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0B, PCI_ANY_ID,
wdenkc6097192002-11-03 00:24:07 +000094 pci_cfgfunc_config_device, { PCI_FIREWIRE_IOADDR,
95 PCI_FIREWIRE_MEMADDR,
96 PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
97#endif /*CONFIG_PCI_PNP*/
98 { }
99};
100
101
102static void pci_utx8245_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
103{
104 if (PCI_DEV(dev) == 11)
105 /* assign serial interrupt line 9 (int25) to FireWire */
106 pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 25);
107
108 else if (PCI_DEV(dev) == 12)
109 /* assign serial interrupt line 8 (int24) to Ethernet */
110 pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 24);
wdenk7a8e9bed2003-05-31 18:35:21 +0000111
112 else if (PCI_DEV(dev) == 14)
113 /* assign serial interrupt line 0 (int16) to PMC slot 0 */
114 pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 16);
115
116 else if (PCI_DEV(dev) == 15)
117 /* assign serial interrupt line 1 (int17) to PMC slot 1 */
118 pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 17);
wdenkc6097192002-11-03 00:24:07 +0000119}
120
121static struct pci_controller utx8245_hose = {
122#ifndef CONFIG_PCI_PNP
123 config_table: pci_utx8245_config_table,
124 fixup_irq: pci_utx8245_fixup_irq,
125 write_byte: pci_hose_write_config_byte
126#endif /*CONFIG_PCI_PNP*/
127};
128
stroesead10dd92003-02-14 11:21:23 +0000129void pci_init_board (void)
wdenkc6097192002-11-03 00:24:07 +0000130{
131 pci_mpc824x_init(&utx8245_hose);
132
133 icache_enable();
134}