]> www.infradead.org Git - users/rw/ppcboot.git/commitdiff
* Patch by Dave Ellis, 13 Apr 2002:
authorwdenk <wdenk>
Sun, 14 Apr 2002 11:01:32 +0000 (11:01 +0000)
committerwdenk <wdenk>
Sun, 14 Apr 2002 11:01:32 +0000 (11:01 +0000)
  - fix debug print in common/soft_i2c.c
  - fix missing initialization of idata on 8xx
  - fix eeprom command for EEPROMS with 2 byte addresses
  - fix SXNI855T for improved flash_real_protect() parameters

* Added M41T11 RTC driver
  Patch by Andrew May, 2 Apr 2002

* Changed MAC handling for Redundand Ethernet Interfaces; see README

* Add DiskOnChip Support for PM826

26 files changed:
CHANGELOG
MAINTAINERS
README
board/cpu86/flash.c
board/pm826/flash.c
board/pm826/pm826.c
board/sixnet/flash.c
common/cmd_eeprom.c
common/cmd_nvedit.c
common/soft_i2c.c
cpu/mpc8xx/cpu_init.c
cpu/mpc8xx/lcd.c
drivers/dc2114x.c
drivers/eepro100.c
include/config_CPU86.h
include/config_DASA_SIM.h
include/config_ICU862.h
include/config_PM826.h
include/config_Sandpoint8240.h
include/config_Sandpoint8245.h
include/config_TQM8260.h
include/config_W7OLMG.h
include/net.h
net/eth.c
rtc/Makefile
rtc/m41t11.c [new file with mode: 0644]

index dbef0227addd65b2a6e16c9cec3cb6f644d95f46..750331721532c0a2bd3bc272eb843bf6d880815b 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
 Modifications for 1.1.6:
 ======================================================================
 
+* Patch by Dave Ellis, 13 Apr 2002:
+  - fix debug print in common/soft_i2c.c
+  - fix missing initialization of idata on 8xx
+  - fix eeprom command for EEPROMS with 2 byte addresses
+
+* Added M41T11 RTC driver
+  Patch by Andrew May, 2 Apr 2002
+
+* Changed MAC handling for Redundand Ethernet Interfaces; see README
+
+* Add DiskOnChip Support for PM826
+
 * Fix I2C driver for PM826, CPU86, and TQM8260
 
 * Add configuration options for PM826 and CPU86 boards to boot either
index 64cd3e2308002fc4821339648f57c63676120e4f..633e304656098677528f5f0091e155d96be1b4a6 100644 (file)
@@ -118,6 +118,10 @@ Oliver Brown <obrown@adventnetworks.com>
        sbc8260                 MPC8260
        gw8260                  MPC8260
 
+Dave Ellis <DGE@sixnetio.com>
+
+       SXNI855T                MPC8xx
+
 -------------------------------------------------------------------------
 
 Unknown / orphaned boards:
@@ -133,7 +137,6 @@ Unknown / orphaned boards:
        NX823                   MPC8xx
        RPXClassic              MPC8xx
        RPXlite                 MPC8xx
-       SXNI855T                MPC8xx
 
        CRAYL1                  PPC4xx
        ERIC                    PPC4xx
diff --git a/README b/README
index 98513dbeeb65d36fb9e3b86599e697b3ca76e0ec..320bd0321050f735590a96854a8c7fb6207de495 100644 (file)
--- a/README
+++ b/README
@@ -1402,6 +1402,40 @@ Please note that changes to some configuration parameters may take
 only effect after the next boot (yes, that's just like Windoze :-).
 
 
+Note for Redundand Ethernet Interfaces:
+=======================================
+
+Some boards come with redundand ethernet interfaces; PPCBoot supports
+such configurations and is capable of automatic selection of a
+"working" interface when needed. MAC assignemnt works as follows:
+
+Network interfaces are numbered eth0, eth1, eth2, ... Corresponding
+MAC addresses can be stored in the environment as "ethaddr" (=>eth0),
+"eth1addr" (=>eth1), "eth2addr", ...
+
+If the network interface stores some valid MAC address (for instance
+in SROM), this is used as default address if there is NO correspon-
+ding setting in the environment; if the corresponding environment
+variable is set, this overrides the settings in the card; that means:
+
+o If the SROM has a valid MAC address, and there is no address in the
+  environment, the SROM's address is used.
+
+o If there is no valid address in the SROM, and a definition in the
+  environment exists, then the value from the environment variable is
+  used.
+
+o If both the SROM and the environment contain a MAC address, and
+  both addresses are the same, this MAC address is used.
+
+o If both the SROM and the environment contain a MAC address, and the
+  addresses differ, the value from the environment is used and a
+  warning is printed.
+
+o If neither SROM nor the environment contain a MAC address, an error
+  is raised.
+
+
 
 Image Formats:
 ==============
index 5786808d610b6a40eb6d68568aafbd8315913509..cc6b09e92a03b6b34135a4a179231cf2f67a65ab 100644 (file)
@@ -187,20 +187,26 @@ unsigned long flash_init (void)
        /* Static FLASH Bank configuration here (only one bank) */
 
        size_b0 = flash_int_get_size ((ulong *) CFG_FLASH_BASE, &flash_info[0]);
-       if (flash_info[0].flash_id == FLASH_UNKNOWN || size_b0 == 0) {
-               printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
-                               size_b0, size_b0 >> 20);
-       }
-
        size_b1 = flash_amd_get_size ((uchar *) CFG_BOOTROM_BASE, &flash_info[1]);
 
