Skip to contentSkip to conversation

sh: clkfwk: Add resume from standby support.

PATCH In review Francesco VIRLINZI 1 participant 2 messages Apr 20, 2009 – Apr 27, 2009 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: clkfwk: Add resume from standby support.

Hi all

As already done to resume from hibernation I would add a standard way to manage the resume from standby in the clock framework.

To do that each clock has to declare to the clock framework what it has to do with the clock it-self.

As general rule during a standby a clock can be:
- reduced or
- disabled

therefore in the flags field the clock has to specify what it wants.

The ratio in standby is a specified with the highest 16 bits in the flags fields with a rule:

#define CLK_PM_EXP_SHIFT (24)
#define CLK_PM_RATIO_SHIFT (16)

ratio = ((clk->flags >> CLK_PM_RATIO_SHIFT) & 0xff) << ((clk->flags >> CLK_PM_EXP_SHIFT) & 0xff);

While to enable/disable I'm using the convention that if the

(clk->flags & CLK_PM_TURNOFF) == CLK_PM_TURNOFF)

than the clock has to be disabled.

In this manned in a single place (where the clock topology is designed) the developers can design also the configuration during the standby.

What do you think?
Regards
Francesco

From 5d0c1dec07c65f8de13c9f60a0465060ec2e5e24 Mon Sep 17 00:00:00 2001
From: Francesco Virlinzi <[email protected]>
Date: Mon, 20 Apr 2009 14:26:58 +0200
Subject: [PATCH] sh: clkfwk: Add resume from standby support.

Add the resume from standby support to the clock framework. Each clock in the flags field specifies how it has to be managed during a standby operation.

---
 arch/sh/include/asm/clock.h |    5 +++
 arch/sh/kernel/cpu/clock.c  |   76 +++++++++++++++++++++++++++++++++---------
 2 files changed, 64 insertions(+), 17 deletions(-)
arch/sh/include/asm/clock.h +5 -0
index 2f6c962..f132db9 100644
@@ -38,6 +38,11 @@ struct clk {
 #define CLK_ALWAYS_ENABLED	(1 << 0)
 #define CLK_RATE_PROPAGATES	(1 << 1)
 
+#define CLK_PM_MASK		(0xff)
+#define CLK_PM_EXP_SHIFT	(24)
+#define CLK_PM_RATIO_SHIFT	(16)
+#define CLK_PM_TURNOFF		(CLK_PM_MASK << CLK_PM_EXP_SHIFT)
+
 /* Should be defined by processor-specific code */
 void arch_init_clk_ops(struct clk_ops **, int type);
 int __init arch_clk_init(void);
arch/sh/kernel/cpu/clock.c +59 -17

89 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#1 lore raw

Hi Paul, Magnus
Any feedback on that?
Regards
Francesco
Francesco VIRLINZI ha scritto:

Quoted 37 lines

Hi all

As already done to resume from hibernation I would add a standard way to manage the resume from standby in the clock framework.

To do that each clock has to declare to the clock framework what it has to do with the clock it-self.

As general rule during a standby a clock can be:
- reduced or
- disabled

therefore in the flags field the clock has to specify what it wants.

The ratio in standby is a specified with the highest 16 bits in the flags fields with a rule:

#define CLK_PM_EXP_SHIFT (24)
#define CLK_PM_RATIO_SHIFT (16)

ratio = ((clk->flags >> CLK_PM_RATIO_SHIFT) & 0xff) << ((clk->flags >> CLK_PM_EXP_SHIFT) & 0xff);

While to enable/disable I'm using the convention that if the

(clk->flags & CLK_PM_TURNOFF) = CLK_PM_TURNOFF)

than the clock has to be disabled.

In this manned in a single place (where the clock topology is designed) the developers
can design also the configuration during the standby.

What do you think?
Regards
Francesco