Commit 566a494f authored by Heiko Schocher's avatar Heiko Schocher
Browse files

[PCS440EP] upgrade the PCS440EP board:

                - Show on the Status LEDs, some States of the board.
                - Get the MAC addresses from the EEProm
                - use PREBOOT
                - use the CF on the board.
                - check the U-Boot image in the Flash with a SHA1
                  checksum.
                - use dynamic TLB entries generation for the SDRAM
Signed-off-by: default avatarHeiko Schocher <hs@denx.de>
parent 9912121f
......@@ -245,7 +245,7 @@ __LIBS := $(subst $(obj),,$(LIBS))
#########################################################################
#########################################################################
ALL = $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND)
ALL += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND)
all: $(ALL)
......@@ -265,6 +265,9 @@ $(obj)u-boot.img: $(obj)u-boot.bin
sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
-d $< $@
$(obj)u-boot.sha1: $(obj)u-boot.bin
./tools/ubsha1 $(obj)u-boot.bin
$(obj)u-boot.dis: $(obj)u-boot
$(OBJDUMP) -d $< > $@
......@@ -2455,7 +2458,7 @@ clean:
$(obj)examples/smc91111_eeprom $(obj)examples/interrupt \
$(obj)examples/test_burst
rm -f $(obj)tools/img2srec $(obj)tools/mkimage $(obj)tools/envcrc \
$(obj)tools/gen_eth_addr
$(obj)tools/gen_eth_addr $(obj)tools/ubsha1
rm -f $(obj)tools/mpc86x_clk $(obj)tools/ncb
rm -f $(obj)tools/easylogo/easylogo $(obj)tools/bmp_logo
rm -f $(obj)tools/gdb/astest $(obj)tools/gdb/gdbcont $(obj)tools/gdb/gdbsend
......@@ -2478,7 +2481,7 @@ clobber: clean
rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS $(obj)include/version_autogenerated.h
rm -fr $(obj)*.*~
rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
rm -f $(obj)tools/crc32.c $(obj)tools/environment.c $(obj)tools/env/crc32.c
rm -f $(obj)tools/crc32.c $(obj)tools/environment.c $(obj)tools/env/crc32.c $(obj)tools/sha1.c
rm -f $(obj)tools/inca-swap-bytes $(obj)cpu/mpc824x/bedbug_603e.c
rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
[ ! -d $(OBJTREE)/nand_spl ] || find $(obj)nand_spl -lname "*" -print | xargs rm -f
......
......@@ -1699,28 +1699,69 @@ The following options need to be configured:
-31 post/post.c POST test failed, detected by post_output_backlog()
-32 post/post.c POST test failed, detected by post_run_single()
-1 common/cmd_doc.c Bad usage of "doc" command
-1 common/cmd_doc.c No boot device
-1 common/cmd_doc.c Unknown Chip ID on boot device
-1 common/cmd_doc.c Read Error on boot device
-1 common/cmd_doc.c Image header has bad magic number
-1 common/cmd_ide.c Bad usage of "ide" command
-1 common/cmd_ide.c No boot device
-1 common/cmd_ide.c Unknown boot device
-1 common/cmd_ide.c Unknown partition table
-1 common/cmd_ide.c Invalid partition type
-1 common/cmd_ide.c Read Error on boot device
-1 common/cmd_ide.c Image header has bad magic number
-1 common/cmd_nand.c Bad usage of "nand" command
-1 common/cmd_nand.c No boot device
-1 common/cmd_nand.c Unknown Chip ID on boot device
-1 common/cmd_nand.c Read Error on boot device
-1 common/cmd_nand.c Image header has bad magic number
-1 common/env_common.c Environment has a bad CRC, using default
34 common/cmd_doc.c before loading a Image from a DOC device
-35 common/cmd_doc.c Bad usage of "doc" command
35 common/cmd_doc.c correct usage of "doc" command
-36 common/cmd_doc.c No boot device
36 common/cmd_doc.c correct boot device
-37 common/cmd_doc.c Unknown Chip ID on boot device
37 common/cmd_doc.c correct chip ID found, device available
-38 common/cmd_doc.c Read Error on boot device
38 common/cmd_doc.c reading Image header from DOC device OK
-39 common/cmd_doc.c Image header has bad magic number
39 common/cmd_doc.c Image header has correct magic number
-40 common/cmd_doc.c Error reading Image from DOC device
40 common/cmd_doc.c Image header has correct magic number
41 common/cmd_ide.c before loading a Image from a IDE device
-42 common/cmd_ide.c Bad usage of "ide" command
42 common/cmd_ide.c correct usage of "ide" command
-43 common/cmd_ide.c No boot device
43 common/cmd_ide.c boot device found
-44 common/cmd_ide.c Device not available
44 common/cmd_ide.c Device available
-45 common/cmd_ide.c wrong partition selected
45 common/cmd_ide.c partition selected
-46 common/cmd_ide.c Unknown partition table
46 common/cmd_ide.c valid partition table found
-47 common/cmd_ide.c Invalid partition type
47 common/cmd_ide.c correct partition type
-48 common/cmd_ide.c Error reading Image Header on boot device
48 common/cmd_ide.c reading Image Header from IDE device OK
-49 common/cmd_ide.c Image header has bad magic number
49 common/cmd_ide.c Image header has correct magic number
-50 common/cmd_ide.c Image header has bad checksum
50 common/cmd_ide.c Image header has correct checksum
-51 common/cmd_ide.c Error reading Image from IDE device
51 common/cmd_ide.c reading Image from IDE device OK
52 common/cmd_nand.c before loading a Image from a NAND device
-53 common/cmd_nand.c Bad usage of "nand" command
53 common/cmd_nand.c correct usage of "nand" command
-54 common/cmd_nand.c No boot device
54 common/cmd_nand.c boot device found
-55 common/cmd_nand.c Unknown Chip ID on boot device
55 common/cmd_nand.c correct chip ID found, device available
-56 common/cmd_nand.c Error reading Image Header on boot device
56 common/cmd_nand.c reading Image Header from NAND device OK
-57 common/cmd_nand.c Image header has bad magic number
57 common/cmd_nand.c Image header has correct magic number
-58 common/cmd_nand.c Error reading Image from NAND device
58 common/cmd_nand.c reading Image from NAND device OK
-60 common/env_common.c Environment has a bad CRC, using default
64 net/eth.c starting with Ethernetconfiguration.
-64 net/eth.c no Ethernet found.
65 net/eth.c Ethernet found.
-80 common/cmd_net.c usage wrong
80 common/cmd_net.c before calling NetLoop()
-81 common/cmd_net.c some error in NetLoop() occured
81 common/cmd_net.c NetLoop() back without error
-82 common/cmd_net.c size == 0 (File with size 0 loaded)
82 common/cmd_net.c trying automatic boot
83 common/cmd_net.c running autoscript
-83 common/cmd_net.c some error in automatic boot or autoscript
84 common/cmd_net.c end without errors
Modem Support:
--------------
......
......@@ -597,6 +597,7 @@ void show_boot_progress (int status)
{
volatile immap_t *immr = (immap_t *) CFG_IMMR;
if (status < -32) status = -1; /* let things compatible */
status ^= 0x0F;
status = (status & 0x0F) << 14;
immr->im_cpm.cp_pbdat = (immr->im_cpm.cp_pbdat & ~PB_LED_ALL) | status;
......
......@@ -107,6 +107,7 @@ void logodl_set_led(int led, int state)
void show_boot_progress (int status)
{
if (status < -32) status = -1; /* let things compatible */
/*
switch(status) {
case 1: logodl_set_led(0,1); break;
......
......@@ -25,6 +25,9 @@
# PCS440EP board
#
# Check the U-Boot Image with a SHA1 checksum
ALL += $(obj)u-boot.sha1
#TEXT_BASE = 0x00001000
ifeq ($(ramsym),1)
......
......@@ -83,6 +83,7 @@ void flash_print_info(flash_info_t *info)
case FLASH_MAN_FUJ: printf ("FUJITSU "); break;
case FLASH_MAN_SST: printf ("SST "); break;
case FLASH_MAN_EXCEL: printf ("Excel Semiconductor "); break;
case FLASH_MAN_MX: printf ("MXIC "); break;
default: printf ("Unknown Vendor "); break;
}
......@@ -195,6 +196,9 @@ static ulong flash_get_size(vu_long *addr, flash_info_t *info)
case (CFG_FLASH_WORD_SIZE)EXCEL_MANUFACT:
info->flash_id = FLASH_MAN_EXCEL;
break;
case (CFG_FLASH_WORD_SIZE)MX_MANUFACT:
info->flash_id = FLASH_MAN_MX;
break;
default:
info->flash_id = FLASH_UNKNOWN;
info->sector_count = 0;
......
......@@ -87,27 +87,32 @@
.globl tlbtab
tlbtab:
tlbtab_start
tlbtab_start
/*
* BOOT_CS (FLASH) must be first. Before relocation SA_I can be off to use the
* speed up boot process. It is patched after relocation to enable SA_I
*/
tlbentry( CFG_BOOT_BASE_ADDR, SZ_256M, CFG_BOOT_BASE_ADDR, 0, AC_R|AC_W|AC_X|SA_G/*|SA_I*/)
/*
* BOOT_CS (FLASH) must be first. Before relocation SA_I can be off to use the
* speed up boot process. It is patched after relocation to enable SA_I
*/
tlbentry( CFG_BOOT_BASE_ADDR, SZ_256M, CFG_BOOT_BASE_ADDR, 0, AC_R|AC_W|AC_X|SA_G/*|SA_I*/)
/* TLB-entry for init-ram in dcache (SA_I must be turned off!) */
tlbentry( CFG_INIT_RAM_ADDR, SZ_64K, CFG_INIT_RAM_ADDR, 0, AC_R|AC_W|AC_X|SA_G )
/* TLB-entry for init-ram in dcache (SA_I must be turned off!) */
tlbentry( CFG_INIT_RAM_ADDR, SZ_64K, CFG_INIT_RAM_ADDR, 0, AC_R|AC_W|AC_X|SA_G )
tlbentry( CFG_SDRAM_BASE, SZ_256M, CFG_SDRAM_BASE, 0, AC_R|AC_W|AC_X|SA_G|SA_I )
tlbentry( CFG_PCI_BASE, SZ_256M, CFG_PCI_BASE, 0, AC_R|AC_W|SA_G|SA_I )
/*
* TLB entries for SDRAM are not needed on this platform.
* They are dynamically generated in the SPD DDR detection
* routine.
*/
/* PCI */
tlbentry( CFG_PCI_MEMBASE, SZ_256M, CFG_PCI_MEMBASE, 0, AC_R|AC_W|SA_G|SA_I )
tlbentry( CFG_PCI_MEMBASE1, SZ_256M, CFG_PCI_MEMBASE1, 0, AC_R|AC_W|SA_G|SA_I )
tlbentry( CFG_PCI_MEMBASE2, SZ_256M, CFG_PCI_MEMBASE2, 0, AC_R|AC_W|SA_G|SA_I )
tlbentry( CFG_PCI_MEMBASE3, SZ_256M, CFG_PCI_MEMBASE3, 0, AC_R|AC_W|SA_G|SA_I )
tlbentry( CFG_PCI_BASE, SZ_256M, CFG_PCI_BASE, 0, AC_R|AC_W|SA_G|SA_I )
/* USB 2.0 Device */
tlbentry( CFG_USB_DEVICE, SZ_1K, 0x50000000, 0, AC_R|AC_W|SA_G|SA_I )
/* PCI */
tlbentry( CFG_PCI_MEMBASE, SZ_256M, CFG_PCI_MEMBASE, 0, AC_R|AC_W|SA_G|SA_I )
tlbentry( CFG_PCI_MEMBASE1, SZ_256M, CFG_PCI_MEMBASE1, 0, AC_R|AC_W|SA_G|SA_I )
tlbentry( CFG_PCI_MEMBASE2, SZ_256M, CFG_PCI_MEMBASE2, 0, AC_R|AC_W|SA_G|SA_I )
tlbentry( CFG_PCI_MEMBASE3, SZ_256M, CFG_PCI_MEMBASE3, 0, AC_R|AC_W|SA_G|SA_I )
tlbtab_end
/* USB 2.0 Device */
tlbentry( CFG_USB_DEVICE, SZ_1K, 0x50000000, 0, AC_R|AC_W|SA_G|SA_I )
tlbtab_end
......@@ -23,19 +23,111 @@
#include <common.h>
#include <ppc4xx.h>
#include <malloc.h>
#include <command.h>
#include <crc.h>
#include <asm/processor.h>
#include <spd_sdram.h>
#include <status_led.h>
#include <sha1.h>
DECLARE_GLOBAL_DATA_PTR;
extern flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
static void set_leds(int val)
unsigned char sha1_checksum[SHA1_SUM_LEN];
/* swap 4 Bits (Bit0 = Bit3, Bit1 = Bit2, Bit2 = Bit1 and Bit3 = Bit0) */
unsigned char swapbits[16] = {0x0, 0x8, 0x4, 0xc, 0x2, 0xa, 0x6, 0xe,
0x1, 0x9, 0x5, 0xd, 0x3, 0xb, 0x7, 0xf};
static void set_leds (int val)
{
out32(GPIO0_OR, (in32 (GPIO0_OR) & ~0x78000000) | (val << 27));
}
#define GET_LEDS ((in32 (GPIO0_OR) & 0x78000000) >> 27)
void __led_init (led_id_t mask, int state)
{
int val = GET_LEDS;
if (state == STATUS_LED_ON)
val |= mask;
else
val &= ~mask;
set_leds (val);
}
void __led_set (led_id_t mask, int state)
{
int val = GET_LEDS;
if (state == STATUS_LED_ON)
val |= mask;
else if (state == STATUS_LED_OFF)
val &= ~mask;
set_leds (val);
}
void __led_toggle (led_id_t mask)
{
int val = GET_LEDS;
val ^= mask;
set_leds (val);
}
static void status_led_blink (void)
{
int i;
int val = GET_LEDS;
/* set all LED which are on, to state BLINKING */
for (i = 0; i < 4; i++) {
if (val & 0x08) status_led_set (i, STATUS_LED_BLINKING);
val = val << 1;
}
}
#if defined(CONFIG_SHOW_BOOT_PROGRESS)
void show_boot_progress (int val)
{
unsigned char led[16] = {0x0, 0x8, 0x4, 0xc, 0x2, 0xa, 0x6, 0xe,
0x1, 0x9, 0x5, 0xd, 0x3, 0xb, 0x7, 0xf};
out32(GPIO0_OR, (in32(GPIO0_OR) & ~0x78000000) | (led[val] << 27));
/* find all valid Codes for val in README */
if (val == -30) return;
if (val < 0) {
/* smthing goes wrong */
status_led_blink ();
return;
}
switch (val) {
case 1:
/* validating Image */
status_led_set (0, STATUS_LED_OFF);
status_led_set (1, STATUS_LED_ON);
status_led_set (2, STATUS_LED_ON);
break;
case 15:
/* booting */
status_led_set (0, STATUS_LED_ON);
status_led_set (1, STATUS_LED_ON);
status_led_set (2, STATUS_LED_ON);
break;
case 64:
/* starting Ethernet configuration */
status_led_set (0, STATUS_LED_OFF);
status_led_set (1, STATUS_LED_OFF);
status_led_set (2, STATUS_LED_ON);
break;
case 80:
/* loading Image */
status_led_set (0, STATUS_LED_ON);
status_led_set (1, STATUS_LED_OFF);
status_led_set (2, STATUS_LED_ON);
break;
}
}
#endif
int board_early_init_f(void)
{
......@@ -85,6 +177,252 @@ int board_early_init_f(void)
return 0;
}
#define EEPROM_LEN 256
void load_sernum_ethaddr (void)
{
int ret;
char buf[EEPROM_LEN];
char mac[32];
char *use_eeprom;
u16 checksumcrc16 = 0;
/* read the MACs from EEprom */
status_led_set (0, STATUS_LED_ON);
status_led_set (1, STATUS_LED_ON);
ret = eeprom_read (CFG_I2C_EEPROM_ADDR, 0, (uchar *)buf, EEPROM_LEN);
if (ret == 0) {
checksumcrc16 = cyg_crc16 ((uchar *)buf, EEPROM_LEN - 2);
/* check, if the EEprom is programmed:
* - The Prefix(Byte 0,1,2) is equal to "ATR"
* - The checksum, stored in the last 2 Bytes, is correct
*/
if ((strncmp (buf,"ATR",3) != 0) ||
((checksumcrc16 >> 8) != buf[EEPROM_LEN - 2]) ||
((checksumcrc16 & 0xff) != buf[EEPROM_LEN - 1]))
{
/* EEprom is not programmed */
printf("%s: EEPROM Checksum not OK\n", __FUNCTION__);
} else {
/* get the MACs */
sprintf (mac, "%02x:%02x:%02x:%02x:%02x:%02x",
buf[3],
buf[4],
buf[5],
buf[6],
buf[7],
buf[8]);
setenv ("ethaddr", (char *) mac);
sprintf (mac, "%02x:%02x:%02x:%02x:%02x:%02x",
buf[9],
buf[10],
buf[11],
buf[12],
buf[13],
buf[14]);
setenv ("eth1addr", (char *) mac);
return;
}
}
/* some error reading the EEprom */
if ((use_eeprom = getenv ("use_eeprom_ethaddr")) == NULL) {
/* dont use bootcmd */
setenv("bootdelay", "-1");
return;
}
/* == default ? use standard */
if (strncmp (use_eeprom, "default", 7) == 0) {
return;
}
/* Env doesnt exist -> hang */
status_led_blink ();
hang ();
return;
}
#ifdef CONFIG_PREBOOT
static uchar kbd_magic_prefix[] = "key_magic";
static uchar kbd_command_prefix[] = "key_cmd";
struct kbd_data_t {
char s1;
char s2;
};
struct kbd_data_t* get_keys (struct kbd_data_t *kbd_data)
{
char *val;
unsigned long tmp;
/* use the DIPs for some bootoptions */
val = getenv (ENV_NAME_DIP);
tmp = simple_strtoul (val, NULL, 16);
kbd_data->s2 = (tmp & 0x0f);
kbd_data->s1 = (tmp & 0xf0) >> 4;
return kbd_data;
}
static int compare_magic (const struct kbd_data_t *kbd_data, char *str)
{
char s1 = str[0];
if (s1 >= '0' && s1 <= '9')
s1 -= '0';
else if (s1 >= 'a' && s1 <= 'f')
s1 = s1 - 'a' + 10;
else if (s1 >= 'A' && s1 <= 'F')
s1 = s1 - 'A' + 10;
else
return -1;
if (s1 != kbd_data->s1) return -1;
s1 = str[1];
if (s1 >= '0' && s1 <= '9')
s1 -= '0';
else if (s1 >= 'a' && s1 <= 'f')
s1 = s1 - 'a' + 10;
else if (s1 >= 'A' && s1 <= 'F')
s1 = s1 - 'A' + 10;
else
return -1;
if (s1 != kbd_data->s2) return -1;
return 0;
}
static char *key_match (const struct kbd_data_t *kbd_data)
{
char magic[sizeof (kbd_magic_prefix) + 1];
char *suffix;
char *kbd_magic_keys;
/*
* The following string defines the characters that can be appended
* to "key_magic" to form the names of environment variables that
* hold "magic" key codes, i. e. such key codes that can cause
* pre-boot actions. If the string is empty (""), then only
* "key_magic" is checked (old behaviour); the string "125" causes
* checks for "key_magic1", "key_magic2" and "key_magic5", etc.
*/
if ((kbd_magic_keys = getenv ("magic_keys")) == NULL)
kbd_magic_keys = "";
/* loop over all magic keys;
* use '\0' suffix in case of empty string
*/
for (suffix = kbd_magic_keys; *suffix ||
suffix == kbd_magic_keys; ++suffix) {
sprintf (magic, "%s%c", kbd_magic_prefix, *suffix);
if (compare_magic (kbd_data, getenv (magic)) == 0) {
char cmd_name[sizeof (kbd_command_prefix) + 1];
char *cmd;
sprintf (cmd_name, "%s%c", kbd_command_prefix, *suffix);
cmd = getenv (cmd_name);
return (cmd);
}
}
return (NULL);
}
#endif /* CONFIG_PREBOOT */
static int pcs440ep_readinputs (void)
{
int i;
char value[20];
/* read the inputs and set the Envvars */
/* Revision Level Bit 26 - 29 */
i = ((in32 (GPIO0_IR) & 0x0000003c) >> 2);
i = swapbits[i];
sprintf (value, "%02x", i);
setenv (ENV_NAME_REVLEV, value);
/* Solder Switch Bit 30 - 33 */
i = (in32 (GPIO0_IR) & 0x00000003) << 2;
i += (in32 (GPIO1_IR) & 0xc0000000) >> 30;
i = swapbits[i];
sprintf (value, "%02x", i);
setenv (ENV_NAME_SOLDER, value);
/* DIP Switch Bit 49 - 56 */
i = ((in32 (GPIO1_IR) & 0x00007f80) >> 7);
i = (swapbits[i & 0x0f] << 4) + swapbits[(i & 0xf0) >> 4];
sprintf (value, "%02x", i);
setenv (ENV_NAME_DIP, value);
return 0;
}
#if defined(CONFIG_SHA1_CHECK_UB_IMG)
/*************************************************************************
* calculate a SHA1 sum for the U-Boot image in Flash.
*
************************************************************************/
static int pcs440ep_sha1 (int docheck)
{
unsigned char *data;
unsigned char *ptroff;
unsigned char output[20];
unsigned char org[20];
int i, len = CONFIG_SHA1_LEN;
memcpy ((char *)CFG_LOAD_ADDR, (char *)CONFIG_SHA1_START, len);
data = (unsigned char *)CFG_LOAD_ADDR;
ptroff = &data[len + SHA1_SUM_POS];
for (i = 0; i < SHA1_SUM_LEN; i++) {
org[i] = ptroff[i];
ptroff[i] = 0;
}
sha1_csum ((unsigned char *) data, len, (unsigned char *)output);
if (docheck == 2) {
for (i = 0; i < 20 ; i++) {
printf("%02X ", output[i]);
}
printf("\n");
}
if (docheck == 1) {
for (i = 0; i < 20 ; i++) {
if (org[i] != output[i]) return 1;
}
}
return 0;
}
/*************************************************************************
* do some checks after the SHA1 checksum from the U-Boot Image was
* calculated.
*
************************************************************************/
static void pcs440ep_checksha1 (void)
{
int ret;
char *cs_test;
ret = pcs440ep_sha1 (1);
if (ret == 0) return;
if ((cs_test = getenv ("cs_test")) == NULL) {
/* Env doesnt exist -> hang */
status_led_blink ();
hang ();
}
if (strncmp (cs_test, "off", 3) == 0) {
printf ("SHA1 U-Boot sum NOT ok!\n");
setenv ("bootdelay", "-1");
}
}
#else
static __inline__ void pcs440ep_checksha1 (void) { do {} while (0);}
#endif
int misc_init_r (void)
{
uint pbcr;
......@@ -139,6 +477,18 @@ int misc_init_r (void)
CFG_ENV_ADDR_REDUND + 2*CFG_ENV_SECT_SIZE - 1,
&flash_info[1]);
pcs440ep_readinputs ();
pcs440ep_checksha1 ();
#ifdef CONFIG_PREBOOT
{
struct kbd_data_t kbd_data;
/* Decode keys */
char *str = strdup (key_match (get_keys (&kbd_data)));
/* Set or delete definition */
setenv ("preboot", str);
free (str);
}
#endif /* CONFIG_PREBOOT */
return 0;
}
......@@ -156,13 +506,34 @@ int checkboard(void)
return (0);
}
#if defined(CONFIG_PPC4xx_USE_SPD_DDR_INIT_HANG)
void spd_ddr_init_hang (void)
{
status_led_set (0, STATUS_LED_OFF);
status_led_set (1, STATUS_LED_ON);
/* we cannot use hang() because we are still running from
Flash, and so the status_led driver is not initialized */
puts ("### ERROR ### Please RESET the board ###\n");
for (;;) {
__led_toggle (4);
udelay (100000);
}
}
#endif
long int initdram (int board_type)
{
long dram_size = 0;
set_leds(1); /* display boot info counter */
status_led_set (0, STATUS_LED_ON);
status_led_set (1, STATUS_LED_OFF);
dram_size = spd_sdram();
set_leds(2); /* display boot info counter */
status_led_set (0, STATUS_LED_OFF);
status_led_set (1, STATUS_LED_ON);
if (dram_size == 0) {
hang();
}
return dram_size;
}
......@@ -377,3 +748,120 @@ void hw_watchdog_reset(void)
}
#endif
/*************************************************************************
* "led" Commando for the U-Boot shell
*
************************************************************************/
int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
int rcode = 0;
ulong pattern = 0;
pattern = simple_strtoul (argv[1], NULL, 10);
if (pattern > 200) {
status_led_blink ();
hang ();
return rcode;
}
if (pattern > 100) {
status_led_blink ();
return rcode;
}
pattern &= 0x0f;
set_leds (pattern);
return rcode;
}
U_BOOT_CMD(
led, 2, 1, do_led,
"led - set the led\n",
NULL
);
#if defined(CONFIG_SHA1_CHECK_UB_IMG)
/*************************************************************************
* "sha1" Commando for the U-Boot shell
*
************************************************************************/
int do_sha1 (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
int rcode = -1;
if (argc < 2) {
usage:
printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
if (argc >= 3) {
unsigned char *data;
unsigned char output[20];
int len;
int i;
data = (unsigned char *)simple_strtoul (argv[1], NULL, 16);
len = simple_strtoul (argv[2], NULL, 16);
sha1_csum (data, len, (unsigned char *)output);
printf ("U-Boot sum:\n");
for (i = 0; i < 20 ; i++) {
printf ("%02X ", output[i]);
}
printf ("\n");
if (argc == 4) {
data = (unsigned char *)simple_strtoul (argv[3], NULL, 16);
memcpy (data, output, 20);
}
return 0;
}
if (argc == 2) {
char *ptr = argv[1];
if (*ptr != '-') goto usage;
ptr++;
if ((*ptr == 'c') || (*ptr == 'C')) {
rcode = pcs440ep_sha1 (1);
printf ("SHA1 U-Boot sum %sok!\n", (rcode != 0) ? "not " : "");
} else if ((*ptr == 'p') || (*ptr == 'P')) {
rcode = pcs440ep_sha1 (2);
} else {
rcode = pcs440ep_sha1 (0);
}
return rcode;
}
return rcode;
}
U_BOOT_CMD(
sha1, 4, 1, do_sha1,
"sha1 - calculate the SHA1 Sum\n",
"address len [addr] calculate the SHA1 sum [save at addr]\n"
" -p calculate the SHA1 sum from the U-Boot image in flash and print\n"
" -c check the U-Boot image in flash\n"
);
#endif
#ifdef CONFIG_IDE_PREINIT
int ide_preinit (void)
{
/* Set True IDE Mode */
out32 (GPIO0_OR, (in32 (GPIO0_OR) | 0x00100000));
out32 (GPIO0_OR, (in32 (GPIO0_OR) | 0x00200000));
out32 (GPIO1_OR, (in32 (GPIO1_OR) & ~0x00008040));
udelay (100000);
return 0;
}
#endif
#if defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET)
void ide_set_reset (int idereset)
{
debug ("ide_reset(%d)\n", idereset);
if (idereset == 0) {
out32 (GPIO0_OR, (in32 (GPIO0_OR) | 0x00200000));
} else {
out32 (GPIO0_OR, (in32 (GPIO0_OR) & ~0x00200000));
}
udelay (10000);
}
#endif /* defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET) */
......@@ -65,6 +65,7 @@ SECTIONS
{
cpu/ppc4xx/start.o (.text)
board/pcs440ep/init.o (.text)
lib_generic/sha1.o (.text)
*(.text)
*(.fixup)
......
......@@ -507,6 +507,7 @@ int dram_init(void)
void show_boot_progress(int val)
{
if (val < -32) val = -1; /* let things compatible */
outb(val&0xff, 0x80);
outb((val&0xff00)>>8, 0x680);
}
......
......@@ -507,6 +507,7 @@ void show_boot_progress(int val)
{
int version = read_mmcr_byte(SC520_SYSINFO);
if (val < -32) val = -1; /* let things compatible */
if (version == 0) {
/* PIO31-PIO16 Data */
write_mmcr_word(SC520_PIODATA31_16,
......
......@@ -216,6 +216,7 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
image_header_t *hdr;
int rcode = 0;
SHOW_BOOT_PROGRESS (34);
switch (argc) {
case 1:
addr = CFG_LOAD_ADDR;
......@@ -236,24 +237,27 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
break;
default:
printf ("Usage:\n%s\n", cmdtp->usage);
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-35);
return 1;
}
SHOW_BOOT_PROGRESS (35);
if (!boot_device) {
puts ("\n** No boot device **\n");
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-36);
return 1;
}
SHOW_BOOT_PROGRESS (36);
dev = simple_strtoul(boot_device, &ep, 16);
if ((dev >= CFG_MAX_DOC_DEVICE) ||
(doc_dev_desc[dev].ChipID == DOC_ChipID_UNKNOWN)) {
printf ("\n** Device %d not available\n", dev);
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-37);
return 1;
}
SHOW_BOOT_PROGRESS (37);
printf ("\nLoading from device %d: %s at 0x%lX (offset 0x%lX)\n",
dev, doc_dev_desc[dev].name, doc_dev_desc[dev].physadr,
......@@ -262,9 +266,10 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (doc_rw (doc_dev_desc + dev, 1, offset,
SECTORSIZE, NULL, (u_char *)addr)) {
printf ("** Read error on %d\n", dev);
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-38);
return 1;
}
SHOW_BOOT_PROGRESS (38);
hdr = (image_header_t *)addr;
......@@ -276,16 +281,18 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
cnt -= SECTORSIZE;
} else {
puts ("\n** Bad Magic Number **\n");
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-39);
return 1;
}
SHOW_BOOT_PROGRESS (39);
if (doc_rw (doc_dev_desc + dev, 1, offset + SECTORSIZE, cnt,
NULL, (u_char *)(addr+SECTORSIZE))) {
printf ("** Read error on %d\n", dev);
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-40);
return 1;
}
SHOW_BOOT_PROGRESS (40);
/* Loading ok, update default load address */
......
......@@ -185,6 +185,9 @@ static void input_data(int dev, ulong *sect_buf, int words);
static void output_data(int dev, ulong *sect_buf, int words);
static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len);
#ifndef CFG_ATA_PORT_ADDR
#define CFG_ATA_PORT_ADDR(port) (port)
#endif
#ifdef CONFIG_ATAPI
static void atapi_inquiry(block_dev_desc_t *dev_desc);
......@@ -382,6 +385,7 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
image_header_t *hdr;
int rcode = 0;
SHOW_BOOT_PROGRESS (41);
switch (argc) {
case 1:
addr = CFG_LOAD_ADDR;
......@@ -397,44 +401,50 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
break;
default:
printf ("Usage:\n%s\n", cmdtp->usage);
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-42);
return 1;
}
SHOW_BOOT_PROGRESS (42);
if (!boot_device) {
puts ("\n** No boot device **\n");
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-43);
return 1;
}
SHOW_BOOT_PROGRESS (43);
dev = simple_strtoul(boot_device, &ep, 16);
if (ide_dev_desc[dev].type==DEV_TYPE_UNKNOWN) {
printf ("\n** Device %d not available\n", dev);
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-44);
return 1;
}
SHOW_BOOT_PROGRESS (44);
if (*ep) {
if (*ep != ':') {
puts ("\n** Invalid boot device, use `dev[:part]' **\n");
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-45);
return 1;
}
part = simple_strtoul(++ep, NULL, 16);
}
SHOW_BOOT_PROGRESS (45);
if (get_partition_info (&ide_dev_desc[dev], part, &info)) {
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-46);
return 1;
}
SHOW_BOOT_PROGRESS (46);
if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
(strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
printf ("\n** Invalid partition type \"%.32s\""
" (expect \"" BOOT_PART_TYPE "\")\n",
info.type);
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-47);
return 1;
}
SHOW_BOOT_PROGRESS (47);
printf ("\nLoading from IDE device %d, partition %d: "
"Name: %.32s Type: %.32s\n",
......@@ -445,26 +455,29 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (ide_dev_desc[dev].block_read (dev, info.start, 1, (ulong *)addr) != 1) {
printf ("** Read error on %d:%d\n", dev, part);
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-48);
return 1;
}
SHOW_BOOT_PROGRESS (48);
hdr = (image_header_t *)addr;
if (ntohl(hdr->ih_magic) != IH_MAGIC) {
printf("\n** Bad Magic Number **\n");
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-49);
return 1;
}
SHOW_BOOT_PROGRESS (49);
checksum = ntohl(hdr->ih_hcrc);
hdr->ih_hcrc = 0;
if (crc32 (0, (uchar *)hdr, sizeof(image_header_t)) != checksum) {
puts ("\n** Bad Header Checksum **\n");
SHOW_BOOT_PROGRESS (-2);
SHOW_BOOT_PROGRESS (-50);
return 1;
}
SHOW_BOOT_PROGRESS (50);
hdr->ih_hcrc = htonl(checksum); /* restore checksum for later use */
print_image_hdr (hdr);
......@@ -477,9 +490,10 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (ide_dev_desc[dev].block_read (dev, info.start+1, cnt,
(ulong *)(addr+info.blksz)) != cnt) {
printf ("** Read error on %d:%d\n", dev, part);
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-51);
return 1;
}
SHOW_BOOT_PROGRESS (51);
/* Loading ok, update default load address */
......@@ -807,13 +821,13 @@ ide_outb(int dev, int port, unsigned char val)
/* Ensure I/O operations complete */
EIEIO;
*((uchar *)(ATA_CURR_BASE(dev)+port)) = val;
*((u16 *)(ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port))) = val;
}
#else /* ! __PPC__ */
static void __inline__
ide_outb(int dev, int port, unsigned char val)
{
outb(val, ATA_CURR_BASE(dev)+port);
outb(val, ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port));
}
#endif /* __PPC__ */
......@@ -825,7 +839,7 @@ ide_inb(int dev, int port)
uchar val;
/* Ensure I/O operations complete */
EIEIO;
val = *((uchar *)(ATA_CURR_BASE(dev)+port));
val = *((u16 *)(ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port)));
debug ("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n",
dev, port, (ATA_CURR_BASE(dev)+port), val);
return (val);
......@@ -834,7 +848,7 @@ ide_inb(int dev, int port)
static unsigned char __inline__
ide_inb(int dev, int port)
{
return inb(ATA_CURR_BASE(dev)+port);
return inb(ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port));
}
#endif /* __PPC__ */
......@@ -891,6 +905,9 @@ input_swap_data(int dev, ulong *sect_buf, int words)
#ifdef __MIPS__
*dbuf++ = swab16p((u16*)pbuf);
*dbuf++ = swab16p((u16*)pbuf);
#elif defined(CONFIG_PCS440EP)
*dbuf++ = *pbuf;
*dbuf++ = *pbuf;
#else
*dbuf++ = ld_le16(pbuf);
*dbuf++ = ld_le16(pbuf);
......@@ -930,10 +947,18 @@ output_data(int dev, ulong *sect_buf, int words)
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
dbuf = (ushort *)sect_buf;
while (words--) {
#if defined(CONFIG_PCS440EP)
/* not tested, because CF was write protected */
EIEIO;
*pbuf = ld_le16(dbuf++);
EIEIO;
*pbuf = ld_le16(dbuf++);
#else
EIEIO;
*pbuf = *dbuf++;
EIEIO;
*pbuf = *dbuf++;
#endif
}
#endif
}
......@@ -981,10 +1006,17 @@ input_data(int dev, ulong *sect_buf, int words)
debug("in input data base for read is %lx\n", (unsigned long) pbuf);
while (words--) {
#if defined(CONFIG_PCS440EP)
EIEIO;
*dbuf++ = ld_le16(pbuf);
EIEIO;
*dbuf++ = ld_le16(pbuf);
#else
EIEIO;
*dbuf++ = *pbuf;
EIEIO;
*dbuf++ = *pbuf;
#endif
}
#endif
}
......
......@@ -486,17 +486,19 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
r = nand_read(nand, offset, &cnt, (u_char *) addr);
if (r) {
puts("** Read error\n");
SHOW_BOOT_PROGRESS(-1);
SHOW_BOOT_PROGRESS(-56);
return 1;
}
SHOW_BOOT_PROGRESS(56);
hdr = (image_header_t *) addr;
if (ntohl(hdr->ih_magic) != IH_MAGIC) {
printf("\n** Bad Magic Number 0x%x **\n", hdr->ih_magic);
SHOW_BOOT_PROGRESS(-1);
SHOW_BOOT_PROGRESS(-57);
return 1;
}
SHOW_BOOT_PROGRESS(57);
print_image_hdr(hdr);
......@@ -505,9 +507,10 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
r = nand_read(nand, offset, &cnt, (u_char *) addr);
if (r) {
puts("** Read error\n");
SHOW_BOOT_PROGRESS(-1);
SHOW_BOOT_PROGRESS(-58);
return 1;
}
SHOW_BOOT_PROGRESS(58);
/* Loading ok, update default load address */
......@@ -559,6 +562,7 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
}
#endif
SHOW_BOOT_PROGRESS(52);
switch (argc) {
case 1:
addr = CFG_LOAD_ADDR;
......@@ -582,23 +586,26 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
usage:
#endif
printf("Usage:\n%s\n", cmdtp->usage);
SHOW_BOOT_PROGRESS(-1);
SHOW_BOOT_PROGRESS(-53);
return 1;
}
SHOW_BOOT_PROGRESS(53);
if (!boot_device) {
puts("\n** No boot device **\n");
SHOW_BOOT_PROGRESS(-1);
SHOW_BOOT_PROGRESS(-54);
return 1;
}
SHOW_BOOT_PROGRESS(54);
idx = simple_strtoul(boot_device, NULL, 16);
if (idx < 0 || idx >= CFG_MAX_NAND_DEVICE || !nand_info[idx].name) {
printf("\n** Device %d not available\n", idx);
SHOW_BOOT_PROGRESS(-1);
SHOW_BOOT_PROGRESS(-55);
return 1;
}
SHOW_BOOT_PROGRESS(55);
return nand_load_image(cmdtp, &nand_info[idx], offset, addr, argv[0]);
}
......@@ -887,6 +894,7 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
ulong offset = 0;
image_header_t *hdr;
int rcode = 0;
SHOW_BOOT_PROGRESS(52);
switch (argc) {
case 1:
addr = CFG_LOAD_ADDR;
......@@ -907,24 +915,27 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
break;
default:
printf ("Usage:\n%s\n", cmdtp->usage);
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-53);
return 1;
}
SHOW_BOOT_PROGRESS(53);
if (!boot_device) {
puts ("\n** No boot device **\n");
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-54);
return 1;
}
SHOW_BOOT_PROGRESS(54);
dev = simple_strtoul(boot_device, &ep, 16);
if ((dev >= CFG_MAX_NAND_DEVICE) ||
(nand_dev_desc[dev].ChipID == NAND_ChipID_UNKNOWN)) {
printf ("\n** Device %d not available\n", dev);
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-55);
return 1;
}
SHOW_BOOT_PROGRESS(55);
printf ("\nLoading from device %d: %s at 0x%lx (offset 0x%lx)\n",
dev, nand_dev_desc[dev].name, nand_dev_desc[dev].IO_ADDR,
......@@ -933,9 +944,10 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (nand_legacy_rw (nand_dev_desc + dev, NANDRW_READ, offset,
SECTORSIZE, NULL, (u_char *)addr)) {
printf ("** Read error on %d\n", dev);
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-56);
return 1;
}
SHOW_BOOT_PROGRESS(56);
hdr = (image_header_t *)addr;
......@@ -947,17 +959,19 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
cnt -= SECTORSIZE;
} else {
printf ("\n** Bad Magic Number 0x%x **\n", ntohl(hdr->ih_magic));
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-57);
return 1;
}
SHOW_BOOT_PROGRESS(57);
if (nand_legacy_rw (nand_dev_desc + dev, NANDRW_READ,
offset + SECTORSIZE, cnt, NULL,
(u_char *)(addr+SECTORSIZE))) {
printf ("** Read error on %d\n", dev);
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-58);
return 1;
}
SHOW_BOOT_PROGRESS(58);
/* Loading ok, update default load address */
......
......@@ -30,6 +30,13 @@
#if (CONFIG_COMMANDS & CFG_CMD_NET)
#ifdef CONFIG_SHOW_BOOT_PROGRESS
# include <status_led.h>
extern void show_boot_progress (int val);
# define SHOW_BOOT_PROGRESS(arg) show_boot_progress (arg)
#else
# define SHOW_BOOT_PROGRESS(arg)
#endif
extern int do_bootm (cmd_tbl_t *, int, int, char *[]);
......@@ -184,18 +191,25 @@ netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char *argv[])
break;
default: printf ("Usage:\n%s\n", cmdtp->usage);
SHOW_BOOT_PROGRESS(-80);
return 1;
}
if ((size = NetLoop(proto)) < 0)
SHOW_BOOT_PROGRESS(80);
if ((size = NetLoop(proto)) < 0) {
SHOW_BOOT_PROGRESS(-81);
return 1;
}
SHOW_BOOT_PROGRESS(81);
/* NetLoop ok, update environment */
netboot_update_env();
/* done if no file was loaded (no errors though) */
if (size == 0)
if (size == 0) {
SHOW_BOOT_PROGRESS(-82);
return 0;
}
/* flush cache */
flush_cache(load_addr, size);
......@@ -208,14 +222,22 @@ netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char *argv[])
printf ("Automatic boot of image at addr 0x%08lX ...\n",
load_addr);
SHOW_BOOT_PROGRESS(82);
rcode = do_bootm (cmdtp, 0, 1, local_args);
}
#ifdef CONFIG_AUTOSCRIPT
if (((s = getenv("autoscript")) != NULL) && (strcmp(s,"yes") == 0)) {
printf("Running autoscript at addr 0x%08lX ...\n", load_addr);
SHOW_BOOT_PROGRESS(83);
rcode = autoscript (load_addr);
}
#endif
#if defined(CONFIG_SHOW_BOOT_PROGRESS)
if (rcode < 0)
SHOW_BOOT_PROGRESS(-83);
else
SHOW_BOOT_PROGRESS(84);
#endif
return rcode;
}
......
......@@ -90,7 +90,7 @@ int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
if (!reiserfs_mount(part_length)) {
printf ("** Bad Reisefs partition or disk - %s %d:%d **\n", argv[1], dev, part);
printf ("** Bad Reiserfs partition or disk - %s %d:%d **\n", argv[1], dev, part);
return 1;
}
......@@ -183,7 +183,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 1;
}
if (strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
if (strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
printf ("\n** Invalid partition type \"%.32s\""
" (expect \"" BOOT_PART_TYPE "\")\n",
info.type);
......@@ -204,7 +204,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
if (!reiserfs_mount(part_length)) {
printf ("** Bad Reisefs partition or disk - %s %d:%d **\n", argv[1], dev, part);
printf ("** Bad Reiserfs partition or disk - %s %d:%d **\n", argv[1], dev, part);
return 1;
}
......
......@@ -232,7 +232,7 @@ void env_relocate (void)
puts ("Using default environment\n\n");
#else
puts ("*** Warning - bad CRC, using default environment\n\n");
SHOW_BOOT_PROGRESS (-1);
SHOW_BOOT_PROGRESS (-60);
#endif
if (sizeof(default_environment) > ENV_SIZE)
......
......@@ -70,6 +70,13 @@
#define ONE_BILLION 1000000000
#if defined(CONFIG_PPC4xx_USE_SPD_DDR_INIT_HANG)
extern void spd_ddr_init_hang (void);
#define HANG() spd_ddr_init_hang()
#else
#define HANG() hang()
#endif
/*-----------------------------------------------------------------------------
| Memory Controller Options 0
+-----------------------------------------------------------------------------*/
......@@ -467,7 +474,7 @@ static void get_spd_info(unsigned long *dimm_populated,
if (dimm_found == FALSE) {
printf("ERROR - No memory installed. Install a DDR-SDRAM DIMM.\n\n");
hang();
HANG();
}
}
......@@ -490,7 +497,7 @@ static void check_mem_type(unsigned long *dimm_populated,
dimm_num);
printf("Only DDR SDRAM DIMMs are supported.\n");
printf("Replace the DIMM module with a supported DIMM.\n\n");
hang();
HANG();
break;
}
}
......@@ -510,7 +517,7 @@ static void check_volt_type(unsigned long *dimm_populated,
if (voltage_type != 0x04) {
printf("ERROR: DIMM %lu with unsupported voltage level.\n",
dimm_num);
hang();
HANG();
} else {
debug("DIMM %lu voltage level supported.\n", dimm_num);
}
......@@ -581,7 +588,7 @@ static void program_cfg0(unsigned long *dimm_populated,
printf("WARNING: DIMM with datawidth of %lu bits.\n",
data_width);
printf("Only DIMMs with 32 or 64 bit datawidths supported.\n");
hang();
HANG();
}
break;
}
......@@ -769,7 +776,7 @@ static void program_tr0(unsigned long *dimm_populated,
if ((tcyc_reg & 0x0F) >= 10) {
printf("ERROR: Tcyc incorrect for DIMM in slot %lu\n",
dimm_num);
hang();
HANG();
}
cycle_time_ns_x_10[cas_index] =
......@@ -849,7 +856,7 @@ static void program_tr0(unsigned long *dimm_populated,
printf("ERROR: No supported CAS latency with the installed DIMMs.\n");
printf("Only CAS latencies of 2.0, 2.5, and 3.0 are supported.\n");
printf("Make sure the PLB speed is within the supported range.\n");
hang();
HANG();
}
/*
......@@ -1008,6 +1015,7 @@ static int short_mem_test(void)
*/
for (i = 0; i < NUMMEMTESTS; i++) {
for (j = 0; j < NUMMEMWORDS; j++) {
//printf("bank enabled base:%x\n", &membase[j]);
membase[j] = test[i][j];
ppcDcbf((unsigned long)&(membase[j]));
}
......@@ -1160,7 +1168,7 @@ static void program_tr1(void)
*/
if (window_found == FALSE) {
printf("ERROR: Cannot determine a common read delay.\n");
hang();
HANG();
}
/*
......@@ -1310,7 +1318,7 @@ static unsigned long program_bxcr(unsigned long *dimm_populated,
printf("ERROR: Unsupported value for the banksize: %d.\n",
bank_size_id);
printf("Replace the DIMM module with a supported DIMM.\n\n");
hang();
HANG();
}
switch (num_col_addr) {
......@@ -1332,7 +1340,7 @@ static unsigned long program_bxcr(unsigned long *dimm_populated,
printf("ERROR: Unsupported value for number of "
"column addresses: %d.\n", num_col_addr);
printf("Replace the DIMM module with a supported DIMM.\n\n");
hang();
HANG();
}
/*
......
......@@ -129,6 +129,13 @@
#define MY_TLB_WORD2_I_ENABLE TLB_WORD2_I_ENABLE /* disable caching on SDRAM */
#endif
#if defined(CONFIG_PPC4xx_USE_SPD_DDR_INIT_HANG)
extern void spd_ddr_init_hang (void);
#define HANG() spd_ddr_init_hang()
#else
#define HANG() hang()
#endif
/* Private Structure Definitions */
/* enum only to ease code for cas latency setting */
......@@ -582,7 +589,7 @@ static void get_spd_info(unsigned long *dimm_populated,
if (dimm_found == FALSE) {
printf("ERROR - No memory installed. Install a DDR-SDRAM DIMM.\n\n");
hang();
HANG();
}
}
......@@ -629,42 +636,42 @@ static void check_mem_type(unsigned long *dimm_populated,
"slot %d.\n", (unsigned int)dimm_num);
printf("Only DDR and DDR2 SDRAM DIMMs are supported.\n");
printf("Replace the DIMM module with a supported DIMM.\n\n");
hang();
HANG();
break;
case 2:
printf("ERROR: EDO DIMM detected in slot %d.\n",
(unsigned int)dimm_num);
printf("Only DDR and DDR2 SDRAM DIMMs are supported.\n");
printf("Replace the DIMM module with a supported DIMM.\n\n");
hang();
HANG();
break;
case 3:
printf("ERROR: Pipelined Nibble DIMM detected in slot %d.\n",
(unsigned int)dimm_num);
printf("Only DDR and DDR2 SDRAM DIMMs are supported.\n");
printf("Replace the DIMM module with a supported DIMM.\n\n");
hang();
HANG();
break;
case 4:
printf("ERROR: SDRAM DIMM detected in slot %d.\n",
(unsigned int)dimm_num);
printf("Only DDR and DDR2 SDRAM DIMMs are supported.\n");
printf("Replace the DIMM module with a supported DIMM.\n\n");
hang();
HANG();
break;
case 5:
printf("ERROR: Multiplexed ROM DIMM detected in slot %d.\n",
(unsigned int)dimm_num);
printf("Only DDR and DDR2 SDRAM DIMMs are supported.\n");
printf("Replace the DIMM module with a supported DIMM.\n\n");
hang();
HANG();
break;
case 6:
printf("ERROR: SGRAM DIMM detected in slot %d.\n",
(unsigned int)dimm_num);
printf("Only DDR and DDR2 SDRAM DIMMs are supported.\n");
printf("Replace the DIMM module with a supported DIMM.\n\n");
hang();
HANG();
break;
case 7:
debug("DIMM slot %d: DDR1 SDRAM detected\n", dimm_num);
......@@ -679,7 +686,7 @@ static void check_mem_type(unsigned long *dimm_populated,
(unsigned int)dimm_num);
printf("Only DDR1 and DDR2 SDRAM DIMMs are supported.\n");
printf("Replace the DIMM module with a supported DIMM.\n\n");
hang();
HANG();
break;
}
}
......@@ -689,7 +696,7 @@ static void check_mem_type(unsigned long *dimm_populated,
&& (dimm_populated[dimm_num] != SDRAM_NONE)
&& (dimm_populated[dimm_num-1] != dimm_populated[dimm_num])) {
printf("ERROR: DIMM's DDR1 and DDR2 type can not be mixed.\n");
hang();
HANG();
}
}
}
......@@ -764,7 +771,7 @@ static void check_frequency(unsigned long *dimm_populated,
(unsigned int)(calc_cycle_time*10));
printf("Replace the DIMM, or change DDR frequency via "
"strapping bits.\n\n");
hang();
HANG();
}
}
}
......@@ -796,7 +803,7 @@ static void check_rank_number(unsigned long *dimm_populated,
"slot %d is not supported.\n", dimm_rank, dimm_num);
printf("Only %d ranks are supported for all DIMM.\n", MAXRANKS);
printf("Replace the DIMM module with a supported DIMM.\n\n");
hang();
HANG();
} else
total_rank += dimm_rank;
}
......@@ -805,7 +812,7 @@ static void check_rank_number(unsigned long *dimm_populated,
"for all slots.\n", (unsigned int)total_rank);
printf("Only %d ranks are supported for all DIMM.\n", MAXRANKS);
printf("Remove one of the DIMM modules.\n\n");
hang();
HANG();
}
}
}
......@@ -830,28 +837,28 @@ static void check_voltage_type(unsigned long *dimm_populated,
printf("This DIMM is 5.0 Volt/TTL.\n");
printf("Replace the DIMM module in slot %d with a supported DIMM.\n\n",
(unsigned int)dimm_num);
hang();
HANG();
break;
case 0x01:
printf("ERROR: Only DIMMs DDR 2.5V or DDR2 1.8V are supported.\n");
printf("This DIMM is LVTTL.\n");
printf("Replace the DIMM module in slot %d with a supported DIMM.\n\n",
(unsigned int)dimm_num);
hang();
HANG();
break;
case 0x02:
printf("ERROR: Only DIMMs DDR 2.5V or DDR2 1.8V are supported.\n");
printf("This DIMM is 1.5 Volt.\n");
printf("Replace the DIMM module in slot %d with a supported DIMM.\n\n",
(unsigned int)dimm_num);
hang();
HANG();
break;
case 0x03:
printf("ERROR: Only DIMMs DDR 2.5V or DDR2 1.8V are supported.\n");
printf("This DIMM is 3.3 Volt/TTL.\n");
printf("Replace the DIMM module in slot %d with a supported DIMM.\n\n",
(unsigned int)dimm_num);
hang();
HANG();
break;
case 0x04:
/* 2.5 Voltage only for DDR1 */
......@@ -863,7 +870,7 @@ static void check_voltage_type(unsigned long *dimm_populated,
printf("ERROR: Only DIMMs DDR 2.5V or DDR2 1.8V are supported.\n");
printf("Replace the DIMM module in slot %d with a supported DIMM.\n\n",
(unsigned int)dimm_num);
hang();
HANG();
break;
}
}
......@@ -1006,13 +1013,13 @@ static void program_copt1(unsigned long *dimm_populated,
if ((dimm_populated[0] != SDRAM_NONE) && (dimm_populated[1] != SDRAM_NONE)) {
if (buf0 != buf1) {
printf("ERROR: DIMM's buffered/unbuffered, registered, clocking don't match.\n");
hang();
HANG();
}
}
if ((dimm_64bit == TRUE) && (dimm_32bit == TRUE)) {
printf("ERROR: Cannot mix 32 bit and 64 bit DDR-SDRAM DIMMs together.\n");
hang();
HANG();
}
else if ((dimm_64bit == TRUE) && (dimm_32bit == FALSE)) {
mcopt1 |= SDRAM_MCOPT1_DMWD_64;
......@@ -1020,7 +1027,7 @@ static void program_copt1(unsigned long *dimm_populated,
mcopt1 |= SDRAM_MCOPT1_DMWD_32;
} else {
printf("ERROR: Please install only 32 or 64 bit DDR-SDRAM DIMMs.\n\n");
hang();
HANG();
}
if (ecc_enabled == TRUE)
......@@ -1209,7 +1216,7 @@ static void program_initplr(unsigned long *dimm_populated,
break;
default:
printf("ERROR: ucode error on selected_cas value %d", selected_cas);
hang();
HANG();
break;
}
......@@ -1241,7 +1248,7 @@ static void program_initplr(unsigned long *dimm_populated,
break;
default:
printf("ERROR: write recovery not support (%d)", write_recovery);
hang();
HANG();
break;
}
#else
......@@ -1259,7 +1266,7 @@ static void program_initplr(unsigned long *dimm_populated,
ods = ODS_REDUCED;
} else {
printf("ERROR: Unsupported number of DIMM's (%d)", total_dimm);
hang();
HANG();
}
mr = CMD_EMR | SELECT_MR | BURST_LEN_4 | wr | cas;
......@@ -1284,7 +1291,7 @@ static void program_initplr(unsigned long *dimm_populated,
mtsdram(SDRAM_INITPLR13, 0x80800000 | emr); /* EMR OCD Exit */
} else {
printf("ERROR: ucode error as unknown DDR type in program_initplr");
hang();
HANG();
}
}
......@@ -1389,7 +1396,7 @@ static void program_mode(unsigned long *dimm_populated,
} else {
printf("ERROR: SPD reported Tcyc is incorrect for DIMM "
"in slot %d\n", (unsigned int)dimm_num);
hang();
HANG();
}
} else {
/* Convert from hex to decimal */
......@@ -1526,7 +1533,7 @@ static void program_mode(unsigned long *dimm_populated,
printf("ERROR: Cannot find a supported CAS latency with the installed DIMMs.\n");
printf("Only DIMMs DDR1 with CAS latencies of 2.0, 2.5, and 3.0 are supported.\n");
printf("Make sure the PLB speed is within the supported range of the DIMMs.\n\n");
hang();
HANG();
}
} else { /* DDR2 */
debug("cas_3_0_available=%d\n", cas_3_0_available);
......@@ -1549,7 +1556,7 @@ static void program_mode(unsigned long *dimm_populated,
cas_3_0_available, cas_4_0_available, cas_5_0_available);
printf("sdram_freq=%d cycle3=%d cycle4=%d cycle5=%d\n\n",
sdram_freq, cycle_3_0_clk, cycle_4_0_clk, cycle_5_0_clk);
hang();
HANG();
}
}
......@@ -1658,7 +1665,7 @@ static void program_rtr(unsigned long *dimm_populated,
printf("ERROR: DIMM %d unsupported refresh rate/type.\n",
(unsigned int)dimm_num);
printf("Replace the DIMM module with a supported DIMM.\n\n");
hang();
HANG();
break;
}
......@@ -2066,7 +2073,7 @@ static void program_bxcf(unsigned long *dimm_populated,
printf("ERROR: Unsupported value for number of "
"column addresses: %d.\n", (unsigned int)num_col_addr);
printf("Replace the DIMM module with a supported DIMM.\n\n");
hang();
HANG();
}
}
......@@ -2148,7 +2155,7 @@ static void program_memory_queue(unsigned long *dimm_populated,
printf("ERROR: Unsupported value for the banksize: %d.\n",
(unsigned int)rank_size_id);
printf("Replace the DIMM module with a supported DIMM.\n\n");
hang();
HANG();
}
if ((dimm_populated[dimm_num] != SDRAM_NONE) && (dimm_num == 1))
......@@ -2693,7 +2700,7 @@ calibration_loop:
printf("\nERROR: Cannot determine a common read delay for the "
"DIMM(s) installed.\n");
debug("%s[%d] ERROR : \n", __FUNCTION__,__LINE__);
hang();
HANG();
}
blank_string(strlen(str));
......@@ -2849,7 +2856,7 @@ static void test(void)
if (window_found == FALSE) {
printf("ERROR: Cannot determine a common read delay for the "
"DIMM(s) installed.\n");
hang();
HANG();
}
/*------------------------------------------------------------------
......
......@@ -180,7 +180,6 @@ void dev_print (block_dev_desc_t *dev_desc)
(CONFIG_COMMANDS & CFG_CMD_SCSI) || \
(CONFIG_COMMANDS & CFG_CMD_USB) || \
defined(CONFIG_MMC) || \
(defined(CONFIG_MMC) && defined(CONFIG_LPC2292)) || \
defined(CONFIG_SYSTEMACE) )
#if defined(CONFIG_MAC_PARTITION) || \
......@@ -223,7 +222,7 @@ void init_part (block_dev_desc_t * dev_desc)
int get_partition_info (block_dev_desc_t *dev_desc, int part
, disk_partition_t *info)
{
switch (dev_desc->part_type) {
switch (dev_desc->part_type) {
#ifdef CONFIG_MAC_PARTITION
case PART_TYPE_MAC:
if (get_partition_info_mac(dev_desc,part,info) == 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment