[U-Boot] [PATCH 21/28] drivers/fsl-mc: Autoload AOIP image from NOR flash

York Sun
2015-03-19T16:45:52Z

From: "J. German Rivera" <German.Rivera@freescale.com>

Load AIOP image from NOR flash into DDR so that the MC firmware
the MC fw can start it at boot time.

Signed-off-by: J. German Rivera <German.Rivera@freescale.com>
Change-Id: I19e23d983e7f947a4398e0421600057e0d7be6a3
[York Sun: This is a debug commit. Will drop once AIOP is loaded by Linux]
---
drivers/net/fsl-mc/mc.c | 24 ++++++++++++++++++++++++
include/configs/ls2085a_common.h | 2 ++
include/configs/ls2085aqds.h | 3 +++
include/configs/ls2085ardb.h | 3 +++
4 files changed, 32 insertions(+)

diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index c5c44bc..e6f6d55 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -298,6 +298,24 @@ static int load_mc_dpl(u64 mc_ram_addr, size_t mc_ram_size)
return 0;
}

+#ifdef CONFIG_SYS_LS_MC_AIOP_IMG_IN_NOR
+static int load_mc_aiop_img(u64 mc_ram_addr, size_t mc_ram_size)
+{
+ void *aiop_img;
+
+ /*
+ * Load the MC AIOP image in the MC private DRAM block:
+ */
+
+ aiop_img = (void *)CONFIG_SYS_LS_MC_AIOP_IMG_ADDR;
+ mc_copy_image("MC AIOP image",
+ (u64)aiop_img, CONFIG_SYS_LS_MC_AIOP_IMG_MAX_LENGTH,
+ mc_ram_addr + CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET);
+
+ return 0;
+}
+#endif
+
/**
* Return the MC boot timeout value in milliseconds
*/
@@ -454,6 +472,12 @@ int mc_init(void)
if (error != 0)
goto out;

+#ifdef CONFIG_SYS_LS_MC_AIOP_IMG_IN_NOR
+ error = load_mc_aiop_img(mc_ram_addr, mc_ram_size);
+ if (error != 0)
+ goto out;
+#endif
+
debug("mc_ccsr_regs %p\n", mc_ccsr_regs);
dump_mc_ccsr_regs(mc_ccsr_regs);

diff --git a/include/configs/ls2085a_common.h b/include/configs/ls2085a_common.h
index 95a5e56..3fee92a 100644
--- a/include/configs/ls2085a_common.h
+++ b/include/configs/ls2085a_common.h
@@ -164,6 +164,8 @@ unsigned long long get_qixis_addr(void);
#define CONFIG_SYS_LS_MC_DRAM_DPC_OFFSET 0x00F00000
#define CONFIG_SYS_LS_MC_DPL_MAX_LENGTH 0x20000
#define CONFIG_SYS_LS_MC_DRAM_DPL_OFFSET 0x00F20000
+#define CONFIG_SYS_LS_MC_AIOP_IMG_MAX_LENGTH 0x200000
+#define CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET 0x1f800000

/* Carve out a DDR region which will not be used by u-boot/Linux */
#if defined(CONFIG_FSL_MC_ENET) || defined(CONFIG_FSL_DEBUG_SERVER)
diff --git a/include/configs/ls2085aqds.h b/include/configs/ls2085aqds.h
index 70162e7..961e4dd 100644
--- a/include/configs/ls2085aqds.h
+++ b/include/configs/ls2085aqds.h
@@ -218,6 +218,9 @@ unsigned long get_board_ddr_clk(void);
#define CONFIG_SYS_LS_MC_DPC_IN_NOR
#define CONFIG_SYS_LS_MC_DPC_ADDR 0x580800000ULL

+#define CONFIG_SYS_LS_MC_AIOP_IMG_IN_NOR
+#define CONFIG_SYS_LS_MC_AIOP_IMG_ADDR 0x580900000ULL
+
#define CONFIG_SYS_LS_MC_BOOT_TIMEOUT_MS 5000

/*
diff --git a/include/configs/ls2085ardb.h b/include/configs/ls2085ardb.h
index 5f7ea7b..24400e4 100644
--- a/include/configs/ls2085ardb.h
+++ b/include/configs/ls2085ardb.h
@@ -201,6 +201,9 @@ unsigned long get_board_sys_clk(void);
#define CONFIG_SYS_LS_MC_DPC_IN_NOR
#define CONFIG_SYS_LS_MC_DPC_ADDR 0x580800000ULL

+#define CONFIG_SYS_LS_MC_AIOP_IMG_IN_NOR
+#define CONFIG_SYS_LS_MC_AIOP_IMG_ADDR 0x580900000ULL
+
#define CONFIG_SYS_LS_MC_BOOT_TIMEOUT_MS 5000

/*
--
1.7.9.5