Skip to contentSkip to conversation

Powerdomains: add OMAP2/3 powerdomain code and common OMAP type bitfield

PATCH In review Paul Walmsley 2 participants 7 messages Apr 19, 2008 – Apr 24, 2008

Subsystems (5)
lore
Share & tools
lore

Paul Walmsley

author maintainer
#0 lore raw

cover Powerdomains: add OMAP2/3 powerdomain code and common OMAP type bitfield

Hi everyone,

This is the second version of the powerdomain patches. It:

. replaces omap_type_t typedef with struct omap_chip_id

. fixes 34xx bug in OMAP type detection code

. removes all EXPORT_SYMBOLs - these can be added back in if powerdomain
code needs to be used from loadable PM modules - the expectation is that it will only be used from PM code

. gets rid of all of the forward declarations in the powerdomain
dependency definitions - now uses powerdomain names

. creates _pwrdm_lookup() to avoid potential race in pwrdm_register()

. gets rid of tabs in comments

. cleans up some dead structure members in struct powerdomain

. adds IVA2 sleepdep for DSS, PER, USBHOST

. is refreshed against current git head (e015fc7)

This version is tested against 3430SDP ES2.1, and compile-tested with the N800 and 2430SDP configs. Size, diffstat have been updated below.

Thanks to Tony & Jouni for review and comments. More comments welcome,

- Paul

-------------------------

Hello,

this patch series adds a hardware control and monitoring interface for OMAP2/3 powerdomains. The interface is fully documented in the code.

The series also adds a common OMAP chip type detection bitfield for use with powerdomain and clockdomain structures; it is planned to expand its use to the clock framework in the future.

Powerdomain code tested on 3430SDP ES2.1; also boot-tested on N800.

Many people at Nokia and TI provided commentary and review during the development of the powerdomain patches. Particular help came from (in alphabetical order): Jouni Högander, Tony Lindgren, Sakari Poussa, Igor Stoppa, and Richard Woodruff.

---

text data bss dec hex filename

3265996  151704  100736 3518436  35afe4 vmlinux.3430sdp.orig
3269405  152552  100736 3522693  35c085 vmlinux.3430sdp

Paul Walmsley (5):
Subject: add OMAP3 powerdomains
Subject: add OMAP2 powerdomains
Subject: add OMAP2/3 common powerdomains
Subject: add base OMAP2/3 powerdomain code
Subject: add OMAP chip type global bitfield; clean up mach-omap2/id.c

 arch/arm/mach-omap2/Makefile            |    2
 arch/arm/mach-omap2/id.c                |  167 ++++--
 arch/arm/mach-omap2/io.c                |    5
 arch/arm/mach-omap2/pm.c                |    2
 arch/arm/mach-omap2/powerdomain.c       |  885 +++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/powerdomains.h      |  187 +++++++
 arch/arm/mach-omap2/powerdomains24xx.h  |  200 +++++++
 arch/arm/mach-omap2/powerdomains34xx.h  |  327 +++++++++++
 arch/arm/mach-omap2/prcm-common.h       |    3
 arch/arm/mach-omap2/prm-regbits-24xx.h  |   12
 arch/arm/mach-omap2/prm-regbits-34xx.h  |   11
 arch/arm/mach-omap2/prm.h               |    3
 arch/arm/plat-omap/Kconfig              |   12
 include/asm-arm/arch-omap/cpu.h         |   33 +
 include/asm-arm/arch-omap/powerdomain.h |  137 +++++
 15 files changed, 1924 insertions(+), 62 deletions(-)
 create mode 100644 arch/arm/mach-omap2/powerdomain.c
 create mode 100644 arch/arm/mach-omap2/powerdomains.h
 create mode 100644 arch/arm/mach-omap2/powerdomains24xx.h
 create mode 100644 arch/arm/mach-omap2/powerdomains34xx.h
 create mode 100644 include/asm-arm/arch-omap/powerdomain.h

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#1 lore raw

PATCH 1/5 add OMAP chip type structure; clean up mach-omap2/id.c

Add a new OMAP chip identification interface, omap_chip_id. omap_chip_id is a structure which contains one bit for each OMAP2/3 CPU type, and on 3430, ES level. For example, the CHIP_IS_OMAP2420 bit is set in omap_chip at boot on an OMAP2420. On OMAP3430ES2, both CHIP_IS_OMAP3430 and CHIP_IS_OMAP3430ES2 bits are set.

omap_chip is set in mach-omap2/id.c by _set_omap_chip(). Other code should use the omap_chip_is() function to test against omap_chip.

