2002-11-03 00:24:07 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2002 Wolfgang Grandegger <wg@denx.de>
|
|
|
|
*
|
|
|
|
* See file CREDITS for list of people who contributed to this
|
|
|
|
* project.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <mpc824x.h>
|
2009-03-26 06:33:59 +00:00
|
|
|
#include <net.h>
|
2002-11-03 00:24:07 +00:00
|
|
|
#include <pci.h>
|
2008-08-31 17:08:43 +00:00
|
|
|
#include <netdev.h>
|
2002-11-03 00:24:07 +00:00
|
|
|
|
|
|
|
#include "pn62.h"
|
|
|
|
|
2006-03-31 16:32:53 +00:00
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
2002-11-03 00:24:07 +00:00
|
|
|
|
|
|
|
static int get_serial_number (char *string, int size);
|
2009-02-11 23:38:38 +00:00
|
|
|
static void get_mac_address(int id, u8 *mac);
|
2002-11-03 00:24:07 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_SHOW_BOOT_PROGRESS
|
|
|
|
void show_boot_progress (int phase)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Show phases of the bootm command on the front panel
|
|
|
|
* LEDs and the scratchpad register #3 as well. We use
|
|
|
|
* blinking LEDs for logical "1".
|
|
|
|
*/
|
|
|
|
if (phase > 0) {
|
|
|
|
set_led (8, (phase & 0x1) ? LED_SLOW_CLOCK : LED_0);
|
|
|
|
set_led (9, (phase & 0x2) ? LED_SLOW_CLOCK : LED_0);
|
|
|
|
set_led (10, (phase & 0x4) ? LED_SLOW_CLOCK : LED_0);
|
|
|
|
set_led (11, (phase & 0x8) ? LED_SLOW_CLOCK : LED_0);
|
|
|
|
}
|
|
|
|
i2155x_write_scrapad (BOOT_STATUS, phase);
|
|
|
|
if (phase < 0)
|
|
|
|
i2155x_write_scrapad (BOOT_DONE, BOOT_DONE_ERROR);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void show_startup_phase (int phase)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Show the phase of U-Boot startup on the front panel
|
|
|
|
* LEDs and the scratchpad register #3 as well.
|
|
|
|
*/
|
|
|
|
if (phase > 0) {
|
|
|
|
set_led (8, (phase & 0x1) ? LED_1 : LED_0);
|
|
|
|
set_led (9, (phase & 0x2) ? LED_1 : LED_0);
|
|
|
|
set_led (10, (phase & 0x4) ? LED_1 : LED_0);
|
|
|
|
set_led (11, (phase & 0x8) ? LED_1 : LED_0);
|
|
|
|
}
|
|
|
|
i2155x_write_scrapad (BOOT_STATUS, phase);
|
|
|
|
if (phase < 0)
|
|
|
|
i2155x_write_scrapad (BOOT_DONE, BOOT_DONE_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
int checkboard (void)
|
|
|
|
{
|
|
|
|
show_startup_phase (1);
|
|
|
|
puts ("Board: PN62\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-06-09 21:03:40 +00:00
|
|
|
phys_size_t initdram (int board_type)
|
2002-11-03 00:24:07 +00:00
|
|
|
{
|
2004-01-06 22:38:14 +00:00
|
|
|
long size;
|
|
|
|
long new_bank0_end;
|
|
|
|
long mear1;
|
|
|
|
long emear1;
|
2002-11-03 00:24:07 +00:00
|
|
|
|
|
|
|
show_startup_phase (2);
|
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
size = get_ram_size(CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_MAX_RAM_SIZE);
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2004-01-06 22:38:14 +00:00
|
|
|
new_bank0_end = size - 1;
|
|
|
|
mear1 = mpc824x_mpc107_getreg (MEAR1);
|
|
|
|
emear1 = mpc824x_mpc107_getreg (EMEAR1);
|
|
|
|
mear1 = (mear1 & 0xFFFFFF00) |
|
|
|
|
((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
|
|
|
|
emear1 = (emear1 & 0xFFFFFF00) |
|
|
|
|
((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
|
|
|
|
mpc824x_mpc107_setreg (MEAR1, mear1);
|
|
|
|
mpc824x_mpc107_setreg (EMEAR1, emear1);
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2004-01-06 22:38:14 +00:00
|
|
|
return (size);
|
2002-11-03 00:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize PCI Devices. We rely on auto-configuration.
|
|
|
|
*/
|
|
|
|
#ifndef CONFIG_PCI_PNP
|
|
|
|
#error "CONFIG_PCI_PNP is not defined, please correct!"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct pci_controller hose = {
|
|
|
|
};
|
|
|
|
|
2003-02-14 11:21:23 +00:00
|
|
|
void pci_init_board (void)
|
2002-11-03 00:24:07 +00:00
|
|
|
{
|
|
|
|
show_startup_phase (4);
|
|
|
|
pci_mpc824x_init (&hose);
|
|
|
|
|
|
|
|
show_startup_phase (5);
|
|
|
|
i2155x_init ();
|
|
|
|
show_startup_phase (6);
|
|
|
|
am79c95x_init ();
|
|
|
|
show_startup_phase (7);
|
|
|
|
}
|
|
|
|
|
|
|
|
int misc_init_r (void)
|
|
|
|
{
|
|
|
|
char str[20];
|
|
|
|
u8 mac[6];
|
|
|
|
|
|
|
|
show_startup_phase (8);
|
|
|
|
/*
|
|
|
|
* Get serial number and ethernet addresses if not already defined
|
|
|
|
* and update the board info structure and the environment.
|
|
|
|
*/
|
|
|
|
if (getenv ("serial#") == NULL &&
|
|
|
|
get_serial_number (str, strlen (str)) > 0) {
|
|
|
|
setenv ("serial#", str);
|
|
|
|
}
|
|
|
|
show_startup_phase (9);
|
|
|
|
|
2009-02-11 23:38:38 +00:00
|
|
|
if (!eth_getenv_enetaddr("ethaddr", mac)) {
|
|
|
|
get_mac_address(0, mac);
|
|
|
|
eth_setenv_enetaddr("ethaddr", mac);
|
2002-11-03 00:24:07 +00:00
|
|
|
}
|
|
|
|
show_startup_phase (10);
|
|
|
|
|
2004-12-31 09:32:47 +00:00
|
|
|
#ifdef CONFIG_HAS_ETH1
|
2009-02-11 23:38:38 +00:00
|
|
|
if (!eth_getenv_enetaddr("eth1addr", mac)) {
|
|
|
|
get_mac_address(1, mac);
|
|
|
|
eth_setenv_enetaddr("eth1addr", mac);
|
2002-11-03 00:24:07 +00:00
|
|
|
}
|
2004-12-31 09:32:47 +00:00
|
|
|
#endif /* CONFIG_HAS_ETH1 */
|
2002-11-03 00:24:07 +00:00
|
|
|
show_startup_phase (11);
|
|
|
|
|
|
|
|
/* Tell everybody that U-Boot is up and runnig */
|
|
|
|
i2155x_write_scrapad (0, 0x12345678);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int get_serial_number (char *string, int size)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char c;
|
|
|
|
|
|
|
|
if (size < I2155X_VPD_SN_SIZE)
|
|
|
|
size = I2155X_VPD_SN_SIZE;
|
|
|
|
for (i = 0; i < (size - 1); i++) {
|
2005-10-13 14:45:02 +00:00
|
|
|
i2155x_read_vpd (I2155X_VPD_SN_START + i, 1, (uchar *)&c);
|
2002-11-03 00:24:07 +00:00
|
|
|
if (c == '\0')
|
|
|
|
break;
|
|
|
|
string[i] = c;
|
|
|
|
}
|
|
|
|
string[i] = '\0'; /* make sure it's terminated */
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2009-02-11 23:38:38 +00:00
|
|
|
static void get_mac_address(int id, u8 *mac)
|
2002-11-03 00:24:07 +00:00
|
|
|
{
|
|
|
|
i2155x_read_vpd (I2155X_VPD_MAC0_START + 6 * id, 6, mac);
|
|
|
|
}
|
2008-08-31 17:08:43 +00:00
|
|
|
|
|
|
|
int board_eth_init(bd_t *bis)
|
|
|
|
{
|
|
|
|
return pci_eth_init(bis);
|
|
|
|
}
|