]>
Commit | Line | Data |
---|---|---|
c609719b WD |
1 | /* |
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> | |
7a8e9bed | 33 | #include <asm/mmu.h> |
c609719b WD |
34 | #include <pci.h> |
35 | ||
36 | #define SAVE_SZ 32 | |
37 | ||
38 | ||
39 | int 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 | ||
49 | long int initdram(int board_type) | |
50 | { | |
c83bf6a2 WD |
51 | long size; |
52 | long new_bank0_end; | |
498b8db7 | 53 | long new_bank1_end; |
c83bf6a2 WD |
54 | long mear1; |
55 | long emear1; | |
7a8e9bed | 56 | |
c83bf6a2 WD |
57 | size = get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE); |
58 | ||
498b8db7 WD |
59 | new_bank0_end = size/2 - 1; |
60 | new_bank1_end = size - 1; | |
c83bf6a2 WD |
61 | mear1 = mpc824x_mpc107_getreg(MEAR1); |
62 | emear1 = mpc824x_mpc107_getreg(EMEAR1); | |
498b8db7 WD |
63 | |
64 | mear1 = (mear1 & 0xFFFF0000) | | |
65 | ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) | | |
66 | ((new_bank1_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT << 8); | |
67 | emear1 = (emear1 & 0xFFFF0000) | | |
68 | ((new_bank0_end & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) | | |
69 | ((new_bank1_end & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT << 8); | |
e35745bb | 70 | |
c83bf6a2 WD |
71 | mpc824x_mpc107_setreg(MEAR1, mear1); |
72 | mpc824x_mpc107_setreg(EMEAR1, emear1); | |
73 | ||
74 | return (size); | |
c609719b WD |
75 | } |
76 | ||
77 | ||
78 | /* | |
79 | * Initialize PCI Devices, report devices found. | |
80 | */ | |
81 | ||
82 | static struct pci_config_table pci_utx8245_config_table[] = { | |
83 | #ifndef CONFIG_PCI_PNP | |
7a8e9bed | 84 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0C, PCI_ANY_ID, |
c609719b WD |
85 | pci_cfgfunc_config_device, { PCI_ENET0_IOADDR, |
86 | PCI_ENET0_MEMADDR, | |
87 | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }}, | |
7a8e9bed | 88 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0B, PCI_ANY_ID, |
c609719b WD |
89 | pci_cfgfunc_config_device, { PCI_FIREWIRE_IOADDR, |
90 | PCI_FIREWIRE_MEMADDR, | |
91 | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }}, | |
92 | #endif /*CONFIG_PCI_PNP*/ | |
93 | { } | |
94 | }; | |
95 | ||
96 | ||
97 | static void pci_utx8245_fixup_irq(struct pci_controller *hose, pci_dev_t dev) | |
98 | { | |
99 | if (PCI_DEV(dev) == 11) | |
100 | /* assign serial interrupt line 9 (int25) to FireWire */ | |
101 | pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 25); | |
102 | ||
103 | else if (PCI_DEV(dev) == 12) | |
104 | /* assign serial interrupt line 8 (int24) to Ethernet */ | |
105 | pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 24); | |
7a8e9bed WD |
106 | |
107 | else if (PCI_DEV(dev) == 14) | |
108 | /* assign serial interrupt line 0 (int16) to PMC slot 0 */ | |
109 | pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 16); | |
110 | ||
111 | else if (PCI_DEV(dev) == 15) | |
112 | /* assign serial interrupt line 1 (int17) to PMC slot 1 */ | |
113 | pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 17); | |
c609719b WD |
114 | } |
115 | ||
116 | static struct pci_controller utx8245_hose = { | |
117 | #ifndef CONFIG_PCI_PNP | |
118 | config_table: pci_utx8245_config_table, | |
119 | fixup_irq: pci_utx8245_fixup_irq, | |
120 | write_byte: pci_hose_write_config_byte | |
121 | #endif /*CONFIG_PCI_PNP*/ | |
122 | }; | |
123 | ||
ad10dd9a | 124 | void pci_init_board (void) |
c609719b WD |
125 | { |
126 | pci_mpc824x_init(&utx8245_hose); | |
127 | ||
128 | icache_enable(); | |
129 | } |