2 * (C) Copyright 2002 Wolfgang Grandegger <wg@denx.de>
4 * SPDX-License-Identifier: GPL-2.0+
15 DECLARE_GLOBAL_DATA_PTR;
17 static int get_serial_number (char *string, int size);
18 static void get_mac_address(int id, u8 *mac);
20 #ifdef CONFIG_SHOW_BOOT_PROGRESS
21 void show_boot_progress (int phase)
24 * Show phases of the bootm command on the front panel
25 * LEDs and the scratchpad register #3 as well. We use
26 * blinking LEDs for logical "1".
29 set_led (8, (phase & 0x1) ? LED_SLOW_CLOCK : LED_0);
30 set_led (9, (phase & 0x2) ? LED_SLOW_CLOCK : LED_0);
31 set_led (10, (phase & 0x4) ? LED_SLOW_CLOCK : LED_0);
32 set_led (11, (phase & 0x8) ? LED_SLOW_CLOCK : LED_0);
34 i2155x_write_scrapad (BOOT_STATUS, phase);
36 i2155x_write_scrapad (BOOT_DONE, BOOT_DONE_ERROR);
40 void show_startup_phase (int phase)
43 * Show the phase of U-Boot startup on the front panel
44 * LEDs and the scratchpad register #3 as well.
47 set_led (8, (phase & 0x1) ? LED_1 : LED_0);
48 set_led (9, (phase & 0x2) ? LED_1 : LED_0);
49 set_led (10, (phase & 0x4) ? LED_1 : LED_0);
50 set_led (11, (phase & 0x8) ? LED_1 : LED_0);
52 i2155x_write_scrapad (BOOT_STATUS, phase);
54 i2155x_write_scrapad (BOOT_DONE, BOOT_DONE_ERROR);
59 show_startup_phase (1);
60 puts ("Board: PN62\n");
64 phys_size_t initdram (int board_type)
71 show_startup_phase (2);
73 size = get_ram_size(CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_MAX_RAM_SIZE);
75 new_bank0_end = size - 1;
76 mear1 = mpc824x_mpc107_getreg (MEAR1);
77 emear1 = mpc824x_mpc107_getreg (EMEAR1);
78 mear1 = (mear1 & 0xFFFFFF00) |
79 ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
80 emear1 = (emear1 & 0xFFFFFF00) |
81 ((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
82 mpc824x_mpc107_setreg (MEAR1, mear1);
83 mpc824x_mpc107_setreg (EMEAR1, emear1);
89 * Initialize PCI Devices. We rely on auto-configuration.
91 #ifndef CONFIG_PCI_PNP
92 #error "CONFIG_PCI_PNP is not defined, please correct!"
95 struct pci_controller hose = {
98 void pci_init_board (void)
100 show_startup_phase (4);
101 pci_mpc824x_init (&hose);
103 show_startup_phase (5);
105 show_startup_phase (6);
107 show_startup_phase (7);
110 int misc_init_r (void)
115 show_startup_phase (8);
117 * Get serial number and ethernet addresses if not already defined
118 * and update the board info structure and the environment.
120 if (getenv ("serial#") == NULL &&
121 get_serial_number (str, strlen (str)) > 0) {
122 setenv ("serial#", str);
124 show_startup_phase (9);
126 if (!eth_getenv_enetaddr("ethaddr", mac)) {
127 get_mac_address(0, mac);
128 eth_setenv_enetaddr("ethaddr", mac);
130 show_startup_phase (10);
132 #ifdef CONFIG_HAS_ETH1
133 if (!eth_getenv_enetaddr("eth1addr", mac)) {
134 get_mac_address(1, mac);
135 eth_setenv_enetaddr("eth1addr", mac);
137 #endif /* CONFIG_HAS_ETH1 */
138 show_startup_phase (11);
140 /* Tell everybody that U-Boot is up and runnig */
141 i2155x_write_scrapad (0, 0x12345678);
145 static int get_serial_number (char *string, int size)
150 if (size < I2155X_VPD_SN_SIZE)
151 size = I2155X_VPD_SN_SIZE;
152 for (i = 0; i < (size - 1); i++) {
153 i2155x_read_vpd (I2155X_VPD_SN_START + i, 1, (uchar *)&c);
158 string[i] = '\0'; /* make sure it's terminated */
163 static void get_mac_address(int id, u8 *mac)
165 i2155x_read_vpd (I2155X_VPD_MAC0_START + 6 * id, 6, mac);
168 int board_eth_init(bd_t *bis)
170 return pci_eth_init(bis);