-       printf("(Bank#1 - %ld MB", size_b0 >> 20);
+       if (size_b0 > 0 || size_b1 > 0) {
 
-       if (size_b1 > 0)
-               printf(", Bank#2 - %ld kB", size_b1 >> 10);
+               printf("(");
 
-       printf(")");
+               if (size_b0 > 0)
+                       printf("Bank#1 - %ld MB", size_b0 >> 20);
 
+               if (size_b1 > 0)
+                       printf("%sBank#2 - %ld kB", 
+                              (size_b0 > 0) ? ", " : "", 
+                              size_b1 >> 10);
+
+               printf(") ");
+       }
+       else {
+               printf ("## No FLASH found.\n");
+               return 0;
+       }
        /* protect monitor and environment sectors
         */
 
index bc40d251bc30572872e9215e3b1ac13a10da91af..35f2d777723c7bafda1a3a28c67f0e1bf8c67843 100644 (file)
@@ -125,24 +125,18 @@ unsigned long flash_init (void)
        /* protect monitor and environment sectors
         */
 
-#ifndef CONFIG_BOOT_BOOTROM
-       /* If PPCBoot is  booted from ROM the CFG_MONITOR_BASE > CFG_FLASH0_BASE
-        * but we shouldn't protect it.
-        */
-
 #ifndef CONFIG_BOOT_ROM
        /* If PPCBoot is  booted from ROM the CFG_MONITOR_BASE > CFG_FLASH0_BASE
         * but we shouldn't protect it.
         */
 
-#if CFG_MONITOR_BASE >= CFG_FLASH0_BASE
+# if CFG_MONITOR_BASE >= CFG_FLASH0_BASE
        flash_protect (FLAG_PROTECT_SET,
                       CFG_MONITOR_BASE,
                       CFG_MONITOR_BASE + CFG_MONITOR_LEN - 1, &flash_info[0]
        );
-#endif
-#endif
-#endif
+# endif
+#endif /* CONFIG_BOOT_ROM */
 
 #if (CFG_ENV_IS_IN_FLASH == 1) && defined(CFG_ENV_ADDR)
 # ifndef  CFG_ENV_SIZE
@@ -197,7 +191,7 @@ void flash_print_info (flash_info_t * info)
                        printf ("\n   ");
                printf (" %08lX%s",
                        info->start[i],
-                       info->protect[i] ? " (RO)" : "     "
+                       info->protect[i] ? " (RO)" : "     "
                );
        }
        printf ("\n");
index 150f676d282f0aa12ec462cfae3d5ed957adbafa..2ff4ec3b664b2fa2c878bb22c6b3c3ea4c74ad44 100644 (file)
@@ -333,3 +333,11 @@ long int initdram(int board_type)
 #endif
     return (psize);
 }
