]> git.sur5r.net Git - u-boot/commitdiff
Merge with git://www.denx.de/git/u-boot.git
authorStefan Roese <sr@denx.de>
Mon, 16 Jul 2007 11:28:47 +0000 (13:28 +0200)
committerStefan Roese <sr@denx.de>
Mon, 16 Jul 2007 11:28:47 +0000 (13:28 +0200)
board/amcc/luan/luan.c
board/amcc/yucca/yucca.c
board/lwmon5/sdram.c
cpu/ppc4xx/44x_spd_ddr.c
cpu/ppc4xx/44x_spd_ddr2.c
cpu/ppc4xx/4xx_enet.c
cpu/ppc4xx/tlb.c
include/asm-ppc/mmu.h
include/configs/luan.h
include/configs/lwmon5.h

index 2eff3b33fdef4744b836fd622f66ae1c43315deb..7b16f8a39ac0cbfa15e4d6e0e3521a2455ccff36 100644 (file)
@@ -104,6 +104,13 @@ int checkboard(void)
        return  0;
 }
 
+/*
+ * Override the default functions in cpu/ppc4xx/44x_spd_ddr2.c with
+ * board specific values.
+ */
+u32 ddr_clktr(u32 default_val) {
+       return (SDRAM_CLKTR_CLKP_180_DEG_ADV);
+}
 
 /*************************************************************************
  *  int testdram()
index 7316c34b4a7d8adc1a5de0e853579d7d464d6a38..d08fcf3565ffc618eb0e3b2ce0fdc1e70b75d62d 100644 (file)
@@ -562,6 +562,40 @@ int checkboard (void)
        return 0;
 }
 
+/*
+ * Override the default functions in cpu/ppc4xx/44x_spd_ddr2.c with
+ * board specific values.
+ */
+static int ppc440spe_rev_a(void)
+{
+       if ((get_pvr() == PVR_440SPe_6_RA) || (get_pvr() == PVR_440SPe_RA))
+               return 1;
+       else
+               return 0;
+}
+
+u32 ddr_wrdtr(u32 default_val) {
+       /*
+        * Yucca boards with 440SPe rev. A need a slightly different setup
+        * for the MCIF0_WRDTR register.
+        */
+       if (ppc440spe_rev_a())
+               return (SDRAM_WRDTR_LLWP_1_CYC | SDRAM_WRDTR_WTR_270_DEG_ADV);
+
+       return default_val;
+}
+
+u32 ddr_clktr(u32 default_val) {
+       /*
+        * Yucca boards with 440SPe rev. A need a slightly different setup
+        * for the MCIF0_CLKTR register.
+        */
+       if (ppc440spe_rev_a())
+               return (SDRAM_CLKTR_CLKP_180_DEG_ADV);
+
+       return default_val;
+}
+
 #if defined(CFG_DRAM_TEST)
 int testdram (void)
 {
index 9a4a8eea8fbfa17e5593c56b467ba452eb191887..b6863b6a79bb7d349dc5ba9bbfae7483334a7f39 100644 (file)
@@ -54,7 +54,6 @@
 #define MY_TLB_WORD2_I_ENABLE  TLB_WORD2_I_ENABLE      /* disable caching on SDRAM */
 #endif
 
-void program_tlb(u32 phys_addr, u32 virt_addr, u32 size, u32 tlb_word2_i_value);
 void dcbz_area(u32 start_address, u32 num_bytes);
 void dflush(void);
 
index 6d6fba1802dffec8e61c5d46fee2ffba4874e145..e5f296eb0688361f165e9d29ca47f0b9d2a875ed 100644 (file)
@@ -271,7 +271,6 @@ typedef struct bank_param BANKPARMS;
 #ifdef CFG_SIMULATE_SPD_EEPROM
 extern unsigned char cfg_simulate_spd_eeprom[128];
 #endif
-void program_tlb(u32 phys_addr, u32 virt_addr, u32 size, u32 tlb_word2_i_value);
 
 static unsigned char spd_read(uchar chip, uint addr);
 static void get_spd_info(unsigned long *dimm_populated,
index 5fef27b984d57073b74b71e825b389cfbd69d46e..18b90ba5ac630b14a35f1ef7ab05f0b0535b9cc6 100644 (file)
 /* Defines for the Read Cycle Delay test */
 #define NUMMEMTESTS    8
 #define NUMMEMWORDS    8
-#define NUMLOOPS       256             /* memory test loops */
+#define NUMLOOPS       64              /* memory test loops */
 
 #undef CONFIG_ECC_ERROR_RESET          /* test-only: see description below, at check_ecc() */
 
@@ -138,6 +138,26 @@ void __spd_ddr_init_hang (void)
 }
 void spd_ddr_init_hang (void) __attribute__((weak, alias("__spd_ddr_init_hang")));
 
+/*
+ * To provide an interface for board specific config values in this common
+ * DDR setup code, we implement he "weak" default functions here. They return
+ * the default value back to the caller.
+ *
+ * Please see include/configs/yucca.h for an example fora board specific
+ * implementation.
+ */
+u32 __ddr_wrdtr(u32 default_val)
+{
+       return default_val;
+}
+u32 ddr_wrdtr(u32) __attribute__((weak, alias("__ddr_wrdtr")));
+
+u32 __ddr_clktr(u32 default_val)
+{
+       return default_val;
+}
+u32 ddr_clktr(u32) __attribute__((weak, alias("__ddr_clktr")));
+
 
 /* Private Structure Definitions */
 
@@ -154,7 +174,6 @@ typedef enum ddr_cas_id {
  * Prototypes
  *-----------------------------------------------------------------------------*/
 static unsigned long sdram_memsize(void);
-void program_tlb(u32 phys_addr, u32 virt_addr, u32 size, u32 tlb_word2_i_value);
 static void get_spd_info(unsigned long *dimm_populated,
                         unsigned char *iic0_dimm_addr,
                         unsigned long num_dimm_banks);
@@ -216,9 +235,7 @@ static void test(void);
 #else
 static void    DQS_calibration_process(void);
 #endif
-#if defined(DEBUG)
 static void ppc440sp_sdram_register_dump(void);
-#endif
 int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 void dcbz_area(u32 start_address, u32 num_bytes);
 void dflush(void);
@@ -469,17 +486,14 @@ long int initdram(int board_type)
         *-----------------------------------------------------------------*/
        mfsdram(SDRAM_WRDTR, val);
        mtsdram(SDRAM_WRDTR, (val & ~(SDRAM_WRDTR_LLWP_MASK | SDRAM_WRDTR_WTR_MASK)) |
-               (SDRAM_WRDTR_LLWP_1_CYC | SDRAM_WRDTR_WTR_90_DEG_ADV));
+               ddr_wrdtr(SDRAM_WRDTR_LLWP_1_CYC | SDRAM_WRDTR_WTR_90_DEG_ADV));
 
        /*------------------------------------------------------------------
         * Set the SDRAM Clock Timing Register
         *-----------------------------------------------------------------*/
        mfsdram(SDRAM_CLKTR, val);
-#ifdef CFG_44x_DDR2_CKTR_180
-       mtsdram(SDRAM_CLKTR, (val & ~SDRAM_CLKTR_CLKP_MASK) | SDRAM_CLKTR_CLKP_180_DEG_ADV);
-#else
-       mtsdram(SDRAM_CLKTR, (val & ~SDRAM_CLKTR_CLKP_MASK) | SDRAM_CLKTR_CLKP_0_DEG);
-#endif
+       mtsdram(SDRAM_CLKTR, (val & ~SDRAM_CLKTR_CLKP_MASK) |
+               ddr_clktr(SDRAM_CLKTR_CLKP_0_DEG));
 
        /*------------------------------------------------------------------
         * Program the BxCF registers.
@@ -538,7 +552,12 @@ long int initdram(int board_type)
        dram_size = sdram_memsize();
 
        /* and program tlb entries for this size (dynamic) */
-       program_tlb(0, 0, dram_size, MY_TLB_WORD2_I_ENABLE);
+
+       /*
+        * Program TLB entries with caches enabled, for best performace
+        * while auto-calibrating and ECC generation
+        */
+       program_tlb(0, 0, dram_size, 0);
 
        /*------------------------------------------------------------------
         * DQS calibration.
@@ -549,12 +568,18 @@ long int initdram(int board_type)
        /*------------------------------------------------------------------
         * If ecc is enabled, initialize the parity bits.
         *-----------------------------------------------------------------*/
-       program_ecc(dimm_populated, iic0_dimm_addr, num_dimm_banks, MY_TLB_WORD2_I_ENABLE);
+       program_ecc(dimm_populated, iic0_dimm_addr, num_dimm_banks, 0);
 #endif
 
-#ifdef DEBUG
+       /*
+        * Now after initialization (auto-calibration and ECC generation)
+        * remove the TLB entries with caches enabled and program again with
+        * desired cache functionality
+        */
+       remove_tlb(0, dram_size);
+       program_tlb(0, 0, dram_size, MY_TLB_WORD2_I_ENABLE);
+
        ppc440sp_sdram_register_dump();
-#endif
 
        return dram_size;
 }
