2 * (C) Copyright 2002 Wolfgang Grandegger <wg@denx.de>
4 * See file CREDITS for list of people who contributed to this
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30 static int get_serial_number (char *string, int size);
31 static int get_mac_address (int id, u8 * mac, char *string, int size);
33 #ifdef CONFIG_SHOW_BOOT_PROGRESS
34 void show_boot_progress (int phase)
37 * Show phases of the bootm command on the front panel
38 * LEDs and the scratchpad register #3 as well. We use
39 * blinking LEDs for logical "1".
42 set_led (8, (phase & 0x1) ? LED_SLOW_CLOCK : LED_0);
43 set_led (9, (phase & 0x2) ? LED_SLOW_CLOCK : LED_0);
44 set_led (10, (phase & 0x4) ? LED_SLOW_CLOCK : LED_0);
45 set_led (11, (phase & 0x8) ? LED_SLOW_CLOCK : LED_0);
47 i2155x_write_scrapad (BOOT_STATUS, phase);
49 i2155x_write_scrapad (BOOT_DONE, BOOT_DONE_ERROR);
53 void show_startup_phase (int phase)
56 * Show the phase of U-Boot startup on the front panel
57 * LEDs and the scratchpad register #3 as well.
60 set_led (8, (phase & 0x1) ? LED_1 : LED_0);
61 set_led (9, (phase & 0x2) ? LED_1 : LED_0);
62 set_led (10, (phase & 0x4) ? LED_1 : LED_0);
63 set_led (11, (phase & 0x8) ? LED_1 : LED_0);
65 i2155x_write_scrapad (BOOT_STATUS, phase);
67 i2155x_write_scrapad (BOOT_DONE, BOOT_DONE_ERROR);
72 show_startup_phase (1);
73 puts ("Board: PN62\n");
77 long int initdram (int board_type)
84 show_startup_phase (2);
86 size = get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE);
88 new_bank0_end = size - 1;
89 mear1 = mpc824x_mpc107_getreg (MEAR1);
90 emear1 = mpc824x_mpc107_getreg (EMEAR1);
91 mear1 = (mear1 & 0xFFFFFF00) |
92 ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
93 emear1 = (emear1 & 0xFFFFFF00) |
94 ((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
95 mpc824x_mpc107_setreg (MEAR1, mear1);
96 mpc824x_mpc107_setreg (EMEAR1, emear1);
102 * Initialize PCI Devices. We rely on auto-configuration.
104 #ifndef CONFIG_PCI_PNP
105 #error "CONFIG_PCI_PNP is not defined, please correct!"
108 struct pci_controller hose = {
111 void pci_init_board (void)
113 show_startup_phase (4);
114 pci_mpc824x_init (&hose);
116 show_startup_phase (5);
118 show_startup_phase (6);
120 show_startup_phase (7);
123 int misc_init_r (void)
125 DECLARE_GLOBAL_DATA_PTR;
130 show_startup_phase (8);
132 * Get serial number and ethernet addresses if not already defined
133 * and update the board info structure and the environment.
135 if (getenv ("serial#") == NULL &&
136 get_serial_number (str, strlen (str)) > 0) {
137 setenv ("serial#", str);
139 show_startup_phase (9);
141 if (getenv ("ethaddr") == NULL &&
142 get_mac_address (0, mac, str, sizeof (str)) > 0) {
143 setenv ("ethaddr", str);
144 memcpy (gd->bd->bi_enetaddr, mac, 6);
146 show_startup_phase (10);
148 #ifdef CONFIG_HAS_ETH1
149 if (getenv ("eth1addr") == NULL &&
150 get_mac_address (1, mac, str, sizeof (str)) > 0) {
151 setenv ("eth1addr", str);
152 memcpy (gd->bd->bi_enet1addr, mac, 6);
154 #endif /* CONFIG_HAS_ETH1 */
155 show_startup_phase (11);
157 /* Tell everybody that U-Boot is up and runnig */
158 i2155x_write_scrapad (0, 0x12345678);
162 static int get_serial_number (char *string, int size)
167 if (size < I2155X_VPD_SN_SIZE)
168 size = I2155X_VPD_SN_SIZE;
169 for (i = 0; i < (size - 1); i++) {
170 i2155x_read_vpd (I2155X_VPD_SN_START + i, 1, &c);
175 string[i] = '\0'; /* make sure it's terminated */
180 static int get_mac_address (int id, u8 * mac, char *string, int size)
185 i2155x_read_vpd (I2155X_VPD_MAC0_START + 6 * id, 6, mac);
186 return sprintf (string, "%02x:%02x:%02x:%02x:%02x:%02x",
187 mac[0], mac[1], mac[2],
188 mac[3], mac[4], mac[5]);