Patchwork [U-Boot] corenet_ds: Update to use new hwconfig APIs

login
register
mail settings
Submitter York Sun
Date Jan. 12, 2011, 4:20 p.m.
Message ID <1294849214-7727-1-git-send-email-yorksun@freescale.com>
Download mbox | patch
Permalink /patch/78585/
State Accepted
Delegated to: Kumar Gala
Headers show

Comments

York Sun - Jan. 12, 2011, 4:20 p.m.
Hwconfig is called before relocating. Use the new hwconfig APIs.

Signed-off-by: York Sun <yorksun@freescale.com>
---
 arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
Kumar Gala - Jan. 20, 2011, 3:08 a.m.
On Jan 12, 2011, at 10:20 AM, York Sun wrote:

> Hwconfig is called before relocating. Use the new hwconfig APIs.
> 
> Signed-off-by: York Sun <yorksun@freescale.com>
> ---
> arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c |   15 +++++++++++++--
> 1 files changed, 13 insertions(+), 2 deletions(-)

applied to 85xx

- k

Patch

diff --git a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
index 5bcf91a..9e00a61 100644
--- a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
@@ -33,6 +33,8 @@ 
 
 static u32 serdes_prtcl_map;
 
+#define HWCONFIG_BUFFER_SIZE	128
+
 #ifdef DEBUG
 static const char *serdes_prtcl_str[] = {
 	[NONE] = "NA",
@@ -277,6 +279,15 @@  void fsl_serdes_init(void)
 	const char *srds_lpd_arg;
 	size_t arglen;
 #endif
+	char buffer[HWCONFIG_BUFFER_SIZE];
+	char *buf = NULL;
+
+	/*
+	 * Extract hwconfig from environment since we have not properly setup
+	 * the environment but need it for ddr config params
+	 */
+	if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
+		buf = buffer;
 
 	/* Is serdes enabled at all? */
 	if (!(in_be32(&gur->rcwsr[5]) & FSL_CORENET_RCWSR5_SRDS_EN))
@@ -295,8 +306,8 @@  void fsl_serdes_init(void)
 	if (!IS_SVR_REV(get_svr(), 1, 0))
 		for (bank = 1; bank < ARRAY_SIZE(srds_lpd_b); bank++) {
 			sprintf(srds_lpd_opt, "fsl_srds_lpd_b%u", bank + 1);
-			srds_lpd_arg = hwconfig_subarg("serdes", srds_lpd_opt,
-						       &arglen);
+			srds_lpd_arg = hwconfig_subarg_f("serdes", srds_lpd_opt,
+						       &arglen, buf);
 			if (srds_lpd_arg)
 				srds_lpd_b[bank] = simple_strtoul(srds_lpd_arg,
 								  NULL, 0);