Also, clean up id.c by splitting some code out of omap_check_revision() into its own function, _set_system_rev(); and converting some debug printk()s into pr_debug().

Second revision.

---

 arch/arm/mach-omap2/id.c        |  167 ++++++++++++++++++++++++++++-----------
 include/asm-arm/arch-omap/cpu.h |   33 +++++++-
 2 files changed, 150 insertions(+), 50 deletions(-)
arch/arm/mach-omap2/id.c +118 -49
index b9a6d50..dff4b16 100644
@@ -18,6 +18,7 @@
 #include <asm/io.h>
 
 #include <asm/arch/control.h>
+#include <asm/arch/cpu.h>
 
 #if defined(CONFIG_ARCH_OMAP2420)
 #define TAP_BASE	io_p2v(0x48014000)
@@ -62,6 +63,21 @@ static struct omap_id omap_ids[] __initdata = {
 	{ .hawkeye = 0xb68a, .dev = 0x0, .type = 0x24300000 },
 };
 
+static struct omap_chip_id omap_chip;
+
+/**
+ * omap_chip_is - test whether currently running OMAP matches a chip type
+ * @oc: omap_chip_t to test against
+ *
+ * Test whether the currently-running OMAP chip matches the supplied
+ * chip type 'oc'.  Returns 1 upon a match; 0 upon failure.
+ */
+int omap_chip_is(struct omap_chip_id oci)
+{
+	return (oci.oc & omap_chip.oc) ? 1 : 0;
+}
+EXPORT_SYMBOL(omap_chip_is);
+
 static u32 __init read_tap_reg(int reg)
 {
 	unsigned int regval = 0;
@@ -93,9 +109,92 @@ static u32 __init read_tap_reg(int reg)
 
 }
 
