]> git.sur5r.net Git - u-boot/blobdiff - board/xpedite1k/xpedite1k.c
xpedite1k: Use standard CFI flash driver
[u-boot] / board / xpedite1k / xpedite1k.c
index 58bcfaf7bad490f9f6d90d95e9f1968be0983e8c..bbbcdb1cdadf4ad1d6cfd959101608b0558003a7 100644 (file)
@@ -25,6 +25,7 @@
 #include <asm/processor.h>
 #include <spd_sdram.h>
 #include <i2c.h>
+#include <net.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -49,12 +50,10 @@ int board_early_init_f(void)
        /*--------------------------------------------------------------------
         * Setup the external bus controller/chip selects
         *-------------------------------------------------------------------*/
-
-       /* set the bus controller */
-       mtebc (pb0ap, 0x04055200);      /* FLASH/SRAM */
-       mtebc (pb0cr, 0xfff18000);      /* BAS=0xfff 1MB R/W 8-bit */
-       mtebc (pb1ap, 0x04055200);      /* FLASH/SRAM */
-       mtebc (pb1cr, 0xfe098000);      /* BAS=0xff8 16MB R/W 8-bit */
+       mtebc (pb0ap, 0x04055200);      /* 16MB Strata FLASH */
+       mtebc (pb0cr, 0xff098000);      /* BAS=0xff0 16MB R/W 8-bit */
+       mtebc (pb1ap, 0x04055200);      /* 512KB Socketed AMD FLASH */
+       mtebc (pb1cr, 0xfe018000);      /* BAS=0xfe0 1MB R/W 8-bit */
 
        /*--------------------------------------------------------------------
         * Setup the interrupt controller polarities, triggers, etc.
@@ -335,29 +334,58 @@ ulong post_word_load (void)
  * board_get_enetaddr -- Read the MAC Addresses in the I2C EEPROM
  *-----------------------------------------------------------------------------
  */
-static int enetaddr_num = 0;
-void board_get_enetaddr (uchar * enet)
+static int read_i2c;
+static void board_get_enetaddr(uchar *enet)
 {
        int i;
        unsigned char buff[0x100], *cp;
 
+       if (read_i2c)
+               return;
+
        /* Initialize I2C                                       */
        i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 
        /* Read 256 bytes in EEPROM                             */
        i2c_read (0x50, 0, 1, buff, 0x100);
 
-       if (enetaddr_num == 0) {
-               cp = &buff[0xF4];
-               enetaddr_num = 1;
-       }
-       else
-               cp = &buff[0xFA];
-
+       cp = &buff[0xF4];
        for (i = 0; i < 6; i++,cp++)
                enet[i] = *cp;
 
-       printf ("MAC address = %02x:%02x:%02x:%02x:%02x:%02x\n",
-               enet[0], enet[1], enet[2], enet[3], enet[4], enet[5]);
+       printf("MAC address = %pM\n", enet);
+       read_i2c = 1;
+}
+
+int misc_init_r(void)
+{
+       uchar enetaddr[6], i2c_enetaddr[6];
 
+       if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+               board_get_enetaddr(i2c_enetaddr);
+               eth_setenv_enetaddr("ethaddr", i2c_enetaddr);
+       }
+
+#ifdef CONFIG_HAS_ETH1
+       if (!eth_getenv_enetaddr("eth1addr", enetaddr)) {
+               board_get_enetaddr(i2c_enetaddr);
+               eth_setenv_enetaddr("eth1addr", i2c_enetaddr);
+       }
+#endif
+
+#ifdef CONFIG_HAS_ETH2
+       if (!eth_getenv_enetaddr("eth2addr", enetaddr)) {
+               board_get_enetaddr(i2c_enetaddr);
+               eth_setenv_enetaddr("eth2addr", i2c_enetaddr);
+       }
+#endif
+
+#ifdef CONFIG_HAS_ETH3
+       if (!eth_getenv_enetaddr("eth3addr", enetaddr)) {
+               board_get_enetaddr(i2c_enetaddr);
+               eth_setenv_enetaddr("eth3addr", i2c_enetaddr);
+       }
+#endif
+
+       return 0;
 }