From: wdenk Date: Sun, 15 Apr 2001 20:36:31 +0000 (+0000) Subject: * Added optional random BOOTP delay X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ab3858bfebf558a2f040ff3d43e07f074bf602d4;p=users%2Frw%2Fppcboot.git * Added optional random BOOTP delay (Patch by Hannes Fertala, 13 Apr 2001) * Update for ETX094 board: add hardware ID detection; misc. config changes (Patch by Hannes Fertala, 13 Apr 2001) * Added support for date/time (print image timestamps; read/write Real-Time Clock); supported RTC's: MPC8xx internal, Philips PCF8563 --- diff --git a/CHANGELOG b/CHANGELOG index cbacdc0..a928090 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -28,14 +28,6 @@ Open Issues: Printing error messages does not work because "cu" is eating all output. -* iminfo: - - Print timestamp information, too. - -* NEW: - - Set system clock. - * saveenv: Can we create a ld script which automagically takes care about @@ -61,6 +53,16 @@ To do: Modifications for 0.9.0: ====================================================================== +* Added optional random BOOTP delay + (Patch by Hannes Fertala, 13 Apr 2001) + +* Update for ETX094 board: add hardware ID detection; misc. config + changes + (Patch by Hannes Fertala, 13 Apr 2001) + +* Added support for date/time (print image timestamps; read/write + Real-Time Clock); supported RTC's: MPC8xx internal, Philips PCF8563 + * Added generic interface for board dependend spacial command extensions. diff --git a/README b/README index 001c640..afd5e26 100644 --- a/README +++ b/README @@ -281,7 +281,10 @@ The following options need to be configured: CFG_CMD_ECHO * echo arguments CFG_CMD_I2C * I2C serial bus support CFG_CMD_REGINFO * Register dump - ------------------------- + CFG_CMD_IMMAP * IMMR dump support + CFG_CMD_DATE * support for RTC, date/time... + CFG_CMD_BSP * Board SPecific functions + ----------------------------------------------- CFG_CMD_ALL all CFG_CMD_DFL Default configuration; at the moment @@ -307,6 +310,15 @@ The following options need to be configured: SIU Watchdog feature is enabled in the SYPCR register. +- Real-Time Clock: + + When CFG_CMD_DATE is selected, the type of the RTC + has to be selected, too. Define exactly one of the + following options: + + CONFIG_RTC_MPC8xx - use internal RTC of MPC8xx + CONFIG_RTC_PCF8563 - use Philips PCF8563 RTC + - Partition Support: CONFIG_MAC_PARTITION and/or CONFIG_DOS_PARTITION @@ -314,6 +326,25 @@ The following options need to be configured: must configure support for at least one partition type as well. +- BOOTP Recovery Mode: + CONFIG_BOOTP_RANDOM_DELAY + + If you have many targets in a network that try to + boot using BOOTP, you may want to avoid that all + systems send out BOOTP requests at precisely the same + moment (which would happen for instance at recovery + from a power failure, when all systems will try to + boot, thus flooding the BOOTP server. Defining + CONFIG_BOOTP_RANDOM_DELAY causes a random delay to be + inserted before sending out BOOTP requests. The + following delays are insterted then: + + 1st BOOTP request: delay 0 ... 1 sec + 2nd BOOTP request: delay 0 ... 2 sec + 3rd BOOTP request: delay 0 ... 4 sec + 4th and following + BOOTP requests: delay 0 ... 8 sec + Configuration Settings: ----------------------- diff --git a/board/etx094/etx094.c b/board/etx094/etx094.c index ecbbe56..01c02c5 100644 --- a/board/etx094/etx094.c +++ b/board/etx094/etx094.c @@ -27,6 +27,7 @@ /* ------------------------------------------------------------------------- */ static long int dram_size (long int, long int *, long int); +static void read_hw_vers (void); /* ------------------------------------------------------------------------- */ @@ -95,6 +96,7 @@ int checkboard (void) if (!s || strncmp(s, "ETX_", 4)) { printf ("### No HW ID - assuming ETX_094\n"); + read_hw_vers (); return (1); } @@ -108,6 +110,8 @@ int checkboard (void) } putc ('\n'); + read_hw_vers (); + return (1); } @@ -129,6 +133,10 @@ long int initdram (int board_type) */ memctl->memc_mptpr = CFG_MPTPR_1BK_4K; + /* A3(SDRAM)=0 => Bursttype = Sequential + * A2-A0(SDRAM)=010 => Burst length = 4 + * A4-A6(SDRAM)=010 => CasLat=2 + */ memctl->memc_mar = 0x00000088; /* @@ -150,14 +158,13 @@ long int initdram (int board_type) /* perform SDRAM initializsation sequence */ - memctl->memc_mcr = 0x80004128; /* Init Part 1*/ - memctl->memc_mcr = 0x80004734; /* Init Part 2*/ + memctl->memc_mcr = 0x80004128; /* SDRAM bank 0 - Init Part 1 */ + memctl->memc_mcr = 0x80004734; /* SDRAM bank 0 - Init Part 2 */ udelay(1); if (board_type == 0) { /* "L" type boards have only one bank SDRAM */ - memctl->memc_mcr = 0x80006105; /* SDRAM bank 1 */ - udelay(1); - memctl->memc_mcr = 0x80006230; /* SDRAM bank 1 - execute twice */ + memctl->memc_mcr = 0x80006128; /* SDRAM bank 1 - Init Part 1 */ + memctl->memc_mcr = 0x80006734; /* SDRAM bank 1 - Init Part 2 */ udelay(1); } @@ -323,3 +330,62 @@ static long int dram_size (long int mamr_value, long int *base, long int maxsize } /* NOTREACHED */ } + +/* ------------------------------------------------------------------------- */ + +/* HW-ID Table (Bits: 2^9;2^7;2^5) */ +#define HW_ID_0 0x0000 +#define HW_ID_1 0x0020 +#define HW_ID_2 0x0080 +#define HW_ID_3 0x00a0 +#define HW_ID_4 0x0200 +#define HW_ID_5 0x0220 +#define HW_ID_6 0x0280 +#define HW_ID_7 0x02a0 + +void read_hw_vers () +{ + unsigned short rd_msk = 0x02A0; + + /* HW-ID pin-definition */ + volatile immap_t *immr = (immap_t *) CFG_IMMR; + + immr->im_ioport.iop_pddir &= ~(rd_msk); + immr->im_ioport.iop_pdpar &= ~(rd_msk); + + /* debug printf(" State of PD: %x\n",immr->im_ioport.iop_pddat); */ + + /* Check the HW-ID */ + printf (" HW-Version: "); + switch (immr->im_ioport.iop_pddat & rd_msk) { + case HW_ID_0: + printf ("V0.1 - V0.3 / W97238-Q3162-A1-1-2\n"); + break; + case HW_ID_1: + printf ("V0.9 / W50037-Q1-D6-1\n"); + break; + case HW_ID_2: + printf ("NOT USED - assuming ID#2\n"); + break; + case HW_ID_3: + printf ("NOT USED - assuming ID#3\n"); + break; + case HW_ID_4: + printf ("NOT USED - assuming ID#4\n"); + break; + case HW_ID_5: + printf ("NOT USED - assuming ID#5\n"); + break; + case HW_ID_6: + printf ("NOT USED - assuming ID#6\n"); + break; + case HW_ID_7: + printf ("NOT USED - assuming ID#7\n"); + break; + default: + printf ("###Error###\n"); + break; + } +} + +/* ------------------------------------------------------------------------- */ diff --git a/board/lwmon/lwmon.c b/board/lwmon/lwmon.c index 21d7f03..d4b556f 100644 --- a/board/lwmon/lwmon.c +++ b/board/lwmon/lwmon.c @@ -27,6 +27,7 @@ #include #include #include +#include /* ------------------------------------------------------------------------- */ @@ -268,6 +269,7 @@ printf ("New PIC read: reg_61 = 0x%02x\n", c); /*----------------------------------------------------------------------- * Board Special Commands: PIC read/write */ +#if (CONFIG_COMMANDS & CFG_CMD_BSP) void do_pic (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) { @@ -302,6 +304,7 @@ void do_pic (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) printf ("Usage:\n%s\n", cmdtp->usage); } +#endif /* CFG_CMD_BSP */ /*----------------------------------------------------------------------- * Test: Enable Ethernet diff --git a/board/mbx8xx/mbx8xx.c b/board/mbx8xx/mbx8xx.c index 23c9770..46ea716 100644 --- a/board/mbx8xx/mbx8xx.c +++ b/board/mbx8xx/mbx8xx.c @@ -165,6 +165,7 @@ void mbx_init(void) #if 0 /* XXX - Just what was this for??? email etheisen@mindspring.com */ plprcr |= ((speed + refclock / 2) / refclock - 1) << 20; #endif + immr->im_clkrstk.cark_plprcrk = KAPWR_KEY; immr->im_clkrst.car_plprcr = plprcr; /* diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index d86c739..bba95e8 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -30,6 +30,9 @@ #include #include #include +#if (CONFIG_COMMANDS & CFG_CMD_DATE) +#include +#endif int gunzip (void *, int, unsigned char *, int *); @@ -483,10 +486,18 @@ static void image_info (ulong addr) void print_image_hdr (image_header_t *hdr) { -/* time_t timestamp = (time_t)hdr->ih_time; */ +#if (CONFIG_COMMANDS & CFG_CMD_DATE) + time_t timestamp = (time_t)hdr->ih_time; + struct rtc_time tm; +#endif printf (" Image Name: %.*s\n", IH_NMLEN, hdr->ih_name); -/* printf (" Created: %s", ctime(×tamp)); */ +#if (CONFIG_COMMANDS & CFG_CMD_DATE) + to_tm (timestamp, &tm); + printf (" Created: %4d-%02d-%02d %2d:%02d:%02d\n", + tm.tm_year, tm.tm_mon, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec); +#endif /* CFG_CMD_DATE */ printf (" Image Type: "); print_type(hdr); printf ("\n"); printf (" Data Size: %d Bytes = %d kB = %d MB\n", hdr->ih_size, hdr->ih_size>>10, hdr->ih_size>>20); diff --git a/include/config_CANBT.h b/include/config_CANBT.h index c515c9a..fbd26df 100644 --- a/include/config_CANBT.h +++ b/include/config_CANBT.h @@ -65,7 +65,7 @@ #define CONFIG_PHY_ADDR 0 /* PHY address */ -#define CONFIG_COMMANDS ((CONFIG_CMD_DFL | CFG_CMD_IRQ | CFG_CMD_ASKENV) +#define CONFIG_COMMANDS ((CONFIG_CMD_DFL | CFG_CMD_IRQ | CFG_CMD_ASKENV) \ & ~CFG_CMD_NET) /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ diff --git a/include/config_ETX094.h b/include/config_ETX094.h index e774452..8337a9b 100644 --- a/include/config_ETX094.h +++ b/include/config_ETX094.h @@ -46,6 +46,9 @@ #define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */ #endif +#undef CONFIG_FLASH_16BIT +#undef CONFIG_BOOTP_RANDOM_DELAY + #undef CONFIG_BOOTARGS #define CONFIG_RAMBOOTCOMMAND \ "bootp; " \ @@ -123,7 +126,7 @@ #ifdef DEBUG #define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ #else -#define CFG_MONITOR_LEN (128 << 10) /* Reserve 128 kB for Monitor */ +#define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ #endif #define CFG_MONITOR_BASE CFG_FLASH_BASE #define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */ @@ -252,17 +255,23 @@ #define CFG_REMAP_OR_AM 0x80000000 /* OR addr mask */ #define CFG_PRELIM_OR_AM 0xE0000000 /* OR addr mask */ -/* FLASH timing: ACS = 11, TRLX = 0, CSNT = 1, SCY = 5, EHTR = 1 */ +/* FLASH timing: ACS = 11, TRLX = 1, CSNT = 0, SCY = 2, EHTR = 0 */ #define CFG_OR_TIMING_FLASH (OR_ACS_DIV2 | OR_BI | \ OR_SCY_2_CLK | OR_TRLX ) #define CFG_OR0_REMAP (CFG_REMAP_OR_AM | CFG_OR_TIMING_FLASH) #define CFG_OR0_PRELIM (CFG_PRELIM_OR_AM | CFG_OR_TIMING_FLASH) -#define CFG_BR0_PRELIM ((FLASH_BASE0_PRELIM & BR_BA_MSK) | BR_V ) + +#ifdef CONFIG_FLASH_16BIT /* 16 bit data port */ +#define CFG_BR0_PRELIM ((FLASH_BASE0_PRELIM & BR_BA_MSK) | BR_V | BR_PS_16) +#define CFG_BR1_PRELIM ((FLASH_BASE1_PRELIM & BR_BA_MSK) | BR_V | BR_PS_16) +#else /* 32 bit data port */ +#define CFG_BR0_PRELIM ((FLASH_BASE0_PRELIM & BR_BA_MSK) | BR_V | BR_PS_32) +#define CFG_BR1_PRELIM ((FLASH_BASE1_PRELIM & BR_BA_MSK) | BR_V | BR_PS_32) +#endif /* CONFIG_FLASH_16BIT */ #define CFG_OR1_REMAP CFG_OR0_REMAP #define CFG_OR1_PRELIM CFG_OR0_PRELIM -#define CFG_BR1_PRELIM ((FLASH_BASE1_PRELIM & BR_BA_MSK) | BR_V ) /* * BR2/3 and OR2/3 (SDRAM) @@ -303,11 +312,11 @@ /* 8 column SDRAM */ #define CFG_MAMR_8COL ((CFG_MAMR_PTA << MAMR_PTA_SHIFT) | MAMR_PTAE | \ MAMR_AMA_TYPE_0 | MAMR_DSA_1_CYCL | MAMR_G0CLA_A11 | \ - MAMR_RLFA_1X | MAMR_WLFA_1X | MAMR_TLFA_4X) + MAMR_RLFA_1X | MAMR_WLFA_1X | MAMR_TLFA_1X) /* 9 column SDRAM */ #define CFG_MAMR_9COL ((CFG_MAMR_PTA << MAMR_PTA_SHIFT) | MAMR_PTAE | \ MAMR_AMA_TYPE_1 | MAMR_DSA_1_CYCL | MAMR_G0CLA_A10 | \ - MAMR_RLFA_1X | MAMR_WLFA_1X | MAMR_TLFA_4X) + MAMR_RLFA_1X | MAMR_WLFA_1X | MAMR_TLFA_1X) /* diff --git a/include/config_TQM823L.h b/include/config_TQM823L.h index 2e13f2f..19881e0 100644 --- a/include/config_TQM823L.h +++ b/include/config_TQM823L.h @@ -60,8 +60,17 @@ #undef CONFIG_WATCHDOG /* watchdog disabled */ +#define CONFIG_STATUS_LED 1 /* Status LED enabled */ + #define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | CONFIG_BOOTP_BOOTFILESIZE) +#define CONFIG_MAC_PARTITION +#define CONFIG_DOS_PARTITION + +#define CONFIG_RTC_MPC8xx /* use internal RTC of MPC8xx */ + +#define CONFIG_COMMANDS (CONFIG_CMD_DFL | CFG_CMD_IDE | CFG_CMD_DATE) + /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ #include @@ -114,10 +123,10 @@ */ #define CFG_SDRAM_BASE 0x00000000 #define CFG_FLASH_BASE 0x40000000 -#if defined(DEBUG) || (CONFIG_COMMANDS & CFG_CMD_IDE) +#if defined(DEBUG) #define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ #else -#define CFG_MONITOR_LEN (128 << 10) /* Reserve 128 kB for Monitor */ +#define CFG_MONITOR_LEN (192 << 10) /* Reserve 192 kB for Monitor */ #endif #define CFG_MONITOR_BASE CFG_FLASH_BASE #define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */ diff --git a/include/config_TQM850L.h b/include/config_TQM850L.h index a534bcc..4cb4905 100644 --- a/include/config_TQM850L.h +++ b/include/config_TQM850L.h @@ -60,11 +60,16 @@ #undef CONFIG_WATCHDOG /* watchdog disabled */ -//#define CONFIG_STATUS_LED 1 /* Status LED enabled */ +#define CONFIG_STATUS_LED 1 /* Status LED enabled */ #define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | CONFIG_BOOTP_BOOTFILESIZE) -#define CONFIG_COMMANDS (CONFIG_CMD_DFL & ~CFG_CMD_CACHE) +#define CONFIG_MAC_PARTITION +#define CONFIG_DOS_PARTITION + +#define CONFIG_RTC_MPC8xx /* use internal RTC of MPC8xx */ + +#define CONFIG_COMMANDS (CONFIG_CMD_DFL | CFG_CMD_IDE | CFG_CMD_DATE) /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ #include @@ -118,10 +123,10 @@ */ #define CFG_SDRAM_BASE 0x00000000 #define CFG_FLASH_BASE 0x40000000 -#if defined(DEBUG) || (CONFIG_COMMANDS & CFG_CMD_IDE) +#if defined(DEBUG) #define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ #else -#define CFG_MONITOR_LEN (128 << 10) /* Reserve 128 kB for Monitor */ +#define CFG_MONITOR_LEN (192 << 10) /* Reserve 192 kB for Monitor */ #endif #define CFG_MONITOR_BASE CFG_FLASH_BASE #define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */ @@ -242,6 +247,34 @@ #define CFG_PCMCIA_IO_ADDR (0xEC000000) #define CFG_PCMCIA_IO_SIZE ( 64 << 20 ) +/*----------------------------------------------------------------------- + * IDE/ATA stuff (Supports IDE harddisk on PCMCIA Adapter) + *----------------------------------------------------------------------- + */ + +#define CONFIG_IDE_PCCARD 1 /* Use IDE with PC Card Adapter */ + +#undef CONFIG_IDE_PCMCIA /* Direct IDE not supported */ +#undef CONFIG_IDE_LED /* LED for ide not supported */ +#undef CONFIG_IDE_RESET /* reset for ide not supported */ + +#define CFG_IDE_MAXBUS 1 /* max. 1 IDE bus */ +#define CFG_IDE_MAXDEVICE 1 /* max. 1 drive per IDE bus */ + +#define CFG_ATA_IDE0_OFFSET 0x0000 + +#define CFG_ATA_BASE_ADDR CFG_PCMCIA_MEM_ADDR + +/* Offset for data I/O */ +#define CFG_ATA_DATA_OFFSET (CFG_PCMCIA_MEM_SIZE + 0x320) + +/* Offset for normal register accesses */ +#define CFG_ATA_REG_OFFSET (2 * CFG_PCMCIA_MEM_SIZE + 0x320) + +/* Offset for alternate registers */ +#define CFG_ATA_ALT_OFFSET 0x0100 + + /*----------------------------------------------------------------------- * *----------------------------------------------------------------------- diff --git a/include/config_TQM855L.h b/include/config_TQM855L.h index 32b5f0a..d16ea84 100644 --- a/include/config_TQM855L.h +++ b/include/config_TQM855L.h @@ -60,8 +60,17 @@ #undef CONFIG_WATCHDOG /* watchdog disabled */ +#define CONFIG_STATUS_LED 1 /* Status LED enabled */ + #define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | CONFIG_BOOTP_BOOTFILESIZE) +#define CONFIG_MAC_PARTITION +#define CONFIG_DOS_PARTITION + +#define CONFIG_RTC_MPC8xx /* use internal RTC of MPC8xx */ + +#define CONFIG_COMMANDS (CONFIG_CMD_DFL | CFG_CMD_IDE | CFG_CMD_DATE) + /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ #include @@ -114,10 +123,10 @@ */ #define CFG_SDRAM_BASE 0x00000000 #define CFG_FLASH_BASE 0x40000000 -#if defined(DEBUG) || (CONFIG_COMMANDS & CFG_CMD_IDE) +#if defined(DEBUG) #define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ #else -#define CFG_MONITOR_LEN (128 << 10) /* Reserve 128 kB for Monitor */ +#define CFG_MONITOR_LEN (192 << 10) /* Reserve 192 kB for Monitor */ #endif #define CFG_MONITOR_BASE CFG_FLASH_BASE #define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */ @@ -238,6 +247,34 @@ #define CFG_PCMCIA_IO_ADDR (0xEC000000) #define CFG_PCMCIA_IO_SIZE ( 64 << 20 ) +/*----------------------------------------------------------------------- + * IDE/ATA stuff (Supports IDE harddisk on PCMCIA Adapter) + *----------------------------------------------------------------------- + */ + +#define CONFIG_IDE_PCCARD 1 /* Use IDE with PC Card Adapter */ + +#undef CONFIG_IDE_PCMCIA /* Direct IDE not supported */ +#undef CONFIG_IDE_LED /* LED for ide not supported */ +#undef CONFIG_IDE_RESET /* reset for ide not supported */ + +#define CFG_IDE_MAXBUS 1 /* max. 1 IDE bus */ +#define CFG_IDE_MAXDEVICE 1 /* max. 1 drive per IDE bus */ + +#define CFG_ATA_IDE0_OFFSET 0x0000 + +#define CFG_ATA_BASE_ADDR CFG_PCMCIA_MEM_ADDR + +/* Offset for data I/O */ +#define CFG_ATA_DATA_OFFSET (CFG_PCMCIA_MEM_SIZE + 0x320) + +/* Offset for normal register accesses */ +#define CFG_ATA_REG_OFFSET (2 * CFG_PCMCIA_MEM_SIZE + 0x320) + +/* Offset for alternate registers */ +#define CFG_ATA_ALT_OFFSET 0x0100 + + /*----------------------------------------------------------------------- * *----------------------------------------------------------------------- diff --git a/include/config_TQM860L.h b/include/config_TQM860L.h index 0ea13ff..333709f 100644 --- a/include/config_TQM860L.h +++ b/include/config_TQM860L.h @@ -60,9 +60,16 @@ #undef CONFIG_WATCHDOG /* watchdog disabled */ +#define CONFIG_STATUS_LED 1 /* Status LED enabled */ + #define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | CONFIG_BOOTP_BOOTFILESIZE) -#define CONFIG_COMMANDS (CONFIG_CMD_DFL & ~CFG_CMD_CACHE) +#define CONFIG_MAC_PARTITION +#define CONFIG_DOS_PARTITION + +#define CONFIG_RTC_MPC8xx /* use internal RTC of MPC8xx */ + +#define CONFIG_COMMANDS (CONFIG_CMD_DFL | CFG_CMD_IDE | CFG_CMD_DATE) /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ #include @@ -116,10 +123,10 @@ */ #define CFG_SDRAM_BASE 0x00000000 #define CFG_FLASH_BASE 0x40000000 -#if defined(DEBUG) || (CONFIG_COMMANDS & CFG_CMD_IDE) +#if defined(DEBUG) #define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ #else -#define CFG_MONITOR_LEN (128 << 10) /* Reserve 128 kB for Monitor */ +#define CFG_MONITOR_LEN (192 << 10) /* Reserve 192 kB for Monitor */ #endif #define CFG_MONITOR_BASE CFG_FLASH_BASE #define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */ diff --git a/include/config_lwmon.h b/include/config_lwmon.h index f7ddff4..cf9cd28 100644 --- a/include/config_lwmon.h +++ b/include/config_lwmon.h @@ -66,6 +66,8 @@ /* page write mode using last */ /* 4 bits of the address */ +#define CONFIG_RTC_PCF8563 /* use Philips PCF8563 RTC */ + #ifdef CONFIG_8xx_CONS_SCC2 /* Can't use ethernet, then */ #define CONFIG_COMMANDS ((CONFIG_CMD_DFL & ~CFG_CMD_NET) | \ CFG_CMD_EEPROM | \ @@ -247,7 +249,7 @@ ( (CFG_PLPRCR_MF << PLPRCR_MF_SHIFT) | \ PLPRCR_SPLSS | PLPRCR_TEXPS | PLPRCR_TMIST | \ /*PLPRCR_CSRC|*/ PLPRCR_LPM_NORMAL | \ - PLPRCR_CSR | PLPRCR_LOLRE /*|PLPRCR_FIOPD*/ \ + PLPRCR_CSR /*| PLPRCR_LOLRE|PLPRCR_FIOPD*/ \ ) #define CONFIG_8xx_GCLK_FREQ ((CFG_PLPRCR_MF+1)*13200000) diff --git a/net/bootp.c b/net/bootp.c index cb96386..32ed8d6 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -30,6 +30,9 @@ ulong BootpID; int BootpTry; +#ifdef CONFIG_BOOTP_RANDOM_DELAY +ulong seed1, seed2; +#endif static int BootpExtended (u8 *e); @@ -55,7 +58,7 @@ static void BootpVendorFieldProcess(u8 *ext) case 3: /* Gateways list */ if (NetOurGatewayIP == 0) { memcpy(&NetOurGatewayIP, ext+2, 4); - } + } break; case 4: /* Time server - Not yet supported */ break; @@ -146,25 +149,25 @@ static void BootpVendorProcess(u8 *ext, int size) print_IPaddr (NetOurSubnetMask); putc('\n'); } - + if (NetOurGatewaysIP[0]) { puts ("NetOurGatewaysIP : "); print_IPaddr (NetOurGatewaysIP[0]); putc('\n'); } - + if (NetBootFileSize) { printf("NetBootFileSize : %d\n", NetBootFileSize); } - + if (NetOurHostName[0]) { printf("NetOurHostName : %s\n", NetOurHostName); } - + if (NetOurRootPath[0]) { printf("NetOurRootPath : %s\n", NetOurRootPath); } - + if (NetOurNISDomain[0]) { printf("NetOurNISDomain : %s\n", NetOurNISDomain); } @@ -217,7 +220,7 @@ BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) /* Retrieve extended informations (we must parse the vendor area) */ if ((*(uint *)bp->bp_vend) == BOOTP_VENDOR_MAGIC) BootpVendorProcess(&bp->bp_vend[4], len); - + NetSetTimeout(0, (thand_f *)0); #ifdef DEBUG @@ -257,7 +260,7 @@ BootpTimeout(void) static int BootpExtended (u8 *e) { u8 *start = e ; - + *e++ = 99; /* RFC1048 Magic Cookie */ *e++ = 130; *e++ = 83; @@ -306,7 +309,7 @@ static int BootpExtended (u8 *e) #endif *e++ = 255; /* End of the list */ - + return e - start ; } @@ -317,6 +320,79 @@ BootpRequest (void) Bootp_t *bp; int ext_len; +#ifdef CONFIG_BOOTP_RANDOM_DELAY /* Random BOOTP delay */ + bd_t *bis; + int reg; + char *e,*s; + uchar tmp[64]; + ulong tst1, tst2, m_value, m_mask, sum; + + if (BootpTry ==0) { + /* get our mac */ + reg = getenv_r ("ethaddr", tmp, sizeof(tmp)); + s = (reg > 0) ? tmp : NULL; + + for (reg=0; reg<6; ++reg) { + bis->bi_enetaddr[reg] = s ? simple_strtoul(s, &e, 16) : 0; + if (s) { + s = (*e) ? e+1 : e; + } + } +#ifdef DEBUG + printf("BootpRequest => Our Mac: "); + for (reg=0; reg<6; reg++) { + printf ("%x%c", + bis->bi_enetaddr[reg], + reg==5 ? '\n' : ':'); + } +#endif /* DEBUG */ + + /* Mac-Manipulation 2 get seed1 */ + tst1=0; + tst2=0; + for (reg=2; reg<6; reg++) { + tst1 = tst1 << 8; + tst1 = tst1 | bis->bi_enetaddr[reg]; + } + for (reg=0; reg<2; reg++) { + tst2 = tst2 | bis->bi_enetaddr[reg]; + tst2 = tst2 << 8; + } + + seed1 = tst1^tst2; + + /* Mirror seed1*/ + m_mask=0x1; + for (reg=1;reg<=32;reg++) { + m_value |= (m_mask & seed1); + seed1 = seed1 >> 1; + m_value = m_value << 1; + } + seed1 = m_value; + seed2 = 0xB78D0945; + } + + /* Random Number Generator */ + + for (reg=0;reg<=0;reg++) { + sum = seed1 + seed2; + if (sum < seed1 || sum < seed2) + sum++; + seed2 = seed1; + seed1 = sum; + + if (BootpTry<=2) { /* Start with max 1024 * 1ms */ + sum = sum >> (22-BootpTry); + } else { /*After 3rd BOOTP request max 8192 * 1ms */ + sum = sum >> 19; + } + + printf ("Random delay: %d ms...\n", sum); + for (reg=0; reg +#include +#include + +#if defined(CONFIG_RTC_MPC8xx) && (CONFIG_COMMANDS & CFG_CMD_DATE) + +/* ------------------------------------------------------------------------- */ + +void rtc_get (struct rtc_time *tmp) +{ + volatile immap_t *immr = (immap_t *)CFG_IMMR; + ulong tim; + + tim = immr->im_sit.sit_rtc; + + to_tm (tim, tmp); + + debug ( "Get DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n", + tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); +} + +void rtc_set (struct rtc_time *tmp) +{ + volatile immap_t *immr = (immap_t *)CFG_IMMR; + ulong tim; + + debug ( "Set DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n", + tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + + tim = mktime (tmp->tm_year, tmp->tm_mon, tmp->tm_mday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + + immr->im_sitk.sitk_rtck = KAPWR_KEY; + immr->im_sit.sit_rtc = tim; +} + +void rtc_reset (void) +{ + return; /* nothing to do */ +} + +/* ------------------------------------------------------------------------- */ + +#endif /* CONFIG_RTC_MPC8xx && CFG_CMD_DATE */ diff --git a/rtc/pcf8563.c b/rtc/pcf8563.c index b44f794..9a5c4f6 100644 --- a/rtc/pcf8563.c +++ b/rtc/pcf8563.c @@ -32,7 +32,7 @@ #include #include -#if (CONFIG_COMMANDS & CFG_CMD_DATE) +#if defined(CONFIG_RTC_PCF8563) && (CONFIG_COMMANDS & CFG_CMD_DATE) static uchar rtc_read (uchar reg); static void rtc_write (uchar reg, uchar val); @@ -141,4 +141,4 @@ static unsigned char bin2bcd (unsigned int n) return (((n / 10) << 4) | (n % 10)); } -#endif /* CFG_CMD_DATE */ +#endif /* CONFIG_RTC_PCF8563 && CFG_CMD_DATE */