+/*
+ * _set_system_rev - set the system_rev global based on current OMAP chip type
+ *
+ * Set the system_rev global.  This is primarily used by the cpu_is_omapxxxx()
+ * macros.
+ */
+static void __init _set_system_rev(u32 type, u8 rev)
+{
+	u32 i, ctrl_status;
+
+	/*
+	 * system_rev encoding is as follows
+	 * system_rev & 0xff000000 -> Omap Class (24xx/34xx)
+	 * system_rev & 0xfff00000 -> Omap Sub Class (242x/343x)
+	 * system_rev & 0xffff0000 -> Omap type (2420/2422/2423/2430/3430)
+	 * system_rev & 0x0000f000 -> Silicon revision (ES1, ES2 )
+	 * system_rev & 0x00000700 -> Device Type ( EMU/HS/GP/BAD )
+	 * system_rev & 0x000000c0 -> IDCODE revision[6:7]
+	 * system_rev & 0x0000003f -> sys_boot[0:5]
+	 */
+	/* Embedding the ES revision info in type field */
+	system_rev = type;
+	/* Also add IDCODE revision info only two lower bits */
+	system_rev |= ((rev & 0x3) << 6);
+
+	/* Add in the device type and sys_boot fields (see above) */
+	if (cpu_is_omap24xx()) {
+		i = OMAP24XX_CONTROL_STATUS;
+	} else if (cpu_is_omap343x()) {
+		i = OMAP343X_CONTROL_STATUS;
+	} else {
+		printk(KERN_ERR "id: unknown CPU type\n");
+		BUG();
+	}
+	ctrl_status = omap_ctrl_readl(i);
+	system_rev |= (ctrl_status & (OMAP2_SYSBOOT_5_MASK |
+				      OMAP2_SYSBOOT_4_MASK |
+				      OMAP2_SYSBOOT_3_MASK |
+				      OMAP2_SYSBOOT_2_MASK |
+				      OMAP2_SYSBOOT_1_MASK |
+				      OMAP2_SYSBOOT_0_MASK));
+	system_rev |= (ctrl_status & OMAP2_DEVICETYPE_MASK);
+}
+
+
+/*
+ * _set_omap_chip - set the omap_chip global based on OMAP chip type
+ *
+ * Build the omap_chip bits.  This variable is used by powerdomain and
+ * clockdomain code to indicate whether structures are applicable for
+ * the current OMAP chip type by ANDing it against a 'platform' bitfield
+ * in the structure.
+ */
+static void __init _set_omap_chip(void)
+{
+	if (cpu_is_omap343x()) {
+
+		omap_chip.oc = CHIP_IS_OMAP3430;
+		if (is_sil_rev_equal_to(OMAP3430_REV_ES1_0))
+			omap_chip.oc |= CHIP_IS_OMAP3430ES1;
+		else if (is_sil_rev_greater_than(OMAP3430_REV_ES1_0))
+			omap_chip.oc |= CHIP_IS_OMAP3430ES2;
+
+	} else if (cpu_is_omap243x()) {
+
+		/* Currently only supports 2430ES2.1 and 2430-all */
+		omap_chip.oc |= CHIP_IS_OMAP2430;
+
+	} else if (cpu_is_omap242x()) {
+
+		/* Currently only supports 2420ES2.1.1 and 2420-all */
+		omap_chip.oc |= CHIP_IS_OMAP2420;
+
+	} else {
+
+		/* Current CPU not supported by this code. */
+		printk(KERN_WARNING "OMAP chip type code does not yet support "
+		       "this CPU type.\n");
+		WARN_ON(1);
+
+	}
+
+}
+
 void __init omap2_check_revision(void)
 {
-	int ctrl_status = 0;
 	int i, j;
 	u32 idcode;
 	u32 prod_id;
@@ -109,21 +208,19 @@ void __init omap2_check_revision(void)
 	rev = (idcode >> 28) & 0x0f;
 	dev_type = (prod_id >> 16) & 0x0f;
 
-#ifdef DEBUG
-	printk(KERN_DEBUG "OMAP_TAP_IDCODE 0x%08x REV %i HAWKEYE 0x%04x MANF %03x\n",
-		idcode, rev, hawkeye, (idcode >> 1) & 0x7ff);
-	printk(KERN_DEBUG "OMAP_TAP_DIE_ID_0: 0x%08x\n",
-		read_tap_reg(OMAP_TAP_DIE_ID_0));
-	printk(KERN_DEBUG "OMAP_TAP_DIE_ID_1: 0x%08x DEV_REV: %i\n",
-		read_tap_reg(OMAP_TAP_DIE_ID_1),
-	       (read_tap_reg(OMAP_TAP_DIE_ID_1) >> 28) & 0xf);
-	printk(KERN_DEBUG "OMAP_TAP_DIE_ID_2: 0x%08x\n",
-		read_tap_reg(OMAP_TAP_DIE_ID_2));
-	printk(KERN_DEBUG "OMAP_TAP_DIE_ID_3: 0x%08x\n",
-		read_tap_reg(OMAP_TAP_DIE_ID_3));
-	printk(KERN_DEBUG "OMAP_TAP_PROD_ID_0: 0x%08x DEV_TYPE: %i\n",
-		prod_id, dev_type);
-#endif
+	pr_debug("OMAP_TAP_IDCODE 0x%08x REV %i HAWKEYE 0x%04x MANF %03x\n",
+		 idcode, rev, hawkeye, (idcode >> 1) & 0x7ff);
+	pr_debug("OMAP_TAP_DIE_ID_0: 0x%08x\n",
+		 read_tap_reg(OMAP_TAP_DIE_ID_0));
+	pr_debug("OMAP_TAP_DIE_ID_1: 0x%08x DEV_REV: %i\n",
+		 read_tap_reg(OMAP_TAP_DIE_ID_1),
+		 (read_tap_reg(OMAP_TAP_DIE_ID_1) >> 28) & 0xf);
+	pr_debug("OMAP_TAP_DIE_ID_2: 0x%08x\n",
+		 read_tap_reg(OMAP_TAP_DIE_ID_2));
+	pr_debug("OMAP_TAP_DIE_ID_3: 0x%08x\n",
+		 read_tap_reg(OMAP_TAP_DIE_ID_3));
+	pr_debug("OMAP_TAP_PROD_ID_0: 0x%08x DEV_TYPE: %i\n",
+		 prod_id, dev_type);
 
 	/*
 	 * Detection for 34xx ES2.0 and above can be done with just
@@ -133,6 +230,7 @@ void __init omap2_check_revision(void)
 	if (hawkeye == 0xb7ae) {
 		system_rev = 0x34300000 | ((1 + rev) << 12);
 		pr_info("OMAP%04x ES2.%i\n", system_rev >> 16, rev);
+		_set_omap_chip();
 		return;
 	}
 
@@ -159,43 +257,14 @@ void __init omap2_check_revision(void)
 		j = i;
 	}
 
-	/*
-	 * system_rev encoding is as follows
-	 * system_rev & 0xff000000 -> Omap Class (24xx/34xx)
-	 * system_rev & 0xfff00000 -> Omap Sub Class (242x/343x)
-	 * system_rev & 0xffff0000 -> Omap type (2420/2422/2423/2430/3430)
-	 * system_rev & 0x0000f000 -> Silicon revision (ES1, ES2 )
-	 * system_rev & 0x00000700 -> Device Type ( EMU/HS/GP/BAD )
-	 * system_rev & 0x000000c0 -> IDCODE revision[6:7]
-	 * system_rev & 0x0000003f -> sys_boot[0:5]
-	 */
-	/* Embedding the ES revision info in type field */
-	system_rev = omap_ids[j].type;
-	/* Also add IDCODE revision info only two lower bits */
-	system_rev |= ((rev & 0x3) << 6);
+	_set_system_rev(omap_ids[j].type, rev);
 
-	/* Add in the device type and sys_boot fields (see above) */
-	if (cpu_is_omap24xx()) {
-		i = OMAP24XX_CONTROL_STATUS;
-	} else if (cpu_is_omap343x()) {
-		i = OMAP343X_CONTROL_STATUS;
-	} else {
-		printk(KERN_ERR "id: unknown CPU type\n");
-		BUG();
-	}
-	ctrl_status = omap_ctrl_readl(i);
-	system_rev |= (ctrl_status & (OMAP2_SYSBOOT_5_MASK |
-				      OMAP2_SYSBOOT_4_MASK |
-				      OMAP2_SYSBOOT_3_MASK |
-				      OMAP2_SYSBOOT_2_MASK |
-				      OMAP2_SYSBOOT_1_MASK |
-				      OMAP2_SYSBOOT_0_MASK));
-	system_rev |= (ctrl_status & OMAP2_DEVICETYPE_MASK);
+	_set_omap_chip();
 
 	pr_info("OMAP%04x", system_rev >> 16);
 	if ((system_rev >> 8) & 0x0f)
-		printk("ES%x", (system_rev >> 12) & 0xf);
-	printk("\n");
+		pr_info("ES%x", (system_rev >> 12) & 0xf);
+	pr_info("\n");
 
 }
 