+
+#if (CONFIG_COMMANDS & CFG_CMD_DOC)
+extern void doc_probe (ulong physadr);
+void doc_init (void)
+{
+       doc_probe (CFG_DOC_BASE);
+}
+#endif
index f50544accfae45b0360c3c54d32e77513f3d21f1..3ae698352db1a89dba46931d87489088d6606e2a 100644 (file)
@@ -683,27 +683,14 @@ static int write_word_intel (flash_info_t *info, FPWV *dest, FPW data)
 
 #ifdef CFG_FLASH_PROTECTION
 /*-----------------------------------------------------------------------
- * FIXME - pass in sector index instead of sector address, would simplify
- * this code a bit. w7o would need changing also.
  */
 int flash_real_protect (flash_info_t * info, long sector, int prot)
 {
-       int rcode;
-       int sectindex = 0;
-       FPWV *addr = (FPWV *) sector;
+       int rcode = 0;          /* assume success */
+       FPWV *addr;             /* address of sector */
        FPW value;
-       int i;
-
-       rcode = 1;                              /* assume fails */
-       for (i = 0; rcode != 0 && i < info->sector_count; i++) {
-               if (info->start[i] == sector) {
-                       sectindex = i;
-                       rcode = 0;              /* success so far */
-               }
-       }
 
-       if (rcode)
-               return (rcode);
+       addr = (FPWV *) (info->start[sector]);
 
        switch (info->flash_id & FLASH_TYPEMASK) {
        case FLASH_28F800C3B:
@@ -732,15 +719,15 @@ int flash_real_protect (flash_info_t * info, long sector, int prot)
                 */
                value = addr[2] & (FPW) 0x00010001;
                if (value == 0)
-                       info->protect[sectindex] = 0;
+                       info->protect[sector] = 0;
                else if (value == (FPW) 0x00010001)
-                       info->protect[sectindex] = 1;
+                       info->protect[sector] = 1;
                else {
                        /* error, mixed protected and unprotected */
                        rcode = 1;
-                       info->protect[sectindex] = 1;
+                       info->protect[sector] = 1;
                }
-               if (info->protect[sectindex] != prot)
+               if (info->protect[sector] != prot)
                        rcode = 1;      /* failed to protect/unprotect as requested */
 
                /* reload all protection bits from hardware for now */
@@ -750,7 +737,7 @@ int flash_real_protect (flash_info_t * info, long sector, int prot)
        case FLASH_AM640U:
        default:
                /* no hardware protect that we support */
-               info->protect[sectindex] = prot;
+               info->protect[sector] = prot;
                break;
        }
 
index 0e5e12ebf68fd7d02674cb043a2c180da5c1045b..11a868d6e386d1e4dc839a80e64f3fe3c026aae9 100644 (file)
@@ -100,15 +100,19 @@ int do_eeprom (cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc,
 
 /*-----------------------------------------------------------------------
  *
- * for CONFIG_I2C_X defined (16-bit EEPROM address) offset is
+ * for CFG_I2C_EEPROM_ADDR_LEN == 2 (16-bit EEPROM address) offset is
  *   0x000nxxxx for EEPROM address selectors at n, offset xxxx in EEPROM.
  *
- * for CONFIG_I2C_X not defined (8-bit EEPROM page address) offset is
+ * for CFG_I2C_EEPROM_ADDR_LEN == 1 (8-bit EEPROM page address) offset is
  *   0x00000nxx for EEPROM address selectors and page number at n.
  */
 
 #if (CONFIG_COMMANDS & CFG_CMD_EEPROM) || defined(CFG_ENV_IS_IN_EEPROM)
 
+#if !defined(CFG_I2C_EEPROM_ADDR_LEN) || CFG_I2C_EEPROM_ADDR_LEN < 1 || CFG_I2C_EEPROM_ADDR_LEN > 2
+#error CFG_I2C_EEPROM_ADDR_LEN must be 1 or 2
+#endif
+
 int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt)
 {
        unsigned end = offset + cnt;
@@ -121,7 +125,7 @@ int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt
         */
        while (offset < end) {
                unsigned alen, len, maxlen;
-#if !defined(CONFIG_I2C_X) && !defined(CONFIG_SPI_X)
+#if CFG_I2C_EEPROM_ADDR_LEN == 1 && !defined(CONFIG_SPI_X)
                uchar addr[2];
 
                blk_off = offset & 0xFF;        /* block offset */
@@ -138,7 +142,7 @@ int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt
                addr[1] = offset >>  8;         /* upper address octet */
                addr[2] = blk_off;              /* lower address octet */
                alen    = 3;
-#endif /* CONFIG_I2C_X, CONFIG_SPI_X */
+#endif /* CFG_I2C_EEPROM_ADDR_LEN, CONFIG_SPI_X */
 
                addr[0] |= dev_addr;            /* insert device address */
 
@@ -162,10 +166,10 @@ int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt
 
 /*-----------------------------------------------------------------------
  *
- * for CONFIG_I2C_X defined (16-bit EEPROM address) offset is
+ * for CFG_I2C_EEPROM_ADDR_LEN == 2 (16-bit EEPROM address) offset is
  *   0x000nxxxx for EEPROM address selectors at n, offset xxxx in EEPROM.
  *
- * for CONFIG_I2C_X not defined (8-bit EEPROM page address) offset is
+ * for CFG_I2C_EEPROM_ADDR_LEN == 1 (8-bit EEPROM page address) offset is
  *   0x00000nxx for EEPROM address selectors and page number at n.
  */
 
@@ -190,7 +194,7 @@ int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cn
 
        while (offset < end) {
                unsigned alen, len, maxlen;
-#if !defined(CONFIG_I2C_X) && !defined(CONFIG_SPI_X)
+#if CFG_I2C_EEPROM_ADDR_LEN == 1 && !defined(CONFIG_SPI_X)
                uchar addr[2];
 
                blk_off = offset & 0xFF;        /* block offset */
@@ -207,7 +211,7 @@ int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cn
                addr[1] = offset >>  8;         /* upper address octet */
                addr[2] = blk_off;              /* lower address octet */
                alen    = 3;
-#endif /* CONFIG_I2C_X, CONFIG_SPI_X */
+#endif /* CFG_I2C_EEPROM_ADDR_LEN, CONFIG_SPI_X */
 
                addr[0] |= dev_addr;            /* insert device address */
 
index b99fcb97972899bdf80f958f363de589ba8c6130..38841d7d2798eda5cb6a18473a55456f49952bcc 100644 (file)
@@ -932,13 +932,9 @@ int saveenv(void)
       (CFG_CMD_ENV|CFG_CMD_FLASH))
 int do_saveenv  (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 {
-       int rcode = 0;
-
        puts (NVRAM_SAVESTR);
-       if (!saveenv())
-           rcode = 1;
 
-       return rcode;
+       return (saveenv() ? 1 : 0);
 }
 #endif
 
index 240c54cf88ec3bae16776fbb7a3042edb25a7f97..ef1386194f1936740ae1a637b544bee3ee4fd800 100644 (file)
 
 
 #ifdef DEBUG_I2C
-#define PRINTD(fmt,args...)    printf (fmt ,##args)
+#define PRINTD(fmt,args...)    do {                                    \
+       init_data_t *idata = (init_data_t *)(CFG_INIT_RAM_ADDR + CFG_INIT_DATA_OFFSET); \
+       if (idata->have_console)                                        \
+               printf (fmt ,##args);                                   \
+       } while (0)
 #else
 #define PRINTD(fmt,args...)
 #endif
index 9caee677caa85c0c21f38eec5c7af8b0598e039c..52c7f860619bdbf57c96d9017a98b1ba7d0c6eb1 100644 (file)
@@ -211,6 +211,9 @@ cpu_init_f (volatile immap_t *immr)
        __asm__ ("eieio");
     } while (immr->im_cpm.cp_cpcr & CPM_CR_FLG);
 
+    /* clear memory for idata */
+    memset((init_data_t *)(CFG_INIT_RAM_ADDR + CFG_INIT_DATA_OFFSET), 0, CFG_INIT_DATA_SIZE);
+
 #ifdef CONFIG_MBX
     /*
      * on the MBX, things are a little bit different:
index e38f9bedef1039504f014cc47845bc6638ee5dfd..4ffa90cb06a94c6301446e7271973c834ddf73d6 100644 (file)
@@ -151,7 +151,7 @@ typedef struct vidinfo {
     u_char     vl_dp;          /* Data polarity */
     u_char     vl_bpix;        /* Bits per pixel, 0 = 1, 1 = 2, 2 = 4, 3 = 8 */
     u_char     vl_lbw;         /* LCD Bus width, 0 = 4, 1 = 8 */
-    u_char     vl_splt;        /* Split display, 0 = dual, 1 = single */
+    u_char     vl_splt;        /* Split display, 0 = single-scan, 1 = dual-scan */
     u_char     vl_clor;        /* Color, 0 = mono, 1 = color */
     u_char     vl_tft;         /* 0 = passive, 1 = TFT */
 
index 8c03ec5dd27b48301fa179ced4a99c0c1b738e2f..14c94e273208474e6a87c3da6977cc1f434957f7 100644 (file)
@@ -445,7 +445,7 @@ static void send_setup_frame(struct eth_device* dev, bd_t *bis)
        memset(pa, 0xff, SETUP_FRAME_LEN);
 
        for (i = 0; i < ETH_ALEN; i++) {
-               *(pa + (i & 1)) = bis->bi_enetaddr[i];
+               *(pa + (i & 1)) = dev->enetaddr[i];
                if (i & 0x01) {
                        pa += 4;
                }
@@ -659,30 +659,13 @@ static void read_hw_addr(struct eth_device *dev, bd_t *bis)
        }
 
        if ((j == 0) || (j == 0x2fffd)) {
+               memset (dev->enetaddr, 0, ETH_ALEN);
+#ifdef DEBUG
                printf("Warning: can't read HW address from SROM.\n");
+#endif
                goto Done;
        }
 
-#ifdef DEBUG
-       for (i = 0; i < ETH_ALEN; i++) {
-               if (dev->enetaddr[i] != bis->bi_enetaddr[i]) {
-                       printf("Warning: HW addresses don't match:\n");
-                       printf("Address in SROM is         "
-                              "%02X:%02X:%02X:%02X:%02X:%02X\n",
-                              dev->enetaddr[0], dev->enetaddr[1],
-                              dev->enetaddr[2], dev->enetaddr[3],
-                              dev->enetaddr[4], dev->enetaddr[5]);
-                       printf("Address used by ppcboot is "
-                              "%02X:%02X:%02X:%02X:%02X:%02X\n",
-                              bis->bi_enetaddr[0], bis->bi_enetaddr[1],
-                              bis->bi_enetaddr[2], bis->bi_enetaddr[3],
-                              bis->bi_enetaddr[4], bis->bi_enetaddr[5]);
-
-                       goto Done;
-               }
-       }
-#endif
-
        return;
 
 Done:
index 417da8d9ff333105cc3eb3f3f77d213a645f388a..e39be7e381076c8095f771c0e9746369d0ab59a1 100644 (file)
@@ -682,34 +682,14 @@ static void read_hw_addr(struct eth_device* dev, bd_t *bis)
                }
        }
 
+       if (sum != 0xBABA) {
+               memset (dev->enetaddr, 0, ETH_ALEN);
 #ifdef DEBUG
-       if (sum != 0xBABA)
                printf("%s: Invalid EEPROM checksum %#4.4x, "
                       "check settings before activating this device!\n",
                       dev->name, sum);
-
-       for (i=0;i<ETH_ALEN;i++)
-       {
-               if (dev->enetaddr[i] != bis->bi_enetaddr[i])
-               {
-                       printf("Warning: HW address don't match:\n");
-                       printf("Address in SROM is         "
-                              "%02X:%02X:%02X:%02X:%02X:%02X\n",
-                              dev->enetaddr[0], dev->enetaddr[1],
-                              dev->enetaddr[2], dev->enetaddr[3],
-                              dev->enetaddr[4], dev->enetaddr[5]);
-                       printf("Address used by ppcboot is "
-                              "%02X:%02X:%02X:%02X:%02X:%02X\n",
-                              bis->bi_enetaddr[0], bis->bi_enetaddr[1],
-                              bis->bi_enetaddr[2], bis->bi_enetaddr[3],
-                              bis->bi_enetaddr[4], bis->bi_enetaddr[5]);
-                       goto Done;
-               }
-       }
-
-Done:
 #endif
-       return;
+       }
 }
 
 #endif
