summaryrefslogtreecommitdiff
path: root/board/freescale
diff options
context:
space:
mode:
Diffstat (limited to 'board/freescale')
-rw-r--r--board/freescale/b4860qds/ddr.c6
-rw-r--r--board/freescale/b4860qds/spl.c2
-rw-r--r--board/freescale/c29xpcie/spl.c2
-rw-r--r--board/freescale/common/fsl_validate.c88
-rw-r--r--board/freescale/corenet_ds/ddr.c6
-rw-r--r--board/freescale/ls1021aqds/ddr.c10
-rw-r--r--board/freescale/ls1021aqds/ls1021aqds.c4
-rw-r--r--board/freescale/ls1043aqds/ddr.c6
-rw-r--r--board/freescale/ls1043aqds/ls1043aqds.c3
-rw-r--r--board/freescale/ls1043ardb/ddr.c6
-rw-r--r--board/freescale/ls1043ardb/ls1043ardb.c2
-rw-r--r--board/freescale/ls1046aqds/ddr.c6
-rw-r--r--board/freescale/ls1046aqds/ls1046aqds.c3
-rw-r--r--board/freescale/ls1046ardb/ddr.c6
-rw-r--r--board/freescale/ls2080a/ddr.c9
-rw-r--r--board/freescale/ls2080aqds/ddr.c10
-rw-r--r--board/freescale/ls2080aqds/ls2080aqds.c13
-rw-r--r--board/freescale/ls2080ardb/ddr.c10
-rw-r--r--board/freescale/ls2080ardb/ls2080ardb.c11
-rw-r--r--board/freescale/m5208evbe/m5208evbe.c6
-rw-r--r--board/freescale/m52277evb/m52277evb.c6
-rw-r--r--board/freescale/m5235evb/m5235evb.c6
-rw-r--r--board/freescale/m5249evb/m5249evb.c9
-rw-r--r--board/freescale/m5253demo/m5253demo.c8
-rw-r--r--board/freescale/m5253evbe/m5253evbe.c8
-rw-r--r--board/freescale/m5272c3/m5272c3.c8
-rw-r--r--board/freescale/m5275evb/m5275evb.c8
-rw-r--r--board/freescale/m5282evb/m5282evb.c6
-rw-r--r--board/freescale/m53017evb/m53017evb.c6
-rw-r--r--board/freescale/m5329evb/m5329evb.c6
-rw-r--r--board/freescale/m5373evb/m5373evb.c6
-rw-r--r--board/freescale/m54418twr/m54418twr.c6
-rw-r--r--board/freescale/m54451evb/m54451evb.c6
-rw-r--r--board/freescale/m54455evb/m54455evb.c6
-rw-r--r--board/freescale/m547xevb/m547xevb.c6
-rw-r--r--board/freescale/m548xevb/m548xevb.c6
-rw-r--r--board/freescale/mpc5121ads/mpc5121ads.c6
-rw-r--r--board/freescale/mpc8308rdb/sdram.c8
-rw-r--r--board/freescale/mpc8313erdb/mpc8313erdb.c4
-rw-r--r--board/freescale/mpc8313erdb/sdram.c8
-rw-r--r--board/freescale/mpc8315erdb/mpc8315erdb.c4
-rw-r--r--board/freescale/mpc8315erdb/sdram.c10
-rw-r--r--board/freescale/mpc8323erdb/mpc8323erdb.c12
-rw-r--r--board/freescale/mpc832xemds/mpc832xemds.c12
-rw-r--r--board/freescale/mpc8349emds/mpc8349emds.c12
-rw-r--r--board/freescale/mpc8349itx/mpc8349itx.c10
-rw-r--r--board/freescale/mpc837xemds/mpc837xemds.c10
-rw-r--r--board/freescale/mpc837xerdb/mpc837xerdb.c10
-rw-r--r--board/freescale/mpc8610hpcd/mpc8610hpcd.c9
-rw-r--r--board/freescale/mpc8641hpcn/mpc8641hpcn.c9
-rw-r--r--board/freescale/mx35pdk/mx35pdk.c4
-rw-r--r--board/freescale/mx53ard/mx53ard.c4
-rw-r--r--board/freescale/mx53loco/mx53loco.c4
-rw-r--r--board/freescale/mx53smd/mx53smd.c4
-rw-r--r--board/freescale/p1010rdb/spl.c2
-rw-r--r--board/freescale/p1022ds/spl.c2
-rw-r--r--board/freescale/p1_p2_rdb_pc/spl.c2
-rw-r--r--board/freescale/p2041rdb/ddr.c10
-rw-r--r--board/freescale/t102xqds/ddr.c6
-rw-r--r--board/freescale/t102xqds/spl.c2
-rw-r--r--board/freescale/t102xrdb/ddr.c6
-rw-r--r--board/freescale/t102xrdb/spl.c2
-rw-r--r--board/freescale/t1040qds/ddr.c6
-rw-r--r--board/freescale/t104xrdb/ddr.c6
-rw-r--r--board/freescale/t104xrdb/spl.c2
-rw-r--r--board/freescale/t208xqds/ddr.c6
-rw-r--r--board/freescale/t208xqds/spl.c2
-rw-r--r--board/freescale/t208xrdb/ddr.c6
-rw-r--r--board/freescale/t208xrdb/spl.c2
-rw-r--r--board/freescale/t4qds/ddr.c6
-rw-r--r--board/freescale/t4qds/spl.c2
-rw-r--r--board/freescale/t4rdb/ddr.c6
-rw-r--r--board/freescale/t4rdb/spl.c2
73 files changed, 361 insertions, 173 deletions
diff --git a/board/freescale/b4860qds/ddr.c b/board/freescale/b4860qds/ddr.c
index 99cd88466d..5cc2f73a16 100644
--- a/board/freescale/b4860qds/ddr.c
+++ b/board/freescale/b4860qds/ddr.c
@@ -176,7 +176,7 @@ found:
popts->cpo_sample = 0x3e;
}
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
phys_size_t dram_size;
@@ -189,7 +189,9 @@ phys_size_t initdram(int board_type)
dram_size = setup_ddr_tlbs(dram_size / 0x100000);
dram_size *= 0x100000;
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
unsigned long long step_assign_addresses(fsl_ddr_info_t *pinfo,
diff --git a/board/freescale/b4860qds/spl.c b/board/freescale/b4860qds/spl.c
index 35b812cb18..60d7f0d48a 100644
--- a/board/freescale/b4860qds/spl.c
+++ b/board/freescale/b4860qds/spl.c
@@ -108,7 +108,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
puts("\n\n");
- gd->ram_size = initdram(0);
+ dram_init();
#ifdef CONFIG_SPL_NAND_BOOT
nand_boot();
diff --git a/board/freescale/c29xpcie/spl.c b/board/freescale/c29xpcie/spl.c
index 6613216950..94093f11a8 100644
--- a/board/freescale/c29xpcie/spl.c
+++ b/board/freescale/c29xpcie/spl.c
@@ -67,7 +67,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
i2c_init_all();
- gd->ram_size = initdram(0);
+ dram_init();
#ifdef CONFIG_SPL_NAND_BOOT
puts("TPL\n");
diff --git a/board/freescale/common/fsl_validate.c b/board/freescale/common/fsl_validate.c
index 2b723a4b9c..7396aa2f69 100644
--- a/board/freescale/common/fsl_validate.c
+++ b/board/freescale/common/fsl_validate.c
@@ -27,6 +27,10 @@
#define CHECK_KEY_LEN(key_len) (((key_len) == 2 * KEY_SIZE_BYTES / 4) || \
((key_len) == 2 * KEY_SIZE_BYTES / 2) || \
((key_len) == 2 * KEY_SIZE_BYTES))
+#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+/* Global data structure */
+static struct fsl_secboot_glb glb;
+#endif
/* This array contains DER value for SHA-256 */
static const u8 hash_identifier[] = { 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60,
@@ -60,7 +64,7 @@ self:
#if defined(CONFIG_FSL_ISBC_KEY_EXT)
static u32 check_ie(struct fsl_secboot_img_priv *img)
{
- if (img->hdr.ie_flag)
+ if (img->hdr.ie_flag & IE_FLAG_MASK)
return 1;
return 0;
@@ -119,7 +123,21 @@ int get_csf_base_addr(u32 *csf_addr, u32 *flash_base_addr)
}
#endif
-static int get_ie_info_addr(u32 *ie_addr)
+#if defined(CONFIG_ESBC_HDR_LS)
+static int get_ie_info_addr(uintptr_t *ie_addr)
+{
+ struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+ /* For LS-CH3, the address of IE Table is
+ * stated in Scratch13 and scratch14 of DCFG.
+ * Bootrom validates this table while validating uboot.
+ * DCFG is LE*/
+ *ie_addr = in_le32(&gur->scratchrw[SCRATCH_IE_HIGH_ADR - 1]);
+ *ie_addr = *ie_addr << 32;
+ *ie_addr |= in_le32(&gur->scratchrw[SCRATCH_IE_LOW_ADR - 1]);
+ return 0;
+}
+#else /* CONFIG_ESBC_HDR_LS */
+static int get_ie_info_addr(uintptr_t *ie_addr)
{
struct fsl_secboot_img_hdr *hdr;
struct fsl_secboot_sg_table *sg_tbl;
@@ -147,16 +165,17 @@ static int get_ie_info_addr(u32 *ie_addr)
/* IE Key Table is the first entry in the SG Table */
#if defined(CONFIG_MPC85xx)
- *ie_addr = (sg_tbl->src_addr & ~(CONFIG_SYS_PBI_FLASH_BASE)) +
- flash_base_addr;
+ *ie_addr = (uintptr_t)((sg_tbl->src_addr &
+ ~(CONFIG_SYS_PBI_FLASH_BASE)) +
+ flash_base_addr);
#else
- *ie_addr = sg_tbl->src_addr;
+ *ie_addr = (uintptr_t)sg_tbl->src_addr;
#endif
- debug("IE Table address is %x\n", *ie_addr);
+ debug("IE Table address is %lx\n", *ie_addr);
return 0;
}
-
+#endif /* CONFIG_ESBC_HDR_LS */
#endif
#ifdef CONFIG_KEY_REVOCATION
@@ -164,7 +183,10 @@ static int get_ie_info_addr(u32 *ie_addr)
static u32 check_srk(struct fsl_secboot_img_priv *img)
{
#ifdef CONFIG_ESBC_HDR_LS
- /* In LS, No SRK Flag as SRK is always present*/
+ /* In LS, No SRK Flag as SRK is always present if IE not present*/
+#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+ return !check_ie(img);
+#endif
return 1;
#else
if (img->hdr.len_kr.srk_table_flag & SRK_FLAG)
@@ -253,14 +275,29 @@ static u32 read_validate_single_key(struct fsl_secboot_img_priv *img)
#endif /* CONFIG_ESBC_HDR_LS */
#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+
+static void install_ie_tbl(uintptr_t ie_tbl_addr,
+ struct fsl_secboot_img_priv *img)
+{
+ /* Copy IE tbl to Global Data */
+ memcpy(&glb.ie_tbl, (u8 *)ie_tbl_addr, sizeof(struct ie_key_info));
+ img->ie_addr = (uintptr_t)&glb.ie_tbl;
+ glb.ie_addr = img->ie_addr;
+}
+
static u32 read_validate_ie_tbl(struct fsl_secboot_img_priv *img)
{
struct fsl_secboot_img_hdr *hdr = &img->hdr;
u32 ie_key_len, ie_revoc_flag, ie_num;
struct ie_key_info *ie_info;
- if (get_ie_info_addr(&img->ie_addr))
- return ERROR_IE_TABLE_NOT_FOUND;
+ if (!img->ie_addr) {
+ if (get_ie_info_addr(&img->ie_addr))
+ return ERROR_IE_TABLE_NOT_FOUND;
+ else
+ install_ie_tbl(img->ie_addr, img);
+ }
+
ie_info = (struct ie_key_info *)(uintptr_t)img->ie_addr;
if (ie_info->num_keys == 0 || ie_info->num_keys > 32)
return ERROR_ESBC_CLIENT_HEADER_INVALID_IE_NUM_ENTRY;
@@ -786,6 +823,26 @@ static int calculate_cmp_img_sig(struct fsl_secboot_img_priv *img)
return 0;
}
+/* Function to initialize img priv and global data structure
+ */
+static int secboot_init(struct fsl_secboot_img_priv **img_ptr)
+{
+ *img_ptr = malloc(sizeof(struct fsl_secboot_img_priv));
+
+ struct fsl_secboot_img_priv *img = *img_ptr;
+
+ if (!img)
+ return -ENOMEM;
+ memset(img, 0, sizeof(struct fsl_secboot_img_priv));
+
+#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+ if (glb.ie_addr)
+ img->ie_addr = glb.ie_addr;
+#endif
+ return 0;
+}
+
+
/* haddr - Address of the header of image to be validated.
* arg_hash_str - Option hash string. If provided, this
* overrides the key hash in the SFP fuses.
@@ -839,12 +896,9 @@ int fsl_secboot_validate(uintptr_t haddr, char *arg_hash_str,
hash_cmd = 1;
}
- img = malloc(sizeof(struct fsl_secboot_img_priv));
-
- if (!img)
- return -1;
-
- memset(img, 0, sizeof(struct fsl_secboot_img_priv));
+ ret = secboot_init(&img);
+ if (ret)
+ goto exit;
/* Update the information in Private Struct */
hdr = &img->hdr;
@@ -899,5 +953,7 @@ int fsl_secboot_validate(uintptr_t haddr, char *arg_hash_str,
}
exit:
+ /* Free Img as it was malloc'ed*/
+ free(img);
return ret;
}
diff --git a/board/freescale/corenet_ds/ddr.c b/board/freescale/corenet_ds/ddr.c
index 9c1a4c2f7c..496d8415ec 100644
--- a/board/freescale/corenet_ds/ddr.c
+++ b/board/freescale/corenet_ds/ddr.c
@@ -260,7 +260,7 @@ found:
popts->ddr_cdr1 = DDR_CDR1_DHC_EN;
}
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
phys_size_t dram_size;
@@ -278,5 +278,7 @@ phys_size_t initdram(int board_type)
dram_size *= 0x100000;
debug(" DDR: ");
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/ls1021aqds/ddr.c b/board/freescale/ls1021aqds/ddr.c
index 2f66ba9e7f..d16a69fc98 100644
--- a/board/freescale/ls1021aqds/ddr.c
+++ b/board/freescale/ls1021aqds/ddr.c
@@ -164,7 +164,7 @@ void board_mem_sleep_setup(void)
}
#endif
-phys_size_t initdram(int board_type)
+int fsl_initdram(void)
{
phys_size_t dram_size;
@@ -179,11 +179,15 @@ phys_size_t initdram(int board_type)
fsl_dp_resume();
#endif
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
-void dram_init_banksize(void)
+int dram_init_banksize(void)
{
gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
gd->bd->bi_dram[0].size = gd->ram_size;
+
+ return 0;
}
diff --git a/board/freescale/ls1021aqds/ls1021aqds.c b/board/freescale/ls1021aqds/ls1021aqds.c
index 79078d237b..d81d8abc9b 100644
--- a/board/freescale/ls1021aqds/ls1021aqds.c
+++ b/board/freescale/ls1021aqds/ls1021aqds.c
@@ -162,9 +162,7 @@ int dram_init(void)
* before accessing DDR SPD.
*/
select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
- gd->ram_size = initdram(0);
-
- return 0;
+ return fsl_initdram();
}
#ifdef CONFIG_FSL_ESDHC
diff --git a/board/freescale/ls1043aqds/ddr.c b/board/freescale/ls1043aqds/ddr.c
index c740062887..2643f5bf4a 100644
--- a/board/freescale/ls1043aqds/ddr.c
+++ b/board/freescale/ls1043aqds/ddr.c
@@ -108,7 +108,7 @@ found:
#endif
}
-phys_size_t initdram(int board_type)
+int fsl_initdram(void)
{
phys_size_t dram_size;
@@ -125,5 +125,7 @@ phys_size_t initdram(int board_type)
fsl_dp_ddr_restore();
#endif
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/ls1043aqds/ls1043aqds.c b/board/freescale/ls1043aqds/ls1043aqds.c
index 6507c09143..2df63e468d 100644
--- a/board/freescale/ls1043aqds/ls1043aqds.c
+++ b/board/freescale/ls1043aqds/ls1043aqds.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <i2c.h>
#include <fdt_support.h>
+#include <fsl_ddr_sdram.h>
#include <asm/io.h>
#include <asm/arch/clock.h>
#include <asm/arch/fsl_serdes.h>
@@ -153,7 +154,7 @@ int dram_init(void)
* before accessing DDR SPD.
*/
select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
- gd->ram_size = initdram(0);
+ fsl_initdram();
#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
/* This will break-before-make MMU for DDR */
update_early_mmu_table();
diff --git a/board/freescale/ls1043ardb/ddr.c b/board/freescale/ls1043ardb/ddr.c
index f90b85df1a..36d27ecfae 100644
--- a/board/freescale/ls1043ardb/ddr.c
+++ b/board/freescale/ls1043ardb/ddr.c
@@ -170,7 +170,7 @@ int fsl_ddr_get_dimm_params(dimm_params_t *pdimm,
}
#endif
-phys_size_t initdram(int board_type)
+int fsl_initdram(void)
{
phys_size_t dram_size;
@@ -186,5 +186,7 @@ phys_size_t initdram(int board_type)
fsl_dp_ddr_restore();
#endif
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/ls1043ardb/ls1043ardb.c b/board/freescale/ls1043ardb/ls1043ardb.c
index 2333843958..728de2e3f1 100644
--- a/board/freescale/ls1043ardb/ls1043ardb.c
+++ b/board/freescale/ls1043ardb/ls1043ardb.c
@@ -23,9 +23,7 @@
#ifdef CONFIG_U_QE
#include <fsl_qe.h>
#endif
-#ifdef CONFIG_FSL_LS_PPA
#include <asm/arch/ppa.h>
-#endif
DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/freescale/ls1046aqds/ddr.c b/board/freescale/ls1046aqds/ddr.c
index dc4d689adc..d37af34a9c 100644
--- a/board/freescale/ls1046aqds/ddr.c
+++ b/board/freescale/ls1046aqds/ddr.c
@@ -92,7 +92,7 @@ found:
popts->cpo_sample = 0x70;
}
-phys_size_t initdram(int board_type)
+int fsl_initdram(void)
{
phys_size_t dram_size;
@@ -110,5 +110,7 @@ phys_size_t initdram(int board_type)
erratum_a008850_post();
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/ls1046aqds/ls1046aqds.c b/board/freescale/ls1046aqds/ls1046aqds.c
index af3f70a38b..69fc15b681 100644
--- a/board/freescale/ls1046aqds/ls1046aqds.c
+++ b/board/freescale/ls1046aqds/ls1046aqds.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <i2c.h>
#include <fdt_support.h>
+#include <fsl_ddr_sdram.h>
#include <asm/io.h>
#include <asm/arch/clock.h>
#include <asm/arch/fsl_serdes.h>
@@ -149,7 +150,7 @@ int dram_init(void)
* before accessing DDR SPD.
*/
select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
- gd->ram_size = initdram(0);
+ fsl_initdram();
#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
/* This will break-before-make MMU for DDR */
update_early_mmu_table();
diff --git a/board/freescale/ls1046ardb/ddr.c b/board/freescale/ls1046ardb/ddr.c
index efe2ba6eb1..a16f7bc83a 100644
--- a/board/freescale/ls1046ardb/ddr.c
+++ b/board/freescale/ls1046ardb/ddr.c
@@ -96,7 +96,7 @@ found:
popts->cpo_sample = 0x70;
}
-phys_size_t initdram(int board_type)
+int fsl_initdram(void)
{
phys_size_t dram_size;
@@ -110,5 +110,7 @@ phys_size_t initdram(int board_type)
erratum_a008850_post();
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/ls2080a/ddr.c b/board/freescale/ls2080a/ddr.c
index 5ed9e1461b..9d176d3851 100644
--- a/board/freescale/ls2080a/ddr.c
+++ b/board/freescale/ls2080a/ddr.c
@@ -158,14 +158,13 @@ int fsl_ddr_get_dimm_params(dimm_params_t *pdimm,
return 0;
}
#endif
-phys_size_t initdram(int board_type)
-{
- phys_size_t dram_size;
+int fsl_initdram(void)
+{
puts("Initializing DDR....");
puts("using SPD\n");
- dram_size = fsl_ddr_sdram();
+ gd->ram_size = fsl_ddr_sdram();
- return dram_size;
+ return 0;
}
diff --git a/board/freescale/ls2080aqds/ddr.c b/board/freescale/ls2080aqds/ddr.c
index 0408c0fc25..22a2676a95 100644
--- a/board/freescale/ls2080aqds/ddr.c
+++ b/board/freescale/ls2080aqds/ddr.c
@@ -155,17 +155,15 @@ found:
}
}
-phys_size_t initdram(int board_type)
+int fsl_initdram(void)
{
- phys_size_t dram_size;
-
#if defined(CONFIG_SPL) && !defined(CONFIG_SPL_BUILD)
- return fsl_ddr_sdram_size();
+ gd->ram_size = fsl_ddr_sdram_size();
#else
puts("Initializing DDR....using SPD\n");
- dram_size = fsl_ddr_sdram();
+ gd->ram_size = fsl_ddr_sdram();
#endif
- return dram_size;
+ return 0;
}
diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c
index 277013bfcc..6da9c6cfe8 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -19,6 +19,8 @@
#include <asm/arch/soc.h>
#include <hwconfig.h>
#include <fsl_sec.h>
+#include <asm/arch/ppa.h>
+
#include "../common/qixis.h"
#include "ls2080aqds_qixis.h"
@@ -225,6 +227,14 @@ int board_init(void)
select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
rtc_enable_32khz_output();
+#ifdef CONFIG_FSL_LS_PPA
+ ppa_init();
+#endif
+
+#ifdef CONFIG_FSL_CAAM
+ sec_init();
+#endif
+
return 0;
}
@@ -266,9 +276,6 @@ void detail_board_ddr_info(void)
#if defined(CONFIG_ARCH_MISC_INIT)
int arch_misc_init(void)
{
-#ifdef CONFIG_FSL_CAAM
- sec_init();
-#endif
return 0;
}
#endif
diff --git a/board/freescale/ls2080ardb/ddr.c b/board/freescale/ls2080ardb/ddr.c
index 2851d5b443..7002dfb236 100644
--- a/board/freescale/ls2080ardb/ddr.c
+++ b/board/freescale/ls2080ardb/ddr.c
@@ -158,17 +158,15 @@ found:
}
}
-phys_size_t initdram(int board_type)
+int fsl_initdram(void)
{
- phys_size_t dram_size;
-
#if defined(CONFIG_SPL) && !defined(CONFIG_SPL_BUILD)
- return fsl_ddr_sdram_size();
+ gd->ram_size = fsl_ddr_sdram_size();
#else
puts("Initializing DDR....using SPD\n");
- dram_size = fsl_ddr_sdram();
+ gd->ram_size = fsl_ddr_sdram();
#endif
- return dram_size;
+ return 0;
}
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
index 4c01f560bc..ea05ec6f65 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -19,6 +19,7 @@
#include <i2c.h>
#include <asm/arch/mmu.h>
#include <asm/arch/soc.h>
+#include <asm/arch/ppa.h>
#include <fsl_sec.h>
#include "../common/qixis.h"
@@ -181,10 +182,17 @@ int board_init(void)
QIXIS_WRITE(rst_ctl, QIXIS_RST_CTL_RESET_EN);
+#ifdef CONFIG_FSL_LS_PPA
+ ppa_init();
+#endif
+
#ifdef CONFIG_FSL_MC_ENET
/* invert AQR405 IRQ pins polarity */
out_le32(irq_ccsr + IRQCR_OFFSET / 4, AQR405_IRQ_MASK);
#endif
+#ifdef CONFIG_FSL_CAAM
+ sec_init();
+#endif
return 0;
}
@@ -223,9 +231,6 @@ void detail_board_ddr_info(void)
#if defined(CONFIG_ARCH_MISC_INIT)
int arch_misc_init(void)
{
-#ifdef CONFIG_FSL_CAAM
- sec_init();
-#endif
return 0;
}
#endif
diff --git a/board/freescale/m5208evbe/m5208evbe.c b/board/freescale/m5208evbe/m5208evbe.c
index 1df128b268..4b841c6221 100644
--- a/board/freescale/m5208evbe/m5208evbe.c
+++ b/board/freescale/m5208evbe/m5208evbe.c
@@ -22,7 +22,7 @@ int checkboard(void)
return 0;
};
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
sdram_t *sdram = (sdram_t *)(MMAP_SDRAM);
u32 dramsize, i;
@@ -68,7 +68,9 @@ phys_size_t initdram(int board_type)
udelay(100);
- return dramsize;
+ gd->ram_size = dramsize;
+
+ return 0;
};
int testdram(void)
diff --git a/board/freescale/m52277evb/m52277evb.c b/board/freescale/m52277evb/m52277evb.c
index a1127e52a3..e4dfb6fda0 100644
--- a/board/freescale/m52277evb/m52277evb.c
+++ b/board/freescale/m52277evb/m52277evb.c
@@ -21,7 +21,7 @@ int checkboard(void)
return 0;
};
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
u32 dramsize;
@@ -78,7 +78,9 @@ phys_size_t initdram(int board_type)
udelay(100);
#endif
- return (dramsize);
+ gd->ram_size = dramsize;
+
+ return 0;
};
int testdram(void)
diff --git a/board/freescale/m5235evb/m5235evb.c b/board/freescale/m5235evb/m5235evb.c
index 68c1631f81..93403f6748 100644
--- a/board/freescale/m5235evb/m5235evb.c
+++ b/board/freescale/m5235evb/m5235evb.c
@@ -22,7 +22,7 @@ int checkboard(void)
return 0;
};
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
sdram_t *sdram = (sdram_t *)(MMAP_SDRAM);
gpio_t *gpio = (gpio_t *)(MMAP_GPIO);
@@ -97,7 +97,9 @@ phys_size_t initdram(int board_type)
*(u32 *) (CONFIG_SYS_SDRAM_BASE + 0x400) = 0xA5A59696;
}
- return dramsize;
+ gd->ram_size = dramsize;
+
+ return 0;
};
int testdram(void)
diff --git a/board/freescale/m5249evb/m5249evb.c b/board/freescale/m5249evb/m5249evb.c
index 7ae842c3d3..7c9b599d66 100644
--- a/board/freescale/m5249evb/m5249evb.c
+++ b/board/freescale/m5249evb/m5249evb.c
@@ -10,6 +10,8 @@
#include <malloc.h>
#include <asm/immap.h>
+DECLARE_GLOBAL_DATA_PTR;
+
int checkboard (void) {
ulong val;
uchar val8;
@@ -29,7 +31,8 @@ int checkboard (void) {
};
-phys_size_t initdram (int board_type) {
+int dram_init(void)
+{
unsigned long junk = 0xa5a59696;
/*
@@ -81,7 +84,9 @@ phys_size_t initdram (int board_type) {
mbar_writeLong(MCFSIM_DACR0, 0x0000b364); /* Enable DACR0[IMRS] (bit 6); RE remains enabled */
*((volatile unsigned long *) 0x800) = junk; /* Access RAM to initialize the mode register */
- return CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
+ gd->ram_size = CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
+
+ return 0;
};
diff --git a/board/freescale/m5253demo/m5253demo.c b/board/freescale/m5253demo/m5253demo.c
index 7e516bfa40..c2cc2d76e4 100644
--- a/board/freescale/m5253demo/m5253demo.c
+++ b/board/freescale/m5253demo/m5253demo.c
@@ -13,6 +13,8 @@
#include <netdev.h>
#include <asm/io.h>
+DECLARE_GLOBAL_DATA_PTR;
+
int checkboard(void)
{
puts("Board: ");
@@ -20,7 +22,7 @@ int checkboard(void)
return 0;
};
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
u32 dramsize = 0;
@@ -73,7 +75,9 @@ phys_size_t initdram(int board_type)
mb();
}
- return dramsize;
+ gd->ram_size = dramsize;
+
+ return 0;
}
int testdram(void)
diff --git a/board/freescale/m5253evbe/m5253evbe.c b/board/freescale/m5253evbe/m5253evbe.c
index 15ff755a56..c1ed431190 100644
--- a/board/freescale/m5253evbe/m5253evbe.c
+++ b/board/freescale/m5253evbe/m5253evbe.c
@@ -12,6 +12,8 @@
#include <asm/immap.h>
#include <asm/io.h>
+DECLARE_GLOBAL_DATA_PTR;
+
int checkboard(void)
{
puts("Board: ");
@@ -19,7 +21,7 @@ int checkboard(void)
return 0;
};
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
/*
* Check to see if the SDRAM has already been initialized
@@ -66,7 +68,9 @@ phys_size_t initdram(int board_type)
*(u32 *) (CONFIG_SYS_SDRAM_BASE + 0x800) = 0xa5a5a5a5;
}
- return CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
+ gd->ram_size = CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
+
+ return 0;
}
int testdram(void)
diff --git a/board/freescale/m5272c3/m5272c3.c b/board/freescale/m5272c3/m5272c3.c
index 3ed4a7da93..efff465d0f 100644
--- a/board/freescale/m5272c3/m5272c3.c
+++ b/board/freescale/m5272c3/m5272c3.c
@@ -11,6 +11,7 @@
#include <asm/immap.h>
#include <asm/io.h>
+DECLARE_GLOBAL_DATA_PTR;
int checkboard (void) {
puts ("Board: ");
@@ -18,7 +19,8 @@ int checkboard (void) {
return 0;
};
-phys_size_t initdram (int board_type) {
+int dram_init(void)
+{
sdramctrl_t * sdp = (sdramctrl_t *)(MMAP_SDRAM);
out_be16(&sdp->sdram_sdtr, 0xf539);
@@ -27,7 +29,9 @@ phys_size_t initdram (int board_type) {
/* Dummy write to start SDRAM */
*((volatile unsigned long *)0) = 0;
- return CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
+ gd->ram_size = CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
+
+ return 0;
};
int testdram (void) {
diff --git a/board/freescale/m5275evb/m5275evb.c b/board/freescale/m5275evb/m5275evb.c
index 16083d1bc0..5a9831d619 100644
--- a/board/freescale/m5275evb/m5275evb.c
+++ b/board/freescale/m5275evb/m5275evb.c
@@ -13,6 +13,8 @@
#include <asm/immap.h>
#include <asm/io.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#define PERIOD 13 /* system bus period in ns */
#define SDRAM_TREFI 7800 /* in ns */
@@ -23,7 +25,7 @@ int checkboard(void)
return 0;
};
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
sdramctrl_t *sdp = (sdramctrl_t *)(MMAP_SDRAM);
gpio_t *gpio_reg = (gpio_t *)(MMAP_GPIO);
@@ -88,7 +90,9 @@ phys_size_t initdram(int board_type)
| MCF_SDRAMC_SDCR_RCNT((SDRAM_TREFI/(PERIOD*64)) - 1 + 1)
| MCF_SDRAMC_SDCR_DQS_OE(0x3));
- return CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
+ gd->ram_size = CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
+
+ return 0;
};
int testdram(void)
diff --git a/board/freescale/m5282evb/m5282evb.c b/board/freescale/m5282evb/m5282evb.c
index 39f12fb4aa..eb618b54f4 100644
--- a/board/freescale/m5282evb/m5282evb.c
+++ b/board/freescale/m5282evb/m5282evb.c
@@ -16,7 +16,7 @@ int checkboard (void)
return 0;
}
-phys_size_t initdram (int board_type)
+int dram_init(void)
{
u32 dramsize, i, dramclk;
@@ -80,5 +80,7 @@ phys_size_t initdram (int board_type)
/* Write to the SDRAM Mode Register */
*(u32 *)(CONFIG_SYS_SDRAM_BASE + 0x400) = 0xA5A59696;
}
- return dramsize;
+ gd->ram_size = dramsize;
+
+ return 0;
}
diff --git a/board/freescale/m53017evb/m53017evb.c b/board/freescale/m53017evb/m53017evb.c
index dbe886b03a..71cca35e02 100644
--- a/board/freescale/m53017evb/m53017evb.c
+++ b/board/freescale/m53017evb/m53017evb.c
@@ -22,7 +22,7 @@ int checkboard(void)
return 0;
};
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
sdram_t *sdram = (sdram_t *)(MMAP_SDRAM);
u32 dramsize, i;
@@ -68,7 +68,9 @@ phys_size_t initdram(int board_type)
udelay(100);
- return dramsize;
+ gd->ram_size = dramsize;
+
+ return 0;
};
int testdram(void)
diff --git a/board/freescale/m5329evb/m5329evb.c b/board/freescale/m5329evb/m5329evb.c
index 1f77adf4c2..4e0b4e4bd8 100644
--- a/board/freescale/m5329evb/m5329evb.c
+++ b/board/freescale/m5329evb/m5329evb.c
@@ -22,7 +22,7 @@ int checkboard(void)
return 0;
};
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
sdram_t *sdram = (sdram_t *)(MMAP_SDRAM);
u32 dramsize, i;
@@ -62,7 +62,9 @@ phys_size_t initdram(int board_type)
udelay(100);
- return dramsize;
+ gd->ram_size = dramsize;
+
+ return 0;
};
int testdram(void)
diff --git a/board/freescale/m5373evb/m5373evb.c b/board/freescale/m5373evb/m5373evb.c
index bfcc4b23b0..f2ed298f0f 100644
--- a/board/freescale/m5373evb/m5373evb.c
+++ b/board/freescale/m5373evb/m5373evb.c
@@ -22,7 +22,7 @@ int checkboard(void)
return 0;
};
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
sdram_t *sdram = (sdram_t *)(MMAP_SDRAM);
u32 dramsize, i;
@@ -62,7 +62,9 @@ phys_size_t initdram(int board_type)
udelay(100);
- return dramsize;
+ gd->ram_size = dramsize;
+
+ return 0;
};
int testdram(void)
diff --git a/board/freescale/m54418twr/m54418twr.c b/board/freescale/m54418twr/m54418twr.c
index 5375d1675d..433539486e 100644
--- a/board/freescale/m54418twr/m54418twr.c
+++ b/board/freescale/m54418twr/m54418twr.c
@@ -25,7 +25,7 @@ int checkboard(void)
return 0;
};
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
u32 dramsize;
@@ -104,7 +104,9 @@ phys_size_t initdram(int board_type)
udelay(100);
#endif
- return dramsize;
+ gd->ram_size = dramsize;
+
+ return 0;
};
int testdram(void)
diff --git a/board/freescale/m54451evb/m54451evb.c b/board/freescale/m54451evb/m54451evb.c
index d2ad42c085..050624bf92 100644
--- a/board/freescale/m54451evb/m54451evb.c
+++ b/board/freescale/m54451evb/m54451evb.c
@@ -26,7 +26,7 @@ int checkboard(void)
return 0;
};
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
u32 dramsize;
#ifdef CONFIG_CF_SBF
@@ -82,7 +82,9 @@ phys_size_t initdram(int board_type)
udelay(100);
#endif
- return (dramsize);
+ gd->ram_size = dramsize;
+
+ return 0;
};
int testdram(void)
diff --git a/board/freescale/m54455evb/m54455evb.c b/board/freescale/m54455evb/m54455evb.c
index 76b4322a19..d6b0650b99 100644
--- a/board/freescale/m54455evb/m54455evb.c
+++ b/board/freescale/m54455evb/m54455evb.c
@@ -22,7 +22,7 @@ int checkboard(void)
return 0;
};
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
u32 dramsize;
#ifdef CONFIG_CF_SBF
@@ -75,7 +75,9 @@ phys_size_t initdram(int board_type)
udelay(100);
#endif
- return (dramsize << 1);
+ gd->ram_size = dramsize << 1;
+
+ return 0;
};
int testdram(void)
diff --git a/board/freescale/m547xevb/m547xevb.c b/board/freescale/m547xevb/m547xevb.c
index 1e3cb6179f..d28f43da04 100644
--- a/board/freescale/m547xevb/m547xevb.c
+++ b/board/freescale/m547xevb/m547xevb.c
@@ -23,7 +23,7 @@ int checkboard(void)
return 0;
};
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
siu_t *siu = (siu_t *) (MMAP_SIU);
sdram_t *sdram = (sdram_t *)(MMAP_SDRAM);
@@ -79,7 +79,9 @@ phys_size_t initdram(int board_type)
udelay(100);
- return dramsize;
+ gd->ram_size = dramsize;
+
+ return 0;
};
int testdram(void)
diff --git a/board/freescale/m548xevb/m548xevb.c b/board/freescale/m548xevb/m548xevb.c
index 05361550b3..56060b68b6 100644
--- a/board/freescale/m548xevb/m548xevb.c
+++ b/board/freescale/m548xevb/m548xevb.c
@@ -23,7 +23,7 @@ int checkboard(void)
return 0;
};
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
siu_t *siu = (siu_t *) (MMAP_SIU);
sdram_t *sdram = (sdram_t *)(MMAP_SDRAM);
@@ -79,7 +79,9 @@ phys_size_t initdram(int board_type)
udelay(100);
- return dramsize;
+ gd->ram_size = dramsize;
+
+ return 0;
};
int testdram(void)
diff --git a/board/freescale/mpc5121ads/mpc5121ads.c b/board/freescale/mpc5121ads/mpc5121ads.c
index 7c44282ca2..f87579f193 100644
--- a/board/freescale/mpc5121ads/mpc5121ads.c
+++ b/board/freescale/mpc5121ads/mpc5121ads.c
@@ -95,7 +95,7 @@ int is_micron(void){
return(ismicron);
}
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
u32 msize = 0;
/*
@@ -167,7 +167,9 @@ phys_size_t initdram(int board_type)
sizeof(elpida_init_sequence)/sizeof(u32));
}
- return msize;
+ gd->ram_size = msize;
+
+ return 0;
}
int misc_init_r(void)
diff --git a/board/freescale/mpc8308rdb/sdram.c b/board/freescale/mpc8308rdb/sdram.c
index 89b665e649..81e155a401 100644
--- a/board/freescale/mpc8308rdb/sdram.c
+++ b/board/freescale/mpc8308rdb/sdram.c
@@ -65,17 +65,19 @@ static long fixed_sdram(void)
return get_ram_size(CONFIG_SYS_DDR_SDRAM_BASE, msize);
}
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
u32 msize;
if ((in_be32(&im->sysconf.immrbar) & IMMRBAR_BASE_ADDR) != (u32)im)
- return -1;
+ return -ENXIO;
/* DDR SDRAM */
msize = fixed_sdram();
/* return total bus SDRAM size(bytes) -- DDR */
- return msize;
+ gd->ram_size = msize;
+
+ return 0;
}
diff --git a/board/freescale/mpc8313erdb/mpc8313erdb.c b/board/freescale/mpc8313erdb/mpc8313erdb.c
index eac193e817..8974378326 100644
--- a/board/freescale/mpc8313erdb/mpc8313erdb.c
+++ b/board/freescale/mpc8313erdb/mpc8313erdb.c
@@ -133,8 +133,8 @@ void board_init_f(ulong bootflag)
NS16550_init((NS16550_t)(CONFIG_SYS_IMMR + 0x4500),
CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
puts("NAND boot... ");
- init_timebase();
- initdram(0);
+ timer_init();
+ dram_init();
relocate_code(CONFIG_SYS_NAND_U_BOOT_RELOC_SP, (gd_t *)gd,
CONFIG_SYS_NAND_U_BOOT_RELOC);
}
diff --git a/board/freescale/mpc8313erdb/sdram.c b/board/freescale/mpc8313erdb/sdram.c
index 6282c3d920..a4128cbd11 100644
--- a/board/freescale/mpc8313erdb/sdram.c
+++ b/board/freescale/mpc8313erdb/sdram.c
@@ -97,14 +97,14 @@ static long fixed_sdram(void)
return msize;
}
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
volatile immap_t *im = (volatile immap_t *)CONFIG_SYS_IMMR;
volatile fsl_lbc_t *lbc = &im->im_lbc;
u32 msize;
if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32)im)
- return -1;
+ return -ENXIO;
/* DDR SDRAM - Main SODIMM */
msize = fixed_sdram();
@@ -120,5 +120,7 @@ phys_size_t initdram(int board_type)
#endif
/* return total bus SDRAM size(bytes) -- DDR */
- return msize;
+ gd->ram_size = msize;
+
+ return 0;
}
diff --git a/board/freescale/mpc8315erdb/mpc8315erdb.c b/board/freescale/mpc8315erdb/mpc8315erdb.c
index 3cec09b586..22f1565b4c 100644
--- a/board/freescale/mpc8315erdb/mpc8315erdb.c
+++ b/board/freescale/mpc8315erdb/mpc8315erdb.c
@@ -221,8 +221,8 @@ void board_init_f(ulong bootflag)
NS16550_init((NS16550_t)(CONFIG_SYS_IMMR + 0x4500),
CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
puts("NAND boot... ");
- init_timebase();
- initdram(0);
+ timer_init();
+ dram_init();
relocate_code(CONFIG_SYS_NAND_U_BOOT_RELOC + 0x10000, (gd_t *)gd,
CONFIG_SYS_NAND_U_BOOT_RELOC);
}
diff --git a/board/freescale/mpc8315erdb/sdram.c b/board/freescale/mpc8315erdb/sdram.c
index 6c9431202f..b69c86bb81 100644
--- a/board/freescale/mpc8315erdb/sdram.c
+++ b/board/freescale/mpc8315erdb/sdram.c
@@ -92,13 +92,13 @@ static long fixed_sdram(void)
}
#endif /* CONFIG_SYS_RAMBOOT */
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
volatile immap_t *im = (volatile immap_t *)CONFIG_SYS_IMMR;
u32 msize;
if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32)im)
- return -1;
+ return -ENXIO;
/* DDR SDRAM */
msize = fixed_sdram();
@@ -106,6 +106,8 @@ phys_size_t initdram(int board_type)
if (im->pmc.pmccr1 & PMCCR1_POWER_OFF)
resume_from_sleep();
- /* return total bus SDRAM size(bytes) -- DDR */
- return msize;
+ /* set total bus SDRAM size(bytes) -- DDR */
+ gd->ram_size = msize;
+
+ return 0;
}
diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c b/board/freescale/mpc8323erdb/mpc8323erdb.c
index 0a0152ad9e..f30a1510ee 100644
--- a/board/freescale/mpc8323erdb/mpc8323erdb.c
+++ b/board/freescale/mpc8323erdb/mpc8323erdb.c
@@ -21,6 +21,8 @@
#endif
#include <asm/mmu.h>
+DECLARE_GLOBAL_DATA_PTR;
+
const qe_iop_conf_t qe_iop_conf_tab[] = {
/* UCC3 */
{1, 0, 1, 0, 1}, /* TxD0 */
@@ -68,21 +70,23 @@ const qe_iop_conf_t qe_iop_conf_tab[] = {
int fixed_sdram(void);
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
u32 msize = 0;
if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32) im)
- return -1;
+ return -ENXIO;
/* DDR SDRAM - Main SODIMM */
im->sysconf.ddrlaw[0].bar = CONFIG_SYS_DDR_BASE & LAWBAR_BAR;
msize = fixed_sdram();
- /* return total bus SDRAM size(bytes) -- DDR */
- return (msize * 1024 * 1024);
+ /* set total bus SDRAM size(bytes) -- DDR */
+ gd->ram_size = msize * 1024 * 1024;
+
+ return 0;
}
/*************************************************************************
diff --git a/board/freescale/mpc832xemds/mpc832xemds.c b/board/freescale/mpc832xemds/mpc832xemds.c
index adf425486e..b49e03e4f9 100644
--- a/board/freescale/mpc832xemds/mpc832xemds.c
+++ b/board/freescale/mpc832xemds/mpc832xemds.c
@@ -23,6 +23,8 @@
#include "../common/pq-mds-pib.h"
#endif
+DECLARE_GLOBAL_DATA_PTR;
+
const qe_iop_conf_t qe_iop_conf_tab[] = {
/* ETH3 */
{1, 0, 1, 0, 1}, /* TxD0 */
@@ -88,21 +90,23 @@ int board_early_init_r(void)
int fixed_sdram(void);
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
u32 msize = 0;
if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32) im)
- return -1;
+ return -ENXIO;
/* DDR SDRAM - Main SODIMM */
im->sysconf.ddrlaw[0].bar = CONFIG_SYS_DDR_BASE & LAWBAR_BAR;
msize = fixed_sdram();
- /* return total bus SDRAM size(bytes) -- DDR */
- return (msize * 1024 * 1024);
+ /* set total bus SDRAM size(bytes) -- DDR */
+ gd->ram_size = msize * 1024 * 1024;
+
+ return 0;
}
/*************************************************************************
diff --git a/board/freescale/mpc8349emds/mpc8349emds.c b/board/freescale/mpc8349emds/mpc8349emds.c
index 02b5040ef4..5f502e2a65 100644
--- a/board/freescale/mpc8349emds/mpc8349emds.c
+++ b/board/freescale/mpc8349emds/mpc8349emds.c
@@ -22,6 +22,8 @@
#include <libfdt.h>
#endif
+DECLARE_GLOBAL_DATA_PTR;
+
int fixed_sdram(void);
void sdram_init(void);
@@ -46,13 +48,13 @@ int board_early_init_f (void)
#define ns2clk(ns) (ns / (1000000000 / CONFIG_8349_CLKIN) + 1)
-phys_size_t initdram (int board_type)
+int dram_init(void)
{
volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
phys_size_t msize = 0;
if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32)im)
- return -1;
+ return -ENXIO;
/* DDR SDRAM - Main SODIMM */
im->sysconf.ddrlaw[0].bar = CONFIG_SYS_DDR_BASE & LAWBAR_BAR;
@@ -73,8 +75,10 @@ phys_size_t initdram (int board_type)
*/
sdram_init();
- /* return total bus SDRAM size(bytes) -- DDR */
- return msize;
+ /* set total bus SDRAM size(bytes) -- DDR */
+ gd->ram_size = msize;
+
+ return 0;
}
#if !defined(CONFIG_SPD_EEPROM)
diff --git a/board/freescale/mpc8349itx/mpc8349itx.c b/board/freescale/mpc8349itx/mpc8349itx.c
index 22a1d99c88..895e9ffda6 100644
--- a/board/freescale/mpc8349itx/mpc8349itx.c
+++ b/board/freescale/mpc8349itx/mpc8349itx.c
@@ -20,6 +20,8 @@
#include <libfdt.h>
#endif
+DECLARE_GLOBAL_DATA_PTR;
+
#ifndef CONFIG_SPD_EEPROM
/*************************************************************************
* fixed sdram init -- doesn't use serial presence detect.
@@ -116,7 +118,7 @@ volatile static struct pci_controller hose[] = {
};
#endif /* CONFIG_PCI */
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
u32 msize = 0;
@@ -125,7 +127,7 @@ phys_size_t initdram(int board_type)
#endif
if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32) im)
- return -1;
+ return -ENXIO;
/* DDR SDRAM - Main SODIMM */
im->sysconf.ddrlaw[0].bar = CONFIG_SYS_DDR_BASE & LAWBAR_BAR;
@@ -144,7 +146,9 @@ phys_size_t initdram(int board_type)
#endif
/* return total bus RAM size(bytes) */
- return msize * 1024 * 1024;
+ gd->ram_size = msize * 1024 * 1024;
+
+ return 0;
}
int checkboard(void)
diff --git a/board/freescale/mpc837xemds/mpc837xemds.c b/board/freescale/mpc837xemds/mpc837xemds.c
index 045841d57b..233049227f 100644
--- a/board/freescale/mpc837xemds/mpc837xemds.c
+++ b/board/freescale/mpc837xemds/mpc837xemds.c
@@ -20,6 +20,8 @@
#include "pci.h"
#include "../common/pq-mds-pib.h"
+DECLARE_GLOBAL_DATA_PTR;
+
int board_early_init_f(void)
{
u8 *bcsr = (u8 *)CONFIG_SYS_BCSR;
@@ -216,13 +218,13 @@ extern void ddr_enable_ecc(unsigned int dram_size);
#endif
int fixed_sdram(void);
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
u32 msize = 0;
if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32) im)
- return -1;
+ return -ENXIO;
#if defined(CONFIG_SPD_EEPROM)
msize = spd_sdram();
@@ -236,7 +238,9 @@ phys_size_t initdram(int board_type)
#endif
/* return total bus DDR size(bytes) */
- return (msize * 1024 * 1024);
+ gd->ram_size = msize * 1024 * 1024;
+
+ return 0;
}
#if !defined(CONFIG_SPD_EEPROM)
diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c b/board/freescale/mpc837xerdb/mpc837xerdb.c
index 07c0599858..319f0479e2 100644
--- a/board/freescale/mpc837xerdb/mpc837xerdb.c
+++ b/board/freescale/mpc837xerdb/mpc837xerdb.c
@@ -16,6 +16,8 @@
#include <vsc7385.h>
#include <fsl_esdhc.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#if defined(CONFIG_SYS_DRAM_TEST)
int
testdram(void)
@@ -60,13 +62,13 @@ void ddr_enable_ecc(unsigned int dram_size);
#endif
int fixed_sdram(void);
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
u32 msize = 0;
if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32) im)
- return -1;
+ return -ENXIO;
#if defined(CONFIG_SPD_EEPROM)
msize = spd_sdram();
@@ -79,7 +81,9 @@ phys_size_t initdram(int board_type)
ddr_enable_ecc(msize * 1024 * 1024);
#endif
/* return total bus DDR size(bytes) */
- return (msize * 1024 * 1024);
+ gd->ram_size = msize * 1024 * 1024;
+
+ return 0;
}
#if !defined(CONFIG_SPD_EEPROM)
diff --git a/board/freescale/mpc8610hpcd/mpc8610hpcd.c b/board/freescale/mpc8610hpcd/mpc8610hpcd.c
index 95e398c9f4..d97562c849 100644
--- a/board/freescale/mpc8610hpcd/mpc8610hpcd.c
+++ b/board/freescale/mpc8610hpcd/mpc8610hpcd.c
@@ -19,6 +19,8 @@
#include <spd_sdram.h>
#include <netdev.h>
+DECLARE_GLOBAL_DATA_PTR;
+
void sdram_init(void);
phys_size_t fixed_sdram(void);
int mpc8610hpcd_diu_init(void);
@@ -116,8 +118,7 @@ int checkboard(void)
}
-phys_size_t
-initdram(int board_type)
+int dram_init(void)
{
phys_size_t dram_size = 0;
@@ -130,7 +131,9 @@ initdram(int board_type)
setup_ddr_bat(dram_size);
debug(" DDR: ");
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/mpc8641hpcn/mpc8641hpcn.c b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
index 94633b5c99..2604a51e91 100644
--- a/board/freescale/mpc8641hpcn/mpc8641hpcn.c
+++ b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
@@ -16,6 +16,8 @@
#include <fdt_support.h>
#include <netdev.h>
+DECLARE_GLOBAL_DATA_PTR;
+
phys_size_t fixed_sdram(void);
int checkboard(void)
@@ -37,8 +39,7 @@ int checkboard(void)
return 0;
}
-phys_size_t
-initdram(int board_type)
+int dram_init(void)
{
phys_size_t dram_size = 0;
@@ -51,7 +52,9 @@ initdram(int board_type)
setup_ddr_bat(dram_size);
debug(" DDR: ");
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/mx35pdk/mx35pdk.c b/board/freescale/mx35pdk/mx35pdk.c
index fb0ab77445..123fb11f42 100644
--- a/board/freescale/mx35pdk/mx35pdk.c
+++ b/board/freescale/mx35pdk/mx35pdk.c
@@ -47,13 +47,15 @@ int dram_init(void)
return 0;
}
-void dram_init_banksize(void)
+int dram_init_banksize(void)
{
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
+
+ return 0;
}
#define I2C_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN | PAD_CTL_ODE)
diff --git a/board/freescale/mx53ard/mx53ard.c b/board/freescale/mx53ard/mx53ard.c
index a6e46b92f9..eb9f74337f 100644
--- a/board/freescale/mx53ard/mx53ard.c
+++ b/board/freescale/mx53ard/mx53ard.c
@@ -32,13 +32,15 @@ int dram_init(void)
return 0;
}
-void dram_init_banksize(void)
+int dram_init_banksize(void)
{
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
+
+ return 0;
}
#ifdef CONFIG_NAND_MXC
diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
index 9e1072f4b1..3741fa178c 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -58,13 +58,15 @@ int dram_init(void)
return 0;
}
-void dram_init_banksize(void)
+int dram_init_banksize(void)
{
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
gd->bd->bi_dram[0].size = mx53_dram_size[0];
gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
gd->bd->bi_dram[1].size = mx53_dram_size[1];
+
+ return 0;
}
u32 get_board_rev(void)
diff --git a/board/freescale/mx53smd/mx53smd.c b/board/freescale/mx53smd/mx53smd.c
index 938c611ef8..630d6714af 100644
--- a/board/freescale/mx53smd/mx53smd.c
+++ b/board/freescale/mx53smd/mx53smd.c
@@ -30,13 +30,15 @@ int dram_init(void)
return 0;
}
-void dram_init_banksize(void)
+int dram_init_banksize(void)
{
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
+
+ return 0;
}
#define UART_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_DSE_HIGH | \
diff --git a/board/freescale/p1010rdb/spl.c b/board/freescale/p1010rdb/spl.c
index 05c76f2e45..2cebc2c002 100644
--- a/board/freescale/p1010rdb/spl.c
+++ b/board/freescale/p1010rdb/spl.c
@@ -94,7 +94,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
i2c_init_all();
- gd->ram_size = initdram(0);
+ dram_init();
#ifdef CONFIG_SPL_NAND_BOOT
puts("\nTertiary program loader running in sram...");
#else
diff --git a/board/freescale/p1022ds/spl.c b/board/freescale/p1022ds/spl.c
index ef38551600..a117dc3a2c 100644
--- a/board/freescale/p1022ds/spl.c
+++ b/board/freescale/p1022ds/spl.c
@@ -111,7 +111,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
#endif
- gd->ram_size = initdram(0);
+ dram_init();
#ifdef CONFIG_SPL_NAND_BOOT
puts("Tertiary program loader running in sram...");
#else
diff --git a/board/freescale/p1_p2_rdb_pc/spl.c b/board/freescale/p1_p2_rdb_pc/spl.c
index 2af5576ff7..1cf3497aa6 100644
--- a/board/freescale/p1_p2_rdb_pc/spl.c
+++ b/board/freescale/p1_p2_rdb_pc/spl.c
@@ -108,7 +108,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
#endif
- gd->ram_size = initdram(0);
+ dram_init();
#ifdef CONFIG_SPL_NAND_BOOT
puts("Tertiary program loader running in sram...");
#else
diff --git a/board/freescale/p2041rdb/ddr.c b/board/freescale/p2041rdb/ddr.c
index b2493e1f61..1ab98fc089 100644
--- a/board/freescale/p2041rdb/ddr.c
+++ b/board/freescale/p2041rdb/ddr.c
@@ -12,6 +12,8 @@
#include <fsl_ddr_dimm_params.h>
#include <asm/fsl_law.h>
+DECLARE_GLOBAL_DATA_PTR;
+
struct board_specific_parameters {
u32 n_ranks;
u32 datarate_mhz_high;
@@ -116,7 +118,7 @@ found:
popts->ddr_cdr1 = DDR_CDR1_DHC_EN;
}
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
phys_size_t dram_size = 0;
@@ -127,12 +129,14 @@ phys_size_t initdram(int board_type)
dram_size = fsl_ddr_sdram();
} else {
puts("no SPD and fixed parameters\n");
- return dram_size;
+ return -ENXIO;
}
dram_size = setup_ddr_tlbs(dram_size / 0x100000);
dram_size *= 0x100000;
debug(" DDR: ");
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/t102xqds/ddr.c b/board/freescale/t102xqds/ddr.c
index b6b1191990..d822d3f806 100644
--- a/board/freescale/t102xqds/ddr.c
+++ b/board/freescale/t102xqds/ddr.c
@@ -169,7 +169,7 @@ void board_mem_sleep_setup(void)
}
#endif
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
phys_size_t dram_size;
@@ -187,5 +187,7 @@ phys_size_t initdram(int board_type)
fsl_dp_resume();
#endif
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/t102xqds/spl.c b/board/freescale/t102xqds/spl.c
index 3e96b33c40..b987ecea1d 100644
--- a/board/freescale/t102xqds/spl.c
+++ b/board/freescale/t102xqds/spl.c
@@ -142,7 +142,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
i2c_init_all();
- gd->ram_size = initdram(0);
+ dram_init();
#ifdef CONFIG_SPL_MMC_BOOT
mmc_boot();
diff --git a/board/freescale/t102xrdb/ddr.c b/board/freescale/t102xrdb/ddr.c
index e66657869c..49460a02d1 100644
--- a/board/freescale/t102xrdb/ddr.c
+++ b/board/freescale/t102xrdb/ddr.c
@@ -229,7 +229,7 @@ void board_mem_sleep_setup(void)
}
#endif
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
phys_size_t dram_size;
@@ -249,5 +249,7 @@ phys_size_t initdram(int board_type)
fsl_dp_resume();
#endif
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/t102xrdb/spl.c b/board/freescale/t102xrdb/spl.c
index b70c2c5d79..dc6d9eeef6 100644
--- a/board/freescale/t102xrdb/spl.c
+++ b/board/freescale/t102xrdb/spl.c
@@ -129,7 +129,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
i2c_init_all();
- gd->ram_size = initdram(0);
+ dram_init();
#ifdef CONFIG_SPL_MMC_BOOT
mmc_boot();
diff --git a/board/freescale/t1040qds/ddr.c b/board/freescale/t1040qds/ddr.c
index cb58d1e524..8f7909dc68 100644
--- a/board/freescale/t1040qds/ddr.c
+++ b/board/freescale/t1040qds/ddr.c
@@ -117,7 +117,7 @@ void board_mem_sleep_setup(void)
}
#endif
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
phys_size_t dram_size;
@@ -134,5 +134,7 @@ phys_size_t initdram(int board_type)
fsl_dp_resume();
#endif
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/t104xrdb/ddr.c b/board/freescale/t104xrdb/ddr.c
index 302f19be69..4e55844abe 100644
--- a/board/freescale/t104xrdb/ddr.c
+++ b/board/freescale/t104xrdb/ddr.c
@@ -120,7 +120,7 @@ void board_mem_sleep_setup(void)
}
#endif
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
phys_size_t dram_size;
@@ -137,5 +137,7 @@ phys_size_t initdram(int board_type)
fsl_dp_resume();
#endif
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/t104xrdb/spl.c b/board/freescale/t104xrdb/spl.c
index 4402e0f4b0..2e43307b2d 100644
--- a/board/freescale/t104xrdb/spl.c
+++ b/board/freescale/t104xrdb/spl.c
@@ -125,7 +125,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
puts("\n\n");
- gd->ram_size = initdram(0);
+ dram_init();
#ifdef CONFIG_SPL_MMC_BOOT
mmc_boot();
diff --git a/board/freescale/t208xqds/ddr.c b/board/freescale/t208xqds/ddr.c
index d6e4554a80..ba65049709 100644
--- a/board/freescale/t208xqds/ddr.c
+++ b/board/freescale/t208xqds/ddr.c
@@ -104,7 +104,7 @@ found:
popts->cpo_sample = 0x64;
}
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
phys_size_t dram_size;
@@ -118,5 +118,7 @@ phys_size_t initdram(int board_type)
dram_size = setup_ddr_tlbs(dram_size / 0x100000);
dram_size *= 0x100000;
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/t208xqds/spl.c b/board/freescale/t208xqds/spl.c
index 334f5083b8..d7d716b690 100644
--- a/board/freescale/t208xqds/spl.c
+++ b/board/freescale/t208xqds/spl.c
@@ -128,7 +128,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
i2c_init_all();
- gd->ram_size = initdram(0);
+ dram_init();
#ifdef CONFIG_SPL_MMC_BOOT
mmc_boot();
diff --git a/board/freescale/t208xrdb/ddr.c b/board/freescale/t208xrdb/ddr.c
index 3487261b9d..50dc69a443 100644
--- a/board/freescale/t208xrdb/ddr.c
+++ b/board/freescale/t208xrdb/ddr.c
@@ -97,7 +97,7 @@ found:
popts->cpo_sample = 0x54;
}
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
phys_size_t dram_size;
@@ -111,5 +111,7 @@ phys_size_t initdram(int board_type)
dram_size = setup_ddr_tlbs(dram_size / 0x100000);
dram_size *= 0x100000;
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/t208xrdb/spl.c b/board/freescale/t208xrdb/spl.c
index aa8e9285fe..b43140148b 100644
--- a/board/freescale/t208xrdb/spl.c
+++ b/board/freescale/t208xrdb/spl.c
@@ -98,7 +98,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
i2c_init_all();
- gd->ram_size = initdram(0);
+ dram_init();
#ifdef CONFIG_SPL_MMC_BOOT
mmc_boot();
diff --git a/board/freescale/t4qds/ddr.c b/board/freescale/t4qds/ddr.c
index 842073b6c6..740897015e 100644
--- a/board/freescale/t4qds/ddr.c
+++ b/board/freescale/t4qds/ddr.c
@@ -112,7 +112,7 @@ found:
popts->cpo_sample = 0x63;
}
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
phys_size_t dram_size;
@@ -127,5 +127,7 @@ phys_size_t initdram(int board_type)
dram_size = setup_ddr_tlbs(dram_size / 0x100000);
dram_size *= 0x100000;
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/t4qds/spl.c b/board/freescale/t4qds/spl.c
index 5e946dc84f..9ecdaedda3 100644
--- a/board/freescale/t4qds/spl.c
+++ b/board/freescale/t4qds/spl.c
@@ -133,7 +133,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
i2c_init_all();
- gd->ram_size = initdram(0);
+ dram_init();
#ifdef CONFIG_SPL_MMC_BOOT
mmc_boot();
diff --git a/board/freescale/t4rdb/ddr.c b/board/freescale/t4rdb/ddr.c
index 7b05821cf7..8415527ec2 100644
--- a/board/freescale/t4rdb/ddr.c
+++ b/board/freescale/t4rdb/ddr.c
@@ -105,7 +105,7 @@ found:
popts->cpo_sample = 0x64;
}
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
phys_size_t dram_size;
@@ -120,5 +120,7 @@ phys_size_t initdram(int board_type)
dram_size = setup_ddr_tlbs(dram_size / 0x100000);
dram_size *= 0x100000;
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/freescale/t4rdb/spl.c b/board/freescale/t4rdb/spl.c
index a32e34ef96..5feab1cfcd 100644
--- a/board/freescale/t4rdb/spl.c
+++ b/board/freescale/t4rdb/spl.c
@@ -91,7 +91,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
i2c_init_all();
- gd->ram_size = initdram(0);
+ dram_init();
mmc_boot();
}