From: wdenk Date: Fri, 1 Nov 2002 00:38:48 +0000 (+0000) Subject: * Fix TFTP problems introduced with multiple network interface code X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d1e847a31632c88d90d8555df73bff6705b37560;p=users%2Frw%2Fppcboot.git * 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 --- diff --git a/CHANGELOG b/CHANGELOG index 6e7a161..8c3e7f4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,36 @@ + +====================================================================== +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) diff --git a/MAKEALL b/MAKEALL index c30f1d6..401c543 100755 --- a/MAKEALL +++ b/MAKEALL @@ -103,7 +103,7 @@ LIST_ARM9="smdk2400 smdk2410 trab" 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 ----- diff --git a/board/pcippc2/cpc710.h b/board/pcippc2/cpc710.h index cfae734..8167270 100644 --- a/board/pcippc2/cpc710.h +++ b/board/pcippc2/cpc710.h @@ -24,6 +24,10 @@ #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 diff --git a/board/pcippc2/cpc710_init_ram.c b/board/pcippc2/cpc710_init_ram.c index fecb2ab..9786159 100644 --- a/board/pcippc2/cpc710_init_ram.c +++ b/board/pcippc2/cpc710_init_ram.c @@ -163,6 +163,13 @@ static int cpc710_compute_mcer ( 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"); @@ -184,6 +191,7 @@ static int cpc710_compute_mcer ( return 0; } + mc |= cpc710_mcer_mem [lines - 18] << 6; for (i = 0; i < sizeof(cpc710_mem_org) / sizeof(cpc710_mem_org_t); i++) @@ -236,13 +244,7 @@ static u8 cpc710_eeprom_read ( 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(); diff --git a/board/pcippc2/i2c.c b/board/pcippc2/i2c.c index 25a16b5..1cf7b2e 100644 --- a/board/pcippc2/i2c.c +++ b/board/pcippc2/i2c.c @@ -31,16 +31,13 @@ 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); @@ -49,43 +46,33 @@ static inline void i2c_udelay (unsigned int time); 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(); @@ -98,7 +85,7 @@ static inline void i2c_udelay ( { 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 { @@ -121,14 +108,6 @@ static inline void i2c_port_start (void) 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) { @@ -165,17 +144,13 @@ static inline void i2c_data ( 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 */ @@ -183,68 +158,72 @@ static inline void i2c_wait (void) 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 ( @@ -261,7 +240,7 @@ static int i2c_write ( return i2c_read_bit() == 0; } -static int i2c_read ( +static void i2c_read ( u8 * data) { unsigned int i; @@ -274,6 +253,5 @@ static int i2c_read ( } *data = val; - - return 1; + i2c_write_bit(1); /* NoAck */ } diff --git a/board/pcippc2/i2c.h b/board/pcippc2/i2c.h index 64d35a1..1224b42 100644 --- a/board/pcippc2/i2c.h +++ b/board/pcippc2/i2c.h @@ -27,8 +27,10 @@ #include 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 diff --git a/board/pcippc2/pcippc2.c b/board/pcippc2/pcippc2.c index 2a44d83..7a8bf94 100644 --- a/board/pcippc2/pcippc2.c +++ b/board/pcippc2/pcippc2.c @@ -85,12 +85,17 @@ int board_pre_init (void) 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); diff --git a/board/trab/ppcboot.lds b/board/trab/ppcboot.lds index 567447c..9b454e2 100644 --- a/board/trab/ppcboot.lds +++ b/board/trab/ppcboot.lds @@ -35,7 +35,6 @@ SECTIONS 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) diff --git a/board/trab/trab.c b/board/trab/trab.c index c66e1be..2ab6592 100644 --- a/board/trab/trab.c +++ b/board/trab/trab.c @@ -35,8 +35,6 @@ static int key_pressed(void); 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 @@ -85,11 +83,11 @@ int board_init () /* 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; @@ -122,12 +120,8 @@ int board_init () 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; @@ -164,8 +158,6 @@ int misc_init_r (void) 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); } diff --git a/board/trab/vfd.c b/board/trab/vfd.c index b550a69..891461a 100644 --- a/board/trab/vfd.c +++ b/board/trab/vfd.c @@ -21,6 +21,12 @@ * MA 02111-1307 USA */ +/************************************************************************/ +/* ** DEBUG SETTINGS */ +/************************************************************************/ + +/* #define DEBUG */ + /************************************************************************/ /* ** HEADER FILES */ /************************************************************************/ @@ -35,18 +41,6 @@ #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 */ /************************************************************************/ @@ -57,15 +51,15 @@ #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]; @@ -380,9 +374,9 @@ int drv_vfd_init(void) 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; @@ -412,7 +406,7 @@ ulong vfd_setmem (ulong addr) /* 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); } diff --git a/board/w7o/ppcboot.lds b/board/w7o/ppcboot.lds index 10ff61f..2ddba5d 100644 --- a/board/w7o/ppcboot.lds +++ b/board/w7o/ppcboot.lds @@ -58,26 +58,8 @@ SECTIONS .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) diff --git a/common/cmd_vfd.c b/common/cmd_vfd.c index 4a538f9..d2c63d6 100644 --- a/common/cmd_vfd.c +++ b/common/cmd_vfd.c @@ -42,7 +42,9 @@ #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[]) { @@ -55,23 +57,28 @@ 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 */ diff --git a/common/main.c b/common/main.c index a8d7c41..aef6ba3 100644 --- a/common/main.c +++ b/common/main.c @@ -63,7 +63,6 @@ static int retry_time = -1; /* -1 so can call readline before main_loop */ #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 @@ -244,13 +243,26 @@ void main_loop (void) 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 diff --git a/cpu/arm920t/start.S b/cpu/arm920t/start.S index 00b3082..270bb52 100644 --- a/cpu/arm920t/start.S +++ b/cpu/arm920t/start.S @@ -444,6 +444,26 @@ fiq: .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) @@ -452,3 +472,4 @@ reset_cpu: bic ip, ip, #0x2100 @ ..v....s........ mcr p15, 0, ip, c1, c0, 0 @ ctrl register mov pc, r0 +#endif /* CONFIG_S3C2400 */ diff --git a/cpu/mpc8xx/video.c b/cpu/mpc8xx/video.c index 795ccd5..a14e4dd 100644 --- a/cpu/mpc8xx/video.c +++ b/cpu/mpc8xx/video.c @@ -837,7 +837,11 @@ static void video_ctrl_init (void *memptr) 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, diff --git a/cpu/xscale/start.S b/cpu/xscale/start.S index 8700d1a..f0b6120 100644 --- a/cpu/xscale/start.S +++ b/cpu/xscale/start.S @@ -130,7 +130,7 @@ relocate: /* relocate ppcboot to RAM */ 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 */ diff --git a/include/cmd_confdefs.h b/include/cmd_confdefs.h index 1eb6918..52d3b60 100644 --- a/include/cmd_confdefs.h +++ b/include/cmd_confdefs.h @@ -109,7 +109,8 @@ CFG_CMD_SAVES | \ CFG_CMD_SCSI | \ CFG_CMD_SDRAM | \ - CFG_CMD_USB ) + CFG_CMD_USB | \ + CFG_CMD_VFD ) /* Default configuration */ diff --git a/include/configs/LANTEC.h b/include/configs/LANTEC.h index 9728f8d..015e621 100644 --- a/include/configs/LANTEC.h +++ b/include/configs/LANTEC.h @@ -100,7 +100,8 @@ & ~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 */ diff --git a/include/configs/MPC8260ADS.h b/include/configs/MPC8260ADS.h index d6e8144..67e8eed 100644 --- a/include/configs/MPC8260ADS.h +++ b/include/configs/MPC8260ADS.h @@ -120,6 +120,7 @@ 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) */ diff --git a/include/configs/ep8260.h b/include/configs/ep8260.h index 189ee9d..2288b6a 100644 --- a/include/configs/ep8260.h +++ b/include/configs/ep8260.h @@ -285,6 +285,7 @@ ~CFG_CMD_PCMCIA & \ ~CFG_CMD_SCSI & \ ~CFG_CMD_USB & \ + ~CFG_CMD_VFD & \ ~CFG_CMD_DTT ) /* Where do the internal registers live? */ diff --git a/include/configs/hymod.h b/include/configs/hymod.h index eecb429..eeae055 100644 --- a/include/configs/hymod.h +++ b/include/configs/hymod.h @@ -149,6 +149,7 @@ 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) */ diff --git a/include/configs/lwmon.h b/include/configs/lwmon.h index 1fa6372..8ae71b7 100644 --- a/include/configs/lwmon.h +++ b/include/configs/lwmon.h @@ -49,11 +49,7 @@ #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 */ @@ -74,21 +70,17 @@ 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" \ @@ -96,16 +88,17 @@ "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 */ diff --git a/include/configs/trab.h b/include/configs/trab.h index 8734c80..3e32314 100644 --- a/include/configs/trab.h +++ b/include/configs/trab.h @@ -114,9 +114,6 @@ 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 @@ -145,7 +142,10 @@ "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 */ diff --git a/include/net.h b/include/net.h index 9f98cec..d4985ca 100644 --- a/include/net.h +++ b/include/net.h @@ -73,7 +73,7 @@ struct eth_device { 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 @@ -262,6 +262,9 @@ extern int NetState; /* Network loop state */ #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; diff --git a/include/version.h b/include/version.h index 40ea9b1..d3e1c80 100644 --- a/include/version.h +++ b/include/version.h @@ -24,6 +24,6 @@ #ifndef __VERSION_H__ #define __VERSION_H__ -#define PPCBOOT_VERSION "PPCBoot 1.2.2" +#define PPCBOOT_VERSION "PPCBoot 2.0.0" #endif /* __VERSION_H__ */ diff --git a/lib_arm/armlinux.c b/lib_arm/armlinux.c index 1db5354..a96fc41 100644 --- a/lib_arm/armlinux.c +++ b/lib_arm/armlinux.c @@ -159,10 +159,6 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], 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; diff --git a/lib_arm/board.c b/lib_arm/board.c index 62981fe..916817b 100644 --- a/lib_arm/board.c +++ b/lib_arm/board.c @@ -295,7 +295,6 @@ int mdm_init (void) 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() */ @@ -329,10 +328,10 @@ int mdm_init (void) } 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 @@ -380,10 +379,4 @@ static inline void mdm_readline(char *buf, int bufsiz) } } } - -static void delay(void) -{ - int i = 50000; - while(i--); -} #endif /* CONFIG_MODEM_SUPPORT */ diff --git a/net/eth.c b/net/eth.c index 885c1eb..0ab467c 100644 --- a/net/eth.c +++ b/net/eth.c @@ -229,6 +229,7 @@ int eth_init(bd_t *bis) if (eth_current->init(eth_current, bis)) { eth_current->state = ETH_STATE_ACTIVE; + printf("%s configured\n", eth_current->name); return 1; } @@ -236,7 +237,7 @@ int eth_init(bd_t *bis) puts ("FAIL\n"); #endif - eth_try_another(); + eth_try_another(0); } while (old_current != eth_current); return 0; @@ -268,12 +269,24 @@ int eth_rx(void) 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 diff --git a/net/net.c b/net/net.c index 28af64c..cc3bec6 100644 --- a/net/net.c +++ b/net/net.c @@ -97,6 +97,11 @@ unsigned NetIPID; /* IP packet ID */ 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 */ @@ -123,6 +128,11 @@ NetLoop(proto_t protocol) bd_t *bd = gd->bd; +#ifdef CONFIG_NET_MULTI + NetRestarted = 0; + NetDevExists = 0; +#endif + if (!NetTxPacket) { int i; @@ -154,56 +164,74 @@ restart: * 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 @@ -250,9 +278,7 @@ restart: case NETLOOP_RESTART: #ifdef CONFIG_NET_MULTI - eth_halt(); - eth_try_another(); - eth_init(bd); + NetRestarted = 1; #endif goto restart; @@ -276,7 +302,6 @@ restart: /**********************************************************************/ -#ifndef CONFIG_NET_MULTI static void startAgainTimeout(void) { @@ -288,8 +313,6 @@ startAgainHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) { /* Totally ignore the packet */ } -#endif - void NetStartAgain(void) @@ -298,7 +321,28 @@ 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 } @@ -564,7 +608,7 @@ static int net_check_prereq (proto_t protocol) switch (num) { case -1: puts ("*** ERROR: No ethernet found.\n"); - break; + return (1); case 0: puts ("*** ERROR: `ethaddr' not set\n"); break; @@ -573,10 +617,13 @@ static int net_check_prereq (proto_t protocol) num); break; } + + NetStartAgain (); + return (2); #else puts ("*** ERROR: `ethaddr' not set\n"); -#endif return (1); +#endif } /* Fall through */ }