index 22f5cf1d1b03f9a42cf27ec7013fbd82e0467f66..7e07116e8d9f7cc4cc2c45b49023e884f8535b5c 100644 (file)
                        else    iop->pdat &= ~0x00010000
 #define I2C_SCL(bit)   if(bit) iop->pdat |=  0x00020000; \
                        else    iop->pdat &= ~0x00020000
-#define I2C_DELAY      udelay(10)       /* 1/4 I2C clock duration */
+#define I2C_DELAY      udelay(5)       /* 1/4 I2C clock duration */
 
 #define CONFIG_RTC_PCF8563
 #define CFG_I2C_RTC_ADDR       0x51
index 227fccf9150e84deb837fbfdf54d736c8c6148c2..a2180b2a03a36e3593ffa8533926329e31790af9 100644 (file)
@@ -73,6 +73,7 @@
 #if 0 /* Does not appear to be used?!  If it is used, needs to be fixed */
 #define CONFIG_SOFT_I2C                        /* Software I2C support enabled */
 #endif
+#define CFG_I2C_EEPROM_ADDR_LEN        1       /* Bytes of address             */
 
 /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
 #include <cmd_confdefs.h>
index e6bb11868d523d2fb442fa4164ce9aad6bb9cc5d..34ccb7a25d2726899c72ed2dc32688a553c9f06a 100644 (file)
@@ -95,6 +95,7 @@
 # define CFG_I2C_SPEED         50000
 # define CFG_I2C_SLAVE         0xFE
 # define CFG_I2C_EEPROM_ADDR   0x50
