]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
imx: mx6: ddr init MMDC according to ddr_type
authorPeng Fan <Peng.Fan@freescale.com>
Mon, 17 Aug 2015 08:11:03 +0000 (16:11 +0800)
committerStefano Babic <sbabic@denx.de>
Wed, 2 Sep 2015 13:34:12 +0000 (15:34 +0200)
To i.MX6, DDR3 and LPDDR2 is supported, so rename function mx6_dram_cfg
to mx6_ddr3_cfg and the original mx6_dram_cfg function only is a wrapper.
The new reimplemented function mx6_dram_cfg only invokes mx6_ddr3_cfg
when ddr_type is for DDR3. Later we can use ddr_type to initialize
MMDC for LPDDR2.

Initialize ddr_type for different boards which enable SPL.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Stefan Roese <sr@denx.de>
arch/arm/cpu/armv7/mx6/ddr.c
arch/arm/include/asm/arch-mx6/mx6-ddr.h
board/barco/platinum/spl_picon.c
board/barco/platinum/spl_titanium.c
board/freescale/mx6sabresd/mx6sabresd.c
board/freescale/mx6sxsabresd/mx6sxsabresd.c
board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
board/gateworks/gw_ventana/gw_ventana_spl.c
board/solidrun/mx6cuboxi/mx6cuboxi.c

index 3f23abfd198395a1e606cdea264868d0cb3a6540..17909a35b7e3b6ab930dfde0179667568e814f62 100644 (file)
@@ -348,7 +348,7 @@ void mx6sdl_dram_iocfg(unsigned width,
                mmdc1->entry = value;                                     \
        } while (0)
 
-void mx6_dram_cfg(const struct mx6_ddr_sysinfo *sysinfo,
+void mx6_ddr3_cfg(const struct mx6_ddr_sysinfo *sysinfo,
                  const struct mx6_mmdc_calibration *calib,
                  const struct mx6_ddr3_cfg *ddr3_cfg)
 {
@@ -655,3 +655,15 @@ void mx6_dram_cfg(const struct mx6_ddr_sysinfo *sysinfo,
        /* wait for auto-ZQ calibration to complete */
        mdelay(1);
 }
+
+void mx6_dram_cfg(const struct mx6_ddr_sysinfo *sysinfo,
+                 const struct mx6_mmdc_calibration *calib,
+                 const void *ddr_cfg)
+{
+       if (sysinfo->ddr_type == DDR_TYPE_DDR3) {
+               mx6_ddr3_cfg(sysinfo, calib, ddr_cfg);
+       } else {
+               puts("Unsupported ddr type\n");
+               hang();
+       }
+}
index 806fafb0690074fd348daa84a8d3c37a05ea3d2f..36fcb2b6fc0c1c1e193651937a7c6cb1916e033c 100644 (file)
@@ -444,7 +444,7 @@ void mx6sl_dram_iocfg(unsigned width,
 /* configure mx6 mmdc registers */
 void mx6_dram_cfg(const struct mx6_ddr_sysinfo *,
                  const struct mx6_mmdc_calibration *,
-                 const struct mx6_ddr3_cfg *);
+                 const void *);
 
 #endif /* CONFIG_SPL_BUILD */
 
index f421c2108c90a69570313ce23e479bdd6e59d906..098542fbd210dc3f9e4039eda1e8dfe402025656 100644 (file)
@@ -137,6 +137,7 @@ static void spl_dram_init(int width)
                .bi_on = 1,     /* Bank interleaving enabled */
                .sde_to_rst = 0x10,     /* 14 cycles, 200us (JEDEC default) */
                .rst_to_cke = 0x23,     /* 33 cycles, 500us (JEDEC default) */
+               .ddr_type = DDR_TYPE_DDR3,
        };
 
        mx6sdl_dram_iocfg(width, &mx6sdl_ddr_ioregs, &mx6sdl_grp_ioregs);
index 26fe26ba2b91327f03664511d034676c049efb3f..a3a42551b0540c23a6ede0d3e21fd25518683b46 100644 (file)
@@ -140,6 +140,7 @@ static void spl_dram_init(int width)
                .bi_on = 1,     /* Bank interleaving enabled */
                .sde_to_rst = 0x10,     /* 14 cycles, 200us (JEDEC default) */
                .rst_to_cke = 0x23,     /* 33 cycles, 500us (JEDEC default) */
+               .ddr_type = DDR_TYPE_DDR3,
        };
 
        mx6dq_dram_iocfg(width, &mx6dq_ddr_ioregs, &mx6dq_grp_ioregs);
