Skip to contentSkip to conversation

sh: Add support for multiple hwblk counters

PATCH Applied Magnus Damm 2 participants 2 messages Jul 17, 2009 – Jul 19, 2009 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: Add support for multiple hwblk counters

From: Magnus Damm <[email protected]>

Extend the SuperH hwblk code to support more than one counter. Contains ground work for the future Runtime PM implementation.

---

Previously posted together with the Runtime PM prototype.

 arch/sh/include/asm/hwblk.h            |   13 +++++-
 arch/sh/kernel/cpu/hwblk.c             |   69 +++++++++++++++++++++-----------
 arch/sh/kernel/cpu/sh4a/hwblk-sh7722.c |    4 -
 3 files changed, 60 insertions(+), 26 deletions(-)
arch/sh/include/asm/hwblk.h +11 -2
@@ -4,6 +4,9 @@
 #include <asm/clock.h>
 #include <asm/io.h>
 
+#define HWBLK_CNT_USAGE 0
+#define HWBLK_CNT_NR 1
+
 #define HWBLK_AREA_FLAG_PARENT (1 << 0) /* valid parent */
 
 #define HWBLK_AREA(_flags, _parent)		\
@@ -13,7 +16,7 @@
 }
 
 struct hwblk_area {
-	unsigned long cnt;
+	int cnt[HWBLK_CNT_NR];
 	unsigned char parent;
 	unsigned char flags;
 };
@@ -29,7 +32,7 @@ struct hwblk {
 	void __iomem *mstp;
 	unsigned char bit;
 	unsigned char area;
-	unsigned long cnt;
+	int cnt[HWBLK_CNT_NR];
 };
 
 struct hwblk_info {
@@ -46,6 +49,12 @@ int arch_hwblk_sleep_mode(void);
 int hwblk_register(struct hwblk_info *info);
 int hwblk_init(void);
 
+void hwblk_enable(struct hwblk_info *info, int hwblk);
+void hwblk_disable(struct hwblk_info *info, int hwblk);
+
+void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int cnt);
+void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int cnt);
+
 /* allow clocks to enable and disable hardware blocks */
 #define SH_HWBLK_CLK(_name, _id, _parent, _hwblk, _flags)	\
 {							\
arch/sh/kernel/cpu/hwblk.c +47 -22

112 lines not on this page · raw message

arch/sh/kernel/cpu/sh4a/hwblk-sh7722.c +2 -2
@@ -91,10 +91,10 @@ static struct hwblk_info sh7722_hwblk_in
 
 int arch_hwblk_sleep_mode(void)
 {
-	if (!sh7722_hwblk_area[CORE_AREA].cnt)
+	if (!sh7722_hwblk_area[CORE_AREA].cnt[HWBLK_CNT_USAGE])
 		return SUSP_SH_STANDBY | SUSP_SH_SF;
 
-	if (!sh7722_hwblk_area[CORE_AREA_BM].cnt)
+	if (!sh7722_hwblk_area[CORE_AREA_BM].cnt[HWBLK_CNT_USAGE])
 		return SUSP_SH_SLEEP | SUSP_SH_SF;
 
 	return SUSP_SH_SLEEP;
Applied
#1 lore raw
Quoted 2 lines · Magnus Damm

Extend the SuperH hwblk code to support more than one counter. Contains ground work for the future Runtime PM implementation.

Quoted 1 line · Magnus Damm

This patch adds hwblk support for the sh7723 processor.

Quoted 2 lines · Magnus Damm

Convert the r8a66597-hcd driver to dev_pm_ops. This makes the driver a good PM citizen and removes a warning printout.

Quoted 10 lines · Magnus Damm

Convert the r8a66597-hcd driver to use the on_chip flag from platform data to enable on chip behaviour instead of relying on CONFIG_SUPERH_ON_CHIP_R8A66597 ugliness.

This makes the code cleaner and also allows us to support both external and internal r8a66597 with the same kernel.

It also makes the Kconfig part more future proof since we with this patch can add support for new processors with on-chip r8a66597 without modifying the Kconfig.

Applied, thanks.