include/asm-arm/arch-omap/cpu.h +32 -1
index ed86d5e..2626fbd 100644
@@ -3,7 +3,7 @@
  *
  * OMAP cpu type detection
  *
- * Copyright (C) 2004 Nokia Corporation
+ * Copyright (C) 2004, 2008 Nokia Corporation
  *
  * Written by Tony Lindgren <[email protected]>
  *
@@ -26,6 +26,12 @@
 #ifndef __ASM_ARCH_OMAP_CPU_H
 #define __ASM_ARCH_OMAP_CPU_H
 
+struct omap_chip_id {
+	u8 oc;
+};
+
+#define OMAP_CHIP_INIT(x)	{ .oc = x }
+
 extern unsigned int system_rev;
 
 #define omap2_cpu_rev()		((system_rev >> 12) & 0x0f)
@@ -349,6 +355,31 @@ IS_OMAP_TYPE(3430, 0x3430)
 #define OMAP3430_REV_ES2_2	0x34303000
 
 /*
+ * omap_chip bits
+ *
+ * CHIP_IS_OMAP{2420,2430,3430} indicate that a particular structure is
+ * valid on all chips of that type.  CHIP_IS_OMAP3430ES{1,2} indicates
+ * something that is only valid on that particular ES revision.
+ *
+ * These bits may be ORed together to indicate structures that are
+ * available on multiple chip types.
+ *
+ * To test whether a particular structure matches the current OMAP chip type,
+ * use omap_chip_is().
+ *
+ */
+#define CHIP_IS_OMAP2420       (1 << 0)
+#define CHIP_IS_OMAP2430       (1 << 1)
+#define CHIP_IS_OMAP3430       (1 << 2)
+#define CHIP_IS_OMAP3430ES1    (1 << 3)
+#define CHIP_IS_OMAP3430ES2    (1 << 4)
+
+#define CHIP_IS_OMAP24XX       (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)
+
+int omap_chip_is(struct omap_chip_id oci);
+
+
+/*
  * Macro to detect device type i.e. EMU/HS/TST/GP/BAD
  */
 #define DEVICE_TYPE_TEST	0
author maintainer
#2 lore raw

PATCH 2/5 add base OMAP2/3 powerdomain code

In reply to Paul Walmsley

This patch creates an interface to the powerdomain registers in the PRM/CM modules on OMAP2/3. This interface is intended to be used by PM code, e.g., pm.c; not by device drivers directly.

