]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
omap4: make SDRAM init work for ES1.0 silicon
authorAneesh V <aneesh@ti.com>
Thu, 8 Sep 2011 15:05:53 +0000 (11:05 -0400)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Tue, 13 Sep 2011 06:25:15 +0000 (08:25 +0200)
SDRAM init was not working on ES1.0 due to a programming
error. A pointer that was passed by value to a function
was set in function emif_get_device_details(), but the effect
wouldn't be seen in the calling function. The issue came
out while testing for ES1.0 because ES1.0 doesn't have any
SDRAM chips connected to CS1

Signed-off-by: Aneesh V <aneesh@ti.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
arch/arm/cpu/armv7/omap4/emif.c
arch/arm/cpu/armv7/omap4/sdram_elpida.c
arch/arm/include/asm/arch-omap4/emif.h

index 487ec421197871c67c58e6ee1d3a179c8400fe2c..8c46464988c23cb45b631bc09f266612d1e98045 100644 (file)
@@ -963,10 +963,11 @@ static u8 is_lpddr2_sdram_present(u32 base, u32 cs,
        return 1;
 }
 
-static struct lpddr2_device_details *get_lpddr2_details(u32 base, u8 cs,
+struct lpddr2_device_details *emif_get_device_details(u32 emif_nr, u8 cs,
                        struct lpddr2_device_details *lpddr2_dev_details)
 {
        u32 phy;
+       u32 base = (emif_nr == 1) ? OMAP44XX_EMIF1 : OMAP44XX_EMIF2;
        struct emif_reg_struct *emif = (struct emif_reg_struct *)base;
 
        if (!lpddr2_dev_details)
@@ -985,40 +986,6 @@ static struct lpddr2_device_details *get_lpddr2_details(u32 base, u8 cs,
 
        return lpddr2_dev_details;
 }
-
-void emif_get_device_details(u32 emif_nr,
-               struct lpddr2_device_details *cs0_device_details,
-               struct lpddr2_device_details *cs1_device_details)
-{
-       u32 base = (emif_nr == 1) ? OMAP44XX_EMIF1 : OMAP44XX_EMIF2;
-
-       if (running_from_sdram()) {
-               /*
-                * We can not do automatic discovery running from SDRAM
-                * Most likely we came here by mistake. Indicate error
-                * by returning NULL
-                */
-               cs0_device_details = NULL;
-               cs1_device_details = NULL;
-       } else {
-               /*
-                * Automatically find the device details:
-                *
-                * Reset the PHY after each call to get_lpddr2_details().
-                * If there is nothing connected to a given chip select
-                * (typically CS1) mode register reads will mess up with
-                * the PHY state and subsequent initialization won't work.
-                * PHY reset brings back PHY to a good state.
-                */
-               cs0_device_details =
-                   get_lpddr2_details(base, CS0, cs0_device_details);
-               emif_reset_phy(base);
-
-               cs1_device_details =
-                   get_lpddr2_details(base, CS1, cs1_device_details);
-               emif_reset_phy(base);
-       }
-}
 #endif /* CONFIG_SYS_AUTOMATIC_SDRAM_DETECTION */
 
 static void do_sdram_init(u32 base)
@@ -1051,10 +1018,12 @@ static void do_sdram_init(u32 base)
         * - Obtained from user otherwise
         */
        struct lpddr2_device_details cs0_dev_details, cs1_dev_details;
-       emif_get_device_details(emif_nr, &cs0_dev_details,
-                               &cs1_dev_details);
-       dev_details.cs0_device_details = &cs0_dev_details;
-       dev_details.cs1_device_details = &cs1_dev_details;
+       emif_reset_phy(base);
+       dev_details.cs0_device_details = emif_get_device_details(base, CS0,
+                                               &cs0_dev_details);
+       dev_details.cs1_device_details = emif_get_device_details(base, CS1,
+                                               &cs1_dev_details);
+       emif_reset_phy(base);
 
        /* Return if no devices on this EMIF */
        if (!dev_details.cs0_device_details &&
index 7757aad2bac22ebb537fc3af58d82df045cd4258..edc5326c3897a445547a61238ad9780142f84059 100644 (file)
@@ -141,24 +141,24 @@ static const struct lpddr2_device_details elpida_2G_S4_details = {
        .manufacturer   = LPDDR2_MANUFACTURER_ELPIDA
 };
 
-static void emif_get_device_details_sdp(u32 emif_nr,
-               struct lpddr2_device_details *cs0_device_details,
-               struct lpddr2_device_details *cs1_device_details)
+struct lpddr2_device_details *emif_get_device_details_sdp(u32 emif_nr, u8 cs,
+                       struct lpddr2_device_details *lpddr2_dev_details)
 {
        u32 omap_rev = omap_revision();
 
        /* EMIF1 & EMIF2 have identical configuration */
-       *cs0_device_details = elpida_2G_S4_details;
-
-       if (omap_rev == OMAP4430_ES1_0)
-               cs1_device_details = NULL;
-       else
-               *cs1_device_details = elpida_2G_S4_details;
+       if ((omap_rev == OMAP4430_ES1_0) && (cs == CS1)) {
+               /* Nothing connected on CS1 for ES1.0 */
+               return NULL;
+       } else {
+               /* In all other cases Elpida 2G device */
+               *lpddr2_dev_details = elpida_2G_S4_details;
+               return lpddr2_dev_details;
+       }
 }
 
-void emif_get_device_details(u32 emif_nr,
-               struct lpddr2_device_details *cs0_device_details,
-               struct lpddr2_device_details *cs1_device_details)
+struct lpddr2_device_details *emif_get_device_details(u32 emif_nr, u8 cs,
+                       struct lpddr2_device_details *lpddr2_dev_details)
        __attribute__((weak, alias("emif_get_device_details_sdp")));
 
 #endif /* CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS */
index 37ad1fdd3e01f07e3ba7b08501b40f6c060623dd..6845c65b2d40d4b2205e8ccddc812a4ca88a3223 100644 (file)
@@ -1029,9 +1029,8 @@ struct emif_regs {
 void emif_get_reg_dump(u32 emif_nr, const struct emif_regs **regs);
 void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs);
 #else
-void emif_get_device_details(u32 emif_nr,
-               struct lpddr2_device_details *cs0_device_details,
-               struct lpddr2_device_details *cs1_device_details);
+struct lpddr2_device_details *emif_get_device_details(u32 emif_nr, u8 cs,
+                       struct lpddr2_device_details *lpddr2_dev_details);
 void emif_get_device_timings(u32 emif_nr,
                const struct lpddr2_device_timings **cs0_device_timings,
                const struct lpddr2_device_timings **cs1_device_timings);