Skip to contentSkip to conversation

powerpc/mpc85xx: Enabling CPC conditionally based on hwconfig options

PATCH New Shaveta Leekha 2 participants 4 messages Jul 2, 2014 – Aug 20, 2014 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/mpc85xx: Enabling CPC conditionally based on hwconfig options

If hwconfig does not contains "en_cpc" then by default all cpcs are enabled If this config is defined then only those individual cpcs which are defined in the subargument of "en_cpc" will be enabled e.g en_cpc:cpc1,cpc2; (this will enable cpc1 and cpc2) or en_cpc:cpc2; (this enables just cpc2)

---
 arch/powerpc/cpu/mpc85xx/cpu_init.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
arch/powerpc/cpu/mpc85xx/cpu_init.c +27 -0
index 78316a6..ecde00b 100644
@@ -254,11 +254,38 @@ static void enable_tdm_law(void)
 static void enable_cpc(void)
 {
 	int i;
+	int ret;
 	u32 size = 0;
 
 	cpc_corenet_t *cpc = (cpc_corenet_t *)CONFIG_SYS_FSL_CPC_ADDR;
+	char buffer[HWCONFIG_BUFFER_SIZE];
+	char cpc_subarg[16];
+	bool have_hwconfig = false;
+	int cpc_args = 0;
+
+	/*
+	 * Extract hwconfig from environment since environmen
+	 * is not setup properly yet
+	 */
+	ret = getenv_f("hwconfig", buffer, sizeof(buffer));
+	if (ret > 0) {
+		/*
+		 * If "en_cpc" is not defined in hwconfig then by default all
+		 * cpcs are enable. If this config is defined then individual
+		 * cpcs which have to be enabled should also be defined.
+		 * e.g en_cpc:cpc1,cpc2;
+		 */
+		if (hwconfig_f("en_cpc", buffer))
+			have_hwconfig = true;
+	}
 
 	for (i = 0; i < CONFIG_SYS_NUM_CPC; i++, cpc++) {
+		if (have_hwconfig) {
+			sprintf(cpc_subarg, "cpc%u", i + 1);
+			cpc_args = hwconfig_sub_f("en_cpc", cpc_subarg, buffer);
+			if (cpc_args == 0)
+				continue;
+		}
 		u32 cpccfg0 = in_be32(&cpc->cpccfg0);
 		size += CPC_CFG0_SZ_K(cpccfg0);
 
Signature · 1 line
1.7.6.GIT
#1 lore raw

PATCH 1/1 powerpc/mpc85xx: Enabling CPC conditionally based on hwconfig options

Quoted 5 lines · Shaveta Leekha

If hwconfig does not contains "en_cpc" then by default all cpcs are enabled If this config is defined then only those individual cpcs which are defined in the subargument of "en_cpc" will be enabled e.g en_cpc:cpc1,cpc2; (this will enable cpc1 and cpc2) or en_cpc:cpc2; (this enables just cpc2)

What's the user's case for enabling selected CPC?

York

#2 lore raw

PATCH 1/1 powerpc/mpc85xx: Enabling CPC conditionally based on hwconfig options

Hi York,

This change was required to provide the flexibility of enabling DDRC1/CPC1 by SC3900/DSP core as DDRC1 is used by Starcore. SC enables CPC1 as per their requirement. PPC core use DDRC2, so it enables DDRC2/CPC2.

Do you suggest mentioning it in the commit message also?

Thanks and Regards,
Shaveta

-----Original Message-----
From: Sun York-R58495
Sent: Wednesday, August 06, 2014 11:04 PM
To: Leekha Shaveta-B20052; u-boot at lists.denx.de
Cc: Wood Scott-B07421; Singh Sandeep-B37400
Subject: Re: [PATCH] powerpc/mpc85xx: Enabling CPC conditionally based on hwconfig options

Quoted 6 lines · Shaveta Leekha

If hwconfig does not contains "en_cpc" then by default all cpcs are enabled If this config is defined then only those individual cpcs which are defined in the subargument of "en_cpc" will be enabled e.g en_cpc:cpc1,cpc2; (this will enable cpc1 and cpc2) or en_cpc:cpc2; (this enables just cpc2)

What's the user's case for enabling selected CPC?

York

#3 lore raw

PATCH 1/1 powerpc/mpc85xx: Enabling CPC conditionally based on hwconfig options

In reply to Shaveta Leekha
Quoted 8 lines · Shaveta Leekha

If hwconfig does not contains "en_cpc" then by default all cpcs are enabled If this config is defined then only those individual cpcs which are defined in the subargument of "en_cpc" will be enabled e.g en_cpc:cpc1,cpc2; (this will enable cpc1 and cpc2) or en_cpc:cpc2; (this enables just cpc2)

---

Applied to u-boot-mpc85xx master branch, awaiting for upstream.

York