+# define CFG_I2C_EEPROM_ADDR_LEN 1     /* Bytes of address             */
 /*
  * Software (bit-bang) I2C driver configuration
  */
index 9508dc956afb17a8b2f10cbd97d697eb48a9ae77..14b4fe9a88d182a6b0dd40060128ce089326dd0a 100644 (file)
 
 #define        CONFIG_CLOCKS_IN_MHZ    1       /* clocks passsed to Linux in MHz */
 
-#if 0
-#define CONFIG_BOOTDELAY       -1      /* autoboot disabled            */
-#else
 #define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds     */
-#endif
 
 #define CONFIG_PREBOOT "echo;echo Type \"run flash_nfs\" to mount root filesystem over NFS;echo"
 
@@ -71,7 +67,7 @@
                        else    iop->pdat &= ~0x00010000
 #define I2C_SCL(bit)   if(bit) iop->pdat |=  0x00020000; \
                        else    iop->pdat &= ~0x00020000
-#define I2C_DELAY      udelay(10)       /* 1/4 I2C clock duration */
+#define I2C_DELAY      udelay(5)       /* 1/4 I2C clock duration */
 
 
 #define CONFIG_RTC_PCF8563
 
 #define CONFIG_BOOTP_MASK      (CONFIG_BOOTP_DEFAULT|CONFIG_BOOTP_BOOTFILESIZE)
 
-#define CONFIG_COMMANDS                (CONFIG_CMD_DFL | CFG_CMD_EEPROM | CFG_CMD_DATE)
+#define CONFIG_COMMANDS                (CONFIG_CMD_DFL | CFG_CMD_EEPROM | CFG_CMD_DATE | CFG_CMD_DOC)
 
 /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
 #include <cmd_confdefs.h>
 
+/*
+ * Disk-On-Chip configuration
+ */
+
+#define CFG_DOC_SHORT_TIMEOUT
+#define CFG_MAX_DOC_DEVICE     1       /* Max number of DOC devices    */
+
+#define CFG_DOC_SUPPORT_2000
+#define CFG_DOC_SUPPORT_MILLENNIUM
+
 /*
  * Miscellaneous configurable options
  */
 #define        CFG_BOOTROM_SIZE        0x00080000
 #define        CFG_FLASH0_BASE         0x40000000
 #define        CFG_FLASH0_SIZE         0x02000000
+#define CFG_DOC_BASE           0x60000000
+#define CFG_DOC_SIZE           0x00100000
 
 
 /* Flash bank size (for preliminary settings)
 
 #if defined(CONFIG_BOOT_ROM)
 /*
- * Bank 0 - BOOTROM
+ * Bank 0 - Boot ROM (8 bit wide)
  */
 #define CFG_BR0_PRELIM ((CFG_BOOTROM_BASE & BRx_BA_MSK)|\
                         BRx_PS_8                       |\
                         ORxG_EHTR                      |\
                         ORxG_TRLX)
 
+/*
+ * Bank 1 - Flash (64 bit wide)
+ */
 #define CFG_BR1_PRELIM ((CFG_FLASH_BASE & BRx_BA_MSK)  |\
                         BRx_PS_64                      |\
                         BRx_MS_GPCM_P                  |\
 #else  /* ! CONFIG_BOOT_ROM */
 
 /*
- * Bank 0 - FLASH
+ * Bank 0 - Flash (64 bit wide)
  */
 #define CFG_BR0_PRELIM  ((CFG_FLASH_BASE & BRx_BA_MSK)  |\
                          BRx_PS_64                      |\
                          ORxG_SCY_3_CLK                 |\
                          ORxG_EHTR                      |\
                          ORxG_TRLX)
