+
+======================================================================
+Note: Version 2.0.0 of PPCBoot, the "Halloween Release", is the LAST
+ Release of the PPCBoot project. Development is frozen with this
+ version.
+
+ Since PPCBoot is no longer focussed on PowerPC systems only the
+ name has become inappropriate. The project will be continued as
+ "Das U-Boot" (The Universal Booter), see the new project page
+ at SourceForge: http://sourceforge.net/projects/u-boot/
+======================================================================
+
======================================================================
-Modifications since 1.2.1:
+Modifications for 2.0.0:
======================================================================
+* Fix TFTP problems introduced with multiple network interface code
+ (tight loop when trying to load non-existent file, etc.)
+
+* Fix delay problem in modem support code;
+ fix HW handshake problem on TRAB
+
+* Implement a real reset (based on a watchdog reset) for s3c2400
+ based systems (SMDK2400, TRAB).
+
+* Fix ramdisk problem on ARM: it would try to copy the image onto
+ itself, which in some cases caused corruption of the flash contents
+
+* Patch by Guillaume Alexandre, 31 Oct 2002:
+ - add support of the dd2 version of the IBM CPC710 (Avignon) chip
+ - fix a bus parking problem (system hang)
+ - fix i2c eeprom erasure problem
+
* Shuffle init sequence: do PCMCIA/IDE init after the watchdog POST
so thatit's done only once during normal startup (saves some secs
when booting on LWMON)
LIST_xscale="lubbock cradle csb226"
-LIST_arm="${LIST_SA} ${LIST_ARM7} ${LIST_ARM9}"
+LIST_arm="${LIST_SA} ${LIST_ARM7} ${LIST_ARM9} ${LIST_xscale}"
#----- for now, just run PPC by default -----
#ifndef _CPC710_H_
#define _CPC710_H_
+/* Revision */
+#define CPC710_TYPE_100 0x80
+#define CPC710_TYPE_100P 0x90
+
/* System control area */
#define HW_PHYS_SCA 0xff000000
unsigned int i;
cpc710_mem_org_t * org = 0;
+
+ if (! i2c_reset())
+ {
+ puts("Can't reset I2C!\n");
+ hang();
+ }
+
if (! cpc710_eeprom_checksum(sdram))
{
puts("Invalid EEPROM checksum !\n");
return 0;
}
+
mc |= cpc710_mcer_mem [lines - 18] << 6;
for (i = 0; i < sizeof(cpc710_mem_org) / sizeof(cpc710_mem_org_t); i++)
u8 dev = (sdram << 1) | 0xa0;
u8 data;
- if (! i2c_write_byte(dev, (u8) offset))
- {
- puts("I2C error !\n");
- hang();
- }
-
- if (! i2c_read_byte(& data, dev))
+ if (! i2c_read_byte(& data, dev,offset))
{
puts("I2C error !\n");
hang();
static void i2c_start (void);
static void i2c_stop (void);
static int i2c_write (u8 data);
-static int i2c_read (u8 * data);
+static void i2c_read (u8 * data);
static inline void i2c_port_start (void);
-static inline void i2c_port_stop (void);
static inline void i2c_clock (unsigned int val);
static inline void i2c_data (unsigned int val);
static inline unsigned int
i2c_in (void);
-static inline void i2c_wait (void);
-
static inline void i2c_write_bit (unsigned int val);
static inline unsigned int
i2c_read_bit (void);
int i2c_read_byte (
u8 * data,
- u8 dev)
+ u8 dev,
+ u8 offset)
{
int err = 0;
i2c_start();
+ err = ! i2c_write(dev);
+
if (! err)
{
- err = ! i2c_write(dev | 0x01);
+ err = ! i2c_write(offset);
}
if (! err)
{
- err = ! i2c_read(data);
+ i2c_start();
}
- i2c_stop();
-
- return ! err;
-}
-
-int i2c_write_byte (
- u8 dev,
- u8 data)
-{
- int err = 0;
-
- i2c_start();
-
if (! err)
{
- err = ! i2c_write(dev);
+ err = ! i2c_write(dev | 0x01);
}
if (! err)
{
- err = ! i2c_write(data);
+ i2c_read(data);
}
i2c_stop();
{
int v;
- asm volatile("mtdec %0" : : "r" (time * (CFG_BUS_CLK / 4 / 1000000)));
+ asm volatile("mtdec %0" : : "r" (time * ((CFG_BUS_CLK / 4) / 1000000)));
do
{
i2c_udelay(1);
}
-static inline void i2c_port_stop (void)
-{
- out32(REG(CPC0, GPDIR), in32(REG(CPC0, GPDIR)) & ~(BIT_GPCLK | BIT_GPDATA));
- iobarrier_rw();
-
- i2c_udelay(1);
-}
-
static inline void i2c_clock (
unsigned int val)
{
static inline unsigned int i2c_in (void)
{
- unsigned int val = (in32(REG(CPC0, GPIN)) & BIT_GPDATA) != 0;
+ unsigned int val = ((in32(REG(CPC0, GPIN)) & BIT_GPDATA) != 0)?1:0;
iobarrier_rw();
return val;
}
-static inline void i2c_wait (void)
-{
- i2c_udelay(10);
-}
/* Protocol implementation
*/
static inline void i2c_write_bit (
unsigned int val)
{
- if (val == 0)
- {
- i2c_data(0);
- }
-
+ i2c_data(val);
+ i2c_udelay(10);
i2c_clock(1);
- i2c_wait();
-
+ i2c_udelay(10);
i2c_clock(0);
- i2c_wait();
-
- if (val == 0)
- {
- i2c_data(1);
- }
+ i2c_udelay(10);
}
static inline unsigned int i2c_read_bit (void)
{
unsigned int val;
+ i2c_data(1);
+ i2c_udelay(10);
+
i2c_clock(1);
- i2c_wait();
+ i2c_udelay(10);
val = i2c_in();
i2c_clock(0);
- i2c_wait();
+ i2c_udelay(10);
return val;
}
-static void i2c_start (void)
+unsigned int i2c_reset (void)
{
+ unsigned int val;
+ int i;
+
i2c_port_start();
- i2c_clock(0);
- i2c_data(1);
+ i=0;
+ do {
+ i2c_udelay(10);
+ i2c_clock(0);
+ i2c_udelay(10);
+ i2c_clock(1);
+ i2c_udelay(10);
+ val = i2c_in();
+ i++;
+ } while ((i<9)&&(val==0));
+ return (val);
+}
- i2c_clock(1);
- i2c_wait();
+static void i2c_start (void)
+{
+ i2c_data(1);
+ i2c_clock(1);
+ i2c_udelay(10);
i2c_data(0);
- i2c_wait();
-
+ i2c_udelay(10);
i2c_clock(0);
- i2c_wait();
-
- i2c_data(1);
+ i2c_udelay(10);
}
static void i2c_stop (void)
{
i2c_data(0);
-
+ i2c_udelay(10);
i2c_clock(1);
- i2c_wait();
-
+ i2c_udelay(10);
i2c_data(1);
- i2c_wait();
-
- i2c_port_stop();
+ i2c_udelay(10);
}
static int i2c_write (
return i2c_read_bit() == 0;
}
-static int i2c_read (
+static void i2c_read (
u8 * data)
{
unsigned int i;
}
*data = val;
-
- return 1;
+ i2c_write_bit(1); /* NoAck */
}
#include <common.h>
extern int i2c_read_byte (u8 * data,
- u8 dev);
-extern int i2c_write_byte (u8 dev,
- u8 data);
+ u8 dev,
+ u8 offset);
+
+extern unsigned int i2c_reset (void);
+
#endif
out32 (REG (CPC0, SIOC0), 0x30000000);
- out32 (REG (CPC0, ABCNTL), 0xF0000000);
+ out32 (REG (CPC0, ABCNTL), 0x00000000);
out32 (REG (CPC0, SESR), 0x00000000);
out32 (REG (CPC0, SEAR), 0x00000000);
- out32 (REG (CPC0, PGCHP), 0x80800040);
+ /* Detect IBM Avignon CPC710 Revision */
+ if ((in32 (REG (CPC0, UCTL)) & 0x000000F0) == CPC710_TYPE_100P)
+ out32 (REG (CPC0, PGCHP), 0xA0000040);
+ else
+ out32 (REG (CPC0, PGCHP), 0x80800040);
+
out32 (REG (CPC0, ATAS), 0x709C2508);
cpu/arm920t/start.o (.text)
lib_arm/_udivsi3.o (.text)
lib_arm/_umodsi3.o (.text)
- lib_arm/div0.o (.text)
lib_generic/zlib.o (.text)
lib_generic/crc32.o (.text)
lib_generic/string.o (.text)
extern void disable_putc(void);
extern int do_mdm_init; /* defined in common/main.c */
-extern int trab_kbd_data []; /* defined in common/main.c */
-
/*
* We need a delay of at least 500 us after turning on the VFD clock
* before we can read any useful information for the CPLD controlling
/* 00, 10, 10, 10, 10, 10, 10 */
rPFCON = (2<<0) | (2<<2) | (2<<4) | (2<<6) | (2<<8) | (2<<10);
#ifdef CONFIG_HWFLOW
- /* do not pull up RXD0, RXD1, TXD0, TXD1 */
- rPFUP = (1<<0) | (1<<1) | (1<<2) | (1<<3);
-#else
/* do not pull up RXD0, RXD1, TXD0, TXD1, CTS0, RTS0 */
rPFUP = (1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<4) | (1<<5);
+#else
+ /* do not pull up RXD0, RXD1, TXD0, TXD1 */
+ rPFUP = (1<<0) | (1<<1) | (1<<2) | (1<<3);
#endif
rPGCON = 0x0;
rPGUP = 0x0;
rLCDCON1 = 0x00000B75;
}
- trab_kbd_data[0] = (*(volatile int *)0x04020000);
-
mdelay_no_timer (KBD_MDELAY);
- trab_kbd_data[1] = (*(volatile int *)0x04020000);
-
if (key_pressed()) {
disable_putc(); /* modem doesn't understand banner etc */
do_mdm_init = 1;
uchar *str;
int i;
- trab_kbd_data[2] = (*(volatile int *)0x04020000);
-
for (i = 0; i < KEYBD_KEY_NUM; ++i) {
keybd_env[i] = '0' + ((kbd_data >> i) & 1);
}
* MA 02111-1307 USA
*/
+/************************************************************************/
+/* ** DEBUG SETTINGS */
+/************************************************************************/
+
+/* #define DEBUG */
+
/************************************************************************/
/* ** HEADER FILES */
/************************************************************************/
#ifdef CONFIG_VFD
-/************************************************************************/
-/* ** DEBUG SETTINGS */
-/************************************************************************/
-
-#undef VFD_DEBUG
-
-#ifdef VFD_DEBUG
-#define DEBUGF(fmt,args...) printf(fmt ,##args)
-#else
-#define DEBUGF(fmt,args...)
-#endif
-
/************************************************************************/
/* ** CONFIG STUFF -- should be moved to board config file */
/************************************************************************/
#define PAGE_SIZE 4096
#endif
-#define ROT 0x09
-#define BLAU 0x0C
-#define VIOLETT 0X0D
+#define ROT 0x09
+#define BLAU 0x0C
+#define VIOLETT 0X0D
ulong vfdbase;
ulong frame_buf_size;
#define frame_buf_offs 4
-/* taken from armboot/common/vfd.c by TQS */
+/* taken from armboot/common/vfd.c */
ulong adr_vfd_table[112][18][2][4][2];
unsigned char bit_vfd_table[112][18][2][4][2];
rLCDCON5 = 0x00000440;
rLCDCON1 = 0x00000B75;
- DEBUGF ("LCDSADDR1: %lX\n", rLCDSADDR1);
- DEBUGF ("LCDSADDR2: %lX\n", rLCDSADDR2);
- DEBUGF ("LCDSADDR3: %lX\n", rLCDSADDR3);
+ debug ("LCDSADDR1: %lX\n", rLCDSADDR1);
+ debug ("LCDSADDR2: %lX\n", rLCDSADDR2);
+ debug ("LCDSADDR3: %lX\n", rLCDSADDR3);
for(palette=0;palette<=15;palette++)
(*(volatile unsigned int*)(PALETTE+(palette*4)))=palette;
/* Round up to nearest full page */
size = (frame_buf_size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
- DEBUGF ("Reserving %ldk for VFD Framebuffer at: %08lx\n", size>>10, addr);
+ debug ("Reserving %ldk for VFD Framebuffer at: %08lx\n", size>>10, addr);
return (size);
}
.plt : { *(.plt) }
.text :
{
- /* WARNING - the following is hand-optimized to fit within */
- /* the sector layout of our flash chips! XXX FIXME XXX */
-
cpu/ppc4xx/start.o (.text)
board/w7o/init.o (.text)
- cpu/ppc4xx/kgdb.o (.text)
- cpu/ppc4xx/traps.o (.text)
- cpu/ppc4xx/interrupts.o (.text)
- cpu/ppc4xx/serial.o (.text)
- cpu/ppc4xx/cpu_init.o (.text)
- cpu/ppc4xx/speed.o (.text)
- cpu/ppc4xx/405gp_enet.o (.text)
- common/dlmalloc.o (.text)
- lib_generic/crc32.o (.text)
- lib_ppc/extable.o (.text)
- lib_generic/zlib.o (.text)
-
-/* . = env_offset;*/
-/* common/environment.o(.text)*/
-
*(.text)
*(.fixup)
*(.got1)
#define VFD_REMOTE_LOGO_BMPNR 1
#endif
-extern void transfer_pic(unsigned char, unsigned char *, int, int);
+extern int transfer_pic(unsigned char, unsigned char *, int, int);
+
+int trab_vfd (ulong bitmap);
int do_vfd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
bitmap = simple_strtoul(argv[1], NULL, 10);
- switch (bitmap)
- {
+ return (trab_vfd(bitmap));
+}
+#endif /* CFG_CMD_VFD */
+
+#ifdef CONFIG_VFD
+int trab_vfd (ulong bitmap)
+{
+ switch (bitmap) {
#ifdef VFD_TEST_LOGO
case VFD_TEST_LOGO_BMPNR:
transfer_pic(1, &vfd_test_logo_bitmap[0],
VFD_TEST_LOGO_HEIGHT, VFD_TEST_LOGO_WIDTH);
- break;
+ return 0;
case VFD_REMOTE_LOGO_BMPNR:
transfer_pic(1, &vfd_remote_logo_bitmap[0],
VFD_TEST_LOGO_HEIGHT, VFD_TEST_LOGO_WIDTH);
- break;
+ return 0;
#endif
default:
printf("Unknown bitmap %ld\n", bitmap);
- break;
+ return 1;
}
- return 0;
+ /* NOTREACHED */
}
-
-#endif /* CFG_CMD_VFD */
+#endif /* CONFIG_VFD */
#ifdef CONFIG_MODEM_SUPPORT
int do_mdm_init = 0;
-int trab_kbd_data[] = {0x666, 0x666, 0x666, };
extern void mdm_init(void); /* defined in board.c */
#endif
char *p;
#endif
+#if defined(CONFIG_VFD) && defined(VFD_TEST_LOGO)
+ ulong bmp = 0; /* default bitmap */
+ extern int trab_vfd (ulong bitmap);
+
#ifdef CONFIG_MODEM_SUPPORT
-printf("DEBUG: board_init 0: kbd_data=%08X -> %01X\n", trab_kbd_data[0], (trab_kbd_data[0] >> 16) & 0xF);
-printf("DEBUG: board_init 1: kbd_data=%08X -> %01X\n", trab_kbd_data[1], (trab_kbd_data[1] >> 16) & 0xF);
-printf("DEBUG: misc_init_r : kbd_data=%08X -> %01X\n\n", trab_kbd_data[2], (trab_kbd_data[2] >> 16) & 0xF);
-printf("DEBUG: main_loop: do_mdm_init=%d\n", do_mdm_init);
if (do_mdm_init)
+ bmp = 1; /* alternate bitmap */
+#endif
+ trab_vfd (bmp);
+#endif /* CONFIG_VFD && VFD_TEST_LOGO */
+
+#ifdef CONFIG_MODEM_SUPPORT
+ debug ("DEBUG: main_loop: do_mdm_init=%d\n", do_mdm_init);
+ if (do_mdm_init) {
+ uchar *str = strdup(getenv("mdm_cmd"));
+ setenv ("preboot", str); /* set or delete definition */
+ if (str != NULL)
+ free (str);
mdm_init(); /* wait for modem connection */
+ }
#endif /* CONFIG_MODEM_SUPPORT */
#ifdef CFG_HUSH_PARSER
.align 5
.globl reset_cpu
reset_cpu:
+#ifdef CONFIG_S3C2400
+ bl disable_interrupts
+ ldr r1, _rWTCON
+ ldr r2, _rWTCNT
+ /* Disable watchdog */
+ mov r3, #0x0000
+ str r3, [r1]
+ /* Initialize watchdog timer count register */
+ mov r3, #0x0001
+ str r3, [r2]
+ /* Enable watchdog timer; assert reset at timer timeout */
+ mov r3, #0x0021
+ str r3, [r1]
+_loop_forever:
+ b _loop_forever
+_rWTCON:
+ .word 0x15300000
+_rWTCNT:
+ .word 0x15300008
+#else /* ! CONFIG_S3C2400 */
mov ip, #0
mcr p15, 0, ip, c7, c7, 0 @ invalidate cache
mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4)
bic ip, ip, #0x2100 @ ..v....s........
mcr p15, 0, ip, c1, c0, 0 @ ctrl register
mov pc, r0
+#endif /* CONFIG_S3C2400 */
debug ("[RRvision] PD3 -> clk output: ");
immr->im_ioport.iop_pdpar |= 0x1000 ;
+#if 0 /* This is supposed to be an output XXX XXX */
+ immr->im_ioport.iop_pddir |= 0x1000 ;
+#else
immr->im_ioport.iop_pddir &= ~(0x1000);
+#endif
udelay (1000);
debug ("PDPAR=%04X PDDIR=%04X PDDAT=%04X\n",
immr->im_ioport.iop_pdpar,
ldr r2, _armboot_start
ldr r3, _armboot_end
sub r2, r3, r2 /* r2 <- size of armboot */
-/* ldr r1, _uboot_reloc /* r1 <- destination address */
+/* ldr r1, _uboot_reloc / * r1 <- destination address */
ldr r1, _TEXT_BASE
add r2, r0, r2 /* r2 <- source end address */
CFG_CMD_SAVES | \
CFG_CMD_SCSI | \
CFG_CMD_SDRAM | \
- CFG_CMD_USB )
+ CFG_CMD_USB | \
+ CFG_CMD_VFD )
/* Default configuration
*/
& ~CFG_CMD_PCI \
& ~CFG_CMD_PCMCIA \
& ~CFG_CMD_SCSI \
- & ~CFG_CMD_USB )
+ & ~CFG_CMD_USB \
+ & ~CFG_CMD_VFD )
#if CONFIG_LANTEC >= 2
#define CONFIG_RTC_MPC8xx /* use internal RTC of MPC8xx */
CFG_CMD_PCI | \
CFG_CMD_PCMCIA | \
CFG_CMD_SCSI | \
+ CFG_CMD_VFD | \
CFG_CMD_USB ) )
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
~CFG_CMD_PCMCIA & \
~CFG_CMD_SCSI & \
~CFG_CMD_USB & \
+ ~CFG_CMD_VFD & \
~CFG_CMD_DTT )
/* Where do the internal registers live? */
CFG_CMD_PCI | \
CFG_CMD_USB | \
CFG_CMD_SCSI | \
+ CFG_CMD_VFD | \
CFG_CMD_DTT ) )
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
#define CONFIG_BAUDRATE 115200 /* with watchdog >= 38400 needed */
-#if 0
-#define CONFIG_BOOTDELAY -1 /* autoboot disabled */
-#else
-#define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */
-#endif
+#define CONFIG_BOOTDELAY 1 /* autoboot after 1 second */
#define CONFIG_CLOCKS_IN_MHZ 1 /* clocks passsed to Linux in MHz */
CFG_POST_USB | \
CFG_POST_SPR)
-/*
- * HACK: insert some more variable definitions ;-)
- */
-#define CONFIG_BOOTCOMMAND \
- "run flash_self" \
- "\0" \
+#define CONFIG_BOOTCOMMAND "run flash_self"
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
"kernel_addr=40040000\0" \
"ramdisk_addr=40100000\0" \
- "magic_keys=#789\0" \
- "key_magic7=24\0key_cmd7=echo ## Taste '7' aktiv ##;echo\0" \
- "key_magic8=25\0key_cmd8=echo=## Taste '8' aktiv ##;echo\0" \
- "key_magic9=26\0key_cmd9=setenv addfb setenv bootargs \\$(bootargs) " \
- "console=tty0 console=ttyS1,$(baudrate)\0" \
- "key_magic#=28\0key_cmd#=setenv addfb setenv bootargs \\$(bootargs) " \
- "console=tty0\0" \
+ "magic_keys=#3\0" \
+ "key_magic#=28\0" \
+ "key_cmd#=setenv addfb setenv bootargs \\$(bootargs) console=tty0\0" \
+ "key_magic3=24\0" \
+ "key_cmd3=echo *** Entering Test Mode ***;" \
+ "setenv add_misc setenv bootargs \\$(bootargs) testmode\0" \
"nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath)\0" \
"ramargs=setenv bootargs root=/dev/ram rw\0" \
"addfb=setenv bootargs $(bootargs) console=ttyS1,$(baudrate)\0" \
"ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname)::off " \
"panic=1\0" \
"add_wdt=setenv bootargs $(bootargs) $(wdt_args)\0" \
- "flash_nfs=run nfsargs;run addip;run add_wdt;run addfb;" \
+ "flash_nfs=run nfsargs addip add_wdt addfb;" \
"bootm $(kernel_addr)\0" \
- "flash_self=run ramargs;run addip;run add_wdt;run addfb;" \
+ "flash_self=run ramargs addip add_wdt addfb;" \
"bootm $(kernel_addr) $(ramdisk_addr)\0" \
- "net_nfs=tftp 100000 /tftpboot/pImage.lwmon;run nfsargs;run addip;" \
- "run add_wdt;run addfb;bootm\0" \
+ "net_nfs=tftp 100000 /tftpboot/pImage.lwmon;" \
+ "run nfsargs addip add_wdt addfb;bootm\0" \
"rootpath=/opt/eldk/ppc_8xx\0" \
"load=tftp 100000 /tftpboot/ppcboot.bin\0" \
"update=protect off 1:0;era 1:0;cp.b 100000 40000000 $(filesize)\0" \
- "wdt_args=wdt_8xx=off"
+ "wdt_args=wdt_8xx=off\0" \
+ "verify=no"
#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
#undef CFG_LOADS_BAUD_CHANGE /* don't allow baudrate change */
CONFIG_COMMANDS_ADD_VFD )
#endif
-#undef CONFIG_COMMANDS_ADD_HWFLOW
-#undef CONFIG_COMMANDS_ADD_VFD
-
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
#include <cmd_confdefs.h>
"net_load=tftpboot $(loadaddr) $(loadfile)\0" \
"net_nfs=run net_load nfs_args add_net add_misc;bootm\0" \
"kernel_addr=00040000\0" \
- "flash_nfs=run nfs_args add_net add_misc;bootm $(kernel_addr)\0"
+ "flash_nfs=run nfs_args add_net add_misc;bootm $(kernel_addr)\0" \
+ "mdm_init1=ATZ\0" \
+ "mdm_init2=ATS0=1\0" \
+ "mdm_flow_control=rts/cts\0"
#if 0 /* disabled for development */
#define CONFIG_AUTOBOOT_KEYED /* Enable password protection */
extern int eth_initialize(bd_t *bis); /* Initialize network subsystem */
extern int eth_register(struct eth_device* dev);/* Register network device */
-extern void eth_try_another(void); /* Change the device */
+extern void eth_try_another(int first_restart); /* Change the device */
extern struct eth_device *eth_get_dev(void); /* get the current device MAC */
extern void eth_set_enetaddr(int num, char* a); /* Set new MAC address */
#endif
#define NETLOOP_SUCCESS 3
#define NETLOOP_FAIL 4
+#ifdef CONFIG_NET_MULTI
+extern int NetRestartWrap; /* Tried all network devices */
+#endif
typedef enum { BOOTP, RARP, ARP, TFTP, DHCP } proto_t;
#ifndef __VERSION_H__
#define __VERSION_H__
-#define PPCBOOT_VERSION "PPCBoot 1.2.2"
+#define PPCBOOT_VERSION "PPCBoot 2.0.0"
#endif /* __VERSION_H__ */
if (data) {
initrd_start = data;
initrd_end = initrd_start + len;
- printf (" Loading Ramdisk to %08lx, end %08lx ... ",
- initrd_start, initrd_end);
- memmove ((void *)initrd_start, (void *)data, len);
- printf ("OK\n");
} else {
initrd_start = 0;
initrd_end = 0;
static inline void mdm_readline(char *buf, int bufsiz);
extern void enable_putc(void);
extern int hwflow_onoff(int);
- static void delay(void);
enable_putc(); /* enable serial_putc() */
} else
break; /* no init string - stop modem init */
- delay();
+ udelay(100000);
}
- delay();
+ udelay(100000);
/* final stage - wait for connect */
for(;i > 1;) { /* if 'i' > 1 - wait for connection
}
}
}
-
-static void delay(void)
-{
- int i = 50000;
- while(i--);
-}
#endif /* CONFIG_MODEM_SUPPORT */
if (eth_current->init(eth_current, bis)) {
eth_current->state = ETH_STATE_ACTIVE;
+ printf("%s configured\n", eth_current->name);
return 1;
}
puts ("FAIL\n");
#endif
- eth_try_another();
+ eth_try_another(0);
} while (old_current != eth_current);
return 0;
return eth_current->recv(eth_current);
}
-void eth_try_another(void)
+void eth_try_another(int first_restart)
{
+ static struct eth_device *first_failed = NULL;
+
if (!eth_current)
return;
+ if (first_restart)
+ {
+ first_failed = eth_current;
+ }
+
eth_current = eth_current->next;
+
+ if (first_failed == eth_current)
+ {
+ NetRestartWrap = 1;
+ }
}
#endif
uchar NetBcastAddr[6] = /* Ethernet bcast address */
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
int NetState; /* Network loop state */
+#ifdef CONFIG_NET_MULTI
+int NetRestartWrap = 0; /* Tried all network devices */
+static int NetRestarted = 0; /* Network loop restarted */
+static int NetDevExists = 0; /* At least one device configured */
+#endif
char BootFile[128]; /* Boot File name */
bd_t *bd = gd->bd;
+#ifdef CONFIG_NET_MULTI
+ NetRestarted = 0;
+ NetDevExists = 0;
+#endif
+
if (!NetTxPacket) {
int i;
* packets and timer events.
*/
- if (protocol == TFTP) { /* TFTP */
+ switch (protocol) {
+ case TFTP:
NetCopyIP(&NetOurIP, &bd->bi_ip_addr);
NetServerIP = getenv_IPaddr ("serverip");
NetOurGatewayIP = getenv_IPaddr ("gatewayip");
NetOurSubnetMask= getenv_IPaddr ("netmask");
-
- if (net_check_prereq (protocol) != 0) {
- return 0;
- }
-
- /* always use ARP to get server ethernet address */
- ArpTry = 0;
- ArpRequest ();
-
-#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
- } else if (protocol == DHCP) {
- if (net_check_prereq (protocol) != 0) {
- return 0;
- }
-
- /* Start with a clean slate... */
- NetOurIP = 0;
- NetServerIP = 0;
- DhcpRequest(); /* Basically same as BOOTP */
-
-#endif /* CFG_CMD_DHCP */
-
- } else { /* BOOTP or RARP */
-
+ break;
+ case BOOTP:
+ case RARP:
/*
* initialize our IP addr to 0 in order to accept ANY
* IP addr assigned to us by the BOOTP / RARP server
*/
NetOurIP = 0;
NetServerIP = 0;
+ break;
+ default:
+ break;
+ }
- if (net_check_prereq (protocol) != 0) {
- return 0;
- }
+ switch (net_check_prereq (protocol)) {
+ case 1:
+ /* network not configured */
+ return 0;
+
+#ifdef CONFIG_NET_MULTI
+ case 2:
+ /* network device not configured */
+ break;
+#endif /* CONFIG_NET_MULTI */
+
+ case 0:
+#ifdef CONFIG_NET_MULTI
+ NetDevExists = 1;
+#endif
+ switch (protocol) {
+ case TFTP:
+ /* always use ARP to get server ethernet address */
+ ArpTry = 0;
+ ArpRequest ();
+ break;
- if (protocol == BOOTP) {
+#if (CONFIG_COMMANDS & CFG_CMD_DHCP)
+ case DHCP:
+ /* Start with a clean slate... */
+ NetOurIP = 0;
+ NetServerIP = 0;
+ DhcpRequest(); /* Basically same as BOOTP */
+ break;
+#endif /* CFG_CMD_DHCP */
+
+ case BOOTP:
BootpTry = 0;
BootpRequest ();
- } else {
- RarpTry = 0;
+ break;
+
+ case RARP:
+ RarpTry = 0;
RarpRequest ();
+ break;
+ default:
+ break;
}
+
+ NetBootFileXferSize = 0;
+ break;
}
- NetBootFileXferSize = 0;
/*
* Main packet reception loop. Loop receiving packets until
case NETLOOP_RESTART:
#ifdef CONFIG_NET_MULTI
- eth_halt();
- eth_try_another();
- eth_init(bd);
+ NetRestarted = 1;
#endif
goto restart;
/**********************************************************************/
-#ifndef CONFIG_NET_MULTI
static void
startAgainTimeout(void)
{
{
/* Totally ignore the packet */
}
-#endif
-
void
NetStartAgain(void)
NetSetTimeout(10 * CFG_HZ, startAgainTimeout);
NetSetHandler(startAgainHandler);
#else
- NetState = NETLOOP_RESTART;
+ DECLARE_GLOBAL_DATA_PTR;
+
+ eth_halt();
+ eth_try_another(!NetRestarted);
+ eth_init(gd->bd);
+ if (NetRestartWrap)
+ {
+ NetRestartWrap = 0;
+ if (NetDevExists)
+ {
+ NetSetTimeout(10 * CFG_HZ, startAgainTimeout);
+ NetSetHandler(startAgainHandler);
+ }
+ else
+ {
+ NetState = NETLOOP_FAIL;
+ }
+ }
+ else
+ {
+ NetState = NETLOOP_RESTART;
+ }
#endif
}
switch (num) {
case -1:
puts ("*** ERROR: No ethernet found.\n");
- break;
+ return (1);
case 0:
puts ("*** ERROR: `ethaddr' not set\n");
break;
num);
break;
}
+
+ NetStartAgain ();
+ return (2);
#else
puts ("*** ERROR: `ethaddr' not set\n");
-#endif
return (1);
+#endif
}
/* Fall through */
}