Each powerdomain will be defined in later patches as static structures. Also defined are dependencies between powerdomains, used for adding and removing PM_WKDEP and CM_SLEEPDEP bits. The powerdomain structures are linked into a list at boot by pwrdm_register(), similar to the OMAP clock code.

The patch adds a Kconfig option, CONFIG_OMAP_DEBUG_POWERDOMAIN, which when enabled will emit verbose debug messages via pr_debug().

---

 arch/arm/mach-omap2/Makefile            |    2 
 arch/arm/mach-omap2/powerdomain.c       |  885 +++++++++++++++++++++++++++++++
 arch/arm/plat-omap/Kconfig              |   12 
 include/asm-arm/arch-omap/powerdomain.h |  137 +++++
 4 files changed, 1035 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap2/powerdomain.c
 create mode 100644 include/asm-arm/arch-omap/powerdomain.h
arch/arm/mach-omap2/Makefile +1 -1
index 5157ff2..02655e1 100644
@@ -4,7 +4,7 @@
 
 # Common support
 obj-y := irq.o id.o io.o memory.o control.o prcm.o clock.o mux.o \
-		devices.o serial.o gpmc.o timer-gp.o
+		devices.o serial.o gpmc.o timer-gp.o powerdomain.o
 
 # Functions loaded to SRAM
 obj-$(CONFIG_ARCH_OMAP2)		+= sram24xx.o
arch/arm/mach-omap2/powerdomain.c new file +885 -0

885 lines not on this page · raw message

arch/arm/plat-omap/Kconfig +12 -0
index 536f8aa..46f4a0c 100644
@@ -42,6 +42,18 @@ config OMAP_DEBUG_SRAM_PATCH
 	  confident in your SRAM code, disabling this will save
 	  about 600 bytes.
 
+config OMAP_DEBUG_POWERDOMAIN
+	bool "Emit debug messages from powerdomain layer"
+	depends on ARCH_OMAP2 || ARCH_OMAP3
+	default n
+	help
+	  Say Y here if you want to compile in powerdomain layer
+	  debugging messages for OMAP2/3.   These messages can
+	  provide more detail as to why some powerdomain calls
+	  may be failing, and will also emit a descriptive message
+	  for every powerdomain register write.  However, the
+	  extra detail costs some memory.
+
 config OMAP_RESET_CLOCKS
 	bool "Reset unused clocks during boot"
 	depends on ARCH_OMAP
include/asm-arm/arch-omap/powerdomain.h new file +137 -0

137 lines not on this page · raw message

author maintainer
#3 lore raw

PATCH 3/5 add OMAP2/3 common powerdomains

In reply to Paul Walmsley

Add powerdomains common to both OMAP2 and OMAP3 (WKUP and GFX/SGX). Modify mach-omap2/io.c to initialize the powerdomain code on boot.

---

 arch/arm/mach-omap2/io.c           |    5 +
 arch/arm/mach-omap2/pm.c           |    2 
 arch/arm/mach-omap2/powerdomains.h |  147 ++++++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prm.h          |    3 -
 4 files changed, 155 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-omap2/powerdomains.h
arch/arm/mach-omap2/io.c +5 -0
index 8acdd04..1314cc3 100644
@@ -27,6 +27,10 @@
 #include <asm/arch/mux.h>
 #include <asm/arch/omapfb.h>
 
+#include <asm/arch/powerdomain.h>
+
+#include "powerdomains.h"
+
 extern void omap_sram_init(void);
 extern int omap2_clk_init(void);
 extern void omap2_check_revision(void);
