summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/board-ardbeg-memory.c
diff options
context:
space:
mode:
authorJay Bhukhanwala <jbhukhanwala@nvidia.com>2013-08-21 12:52:28 -0700
committerGraziano Misuraca <gmisuraca@nvidia.com>2013-10-23 13:05:25 -0700
commitea0661d9dbe19e9e4b5c6d425766e44e987d16c7 (patch)
treee48d27c5446d8a3136e88582505465b6dbdb2db6 /arch/arm/mach-tegra/board-ardbeg-memory.c
parentb93cf600fb36f90dc477c2b2138617d546b13e28 (diff)
ARM: Tegra12: Ardbeg: NCT: Load EMC tables
Adds functionality to load the EMC table from the NCT partition. If no memory table is in NCT or the NCT partition doesn't exist, fall back to the built-in table. Bug 1300925 Change-Id: I09c13443600c987884f67520ca72a7702e052837 Signed-off-by: Jay Bhukhanwala <jbhukhanwala@nvidia.com> Signed-off-by: Ray Poudrier <rapoudrier@nvidia.com> Signed-off-by: Graziano Misuraca <gmisuraca@nvidia.com> Reviewed-on: http://git-master/r/289290 GVS: Gerrit_Virtual_Submit Reviewed-by: Thomas Cherry <tcherry@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/board-ardbeg-memory.c')
-rw-r--r--arch/arm/mach-tegra/board-ardbeg-memory.c47
1 files changed, 33 insertions, 14 deletions
diff --git a/arch/arm/mach-tegra/board-ardbeg-memory.c b/arch/arm/mach-tegra/board-ardbeg-memory.c
index 36a49627cdac..e6d2ce0dfd74 100644
--- a/arch/arm/mach-tegra/board-ardbeg-memory.c
+++ b/arch/arm/mach-tegra/board-ardbeg-memory.c
@@ -5432,11 +5432,16 @@ static struct tegra12_emc_table ardbeg_lpddr3_emc_table[] = {
},
};
+#ifdef CONFIG_TEGRA_USE_NCT
+static struct tegra12_emc_pdata board_emc_pdata;
+#endif
+
static struct tegra12_emc_pdata ardbeg_emc_pdata = {
.description = "ardbeg_emc_tables",
.tables = ardbeg_emc_table,
.num_tables = ARRAY_SIZE(ardbeg_emc_table),
};
+
static struct tegra12_emc_pdata ardbeg_lpddr3_emc_pdata = {
.description = "ardbeg_emc_tables",
.tables = ardbeg_lpddr3_emc_table,
@@ -5450,22 +5455,36 @@ int __init ardbeg_emc_init(void)
{
struct board_info bi;
- tegra_get_board_info(&bi);
+ /*
+ * If the EMC table is successfully read from the NCT partition,
+ * we do not need to check for board ids and blindly load the one
+ * flashed on the NCT partition.
+ */
+ #ifdef CONFIG_TEGRA_USE_NCT
+ if (!tegra12_nct_emc_table_init(&board_emc_pdata)) {
+ tegra_emc_device.dev.platform_data = &board_emc_pdata;
+ pr_info("Loading EMC table read from NCT partition.\n");
+ } else {
+ #endif
+ tegra_get_board_info(&bi);
-
- switch (bi.board_id) {
- case BOARD_E1780:
- pr_info("Loading Ardbeg EMC tables.\n");
- tegra_emc_device.dev.platform_data = &ardbeg_emc_pdata;
- break;
- case BOARD_E1792:
- pr_info("Loading Ardbeg EMC tables.\n");
- tegra_emc_device.dev.platform_data = &ardbeg_lpddr3_emc_pdata;
- break;
- default:
- WARN(1, "Invalid board ID: %u\n", bi.board_id);
- return -EINVAL;
+ switch (bi.board_id) {
+ case BOARD_E1780:
+ pr_info("Loading Ardbeg EMC tables.\n");
+ tegra_emc_device.dev.platform_data = &ardbeg_emc_pdata;
+ break;
+ case BOARD_E1792:
+ pr_info("Loading Ardbeg EMC tables.\n");
+ tegra_emc_device.dev.platform_data = &ardbeg_lpddr3_emc_pdata;
+ break;
+ default:
+ WARN(1, "Invalid board ID: %u\n", bi.board_id);
+ return -EINVAL;
+ }
+ #ifdef CONFIG_TEGRA_USE_NCT
}
+ #endif
+
platform_device_register(&tegra_emc_device);
tegra12_emc_init();
return 0;