All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Walmsley <paul@pwsan.com>
To: linux-omap@vger.kernel.org
Subject: [PATCH 3/5] Powerdomains: add OMAP2/3 common powerdomains
Date: Thu, 10 Apr 2008 08:46:27 -0600	[thread overview]
Message-ID: <20080410153344.047996986@pwsan.com> (raw)
In-Reply-To: 20080410144624.246788469@pwsan.com

[-- Attachment #1: add_common_powerdomains.patch --]
[-- Type: TEXT/PLAIN, Size: 7471 bytes --]

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

Signed-off-by: Paul Walmsley <paul@pwsan.com>


---
 arch/arm/mach-omap2/io.c           |    4 -
 arch/arm/mach-omap2/pm.c           |    2 
 arch/arm/mach-omap2/powerdomains.h |  144 +++++++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prm.h          |    3 
 4 files changed, 150 insertions(+), 3 deletions(-)

Index: linux-omap/arch/arm/mach-omap2/io.c
===================================================================
--- linux-omap.orig/arch/arm/mach-omap2/io.c	2008-04-10 07:54:33.000000000 -0600
+++ linux-omap/arch/arm/mach-omap2/io.c	2008-04-10 07:54:34.000000000 -0600
@@ -29,6 +29,8 @@
 
 #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);
@@ -190,7 +192,7 @@
 void __init omap2_init_common_hw(void)
 {
 	omap2_mux_init();
-	pwrdm_init(NULL);
+	pwrdm_init(powerdomains_omap);
 	omap2_clk_init();
 	omap2_init_memory();
 	gpmc_init();
Index: linux-omap/arch/arm/mach-omap2/pm.c
===================================================================
--- linux-omap.orig/arch/arm/mach-omap2/pm.c	2008-04-10 07:54:33.000000000 -0600
+++ linux-omap/arch/arm/mach-omap2/pm.c	2008-04-10 07:54:34.000000000 -0600
@@ -651,7 +651,7 @@
 	__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);
Index: linux-omap/arch/arm/mach-omap2/powerdomains.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-omap/arch/arm/mach-omap2/powerdomains.h	2008-04-10 07:55:34.000000000 -0600
@@ -0,0 +1,144 @@
+/*
+ * OMAP2/3 common powerdomain definitions
+ *
+ * Copyright (C) 2007-8 Texas Instruments, Inc.
+ * Copyright (C) 2007-8 Nokia Corporation
+ *
+ * Written by Paul Walmsley
+ * Debugging and integration fixes by Jouni Högander
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef ARCH_ARM_MACH_OMAP2_POWERDOMAINS
+#define ARCH_ARM_MACH_OMAP2_POWERDOMAINS
+
+/*
+ * This file contains all of the powerdomains that have some element
+ * of software control for the OMAP24xx and OMAP34XX chips.
+ *
+ * A few notes:
+ *
+ * This is not an exhaustive listing of powerdomains on the chips; only
+ * powerdomains that can be controlled in software.
+ *
+ * A useful validation rule for struct powerdomain:
+ * Any powerdomain referenced by a wkdep_srcs or sleepdep_srcs array
+ * must have a dep_bit assigned.  So wkdep_srcs/sleepdep_srcs are really
+ * just software-controllable dependencies.  Non-software-controllable
+ * dependencies do exist, but they are not encoded below (yet).
+ *
+ * 24xx does not support programmable sleep dependencies (SLEEPDEP)
+ *
+ */
+
+/*
+ * The names for the DSP/IVA2 powerdomains are confusing.
+ *
+ * Most OMAP chips have an on-board DSP.
+ *
+ * On the 2420, this is a 'C55 DSP called, simply, the DSP.  Its
+ * powerdomain is called the "DSP power domain."  On the 2430, the
+ * on-board DSP is a 'C64 DSP, now called the IVA2 or IVA2.1.  Its
+ * powerdomain is still called the "DSP power domain."	On the 3430,
+ * the DSP is a 'C64 DSP like the 2430, also known as the IVA2; but
+ * its powerdomain is now called the "IVA2 power domain."
+ *
+ * The 2420 also has something called the IVA, which is a separate ARM
+ * core, and has nothing to do with the DSP/IVA2.
+ *
+ * Ideally the DSP/IVA2 could just be the same powerdomain, but the PRCM
+ * address offset is different between the C55 and C64 DSPs.
+ *
+ * The overly-specific dep_bit names are due to a bit name collision
+ * with CM_FCLKEN_{DSP,IVA2}.  The DSP/IVA2 PM_WKDEP and CM_SLEEPDEP shift
+ * value are the same for all powerdomains: 2
+ */
+
+/*
+ * XXX should dep_bit be a mask, so we can test to see if it is 0 as a
+ * sanity check?
+ * XXX encode hardware fixed wakeup dependencies -- esp. for 3430 CORE
+ */
+
+#include <asm/arch/powerdomain.h>
+
+#include "prcm-common.h"
+#include "prm.h"
+#include "cm.h"
+
+/* Forward declarations - so powerdomain dependencies can be encoded */
+
+static struct powerdomain gfx_pwrdm;
+static struct powerdomain wkup_pwrdm;
+
+static struct powerdomain core_24xx_pwrdm;
+static struct powerdomain mpu_24xx_pwrdm;
+static struct powerdomain mpu_34xx_pwrdm;
+static struct powerdomain iva2_pwrdm;
+
+
+/* OMAP2/3-common powerdomains and wakeup dependencies */
+
+/*
+ * 2420/2430 PM_WKDEP_GFX: CORE, MPU, WKUP
+ * 3430ES1 PM_WKDEP_GFX: adds IVA2, removes CORE
+ * 3430ES2 PM_WKDEP_SGX: adds IVA2, removes CORE
+ */
+static struct pwrdm_dep gfx_sgx_wkdeps[] = {
+	{ .pwrdm = &core_24xx_pwrdm,	.omap_chip = CHIP_IS_OMAP24XX },
+	{ .pwrdm = &iva2_pwrdm,		.omap_chip = CHIP_IS_OMAP3430 },
+	{ .pwrdm = &mpu_24xx_pwrdm,	.omap_chip = CHIP_IS_OMAP24XX },
+	{ .pwrdm = &mpu_34xx_pwrdm,	.omap_chip = CHIP_IS_OMAP3430 },
+	{ .pwrdm = &wkup_pwrdm,		.omap_chip = CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430 },
+	{ NULL },
+};
+
+/*
+ * 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.
+ */
+static struct powerdomain gfx_pwrdm = {
+	.name		  = "gfx_pwrdm",
+	.prcm_offs	  = GFX_MOD,
+	.omap_chip	  = CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430ES1,
+	.wkdep_srcs	  = gfx_sgx_wkdeps,
+	.pwrsts		  = PWRSTS_OFF_RET_ON,
+	.pwrsts_logic_ret = PWRDM_POWER_RET,
+	.banks		  = 1,
+	.pwrsts_mem_ret	  = {
+		[0] = PWRDM_POWER_RET, /* MEMRETSTATE */
+	},
+	.pwrsts_mem_on	  = {
+		[0] = PWRDM_POWER_ON,  /* MEMONSTATE */
+	},
+};
+
+static struct powerdomain wkup_pwrdm = {
+	.name		= "wkup_pwrdm",
+	.prcm_offs	= WKUP_MOD,
+	.omap_chip	= CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430,
+	.dep_bit	= OMAP_EN_WKUP_SHIFT,
+};
+
+
+
+/* As powerdomains are added or removed above, this list must also be changed */
+static struct powerdomain *powerdomains_omap[] __initdata = {
+
+	&gfx_pwrdm,
+	&wkup_pwrdm,
+
+	NULL
+};
+
+
+#endif
Index: linux-omap/arch/arm/mach-omap2/prm.h
===================================================================
--- linux-omap.orig/arch/arm/mach-omap2/prm.h	2008-04-10 07:54:33.000000000 -0600
+++ linux-omap/arch/arm/mach-omap2/prm.h	2008-04-10 07:54:34.000000000 -0600
@@ -323,7 +323,8 @@
  * 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2008-04-10 17:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10 14:46 [PATCH 0/5] Powerdomains: add OMAP2/3 powerdomain code, and common OMAP type bitfield Paul Walmsley
2008-04-10 14:46 ` [PATCH 1/5] Powerdomains: add OMAP chip type global bitfield; clean up mach-omap2/id.c Paul Walmsley
2008-04-16 21:20   ` Tony Lindgren
2008-04-18  5:48   ` Högander Jouni
2008-04-18  5:53     ` Paul Walmsley
2008-04-10 14:46 ` [PATCH 2/5] Powerdomains: add base OMAP2/3 powerdomain code Paul Walmsley
2008-04-16 21:31   ` Tony Lindgren
2008-04-10 14:46 ` Paul Walmsley [this message]
2008-04-10 14:46 ` [PATCH 4/5] Powerdomains: add OMAP2 powerdomains Paul Walmsley
2008-04-10 14:46 ` [PATCH 5/5] Powerdomains: Add OMAP3 powerdomains Paul Walmsley
2008-04-16 21:42   ` Tony Lindgren
2008-04-17 16:23     ` Paul Walmsley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080410153344.047996986@pwsan.com \
    --to=paul@pwsan.com \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.