]> www.infradead.org Git - users/rw/ppcboot.git/commitdiff
* Added optional random BOOTP delay
authorwdenk <wdenk>
Sun, 15 Apr 2001 20:36:31 +0000 (20:36 +0000)
committerwdenk <wdenk>
Sun, 15 Apr 2001 20:36:31 +0000 (20:36 +0000)
  (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

18 files changed:
CHANGELOG
README
board/etx094/etx094.c
board/lwmon/lwmon.c
board/mbx8xx/mbx8xx.c
common/cmd_bootm.c
include/config_CANBT.h
include/config_ETX094.h
include/config_TQM823L.h
include/config_TQM850L.h
include/config_TQM855L.h
include/config_TQM860L.h
include/config_lwmon.h
net/bootp.c
net/bootp.h
rtc/Makefile
rtc/mpc8xx.c [new file with mode: 0644]
rtc/pcf8563.c

index cbacdc0fb6b9237f631420698459b5afd7c6975e..a928090efa5989ca02cab36af49b06c53152dc64 100644 (file)
--- 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 001c640aeb1ddbdad021cb685327363532e7f514..afd5e26223bbd74506ac2313da1295cb31fe4484 100644 (file)
--- 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:
 -----------------------
index ecbbe56c88b5ca583ee0c342ec4c313d76113f69..01c02c5ec2fb7a7283d5a2753e86290ed3477099 100644 (file)
@@ -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;
+       }
+}
+
+/* ------------------------------------------------------------------------- */
index 21d7f038aa46a3b27b777938d99287872f0e5671..d4b556f95020f96bff3705cb684ded404fb7b3d5 100644 (file)
@@ -27,6 +27,7 @@
 #include <commproc.h>
 #include <i2c.h>
 #include <command.h>
+#include <cmd_bsp.h>
 
 /* ------------------------------------------------------------------------- */
 
@@ -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
index 23c97701ad89a4a3b56189d376c1a4522b69ad00..46ea716acce1243b641e6afb34b38d62f27cf3e0 100644 (file)
@@ -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;
 
     /* 
index d86c73972800bb254a4c1c710fde05b504555424..bba95e837fe96cdeb3ff017a3434391cb5f6aaa5 100644 (file)
@@ -30,6 +30,9 @@
 #include <image.h>
 #include <malloc.h>
 #include <zlib.h>
+#if (CONFIG_COMMANDS & CFG_CMD_DATE)
+#include <rtc.h>
+#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(&timestamp)); */
+#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);
index c515c9a0906df9fb31d0708838cb334d2c6eca54..fbd26df7f1473bdc9eadd9efac700f106efeb6f8 100644 (file)
@@ -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) */
index e774452cd3e7185a0ce22fba79d3b1f7602ca2db..8337a9bf87b95807f880aa90383f70c663c63675 100644 (file)
@@ -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; "                                                               \
 #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()  */
 #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)
 /* 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)
 
 
 /*
index 2e13f2f76a09d01e1ae2d059c062e434b3497bec..19881e087bdb1d1cffa66d881e0c638f2573d0a7 100644 (file)
 
 #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 <cmd_confdefs.h>
 
  */
 #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()  */
index a534bcca5938b54f60d6da33c43843af8b94ba00..4cb490514a1d5185add1af877bab8429df9b2995 100644 (file)
 
 #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 <cmd_confdefs.h>
  */
 #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()  */
 #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
+
+
 /*-----------------------------------------------------------------------
  * 
  *-----------------------------------------------------------------------
index 32b5f0a1eba61909b58f4b8562382aaa203c6992..d16ea84996e7940b10a5d648fe06829bc997ae2c 100644 (file)
 
 #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 <cmd_confdefs.h>
 
  */
 #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()  */
 #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
+
+
 /*-----------------------------------------------------------------------
  * 
  *-----------------------------------------------------------------------
index 0ea13ffc40cbe55774f99be5133e9fc03bdb554b..333709f0524454efd5d9602871ff7d885e82f86a 100644 (file)
 
 #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 <cmd_confdefs.h>
  */
 #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()  */
index f7ddff4c46c7e3ec07988c1494d510b583403492..cf9cd28707d83ef344ac10e50f4c60d60133e982 100644 (file)
@@ -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 | \
                (       (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)
index cb9638629555924ca930b47a883d466ce5e36b48..32ed8d6960ff5c7c1d3ee820c281c576dfc69bfd 100644 (file)
@@ -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 <sum; reg++) {
+               udelay(1000); /*Wait 1ms*/
+       }
+#endif /* CONFIG_BOOTP_RANDOM_DELAY */
+
        printf("BOOTP broadcast %d\n", ++BootpTry);
        pkt = NetTxPacket;
        memset ((void*)pkt, 0, PKTSIZE);
index cf9a77e4a34586250d01fdf8313ebffb86f0fca9..4956eb2dc12c99c7315c3dfad2d8ea32154d14c0 100644 (file)
@@ -53,6 +53,10 @@ typedef struct
 extern ulong   BootpID;                /* ID of cur BOOTP request              */
 extern char    BootFile[128];          /* Boot file name                       */
 extern int     BootpTry;
+#ifdef CONFIG_BOOTP_RANDOM_DELAY
+ulong          seed1, seed2;           /* seed for random BOOTP delay          */
+#endif
+
 
 /* Send a BOOTP request */
 extern void    BootpRequest (void);
index fe397c0a5cfd6a7df74a63f679fdcb3ba17dec9a..7435d81623927ea25c0090f376b436c3dbc91951 100644 (file)
@@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk
 
 LIB    = librtc.a
 
-OBJS   = date.o pcf8563.o
+OBJS   = date.o pcf8563.o mpc8xx.o
 
 all:   $(LIB)
 
diff --git a/rtc/mpc8xx.c b/rtc/mpc8xx.c
new file mode 100644 (file)
index 0000000..d96153c
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * (C) Copyright 2001
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * Date & Time support for internal RTC of MPC8xx
+ */
+
+/*#define      DEBUG*/
+
+#include <ppcboot.h>
+#include <command.h>
+#include <rtc.h>
+
+#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 */
index b44f794ee8cfe71708f5db72fd0fa48ca3c5ba41..9a5c4f6e589cd02b4bb27e7bc9747ebc700bba92 100644 (file)
@@ -32,7 +32,7 @@
 #include <rtc.h>
 #include <i2c.h>
 
-#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 */