[U-Boot] [PATCH] powerpc/b4860: Disable unused devices using DEVDISR register

Sandeep Singh Sandeep at freescale.com
Tue Jul 2 13:05:07 CEST 2013


Explicitly disabling unused IPs/blocks. This will lower
power consumption.

Signed-off-by: Sandeep Singh <Sandeep at freescale.com>
---
 arch/powerpc/cpu/mpc85xx/Makefile    |    1 +
 arch/powerpc/cpu/mpc85xx/b4860_cpu.c |  130 ++++++++++++++++++++++++++++++++++
 arch/powerpc/include/asm/processor.h |    1 +
 board/freescale/b4860qds/b4860qds.c  |    2 +
 4 files changed, 134 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/cpu/mpc85xx/b4860_cpu.c

diff --git a/arch/powerpc/cpu/mpc85xx/Makefile b/arch/powerpc/cpu/mpc85xx/Makefile
index cefd57b..340f3dd 100644
--- a/arch/powerpc/cpu/mpc85xx/Makefile
+++ b/arch/powerpc/cpu/mpc85xx/Makefile
@@ -149,6 +149,7 @@ COBJS-$(CONFIG_PPC_T4240) += t4240_serdes.o
 COBJS-$(CONFIG_PPC_T4160) += t4240_serdes.o
 COBJS-$(CONFIG_PPC_B4420) += b4860_serdes.o
 COBJS-$(CONFIG_PPC_B4860) += b4860_serdes.o
+COBJS-$(CONFIG_PPC_B4860) += b4860_cpu.o
 COBJS-$(CONFIG_BSC9132) += bsc9132_serdes.o
 COBJS-$(CONFIG_PPC_T1040) += t1040_serdes.o
 