index eb8a8b38266a7fa685f15066eb234d1a630386c1..564416700857203a62fe5fc2e0c3146cbe8507f8 100644 (file)
@@ -824,6 +824,7 @@ static void spl_dram_init(void)
                .bi_on = 1,     /* Bank interleaving enabled */
                .sde_to_rst = 0x10,     /* 14 cycles, 200us (JEDEC default) */
                .rst_to_cke = 0x23,     /* 33 cycles, 500us (JEDEC default) */
+               .ddr_type = DDR_TYPE_DDR3,
        };
 
        mx6dq_dram_iocfg(64, &mx6_ddr_ioregs, &mx6_grp_ioregs);
index ffc0046fb9a78ce0c0d83e1e1f30cb51f10b432a..b9af7e7b959b20c9250e581301cd0988541a3b24 100644 (file)
@@ -566,6 +566,7 @@ static void spl_dram_init(void)
                .bi_on = 1,             /* Bank interleaving enabled */
                .sde_to_rst = 0x10,     /* 14 cycles, 200us (JEDEC default) */
                .rst_to_cke = 0x23,     /* 33 cycles, 500us (JEDEC default) */
+               .ddr_type = DDR_TYPE_DDR3,
        };
 
        mx6sx_dram_iocfg(mem_ddr.width, &mx6_ddr_ioregs, &mx6_grp_ioregs);
index d9af220b64b5b92675ed60920639ee952490c038..c09d84e5405c81cae2c7ce5b21221f16bf8b667c 100644 (file)
@@ -708,6 +708,7 @@ static void spl_dram_init(void)
                .bi_on = 1,             /* Bank interleaving enabled */
                .sde_to_rst = 0x10,     /* 14 cycles, 200us (JEDEC default) */
                .rst_to_cke = 0x23,     /* 33 cycles, 500us (JEDEC default) */
+               .ddr_type = DDR_TYPE_DDR3,
        };
 
        mx6ul_dram_iocfg(mem_ddr.width, &mx6_ddr_ioregs, &mx6_grp_ioregs);
index d4418e554c4aac209a37126d4e6b73b009ea6c0c..d28eb14f87e53c90ed9c426b13de03022083a85a 100644 (file)
@@ -365,6 +365,7 @@ static void spl_dram_init(int width, int size_mb, int board_model)
                .sde_to_rst = 0x10,     /* 14 cycles, 200us (JEDEC default) */
                .rst_to_cke = 0x23,     /* 33 cycles, 500us (JEDEC default) */
                .pd_fast_exit = 1, /* enable precharge power-down fast exit */
+               .ddr_type = DDR_TYPE_DDR3,
        };
 
        /*
index 8247e4368a4c4ef8501858802948a14d12db98c9..fc37f1eef06da5147e5403d4272d220836c9cfbc 100644 (file)
@@ -615,6 +615,7 @@ static void spl_dram_init(int width)
                .bi_on = 1,     /* Bank interleaving enabled */
                .sde_to_rst = 0x10,     /* 14 cycles, 200us (JEDEC default) */
                .rst_to_cke = 0x23,     /* 33 cycles, 500us (JEDEC default) */
+               .ddr_type = DDR_TYPE_DDR3,
        };
 
        if (is_cpu_type(MXC_CPU_MX6D) || is_cpu_type(MXC_CPU_MX6Q))