#include <asm/arch/sys_proto.h>
 #include <asm/utils.h>
 #include <asm/omap_gpio.h>
+#include <asm/emif.h>
 
 #ifndef CONFIG_SPL_BUILD
 /*
         * Core DPLL will be locked after setting up EMIF
         * using the FREQ_UPDATE method(freq_update_core())
         */
-       if (omap_revision() != OMAP5432_ES1_0)
+       if (emif_sdram_type() == EMIF_SDRAM_TYPE_LPDDR2)
                do_setup_dpll(&prcm->cm_clkmode_dpll_core, params,
                                                        DPLL_NO_LOCK, "core");
        else
 
                return 0;
 }
 
+/*
+ * Get SDRAM type connected to EMIF.
+ * Assuming similar SDRAM parts are connected to both EMIF's
+ * which is typically the case. So it is sufficient to get
+ * SDRAM type from EMIF1.
+ */
+u32 emif_sdram_type()
+{
+       struct emif_reg_struct *emif = (struct emif_reg_struct *)EMIF1_BASE;
+
+       return (readl(&emif->emif_sdram_config) &
+               EMIF_REG_SDRAM_TYPE_MASK) >> EMIF_REG_SDRAM_TYPE_SHIFT;
+}
 
 static inline u32 get_mr(u32 base, u32 cs, u32 mr_addr)
 {
         * OPP to another)
         */
        if (!(in_sdram || warm_reset())) {
-               if (omap_revision() != OMAP5432_ES1_0)
+               if (emif_sdram_type() == EMIF_SDRAM_TYPE_LPDDR2)
                        lpddr2_init(base, regs);
                else
                        ddr3_init(base, regs);
 void sdram_init(void)
 {
        u32 in_sdram, size_prog, size_detect;
-       u32 omap_rev = omap_revision();
+       u32 sdram_type = emif_sdram_type();
 
        debug(">>sdram_init()\n");
 
        debug("in_sdram = %d\n", in_sdram);
 
        if (!(in_sdram || warm_reset())) {
-               if (omap_rev != OMAP5432_ES1_0)
+               if (sdram_type == EMIF_SDRAM_TYPE_LPDDR2)
                        bypass_dpll(&prcm->cm_clkmode_dpll_core);
                else
                        writel(CM_DLL_CTRL_NO_OVERRIDE, &prcm->cm_dll_ctrl);
        }
 
        /* for the shadow registers to take effect */
-       if (omap_rev != OMAP5432_ES1_0)
+       if (sdram_type == EMIF_SDRAM_TYPE_LPDDR2)
                freq_update_core();
 
        /* Do some testing after the init */
 
 #include <asm/arch/sys_proto.h>
 #include <asm/utils.h>
 #include <asm/omap_gpio.h>
+#include <asm/emif.h>
 
 #ifndef CONFIG_SPL_BUILD
 /*
        do_scale_vcore(SMPS_REG_ADDR_12_MPU, volt_mpu);
        do_scale_vcore(SMPS_REG_ADDR_45_IVA, volt_mm);
 
-       if (omap_revision() == OMAP5432_ES1_0) {
+       if (emif_sdram_type() == EMIF_SDRAM_TYPE_DDR3) {
                /* Configure LDO SRAM "magic" bits */
                writel(2, &prcm->prm_sldo_core_setup);
                writel(2, &prcm->prm_sldo_mpu_setup);
 
 #define MR8_IO_WIDTH_SHIFT     0x6
 #define MR8_IO_WIDTH_MASK      (0x3 << 0x6)
 
+/* SDRAM TYPE */
+#define EMIF_SDRAM_TYPE_DDR2   0x2
+#define EMIF_SDRAM_TYPE_DDR3   0x3
+#define EMIF_SDRAM_TYPE_LPDDR2 0x4
+
 struct lpddr2_addressing {
        u8      num_banks;
        u8      t_REFI_us_x10;
 #endif
 
 void config_data_eye_leveling_samples(u32 emif_base);
+u32 emif_sdram_type(void);
 #endif