@@ -2703,6 +2728,7 @@ calibration_loop:
                printf("\nERROR: Cannot determine a common read delay for the "
                       "DIMM(s) installed.\n");
                debug("%s[%d] ERROR : \n", __FUNCTION__,__LINE__);
+               ppc440sp_sdram_register_dump();
                spd_ddr_init_hang ();
        }
 
@@ -3028,5 +3054,9 @@ static void ppc440sp_sdram_register_dump(void)
        dcr_data = mfdcr(SDRAM_R3BAS);
        printf("        MQ3_B0BAS       = 0x%08X\n", dcr_data);
 }
+#else
+static void ppc440sp_sdram_register_dump(void)
+{
+}
 #endif
 #endif /* CONFIG_SPD_EEPROM */
index 1200d021af62a832477843e805a32caffdc8e0c6..b90363f47ab5b33631a13d9e94988f00015bda0b 100644 (file)
@@ -1415,10 +1415,8 @@ static void enet_rcv (struct eth_device *dev, unsigned long malisr)
                        if ((MAL_RX_CTRL_EMPTY & hw_p->rx[i].ctrl)
                            || (loop_count >= NUM_RX_BUFF))
                                break;
+
                        loop_count++;
-                       hw_p->rx_slot++;
-                       if (NUM_RX_BUFF == hw_p->rx_slot)
-                               hw_p->rx_slot = 0;
                        handled++;
                        data_len = (unsigned long) hw_p->rx[i].data_len;        /* Get len */
                        if (data_len) {
@@ -1468,6 +1466,10 @@ static void enet_rcv (struct eth_device *dev, unsigned long malisr)
                                if (NUM_RX_BUFF == hw_p->rx_i_index)
                                        hw_p->rx_i_index = 0;
 
+                               hw_p->rx_slot++;
+                               if (NUM_RX_BUFF == hw_p->rx_slot)
+                                       hw_p->rx_slot = 0;
+
                                /*  AS.HARNOIS
                                 * free receive buffer only when
                                 * buffer has been handled (eth_rx)
index 049a78549505272e37f6de874d15752c12331527..098694caf4946704aed9344e808897b955064848 100644 (file)
@@ -25,7 +25,6 @@
 
 #if defined(CONFIG_440)
 
-#include <ppc4xx.h>
 #include <ppc440.h>
 #include <asm/io.h>
 #include <asm/mmu.h>
@@ -36,6 +35,67 @@ typedef struct region {
        unsigned long tlb_word2_i_value;
 } region_t;
 
+void remove_tlb(u32 vaddr, u32 size)
+{
+       int i;
+       u32 tlb_word0_value;
+       u32 tlb_vaddr;
+       u32 tlb_size = 0;
+
+       /* First, find the index of a TLB entry not being used */
+       for (i=0; i<PPC4XX_TLB_SIZE; i++) {
+               tlb_word0_value = mftlb1(i);
+               tlb_vaddr = TLB_WORD0_EPN_DECODE(tlb_word0_value);
+               if (((tlb_word0_value & TLB_WORD0_V_MASK) == TLB_WORD0_V_ENABLE) &&
+                   (tlb_vaddr >= vaddr)) {
+                       /*
+                        * TLB is enabled and start address is lower or equal
+                        * than the area we are looking for. Now we only have
+                        * to check the size/end address for a match.
+                        */
+                       switch (tlb_word0_value & TLB_WORD0_SIZE_MASK) {
+                       case TLB_WORD0_SIZE_1KB:
+                               tlb_size = 1 << 10;
+                               break;
+                       case TLB_WORD0_SIZE_4KB:
+                               tlb_size = 4 << 10;
+                               break;
+                       case TLB_WORD0_SIZE_16KB:
+                               tlb_size = 16 << 10;
+                               break;
+                       case TLB_WORD0_SIZE_64KB:
+                               tlb_size = 64 << 10;
+                               break;
+                       case TLB_WORD0_SIZE_256KB:
+                               tlb_size = 256 << 10;
+                               break;
+                       case TLB_WORD0_SIZE_1MB:
+                               tlb_size = 1 << 20;
+                               break;
+                       case TLB_WORD0_SIZE_16MB:
+                               tlb_size = 16 << 20;
+                               break;
+                       case TLB_WORD0_SIZE_256MB:
+                               tlb_size = 256 << 20;
+                               break;
+                       }
+
+                       /*
+                        * Now check the end-address if it's in the range
+                        */
+                       if ((tlb_vaddr + tlb_size - 1) <= (vaddr + size - 1))
+                               /*
+                                * Found a TLB in the range.
+                                * Disable it by writing 0 to tlb0 word.
+                                */
+                               mttlb1(i, 0);
+               }
+       }
+
+       /* Execute an ISYNC instruction so that the new TLB entry takes effect */
+       asm("isync");
+}
+
 static int add_tlb_entry(unsigned long phys_addr,
                         unsigned long virt_addr,
                         unsigned long tlb_word0_size_value,
index 48fd9829506992bcd95da0fe8eaabbdd3d701933..b3cfa9b37268dde73f6a5cd70b04e327e01f63c7 100644 (file)
@@ -645,6 +645,9 @@ void mttlb3(unsigned long index, unsigned long value);
 unsigned long mftlb1(unsigned long index);
 unsigned long mftlb2(unsigned long index);
 unsigned long mftlb3(unsigned long index);
+
+void program_tlb(u32 phys_addr, u32 virt_addr, u32 size, u32 tlb_word2_i_value);
+void remove_tlb(u32 vaddr, u32 size);
 #endif /* __ASSEMBLY__ */
 
 #endif /* CONFIG_440 */
index cbb59c50eaf3a8c605f51910b8dcd12f8653df36..e192d06923361f108e11e8257170635f6ad6f8f1 100644 (file)
 #define CONFIG_SPD_EEPROM      1       /* Use SPD EEPROM for setup     */
 #define SPD_EEPROM_ADDRESS     {0x53, 0x52}    /* SPD i2c spd addresses*/
 #define CONFIG_DDR_ECC         1       /* with ECC support             */
-#define CFG_44x_DDR2_CKTR_180  1       /* use 180 deg advance          */
 
 /*-----------------------------------------------------------------------
  * I2C
index 1d87c73c7116cc277301050797d0045b4f42f274..c4b7c4ee504196abacaad0b4e284f909ca3cd5b4 100644 (file)
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
        "hostname=lwmon5\0"                                             \
        "netdev=eth0\0"                                                 \
+       "unlock=yes\0"                                                  \
        "nfsargs=setenv bootargs root=/dev/nfs rw "                     \
                "nfsroot=${serverip}:${rootpath}\0"                     \
        "ramargs=setenv bootargs root=/dev/ram rw\0"                    \
        "update=protect off FFF80000 FFFFFFFF;era FFF80000 FFFFFFFF;"   \
                "cp.b 200000 FFF80000 80000\0"                          \
        "upd=run load;run update\0"                                     \
+       "lwe_env=tftp 200000 /tftpboot.dev/lwmon5/env_uboot.bin;"       \
+               "autoscr 200000\0"                                      \
        ""
 #define CONFIG_BOOTCOMMAND     "run flash_self"