+
+/*
+ * Bank 1 - Disk-On-Chip
+ */
+#define CFG_BR1_PRELIM ((CFG_DOC_BASE & BRx_BA_MSK)    |\
+                        BRx_PS_8                       |\
+                        BRx_MS_GPCM_P                  |\
+                        BRx_V)
+
+#define CFG_OR1_PRELIM (P2SZ_TO_AM(CFG_DOC_SIZE)       |\
+                        ORxG_CSNT                      |\
+                        ORxG_ACS_DIV1                  |\
+                        ORxG_SCY_3_CLK                 |\
+                        ORxG_EHTR                      |\
+                        ORxG_TRLX)
+
 #endif /* CONFIG_BOOT_ROM */
 
 /* Bank 2 - SDRAM
index 2b089121f03f5a1208e0bcaaab94d04e35495710..d22df0cbf540874bddaa66e60c5e948205bd1cbd 100644 (file)
 
 
 #define CFG_I2C_EEPROM_ADDR    0x57            /* EEPROM IS24C02               */
+#define CFG_I2C_EEPROM_ADDR_LEN        1               /* Bytes of address             */
 
 #define CFG_BAUDRATE_TABLE     { 9600, 19200, 38400, 57600, 115200 }
 #define CFG_FLASH_BANKS                { FLASH_BASE0_PRELIM , FLASH_BASE1_PRELIM }
index df207675283da586500f89334b84d2f029688848..23fca50a0ad95ade78b8dd5ed3c813b6b1c08863 100644 (file)
 #endif /* CONFIG_SOFT_I2C */
 
 #define CFG_I2C_EEPROM_ADDR    0x57            /* EEPROM IS24C02               */
+#define CFG_I2C_EEPROM_ADDR_LEN        1               /* Bytes of address             */
 #define CFG_EEPROM_PAGE_WRITE_BITS     3
 #define CFG_EEPROM_PAGE_WRITE_DELAY_MS 10      /* and takes up to 10 msec */
 
index 07e81cca6b31af019d32bd820d95ac3a44f83b6f..e9db27c9f3246599369e07507688fefc48e48e7a 100644 (file)
@@ -96,7 +96,7 @@
                        else    iop->pdat &= ~0x00020000
 #define I2C_SCL(bit)   if(bit) iop->pdat |=  0x00010000; \
                        else    iop->pdat &= ~0x00010000
-#define I2C_DELAY      udelay(20)      /* 1/4 I2C clock duration */
+#define I2C_DELAY      udelay(5)       /* 1/4 I2C clock duration */
 
 #else
 
                        else    iop->pdat &= ~0x00010000
 #define I2C_SCL(bit)   if(bit) iop->pdat |=  0x00020000; \
                        else    iop->pdat &= ~0x00020000
-#define I2C_DELAY      udelay(20)      /* 1/4 I2C clock duration */
+#define I2C_DELAY      udelay(5)       /* 1/4 I2C clock duration */
 #endif
 
 #define CFG_I2C_EEPROM_ADDR    0x50
index 252c6deab81e7fea56ed143173a13dcf9e18531f..9be8cdb03fd19dfb32d036a55aa8fa70375c47c1 100644 (file)
 #define CFG_I2C_SLAVE          0x7F
 
 #define CFG_I2C_EEPROM_ADDR    0x50            /* EEPROM ATMEL 24C04N          */
+#define CFG_I2C_EEPROM_ADDR_LEN        1               /* Bytes of address             */
 #define CFG_EEPROM_PAGE_WRITE_ENABLE
 #define CFG_EEPROM_PAGE_WRITE_BITS 3
 #define CFG_I2C_MULTI_EEPROMS
index 717e9e652106a85cb246b4d17fbd98cb90120be1..cd92a2705fc69855d82f952769ff65638b3e33e1 100644 (file)
@@ -76,7 +76,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 char *eth_get_enetaddr(void);           /* get the current device MAC */
+extern char *eth_get_enetaddr(void);           /* get the current device MAC   */
 #endif
 
 extern int eth_init(bd_t *bis);                        /* Initialize the device        */
