From: Paul Walmsley <paul@pwsan.com>
To: linux-omap-open-source@linux.omap.com
Subject: [PATCH 3/7] omap2 clock: add support for inverted enable bits
Date: Wed, 19 Sep 2007 15:10:02 -0600 [thread overview]
Message-ID: <20070919211138.968218917@pwsan.com> (raw)
In-Reply-To: 20070919210959.062447046@pwsan.com
[-- Attachment #1: add_invert_enable.patch --]
[-- Type: text/plain, Size: 3160 bytes --]
On 3430ES2 (and presumably beyond), some clock tree branches from
DPLL3 & 4 can be powered down by setting 'PWRDN' bits in CM_CLKEN_PLL.
It appears that an easy way to power these branches down in our
existing clock framework is to use the PWRDN bits as clock enable bits
for the specific DPLL branches they affect. The problem with this is
that the meaning of a set PWRDN bit is 'disable,' not 'enable.' So,
introduce a new clock flag, INVERT_ENABLE, that clears the bit on
'clock enable,' and sets the bit on 'clock disable.' This flag is used
on all PWRDN clock branches in the 3430 clock framework.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
arch/arm/mach-omap2/clock.c | 21 +++++++++++++++++----
include/asm-arm/arch-omap/clock.h | 3 ++-
2 files changed, 19 insertions(+), 5 deletions(-)
Index: linux-omap/arch/arm/mach-omap2/clock.c
===================================================================
--- linux-omap.orig/arch/arm/mach-omap2/clock.c 2007-09-15 17:34:37.000000000 -0600
+++ linux-omap/arch/arm/mach-omap2/clock.c 2007-09-15 17:40:31.000000000 -0600
@@ -166,6 +166,11 @@
};
+/*
+ * Note: We don't need special code here for INVERT_ENABLE
+ * for the time being since INVERT_ENABLE only applies to clocks enabled by
+ * CM_CLKEN_PLL
+ */
static void omap2_clk_wait_ready(struct clk *clk)
{
void __iomem *reg, *other_reg, *st_reg;
@@ -220,7 +225,10 @@
}
regval32 = cm_read_reg(clk->enable_reg);
- regval32 |= (1 << clk->enable_bit);
+ if (clk->flags & INVERT_ENABLE)
+ regval32 &= ~(1 << clk->enable_bit);
+ else
+ regval32 |= (1 << clk->enable_bit);
cm_write_reg(regval32, clk->enable_reg);
wmb();
@@ -253,7 +261,10 @@
}
regval32 = cm_read_reg(clk->enable_reg);
- regval32 &= ~(1 << clk->enable_bit);
+ if (clk->flags & INVERT_ENABLE)
+ regval32 |= (1 << clk->enable_bit);
+ else
+ regval32 &= ~(1 << clk->enable_bit);
cm_write_reg(regval32, clk->enable_reg);
wmb();
}
@@ -705,10 +716,12 @@
#ifdef CONFIG_OMAP_RESET_CLOCKS
void __init omap2_clk_disable_unused(struct clk *clk)
{
- u32 regval32;
+ u32 regval32, v;
+
+ v = (clk->flags & INVERT_ENABLE) ? (1 << clk->enable_bit) : 0;
regval32 = cm_read_reg(clk->enable_reg);
- if ((regval32 & (1 << clk->enable_bit)) == 0)
+ if ((regval32 & (1 << clk->enable_bit)) == v)
return;
printk(KERN_INFO "Disabling unused clock \"%s\"\n", clk->name);
Index: linux-omap/include/asm-arm/arch-omap/clock.h
===================================================================
--- linux-omap.orig/include/asm-arm/arch-omap/clock.h 2007-09-15 17:28:20.000000000 -0600
+++ linux-omap/include/asm-arm/arch-omap/clock.h 2007-09-15 17:40:31.000000000 -0600
@@ -104,7 +104,8 @@
#define DELAYED_APP (1 << 9) /* Delay application of clock */
#define CONFIG_PARTICIPANT (1 << 10) /* Fundamental clock */
#define ENABLE_ON_INIT (1 << 11) /* Enable upon framework init */
-/* bits 12-20 are currently free */
+#define INVERT_ENABLE (1 << 12) /* 0 enables, 1 disables */
+/* bits 13-20 are currently free */
#define CLOCK_IN_OMAP310 (1 << 21)
#define CLOCK_IN_OMAP730 (1 << 22)
#define CLOCK_IN_OMAP1510 (1 << 23)
--
next prev parent reply other threads:[~2007-09-19 21:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-19 21:09 [PATCH 0/7] OMAP3 clock patches: first set Paul Walmsley
2007-09-19 21:10 ` [PATCH 1/7] omap2 arch: fix CONTROL_DEVCONF addresses for OMAP3430 Paul Walmsley
2007-09-19 21:10 ` [PATCH 2/7] omap2 clock: split out OMAP2/3 common defines, clksel rates Paul Walmsley
2007-09-19 21:10 ` Paul Walmsley [this message]
2007-09-19 21:10 ` [PATCH 4/7] omap2 clock: add OMAP3430 clock definitions, basic code Paul Walmsley
2007-09-19 21:10 ` [PATCH 5/7] gpmc: fix GPMC code to boot on 3430 Paul Walmsley
2007-09-19 21:10 ` [PATCH 6/7] dmtimer: fix source clocks for 3430 Paul Walmsley
2007-09-19 21:10 ` [PATCH 7/7] gpio: fix GPIO clock code " Paul Walmsley
-- strict thread matches above, loose matches on Subject: below --
2007-09-27 6:11 [PATCH 0/7] OMAP3 clock patches: first set (take two) Paul Walmsley
2007-09-27 6:11 ` [PATCH 3/7] omap2 clock: add support for inverted enable bits 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=20070919211138.968218917@pwsan.com \
--to=paul@pwsan.com \
--cc=linux-omap-open-source@linux.omap.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox