3 * Rob Taylor, Flying Pig Systems. robt@flyingpig.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,
29 DECLARE_GLOBAL_DATA_PTR;
33 puts ( "Board: OXC8240\n" );
37 long int initdram (int board_type)
45 size = get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE);
47 new_bank0_end = size - 1;
48 mear1 = mpc824x_mpc107_getreg(MEAR1);
49 emear1 = mpc824x_mpc107_getreg(EMEAR1);
50 mear1 = (mear1 & 0xFFFFFF00) |
51 ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
52 emear1 = (emear1 & 0xFFFFFF00) |
53 ((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
54 mpc824x_mpc107_setreg(MEAR1, mear1);
55 mpc824x_mpc107_setreg(EMEAR1, emear1);
59 /* if U-Boot starts from RAM, then suppose we have 16Mb of RAM */
65 * Initialize PCI Devices, report devices found.
67 #ifndef CONFIG_PCI_PNP
68 static struct pci_config_table pci_oxc_config_table[] = {
69 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x14, PCI_ANY_ID,
70 pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
72 PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
73 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x15, PCI_ANY_ID,
74 pci_cfgfunc_config_device, { PCI_ENET1_IOADDR,
76 PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
81 static struct pci_controller hose = {
82 #ifndef CONFIG_PCI_PNP
83 config_table: pci_oxc_config_table,
87 void pci_init_board (void)
89 pci_mpc824x_init(&hose);
92 int board_early_init_f (void)
94 *(volatile unsigned char *)(CFG_CPLD_RESET) = 0x89;
98 #ifdef CONFIG_WATCHDOG
99 void oxc_wdt_reset(void)
101 *(volatile unsigned char *)(CFG_CPLD_WATCHDOG) = 0xff;
104 void watchdog_reset(void)
106 int re_enable = disable_interrupts();
114 static int oxc_get_expander(unsigned char addr, unsigned char * val)
116 return i2c_read(addr, 0, 0, val, 1);
119 static int oxc_set_expander(unsigned char addr, unsigned char val)
121 return i2c_write(addr, 0, 0, &val, 1);
124 static int expander0alive = 0;
126 #ifdef CONFIG_SHOW_ACTIVITY
127 static int ledtoggle = 0;
128 static int ledstatus = 1;
130 void oxc_toggle_activeled(void)
135 void board_show_activity (ulong timestamp)
137 if ((timestamp % (CFG_HZ / 10)) == 0)
138 oxc_toggle_activeled ();
141 void show_activity(int arg)
143 static unsigned char led = 0;
146 if (!expander0alive) return;
148 if ((ledtoggle > (2 * arg)) && ledstatus) {
150 oxc_get_expander(CFG_I2C_EXPANDER0_ADDR, &val);
152 oxc_set_expander(CFG_I2C_EXPANDER0_ADDR, (val & 0x7F) | led);
158 #ifdef CONFIG_SHOW_BOOT_PROGRESS
159 void show_boot_progress(int arg)
163 if (!expander0alive) return;
165 if (arg > 0 && ledstatus) {
167 oxc_get_expander(CFG_I2C_EXPANDER0_ADDR, &val);
169 oxc_set_expander(CFG_I2C_EXPANDER0_ADDR, val | 0x80);
170 } else if (arg < 0) {
171 oxc_get_expander(CFG_I2C_EXPANDER0_ADDR, &val);
173 oxc_set_expander(CFG_I2C_EXPANDER0_ADDR, val & 0x7F);
179 int misc_init_r (void)
181 /* check whether the i2c expander #0 is accessible */
182 if (!oxc_set_expander(CFG_I2C_EXPANDER0_ADDR, 0x7F)) {
187 #ifdef CFG_OXC_GENERATE_IP
190 unsigned long ip = CFG_OXC_IPMASK;
193 if (expander0alive) {
196 if (!oxc_get_expander(CFG_I2C_EXPANDER0_ADDR, &val)) {
197 ip = (ip & 0xffffff00) | ((val & 0x7c) >> 2);
201 if ((ip & 0xff) < 3) {
202 /* if fail, set x.x.x.254 */
203 ip = (ip & 0xffffff00) | 0xfe;
207 sprintf(str, "%ld.%ld.%ld.%ld",
208 (bd->bi_ip_addr & 0xff000000) >> 24,
209 (bd->bi_ip_addr & 0x00ff0000) >> 16,
210 (bd->bi_ip_addr & 0x0000ff00) >> 8,
211 (bd->bi_ip_addr & 0x000000ff));
212 setenv("ipaddr", str);
213 printf("ip: %s\n", str);