index 06896226142a5bd49fea7a3d52286722d2a1a781..506d1d89b65a3d676fc4362b936ed898d88bec04 100644 (file)
--- a/net/eth.c
+++ b/net/eth.c
@@ -41,7 +41,9 @@ int eth_register(struct eth_device* dev)
 
 int eth_initialize(bd_t *bis)
 {
-       int eth_number = 0;
+       unsigned char enetvar[32], env_enetaddr[6];
+       int i, eth_number = 0;
+       char *tmp, *end;
 
        eth_devices = NULL;
        eth_current = NULL;
@@ -63,9 +65,43 @@ int eth_initialize(bd_t *bis)
                struct eth_device *dev = eth_devices;
 
                do {
-                       if (eth_number++)
+                       if (eth_number)
                                printf(", ");
+
                        printf("%s", dev->name);
+
+                       sprintf(enetvar, eth_number ? "eth%daddr" : "ethaddr", eth_number);
+                       tmp = getenv (enetvar);
+
+                       for (i=0; i<6; i++)
+                       {
+                               env_enetaddr[i] = tmp ? simple_strtoul(tmp, &end, 16) : 0;
+                               if (tmp)
+                                       tmp = (*end) ? end+1 : end;
+                       }
+
+                       if (memcmp(env_enetaddr, "\0\0\0\0\0\0", 6))
+                       {
+                               if (memcmp(dev->enetaddr, "\0\0\0\0\0\0", 6) && 
+                                   memcmp(dev->enetaddr, env_enetaddr, 6))
+                               {
+                                       printf("\nWarning: %s HW address don't match:\n", dev->name);
+                                       printf("Address in SROM is         "
+                                              "%02X:%02X:%02X:%02X:%02X:%02X\n",
+                                              dev->enetaddr[0], dev->enetaddr[1],
+                                              dev->enetaddr[2], dev->enetaddr[3],
+                                              dev->enetaddr[4], dev->enetaddr[5]);
+                                       printf("Address in environment is  "
+                                              "%02X:%02X:%02X:%02X:%02X:%02X\n",
+                                              env_enetaddr[0], env_enetaddr[1],
+                                              env_enetaddr[2], env_enetaddr[3],
+                                              env_enetaddr[4], env_enetaddr[5]);
+                               }
+
+                               memcpy(dev->enetaddr, env_enetaddr, 6);
+                       }
+
+                       eth_number++;
                        dev = dev->next;
                } while(dev != eth_devices);
 
index 690fe212d6b7855720e87ed01887fe6d25a6311d..4119adbef4486a5da37f20c3ddaf21c93355d0a8 100644 (file)
@@ -28,7 +28,8 @@ include $(TOPDIR)/config.mk
 LIB    = librtc.a
 
 OBJS   = date.o   ds1302.o ds174x.o ds1306.o ds1556.o \
-         m48t35ax.o mc146818.o mk48t59.o mpc8xx.o pcf8563.o
+         m41t11.o m48t35ax.o mc146818.o mk48t59.o \
+         mpc8xx.o pcf8563.o
 
 all:   $(LIB)
 
diff --git a/rtc/m41t11.c b/rtc/m41t11.c
new file mode 100644 (file)
index 0000000..cef9b41
--- /dev/null
@@ -0,0 +1,202 @@
+/*
+ * (C) Copyright 2002
+ * Andrew May, Viasat Inc, amay@viasat.com
+ *
+ * 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
+ */
+
+/*
+ * M41T11 Serial Access Timekeeper(R) SRAM
+ * can you believe a trademark on that?
+ */
+
+#include <ppcboot.h>
+#include <command.h>
+#include <rtc.h>
+#include <i2c.h>
+
+/*
+       I Don't have an example config file but this
+       is what should be done.
+
+#define CONFIG_RTC_M41T11 1
+#define CFG_I2C_RTC_ADDR 0x68
+#if 0
+#define CFG_M41T11_EXT_CENTURY_DATA
+#else
+#define CFG_M41T11_BASE_YEAR 2000
+#endif
+*/
+
+#if defined(CONFIG_RTC_M41T11) && defined(CFG_I2C_RTC_ADDR) && (CONFIG_COMMANDS & CFG_CMD_DATE)
+
+#define DEBUG 1
+
+static unsigned bcd2bin (uchar n)
+{
+       return ((((n >> 4) & 0x0F) * 10) + (n & 0x0F));
+}
+
+static unsigned char bin2bcd (unsigned int n)
+{
+       return (((n / 10) << 4) | (n % 10));
+}
+
+
+/* ------------------------------------------------------------------------- */
+/*
+  these are simple defines for the chip local to here so they aren't too
+  verbose
+  DAY/DATE aren't nice but that is how they are on the data sheet
+*/
+#define RTC_SEC_ADDR       0x0
+#define RTC_MIN_ADDR       0x1
+#define RTC_HOUR_ADDR      0x2
+#define RTC_DAY_ADDR       0x3
+#define RTC_DATE_ADDR      0x4
+#define RTC_MONTH_ADDR     0x5
+#define RTC_YEARS_ADDR     0x6
+
+#define RTC_REG_CNT        7
+
+#define RTC_CONTROL_ADDR   0x7
+
+
+#ifndef CFG_M41T11_EXT_CENTURY_DATA
+
+#define REG_CNT            (RTC_REG_CNT+1)
+
+/*
+  you only get 00-99 for the year we will asume you
+  want from the year 2000 if you don't set the config
+*/
+#ifndef CFG_M41T11_BASE_YEAR
+#define CFG_M41T11_BASE_YEAR 2000
+#endif
+
+#else
+/* we will store extra year info in byte 9*/
+#define M41T11_YEAR_DATA   0x8
+#define M41T11_YEAR_SIZE   1
+#define REG_CNT            (RTC_REG_CNT+1+M41T11_YEAR_SIZE)
+#endif
+
+#define M41T11_STORAGE_SZ  (64-REG_CNT)
+
+void rtc_get (struct rtc_time *tmp)
+{
+        uchar data[RTC_REG_CNT];
+
+        i2c_read(CFG_I2C_RTC_ADDR, RTC_SEC_ADDR, 1, data, RTC_REG_CNT);
+
+        if( data[RTC_SEC_ADDR] & 0x80 ){
+                printf( "m41t11 RTC Clock stopped!!!\n" );
+        }
+       tmp->tm_sec  = bcd2bin (data[RTC_SEC_ADDR]  & 0x7F);
+       tmp->tm_min  = bcd2bin (data[RTC_MIN_ADDR]  & 0x7F);
+       tmp->tm_hour = bcd2bin (data[RTC_HOUR_ADDR] & 0x3F);
+       tmp->tm_mday = bcd2bin (data[RTC_DATE_ADDR] & 0x3F);
+       tmp->tm_mon  = bcd2bin (data[RTC_MONTH_ADDR]& 0x1F);
+#ifndef CFG_M41T11_EXT_CENTURY_DATA
+        tmp->tm_year = CFG_M41T11_BASE_YEAR
+                + bcd2bin(data[RTC_YEARS_ADDR])
+                + ((data[RTC_HOUR_ADDR]&0x40) ? 100 : 0);
+#else
+        {
+                unsigned char cent;
+                i2c_read(CFG_I2C_RTC_ADDR, M41T11_YEAR_DATA, 1, &cent, M41T11_YEAR_SIZE);
+                if( !(data[RTC_HOUR_ADDR] & 0x80) ){
+                        printf( "m41t11 RTC: cann't keep track of years without CEB set\n" );
+                }
+                if( (cent & 0x1) != ((data[RTC_HOUR_ADDR]&0x40)>>7) ){
+                        /*century flip store off new year*/
+                        cent += 1;
+                        i2c_write(CFG_I2C_RTC_ADDR, M41T11_YEAR_DATA, 1, &cent, M41T11_YEAR_SIZE);
+                }
+                tmp->tm_year =((int)cent*100)+bcd2bin(data[RTC_YEARS_ADDR]);
+        }
+#endif
+       tmp->tm_wday = bcd2bin (data[RTC_DAY_ADDR]  & 0x07);
+       tmp->tm_yday = 0;
+       tmp->tm_isdst= 0;
+
+       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)
+{
+        uchar data[RTC_REG_CNT];
+
+       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);
+
+       data[RTC_SEC_ADDR]    = bin2bcd(tmp->tm_sec) &  0x7F;/*just in case*/
+       data[RTC_MIN_ADDR]    = bin2bcd(tmp->tm_min);
+       data[RTC_HOUR_ADDR]   = bin2bcd(tmp->tm_hour) & 0x3F;/*handle cent stuff later*/
+       data[RTC_DATE_ADDR]   = bin2bcd(tmp->tm_mday) & 0x3F;
+       data[RTC_MONTH_ADDR]  = bin2bcd(tmp->tm_mon);
+       data[RTC_DAY_ADDR]    = bin2bcd(tmp->tm_wday) & 0x07;
+
+        data[RTC_HOUR_ADDR]   |= 0x80;/*we will always use CEB*/
+
+        data[RTC_YEARS_ADDR]  = bin2bcd(tmp->tm_year%100);/*same thing either way*/
+#ifndef CFG_M41T11_EXT_CENTURY_DATA
+        if( ((tmp->tm_year - CFG_M41T11_BASE_YEAR) > 200) ||
+            (tmp->tm_year < CFG_M41T11_BASE_YEAR) ){
+                printf( "m41t11 RTC setting year out of range!!need recompile\n" );
+        }
+        data[RTC_HOUR_ADDR] |= (tmp->tm_year - CFG_M41T11_BASE_YEAR) > 100 ? 0x40 : 0;
+#else
+        {
+                unsigned char cent;
+                cent = tmp->tm_year ? tmp->tm_year / 100 : 0;
+                data[RTC_HOUR_ADDR] |= (cent & 0x1) ? 0x40 : 0;
+                i2c_write(CFG_I2C_RTC_ADDR, M41T11_YEAR_DATA, 1, &cent, M41T11_YEAR_SIZE);
+        }
+#endif
+        i2c_write(CFG_I2C_RTC_ADDR, RTC_SEC_ADDR, 1, data, RTC_REG_CNT);
+}
+
+void rtc_reset (void)
+{
+        unsigned char val;
+       /* clear all control & status registers */
+        i2c_read(CFG_I2C_RTC_ADDR, RTC_SEC_ADDR, 1, &val, 1);
+        val = val & 0x7F;/*make sure we are running*/
+        i2c_write(CFG_I2C_RTC_ADDR, RTC_SEC_ADDR, 1, &val, RTC_REG_CNT);
+
+        i2c_read(CFG_I2C_RTC_ADDR, RTC_CONTROL_ADDR, 1, &val, 1);
+        val = val & 0x3F;/*turn off freq test keep calibration*/
+        i2c_write(CFG_I2C_RTC_ADDR, RTC_CONTROL_ADDR, 1, &val, 1);
+}
+
+int rtc_store(int addr, unsigned char* data, int size)
+{
+        /*don't let things wrap onto the time on a write*/
+        if( (addr+size) >= M41T11_STORAGE_SZ )
+                return 1;
+        return i2c_write( CFG_I2C_RTC_ADDR, REG_CNT+addr, 1, data, size );
+}
+
+int rtc_recall(int addr, unsigned char* data, int size)
+{
+        return i2c_read( CFG_I2C_RTC_ADDR, REG_CNT+addr, 1, data, size );
+}
+
+#endif /* CONFIG_RTC_M41T11 && CFG_I2C_RTC_ADDR && CFG_CMD_DATE */