diff mbox series

[U-Boot,v3] board/ls2080ardb: Update board env based on SoC

Message ID 1505450988-1870-1-git-send-email-priyanka.jain@nxp.com
State Accepted
Commit b5dfd47581b82a8cbe423c0060f0641ae0f5c1b5
Delegated to: York Sun
Headers show
Series [U-Boot,v3] board/ls2080ardb: Update board env based on SoC | expand

Commit Message

Priyanka Jain Sept. 15, 2017, 4:49 a.m. UTC
As per current implementation, default value of board env is
based on board filename i.e ls2080ardb.

With distro support changes, this env is used to decide upon
kernel dtb which is different for other SoCs (ls2088a, ls2081a)
combination supported with this board.

Add support to modify board env at runtime based on SoC type

Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
---
Changes for v3:
  Corrected v2 patch for 
  Replace setenv() with env_set()

Changes for v2:
  Replace setenv() with env_set()

 board/freescale/ls2080ardb/ls2080ardb.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

Comments

York Sun Sept. 25, 2017, 5:33 p.m. UTC | #1
On 09/14/2017 09:49 PM, Priyanka Jain wrote:
> As per current implementation, default value of board env is
> based on board filename i.e ls2080ardb.
> 
> With distro support changes, this env is used to decide upon
> kernel dtb which is different for other SoCs (ls2088a, ls2081a)
> combination supported with this board.
> 
> Add support to modify board env at runtime based on SoC type
> 
> Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
> ---
> Changes for v3:
>    Corrected v2 patch for
>    Replace setenv() with env_set()
> 
> Changes for v2:
>    Replace setenv() with env_set()
> 

Applied to fsl-qoriq mater. Thanks.

York
diff mbox series

Patch

diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
index 07ba026..dba0988 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -247,6 +247,8 @@  int misc_init_r(void)
 	char *env_hwconfig;
 	u32 __iomem *dcfg_ccsr = (u32 __iomem *)DCFG_BASE;
 	u32 val;
+	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+	u32 svr = gur_in32(&gur->svr);
 
 	val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4);
 
@@ -274,6 +276,16 @@  int misc_init_r(void)
 
 	if (adjust_vdd(0))
 		printf("Warning: Adjusting core voltage failed.\n");
+	/*
+	 * Default value of board env is based on filename which is
+	 * ls2080ardb. Modify board env for other supported SoCs
+	 */
+	if ((SVR_SOC_VER(svr) == SVR_LS2088A) ||
+	    (SVR_SOC_VER(svr) == SVR_LS2048A))
+		env_set("board", "ls2088ardb");
+	else if ((SVR_SOC_VER(svr) == SVR_LS2081A) ||
+	    (SVR_SOC_VER(svr) == SVR_LS2041A))
+		env_set("board", "ls2081ardb");
 
 	return 0;
 }