]> git.sur5r.net Git - u-boot/blobdiff - board/xpedite1k/xpedite1k.c
xpedite1k: Remove CONFIG_SYS_DRAM_TEST support
[u-boot] / board / xpedite1k / xpedite1k.c
index 8411cf06f761816a15d3fd04157e190341cc2ddb..9abb83f2f5bc3245d98b989213d7b15eaa35aa5c 100644 (file)
@@ -25,6 +25,7 @@
 #include <asm/processor.h>
 #include <spd_sdram.h>
 #include <i2c.h>
+#include <net.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -40,7 +41,7 @@ int board_early_init_f(void)
        /* TBS:  Setup the GPIO access for the user LEDs */
        mfsdr(sdr_pfc0, sdrreg);
        mtsdr(sdr_pfc0, (sdrreg & ~0x00000100) | 0x00000E00);
-       out32(CFG_GPIO_BASE + 0x018, (USR_LED0 | USR_LED1 | USR_LED2 | USR_LED3));
+       out32(CONFIG_SYS_GPIO_BASE + 0x018, (USR_LED0 | USR_LED1 | USR_LED2 | USR_LED3));
        LED0_OFF();
        LED1_OFF();
        LED2_OFF();
@@ -49,46 +50,56 @@ 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.
         *-------------------------------------------------------------------*/
-       mtdcr (uic0sr, 0xffffffff);     /* clear all */
-       mtdcr (uic0er, 0x00000000);     /* disable all */
-       mtdcr (uic0cr, 0x00000003);     /* SMI & UIC1 crit are critical */
-       mtdcr (uic0pr, 0xfffffe00);     /* per ref-board manual */
-       mtdcr (uic0tr, 0x01c00000);     /* per ref-board manual */
-       mtdcr (uic0vr, 0x00000001);     /* int31 highest, base=0x000 */
-       mtdcr (uic0sr, 0xffffffff);     /* clear all */
-
+       /*
+        * Because of the interrupt handling rework to handle 440GX interrupts
+        * with the common code, we needed to change names of the UIC registers.
+        * Here the new relationship:
+        *
+        * U-Boot name  440GX name
+        * -----------------------
+        * UIC0         UICB0
+        * UIC1         UIC0
+        * UIC2         UIC1
+        * UIC3         UIC2
+        */
        mtdcr (uic1sr, 0xffffffff);     /* clear all */
        mtdcr (uic1er, 0x00000000);     /* disable all */
-       mtdcr (uic1cr, 0x00000000);     /* all non-critical */
-       mtdcr (uic1pr, 0xffffc0ff);     /* per ref-board manual */
-       mtdcr (uic1tr, 0x00ff8000);     /* per ref-board manual */
+       mtdcr (uic1cr, 0x00000003);     /* SMI & UIC1 crit are critical */
+       mtdcr (uic1pr, 0xfffffe00);     /* per ref-board manual */
+       mtdcr (uic1tr, 0x01c00000);     /* per ref-board manual */
        mtdcr (uic1vr, 0x00000001);     /* int31 highest, base=0x000 */
        mtdcr (uic1sr, 0xffffffff);     /* clear all */
 
        mtdcr (uic2sr, 0xffffffff);     /* clear all */
        mtdcr (uic2er, 0x00000000);     /* disable all */
        mtdcr (uic2cr, 0x00000000);     /* all non-critical */
-       mtdcr (uic2pr, 0xffffffff);     /* per ref-board manual */
-       mtdcr (uic2tr, 0x00ff8c0f);     /* per ref-board manual */
+       mtdcr (uic2pr, 0xffffc0ff);     /* per ref-board manual */
+       mtdcr (uic2tr, 0x00ff8000);     /* per ref-board manual */
        mtdcr (uic2vr, 0x00000001);     /* int31 highest, base=0x000 */
        mtdcr (uic2sr, 0xffffffff);     /* clear all */
 
-       mtdcr (uicb0sr, 0xfc000000); /* clear all */
-       mtdcr (uicb0er, 0x00000000); /* disable all */
-       mtdcr (uicb0cr, 0x00000000); /* all non-critical */
-       mtdcr (uicb0pr, 0xfc000000); /* */
-       mtdcr (uicb0tr, 0x00000000); /* */
-       mtdcr (uicb0vr, 0x00000001); /* */
+       mtdcr (uic3sr, 0xffffffff);     /* clear all */
+       mtdcr (uic3er, 0x00000000);     /* disable all */
+       mtdcr (uic3cr, 0x00000000);     /* all non-critical */
+       mtdcr (uic3pr, 0xffffffff);     /* per ref-board manual */
+       mtdcr (uic3tr, 0x00ff8c0f);     /* per ref-board manual */
+       mtdcr (uic3vr, 0x00000001);     /* int31 highest, base=0x000 */
+       mtdcr (uic3sr, 0xffffffff);     /* clear all */
+
+       mtdcr (uic0sr, 0xfc000000); /* clear all */
+       mtdcr (uic0er, 0x00000000); /* disable all */
+       mtdcr (uic0cr, 0x00000000); /* all non-critical */
+       mtdcr (uic0pr, 0xfc000000); /* */
+       mtdcr (uic0tr, 0x00000000); /* */
+       mtdcr (uic0vr, 0x00000001); /* */
 
        LED0_ON();
 