@@ -188,6 +192,7 @@ void __init omap2_map_common_io(void)
 void __init omap2_init_common_hw(void)
 {
 	omap2_mux_init();
+	pwrdm_init(powerdomains_omap);
 	omap2_clk_init();
 	omap2_init_memory();
 	gpmc_init();
arch/arm/mach-omap2/pm.c +1 -1
index a7faba3..b8a13c6 100644
@@ -651,7 +651,7 @@ static void __init prcm_setup_regs(void)
 	__raw_writel(OMAP24XX_AUTOIDLE, OMAP24XX_PRCM_SYSCONFIG);
 
 	/* Set all domain wakeup dependencies */
-	prm_write_mod_reg(OMAP_EN_WKUP, MPU_MOD, PM_WKDEP);
+	prm_write_mod_reg(OMAP_EN_WKUP_MASK, MPU_MOD, PM_WKDEP);
 	prm_write_mod_reg(0, OMAP24XX_DSP_MOD, PM_WKDEP);
 	prm_write_mod_reg(0, GFX_MOD, PM_WKDEP);
 	prm_write_mod_reg(0, CORE_MOD, PM_WKDEP);
arch/arm/mach-omap2/powerdomains.h new file +147 -0

147 lines not on this page · raw message

arch/arm/mach-omap2/prm.h +2 -1
index 125d1e2..a00f28f 100644
@@ -323,7 +323,8 @@ static __inline__ u32 __attribute__((unused)) prm_read_mod_reg(s16 module,
  * 3430: PM_WKDEP_IVA2, PM_WKDEP_GFX, PM_WKDEP_DSS, PM_WKDEP_CAM,
  *	 PM_WKDEP_PER
  */
-#define OMAP_EN_WKUP					(1 << 4)
+#define OMAP_EN_WKUP_SHIFT				4
+#define OMAP_EN_WKUP_MASK				(1 << 4)
 
 /*
  * 24XX: PM_PWSTCTRL_MPU, PM_PWSTCTRL_CORE, PM_PWSTCTRL_GFX,

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#4 lore raw

PATCH 4/5 add OMAP2 powerdomains

In reply to Paul Walmsley

Add OMAP2-specific powerdomains.

---

 arch/arm/mach-omap2/powerdomains.h     |   14 ++
 arch/arm/mach-omap2/powerdomains24xx.h |  200 ++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prm-regbits-24xx.h |   12 +-
 3 files changed, 222 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/mach-omap2/powerdomains24xx.h
arch/arm/mach-omap2/powerdomains.h +14 -0
index 56c2a8f..801e3b3 100644
@@ -98,6 +98,10 @@ static struct pwrdm_dep gfx_sgx_wkdeps[] = {
 	{ NULL },
 };
 
+
+#include "powerdomains24xx.h"
+
+
 /*
  * OMAP2/3 common powerdomains
  */
@@ -140,6 +144,16 @@ static struct powerdomain *powerdomains_omap[] __initdata = {
 	&gfx_pwrdm,
 	&wkup_pwrdm,
 
+#ifdef CONFIG_ARCH_OMAP24XX
+	&dsp_pwrdm,
+	&mpu_24xx_pwrdm,
+	&core_24xx_pwrdm,
+#endif
+
+#ifdef CONFIG_ARCH_OMAP2430
+	&mdm_pwrdm,
+#endif
+
 	NULL
 };
 
arch/arm/mach-omap2/powerdomains24xx.h new file +200 -0

200 lines not on this page · raw message

arch/arm/mach-omap2/prm-regbits-24xx.h +8 -4
index c6d17a3..4002051 100644
@@ -29,8 +29,10 @@
 #define OMAP24XX_WKUP1_EN				(1 << 0)
 
 /* PM_WKDEP_GFX, PM_WKDEP_MPU, PM_WKDEP_DSP, PM_WKDEP_MDM shared bits */
-#define OMAP24XX_EN_MPU					(1 << 1)
-#define OMAP24XX_EN_CORE				(1 << 0)
+#define OMAP24XX_EN_MPU_SHIFT				1
+#define OMAP24XX_EN_MPU_MASK				(1 << 1)
+#define OMAP24XX_EN_CORE_SHIFT 				0
+#define OMAP24XX_EN_CORE_MASK				(1 << 0)
 
 /*
  * PM_PWSTCTRL_MPU, PM_PWSTCTRL_GFX, PM_PWSTCTRL_DSP, PM_PWSTCTRL_MDM
@@ -140,8 +142,10 @@
 /* 2430 calls GLOBALWMPU_RST "GLOBALWARM_RST" instead */
 
 /* PM_WKDEP_MPU specific bits */
-#define OMAP2430_PM_WKDEP_MPU_EN_MDM			(1 << 5)
-#define OMAP24XX_PM_WKDEP_MPU_EN_DSP			(1 << 2)
+#define OMAP2430_PM_WKDEP_MPU_EN_MDM_SHIFT		5
+#define OMAP2430_PM_WKDEP_MPU_EN_MDM_MASK		(1 << 5)
+#define OMAP24XX_PM_WKDEP_MPU_EN_DSP_SHIFT		2
+#define OMAP24XX_PM_WKDEP_MPU_EN_DSP_MASK		(1 << 2)
 
 /* PM_EVGENCTRL_MPU specific bits */
 

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#5 lore raw

PATCH 5/5 add OMAP3 powerdomains

In reply to Paul Walmsley

Add OMAP3-specific powerdomains.

---

 arch/arm/mach-omap2/powerdomains.h     |   30 +++
 arch/arm/mach-omap2/powerdomains34xx.h |  327 ++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prcm-common.h      |    3 
 arch/arm/mach-omap2/prm-regbits-34xx.h |   11 +
 4 files changed, 364 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/mach-omap2/powerdomains34xx.h
arch/arm/mach-omap2/powerdomains.h +28 -2
index 801e3b3..5ad9cb0 100644
@@ -98,16 +98,28 @@ static struct pwrdm_dep gfx_sgx_wkdeps[] = {
 	{ NULL },
 };
 
+/*
+ * 3430: CM_SLEEPDEP_CAM: MPU
+ * 3430ES1: CM_SLEEPDEP_GFX: MPU
+ * 3430ES2: CM_SLEEPDEP_SGX: MPU
+ */
+static struct pwrdm_dep cam_gfx_sleepdeps[] = {
+	{
+		.pwrdm_name = "mpu_pwrdm",
+		.omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
+	},
+	{ NULL },
+};
+
 
 #include "powerdomains24xx.h"
+#include "powerdomains34xx.h"
 
 
 /*
  * OMAP2/3 common powerdomains
  */
 
-/* XXX add sleepdeps for this powerdomain : 3430 */
-
 /*
  * The GFX powerdomain is not present on 3430ES2, but currently we do not
  * have a macro to filter it out at compile-time.
@@ -118,6 +130,7 @@ static struct powerdomain gfx_pwrdm = {
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX |
 					   CHIP_IS_OMAP3430ES1),
 	.wkdep_srcs	  = gfx_sgx_wkdeps,
+	.sleepdep_srcs	  = cam_gfx_sleepdeps,
 	.pwrsts		  = PWRSTS_OFF_RET_ON,
 	.pwrsts_logic_ret = PWRDM_POWER_RET,
 	.banks		  = 1,
@@ -154,6 +167,19 @@ static struct powerdomain *powerdomains_omap[] __initdata = {
 	&mdm_pwrdm,
 #endif
 
+#ifdef CONFIG_ARCH_OMAP34XX
+	&iva2_pwrdm,
+	&mpu_34xx_pwrdm,
+	&neon_pwrdm,
+	&core_34xx_pwrdm,
+	&cam_pwrdm,
+	&dss_pwrdm,
+	&per_pwrdm,
+	&emu_pwrdm,
+	&sgx_pwrdm,
+	&usbhost_pwrdm,
+#endif
+
 	NULL
 };
 
arch/arm/mach-omap2/powerdomains34xx.h new file +327 -0

327 lines not on this page · raw message

arch/arm/mach-omap2/prcm-common.h +2 -1
index cacb340..99a582d 100644
@@ -311,7 +311,8 @@
 #define OMAP3430_ST_GPT2				(1 << 3)
 
 /* CM_SLEEPDEP_PER, PM_WKDEP_IVA2, PM_WKDEP_MPU, PM_WKDEP_PER shared bits */
-#define OMAP3430_EN_CORE				(1 << 0)
+#define OMAP3430_EN_CORE_SHIFT				0
+#define OMAP3430_EN_CORE_MASK				(1 << 0)
 
 #endif
 
arch/arm/mach-omap2/prm-regbits-34xx.h +7 -4
index b4686bc..5b5ecfe 100644
@@ -68,7 +68,8 @@
 #define OMAP3430_VPINIDLE				(1 << 0)
 
 /* PM_WKDEP_IVA2, PM_WKDEP_MPU shared bits */
-#define OMAP3430_EN_PER					(1 << 7)
+#define OMAP3430_EN_PER_SHIFT				7
+#define OMAP3430_EN_PER_MASK				(1 << 7)
 
 /* PM_PWSTCTRL_IVA2, PM_PWSTCTRL_MPU, PM_PWSTCTRL_CORE shared bits */
 #define OMAP3430_MEMORYCHANGE				(1 << 3)
@@ -77,7 +78,7 @@
 #define OMAP3430_LOGICSTATEST				(1 << 2)
 
 /* PM_PREPWSTST_IVA2, PM_PREPWSTST_CORE shared bits */
-#define OMAP3430_LASTLOGICSTATEENTERED				(1 << 2)
+#define OMAP3430_LASTLOGICSTATEENTERED			(1 << 2)
 
 /*
  * PM_PREPWSTST_IVA2, PM_PREPWSTST_MPU, PM_PREPWSTST_CORE,
@@ -278,8 +279,10 @@
 #define OMAP3430_EMULATION_MPU_RST			(1 << 11)
 
 /* PM_WKDEP_MPU specific bits */
-#define OMAP3430_PM_WKDEP_MPU_EN_DSS			(1 << 5)
-#define OMAP3430_PM_WKDEP_MPU_EN_IVA2			(1 << 2)
+#define OMAP3430_PM_WKDEP_MPU_EN_DSS_SHIFT		5
+#define OMAP3430_PM_WKDEP_MPU_EN_DSS_MASK		(1 << 5)
+#define OMAP3430_PM_WKDEP_MPU_EN_IVA2_SHIFT		2
+#define OMAP3430_PM_WKDEP_MPU_EN_IVA2_MASK		(1 << 2)
 
 /* PM_EVGENCTRL_MPU */
 #define OMAP3430_OFFLOADMODE_SHIFT			3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#6 lore raw
In reply to Paul Walmsley
Quoted 22 lines · Paul Walmsley

Hi everyone,

This is the second version of the powerdomain patches. It:

. replaces omap_type_t typedef with struct omap_chip_id

. fixes 34xx bug in OMAP type detection code

. removes all EXPORT_SYMBOLs - these can be added back in if powerdomain
code needs to be used from loadable PM modules - the expectation is that it will only be used from PM code

. gets rid of all of the forward declarations in the powerdomain
dependency definitions - now uses powerdomain names

. creates _pwrdm_lookup() to avoid potential race in pwrdm_register()

. gets rid of tabs in comments

. cleans up some dead structure members in struct powerdomain

Quoted 8 lines

. adds IVA2 sleepdep for DSS, PER, USBHOST

. is refreshed against current git head (e015fc7)

This version is tested against 3430SDP ES2.1, and compile-tested with the N800 and 2430SDP configs. Size, diffstat have been updated below.

Thanks to Tony & Jouni for review and comments. More comments welcome,

Pushing today.

Tony

Quoted 50 lines

- Paul

-------------------------

Hello,

this patch series adds a hardware control and monitoring interface for OMAP2/3 powerdomains. The interface is fully documented in the code.

The series also adds a common OMAP chip type detection bitfield for use with powerdomain and clockdomain structures; it is planned to expand its use to the clock framework in the future.

Powerdomain code tested on 3430SDP ES2.1; also boot-tested on N800.

Many people at Nokia and TI provided commentary and review during the development of the powerdomain patches. Particular help came from (in alphabetical order): Jouni Högander, Tony Lindgren, Sakari Poussa, Igor Stoppa, and Richard Woodruff.

---

text data bss dec hex filename

3265996  151704  100736 3518436  35afe4 vmlinux.3430sdp.orig
3269405  152552  100736 3522693  35c085 vmlinux.3430sdp

Paul Walmsley (5):
Subject: add OMAP3 powerdomains
Subject: add OMAP2 powerdomains
Subject: add OMAP2/3 common powerdomains
Subject: add base OMAP2/3 powerdomain code
Subject: add OMAP chip type global bitfield; clean up mach-omap2/id.c

 arch/arm/mach-omap2/Makefile            |    2
 arch/arm/mach-omap2/id.c                |  167 ++++--
 arch/arm/mach-omap2/io.c                |    5
 arch/arm/mach-omap2/pm.c                |    2
 arch/arm/mach-omap2/powerdomain.c       |  885 +++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/powerdomains.h      |  187 +++++++
 arch/arm/mach-omap2/powerdomains24xx.h  |  200 +++++++
 arch/arm/mach-omap2/powerdomains34xx.h  |  327 +++++++++++
 arch/arm/mach-omap2/prcm-common.h       |    3
 arch/arm/mach-omap2/prm-regbits-24xx.h  |   12
 arch/arm/mach-omap2/prm-regbits-34xx.h  |   11
 arch/arm/mach-omap2/prm.h               |    3
 arch/arm/plat-omap/Kconfig              |   12
Quoted 9 lines
 include/asm-arm/arch-omap/cpu.h         |   33 +
 include/asm-arm/arch-omap/powerdomain.h |  137 +++++
 15 files changed, 1924 insertions(+), 62 deletions(-)
 create mode 100644 arch/arm/mach-omap2/powerdomain.c
 create mode 100644 arch/arm/mach-omap2/powerdomains.h
 create mode 100644 arch/arm/mach-omap2/powerdomains24xx.h
 create mode 100644 arch/arm/mach-omap2/powerdomains34xx.h
 create mode 100644 include/asm-arm/arch-omap/powerdomain.h

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html