diff --git a/arch/powerpc/cpu/mpc85xx/b4860_cpu.c b/arch/powerpc/cpu/mpc85xx/b4860_cpu.c
new file mode 100644
index 0000000..600842a
--- /dev/null
+++ b/arch/powerpc/cpu/mpc85xx/b4860_cpu.c
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/processor.h>
+#include <asm/io.h>
+
+#define DISABLE_DDR1		0x8000
+#define DISABLE_DDR2		0x4000
+#define DISABLE_MAPLE_LTE0	0x0080
+#define DISABLE_MAPLE_LTE1	0x0040
+#define DISABLE_MAPLE_WCDMA	0x0020
+
+/* Set DCFG_DEVDISRn for devices to be disabled for B4860 */
+#define B4860_DCFG_DEVDISR1	0
+#define B4860_DCFG_DEVDISR2	0
+#define B4860_DCFG_DEVDISR3	0
+#define B4860_DCFG_DEVDISR4	0
+#define B4860_DCFG_DEVDISR5	0
+
+/* Set DCFG_DEVDISRn for devices to be disabled for G4860 */
+#define G4860_DCFG_DEVDISR1	0
+#define G4860_DCFG_DEVDISR2	0
+#define G4860_DCFG_DEVDISR3	(DISABLE_MAPLE_LTE0 | DISABLE_MAPLE_LTE1 |\
+						DISABLE_MAPLE_WCDMA)
+#define G4860_DCFG_DEVDISR4	0
+#define G4860_DCFG_DEVDISR5	0
+
+/* Set DCFG_DEVDISRn for devices to be disabled for B4060 */
+#define B4060_DCFG_DEVDISR1	0
+#define B4060_DCFG_DEVDISR2	0
+#define B4060_DCFG_DEVDISR3	0
+#define B4060_DCFG_DEVDISR4	0
+#define B4060_DCFG_DEVDISR5	DISABLE_DDR2
+
+/* Set DCFG_DEVDISRn for devices to be disabled for G4060 */
+#define G4060_DCFG_DEVDISR1	0
+#define G4060_DCFG_DEVDISR2	0
+#define G4060_DCFG_DEVDISR3	(DISABLE_MAPLE_LTE0 | DISABLE_MAPLE_LTE1 |\
+						DISABLE_MAPLE_WCDMA)
+#define G4060_DCFG_DEVDISR4	0
+#define G4060_DCFG_DEVDISR5	DISABLE_DDR2
+
+/* Set DCFG_DEVDISRn for devices to be disabled for B4420 */
+#define B4420_DCFG_DEVDISR1	0
+#define B4420_DCFG_DEVDISR2	0
+#define B4420_DCFG_DEVDISR3	DISABLE_MAPLE_LTE1
+#define B4420_DCFG_DEVDISR4	0
+#define B4420_DCFG_DEVDISR5	DISABLE_DDR2
+
+
+void cpu_device_disable()
+{
+	ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
+
+	/* get devdisr */
+	u32 *devdisr1 = in_be32(&gur->devdisr);
+	u32 *devdisr2 = in_be32(&gur->devdisr2);
+	u32 *devdisr3 = in_be32(&gur->devdisr3);
+	u32 *devdisr4 = in_be32(&gur->devdisr4);
+	u32 *devdisr5 = in_be32(&gur->devdisr5);
+
+	/* get SVR info */
+	u32 svr = SVR_SOC_VER(get_svr());
+
+	/*
+	 * Decide on the basis of SVR which devices to disable for a
+	 * particular personality
+	 */
+	switch (svr) {
+	case SVR_B4860:
+		setbits_be32(devdisr1, B4860_DCFG_DEVDISR1);
+		setbits_be32(devdisr2, B4860_DCFG_DEVDISR2);
+		setbits_be32(devdisr3, B4860_DCFG_DEVDISR3);
+		setbits_be32(devdisr4, B4860_DCFG_DEVDISR4);
+		setbits_be32(devdisr5, B4860_DCFG_DEVDISR5);
+		break;
+	case SVR_G4860:
+		setbits_be32(devdisr1, G4860_DCFG_DEVDISR1);
+		setbits_be32(devdisr2, G4860_DCFG_DEVDISR2);
+		setbits_be32(devdisr3, G4860_DCFG_DEVDISR3);
+		setbits_be32(devdisr4, G4860_DCFG_DEVDISR4);
+		setbits_be32(devdisr5, G4860_DCFG_DEVDISR5);
+		break;
+	case SVR_B4060:
+		setbits_be32(devdisr1, B4060_DCFG_DEVDISR1);
+		setbits_be32(devdisr2, B4060_DCFG_DEVDISR2);
+		setbits_be32(devdisr3, B4060_DCFG_DEVDISR3);
+		setbits_be32(devdisr4, B4060_DCFG_DEVDISR4);
+		setbits_be32(devdisr5, B4060_DCFG_DEVDISR5);
+		break;
+	case SVR_G4060:
+		setbits_be32(devdisr1, G4060_DCFG_DEVDISR1);
+		setbits_be32(devdisr2, G4060_DCFG_DEVDISR2);
+		setbits_be32(devdisr3, G4060_DCFG_DEVDISR3);
+		setbits_be32(devdisr4, G4060_DCFG_DEVDISR4);
+		setbits_be32(devdisr5, G4060_DCFG_DEVDISR5);
+		break;
+	case SVR_B4420:
+		setbits_be32(devdisr1, B4420_DCFG_DEVDISR1);
+		setbits_be32(devdisr2, B4420_DCFG_DEVDISR2);
+		setbits_be32(devdisr3, B4420_DCFG_DEVDISR3);
+		setbits_be32(devdisr4, B4420_DCFG_DEVDISR4);
+		setbits_be32(devdisr5, B4420_DCFG_DEVDISR5);
+		break;
+	default:
+		printf("Unused devices not disabled:"
+				"No matching SVR\n");
+		break;
+	}
+}
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 64a6f9c..143d561 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -1125,6 +1125,7 @@
 #define SVR_B4860	0X868000
 #define SVR_G4860	0x868001
 #define SVR_G4060	0x868003
+#define SVR_B4060	0x868002
 #define SVR_B4440	0x868100
 #define SVR_G4440	0x868101
 #define SVR_B4420	0x868102
diff --git a/board/freescale/b4860qds/b4860qds.c b/board/freescale/b4860qds/b4860qds.c
index b1b012c..5e2efd3 100644
--- a/board/freescale/b4860qds/b4860qds.c
+++ b/board/freescale/b4860qds/b4860qds.c
@@ -575,6 +575,8 @@ int board_early_init_r(void)
 	int ret;
 	u32 svr = SVR_SOC_VER(get_svr());
 
+	cpu_device_disable();
+
 	/* Create law for MAPLE only for personalities having MAPLE */
 	if ((svr == SVR_B4860) || (svr == SVR_B4440) ||
 			(svr == SVR_B4420) || (svr == SVR_B4220)) {
-- 
1.7.6.GIT




More information about the U-Boot mailing list