@@ -104,7 +115,7 @@ int checkboard (void)
 }
 
 
-long int initdram (int board_type)
+phys_size_t initdram (int board_type)
 {
        long dram_size = 0;
 
@@ -116,37 +127,6 @@ long int initdram (int board_type)
        return dram_size;
 }
 
-
-#if defined(CFG_DRAM_TEST)
-int testdram (void)
-{
-       uint *pstart = (uint *) 0x00000000;
-       uint *pend = (uint *) 0x08000000;
-       uint *p;
-
-       for (p = pstart; p < pend; p++)
-               *p = 0xaaaaaaaa;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0xaaaaaaaa) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-
-       for (p = pstart; p < pend; p++)
-               *p = 0x55555555;
-
-       for (p = pstart; p < pend; p++) {
-               if (*p != 0x55555555) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
-                       return 1;
-               }
-       }
-       return 0;
-}
-#endif
-
 #if !defined(CONFIG_SPD_EEPROM)
 /*************************************************************************
  *  fixed sdram init -- doesn't use serial presence detect.
@@ -219,7 +199,7 @@ int pci_pre_init(struct pci_controller * hose )
                return (0);
        }
 
-#if defined(CFG_PCI_FORCE_PCI_CONV)
+#if defined(CONFIG_SYS_PCI_FORCE_PCI_CONV)
        /* Setup System Device Register PCIX0_XCR */
        mfsdr(sdr_xcr, strap);
        strap &= 0x0f000000;
@@ -237,7 +217,7 @@ int pci_pre_init(struct pci_controller * hose )
  *     may not be sufficient for a given board.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT)
+#if defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT)
 void pci_target_init(struct pci_controller * hose )
 {
        /*--------------------------------------------------------------------------+
@@ -252,7 +232,7 @@ void pci_target_init(struct pci_controller * hose )
         * Map all of SDRAM to PCI address 0x0000_0000. Note that the 440 strapping
         * options to not support sizes such as 128/256 MB.
         *--------------------------------------------------------------------------*/
-       out32r( PCIX0_PIM0LAL, CFG_SDRAM_BASE );
+       out32r( PCIX0_PIM0LAL, CONFIG_SYS_SDRAM_BASE );
        out32r( PCIX0_PIM0LAH, 0 );
        out32r( PCIX0_PIM0SA, ~(gd->ram_size - 1) | 1 );
 
@@ -261,12 +241,12 @@ void pci_target_init(struct pci_controller * hose )
        /*--------------------------------------------------------------------------+
         * Program the board's subsystem id/vendor id
         *--------------------------------------------------------------------------*/
-       out16r( PCIX0_SBSYSVID, CFG_PCI_SUBSYS_VENDORID );
-       out16r( PCIX0_SBSYSID, CFG_PCI_SUBSYS_DEVICEID );
+       out16r( PCIX0_SBSYSVID, CONFIG_SYS_PCI_SUBSYS_VENDORID );
+       out16r( PCIX0_SBSYSID, CONFIG_SYS_PCI_SUBSYS_DEVICEID );
 
        out16r( PCIX0_CMD, in16r(PCIX0_CMD) | PCI_COMMAND_MEMORY );
 }
-#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT) */
+#endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */
 
 
 /*************************************************************************
@@ -287,7 +267,7 @@ void pci_target_init(struct pci_controller * hose )
 #if defined(CONFIG_PCI)
 int is_pci_host(struct pci_controller *hose)
 {
-       return ((in32(CFG_GPIO_BASE + 0x1C) & 0x00000800) == 0);
+       return ((in32(CONFIG_SYS_GPIO_BASE + 0x1C) & 0x00000800) == 0);
 }
 #endif /* defined(CONFIG_PCI) */
 
@@ -305,7 +285,7 @@ int post_hotkeys_pressed(void)
 void post_word_store (ulong a)
 {
        volatile ulong *save_addr =
-               (volatile ulong *)(CFG_POST_WORD_ADDR);
+               (volatile ulong *)(CONFIG_SYS_POST_WORD_ADDR);
 
        *save_addr = a;
 }
@@ -313,7 +293,7 @@ void post_word_store (ulong a)
 ulong post_word_load (void)
 {
        volatile ulong *save_addr =
-               (volatile ulong *)(CFG_POST_WORD_ADDR);
+               (volatile ulong *)(CONFIG_SYS_POST_WORD_ADDR);
 
        return *save_addr;
 }
@@ -323,29 +303,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 (CFG_I2C_SPEED, CFG_I2C_SLAVE);
+       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;
 }