Permalink
Browse files

FogBugz #289516: Enhancement on U-BOOT driver to support QSPI/NAND RB…

…F address loading from DTB.

This patch enhanced the driver capability to load both QSPI/NAND
RBF address from device tree.

Signed-off-by: Tien Fong Chee <tfchee@altera.com>
  • Loading branch information...
1 parent c189860 commit 2c7fd1aac5f06ceea822c4d6a8af9ea2b11fdfd4 Tien Fong Chee committed with Tien Fong Chee Nov 17, 2015
Showing with 41 additions and 2 deletions.
  1. +41 −2 arch/arm/cpu/armv7/socfpga_arria10/cff.c
@@ -179,6 +179,26 @@ int cff_from_mmc_fat_dt(void)
return cff_from_mmc_fat("0:1", filename, len);
}
+#else /* helper function supports both QSPI and NAND */
+static int get_cff_offset(const void *fdt)
+{
+ int nodeoffset = 0;
+
+ nodeoffset = fdt_subnode_offset(fdt, 0, "chosen");
+
+ if (nodeoffset >= 0) {
+#if defined(CONFIG_CADENCE_QSPI) && defined(CONFIG_QSPI_RBF_ADDR)
+ return fdtdec_get_int(fdt, nodeoffset, "cff-offset",
+ CONFIG_QSPI_RBF_ADDR);
+#elif defined(CONFIG_NAND_DENALI) && defined(CONFIG_NAND_RBF_ADDR)
+ return fdtdec_get_int(fdt, nodeoffset, "cff-offset",
+ CONFIG_NAND_RBF_ADDR);
+#else
+ return fdtdec_get_int(fdt, nodeoffset, "cff-offset", -1);
+#endif
+ }
+ return -1;
+}
#endif /* #ifdef CONFIG_MMC */
@@ -282,7 +302,16 @@ int cff_from_qspi(unsigned long flash_offset)
int cff_from_qspi_env(void)
{
- return cff_from_qspi(CONFIG_QSPI_RBF_ADDR);
+ int qspi_rbf_addr = 0;
+
+ qspi_rbf_addr = get_cff_offset(gd->fdt_blob);
+
+ if (0 > qspi_rbf_addr) {
+ printf("Error: No QSPI rbf addrress found\n");
+ return -1;
+ }
+
+ return cff_from_qspi(qspi_rbf_addr);
}
#endif /* #ifdef CONFIG_CADENCE_QSPI */
@@ -441,7 +470,17 @@ int cff_from_nand(unsigned long flash_offset)
int cff_from_nand_env(void)
{
- return cff_from_nand(CONFIG_NAND_RBF_ADDR);
+ int nand_rbf_addr = 0;
+
+ nand_rbf_addr = get_cff_offset(gd->fdt_blob);
+
+ if (0 > nand_rbf_addr) {
+ printf(" Error: No NAND rbf addrress found\n");
+ return -1;
+ }
+
+ return cff_from_nand(nand_rbf_addr);
+
}
#endif /* CONFIG_NAND_DENALI */

0 comments on commit 2c7fd1a

Please sign in to comment.