Skip to contentSkip to conversation

OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38, part two

PATCH New Paul Walmsley 6 participants 38 messages Dec 8, 2010 – Dec 18, 2010

Subsystems (8)
lore
Share & tools
lore

Paul Walmsley

author maintainer
#0 lore raw

cover OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38, part two

This patch series, intended for 2.6.38:

- adds OMAP4-specific PRM and CM instance functions, which are capable of writing to PRM/CM instances, no matter what PRCM partition they appear in;

- renames the old OMAP2/3 PRM and CM functions to prefix them with 'omap2_';

- adds OMAP4 clockdomain offset addressing to the OMAP4 clockdomain definitions;

- removes the (now unused) OMAP clockdomain .clkstctrl_reg field;

- moves plat-omap/include/plat/{clock,power}domain.h to mach-omap2/, since these are OMAP2-specific;

- moves the OMAP3 SCM padconf save code from pm34xx.c into the SCM common code.

This series is available via git from git://git.pwsan.com/linux-2.6 in the branch 'pwrdm_prcm_b_2.6.38'. It applies on top of the "OMAP:
PRCM/powerdomain/clockdomain patches for 2.6.38, part one" series, sent earlier.

Kevin and OMAP ASoC-hackers, I'd appreciate review and acks, if appropriate, on the patches that touch code that you maintain. TI OMAP4 PM people, I would appreciate any testing assistance that you may be able to provide. Beno?t, I've tried to keep the kernel data files and the output of the scripts relatively similar, but we might need to do some tweaking of the scripts or data files to align them in the way that makes the most sense.

Boot-tested on N800, OMAP35xx Beagle, and OMAP4430ES2 Panda.

- Paul

---

pwrdm_prcm_b_2.6.38
text data bss dec hex filename
5709988 473952 5608800 11792740 b3f164 vmlinux.orig
5712868 474496 5608800 11796164 b3fec4 vmlinux.patched

Paul Walmsley (11):
OMAP4: PRCM: add OMAP4-specific accessor/mutator functions
OMAP4: PRCM: move global reset function for OMAP4 to an OMAP4-specific file OMAP2/3: PRM/CM: prefix OMAP2 PRM/CM functions with "omap2_"
OMAP4: powerdomains: add PRCM partition data; use OMAP4 PRM functions
OMAP2+: clockdomains: split the clkdm hwsup enable/disable function
OMAP4: CM instances: add clockdomain register offsets
OMAP4: clockdomains: add OMAP4 PRCM data and OMAP4 support
OMAP2/3: clockdomain: remove unneeded .clkstctrl_reg, remove some direct CM register accesses OMAP2+: clockdomain: move header file from plat-omap to mach-omap2
OMAP2+: powerdomain: move header file from plat-omap to mach-omap2
OMAP3: control/PM: move padconf save code to mach-omap2/control.c

 arch/arm/mach-omap2/Makefile                     |    4 
 arch/arm/mach-omap2/clkt2xxx_apll.c              |   10 -
 arch/arm/mach-omap2/clkt2xxx_dpllcore.c          |    8 
 arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c     |   12 -
 arch/arm/mach-omap2/clock.c                      |    2 
 arch/arm/mach-omap2/clockdomain.c                |  209 ++++++-----
 arch/arm/mach-omap2/clockdomain.h                |   33 +-
 arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c |   42 --
 arch/arm/mach-omap2/clockdomains44xx_data.c      |  123 ++++--
 arch/arm/mach-omap2/cm-regbits-24xx.h            |    5 
 arch/arm/mach-omap2/cm-regbits-34xx.h            |   11 +
 arch/arm/mach-omap2/cm1_44xx.h                   |   10 +
 arch/arm/mach-omap2/cm2_44xx.h                   |   25 +
 arch/arm/mach-omap2/cm2xxx_3xxx.c                |  420 +++++++++++++---------
 arch/arm/mach-omap2/cm2xxx_3xxx.h                |   19 +
 arch/arm/mach-omap2/cm44xx.c                     |   52 +++
 arch/arm/mach-omap2/cm4xxx.c                     |   62 ---
 arch/arm/mach-omap2/cminst44xx.c                 |  223 ++++++++++++
 arch/arm/mach-omap2/control.c                    |   72 +++-
 arch/arm/mach-omap2/control.h                    |    1 
 arch/arm/mach-omap2/cpuidle34xx.c                |    4 
 arch/arm/mach-omap2/io.c                         |    4 
 arch/arm/mach-omap2/omap_hwmod.c                 |    4 
 arch/arm/mach-omap2/pm-debug.c                   |   12 -
 arch/arm/mach-omap2/pm.c                         |    4 
 arch/arm/mach-omap2/pm.h                         |    2 
 arch/arm/mach-omap2/pm24xx.c                     |  200 +++++-----
 arch/arm/mach-omap2/pm34xx.c                     |  162 ++++----
 arch/arm/mach-omap2/pm44xx.c                     |    2 
 arch/arm/mach-omap2/powerdomain-common.c         |    1 
 arch/arm/mach-omap2/powerdomain.c                |   14 +
 arch/arm/mach-omap2/powerdomain.h                |   30 +-
 arch/arm/mach-omap2/powerdomain2xxx_3xxx.c       |   68 ++--
 arch/arm/mach-omap2/powerdomain44xx.c            |  122 ++++--
 arch/arm/mach-omap2/powerdomains.h               |   30 --
 arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c |    4 
 arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.h |    2 
 arch/arm/mach-omap2/powerdomains2xxx_data.c      |    3 
 arch/arm/mach-omap2/powerdomains3xxx_data.c      |    3 
 arch/arm/mach-omap2/powerdomains44xx_data.c      |   20 +
 arch/arm/mach-omap2/prcm.c                       |   51 +--
 arch/arm/mach-omap2/prcm44xx.h                   |   42 ++
 arch/arm/mach-omap2/prcm_mpu44xx.c               |   45 ++
 arch/arm/mach-omap2/prcm_mpu44xx.h               |   13 +
 arch/arm/mach-omap2/prm2xxx_3xxx.c               |   34 +-
 arch/arm/mach-omap2/prm2xxx_3xxx.h               |   12 -
 arch/arm/mach-omap2/prm44xx.c                    |   79 ++++
 arch/arm/mach-omap2/prm44xx.h                    |   23 +
 arch/arm/mach-omap2/prminst44xx.c                |   74 ++++
 arch/arm/mach-omap2/prminst44xx.h                |   25 +
 arch/arm/mach-omap2/sdrc2xxx.c                   |    4 
 arch/arm/mach-omap2/serial.c                     |    1 
 arch/arm/plat-omap/gpio.c                        |    5 
 arch/arm/plat-omap/include/plat/gpio.h           |    2 
 arch/arm/plat-omap/include/plat/omap-pm.h        |    2 
 arch/arm/plat-omap/include/plat/prcm.h           |   10 -
 arch/arm/plat-omap/mcbsp.c                       |    8 
 arch/arm/plat-omap/omap-pm-noop.c                |    2 
 58 files changed, 1597 insertions(+), 869 deletions(-)
 rename arch/arm/{plat-omap/include/plat/clockdomain.h => mach-omap2/clockdomain.h} (86%)
 create mode 100644 arch/arm/mach-omap2/cm44xx.c
 delete mode 100644 arch/arm/mach-omap2/cm4xxx.c
 create mode 100644 arch/arm/mach-omap2/cminst44xx.c
 rename arch/arm/{plat-omap/include/plat/powerdomain.h => mach-omap2/powerdomain.h} (90%)
 delete mode 100644 arch/arm/mach-omap2/powerdomains.h
 create mode 100644 arch/arm/mach-omap2/prcm44xx.h
 create mode 100644 arch/arm/mach-omap2/prcm_mpu44xx.c
 create mode 100644 arch/arm/mach-omap2/prminst44xx.c
 create mode 100644 arch/arm/mach-omap2/prminst44xx.h
author maintainer
#1 lore raw

PATCH 1/11 OMAP4: PRCM: add OMAP4-specific accessor/mutator functions

In some ways, the OMAP4 PRCM register layout is quite different than the OMAP2/3 PRCM register layout. For example, on OMAP2/3, from a register layout point of view, all CM instances were located in the CM subsystem, and all PRM instances were located in the PRM subsystem. OMAP4 changes this. Now, for example, some CM instances, such as WKUP_CM and EMU_CM, are located in the system PRM subsystem. And a "local PRCM" exists for the MPU - this PRCM combines registers that would normally appear in both CM and PRM instances, but uses its own register layout which matches neither the OMAP2/3 PRCM layout nor the OMAP4 PRCM layout.

To try to deal with this, introduce some new functions, omap4_cminst* and omap4_prminst*. The former is to be used when writing to a CM instance register (no matter what subsystem or hardware module it exists in), and the latter, similarly, with PRM instance registers. To determine which "PRCM partition" to write to, the functions take a PRCM instance ID argument. Subsequent patches add these partition IDs to the OMAP4 powerdomain and clockdomain definitions.

As far as I can see, there's really no good way to handle these types of register access inconsistencies. This patch seemed like the least bad approach.

Moving forward, the long-term goal is to remove all direct PRCM register access from the PM code. PRCM register access should go through layers such as the powerdomain and clockdomain code that can hide the details of how to interact with the specific hardware variant.

While here, rename cm4xxx.c to cm44xx.c to match the naming convention of the other OMAP4 PRCM files.

Cc Beno?t Cousson <[email protected]>
Cc Rajendra Nayak <[email protected]>
Cc Santosh Shilimkar <[email protected]>
---
 arch/arm/mach-omap2/Makefile           |    4 +
 arch/arm/mach-omap2/cm1_44xx.h         |    5 +
 arch/arm/mach-omap2/cm2_44xx.h         |    6 ++
 arch/arm/mach-omap2/cm44xx.c           |   52 ++++++++++++++
 arch/arm/mach-omap2/cm4xxx.c           |   62 -----------------
 arch/arm/mach-omap2/cminst44xx.c       |  118 ++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prcm.c             |   26 -------
 arch/arm/mach-omap2/prcm44xx.h         |   42 +++++++++++
 arch/arm/mach-omap2/prcm_mpu44xx.c     |   45 ++++++++++++
 arch/arm/mach-omap2/prcm_mpu44xx.h     |    8 ++
 arch/arm/mach-omap2/prm44xx.c          |   65 ++++++++++++++++++
 arch/arm/mach-omap2/prm44xx.h          |    6 ++
 arch/arm/mach-omap2/prminst44xx.c      |   74 ++++++++++++++++++++
 arch/arm/mach-omap2/prminst44xx.h      |   25 +++++++
 arch/arm/plat-omap/include/plat/prcm.h |    7 +-
 15 files changed, 454 insertions(+), 91 deletions(-)
 create mode 100644 arch/arm/mach-omap2/cm44xx.c
 delete mode 100644 arch/arm/mach-omap2/cm4xxx.c
 create mode 100644 arch/arm/mach-omap2/cminst44xx.c
 create mode 100644 arch/arm/mach-omap2/prcm44xx.h
 create mode 100644 arch/arm/mach-omap2/prcm_mpu44xx.c
 create mode 100644 arch/arm/mach-omap2/prminst44xx.c
 create mode 100644 arch/arm/mach-omap2/prminst44xx.h
arch/arm/mach-omap2/Makefile +3 -1
index 7f3302f..0fa48a882 100644
@@ -68,7 +68,9 @@ obj-$(CONFIG_ARCH_OMAP3)		+= prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
 # XXX The presence of cm2xxx_3xxx.o on the line below is temporary and
 # will be removed once the OMAP4 part of the codebase is converted to
 # use OMAP4-specific PRCM functions.
-obj-$(CONFIG_ARCH_OMAP4)		+= prcm.o cm2xxx_3xxx.o cm4xxx.o
+obj-$(CONFIG_ARCH_OMAP4)		+= prcm.o cm2xxx_3xxx.o cminst44xx.o \
+					   cm44xx.o prcm_mpu44xx.o \
+					   prminst44xx.o
 
 # OMAP powerdomain framework
 powerdomain-common			+= powerdomain.o powerdomain-common.o
arch/arm/mach-omap2/cm1_44xx.h +5 -0
index aa2ee78..63ef9e3 100644
@@ -248,4 +248,9 @@
 #define OMAP4_CM_DYN_DEP_PRESCAL_RESTORE_OFFSET		0x0040
 #define OMAP4430_CM_DYN_DEP_PRESCAL_RESTORE		OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_INST, 0x0040)
 
+/* Function prototypes */
+extern u32 omap4_cm1_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_cm1_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
+
 #endif
arch/arm/mach-omap2/cm2_44xx.h +6 -0
index 89c9522..0fd0210 100644
@@ -480,4 +480,10 @@
 #define OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL_RESTORE	OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_INST, 0x0058)
 #define OMAP4_CM_SDMA_STATICDEP_RESTORE_OFFSET		0x005c
 #define OMAP4430_CM_SDMA_STATICDEP_RESTORE		OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_INST, 0x005c)
+
+/* Function prototypes */
+extern u32 omap4_cm2_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_cm2_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
+
 #endif
arch/arm/mach-omap2/cm44xx.c new file +52 -0

52 lines not on this page · raw message

arch/arm/mach-omap2/cm4xxx.c deleted +0 -62

62 lines not on this page · raw message

arch/arm/mach-omap2/cminst44xx.c new file +118 -0

118 lines not on this page · raw message

arch/arm/mach-omap2/prcm.c +1 -25
index dd95cbb..fe0865b 100644
@@ -33,6 +33,7 @@
 #include "cm44xx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
+#include "prcm44xx.h"
 #include "prm-regbits-24xx.h"
 #include "prm-regbits-44xx.h"
 #include "control.h"
@@ -80,31 +81,6 @@ void omap_prcm_arch_reset(char mode, const char *cmd)
 				     prcm_offs, OMAP4_RM_RSTCTRL);
 }
 
-/* Read a PRM register, AND it, and shift the result down to bit 0 */
-u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask)
-{
-	u32 v;
-
-	v = __raw_readl(reg);
-	v &= mask;
-	v >>= __ffs(mask);
-
-	return v;
-}
-
-/* Read-modify-write a register in a PRM module. Caller must lock */
-u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg)
-{
-	u32 v;
-
-	v = __raw_readl(reg);
-	v &= ~mask;
-	v |= bits;
-	__raw_writel(v, reg);
-
-	return v;
-}
-
 /**
  * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness
  * @reg: physical address of module IDLEST register
arch/arm/mach-omap2/prcm44xx.h new file +42 -0

42 lines not on this page · raw message

arch/arm/mach-omap2/prcm_mpu44xx.c new file +45 -0

45 lines not on this page · raw message

arch/arm/mach-omap2/prcm_mpu44xx.h +8 -0
index 80e00c1..e5190e9 100644
@@ -88,4 +88,12 @@
 #define OMAP4_CM_CPU1_CLKSTCTRL_OFFSET			0x0018
 #define OMAP4430_CM_CPU1_CLKSTCTRL			OMAP44XX_PRCM_MPU_REGADDR(OMAP4430_PRCM_MPU_CPU1_INST, 0x0018)
 
+/* Function prototypes */
+# ifndef __ASSEMBLER__
+extern u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,
+					    s16 idx);
+# endif
+
 #endif
arch/arm/mach-omap2/prm44xx.c +65 -0

77 lines not on this page · raw message

arch/arm/mach-omap2/prm44xx.h +6 -0
index 3d36149..3588653 100644
@@ -744,6 +744,12 @@
 /* Function prototypes */
 # ifndef __ASSEMBLER__
 
+extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
+extern u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg);
+extern u32 omap4_prm_set_inst_reg_bits(u32 bits, s16 inst, s16 idx);
+extern u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 idx);
 extern u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask);
 
 extern int omap4_prm_is_hardreset_asserted(void __iomem *rstctrl_reg, u8 shift);
arch/arm/mach-omap2/prminst44xx.c new file +74 -0

74 lines not on this page · raw message

arch/arm/mach-omap2/prminst44xx.h new file +25 -0
new file mode 100644
index 0000000..02dd66d
@@ -0,0 +1,25 @@
+/*
+ * OMAP4 Power/Reset Management (PRM) function prototypes
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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_ASM_MACH_OMAP2_PRMINST44XX_H
+#define __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H
+
+/*
+ * In an ideal world, we would not export these low-level functions,
+ * but this will probably take some time to fix properly
+ */
+extern u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx);
+extern void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx);
+extern u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,
+					   s16 inst, s16 idx);
+
+extern void omap4_prm_global_warm_sw_reset(void);
+
+#endif
arch/arm/plat-omap/include/plat/prcm.h +4 -3
index d059a05..078906d 100644
@@ -18,6 +18,10 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * XXX This file is deprecated.  The PRCM is an OMAP2+-only subsystem,
+ * so this file doesn't belong in plat-omap/include/plat.  Please
+ * do not add anything new to this file.
  */
 
 #ifndef __ASM_ARM_ARCH_OMAP_PRCM_H
@@ -31,9 +35,6 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
 #define START_PADCONF_SAVE 0x2
 #define PADCONF_SAVE_DONE  0x1
 
-u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask);
-u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg);
-
 #endif
 
 
#2 lore raw

PATCH 1/11 OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

Paul,

Quoted 19 lines

-----Original Message-----
From: Paul Walmsley [mailto:paul at pwsan.com]
Sent: Wednesday, December 08, 2010 11:49 AM
To: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
Cc: Rajendra Nayak; Santosh Shilimkar; Beno?t Cousson
Subject: [PATCH 01/11] OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

In some ways, the OMAP4 PRCM register layout is quite different than the OMAP2/3 PRCM register layout. For example, on OMAP2/3, from a register layout point of view, all CM instances were located in the CM subsystem, and all PRM instances were located in the PRM subsystem. OMAP4 changes this. Now, for example, some CM instances, such as WKUP_CM and EMU_CM, are located in the system PRM subsystem. And a "local PRCM" exists for the MPU - this PRCM combines registers that would normally appear in both CM and PRM instances, but uses its own register layout which matches neither the OMAP2/3 PRCM layout nor the OMAP4 PRCM layout.

Quoted 8 lines

To try to deal with this, introduce some new functions, omap4_cminst* and omap4_prminst*. The former is to be used when writing to a CM instance register (no matter what subsystem or hardware module it exists in), and the latter, similarly, with PRM instance registers. To determine which "PRCM partition" to write to, the functions take a PRCM instance ID argument. Subsequent patches add these partition IDs to the OMAP4 powerdomain and clockdomain definitions.

Thanks a lot for this cleanup.

Quoted 10 lines

As far as I can see, there's really no good way to handle these types of register access inconsistencies. This patch seemed like the least bad approach.

Moving forward, the long-term goal is to remove all direct PRCM register access from the PM code. PRCM register access should go through layers such as the powerdomain and clockdomain code that can hide the details of how to interact with the specific hardware variant.

One more possible road block of removing the direct register access from PM code is DEVICE PRM module. Even with this clean-up for DEVCIE PRM related registers. I guess we still need to use the lowest level APIs.

Quoted 33 lines

While here, rename cm4xxx.c to cm44xx.c to match the naming convention of the other OMAP4 PRCM files.

Cc Beno?t Cousson <[email protected]>
Cc Rajendra Nayak <[email protected]>
Cc Santosh Shilimkar <[email protected]>
---
 arch/arm/mach-omap2/Makefile           |    4 +
 arch/arm/mach-omap2/cm1_44xx.h         |    5 +
 arch/arm/mach-omap2/cm2_44xx.h         |    6 ++
 arch/arm/mach-omap2/cm44xx.c           |   52 ++++++++++++++
 arch/arm/mach-omap2/cm4xxx.c           |   62 -----------------
 arch/arm/mach-omap2/cminst44xx.c       |  118
++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prcm.c             |   26 -------
 arch/arm/mach-omap2/prcm44xx.h         |   42 +++++++++++
 arch/arm/mach-omap2/prcm_mpu44xx.c     |   45 ++++++++++++
 arch/arm/mach-omap2/prcm_mpu44xx.h     |    8 ++
 arch/arm/mach-omap2/prm44xx.c          |   65 ++++++++++++++++++
 arch/arm/mach-omap2/prm44xx.h          |    6 ++
 arch/arm/mach-omap2/prminst44xx.c      |   74 ++++++++++++++++++++
 arch/arm/mach-omap2/prminst44xx.h      |   25 +++++++
 arch/arm/plat-omap/include/plat/prcm.h |    7 +-
 15 files changed, 454 insertions(+), 91 deletions(-)
 create mode 100644 arch/arm/mach-omap2/cm44xx.c
 delete mode 100644 arch/arm/mach-omap2/cm4xxx.c
 create mode 100644 arch/arm/mach-omap2/cminst44xx.c
 create mode 100644 arch/arm/mach-omap2/prcm44xx.h
 create mode 100644 arch/arm/mach-omap2/prcm_mpu44xx.c
 create mode 100644 arch/arm/mach-omap2/prminst44xx.c
 create mode 100644 arch/arm/mach-omap2/prminst44xx.h
author maintainer
#3 lore raw

PATCH 1/11 OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

Quoted 4 lines · Santosh Shilimkar

One more possible road block of removing the direct register access from PM code is DEVICE PRM module. Even with this clean-up for DEVCIE PRM related registers. I guess we still need to use the lowest level APIs.

To clarify my comments, I'm not talking about replacing omap4_prm_*() with omap4_prminst_*() for the device PRM cases. I agree that is not desirable. What I'd like to see is for the middle-level PM code, such as pm*.c, to call functions that describe what they are actually trying to do at a higher level, rather than writing to registers directly.

I'll take the PRM_VOLTSETUP* registers as a rough example. This may be a bad example since we probably don't write to this directly from pm*.c any more, but the basic idea is, rather than writing some mystery value to a register from the pm*.c code, we should write something like:

int omap4_prm_regulator_set_ramp_up_duration(u32 ns, u8 starting_pwrst);

which would then take care of computing the prescaler and count values appropriately given the current sys_clk and writing them to the register or returning an error if something is wrong.

The long-term goal is to be able to reuse as much PM code as possible between all of the different OMAP2+ platforms.

- Paul

#4 lore raw

PATCH 1/11 OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

Quoted 9 lines

-----Original Message-----
From: Paul Walmsley [mailto:paul at pwsan.com]
Sent: Saturday, December 11, 2010 7:26 AM
To: Santosh Shilimkar
Cc: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org; Rajendra Nayak; Benoit Cousson
Subject: RE: [PATCH 01/11] OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

Quoted 8 lines
Quoted 4 lines · Santosh Shilimkar

One more possible road block of removing the direct register access from PM code is DEVICE PRM module. Even with this clean-up for DEVCIE PRM related registers. I guess we still need to use the lowest level APIs.

To clarify my comments, I'm not talking about replacing omap4_prm_*()

with

Quoted 2 lines

omap4_prminst_*() for the device PRM cases. I agree that is not desirable. What I'd like to see is for the middle-level PM code, such

as

Quoted 1 line

pm*.c, to call functions that describe what they are actually trying to

do

Quoted 3 lines

at a higher level, rather than writing to registers directly.

I'll take the PRM_VOLTSETUP* registers as a rough example. This may be

a

Quoted 1 line

bad example since we probably don't write to this directly from pm*.c

any

Quoted 12 lines

more, but the basic idea is, rather than writing some mystery value to a register from the pm*.c code, we should write something like:

int omap4_prm_regulator_set_ramp_up_duration(u32 ns, u8 starting_pwrst);

which would then take care of computing the prescaler and count values appropriately given the current sys_clk and writing them to the register or returning an error if something is wrong.

The long-term goal is to be able to reuse as much PM code as possible between all of the different OMAP2+ platforms.

Thanks for clarification. We are fully aligned here.

Regards,
Santosh

#5 lore raw

PATCH 1/11 OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

In reply to Paul Walmsley

<snip>...

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/mach-omap2/cminst44xx.c

Quoted 31 lines

new file mode 100644
index 0000000..2c0cad3

arch/arm/mach-omap2/cminst44xx.c new file +26 -0
@@ -0,0 +1,118 @@
+/*
+ * OMAP4 CM instance functions
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ *
+ * This is needed since CM instances can be in the PRM, PRCM_MPU, CM1,
+ * or CM2 hardware modules.  For example, the EMU_CM CM instance is in
+ * the PRM hardware module.  What a mess...
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+
+#include "cm.h"
+#include "cm1_44xx.h"
+#include "cm2_44xx.h"

arch/arm/mach-omap2/cminst44xx.c line 36

Quoted 10 lines
arch/arm/mach-omap2/cminst44xx.c new file +10 -0
+#include "cm44xx.h"
+#include "cminst44xx.h"
+#include "cm-regbits-44xx.h"
+#include "prcm44xx.h"
+#include "prm44xx.h"
+#include "prcm_mpu44xx.h"
+
+static u32 (*_cm_read_fns[OMAP4_MAX_PRCM_PARTITIONS])(s16, u16)  = {
+	[OMAP4430_INVALID_PRCM_PARTITION]	= NULL,
+	[OMAP4430_PRM_PARTITION]		=

&omap4_prm_read_inst_reg,

arch/arm/mach-omap2/cminst44xx.c line 37

Quoted 1 line
arch/arm/mach-omap2/cminst44xx.c new file +1 -0
+	[OMAP4430_CM1_PARTITION]		=

&omap4_cm1_read_inst_reg,

arch/arm/mach-omap2/cminst44xx.c line 38

Quoted 1 line
arch/arm/mach-omap2/cminst44xx.c new file +1 -0
+	[OMAP4430_CM2_PARTITION]		=

&omap4_cm2_read_inst_reg,

arch/arm/mach-omap2/cminst44xx.c line 40

Quoted 2 lines
arch/arm/mach-omap2/cminst44xx.c new file +2 -0
+	[OMAP4430_SCRM_PARTITION]		= NULL,
+	[OMAP4430_PRCM_MPU_PARTITION]		=

&omap4_prcm_mpu_read_inst_reg

arch/arm/mach-omap2/cminst44xx.c

Quoted 3 lines
arch/arm/mach-omap2/cminst44xx.c new file +3 -0
+};
+
+static void (*_cm_write_fns[OMAP4_MAX_PRCM_PARTITIONS])(u32, s16, u16)

= {

arch/arm/mach-omap2/cminst44xx.c line 45

Quoted 2 lines
arch/arm/mach-omap2/cminst44xx.c new file +2 -0
+	[OMAP4430_INVALID_PRCM_PARTITION]	= NULL,
+	[OMAP4430_PRM_PARTITION]		=

&omap4_prm_write_inst_reg,

arch/arm/mach-omap2/cminst44xx.c line 46

Quoted 1 line
arch/arm/mach-omap2/cminst44xx.c new file +1 -0
+	[OMAP4430_CM1_PARTITION]		=

&omap4_cm1_write_inst_reg,

arch/arm/mach-omap2/cminst44xx.c line 47

Quoted 1 line
arch/arm/mach-omap2/cminst44xx.c new file +1 -0
+	[OMAP4430_CM2_PARTITION]		=

&omap4_cm2_write_inst_reg,

arch/arm/mach-omap2/cminst44xx.c line 49

Quoted 2 lines
arch/arm/mach-omap2/cminst44xx.c new file +2 -0
+	[OMAP4430_SCRM_PARTITION]		= NULL,
+	[OMAP4430_PRCM_MPU_PARTITION]		=

&omap4_prcm_mpu_write_inst_reg

arch/arm/mach-omap2/cminst44xx.c line 58

Quoted 9 lines
arch/arm/mach-omap2/cminst44xx.c new file +9 -0
+};
+
+/* Read a register in a CM instance */
+u32 omap4_cminst_read_inst_reg(u8 part, s16 module, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_cm_read_fns[part]);
+	return _cm_read_fns[part](module, idx);

Hi Paul,

Would it help if we can avoid one more level of function indirection (given that these are low level apis) and store the Partition offsets in the tables above (instead of func pointers) and do some thing like this.

return __raw_readl(OMAP2_L4_IO_ADDRESS(cm_read_offset[part],
module, idx));

with the table entries of cm_read_offset looking something like

arch/arm/mach-omap2/cminst44xx.c line 61

Quoted 3 lines
arch/arm/mach-omap2/cminst44xx.c new file +3 -0
+	[OMAP4430_PRM_PARTITION]		= OMAP4430_PRM_BASE,
+	[OMAP4430_CM1_PARTITION]		= OMAP4430_CM1_BASE,
+	[OMAP4430_CM2_PARTITION]		= OMAP4430_CM2_BASE,

regards,
Rajendra

Quoted 21 lines
arch/arm/mach-omap2/cminst44xx.c new file +21 -0
+}
+
+/* Write into a register in a CM instance */
+void omap4_cminst_write_inst_reg(u32 val, u8 part, s16 module, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_cm_write_fns[part]);
+	_cm_write_fns[part](val, module, idx);
+}
+
+/* Read-modify-write a register in CM1. Caller must lock */
+u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,
+				  s16 module, s16 idx)
+{
+	u32 v;
+
+	v = omap4_cminst_read_inst_reg(part, module, idx);
+	v &= ~mask;
+	v |= bits;
+	omap4_cminst_write_inst_reg(v, part, module, idx);

arch/arm/mach-omap2/cminst44xx.c

Quoted 10 lines
arch/arm/mach-omap2/cminst44xx.c new file +10 -0
+
+	return v;
+}
+
+
+/**
+ * omap4_cm_wait_module_ready - wait for a module to be in 'func' state
+ * @clkctrl_reg: CLKCTRL module address
+ *
+ * Wait for the module IDLEST to be functional. If the idle state is in

any

arch/arm/mach-omap2/cminst44xx.c line 93

Quoted 1 line
arch/arm/mach-omap2/cminst44xx.c new file +1 -0
+ * the non functional state (trans, idle or disabled), module and thus

the

arch/arm/mach-omap2/cminst44xx.c

Quoted 6 lines
arch/arm/mach-omap2/cminst44xx.c new file +6 -0
+ * sysconfig cannot be accessed and will probably lead to an "imprecise
+ * external abort"
+ *
+ * Module idle state:
+ *   0x0 func:     Module is fully functional, including OCP
+ *   0x1 trans:    Module is performing transition: wakeup, or sleep,

or sleep

arch/arm/mach-omap2/cminst44xx.c line 101

Quoted 2 lines
arch/arm/mach-omap2/cminst44xx.c new file +2 -0
+ *                 abortion
+ *   0x2 idle:     Module is in Idle mode (only OCP part). It is

functional if

arch/arm/mach-omap2/cminst44xx.c

Quoted 13 lines
arch/arm/mach-omap2/cminst44xx.c new file +13 -0
+ *                 using separate functional clock
+ *   0x3 disabled: Module is disabled and cannot be accessed
+ *
+ */
+int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg)
+{
+	int i = 0;
+
+	if (!clkctrl_reg)
+		return 0;
+
+	omap_test_timeout((
+		((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) == 0)

||

Quoted 40 lines
arch/arm/mach-omap2/cminst44xx.c new file +7 -0
+		 (((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) >>
+		  OMAP4430_IDLEST_SHIFT) == 0x2)),
+		MAX_MODULE_READY_TIME, i);
+
+	return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
+}
+
arch/arm/mach-omap2/prcm.c +1 -17
index dd95cbb..fe0865b 100644
@@ -33,6 +33,7 @@
 #include "cm44xx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
+#include "prcm44xx.h"
 #include "prm-regbits-24xx.h"
 #include "prm-regbits-44xx.h"
 #include "control.h"
@@ -80,31 +81,6 @@ void omap_prcm_arch_reset(char mode, const char *cmd)
 				     prcm_offs, OMAP4_RM_RSTCTRL);
 }
 
-/* Read a PRM register, AND it, and shift the result down to bit 0 */
-u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask)
-{
-	u32 v;
-
-	v = __raw_readl(reg);
-	v &= mask;
-	v >>= __ffs(mask);
-
-	return v;
-}
-
-/* Read-modify-write a register in a PRM module. Caller must lock */
-u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg)
-{
-	u32 v;
-

arch/arm/mach-omap2/prcm.c void omap_prcm_arch_reset(char mode, const char *cmd) · line 85

Quoted 10 lines
arch/arm/mach-omap2/prcm.c +0 -8
-	v = __raw_readl(reg);
-	v &= ~mask;
-	v |= bits;
-	__raw_writel(v, reg);
-
-	return v;
-}
-
 /**
  * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module

readiness

Review

Quoted 2 lines
arch/arm/mach-omap2/prcm.c +0 -0
  * @reg: physical address of module IDLEST register
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prcm44xx.h

Quoted 31 lines

new file mode 100644
index 0000000..7334ffb

arch/arm/mach-omap2/prcm44xx.h new file +26 -0
@@ -0,0 +1,42 @@
+/*
+ * OMAP4 PRCM definitions
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ * Copyright (C) 2010 Nokia Corporation
+ *
+ * Paul Walmsley
+ *
+ * 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.
+ *
+ * This file contains macros and functions that are common to all of
+ * the PRM/CM/PRCM blocks on the OMAP4 devices: PRM, CM1, CM2,
+ * PRCM_MPU, SCRM
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP2_PRCM44XX_H
+#define __ARCH_ARM_MACH_OMAP2_PRCM44XX_H
+
+/*
+ * OMAP4 PRCM partition IDs
+ *
+ * The numbers and order are arbitrary, but 0 is reserved for the
+ * 'invalid' partition in case someone forgets to add a
+ * .prcm_partition field.

arch/arm/mach-omap2/prcm44xx.h line 36

Quoted 10 lines
arch/arm/mach-omap2/prcm44xx.h new file +10 -0
+ */
+#define OMAP4430_INVALID_PRCM_PARTITION		0
+#define OMAP4430_PRM_PARTITION			1
+#define OMAP4430_CM1_PARTITION			2
+#define OMAP4430_CM2_PARTITION			3
+#define OMAP4430_SCRM_PARTITION			4
+#define OMAP4430_PRCM_MPU_PARTITION		5
+
+/*
+ * OMAP4_MAX_PRCM_PARTITIONS: set to the highest value of the PRCM

partition

Review

Quoted 7 lines
arch/arm/mach-omap2/prcm44xx.h new file +6 -0
+ * IDs, plus one
+ */
+#define OMAP4_MAX_PRCM_PARTITIONS		6
+
+
+#endif
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prcm_mpu44xx.c

Quoted 30 lines

new file mode 100644
index 0000000..171fe17

arch/arm/mach-omap2/prcm_mpu44xx.c new file +25 -0
@@ -0,0 +1,45 @@
+/*
+ * OMAP4 PRCM_MPU module functions
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+
+#include "prcm_mpu44xx.h"
+#include "cm-regbits-44xx.h"
+
+/* PRCM_MPU low-level functions */
+
+u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg)

arch/arm/mach-omap2/prcm_mpu44xx.c line 35

Quoted 10 lines
arch/arm/mach-omap2/prcm_mpu44xx.c new file +10 -0
+{
+	return __raw_readl(OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
+}
+
+void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 reg)
+{
+	__raw_writel(val, OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
+}
+
+u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16

reg)

Review

Quoted 11 lines
arch/arm/mach-omap2/prcm_mpu44xx.c new file +10 -0
+{
+	u32 v;
+
+	v = omap4_prcm_mpu_read_inst_reg(inst, reg);
+	v &= ~mask;
+	v |= bits;
+	omap4_prcm_mpu_write_inst_reg(v, inst, reg);
+
+	return v;
+}
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prcm_mpu44xx.h

arch/arm/mach-omap2/prcm_mpu44xx.h line 96

Quoted 13 lines

index 80e00c1..e5190e9 100644

arch/arm/mach-omap2/prcm_mpu44xx.h +5 -0
@@ -88,4 +88,12 @@
 #define OMAP4_CM_CPU1_CLKSTCTRL_OFFSET			0x0018
 #define OMAP4430_CM_CPU1_CLKSTCTRL
 	OMAP44XX_PRCM_MPU_REGADDR(OMAP4430_PRCM_MPU_CPU1_INST, 0x0018)
 
+/* Function prototypes */
+# ifndef __ASSEMBLER__
+extern u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16

inst,

Review

Quoted 5 lines
arch/arm/mach-omap2/prcm_mpu44xx.h +3 -0
+					    s16 idx);
+# endif
+

#endif

(quoted diff) +0 -0

b/arch/arm/mach-omap2/prm44xx.c

Review

Quoted 83 lines

index 697b58f..c016ae4 100644

arch/arm/mach-omap2/prm44xx.c +65 -0
@@ -15,6 +15,7 @@
 #include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/err.h>
+#include <linux/io.h>
 
 #include <plat/common.h>
 #include <plat/cpu.h>
@@ -29,6 +30,70 @@
  */
 #define OMAP4_RST_CTRL_ST_OFFSET		4
 
+/* PRM low-level functions */
+
+/* Read a register in a CM/PRM instance in the PRM module */
+u32 omap4_prm_read_inst_reg(s16 inst, u16 reg)
+{
+	return __raw_readl(OMAP44XX_PRM_REGADDR(inst, reg));
+}
+
+/* Write into a register in a CM/PRM instance in the PRM module */
+void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 reg)
+{
+	__raw_writel(val, OMAP44XX_PRM_REGADDR(inst, reg));
+}
+
+/* Read-modify-write a register in a PRM module. Caller must lock */
+u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
+{
+	u32 v;
+
+	v = omap4_prm_read_inst_reg(inst, reg);
+	v &= ~mask;
+	v |= bits;
+	omap4_prm_write_inst_reg(v, inst, reg);
+
+	return v;
+}
+
+/* Read a PRM register, AND it, and shift the result down to bit 0 */
+/* XXX deprecated */
+u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask)
+{
+	u32 v;
+
+	v = __raw_readl(reg);
+	v &= mask;
+	v >>= __ffs(mask);
+
+	return v;
+}
+
+/* Read-modify-write a register in a PRM module. Caller must lock */
+/* XXX deprecated */
+u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg)
+{
+	u32 v;
+
+	v = __raw_readl(reg);
+	v &= ~mask;
+	v |= bits;
+	__raw_writel(v, reg);
+
+	return v;
+}
+
+u32 omap4_prm_set_inst_reg_bits(u32 bits, s16 inst, s16 reg)
+{
+	return omap4_prm_rmw_inst_reg_bits(bits, bits, inst, reg);
+}
+
+u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 reg)
+{
+	return omap4_prm_rmw_inst_reg_bits(bits, 0x0, inst, reg);
+}
+
 /**
  * omap4_prm_is_hardreset_asserted - read the HW reset line state of
  * submodules contained in the hwmod module
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prm44xx.h

arch/arm/mach-omap2/prm44xx.h line 749

Quoted 10 lines

index 3d36149..3588653 100644

arch/arm/mach-omap2/prm44xx.h +3 -0
@@ -744,6 +744,12 @@
 /* Function prototypes */
 # ifndef __ASSEMBLER__
 
+extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,

s16 idx);

arch/arm/mach-omap2/prm44xx.h line 750

Quoted 1 line
arch/arm/mach-omap2/prm44xx.h +1 -0
+extern u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem

*reg);

arch/arm/mach-omap2/prm44xx.h

Quoted 5 lines
arch/arm/mach-omap2/prm44xx.h +2 -0
+extern u32 omap4_prm_set_inst_reg_bits(u32 bits, s16 inst, s16 idx);
+extern u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 idx);
 extern u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask);
 
 extern int omap4_prm_is_hardreset_asserted(void __iomem *rstctrl_reg,

u8 shift);

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prminst44xx.c

Quoted 23 lines

new file mode 100644
index 0000000..01c57b6

arch/arm/mach-omap2/prminst44xx.c new file +18 -0
@@ -0,0 +1,74 @@
+/*
+ * OMAP4 PRM instance functions
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <plat/common.h>

arch/arm/mach-omap2/prminst44xx.c line 28

Quoted 10 lines
arch/arm/mach-omap2/prminst44xx.c new file +10 -0
+
+#include "prm44xx.h"
+#include "prminst44xx.h"
+#include "prm-regbits-44xx.h"
+#include "prcm44xx.h"
+#include "prcm_mpu44xx.h"
+
+static u32 (*_prm_read_fns[OMAP4_MAX_PRCM_PARTITIONS])(s16, u16)  = {
+	[OMAP4430_INVALID_PRCM_PARTITION]	= NULL,
+	[OMAP4430_PRM_PARTITION]		=

&omap4_prm_read_inst_reg,

arch/arm/mach-omap2/prminst44xx.c

Quoted 4 lines
arch/arm/mach-omap2/prminst44xx.c new file +4 -0
+	[OMAP4430_CM1_PARTITION]		= NULL,
+	[OMAP4430_CM2_PARTITION]		= NULL,
+	[OMAP4430_SCRM_PARTITION]		= NULL,
+	[OMAP4430_PRCM_MPU_PARTITION]		=

&omap4_prcm_mpu_read_inst_reg

arch/arm/mach-omap2/prminst44xx.c line 35

Quoted 3 lines
arch/arm/mach-omap2/prminst44xx.c new file +3 -0
+};
+
+static void (*_prm_write_fns[OMAP4_MAX_PRCM_PARTITIONS])(u32, s16, u16)

= {

arch/arm/mach-omap2/prminst44xx.c line 37

Quoted 2 lines
arch/arm/mach-omap2/prminst44xx.c new file +2 -0
+	[OMAP4430_INVALID_PRCM_PARTITION]	= NULL,
+	[OMAP4430_PRM_PARTITION]		=

&omap4_prm_write_inst_reg,

arch/arm/mach-omap2/prminst44xx.c

Quoted 4 lines
arch/arm/mach-omap2/prminst44xx.c new file +4 -0
+	[OMAP4430_CM1_PARTITION]		= NULL,
+	[OMAP4430_CM2_PARTITION]		= NULL,
+	[OMAP4430_SCRM_PARTITION]		= NULL,
+	[OMAP4430_PRCM_MPU_PARTITION]		=

&omap4_prcm_mpu_write_inst_reg

Quoted 12 lines
arch/arm/mach-omap2/prminst44xx.c new file +12 -0
+};
+
+/* Read a register in a PRM instance */
+u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_prm_read_fns[part]);
+	return _prm_read_fns[part](inst, idx);
+}
+
+/* Write into a register in a PRM instance */

arch/arm/mach-omap2/prminst44xx.c

Quoted 10 lines
arch/arm/mach-omap2/prminst44xx.c new file +10 -0
+void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_prm_write_fns[part]);
+	_prm_write_fns[part](val, inst, idx);
+}
+
+/* Read-modify-write a register in PRM. Caller must lock */
+u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16

inst,

Review

Quoted 12 lines
arch/arm/mach-omap2/prminst44xx.c new file +11 -0
+				   s16 idx)
+{
+	u32 v;
+
+	v = omap4_prminst_read_inst_reg(part, inst, idx);
+	v &= ~mask;
+	v |= bits;
+	omap4_prminst_write_inst_reg(v, part, inst, idx);
+
+	return v;
+}
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prminst44xx.h

Quoted 14 lines

new file mode 100644
index 0000000..02dd66d

arch/arm/mach-omap2/prminst44xx.h new file +9 -0
@@ -0,0 +1,25 @@
+/*
+ * OMAP4 Power/Reset Management (PRM) function prototypes
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.

arch/arm/mach-omap2/prminst44xx.h line 19

Quoted 10 lines
arch/arm/mach-omap2/prminst44xx.h new file +10 -0
+ */
+#ifndef __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H
+#define __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H
+
+/*
+ * In an ideal world, we would not export these low-level functions,
+ * but this will probably take some time to fix properly
+ */
+extern u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx);
+extern void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst,

u16 idx);

Review

Quoted 7 lines
arch/arm/mach-omap2/prminst44xx.h new file +6 -0
+extern u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,
+					   s16 inst, s16 idx);
+
+extern void omap4_prm_global_warm_sw_reset(void);
+
+#endif
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/plat/prcm.h

arch/arm/plat-omap/include/plat/prcm.h line 20

Quoted 7 lines

index d059a05..078906d 100644

arch/arm/plat-omap/include/plat/prcm.h +0 -0
@@ -18,6 +18,10 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

USA

arch/arm/plat-omap/include/plat/prcm.h int omap2_cm_wait_idlest(void __iomem *reg, u32 mask,

Quoted 8 lines
arch/arm/plat-omap/include/plat/prcm.h +4 -0
+ *
+ * XXX This file is deprecated.  The PRCM is an OMAP2+-only subsystem,
+ * so this file doesn't belong in plat-omap/include/plat.  Please
+ * do not add anything new to this file.
  */
 
 #ifndef __ASM_ARM_ARCH_OMAP_PRCM_H
@@ -31,9 +35,6 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask,

u8 idlest,

Quoted 10 lines
arch/arm/plat-omap/include/plat/prcm.h +0 -3
 #define START_PADCONF_SAVE 0x2
 #define PADCONF_SAVE_DONE  0x1
 
-u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask);
-u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg);
-
 #endif
 
 
author maintainer
#6 lore raw

PATCH 1/11 OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

Hi Rajendra

Quoted 5 lines · Rajendra Nayak

Would it help if we can avoid one more level of function indirection (given that these are low level apis) and store the Partition offsets in the tables above (instead of func pointers) and do some thing like this.

Quoted 7 lines

return __raw_readl(OMAP2_L4_IO_ADDRESS(cm_read_offset[part],
module, idx));

with the table entries of cm_read_offset looking something like

Review

Quoted 3 lines
(quoted diff) +3 -0
+	[OMAP4430_PRM_PARTITION]		= OMAP4430_PRM_BASE,
+	[OMAP4430_CM1_PARTITION]		= OMAP4430_CM1_BASE,
+	[OMAP4430_CM2_PARTITION]		= OMAP4430_CM2_BASE,

I did a version of this patch without the extra level of indirection. I'm not sure if it's better or worse. The original seems conceptually cleaner to me, but this revised version is probably slightly more efficient. Do you (or anyone else) have a strong preference?

Note that the patch has not yet been boot-tested, but I think the principle is clear.

- Paul

From: Paul Walmsley <[email protected]>
Date: Tue, 14 Dec 2010 22:23:49 -0700
Subject: [PATCH] OMAP4: PRCM: add OMAP4-specific accessor/mutator functions

In some ways, the OMAP4 PRCM register layout is quite different than the OMAP2/3 PRCM register layout. For example, on OMAP2/3, from a register layout point of view, all CM instances were located in the CM subsystem, and all PRM instances were located in the PRM subsystem. OMAP4 changes this. Now, for example, some CM instances, such as WKUP_CM and EMU_CM, are located in the system PRM subsystem. And a "local PRCM" exists for the MPU - this PRCM combines registers that would normally appear in both CM and PRM instances, but uses its own register layout which matches neither the OMAP2/3 PRCM layout nor the OMAP4 PRCM layout.

To try to deal with this, introduce some new functions, omap4_cminst* and omap4_prminst*. The former is to be used when writing to a CM instance register (no matter what subsystem or hardware module it exists in), and the latter, similarly, with PRM instance registers. To determine which "PRCM partition" to write to, the functions take a PRCM instance ID argument. Subsequent patches add these partition IDs to the OMAP4 powerdomain and clockdomain definitions.

As far as I can see, there's really no good way to handle these types of register access inconsistencies. This patch seemed like the least bad approach.

Moving forward, the long-term goal is to remove all direct PRCM register access from the PM code. PRCM register access should go through layers such as the powerdomain and clockdomain code that can hide the details of how to interact with the specific hardware variant.

While here, rename cm4xxx.c to cm44xx.c to match the naming convention of the other OMAP4 PRCM files.

Thanks to Santosh Shilimkar <[email protected]> for some comments.

Cc Beno?t Cousson <[email protected]>
Cc Rajendra Nayak <[email protected]>
Cc Santosh Shilimkar <[email protected]>
---
 arch/arm/mach-omap2/Makefile           |    4 +-
 arch/arm/mach-omap2/cm1_44xx.h         |    5 ++
 arch/arm/mach-omap2/cm2_44xx.h         |    6 ++
 arch/arm/mach-omap2/cm44xx.c           |   52 +++++++++++++++
 arch/arm/mach-omap2/cm4xxx.c           |   62 ------------------
 arch/arm/mach-omap2/cminst44xx.c       |  109 ++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/cminst44xx.h       |   25 +++++++
 arch/arm/mach-omap2/prcm.c             |   26 +-------
 arch/arm/mach-omap2/prcm44xx.h         |   42 ++++++++++++
 arch/arm/mach-omap2/prcm_mpu44xx.c     |   45 +++++++++++++
 arch/arm/mach-omap2/prcm_mpu44xx.h     |    8 +++
 arch/arm/mach-omap2/prm44xx.c          |   65 +++++++++++++++++++
 arch/arm/mach-omap2/prm44xx.h          |    6 ++
 arch/arm/mach-omap2/prminst44xx.c      |   66 +++++++++++++++++++
 arch/arm/mach-omap2/prminst44xx.h      |   25 +++++++
 arch/arm/plat-omap/include/plat/prcm.h |    7 +-
 16 files changed, 462 insertions(+), 91 deletions(-)
 create mode 100644 arch/arm/mach-omap2/cm44xx.c
 delete mode 100644 arch/arm/mach-omap2/cm4xxx.c
 create mode 100644 arch/arm/mach-omap2/cminst44xx.c
 create mode 100644 arch/arm/mach-omap2/cminst44xx.h
 create mode 100644 arch/arm/mach-omap2/prcm44xx.h
 create mode 100644 arch/arm/mach-omap2/prcm_mpu44xx.c
 create mode 100644 arch/arm/mach-omap2/prminst44xx.c
 create mode 100644 arch/arm/mach-omap2/prminst44xx.h
arch/arm/mach-omap2/Makefile +3 -1
index aee22f9..0c0cdd9 100644
@@ -69,7 +69,9 @@ obj-$(CONFIG_ARCH_OMAP3)		+= prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
 # XXX The presence of cm2xxx_3xxx.o on the line below is temporary and
 # will be removed once the OMAP4 part of the codebase is converted to
 # use OMAP4-specific PRCM functions.
-obj-$(CONFIG_ARCH_OMAP4)		+= prcm.o cm2xxx_3xxx.o cm4xxx.o
+obj-$(CONFIG_ARCH_OMAP4)		+= prcm.o cm2xxx_3xxx.o cminst44xx.o \
+					   cm44xx.o prcm_mpu44xx.o \
+					   prminst44xx.o
 
 # OMAP powerdomain framework
 powerdomain-common			+= powerdomain.o powerdomain-common.o
arch/arm/mach-omap2/cm1_44xx.h +5 -0
index aa2ee78..63ef9e3 100644
@@ -248,4 +248,9 @@
 #define OMAP4_CM_DYN_DEP_PRESCAL_RESTORE_OFFSET		0x0040
 #define OMAP4430_CM_DYN_DEP_PRESCAL_RESTORE		OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_INST, 0x0040)
 
+/* Function prototypes */
+extern u32 omap4_cm1_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_cm1_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
+
 #endif
arch/arm/mach-omap2/cm2_44xx.h +6 -0
index 89c9522..0fd0210 100644
@@ -480,4 +480,10 @@
 #define OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL_RESTORE	OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_INST, 0x0058)
 #define OMAP4_CM_SDMA_STATICDEP_RESTORE_OFFSET		0x005c
 #define OMAP4430_CM_SDMA_STATICDEP_RESTORE		OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_INST, 0x005c)
+
+/* Function prototypes */
+extern u32 omap4_cm2_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_cm2_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
+
 #endif
arch/arm/mach-omap2/cm44xx.c new file +52 -0

52 lines not on this page · raw message

arch/arm/mach-omap2/cm4xxx.c deleted +0 -62

62 lines not on this page · raw message

arch/arm/mach-omap2/cminst44xx.c new file +109 -0

109 lines not on this page · raw message

arch/arm/mach-omap2/cminst44xx.h new file +25 -0
new file mode 100644
index 0000000..6baa4c7
@@ -0,0 +1,25 @@
+/*
+ * OMAP4 Clock Management (CM) function prototypes
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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_ASM_MACH_OMAP2_CMINST44XX_H
+#define __ARCH_ASM_MACH_OMAP2_CMINST44XX_H
+
+/*
+ * In an ideal world, we would not export these low-level functions,
+ * but this will probably take some time to fix properly
+ */
+extern u32 omap4_cminst_read_inst_reg(u8 part, s16 inst, u16 idx);
+extern void omap4_cminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx);
+extern u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,
+					   s16 inst, s16 idx);
+
+extern int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg);
+
+#endif
arch/arm/mach-omap2/prcm.c +1 -25
index dd95cbb..fe0865b 100644
@@ -33,6 +33,7 @@
 #include "cm44xx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
+#include "prcm44xx.h"
 #include "prm-regbits-24xx.h"
 #include "prm-regbits-44xx.h"
 #include "control.h"
@@ -80,31 +81,6 @@ void omap_prcm_arch_reset(char mode, const char *cmd)
 				     prcm_offs, OMAP4_RM_RSTCTRL);
 }
 
-/* Read a PRM register, AND it, and shift the result down to bit 0 */
-u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask)
-{
-	u32 v;
-
-	v = __raw_readl(reg);
-	v &= mask;
-	v >>= __ffs(mask);
-
-	return v;
-}
-
-/* Read-modify-write a register in a PRM module. Caller must lock */
-u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg)
-{
-	u32 v;
-
-	v = __raw_readl(reg);
-	v &= ~mask;
-	v |= bits;
-	__raw_writel(v, reg);
-
-	return v;
-}
-
 /**
  * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness
  * @reg: physical address of module IDLEST register
arch/arm/mach-omap2/prcm44xx.h new file +42 -0

42 lines not on this page · raw message

arch/arm/mach-omap2/prcm_mpu44xx.c new file +45 -0

45 lines not on this page · raw message

arch/arm/mach-omap2/prcm_mpu44xx.h +8 -0
index 80e00c1..e5190e9 100644
@@ -88,4 +88,12 @@
 #define OMAP4_CM_CPU1_CLKSTCTRL_OFFSET			0x0018
 #define OMAP4430_CM_CPU1_CLKSTCTRL			OMAP44XX_PRCM_MPU_REGADDR(OMAP4430_PRCM_MPU_CPU1_INST, 0x0018)
 
+/* Function prototypes */
+# ifndef __ASSEMBLER__
+extern u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,
+					    s16 idx);
+# endif
+
 #endif
arch/arm/mach-omap2/prm44xx.c +65 -0

77 lines not on this page · raw message

arch/arm/mach-omap2/prm44xx.h +6 -0
index 3d36149..3588653 100644
@@ -744,6 +744,12 @@
 /* Function prototypes */
 # ifndef __ASSEMBLER__
 
+extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
+extern u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg);
+extern u32 omap4_prm_set_inst_reg_bits(u32 bits, s16 inst, s16 idx);
+extern u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 idx);
 extern u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask);
 
 extern int omap4_prm_is_hardreset_asserted(void __iomem *rstctrl_reg, u8 shift);
arch/arm/mach-omap2/prminst44xx.c new file +66 -0

66 lines not on this page · raw message

arch/arm/mach-omap2/prminst44xx.h new file +25 -0
new file mode 100644
index 0000000..02dd66d
@@ -0,0 +1,25 @@
+/*
+ * OMAP4 Power/Reset Management (PRM) function prototypes
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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_ASM_MACH_OMAP2_PRMINST44XX_H
+#define __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H
+
+/*
+ * In an ideal world, we would not export these low-level functions,
+ * but this will probably take some time to fix properly
+ */
+extern u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx);
+extern void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx);
+extern u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,
+					   s16 inst, s16 idx);
+
+extern void omap4_prm_global_warm_sw_reset(void);
+
+#endif
arch/arm/plat-omap/include/plat/prcm.h +4 -3
index d059a05..078906d 100644
@@ -18,6 +18,10 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * XXX This file is deprecated.  The PRCM is an OMAP2+-only subsystem,
+ * so this file doesn't belong in plat-omap/include/plat.  Please
+ * do not add anything new to this file.
  */
 
 #ifndef __ASM_ARM_ARCH_OMAP_PRCM_H
@@ -31,9 +35,6 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
 #define START_PADCONF_SAVE 0x2
 #define PADCONF_SAVE_DONE  0x1
 
-u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask);
-u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg);
-
 #endif
 
 
Signature · 1 line
1.7.2.3
#7 lore raw

PATCH 1/11 OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

Hi Paul,

Quoted 5 lines

-----Original Message-----
From: Paul Walmsley [mailto:paul at pwsan.com]
Sent: Wednesday, December 15, 2010 12:18 PM
To: Rajendra Nayak
Cc: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org;

Santosh Shilimkar; Benoit Cousson

Quoted 1 line

Subject: RE: [PATCH 01/11] OMAP4: PRCM: add OMAP4-specific

accessor/mutatorfunctions

Quoted 14 lines

Hi Rajendra

Quoted 9 lines · Rajendra Nayak

Would it help if we can avoid one more level of function indirection (given that these are low level apis) and store the Partition offsets in the tables above (instead of func pointers) and do some thing like this.

return __raw_readl(OMAP2_L4_IO_ADDRESS(cm_read_offset[part],
module, idx));

with the table entries of cm_read_offset looking something like

Quoted 8 lines
Quoted 3 lines

arch/arm/mach-omap2/cminst44xx.c line 38

Quoted 3 lines
arch/arm/mach-omap2/cminst44xx.c new file +3 -0
+	[OMAP4430_PRM_PARTITION]		= OMAP4430_PRM_BASE,
+	[OMAP4430_CM1_PARTITION]		= OMAP4430_CM1_BASE,
+	[OMAP4430_CM2_PARTITION]		= OMAP4430_CM2_BASE,

I did a version of this patch without the extra level of indirection. I'm not sure if it's better or worse. The original seems conceptually cleaner to me, but this revised version is probably slightly more efficient. Do you (or anyone else) have a strong preference?

Thanks, the changes are very much in line with what I was trying to suggest. The concern was mainly performance/efficiency but otherwise I don't have a strong preference one way or the other.

Regards,
Rajendra

Quoted 10 lines

Note that the patch has not yet been boot-tested, but I think the principle is clear.

- Paul

From: Paul Walmsley <[email protected]>
Date: Tue, 14 Dec 2010 22:23:49 -0700
Subject: [PATCH] OMAP4: PRCM: add OMAP4-specific accessor/mutator

functions

Quoted 30 lines

In some ways, the OMAP4 PRCM register layout is quite different than the OMAP2/3 PRCM register layout. For example, on OMAP2/3, from a register layout point of view, all CM instances were located in the CM subsystem, and all PRM instances were located in the PRM subsystem. OMAP4 changes this. Now, for example, some CM instances, such as WKUP_CM and EMU_CM, are located in the system PRM subsystem. And a "local PRCM" exists for the MPU - this PRCM combines registers that would normally appear in both CM and PRM instances, but uses its own register layout which matches neither the OMAP2/3 PRCM layout nor the OMAP4 PRCM layout.

To try to deal with this, introduce some new functions, omap4_cminst* and omap4_prminst*. The former is to be used when writing to a CM instance register (no matter what subsystem or hardware module it exists in), and the latter, similarly, with PRM instance registers. To determine which "PRCM partition" to write to, the functions take a PRCM instance ID argument. Subsequent patches add these partition IDs to the OMAP4 powerdomain and clockdomain definitions.

As far as I can see, there's really no good way to handle these types of register access inconsistencies. This patch seemed like the least bad approach.

Moving forward, the long-term goal is to remove all direct PRCM register access from the PM code. PRCM register access should go through layers such as the powerdomain and clockdomain code that can hide the details of how to interact with the specific hardware variant.

Quoted 4 lines

While here, rename cm4xxx.c to cm44xx.c to match the naming convention of the other OMAP4 PRCM files.

Thanks to Santosh Shilimkar <[email protected]> for some

comments.

Quoted 5 lines
Cc Beno?t Cousson <[email protected]>
Cc Rajendra Nayak <[email protected]>
Cc Santosh Shilimkar <[email protected]>
Quoted 7 lines
---
 arch/arm/mach-omap2/Makefile           |    4 +-
 arch/arm/mach-omap2/cm1_44xx.h         |    5 ++
 arch/arm/mach-omap2/cm2_44xx.h         |    6 ++
 arch/arm/mach-omap2/cm44xx.c           |   52 +++++++++++++++
 arch/arm/mach-omap2/cm4xxx.c           |   62 ------------------
 arch/arm/mach-omap2/cminst44xx.c       |  109

++++++++++++++++++++++++++++++++

arch/arm/mach-omap2/Makefile obj-$(CONFIG_ARCH_OMAP3) += prcm.o

Quoted 25 lines
 arch/arm/mach-omap2/cminst44xx.h       |   25 +++++++
 arch/arm/mach-omap2/prcm.c             |   26 +-------
 arch/arm/mach-omap2/prcm44xx.h         |   42 ++++++++++++
 arch/arm/mach-omap2/prcm_mpu44xx.c     |   45 +++++++++++++
 arch/arm/mach-omap2/prcm_mpu44xx.h     |    8 +++
 arch/arm/mach-omap2/prm44xx.c          |   65 +++++++++++++++++++
 arch/arm/mach-omap2/prm44xx.h          |    6 ++
 arch/arm/mach-omap2/prminst44xx.c      |   66 +++++++++++++++++++
 arch/arm/mach-omap2/prminst44xx.h      |   25 +++++++
 arch/arm/plat-omap/include/plat/prcm.h |    7 +-
 16 files changed, 462 insertions(+), 91 deletions(-)
 create mode 100644 arch/arm/mach-omap2/cm44xx.c
 delete mode 100644 arch/arm/mach-omap2/cm4xxx.c
 create mode 100644 arch/arm/mach-omap2/cminst44xx.c
 create mode 100644 arch/arm/mach-omap2/cminst44xx.h
 create mode 100644 arch/arm/mach-omap2/prcm44xx.h
 create mode 100644 arch/arm/mach-omap2/prcm_mpu44xx.c
 create mode 100644 arch/arm/mach-omap2/prminst44xx.c
 create mode 100644 arch/arm/mach-omap2/prminst44xx.h
arch/arm/mach-omap2/Makefile +0 -0
index aee22f9..0c0cdd9 100644
@@ -69,7 +69,9 @@ obj-$(CONFIG_ARCH_OMAP3)		+= prcm.o

cm2xxx_3xxx.o prm2xxx_3xxx.o

arch/arm/mach-omap2/Makefile obj-$(CONFIG_ARCH_OMAP3) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o

Quoted 5 lines
arch/arm/mach-omap2/Makefile +1 -1
 # XXX The presence of cm2xxx_3xxx.o on the line below is temporary and
 # will be removed once the OMAP4 part of the codebase is converted to
 # use OMAP4-specific PRCM functions.
-obj-$(CONFIG_ARCH_OMAP4)		+= prcm.o cm2xxx_3xxx.o cm4xxx.o
+obj-$(CONFIG_ARCH_OMAP4)		+= prcm.o cm2xxx_3xxx.o

cminst44xx.o \

arch/arm/mach-omap2/Makefile obj-$(CONFIG_ARCH_OMAP3) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o

Quoted 5 lines
arch/arm/mach-omap2/Makefile +2 -0
+					   cm44xx.o prcm_mpu44xx.o \
+					   prminst44xx.o
 
 # OMAP powerdomain framework
 powerdomain-common			+= powerdomain.o

powerdomain-common.o

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/mach-omap2/cm1_44xx.h

arch/arm/mach-omap2/cm1_44xx.h line 255

Quoted 12 lines

index aa2ee78..63ef9e3 100644

arch/arm/mach-omap2/cm1_44xx.h +4 -0
@@ -248,4 +248,9 @@
 #define OMAP4_CM_DYN_DEP_PRESCAL_RESTORE_OFFSET		0x0040
 #define OMAP4430_CM_DYN_DEP_PRESCAL_RESTORE
 	OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_INST, 0x0040)
 
+/* Function prototypes */
+extern u32 omap4_cm1_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_cm1_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,

s16 idx);

Review

Quoted 3 lines
arch/arm/mach-omap2/cm1_44xx.h +1 -0
+

#endif

(quoted diff) +0 -0

b/arch/arm/mach-omap2/cm2_44xx.h

Quoted 9 lines

index 89c9522..0fd0210 100644

arch/arm/mach-omap2/cm2_44xx.h +0 -0
@@ -480,4 +480,10 @@
 #define OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL_RESTORE
 	OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_INST, 0x0058)
 #define OMAP4_CM_SDMA_STATICDEP_RESTORE_OFFSET		0x005c
 #define OMAP4430_CM_SDMA_STATICDEP_RESTORE
	OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_INST, 0x005c)

arch/arm/mach-omap2/cm2_44xx.h

Quoted 5 lines
arch/arm/mach-omap2/cm2_44xx.h +5 -0
+
+/* Function prototypes */
+extern u32 omap4_cm2_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_cm2_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,

s16 idx);

Quoted 9 lines
arch/arm/mach-omap2/cm2_44xx.h +1 -0
+
 #endif
arch/arm/mach-omap2/cm44xx.c new file +1 -0
new file mode 100644
index 0000000..e96f53e
@@ -0,0 +1,52 @@
+/*

arch/arm/mach-omap2/cm44xx.c line 11

Quoted 10 lines
arch/arm/mach-omap2/cm44xx.c new file +10 -0
+ * OMAP4 CM1, CM2 module low-level functions
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ *
+ * These functions are intended to be used only by the cminst44xx.c

file.

Quoted 70 lines
arch/arm/mach-omap2/cm44xx.c new file +41 -0
+ * XXX Perhaps we should just move them there and make them static.
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+
+#include "cm.h"
+#include "cm1_44xx.h"
+#include "cm2_44xx.h"
+#include "cm-regbits-44xx.h"
+
+/* CM1 hardware module low-level functions */
+
+/* Read a register in CM1 */
+u32 omap4_cm1_read_inst_reg(s16 inst, u16 reg)
+{
+	return __raw_readl(OMAP44XX_CM1_REGADDR(inst, reg));
+}
+
+/* Write into a register in CM1 */
+void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 reg)
+{
+	__raw_writel(val, OMAP44XX_CM1_REGADDR(inst, reg));
+}
+
+/* Read a register in CM2 */
+u32 omap4_cm2_read_inst_reg(s16 inst, u16 reg)
+{
+	return __raw_readl(OMAP44XX_CM2_REGADDR(inst, reg));
+}
+
+/* Write into a register in CM2 */
+void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 reg)
+{
+	__raw_writel(val, OMAP44XX_CM2_REGADDR(inst, reg));
+}
arch/arm/mach-omap2/cm4xxx.c deleted +0 -23
deleted file mode 100644
index 25d2b3e..0000000
@@ -1,62 +0,0 @@
-/*
- * OMAP4 CM module functions
- *
- * Copyright (C) 2009 Nokia Corporation
- * Paul Walmsley
- *
- * 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.
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/delay.h>
-#include <linux/spinlock.h>
-#include <linux/list.h>
-#include <linux/errno.h>
-#include <linux/err.h>
-#include <linux/io.h>
-
-#include <asm/atomic.h>
-

arch/arm/mach-omap2/cm4xxx.c line 33

Quoted 10 lines
arch/arm/mach-omap2/cm4xxx.c deleted +0 -10
-#include <plat/common.h>
-
-#include "cm44xx.h"
-#include "cm-regbits-44xx.h"
-
-/**
- * omap4_cm_wait_module_ready - wait for a module to be in 'func' state
- * @clkctrl_reg: CLKCTRL module address
- *
- * Wait for the module IDLEST to be functional. If the idle state is in

any

arch/arm/mach-omap2/cm4xxx.c line 34

Quoted 1 line
arch/arm/mach-omap2/cm4xxx.c deleted +0 -1
- * the non functional state (trans, idle or disabled), module and thus

the

arch/arm/mach-omap2/cm4xxx.c

Quoted 6 lines
arch/arm/mach-omap2/cm4xxx.c deleted +0 -6
- * sysconfig cannot be accessed and will probably lead to an "imprecise
- * external abort"
- *
- * Module idle state:
- *   0x0 func:     Module is fully functional, including OCP
- *   0x1 trans:    Module is performing transition: wakeup, or sleep,

or sleep

arch/arm/mach-omap2/cm4xxx.c line 42

Quoted 2 lines
arch/arm/mach-omap2/cm4xxx.c deleted +0 -2
- *                 abortion
- *   0x2 idle:     Module is in Idle mode (only OCP part). It is

functional if

arch/arm/mach-omap2/cm4xxx.c

Quoted 13 lines
arch/arm/mach-omap2/cm4xxx.c deleted +0 -13
- *                 using separate functional clock
- *   0x3 disabled: Module is disabled and cannot be accessed
- *
- */
-int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg)
-{
-	int i = 0;
-
-	if (!clkctrl_reg)
-		return 0;
-
-	omap_test_timeout((
-		((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) == 0)

||

Review

Quoted 8 lines
arch/arm/mach-omap2/cm4xxx.c deleted +0 -7
-		 (((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) >>
-		  OMAP4430_IDLEST_SHIFT) == 0x2)),
-		MAX_MODULE_READY_TIME, i);
-
-	return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
-}
-
(quoted diff) +0 -0

b/arch/arm/mach-omap2/cminst44xx.c

Quoted 44 lines

new file mode 100644
index 0000000..c13613b

arch/arm/mach-omap2/cminst44xx.c new file +39 -0
@@ -0,0 +1,109 @@
+/*
+ * OMAP4 CM instance functions
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ *
+ * This is needed since CM instances can be in the PRM, PRCM_MPU, CM1,
+ * or CM2 hardware modules.  For example, the EMU_CM CM instance is in
+ * the PRM hardware module.  What a mess...
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+
+#include "cm.h"
+#include "cm1_44xx.h"
+#include "cm2_44xx.h"
+#include "cm44xx.h"
+#include "cminst44xx.h"
+#include "cm-regbits-44xx.h"
+#include "prcm44xx.h"
+#include "prm44xx.h"
+#include "prcm_mpu44xx.h"
+
+static u32 _cm_bases[OMAP4_MAX_PRCM_PARTITIONS] = {
+	[OMAP4430_INVALID_PRCM_PARTITION]	= 0,
+	[OMAP4430_PRM_PARTITION]		= OMAP4430_PRM_BASE,
+	[OMAP4430_CM1_PARTITION]		= OMAP4430_CM1_BASE,
+	[OMAP4430_CM2_PARTITION]		= OMAP4430_CM2_BASE,
+	[OMAP4430_SCRM_PARTITION]		= 0,

arch/arm/mach-omap2/cminst44xx.c line 49

Quoted 10 lines
arch/arm/mach-omap2/cminst44xx.c new file +10 -0
+	[OMAP4430_PRCM_MPU_PARTITION]		= OMAP4430_PRCM_MPU_BASE,
+};
+
+/* Read a register in a CM instance */
+u32 omap4_cminst_read_inst_reg(u8 part, s16 inst, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_cm_bases[part]);
+	return __raw_readl(OMAP2_L4_IO_ADDRESS(_cm_bases[part] + inst +

idx));

arch/arm/mach-omap2/cminst44xx.c

Quoted 9 lines
arch/arm/mach-omap2/cminst44xx.c new file +9 -0
+}
+
+/* Write into a register in a CM instance */
+void omap4_cminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_cm_bases[part]);
+	__raw_writel(val, OMAP2_L4_IO_ADDRESS(_cm_bases[part] + inst +

idx));

arch/arm/mach-omap2/cminst44xx.c

Quoted 4 lines
arch/arm/mach-omap2/cminst44xx.c new file +4 -0
+}
+
+/* Read-modify-write a register in CM1. Caller must lock */
+u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16

inst,

Quoted 8 lines
arch/arm/mach-omap2/cminst44xx.c new file +8 -0
+				   s16 idx)
+{
+	u32 v;
+
+	v = omap4_cminst_read_inst_reg(part, inst, idx);
+	v &= ~mask;
+	v |= bits;
+	omap4_cminst_write_inst_reg(v, part, inst, idx);

arch/arm/mach-omap2/cminst44xx.c

Quoted 10 lines
arch/arm/mach-omap2/cminst44xx.c new file +10 -0
+
+	return v;
+}
+
+
+/**
+ * omap4_cm_wait_module_ready - wait for a module to be in 'func' state
+ * @clkctrl_reg: CLKCTRL module address
+ *
+ * Wait for the module IDLEST to be functional. If the idle state is in

any

arch/arm/mach-omap2/cminst44xx.c line 81

Quoted 1 line
arch/arm/mach-omap2/cminst44xx.c new file +1 -0
+ * the non functional state (trans, idle or disabled), module and thus

the

arch/arm/mach-omap2/cminst44xx.c

Quoted 6 lines
arch/arm/mach-omap2/cminst44xx.c new file +6 -0
+ * sysconfig cannot be accessed and will probably lead to an "imprecise
+ * external abort"
+ *
+ * Module idle state:
+ *   0x0 func:     Module is fully functional, including OCP
+ *   0x1 trans:    Module is performing transition: wakeup, or sleep,

or sleep

arch/arm/mach-omap2/cminst44xx.c line 89

Quoted 2 lines
arch/arm/mach-omap2/cminst44xx.c new file +2 -0
+ *                 abortion
+ *   0x2 idle:     Module is in Idle mode (only OCP part). It is

functional if

arch/arm/mach-omap2/cminst44xx.c

Quoted 13 lines
arch/arm/mach-omap2/cminst44xx.c new file +13 -0
+ *                 using separate functional clock
+ *   0x3 disabled: Module is disabled and cannot be accessed
+ *
+ */
+int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg)
+{
+	int i = 0;
+
+	if (!clkctrl_reg)
+		return 0;
+
+	omap_test_timeout((
+		((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) == 0)

||

Review

Quoted 8 lines
arch/arm/mach-omap2/cminst44xx.c new file +7 -0
+		 (((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) >>
+		  OMAP4430_IDLEST_SHIFT) == 0x2)),
+		MAX_MODULE_READY_TIME, i);
+
+	return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
+}
+
(quoted diff) +0 -0

b/arch/arm/mach-omap2/cminst44xx.h

Quoted 14 lines

new file mode 100644
index 0000000..6baa4c7

arch/arm/mach-omap2/cminst44xx.h new file +9 -0
@@ -0,0 +1,25 @@
+/*
+ * OMAP4 Clock Management (CM) function prototypes
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.

arch/arm/mach-omap2/cminst44xx.h line 19

Quoted 10 lines
arch/arm/mach-omap2/cminst44xx.h new file +10 -0
+ */
+#ifndef __ARCH_ASM_MACH_OMAP2_CMINST44XX_H
+#define __ARCH_ASM_MACH_OMAP2_CMINST44XX_H
+
+/*
+ * In an ideal world, we would not export these low-level functions,
+ * but this will probably take some time to fix properly
+ */
+extern u32 omap4_cminst_read_inst_reg(u8 part, s16 inst, u16 idx);
+extern void omap4_cminst_write_inst_reg(u32 val, u8 part, s16 inst, u16

idx);

Quoted 39 lines
arch/arm/mach-omap2/cminst44xx.h new file +6 -0
+extern u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,
+					   s16 inst, s16 idx);
+
+extern int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg);
+
+#endif
arch/arm/mach-omap2/prcm.c +1 -17
index dd95cbb..fe0865b 100644
@@ -33,6 +33,7 @@
 #include "cm44xx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
+#include "prcm44xx.h"
 #include "prm-regbits-24xx.h"
 #include "prm-regbits-44xx.h"
 #include "control.h"
@@ -80,31 +81,6 @@ void omap_prcm_arch_reset(char mode, const char *cmd)
 				     prcm_offs, OMAP4_RM_RSTCTRL);
 }
 
-/* Read a PRM register, AND it, and shift the result down to bit 0 */
-u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask)
-{
-	u32 v;
-
-	v = __raw_readl(reg);
-	v &= mask;
-	v >>= __ffs(mask);
-
-	return v;
-}
-
-/* Read-modify-write a register in a PRM module. Caller must lock */
-u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg)
-{
-	u32 v;
-

arch/arm/mach-omap2/prcm.c void omap_prcm_arch_reset(char mode, const char *cmd) · line 85

Quoted 10 lines
arch/arm/mach-omap2/prcm.c +0 -8
-	v = __raw_readl(reg);
-	v &= ~mask;
-	v |= bits;
-	__raw_writel(v, reg);
-
-	return v;
-}
-
 /**
  * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module

readiness

Review

Quoted 2 lines
arch/arm/mach-omap2/prcm.c +0 -0
  * @reg: physical address of module IDLEST register
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prcm44xx.h

Quoted 31 lines

new file mode 100644
index 0000000..7334ffb

arch/arm/mach-omap2/prcm44xx.h new file +26 -0
@@ -0,0 +1,42 @@
+/*
+ * OMAP4 PRCM definitions
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ * Copyright (C) 2010 Nokia Corporation
+ *
+ * Paul Walmsley
+ *
+ * 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.
+ *
+ * This file contains macros and functions that are common to all of
+ * the PRM/CM/PRCM blocks on the OMAP4 devices: PRM, CM1, CM2,
+ * PRCM_MPU, SCRM
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP2_PRCM44XX_H
+#define __ARCH_ARM_MACH_OMAP2_PRCM44XX_H
+
+/*
+ * OMAP4 PRCM partition IDs
+ *
+ * The numbers and order are arbitrary, but 0 is reserved for the
+ * 'invalid' partition in case someone forgets to add a
+ * .prcm_partition field.

arch/arm/mach-omap2/prcm44xx.h line 36

Quoted 10 lines
arch/arm/mach-omap2/prcm44xx.h new file +10 -0
+ */
+#define OMAP4430_INVALID_PRCM_PARTITION		0
+#define OMAP4430_PRM_PARTITION			1
+#define OMAP4430_CM1_PARTITION			2
+#define OMAP4430_CM2_PARTITION			3
+#define OMAP4430_SCRM_PARTITION			4
+#define OMAP4430_PRCM_MPU_PARTITION		5
+
+/*
+ * OMAP4_MAX_PRCM_PARTITIONS: set to the highest value of the PRCM

partition

Review

Quoted 7 lines
arch/arm/mach-omap2/prcm44xx.h new file +6 -0
+ * IDs, plus one
+ */
+#define OMAP4_MAX_PRCM_PARTITIONS		6
+
+
+#endif
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prcm_mpu44xx.c

Quoted 30 lines

new file mode 100644
index 0000000..171fe17

arch/arm/mach-omap2/prcm_mpu44xx.c new file +25 -0
@@ -0,0 +1,45 @@
+/*
+ * OMAP4 PRCM_MPU module functions
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+
+#include "prcm_mpu44xx.h"
+#include "cm-regbits-44xx.h"
+
+/* PRCM_MPU low-level functions */
+
+u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg)

arch/arm/mach-omap2/prcm_mpu44xx.c line 35

Quoted 10 lines
arch/arm/mach-omap2/prcm_mpu44xx.c new file +10 -0
+{
+	return __raw_readl(OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
+}
+
+void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 reg)
+{
+	__raw_writel(val, OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
+}
+
+u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16

reg)

Review

Quoted 11 lines
arch/arm/mach-omap2/prcm_mpu44xx.c new file +10 -0
+{
+	u32 v;
+
+	v = omap4_prcm_mpu_read_inst_reg(inst, reg);
+	v &= ~mask;
+	v |= bits;
+	omap4_prcm_mpu_write_inst_reg(v, inst, reg);
+
+	return v;
+}
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prcm_mpu44xx.h

arch/arm/mach-omap2/prcm_mpu44xx.h line 96

Quoted 13 lines

index 80e00c1..e5190e9 100644

arch/arm/mach-omap2/prcm_mpu44xx.h +5 -0
@@ -88,4 +88,12 @@
 #define OMAP4_CM_CPU1_CLKSTCTRL_OFFSET			0x0018
 #define OMAP4430_CM_CPU1_CLKSTCTRL
 	OMAP44XX_PRCM_MPU_REGADDR(OMAP4430_PRCM_MPU_CPU1_INST, 0x0018)
 
+/* Function prototypes */
+# ifndef __ASSEMBLER__
+extern u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16

inst,

Review

Quoted 5 lines
arch/arm/mach-omap2/prcm_mpu44xx.h +3 -0
+					    s16 idx);
+# endif
+

#endif

(quoted diff) +0 -0

b/arch/arm/mach-omap2/prm44xx.c

Review

Quoted 83 lines

index 697b58f..c016ae4 100644

arch/arm/mach-omap2/prm44xx.c +65 -0
@@ -15,6 +15,7 @@
 #include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/err.h>
+#include <linux/io.h>
 
 #include <plat/common.h>
 #include <plat/cpu.h>
@@ -29,6 +30,70 @@
  */
 #define OMAP4_RST_CTRL_ST_OFFSET		4
 
+/* PRM low-level functions */
+
+/* Read a register in a CM/PRM instance in the PRM module */
+u32 omap4_prm_read_inst_reg(s16 inst, u16 reg)
+{
+	return __raw_readl(OMAP44XX_PRM_REGADDR(inst, reg));
+}
+
+/* Write into a register in a CM/PRM instance in the PRM module */
+void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 reg)
+{
+	__raw_writel(val, OMAP44XX_PRM_REGADDR(inst, reg));
+}
+
+/* Read-modify-write a register in a PRM module. Caller must lock */
+u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
+{
+	u32 v;
+
+	v = omap4_prm_read_inst_reg(inst, reg);
+	v &= ~mask;
+	v |= bits;
+	omap4_prm_write_inst_reg(v, inst, reg);
+
+	return v;
+}
+
+/* Read a PRM register, AND it, and shift the result down to bit 0 */
+/* XXX deprecated */
+u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask)
+{
+	u32 v;
+
+	v = __raw_readl(reg);
+	v &= mask;
+	v >>= __ffs(mask);
+
+	return v;
+}
+
+/* Read-modify-write a register in a PRM module. Caller must lock */
+/* XXX deprecated */
+u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg)
+{
+	u32 v;
+
+	v = __raw_readl(reg);
+	v &= ~mask;
+	v |= bits;
+	__raw_writel(v, reg);
+
+	return v;
+}
+
+u32 omap4_prm_set_inst_reg_bits(u32 bits, s16 inst, s16 reg)
+{
+	return omap4_prm_rmw_inst_reg_bits(bits, bits, inst, reg);
+}
+
+u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 reg)
+{
+	return omap4_prm_rmw_inst_reg_bits(bits, 0x0, inst, reg);
+}
+
 /**
  * omap4_prm_is_hardreset_asserted - read the HW reset line state of
  * submodules contained in the hwmod module
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prm44xx.h

arch/arm/mach-omap2/prm44xx.h line 749

Quoted 10 lines

index 3d36149..3588653 100644

arch/arm/mach-omap2/prm44xx.h +3 -0
@@ -744,6 +744,12 @@
 /* Function prototypes */
 # ifndef __ASSEMBLER__
 
+extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,

s16 idx);

arch/arm/mach-omap2/prm44xx.h line 750

Quoted 1 line
arch/arm/mach-omap2/prm44xx.h +1 -0
+extern u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem

*reg);

arch/arm/mach-omap2/prm44xx.h

Quoted 5 lines
arch/arm/mach-omap2/prm44xx.h +2 -0
+extern u32 omap4_prm_set_inst_reg_bits(u32 bits, s16 inst, s16 idx);
+extern u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 idx);
 extern u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask);
 
 extern int omap4_prm_is_hardreset_asserted(void __iomem *rstctrl_reg,

u8 shift);

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prminst44xx.c

Quoted 46 lines

new file mode 100644
index 0000000..a303242

arch/arm/mach-omap2/prminst44xx.c new file +41 -0
@@ -0,0 +1,66 @@
+/*
+ * OMAP4 PRM instance functions
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+
+#include "prm44xx.h"
+#include "prminst44xx.h"
+#include "prm-regbits-44xx.h"
+#include "prcm44xx.h"
+#include "prcm_mpu44xx.h"
+
+static u32 _prm_bases[OMAP4_MAX_PRCM_PARTITIONS] = {
+	[OMAP4430_INVALID_PRCM_PARTITION]	= 0,
+	[OMAP4430_PRM_PARTITION]		= OMAP4430_PRM_BASE,
+	[OMAP4430_CM1_PARTITION]		= 0,
+	[OMAP4430_CM2_PARTITION]		= 0,
+	[OMAP4430_SCRM_PARTITION]		= 0,
+	[OMAP4430_PRCM_MPU_PARTITION]		= OMAP4430_PRCM_MPU_BASE,
+};
+
+/* Read a register in a PRM instance */
+u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_prm_bases[part]);
+	return __raw_readl(OMAP2_L4_IO_ADDRESS(_prm_bases[part] + inst +

arch/arm/mach-omap2/prminst44xx.c line 51

Quoted 10 lines
arch/arm/mach-omap2/prminst44xx.c new file +10 -0
+					       idx));
+}
+
+/* Write into a register in a PRM instance */
+void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_prm_bases[part]);
+	__raw_writel(val, OMAP2_L4_IO_ADDRESS(_prm_bases[part] + inst +

idx));

arch/arm/mach-omap2/prminst44xx.c

Quoted 4 lines
arch/arm/mach-omap2/prminst44xx.c new file +4 -0
+}
+
+/* Read-modify-write a register in PRM. Caller must lock */
+u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16

inst,

Review

Quoted 12 lines
arch/arm/mach-omap2/prminst44xx.c new file +11 -0
+				   s16 idx)
+{
+	u32 v;
+
+	v = omap4_prminst_read_inst_reg(part, inst, idx);
+	v &= ~mask;
+	v |= bits;
+	omap4_prminst_write_inst_reg(v, part, inst, idx);
+
+	return v;
+}
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prminst44xx.h

Quoted 14 lines

new file mode 100644
index 0000000..02dd66d

arch/arm/mach-omap2/prminst44xx.h new file +9 -0
@@ -0,0 +1,25 @@
+/*
+ * OMAP4 Power/Reset Management (PRM) function prototypes
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.

arch/arm/mach-omap2/prminst44xx.h line 19

Quoted 10 lines
arch/arm/mach-omap2/prminst44xx.h new file +10 -0
+ */
+#ifndef __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H
+#define __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H
+
+/*
+ * In an ideal world, we would not export these low-level functions,
+ * but this will probably take some time to fix properly
+ */
+extern u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx);
+extern void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst,

u16 idx);

Review

Quoted 7 lines
arch/arm/mach-omap2/prminst44xx.h new file +6 -0
+extern u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,
+					   s16 inst, s16 idx);
+
+extern void omap4_prm_global_warm_sw_reset(void);
+
+#endif
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/plat/prcm.h

arch/arm/plat-omap/include/plat/prcm.h line 20

Quoted 7 lines

index d059a05..078906d 100644

arch/arm/plat-omap/include/plat/prcm.h +0 -0
@@ -18,6 +18,10 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

USA

arch/arm/plat-omap/include/plat/prcm.h int omap2_cm_wait_idlest(void __iomem *reg, u32 mask,

Quoted 8 lines
arch/arm/plat-omap/include/plat/prcm.h +4 -0
+ *
+ * XXX This file is deprecated.  The PRCM is an OMAP2+-only subsystem,
+ * so this file doesn't belong in plat-omap/include/plat.  Please
+ * do not add anything new to this file.
  */
 
 #ifndef __ASM_ARM_ARCH_OMAP_PRCM_H
@@ -31,9 +35,6 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask,

u8 idlest,

Quoted 11 lines
arch/arm/plat-omap/include/plat/prcm.h +0 -4
 #define START_PADCONF_SAVE 0x2
 #define PADCONF_SAVE_DONE  0x1
 
-u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask);
-u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg);
-
 #endif
 
 
--

1.7.2.3

#8 lore raw

PATCH 1/11 OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

In reply to Paul Walmsley
Quoted 22 lines

-----Original Message-----
From: Paul Walmsley [mailto:paul at pwsan.com]
Sent: Wednesday, December 15, 2010 12:18 PM
To: Rajendra Nayak
Cc: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org; Santosh Shilimkar; Benoit Cousson
Subject: RE: [PATCH 01/11] OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

Hi Rajendra

Quoted 9 lines · Rajendra Nayak

Would it help if we can avoid one more level of function indirection (given that these are low level apis) and store the Partition offsets in the tables above (instead of func pointers) and do some thing like this.

return __raw_readl(OMAP2_L4_IO_ADDRESS(cm_read_offset[part],
module, idx));

with the table entries of cm_read_offset looking something like

Quoted 9 lines
Quoted 3 lines

arch/arm/mach-omap2/cminst44xx.c line 38

Quoted 3 lines
arch/arm/mach-omap2/cminst44xx.c new file +3 -0
+	[OMAP4430_PRM_PARTITION]		= OMAP4430_PRM_BASE,
+	[OMAP4430_CM1_PARTITION]		= OMAP4430_CM1_BASE,
+	[OMAP4430_CM2_PARTITION]		= OMAP4430_CM2_BASE,

I did a version of this patch without the extra level of indirection. I'm not sure if it's better or worse. The original seems conceptually cleaner to me, but this revised version is probably slightly more efficient. Do you (or anyone else) have a strong preference?

I think we need to cut down on number of indirections we need to do to reach to hardware register read/writes to be more efficient especially for low level accessory APIs. We use them in performance/latency critical path more often and having these accessory apis as fast as they can be, keeping all the needed abstraction should be ideal.

Again not a very strong opinion here but I like this version than the previous just on the fact that it's cut down one indirection and still gives the same flexibility. :)

Quoted 40 lines

Note that the patch has not yet been boot-tested, but I think the principle is clear.

- Paul

From: Paul Walmsley <[email protected]>
Date: Tue, 14 Dec 2010 22:23:49 -0700
Subject: [PATCH] OMAP4: PRCM: add OMAP4-specific accessor/mutator functions

In some ways, the OMAP4 PRCM register layout is quite different than the OMAP2/3 PRCM register layout. For example, on OMAP2/3, from a register layout point of view, all CM instances were located in the CM subsystem, and all PRM instances were located in the PRM subsystem. OMAP4 changes this. Now, for example, some CM instances, such as WKUP_CM and EMU_CM, are located in the system PRM subsystem. And a "local PRCM" exists for the MPU - this PRCM combines registers that would normally appear in both CM and PRM instances, but uses its own register layout which matches neither the OMAP2/3 PRCM layout nor the OMAP4 PRCM layout.

To try to deal with this, introduce some new functions, omap4_cminst* and omap4_prminst*. The former is to be used when writing to a CM instance register (no matter what subsystem or hardware module it exists in), and the latter, similarly, with PRM instance registers. To determine which "PRCM partition" to write to, the functions take a PRCM instance ID argument. Subsequent patches add these partition IDs to the OMAP4 powerdomain and clockdomain definitions.

As far as I can see, there's really no good way to handle these types of register access inconsistencies. This patch seemed like the least bad approach.

Moving forward, the long-term goal is to remove all direct PRCM register access from the PM code. PRCM register access should go through layers such as the powerdomain and clockdomain code that can hide the details of how to interact with the specific hardware variant.

Quoted 4 lines

While here, rename cm4xxx.c to cm44xx.c to match the naming convention of the other OMAP4 PRCM files.

Thanks to Santosh Shilimkar <[email protected]> for some

comments.

Quoted 42 lines
Cc Beno?t Cousson <[email protected]>
Cc Rajendra Nayak <[email protected]>
Cc Santosh Shilimkar <[email protected]>
---
 arch/arm/mach-omap2/Makefile           |    4 +-
 arch/arm/mach-omap2/cm1_44xx.h         |    5 ++
 arch/arm/mach-omap2/cm2_44xx.h         |    6 ++
 arch/arm/mach-omap2/cm44xx.c           |   52 +++++++++++++++
 arch/arm/mach-omap2/cm4xxx.c           |   62 ------------------
 arch/arm/mach-omap2/cminst44xx.c       |  109
++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/cminst44xx.h       |   25 +++++++
 arch/arm/mach-omap2/prcm.c             |   26 +-------
 arch/arm/mach-omap2/prcm44xx.h         |   42 ++++++++++++
 arch/arm/mach-omap2/prcm_mpu44xx.c     |   45 +++++++++++++
 arch/arm/mach-omap2/prcm_mpu44xx.h     |    8 +++
 arch/arm/mach-omap2/prm44xx.c          |   65 +++++++++++++++++++
 arch/arm/mach-omap2/prm44xx.h          |    6 ++
 arch/arm/mach-omap2/prminst44xx.c      |   66 +++++++++++++++++++
 arch/arm/mach-omap2/prminst44xx.h      |   25 +++++++
 arch/arm/plat-omap/include/plat/prcm.h |    7 +-
 16 files changed, 462 insertions(+), 91 deletions(-)
 create mode 100644 arch/arm/mach-omap2/cm44xx.c
 delete mode 100644 arch/arm/mach-omap2/cm4xxx.c
 create mode 100644 arch/arm/mach-omap2/cminst44xx.c
 create mode 100644 arch/arm/mach-omap2/cminst44xx.h
 create mode 100644 arch/arm/mach-omap2/prcm44xx.h
 create mode 100644 arch/arm/mach-omap2/prcm_mpu44xx.c
 create mode 100644 arch/arm/mach-omap2/prminst44xx.c
 create mode 100644 arch/arm/mach-omap2/prminst44xx.h
arch/arm/mach-omap2/Makefile +0 -0
index aee22f9..0c0cdd9 100644
@@ -69,7 +69,9 @@ obj-$(CONFIG_ARCH_OMAP3)		+= prcm.o

cm2xxx_3xxx.o prm2xxx_3xxx.o
# XXX The presence of cm2xxx_3xxx.o on the line below is temporary and

 # will be removed once the OMAP4 part of the codebase is converted to
 # use OMAP4-specific PRCM functions.

arch/arm/mach-omap2/Makefile

Quoted 2 lines
arch/arm/mach-omap2/Makefile +1 -1
-obj-$(CONFIG_ARCH_OMAP4)		+= prcm.o cm2xxx_3xxx.o cm4xxx.o
+obj-$(CONFIG_ARCH_OMAP4)		+= prcm.o cm2xxx_3xxx.o

cminst44xx.o \

arch/arm/mach-omap2/Makefile obj-$(CONFIG_ARCH_OMAP3) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o

Quoted 5 lines
arch/arm/mach-omap2/Makefile +2 -0
+					   cm44xx.o prcm_mpu44xx.o \
+					   prminst44xx.o
 
 # OMAP powerdomain framework
 powerdomain-common			+= powerdomain.o

powerdomain-common.o

Quoted 6 lines
arch/arm/mach- renamed from arch/arm/mach-omap2/cm1_44xx.h +0 -0

omap2/cm1_44xx.h
index aa2ee78..63ef9e3 100644

arch/arm/mach-omap2/cm1_44xx.h line 255

Quoted 8 lines
arch/arm/mach-omap2/cm1_44xx.h +4 -0
@@ -248,4 +248,9 @@
 #define OMAP4_CM_DYN_DEP_PRESCAL_RESTORE_OFFSET		0x0040
 #define OMAP4430_CM_DYN_DEP_PRESCAL_RESTORE
 	OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_INST, 0x0040)
 
+/* Function prototypes */
+extern u32 omap4_cm1_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_cm1_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,

s16

Quoted 14 lines

idx);

arch/arm/mach-omap2/cm1_44xx.h +1 -0
+
 #endif
arch/arm/mach- renamed from arch/arm/mach-omap2/cm2_44xx.h +0 -0

omap2/cm2_44xx.h
index 89c9522..0fd0210 100644

arch/arm/mach-omap2/cm2_44xx.h +0 -0
@@ -480,4 +480,10 @@
 #define OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL_RESTORE
 	OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_INST, 0x0058)
 #define OMAP4_CM_SDMA_STATICDEP_RESTORE_OFFSET		0x005c
 #define OMAP4430_CM_SDMA_STATICDEP_RESTORE
	OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_INST, 0x005c)

arch/arm/mach-omap2/cm2_44xx.h

Quoted 5 lines
arch/arm/mach-omap2/cm2_44xx.h +5 -0
+
+/* Function prototypes */
+extern u32 omap4_cm2_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_cm2_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,

s16

Quoted 10 lines

idx);

arch/arm/mach-omap2/cm2_44xx.h +1 -0
+
 #endif
arch/arm/mach-omap2/cm44xx.c new file +1 -0
new file mode 100644
index 0000000..e96f53e
@@ -0,0 +1,52 @@
+/*

arch/arm/mach-omap2/cm44xx.c line 11

Quoted 10 lines
arch/arm/mach-omap2/cm44xx.c new file +10 -0
+ * OMAP4 CM1, CM2 module low-level functions
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ *
+ * These functions are intended to be used only by the cminst44xx.c

file.

Quoted 87 lines
arch/arm/mach-omap2/cm44xx.c new file +41 -0
+ * XXX Perhaps we should just move them there and make them static.
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+
+#include "cm.h"
+#include "cm1_44xx.h"
+#include "cm2_44xx.h"
+#include "cm-regbits-44xx.h"
+
+/* CM1 hardware module low-level functions */
+
+/* Read a register in CM1 */
+u32 omap4_cm1_read_inst_reg(s16 inst, u16 reg)
+{
+	return __raw_readl(OMAP44XX_CM1_REGADDR(inst, reg));
+}
+
+/* Write into a register in CM1 */
+void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 reg)
+{
+	__raw_writel(val, OMAP44XX_CM1_REGADDR(inst, reg));
+}
+
+/* Read a register in CM2 */
+u32 omap4_cm2_read_inst_reg(s16 inst, u16 reg)
+{
+	return __raw_readl(OMAP44XX_CM2_REGADDR(inst, reg));
+}
+
+/* Write into a register in CM2 */
+void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 reg)
+{
+	__raw_writel(val, OMAP44XX_CM2_REGADDR(inst, reg));
+}
arch/arm/mach-omap2/cm4xxx.c deleted +0 -33
deleted file mode 100644
index 25d2b3e..0000000
@@ -1,62 +0,0 @@
-/*
- * OMAP4 CM module functions
- *
- * Copyright (C) 2009 Nokia Corporation
- * Paul Walmsley
- *
- * 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.
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/delay.h>
-#include <linux/spinlock.h>
-#include <linux/list.h>
-#include <linux/errno.h>
-#include <linux/err.h>
-#include <linux/io.h>
-
-#include <asm/atomic.h>
-
-#include <plat/common.h>
-
-#include "cm44xx.h"
-#include "cm-regbits-44xx.h"
-
-/**
- * omap4_cm_wait_module_ready - wait for a module to be in 'func' state
- * @clkctrl_reg: CLKCTRL module address
- *
- * Wait for the module IDLEST to be functional. If the idle state is in

any
- * the non functional state (trans, idle or disabled), module and thus the
- * sysconfig cannot be accessed and will probably lead to an "imprecise
- * external abort"
- *
- * Module idle state:

Quoted 2 lines
- *   0x0 func:     Module is fully functional, including OCP
- *   0x1 trans:    Module is performing transition: wakeup, or sleep,

or

Quoted 8 lines

sleep
- * abortion
- * 0x2 idle: Module is in Idle mode (only OCP part). It is
functional if
- * using separate functional clock
- * 0x3 disabled: Module is disabled and cannot be accessed
- *
- */

arch/arm/mach-omap2/cm4xxx.c

Quoted 9 lines
arch/arm/mach-omap2/cm4xxx.c deleted +0 -9
-int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg)
-{
-	int i = 0;
-
-	if (!clkctrl_reg)
-		return 0;
-
-	omap_test_timeout((
-		((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) == 0)

||

Quoted 74 lines
arch/arm/mach-omap2/cm4xxx.c deleted +0 -7
-		 (((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) >>
-		  OMAP4430_IDLEST_SHIFT) == 0x2)),
-		MAX_MODULE_READY_TIME, i);
-
-	return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
-}
-
arch/arm/mach- renamed from arch/arm/mach-omap2/cminst44xx.c +0 -0

omap2/cminst44xx.c
new file mode 100644
index 0000000..c13613b

arch/arm/mach-omap2/cminst44xx.c new file +49 -0
@@ -0,0 +1,109 @@
+/*
+ * OMAP4 CM instance functions
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ *
+ * This is needed since CM instances can be in the PRM, PRCM_MPU, CM1,
+ * or CM2 hardware modules.  For example, the EMU_CM CM instance is in
+ * the PRM hardware module.  What a mess...
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+
+#include "cm.h"
+#include "cm1_44xx.h"
+#include "cm2_44xx.h"
+#include "cm44xx.h"
+#include "cminst44xx.h"
+#include "cm-regbits-44xx.h"
+#include "prcm44xx.h"
+#include "prm44xx.h"
+#include "prcm_mpu44xx.h"
+
+static u32 _cm_bases[OMAP4_MAX_PRCM_PARTITIONS] = {
+	[OMAP4430_INVALID_PRCM_PARTITION]	= 0,
+	[OMAP4430_PRM_PARTITION]		= OMAP4430_PRM_BASE,
+	[OMAP4430_CM1_PARTITION]		= OMAP4430_CM1_BASE,
+	[OMAP4430_CM2_PARTITION]		= OMAP4430_CM2_BASE,
+	[OMAP4430_SCRM_PARTITION]		= 0,
+	[OMAP4430_PRCM_MPU_PARTITION]		= OMAP4430_PRCM_MPU_BASE,
+};
+
+/* Read a register in a CM instance */
+u32 omap4_cminst_read_inst_reg(u8 part, s16 inst, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_cm_bases[part]);
+	return __raw_readl(OMAP2_L4_IO_ADDRESS(_cm_bases[part] + inst +

idx));

arch/arm/mach-omap2/cminst44xx.c new file +9 -0
+}
+
+/* Write into a register in a CM instance */
+void omap4_cminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_cm_bases[part]);
+	__raw_writel(val, OMAP2_L4_IO_ADDRESS(_cm_bases[part] + inst +

idx));

arch/arm/mach-omap2/cminst44xx.c

Quoted 4 lines
arch/arm/mach-omap2/cminst44xx.c new file +4 -0
+}
+
+/* Read-modify-write a register in CM1. Caller must lock */
+u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16

inst,

Quoted 25 lines
arch/arm/mach-omap2/cminst44xx.c new file +18 -0
+				   s16 idx)
+{
+	u32 v;
+
+	v = omap4_cminst_read_inst_reg(part, inst, idx);
+	v &= ~mask;
+	v |= bits;
+	omap4_cminst_write_inst_reg(v, part, inst, idx);
+
+	return v;
+}
+
+
+/**
+ * omap4_cm_wait_module_ready - wait for a module to be in 'func' state
+ * @clkctrl_reg: CLKCTRL module address
+ *
+ * Wait for the module IDLEST to be functional. If the idle state is in

any
+ * the non functional state (trans, idle or disabled), module and thus the
+ * sysconfig cannot be accessed and will probably lead to an "imprecise
+ * external abort"
+ *
+ * Module idle state:

Quoted 2 lines
+ *   0x0 func:     Module is fully functional, including OCP
+ *   0x1 trans:    Module is performing transition: wakeup, or sleep,

or

Quoted 8 lines

sleep
+ * abortion
+ * 0x2 idle: Module is in Idle mode (only OCP part). It is
functional if
+ * using separate functional clock
+ * 0x3 disabled: Module is disabled and cannot be accessed
+ *
+ */

arch/arm/mach-omap2/cminst44xx.c

Quoted 9 lines
arch/arm/mach-omap2/cminst44xx.c new file +9 -0
+int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg)
+{
+	int i = 0;
+
+	if (!clkctrl_reg)
+		return 0;
+
+	omap_test_timeout((
+		((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) == 0)

||

Quoted 194 lines
arch/arm/mach-omap2/cminst44xx.c new file +7 -0
+		 (((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) >>
+		  OMAP4430_IDLEST_SHIFT) == 0x2)),
+		MAX_MODULE_READY_TIME, i);
+
+	return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
+}
+
arch/arm/mach- renamed from arch/arm/mach-omap2/cminst44xx.h +0 -0

omap2/cminst44xx.h
new file mode 100644
index 0000000..6baa4c7

arch/arm/mach-omap2/cminst44xx.h new file +19 -0
@@ -0,0 +1,25 @@
+/*
+ * OMAP4 Clock Management (CM) function prototypes
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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_ASM_MACH_OMAP2_CMINST44XX_H
+#define __ARCH_ASM_MACH_OMAP2_CMINST44XX_H
+
+/*
+ * In an ideal world, we would not export these low-level functions,
+ * but this will probably take some time to fix properly
+ */
+extern u32 omap4_cminst_read_inst_reg(u8 part, s16 inst, u16 idx);
+extern void omap4_cminst_write_inst_reg(u32 val, u8 part, s16 inst, u16

idx);

arch/arm/mach-omap2/cminst44xx.h new file +6 -0
+extern u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,
+					   s16 inst, s16 idx);
+
+extern int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg);
+
+#endif
arch/arm/mach-omap2/prcm.c +1 -25
index dd95cbb..fe0865b 100644
@@ -33,6 +33,7 @@
 #include "cm44xx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
+#include "prcm44xx.h"
 #include "prm-regbits-24xx.h"
 #include "prm-regbits-44xx.h"
 #include "control.h"
@@ -80,31 +81,6 @@ void omap_prcm_arch_reset(char mode, const char *cmd)
 				     prcm_offs, OMAP4_RM_RSTCTRL);
 }
 
-/* Read a PRM register, AND it, and shift the result down to bit 0 */
-u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask)
-{
-	u32 v;
-
-	v = __raw_readl(reg);
-	v &= mask;
-	v >>= __ffs(mask);
-
-	return v;
-}
-
-/* Read-modify-write a register in a PRM module. Caller must lock */
-u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg)
-{
-	u32 v;
-
-	v = __raw_readl(reg);
-	v &= ~mask;
-	v |= bits;
-	__raw_writel(v, reg);
-
-	return v;
-}
-
 /**
  * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module

readiness
* @reg: physical address of module IDLEST register

arch/arm/mach- renamed from arch/arm/mach-omap2/prcm44xx.h +0 -0

omap2/prcm44xx.h
new file mode 100644
index 0000000..7334ffb

arch/arm/mach-omap2/prcm44xx.h new file +36 -0
@@ -0,0 +1,42 @@
+/*
+ * OMAP4 PRCM definitions
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ * Copyright (C) 2010 Nokia Corporation
+ *
+ * Paul Walmsley
+ *
+ * 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.
+ *
+ * This file contains macros and functions that are common to all of
+ * the PRM/CM/PRCM blocks on the OMAP4 devices: PRM, CM1, CM2,
+ * PRCM_MPU, SCRM
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP2_PRCM44XX_H
+#define __ARCH_ARM_MACH_OMAP2_PRCM44XX_H
+
+/*
+ * OMAP4 PRCM partition IDs
+ *
+ * The numbers and order are arbitrary, but 0 is reserved for the
+ * 'invalid' partition in case someone forgets to add a
+ * .prcm_partition field.
+ */
+#define OMAP4430_INVALID_PRCM_PARTITION		0
+#define OMAP4430_PRM_PARTITION			1
+#define OMAP4430_CM1_PARTITION			2
+#define OMAP4430_CM2_PARTITION			3
+#define OMAP4430_SCRM_PARTITION			4
+#define OMAP4430_PRCM_MPU_PARTITION		5
+
+/*
+ * OMAP4_MAX_PRCM_PARTITIONS: set to the highest value of the PRCM

partition
+ * IDs, plus one
+ */

arch/arm/mach-omap2/prcm44xx.h new file +4 -0
+#define OMAP4_MAX_PRCM_PARTITIONS		6
+
+
+#endif
arch/arm/mach- renamed from arch/arm/mach-omap2/prcm_mpu44xx.c +0 -0

omap2/prcm_mpu44xx.c
new file mode 100644
index 0000000..171fe17

arch/arm/mach-omap2/prcm_mpu44xx.c new file +35 -0
@@ -0,0 +1,45 @@
+/*
+ * OMAP4 PRCM_MPU module functions
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+
+#include "prcm_mpu44xx.h"
+#include "cm-regbits-44xx.h"
+
+/* PRCM_MPU low-level functions */
+
+u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg)
+{
+	return __raw_readl(OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
+}
+
+void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 reg)
+{
+	__raw_writel(val, OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
+}
+
+u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16

reg)

arch/arm/mach-omap2/prcm_mpu44xx.c new file +10 -0
+{
+	u32 v;
+
+	v = omap4_prcm_mpu_read_inst_reg(inst, reg);
+	v &= ~mask;
+	v |= bits;
+	omap4_prcm_mpu_write_inst_reg(v, inst, reg);
+
+	return v;
+}
arch/arm/mach- renamed from arch/arm/mach-omap2/prcm_mpu44xx.h +0 -0

omap2/prcm_mpu44xx.h
index 80e00c1..e5190e9 100644

arch/arm/mach-omap2/prcm_mpu44xx.h line 96

Quoted 9 lines
arch/arm/mach-omap2/prcm_mpu44xx.h +5 -0
@@ -88,4 +88,12 @@
 #define OMAP4_CM_CPU1_CLKSTCTRL_OFFSET			0x0018
 #define OMAP4430_CM_CPU1_CLKSTCTRL
 	OMAP44XX_PRCM_MPU_REGADDR(OMAP4430_PRCM_MPU_CPU1_INST, 0x0018)
 
+/* Function prototypes */
+# ifndef __ASSEMBLER__
+extern u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16

inst,

Review

Quoted 5 lines
arch/arm/mach-omap2/prcm_mpu44xx.h +3 -0
+					    s16 idx);
+# endif
+

#endif

(quoted diff) +0 -0

b/arch/arm/mach-omap2/prm44xx.c

Review

Quoted 83 lines

index 697b58f..c016ae4 100644

arch/arm/mach-omap2/prm44xx.c +65 -0
@@ -15,6 +15,7 @@
 #include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/err.h>
+#include <linux/io.h>
 
 #include <plat/common.h>
 #include <plat/cpu.h>
@@ -29,6 +30,70 @@
  */
 #define OMAP4_RST_CTRL_ST_OFFSET		4
 
+/* PRM low-level functions */
+
+/* Read a register in a CM/PRM instance in the PRM module */
+u32 omap4_prm_read_inst_reg(s16 inst, u16 reg)
+{
+	return __raw_readl(OMAP44XX_PRM_REGADDR(inst, reg));
+}
+
+/* Write into a register in a CM/PRM instance in the PRM module */
+void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 reg)
+{
+	__raw_writel(val, OMAP44XX_PRM_REGADDR(inst, reg));
+}
+
+/* Read-modify-write a register in a PRM module. Caller must lock */
+u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
+{
+	u32 v;
+
+	v = omap4_prm_read_inst_reg(inst, reg);
+	v &= ~mask;
+	v |= bits;
+	omap4_prm_write_inst_reg(v, inst, reg);
+
+	return v;
+}
+
+/* Read a PRM register, AND it, and shift the result down to bit 0 */
+/* XXX deprecated */
+u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask)
+{
+	u32 v;
+
+	v = __raw_readl(reg);
+	v &= mask;
+	v >>= __ffs(mask);
+
+	return v;
+}
+
+/* Read-modify-write a register in a PRM module. Caller must lock */
+/* XXX deprecated */
+u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg)
+{
+	u32 v;
+
+	v = __raw_readl(reg);
+	v &= ~mask;
+	v |= bits;
+	__raw_writel(v, reg);
+
+	return v;
+}
+
+u32 omap4_prm_set_inst_reg_bits(u32 bits, s16 inst, s16 reg)
+{
+	return omap4_prm_rmw_inst_reg_bits(bits, bits, inst, reg);
+}
+
+u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 reg)
+{
+	return omap4_prm_rmw_inst_reg_bits(bits, 0x0, inst, reg);
+}
+
 /**
  * omap4_prm_is_hardreset_asserted - read the HW reset line state of
  * submodules contained in the hwmod module
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prm44xx.h

arch/arm/mach-omap2/prm44xx.h line 749

Quoted 10 lines

index 3d36149..3588653 100644

arch/arm/mach-omap2/prm44xx.h +3 -0
@@ -744,6 +744,12 @@
 /* Function prototypes */
 # ifndef __ASSEMBLER__
 
+extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,

s16

arch/arm/mach-omap2/prm44xx.h line 751

Quoted 2 lines
arch/arm/mach-omap2/prm44xx.h +1 -0
 idx);
+extern u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem

*reg);

Quoted 5 lines
arch/arm/mach-omap2/prm44xx.h +2 -0
+extern u32 omap4_prm_set_inst_reg_bits(u32 bits, s16 inst, s16 idx);
+extern u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 idx);
 extern u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask);
 

extern int omap4_prm_is_hardreset_asserted(void __iomem *rstctrl_reg,

u8

Quoted 60 lines

shift);

arch/arm/mach- renamed from arch/arm/mach-omap2/prminst44xx.c +0 -0

omap2/prminst44xx.c
new file mode 100644
index 0000000..a303242

arch/arm/mach-omap2/prminst44xx.c new file +51 -0
@@ -0,0 +1,66 @@
+/*
+ * OMAP4 PRM instance functions
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+
+#include "prm44xx.h"
+#include "prminst44xx.h"
+#include "prm-regbits-44xx.h"
+#include "prcm44xx.h"
+#include "prcm_mpu44xx.h"
+
+static u32 _prm_bases[OMAP4_MAX_PRCM_PARTITIONS] = {
+	[OMAP4430_INVALID_PRCM_PARTITION]	= 0,
+	[OMAP4430_PRM_PARTITION]		= OMAP4430_PRM_BASE,
+	[OMAP4430_CM1_PARTITION]		= 0,
+	[OMAP4430_CM2_PARTITION]		= 0,
+	[OMAP4430_SCRM_PARTITION]		= 0,
+	[OMAP4430_PRCM_MPU_PARTITION]		= OMAP4430_PRCM_MPU_BASE,
+};
+
+/* Read a register in a PRM instance */
+u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_prm_bases[part]);
+	return __raw_readl(OMAP2_L4_IO_ADDRESS(_prm_bases[part] + inst +
+					       idx));
+}
+
+/* Write into a register in a PRM instance */
+void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_prm_bases[part]);
+	__raw_writel(val, OMAP2_L4_IO_ADDRESS(_prm_bases[part] + inst +

idx));

arch/arm/mach-omap2/prminst44xx.c

Quoted 4 lines
arch/arm/mach-omap2/prminst44xx.c new file +4 -0
+}
+
+/* Read-modify-write a register in PRM. Caller must lock */
+u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16

inst,

Quoted 27 lines
arch/arm/mach-omap2/prminst44xx.c new file +11 -0
+				   s16 idx)
+{
+	u32 v;
+
+	v = omap4_prminst_read_inst_reg(part, inst, idx);
+	v &= ~mask;
+	v |= bits;
+	omap4_prminst_write_inst_reg(v, part, inst, idx);
+
+	return v;
+}
arch/arm/mach- renamed from arch/arm/mach-omap2/prminst44xx.h +0 -0

omap2/prminst44xx.h
new file mode 100644
index 0000000..02dd66d

arch/arm/mach-omap2/prminst44xx.h new file +9 -0
@@ -0,0 +1,25 @@
+/*
+ * OMAP4 Power/Reset Management (PRM) function prototypes
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.

arch/arm/mach-omap2/prminst44xx.h line 19

Quoted 10 lines
arch/arm/mach-omap2/prminst44xx.h new file +10 -0
+ */
+#ifndef __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H
+#define __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H
+
+/*
+ * In an ideal world, we would not export these low-level functions,
+ * but this will probably take some time to fix properly
+ */
+extern u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx);
+extern void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst,

u16

arch/arm/plat-omap/include/plat/prcm.h int omap2_cm_wait_idlest(void __iomem *reg, u32 mask,

Quoted 25 lines

idx);

arch/arm/mach-omap2/prminst44xx.h new file +6 -0
+extern u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,
+					   s16 inst, s16 idx);
+
+extern void omap4_prm_global_warm_sw_reset(void);
+
+#endif
arch/arm/plat- renamed from arch/arm/plat-omap/include/plat/prcm.h +0 -0

omap/include/plat/prcm.h
index d059a05..078906d 100644

arch/arm/plat-omap/include/plat/prcm.h +0 -0
@@ -18,6 +18,10 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

USA
+ *
+ * XXX This file is deprecated. The PRCM is an OMAP2+-only subsystem,
+ * so this file doesn't belong in plat-omap/include/plat. Please
+ * do not add anything new to this file.
*/

#ifndef __ASM_ARM_ARCH_OMAP_PRCM_H

arch/arm/plat-omap/include/plat/prcm.h +0 -0
@@ -31,9 +35,6 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask,

u8

Quoted 12 lines
arch/arm/plat-omap/include/plat/prcm.h +0 -4
 idlest,
 #define START_PADCONF_SAVE 0x2
 #define PADCONF_SAVE_DONE  0x1
 
-u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask);
-u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg);
-
 #endif
 
 
--

1.7.2.3

#9 lore raw

PATCH 1/11 OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

In reply to Paul Walmsley
Quoted 13 lines · Paul Walmsley

Hi Rajendra

Quoted 9 lines · Rajendra Nayak

Would it help if we can avoid one more level of function indirection (given that these are low level apis) and store the Partition offsets in the tables above (instead of func pointers) and do some thing like this.

return __raw_readl(OMAP2_L4_IO_ADDRESS(cm_read_offset[part],
module, idx));

with the table entries of cm_read_offset looking something like

Quoted 8 lines
Quoted 3 lines

arch/arm/mach-omap2/cminst44xx.c line 38

Quoted 3 lines
arch/arm/mach-omap2/cminst44xx.c new file +3 -0
+   [OMAP4430_PRM_PARTITION]                = OMAP4430_PRM_BASE,
+   [OMAP4430_CM1_PARTITION]                = OMAP4430_CM1_BASE,
+   [OMAP4430_CM2_PARTITION]                = OMAP4430_CM2_BASE,

I did a version of this patch without the extra level of indirection. I'm not sure if it's better or worse. The original seems conceptually cleaner to me, but this revised version is probably slightly more efficient. Do you (or anyone else) have a strong preference?

I do not have a strong but a slight preference for that. It is a little bit more readable that function pointers for my point of view.

On the other hand, the function pointers might allow to handle tricky differences that this solution will not.

Regards,
Benoit

author maintainer
#10 lore raw

PATCH 1/11 OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

Thanks for your comments on this patch. I'll plan to use the revised version, without the function pointers.

- Paul

#11 lore raw

PATCH 1/11 OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

In reply to Paul Walmsley

<snip>...

Quoted 20 lines

+++ b/arch/arm/mach-omap2/cminst44xx.c

arch/arm/mach-omap2/cminst44xx.c new file +18 -0
@@ -0,0 +1,118 @@
+/*
+ * OMAP4 CM instance functions
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ *
+ * This is needed since CM instances can be in the PRM, PRCM_MPU, CM1,
+ * or CM2 hardware modules.  For example, the EMU_CM CM instance is in
+ * the PRM hardware module.  What a mess...
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/errno.h>

arch/arm/mach-omap2/cminst44xx.c line 28

Quoted 10 lines
arch/arm/mach-omap2/cminst44xx.c new file +10 -0
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+
+#include "cm.h"
+#include "cm1_44xx.h"
+#include "cm2_44xx.h"
+#include "cm44xx.h"
+#include "cminst44xx.h"

This header seems to be missed in the series.

arch/arm/mach-omap2/cminst44xx.c

Quoted 8 lines
arch/arm/mach-omap2/cminst44xx.c new file +8 -0
+#include "cm-regbits-44xx.h"
+#include "prcm44xx.h"
+#include "prm44xx.h"
+#include "prcm_mpu44xx.h"
+
+static u32 (*_cm_read_fns[OMAP4_MAX_PRCM_PARTITIONS])(s16, u16)  = {
+	[OMAP4430_INVALID_PRCM_PARTITION]	= NULL,
+	[OMAP4430_PRM_PARTITION]		=

&omap4_prm_read_inst_reg,

Review line 37

Quoted 1 line
(quoted diff) +1 -0
+	[OMAP4430_CM1_PARTITION]		=

&omap4_cm1_read_inst_reg,

Review line 38

Quoted 1 line
(quoted diff) +1 -0
+	[OMAP4430_CM2_PARTITION]		=

&omap4_cm2_read_inst_reg,

Review line 40

Quoted 2 lines
(quoted diff) +2 -0
+	[OMAP4430_SCRM_PARTITION]		= NULL,
+	[OMAP4430_PRCM_MPU_PARTITION]		=

&omap4_prcm_mpu_read_inst_reg

arch/arm/mach-omap2/cminst44xx.c

Quoted 3 lines
arch/arm/mach-omap2/cminst44xx.c new file +3 -0
+};
+
+static void (*_cm_write_fns[OMAP4_MAX_PRCM_PARTITIONS])(u32, s16, u16)

= {

Review line 45

Quoted 2 lines
(quoted diff) +2 -0
+	[OMAP4430_INVALID_PRCM_PARTITION]	= NULL,
+	[OMAP4430_PRM_PARTITION]		=

&omap4_prm_write_inst_reg,

Review line 46

Quoted 1 line
(quoted diff) +1 -0
+	[OMAP4430_CM1_PARTITION]		=

&omap4_cm1_write_inst_reg,

Review line 47

Quoted 1 line
(quoted diff) +1 -0
+	[OMAP4430_CM2_PARTITION]		=

&omap4_cm2_write_inst_reg,

Review line 49

Quoted 2 lines
(quoted diff) +2 -0
+	[OMAP4430_SCRM_PARTITION]		= NULL,
+	[OMAP4430_PRCM_MPU_PARTITION]		=

&omap4_prcm_mpu_write_inst_reg

Quoted 30 lines
arch/arm/mach-omap2/cminst44xx.c new file +30 -0
+};
+
+/* Read a register in a CM instance */
+u32 omap4_cminst_read_inst_reg(u8 part, s16 module, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_cm_read_fns[part]);
+	return _cm_read_fns[part](module, idx);
+}
+
+/* Write into a register in a CM instance */
+void omap4_cminst_write_inst_reg(u32 val, u8 part, s16 module, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_cm_write_fns[part]);
+	_cm_write_fns[part](val, module, idx);
+}
+
+/* Read-modify-write a register in CM1. Caller must lock */
+u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,
+				  s16 module, s16 idx)
+{
+	u32 v;
+
+	v = omap4_cminst_read_inst_reg(part, module, idx);
+	v &= ~mask;
+	v |= bits;
+	omap4_cminst_write_inst_reg(v, part, module, idx);

arch/arm/mach-omap2/cminst44xx.c

Quoted 10 lines
arch/arm/mach-omap2/cminst44xx.c new file +10 -0
+
+	return v;
+}
+
+
+/**
+ * omap4_cm_wait_module_ready - wait for a module to be in 'func' state
+ * @clkctrl_reg: CLKCTRL module address
+ *
+ * Wait for the module IDLEST to be functional. If the idle state is in

any

Review line 90

Quoted 1 line
(quoted diff) +1 -0
+ * the non functional state (trans, idle or disabled), module and thus

the

arch/arm/mach-omap2/cminst44xx.c

Quoted 6 lines
arch/arm/mach-omap2/cminst44xx.c new file +6 -0
+ * sysconfig cannot be accessed and will probably lead to an "imprecise
+ * external abort"
+ *
+ * Module idle state:
+ *   0x0 func:     Module is fully functional, including OCP
+ *   0x1 trans:    Module is performing transition: wakeup, or sleep,

or sleep

Review line 98

Quoted 2 lines
(quoted diff) +2 -0
+ *                 abortion
+ *   0x2 idle:     Module is in Idle mode (only OCP part). It is

functional if

arch/arm/mach-omap2/cminst44xx.c

Quoted 13 lines
arch/arm/mach-omap2/cminst44xx.c new file +13 -0
+ *                 using separate functional clock
+ *   0x3 disabled: Module is disabled and cannot be accessed
+ *
+ */
+int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg)
+{
+	int i = 0;
+
+	if (!clkctrl_reg)
+		return 0;
+
+	omap_test_timeout((
+		((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) == 0)

||

Quoted 40 lines
arch/arm/mach-omap2/cminst44xx.c new file +7 -0
+		 (((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) >>
+		  OMAP4430_IDLEST_SHIFT) == 0x2)),
+		MAX_MODULE_READY_TIME, i);
+
+	return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
+}
+
arch/arm/mach-omap2/prcm.c +1 -17
index dd95cbb..fe0865b 100644
@@ -33,6 +33,7 @@
 #include "cm44xx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
+#include "prcm44xx.h"
 #include "prm-regbits-24xx.h"
 #include "prm-regbits-44xx.h"
 #include "control.h"
@@ -80,31 +81,6 @@ void omap_prcm_arch_reset(char mode, const char *cmd)
 				     prcm_offs, OMAP4_RM_RSTCTRL);
 }
 
-/* Read a PRM register, AND it, and shift the result down to bit 0 */
-u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask)
-{
-	u32 v;
-
-	v = __raw_readl(reg);
-	v &= mask;
-	v >>= __ffs(mask);
-
-	return v;
-}
-
-/* Read-modify-write a register in a PRM module. Caller must lock */
-u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg)
-{
-	u32 v;
-

arch/arm/mach-omap2/prcm.c void omap_prcm_arch_reset(char mode, const char *cmd) · line 85

Quoted 10 lines
arch/arm/mach-omap2/prcm.c +0 -8
-	v = __raw_readl(reg);
-	v &= ~mask;
-	v |= bits;
-	__raw_writel(v, reg);
-
-	return v;
-}
-
 /**
  * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module

readiness

Review

Quoted 2 lines
arch/arm/mach-omap2/prcm.c +0 -0
  * @reg: physical address of module IDLEST register
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prcm44xx.h

Quoted 31 lines

new file mode 100644
index 0000000..7334ffb

arch/arm/mach-omap2/prcm44xx.h new file +26 -0
@@ -0,0 +1,42 @@
+/*
+ * OMAP4 PRCM definitions
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ * Copyright (C) 2010 Nokia Corporation
+ *
+ * Paul Walmsley
+ *
+ * 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.
+ *
+ * This file contains macros and functions that are common to all of
+ * the PRM/CM/PRCM blocks on the OMAP4 devices: PRM, CM1, CM2,
+ * PRCM_MPU, SCRM
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP2_PRCM44XX_H
+#define __ARCH_ARM_MACH_OMAP2_PRCM44XX_H
+
+/*
+ * OMAP4 PRCM partition IDs
+ *
+ * The numbers and order are arbitrary, but 0 is reserved for the
+ * 'invalid' partition in case someone forgets to add a
+ * .prcm_partition field.

arch/arm/mach-omap2/prcm44xx.h line 36

Quoted 10 lines
arch/arm/mach-omap2/prcm44xx.h new file +10 -0
+ */
+#define OMAP4430_INVALID_PRCM_PARTITION		0
+#define OMAP4430_PRM_PARTITION			1
+#define OMAP4430_CM1_PARTITION			2
+#define OMAP4430_CM2_PARTITION			3
+#define OMAP4430_SCRM_PARTITION			4
+#define OMAP4430_PRCM_MPU_PARTITION		5
+
+/*
+ * OMAP4_MAX_PRCM_PARTITIONS: set to the highest value of the PRCM

partition

Review

Quoted 7 lines
arch/arm/mach-omap2/prcm44xx.h new file +6 -0
+ * IDs, plus one
+ */
+#define OMAP4_MAX_PRCM_PARTITIONS		6
+
+
+#endif
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prcm_mpu44xx.c

Quoted 30 lines

new file mode 100644
index 0000000..171fe17

arch/arm/mach-omap2/prcm_mpu44xx.c new file +25 -0
@@ -0,0 +1,45 @@
+/*
+ * OMAP4 PRCM_MPU module functions
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+
+#include "prcm_mpu44xx.h"
+#include "cm-regbits-44xx.h"
+
+/* PRCM_MPU low-level functions */
+
+u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg)

arch/arm/mach-omap2/prcm_mpu44xx.c line 35

Quoted 10 lines
arch/arm/mach-omap2/prcm_mpu44xx.c new file +10 -0
+{
+	return __raw_readl(OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
+}
+
+void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 reg)
+{
+	__raw_writel(val, OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
+}
+
+u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16

reg)

Review

Quoted 11 lines
arch/arm/mach-omap2/prcm_mpu44xx.c new file +10 -0
+{
+	u32 v;
+
+	v = omap4_prcm_mpu_read_inst_reg(inst, reg);
+	v &= ~mask;
+	v |= bits;
+	omap4_prcm_mpu_write_inst_reg(v, inst, reg);
+
+	return v;
+}
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prcm_mpu44xx.h

arch/arm/mach-omap2/prcm_mpu44xx.h line 96

Quoted 13 lines

index 80e00c1..e5190e9 100644

arch/arm/mach-omap2/prcm_mpu44xx.h +5 -0
@@ -88,4 +88,12 @@
 #define OMAP4_CM_CPU1_CLKSTCTRL_OFFSET			0x0018
 #define OMAP4430_CM_CPU1_CLKSTCTRL
 	OMAP44XX_PRCM_MPU_REGADDR(OMAP4430_PRCM_MPU_CPU1_INST, 0x0018)
 
+/* Function prototypes */
+# ifndef __ASSEMBLER__
+extern u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16

inst,

Review

Quoted 5 lines
arch/arm/mach-omap2/prcm_mpu44xx.h +3 -0
+					    s16 idx);
+# endif
+

#endif

(quoted diff) +0 -0

b/arch/arm/mach-omap2/prm44xx.c

Review

Quoted 83 lines

index 697b58f..c016ae4 100644

arch/arm/mach-omap2/prm44xx.c +65 -0
@@ -15,6 +15,7 @@
 #include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/err.h>
+#include <linux/io.h>
 
 #include <plat/common.h>
 #include <plat/cpu.h>
@@ -29,6 +30,70 @@
  */
 #define OMAP4_RST_CTRL_ST_OFFSET		4
 
+/* PRM low-level functions */
+
+/* Read a register in a CM/PRM instance in the PRM module */
+u32 omap4_prm_read_inst_reg(s16 inst, u16 reg)
+{
+	return __raw_readl(OMAP44XX_PRM_REGADDR(inst, reg));
+}
+
+/* Write into a register in a CM/PRM instance in the PRM module */
+void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 reg)
+{
+	__raw_writel(val, OMAP44XX_PRM_REGADDR(inst, reg));
+}
+
+/* Read-modify-write a register in a PRM module. Caller must lock */
+u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
+{
+	u32 v;
+
+	v = omap4_prm_read_inst_reg(inst, reg);
+	v &= ~mask;
+	v |= bits;
+	omap4_prm_write_inst_reg(v, inst, reg);
+
+	return v;
+}
+
+/* Read a PRM register, AND it, and shift the result down to bit 0 */
+/* XXX deprecated */
+u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask)
+{
+	u32 v;
+
+	v = __raw_readl(reg);
+	v &= mask;
+	v >>= __ffs(mask);
+
+	return v;
+}
+
+/* Read-modify-write a register in a PRM module. Caller must lock */
+/* XXX deprecated */
+u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg)
+{
+	u32 v;
+
+	v = __raw_readl(reg);
+	v &= ~mask;
+	v |= bits;
+	__raw_writel(v, reg);
+
+	return v;
+}
+
+u32 omap4_prm_set_inst_reg_bits(u32 bits, s16 inst, s16 reg)
+{
+	return omap4_prm_rmw_inst_reg_bits(bits, bits, inst, reg);
+}
+
+u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 reg)
+{
+	return omap4_prm_rmw_inst_reg_bits(bits, 0x0, inst, reg);
+}
+
 /**
  * omap4_prm_is_hardreset_asserted - read the HW reset line state of
  * submodules contained in the hwmod module
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prm44xx.h

arch/arm/mach-omap2/prm44xx.h line 749

Quoted 10 lines

index 3d36149..3588653 100644

arch/arm/mach-omap2/prm44xx.h +3 -0
@@ -744,6 +744,12 @@
 /* Function prototypes */
 # ifndef __ASSEMBLER__
 
+extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx);
+extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx);
+extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,

s16 idx);

arch/arm/mach-omap2/prm44xx.h line 750

Quoted 1 line
arch/arm/mach-omap2/prm44xx.h +1 -0
+extern u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem

*reg);

arch/arm/mach-omap2/prm44xx.h

Quoted 5 lines
arch/arm/mach-omap2/prm44xx.h +2 -0
+extern u32 omap4_prm_set_inst_reg_bits(u32 bits, s16 inst, s16 idx);
+extern u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 idx);
 extern u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask);
 
 extern int omap4_prm_is_hardreset_asserted(void __iomem *rstctrl_reg,

u8 shift);

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prminst44xx.c

Quoted 23 lines

new file mode 100644
index 0000000..01c57b6

arch/arm/mach-omap2/prminst44xx.c new file +18 -0
@@ -0,0 +1,74 @@
+/*
+ * OMAP4 PRM instance functions
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <plat/common.h>

arch/arm/mach-omap2/prminst44xx.c line 28

Quoted 10 lines
arch/arm/mach-omap2/prminst44xx.c new file +10 -0
+
+#include "prm44xx.h"
+#include "prminst44xx.h"
+#include "prm-regbits-44xx.h"
+#include "prcm44xx.h"
+#include "prcm_mpu44xx.h"
+
+static u32 (*_prm_read_fns[OMAP4_MAX_PRCM_PARTITIONS])(s16, u16)  = {
+	[OMAP4430_INVALID_PRCM_PARTITION]	= NULL,
+	[OMAP4430_PRM_PARTITION]		=

&omap4_prm_read_inst_reg,

arch/arm/mach-omap2/prminst44xx.c

Quoted 4 lines
arch/arm/mach-omap2/prminst44xx.c new file +4 -0
+	[OMAP4430_CM1_PARTITION]		= NULL,
+	[OMAP4430_CM2_PARTITION]		= NULL,
+	[OMAP4430_SCRM_PARTITION]		= NULL,
+	[OMAP4430_PRCM_MPU_PARTITION]		=

&omap4_prcm_mpu_read_inst_reg

arch/arm/mach-omap2/prminst44xx.c line 35

Quoted 3 lines
arch/arm/mach-omap2/prminst44xx.c new file +3 -0
+};
+
+static void (*_prm_write_fns[OMAP4_MAX_PRCM_PARTITIONS])(u32, s16, u16)

= {

arch/arm/mach-omap2/prminst44xx.c line 37

Quoted 2 lines
arch/arm/mach-omap2/prminst44xx.c new file +2 -0
+	[OMAP4430_INVALID_PRCM_PARTITION]	= NULL,
+	[OMAP4430_PRM_PARTITION]		=

&omap4_prm_write_inst_reg,

arch/arm/mach-omap2/prminst44xx.c

Quoted 4 lines
arch/arm/mach-omap2/prminst44xx.c new file +4 -0
+	[OMAP4430_CM1_PARTITION]		= NULL,
+	[OMAP4430_CM2_PARTITION]		= NULL,
+	[OMAP4430_SCRM_PARTITION]		= NULL,
+	[OMAP4430_PRCM_MPU_PARTITION]		=

&omap4_prcm_mpu_write_inst_reg

Quoted 12 lines
arch/arm/mach-omap2/prminst44xx.c new file +12 -0
+};
+
+/* Read a register in a PRM instance */
+u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_prm_read_fns[part]);
+	return _prm_read_fns[part](inst, idx);
+}
+
+/* Write into a register in a PRM instance */

arch/arm/mach-omap2/prminst44xx.c

Quoted 10 lines
arch/arm/mach-omap2/prminst44xx.c new file +10 -0
+void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx)
+{
+	BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
+	       part == OMAP4430_INVALID_PRCM_PARTITION ||
+	       !_prm_write_fns[part]);
+	_prm_write_fns[part](val, inst, idx);
+}
+
+/* Read-modify-write a register in PRM. Caller must lock */
+u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16

inst,

Review

Quoted 12 lines
arch/arm/mach-omap2/prminst44xx.c new file +11 -0
+				   s16 idx)
+{
+	u32 v;
+
+	v = omap4_prminst_read_inst_reg(part, inst, idx);
+	v &= ~mask;
+	v |= bits;
+	omap4_prminst_write_inst_reg(v, part, inst, idx);
+
+	return v;
+}
(quoted diff) +0 -0

b/arch/arm/mach-omap2/prminst44xx.h

Quoted 14 lines

new file mode 100644
index 0000000..02dd66d

arch/arm/mach-omap2/prminst44xx.h new file +9 -0
@@ -0,0 +1,25 @@
+/*
+ * OMAP4 Power/Reset Management (PRM) function prototypes
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ * Paul Walmsley
+ *
+ * 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.

arch/arm/mach-omap2/prminst44xx.h line 19

Quoted 10 lines
arch/arm/mach-omap2/prminst44xx.h new file +10 -0
+ */
+#ifndef __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H
+#define __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H
+
+/*
+ * In an ideal world, we would not export these low-level functions,
+ * but this will probably take some time to fix properly
+ */
+extern u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx);
+extern void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst,

u16 idx);

Review

Quoted 7 lines
arch/arm/mach-omap2/prminst44xx.h new file +6 -0
+extern u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,
+					   s16 inst, s16 idx);
+
+extern void omap4_prm_global_warm_sw_reset(void);
+
+#endif
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/plat/prcm.h

arch/arm/plat-omap/include/plat/prcm.h line 20

Quoted 7 lines

index d059a05..078906d 100644

arch/arm/plat-omap/include/plat/prcm.h +0 -0
@@ -18,6 +18,10 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

USA

arch/arm/plat-omap/include/plat/prcm.h int omap2_cm_wait_idlest(void __iomem *reg, u32 mask,

Quoted 8 lines
arch/arm/plat-omap/include/plat/prcm.h +4 -0
+ *
+ * XXX This file is deprecated.  The PRCM is an OMAP2+-only subsystem,
+ * so this file doesn't belong in plat-omap/include/plat.  Please
+ * do not add anything new to this file.
  */
 
 #ifndef __ASM_ARM_ARCH_OMAP_PRCM_H
@@ -31,9 +35,6 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask,

u8 idlest,

Quoted 10 lines
arch/arm/plat-omap/include/plat/prcm.h +0 -3
 #define START_PADCONF_SAVE 0x2
 #define PADCONF_SAVE_DONE  0x1
 
-u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask);
-u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg);
-
 #endif
 
 
author maintainer
#12 lore raw

PATCH 1/11 OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

Quoted 3 lines · Rajendra Nayak
Quoted 1 line

+#include "cminst44xx.h"

This header seems to be missed in the series.

Oops, sorry about that. Fixed in the git branch on git.pwsan.com.

Attached below is the final mach-omap2/cminst44xx.h file. It's created by the first patch in this series ("OMAP4: PRCM: add OMAP4-specific accessor/mutator functions") and modified by the seventh patch in the series ("OMAP4: clockdomains: add OMAP4 PRCM data and OMAP4 support") I will repost those.

- Paul

author maintainer
#13 lore raw

PATCH 1/11 OMAP4: PRCM: add OMAP4-specific accessor/mutatorfunctions

Quoted 9 lines · Paul Walmsley
Quoted 3 lines · Rajendra Nayak
Quoted 1 line

+#include "cminst44xx.h"

This header seems to be missed in the series.

Oops, sorry about that. Fixed in the git branch on git.pwsan.com.

Attached below is the final mach-omap2/cminst44xx.h file.

Well, anyway, here it is.

- Paul

/*
* OMAP4 Power/Reset Management (CM) function prototypes
*
* Copyright (C) 2010 Nokia Corporation
* Paul Walmsley
*
* 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_ASM_MACH_OMAP2_CMINST44XX_H
#define __ARCH_ASM_MACH_OMAP2_CMINST44XX_H

extern bool omap4_cminst_is_clkdm_in_hwsup(u8 part, s16 inst, u16 cdoffs); extern void omap4_cminst_clkdm_enable_hwsup(u8 part, s16 inst, u16 cdoffs); extern void omap4_cminst_clkdm_disable_hwsup(u8 part, s16 inst, u16 cdoffs); extern void omap4_cminst_clkdm_force_sleep(u8 part, s16 inst, u16 cdoffs); extern void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, u16 cdoffs);

/*
* In an ideal world, we would not export these low-level functions,
* but this will probably take some time to fix properly
*/
extern u32 omap4_cminst_read_inst_reg(u8 part, s16 inst, u16 idx); extern void omap4_cminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx); extern u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,

					   s16 inst, s16 idx);

extern int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg);

#endif

author maintainer
#14 lore raw

PATCH 2/11 OMAP4: PRCM: move global reset function for OMAP4 to an OMAP4-specific file

In reply to Paul Walmsley

Move the OMAP4 global software reset function to the OMAP4-specific prm44xx.c file, where it belongs. Part of the long-term process of moving all of the direct PRCM register writes into lower-layer code.

Also add OCP barriers on OMAP2/3/4 to reduce the chance that the MPU will continue executing while the system is supposed to be resetting itself.

---
 arch/arm/mach-omap2/prcm.c    |   17 ++++++++---------
 arch/arm/mach-omap2/prm44xx.c |   14 ++++++++++++++
 arch/arm/mach-omap2/prm44xx.h |    2 ++
 3 files changed, 24 insertions(+), 9 deletions(-)
arch/arm/mach-omap2/prcm.c +8 -9
index fe0865b..68c541f 100644
@@ -68,17 +68,16 @@ void omap_prcm_arch_reset(char mode, const char *cmd)
 	} else if (cpu_is_omap34xx()) {
 		prcm_offs = OMAP3430_GR_MOD;
 		omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
-	} else if (cpu_is_omap44xx())
-		prcm_offs = OMAP4430_PRM_DEVICE_INST;
-	else
+	} else if (cpu_is_omap44xx()) {
+		omap4_prm_global_warm_sw_reset(); /* never returns */
+	} else {
 		WARN_ON(1);
+	}
 
-	if (cpu_is_omap24xx() || cpu_is_omap34xx())
-		prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, prcm_offs,
-						 OMAP2_RM_RSTCTRL);
-	if (cpu_is_omap44xx())
-		prm_set_mod_reg_bits(OMAP4430_RST_GLOBAL_WARM_SW_MASK,
-				     prcm_offs, OMAP4_RM_RSTCTRL);
+	/* XXX should be moved to some OMAP2/3 specific code */
+	prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, prcm_offs,
+			     OMAP2_RM_RSTCTRL);
+	prm_read_mod_reg(prcm_offs, OMAP2_RM_RSTCTRL); /* OCP barrier */
 }
 
 /**
arch/arm/mach-omap2/prm44xx.c +14 -0
index c016ae4..a2a04bf 100644
@@ -179,3 +179,17 @@ int omap4_prm_deassert_hardreset(void __iomem *rstctrl_reg, u8 shift)
 	return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
 }
 
+void omap4_prm_global_warm_sw_reset(void)
+{
+	u32 v;
+
+	v = omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST,
+				    OMAP4_RM_RSTCTRL);
+	v |= OMAP4430_RST_GLOBAL_WARM_SW_MASK;
+	omap4_prm_write_inst_reg(v, OMAP4430_PRM_DEVICE_INST,
+				 OMAP4_RM_RSTCTRL);
+
+	/* OCP barrier */
+	v = omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST,
+				    OMAP4_RM_RSTCTRL);
+}
arch/arm/mach-omap2/prm44xx.h +2 -0
index 3588653..95542ae 100644
@@ -756,6 +756,8 @@ extern int omap4_prm_is_hardreset_asserted(void __iomem *rstctrl_reg, u8 shift);
 extern int omap4_prm_assert_hardreset(void __iomem *rstctrl_reg, u8 shift);
 extern int omap4_prm_deassert_hardreset(void __iomem *rstctrl_reg, u8 shift);
 
+extern void omap4_prm_global_warm_sw_reset(void);
+
 # endif
 
 #endif
author maintainer
#15 lore raw

PATCH 3/11 OMAP2/3: PRM/CM: prefix OMAP2 PRM/CM functions with "omap2_"

In reply to Paul Walmsley

Now that OMAP4-specific PRCM functions have been added, distinguish the existing OMAP2/3-specific PRCM functions by prefixing them with "omap2_".

This patch should not result in any functional change.

Cc Kevin Hilman <[email protected]>
Cc Jarkko Nikula <[email protected]>
Cc Peter Ujfalusi <[email protected]>
Cc Liam Girdwood <[email protected]>
Cc Mark Brown <[email protected]>
---
 arch/arm/mach-omap2/clkt2xxx_apll.c          |   10 -
 arch/arm/mach-omap2/clkt2xxx_dpllcore.c      |    8 -
 arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c |   12 -
 arch/arm/mach-omap2/clockdomain.c            |   22 +-
 arch/arm/mach-omap2/cm2xxx_3xxx.c            |  352 +++++++++++++-------------
 arch/arm/mach-omap2/cm2xxx_3xxx.h            |   10 -
 arch/arm/mach-omap2/control.c                |   40 ++-
 arch/arm/mach-omap2/pm-debug.c               |    8 -
 arch/arm/mach-omap2/pm24xx.c                 |  194 +++++++-------
 arch/arm/mach-omap2/pm34xx.c                 |  143 +++++------
 arch/arm/mach-omap2/powerdomain2xxx_3xxx.c   |   66 +++--
 arch/arm/mach-omap2/powerdomain44xx.c        |   33 +-
 arch/arm/mach-omap2/prcm.c                   |   16 +
 arch/arm/mach-omap2/prm2xxx_3xxx.c           |   34 +--
 arch/arm/mach-omap2/prm2xxx_3xxx.h           |   12 -
 arch/arm/mach-omap2/sdrc2xxx.c               |    4 
 arch/arm/mach-omap2/serial.c                 |    1 
 arch/arm/plat-omap/mcbsp.c                   |    8 -
 18 files changed, 501 insertions(+), 472 deletions(-)
arch/arm/mach-omap2/clkt2xxx_apll.c +5 -5
index 954d11f..f51cffd 100644
@@ -49,14 +49,14 @@ static int omap2_clk_apll_enable(struct clk *clk, u32 status_mask)
 
 	apll_mask = EN_APLL_LOCKED << clk->enable_bit;
 
-	cval = cm_read_mod_reg(PLL_MOD, CM_CLKEN);
+	cval = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
 
 	if ((cval & apll_mask) == apll_mask)
 		return 0;   /* apll already enabled */
 
 	cval &= ~apll_mask;
 	cval |= apll_mask;
-	cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
+	omap2_cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
 
 	omap2_cm_wait_idlest(cm_idlest_pll, status_mask,
 			     OMAP24XX_CM_IDLEST_VAL, clk->name);
@@ -83,9 +83,9 @@ static void omap2_clk_apll_disable(struct clk *clk)
 {
 	u32 cval;
 
-	cval = cm_read_mod_reg(PLL_MOD, CM_CLKEN);
+	cval = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
 	cval &= ~(EN_APLL_LOCKED << clk->enable_bit);
-	cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
+	omap2_cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
 }
 
 /* Public data */
@@ -106,7 +106,7 @@ u32 omap2xxx_get_apll_clkin(void)
 {
 	u32 aplls, srate = 0;
 
-	aplls = cm_read_mod_reg(PLL_MOD, CM_CLKSEL1);
+	aplls = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL1);
 	aplls &= OMAP24XX_APLLS_CLKIN_MASK;
 	aplls >>= OMAP24XX_APLLS_CLKIN_SHIFT;
 
arch/arm/mach-omap2/clkt2xxx_dpllcore.c +4 -4
index 530a76b..4ae4392 100644
@@ -54,7 +54,7 @@ unsigned long omap2xxx_clk_get_core_rate(struct clk *clk)
 
 	core_clk = omap2_get_dpll_rate(clk);
 
-	v = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
+	v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
 	v &= OMAP24XX_CORE_CLK_SRC_MASK;
 
 	if (v == CORE_CLK_SRC_32K)
@@ -73,7 +73,7 @@ static long omap2_dpllcore_round_rate(unsigned long target_rate)
 {
 	u32 high, low, core_clk_src;
 
-	core_clk_src = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
+	core_clk_src = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
 	core_clk_src &= OMAP24XX_CORE_CLK_SRC_MASK;
 
 	if (core_clk_src == CORE_CLK_SRC_DPLL) {	/* DPLL clockout */
@@ -111,7 +111,7 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
 	const struct dpll_data *dd;
 
 	cur_rate = omap2xxx_clk_get_core_rate(dclk);
-	mult = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
+	mult = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
 	mult &= OMAP24XX_CORE_CLK_SRC_MASK;
 
 	if ((rate == (cur_rate / 2)) && (mult == 2)) {
@@ -136,7 +136,7 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
 		tmpset.cm_clksel1_pll &= ~(dd->mult_mask |
 					   dd->div1_mask);
 		div = ((curr_prcm_set->xtal_speed / 1000000) - 1);
-		tmpset.cm_clksel2_pll = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
+		tmpset.cm_clksel2_pll = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
 		tmpset.cm_clksel2_pll &= ~OMAP24XX_CORE_CLK_SRC_MASK;
 		if (rate > low) {
 			tmpset.cm_clksel2_pll |= CORE_CLK_SRC_DPLL_X2;
arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c +6 -6
index f49f47d..39f9d5a 100644
@@ -133,21 +133,21 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
 			done_rate = CORE_CLK_SRC_DPLL;
 
 		/* MPU divider */
-		cm_write_mod_reg(prcm->cm_clksel_mpu, MPU_MOD, CM_CLKSEL);
+		omap2_cm_write_mod_reg(prcm->cm_clksel_mpu, MPU_MOD, CM_CLKSEL);
 
 		/* dsp + iva1 div(2420), iva2.1(2430) */
-		cm_write_mod_reg(prcm->cm_clksel_dsp,
+		omap2_cm_write_mod_reg(prcm->cm_clksel_dsp,
 				 OMAP24XX_DSP_MOD, CM_CLKSEL);
 
-		cm_write_mod_reg(prcm->cm_clksel_gfx, GFX_MOD, CM_CLKSEL);
+		omap2_cm_write_mod_reg(prcm->cm_clksel_gfx, GFX_MOD, CM_CLKSEL);
 
 		/* Major subsystem dividers */
-		tmp = cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) & OMAP24XX_CLKSEL_DSS2_MASK;
-		cm_write_mod_reg(prcm->cm_clksel1_core | tmp, CORE_MOD,
+		tmp = omap2_cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) & OMAP24XX_CLKSEL_DSS2_MASK;
+		omap2_cm_write_mod_reg(prcm->cm_clksel1_core | tmp, CORE_MOD,
 				 CM_CLKSEL1);
 
 		if (cpu_is_omap2430())
-			cm_write_mod_reg(prcm->cm_clksel_mdm,
+			omap2_cm_write_mod_reg(prcm->cm_clksel_mdm,
 					 OMAP2430_MDM_MOD, CM_CLKSEL);
 
 		/* x2 to enter omap2xxx_sdrc_init_params() */
arch/arm/mach-omap2/clockdomain.c +10 -12
index a2142e0..da74f71 100644
@@ -13,7 +13,6 @@
  */
 #undef DEBUG
 
-#include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/device.h>
 #include <linux/list.h>
@@ -30,7 +29,6 @@
 #include "prm2xxx_3xxx.h"
 #include "prm-regbits-24xx.h"
 #include "cm2xxx_3xxx.h"
-#include "cm2xxx_3xxx.h"
 
 #include <plat/clock.h>
 #include <plat/powerdomain.h>
@@ -410,7 +408,7 @@ int clkdm_add_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
 		pr_debug("clockdomain: hardware will wake up %s when %s wakes "
 			 "up\n", clkdm1->name, clkdm2->name);
 
-		prm_set_mod_reg_bits((1 << clkdm2->dep_bit),
+		omap2_prm_set_mod_reg_bits((1 << clkdm2->dep_bit),
 				     clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
 	}
 
@@ -445,7 +443,7 @@ int clkdm_del_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
 		pr_debug("clockdomain: hardware will no longer wake up %s "
 			 "after %s wakes up\n", clkdm1->name, clkdm2->name);
 
-		prm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
+		omap2_prm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
 				       clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
 	}
 
@@ -481,7 +479,7 @@ int clkdm_read_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
 	}
 
 	/* XXX It's faster to return the atomic wkdep_usecount */
-	return prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP,
+	return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP,
 				       (1 << clkdm2->dep_bit));
 }
 
@@ -515,7 +513,7 @@ int clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
 		atomic_set(&cd->wkdep_usecount, 0);
 	}
 
-	prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs, PM_WKDEP);
+	omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs, PM_WKDEP);
 
 	return 0;
 }
@@ -554,7 +552,7 @@ int clkdm_add_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
 		pr_debug("clockdomain: will prevent %s from sleeping if %s "
 			 "is active\n", clkdm1->name, clkdm2->name);
 
-		cm_set_mod_reg_bits((1 << clkdm2->dep_bit),
+		omap2_cm_set_mod_reg_bits((1 << clkdm2->dep_bit),
 				    clkdm1->pwrdm.ptr->prcm_offs,
 				    OMAP3430_CM_SLEEPDEP);
 	}
@@ -597,7 +595,7 @@ int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
 			 "sleeping if %s is active\n", clkdm1->name,
 			 clkdm2->name);
 
-		cm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
+		omap2_cm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
 				      clkdm1->pwrdm.ptr->prcm_offs,
 				      OMAP3430_CM_SLEEPDEP);
 	}
@@ -640,7 +638,7 @@ int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
 	}
 
 	/* XXX It's faster to return the atomic sleepdep_usecount */
-	return prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
+	return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
 				       OMAP3430_CM_SLEEPDEP,
 				       (1 << clkdm2->dep_bit));
 }
@@ -678,7 +676,7 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
 		atomic_set(&cd->sleepdep_usecount, 0);
 	}
 
-	prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
+	omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
 			       OMAP3430_CM_SLEEPDEP);
 
 	return 0;
@@ -730,7 +728,7 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
 
 	if (cpu_is_omap24xx()) {
 
-		cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
+		omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
 			    clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL);
 
 	} else if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
@@ -774,7 +772,7 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
 
 	if (cpu_is_omap24xx()) {
 
-		cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
+		omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
 			      clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL);
 
 	} else if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
arch/arm/mach-omap2/cm2xxx_3xxx.c +181 -171

453 lines not on this page · raw message

arch/arm/mach-omap2/cm2xxx_3xxx.h +5 -5
index ce2582c1..ff24edf 100644
@@ -104,14 +104,14 @@
 
 #ifndef __ASSEMBLER__
 
-extern u32 cm_read_mod_reg(s16 module, u16 idx);
-extern void cm_write_mod_reg(u32 val, s16 module, u16 idx);
-extern u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
+extern u32 omap2_cm_read_mod_reg(s16 module, u16 idx);
+extern void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx);
+extern u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
 
 extern int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
 				      u8 idlest_shift);
-extern u32 cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx);
-extern u32 cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx);
+extern u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx);
+extern u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx);
 
 #endif
 
arch/arm/mach-omap2/control.c +21 -19
index fee6620..16bde76 100644
@@ -252,13 +252,13 @@ void omap3_clear_scratchpad_contents(void)
 	void __iomem *v_addr;
 	u32 offset = 0;
 	v_addr = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD_ROM);
-	if (prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) &
+	if (omap2_prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) &
 	    OMAP3430_GLOBAL_COLD_RST_MASK) {
 		for ( ; offset <= max_offset; offset += 0x4)
 			__raw_writel(0x0, (v_addr + offset));
-		prm_set_mod_reg_bits(OMAP3430_GLOBAL_COLD_RST_MASK,
-				     OMAP3430_GR_MOD,
-				     OMAP3_PRM_RSTST_OFFSET);
+		omap2_prm_set_mod_reg_bits(OMAP3430_GLOBAL_COLD_RST_MASK,
+					   OMAP3430_GR_MOD,
+					   OMAP3_PRM_RSTST_OFFSET);
 	}
 }
 
@@ -290,32 +290,34 @@ void omap3_save_scratchpad_contents(void)
 	scratchpad_contents.sdrc_block_offset = 0x64;
 
 	/* Populate the PRCM block contents */
-	prcm_block_contents.prm_clksrc_ctrl = prm_read_mod_reg(OMAP3430_GR_MOD,
-			OMAP3_PRM_CLKSRC_CTRL_OFFSET);
-	prcm_block_contents.prm_clksel = prm_read_mod_reg(OMAP3430_CCR_MOD,
-			OMAP3_PRM_CLKSEL_OFFSET);
+	prcm_block_contents.prm_clksrc_ctrl =
+		omap2_prm_read_mod_reg(OMAP3430_GR_MOD,
+				       OMAP3_PRM_CLKSRC_CTRL_OFFSET);
+	prcm_block_contents.prm_clksel =
+		omap2_prm_read_mod_reg(OMAP3430_CCR_MOD,
+				       OMAP3_PRM_CLKSEL_OFFSET);
 	prcm_block_contents.cm_clksel_core =
-			cm_read_mod_reg(CORE_MOD, CM_CLKSEL);
+			omap2_cm_read_mod_reg(CORE_MOD, CM_CLKSEL);
 	prcm_block_contents.cm_clksel_wkup =
-			cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
+			omap2_cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
 	prcm_block_contents.cm_clken_pll =
-			cm_read_mod_reg(PLL_MOD, CM_CLKEN);
+			omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
 	prcm_block_contents.cm_autoidle_pll =
-			cm_read_mod_reg(PLL_MOD, OMAP3430_CM_AUTOIDLE_PLL);
+			omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_AUTOIDLE_PLL);
 	prcm_block_contents.cm_clksel1_pll =
-			cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL1_PLL);
+			omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL1_PLL);
 	prcm_block_contents.cm_clksel2_pll =
-			cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL2_PLL);
+			omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL2_PLL);
 	prcm_block_contents.cm_clksel3_pll =
-			cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL3);
+			omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL3);
 	prcm_block_contents.cm_clken_pll_mpu =
-			cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKEN_PLL);
+			omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKEN_PLL);
 	prcm_block_contents.cm_autoidle_pll_mpu =
-			cm_read_mod_reg(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL);
+			omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL);
 	prcm_block_contents.cm_clksel1_pll_mpu =
-			cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL);
+			omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL);
 	prcm_block_contents.cm_clksel2_pll_mpu =
-			cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL);
+			omap2_cm_read_mod_reg(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL);
 	prcm_block_contents.prcm_block_size = 0x0;
 
 	/* Populate the SDRC block contents */
arch/arm/mach-omap2/pm-debug.c +4 -4
index 26eda02..73f8ec0 100644
@@ -45,10 +45,10 @@ u32 wakeup_timer_milliseconds;
 
 #define DUMP_PRM_MOD_REG(mod, reg)    \
 	regs[reg_count].name = #mod "." #reg; \
-	regs[reg_count++].val = prm_read_mod_reg(mod, reg)
+	regs[reg_count++].val = omap2_prm_read_mod_reg(mod, reg)
 #define DUMP_CM_MOD_REG(mod, reg)     \
 	regs[reg_count].name = #mod "." #reg; \
-	regs[reg_count++].val = cm_read_mod_reg(mod, reg)
+	regs[reg_count++].val = omap2_cm_read_mod_reg(mod, reg)
 #define DUMP_PRM_REG(reg) \
 	regs[reg_count].name = #reg; \
 	regs[reg_count++].val = __raw_readl(reg)
@@ -311,10 +311,10 @@ static void pm_dbg_regset_store(u32 *ptr)
 		for (j = pm_dbg_reg_modules[i].low;
 			j <= pm_dbg_reg_modules[i].high; j += 4) {
 			if (pm_dbg_reg_modules[i].type == MOD_CM)
-				val = cm_read_mod_reg(
+				val = omap2_cm_read_mod_reg(
 					pm_dbg_reg_modules[i].offset, j);
 			else
-				val = prm_read_mod_reg(
+				val = omap2_prm_read_mod_reg(
 					pm_dbg_reg_modules[i].offset, j);
 			*(ptr++) = val;
 		}
arch/arm/mach-omap2/pm24xx.c +97 -97

292 lines not on this page · raw message

arch/arm/mach-omap2/pm34xx.c +72 -71

352 lines not on this page · raw message

arch/arm/mach-omap2/powerdomain2xxx_3xxx.c +38 -28

156 lines not on this page · raw message

arch/arm/mach-omap2/powerdomain44xx.c +18 -15
index dae767b..4c5ab1a 100644
@@ -25,7 +25,7 @@
 
 static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
 {
-	prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
+	omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
 				(pwrst << OMAP_POWERSTATE_SHIFT),
 				pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
 	return 0;
@@ -33,25 +33,25 @@ static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
 
 static int omap4_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
 {
-	return prm_read_mod_bits_shift(pwrdm->prcm_offs,
+	return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
 				OMAP4_PM_PWSTCTRL, OMAP_POWERSTATE_MASK);
 }
 
 static int omap4_pwrdm_read_pwrst(struct powerdomain *pwrdm)
 {
-	return prm_read_mod_bits_shift(pwrdm->prcm_offs,
+	return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
 				OMAP4_PM_PWSTST, OMAP_POWERSTATEST_MASK);
 }
 
 static int omap4_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
 {
-	return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP4_PM_PWSTST,
+	return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP4_PM_PWSTST,
 				OMAP4430_LASTPOWERSTATEENTERED_MASK);
 }
 
 static int omap4_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
 {
-	prm_rmw_mod_reg_bits(OMAP4430_LOWPOWERSTATECHANGE_MASK,
+	omap2_prm_rmw_mod_reg_bits(OMAP4430_LOWPOWERSTATECHANGE_MASK,
 				(1 << OMAP4430_LOWPOWERSTATECHANGE_SHIFT),
 				pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
 	return 0;
@@ -59,7 +59,7 @@ static int omap4_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
 
 static int omap4_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
 {
-	prm_rmw_mod_reg_bits(OMAP4430_LASTPOWERSTATEENTERED_MASK,
+	omap2_prm_rmw_mod_reg_bits(OMAP4430_LASTPOWERSTATEENTERED_MASK,
 				OMAP4430_LASTPOWERSTATEENTERED_MASK,
 				pwrdm->prcm_offs, OMAP4_PM_PWSTST);
 	return 0;
@@ -70,7 +70,7 @@ static int omap4_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
 	u32 v;
 
 	v = pwrst << __ffs(OMAP4430_LOGICRETSTATE_MASK);
-	prm_rmw_mod_reg_bits(OMAP4430_LOGICRETSTATE_MASK, v,
+	omap2_prm_rmw_mod_reg_bits(OMAP4430_LOGICRETSTATE_MASK, v,
 				pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
 
 	return 0;
@@ -83,7 +83,7 @@ static int omap4_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
 
 	m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
 
-	prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
+	omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
 				OMAP4_PM_PWSTCTRL);
 
 	return 0;
@@ -96,7 +96,7 @@ static int omap4_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
 
 	m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
 
-	prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
+	omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
 				OMAP4_PM_PWSTCTRL);
 
 	return 0;
@@ -104,14 +104,15 @@ static int omap4_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
 
 static int omap4_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
 {
-	return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP4_PM_PWSTST,
+	return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP4_PM_PWSTST,
 				OMAP4430_LOGICSTATEST_MASK);
 }
 
 static int omap4_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
 {
-	return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL,
-				OMAP4430_LOGICRETSTATE_MASK);
+	return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
+					     OMAP4_PM_PWSTCTRL,
+					     OMAP4430_LOGICRETSTATE_MASK);
 }
 
 static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
@@ -120,7 +121,8 @@ static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 
 	m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
 
-	return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP4_PM_PWSTST, m);
+	return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP4_PM_PWSTST,
+					     m);
 }
 
 static int omap4_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
@@ -129,7 +131,8 @@ static int omap4_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
 
 	m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
 
-	return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL, m);
+	return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
+					     OMAP4_PM_PWSTCTRL, m);
 }
 
 static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm)
@@ -143,7 +146,7 @@ static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm)
 	 */
 
 	/* XXX Is this udelay() value meaningful? */
-	while ((prm_read_mod_reg(pwrdm->prcm_offs, OMAP4_PM_PWSTST) &
+	while ((omap2_prm_read_mod_reg(pwrdm->prcm_offs, OMAP4_PM_PWSTST) &
 		OMAP_INTRANSITION_MASK) &&
 		(c++ < PWRDM_TRANSITION_BAILOUT))
 			udelay(1);
arch/arm/mach-omap2/prcm.c +8 -8
index 68c541f..c22e726 100644
@@ -17,7 +17,8 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#include <linux/module.h>
+
+#include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/clk.h>
 #include <linux/io.h>
@@ -30,10 +31,9 @@
 #include "clock.h"
 #include "clock2xxx.h"
 #include "cm2xxx_3xxx.h"
-#include "cm44xx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
-#include "prcm44xx.h"
+#include "prminst44xx.h"
 #include "prm-regbits-24xx.h"
 #include "prm-regbits-44xx.h"
 #include "control.h"
@@ -48,9 +48,9 @@ u32 omap_prcm_get_reset_sources(void)
 {
 	/* XXX This presumably needs modification for 34XX */
 	if (cpu_is_omap24xx() || cpu_is_omap34xx())
-		return prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST) & 0x7f;
+		return omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST) & 0x7f;
 	if (cpu_is_omap44xx())
-		return prm_read_mod_reg(WKUP_MOD, OMAP4_RM_RSTST) & 0x7f;
+		return omap2_prm_read_mod_reg(WKUP_MOD, OMAP4_RM_RSTST) & 0x7f;
 
 	return 0;
 }
@@ -75,9 +75,9 @@ void omap_prcm_arch_reset(char mode, const char *cmd)
 	}
 
 	/* XXX should be moved to some OMAP2/3 specific code */
-	prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, prcm_offs,
-			     OMAP2_RM_RSTCTRL);
-	prm_read_mod_reg(prcm_offs, OMAP2_RM_RSTCTRL); /* OCP barrier */
+	omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, prcm_offs,
+				   OMAP2_RM_RSTCTRL);
+	omap2_prm_read_mod_reg(prcm_offs, OMAP2_RM_RSTCTRL); /* OCP barrier */
 }
 
 /**
arch/arm/mach-omap2/prm2xxx_3xxx.c +17 -17
index 3e1d36c..ec03625 100644
@@ -25,49 +25,49 @@
 #include "prm-regbits-24xx.h"
 #include "prm-regbits-34xx.h"
 
-u32 prm_read_mod_reg(s16 module, u16 idx)
+u32 omap2_prm_read_mod_reg(s16 module, u16 idx)
 {
 	return __raw_readl(prm_base + module + idx);
 }
 
-void prm_write_mod_reg(u32 val, s16 module, u16 idx)
+void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
 {
 	__raw_writel(val, prm_base + module + idx);
 }
 
 /* Read-modify-write a register in a PRM module. Caller must lock */
-u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
+u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
 {
 	u32 v;
 
-	v = prm_read_mod_reg(module, idx);
+	v = omap2_prm_read_mod_reg(module, idx);
 	v &= ~mask;
 	v |= bits;
-	prm_write_mod_reg(v, module, idx);
+	omap2_prm_write_mod_reg(v, module, idx);
 
 	return v;
 }
 
 /* Read a PRM register, AND it, and shift the result down to bit 0 */
-u32 prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
+u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
 {
 	u32 v;
 
-	v = prm_read_mod_reg(domain, idx);
+	v = omap2_prm_read_mod_reg(domain, idx);
 	v &= mask;
 	v >>= __ffs(mask);
 
 	return v;
 }
 
-u32 prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
+u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
 {
-	return prm_rmw_mod_reg_bits(bits, bits, module, idx);
+	return omap2_prm_rmw_mod_reg_bits(bits, bits, module, idx);
 }
 
-u32 prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
+u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
 {
-	return prm_rmw_mod_reg_bits(bits, 0x0, module, idx);
+	return omap2_prm_rmw_mod_reg_bits(bits, 0x0, module, idx);
 }
 
 
@@ -86,7 +86,7 @@ int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift)
 	if (!(cpu_is_omap24xx() || cpu_is_omap34xx()))
 		return -EINVAL;
 
-	return prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL,
+	return omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL,
 				       (1 << shift));
 }
 
@@ -110,7 +110,7 @@ int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift)
 		return -EINVAL;
 
 	mask = 1 << shift;
-	prm_rmw_mod_reg_bits(mask, mask, prm_mod, OMAP2_RM_RSTCTRL);
+	omap2_prm_rmw_mod_reg_bits(mask, mask, prm_mod, OMAP2_RM_RSTCTRL);
 
 	return 0;
 }
@@ -140,15 +140,15 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 shift)
 	mask = 1 << shift;
 
 	/* Check the current status to avoid de-asserting the line twice */
-	if (prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL, mask) == 0)
+	if (omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL, mask) == 0)
 		return -EEXIST;
 
 	/* Clear the reset status by writing 1 to the status bit */
-	prm_rmw_mod_reg_bits(0xffffffff, mask, prm_mod, OMAP2_RM_RSTST);
+	omap2_prm_rmw_mod_reg_bits(0xffffffff, mask, prm_mod, OMAP2_RM_RSTST);
 	/* de-assert the reset control line */
-	prm_rmw_mod_reg_bits(mask, 0, prm_mod, OMAP2_RM_RSTCTRL);
+	omap2_prm_rmw_mod_reg_bits(mask, 0, prm_mod, OMAP2_RM_RSTCTRL);
 	/* wait the status to be set */
-	omap_test_timeout(prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTST,
+	omap_test_timeout(omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTST,
 						  mask),
 			  MAX_MODULE_HARDRESET_WAIT, c);
 
arch/arm/mach-omap2/prm2xxx_3xxx.h +6 -6
index ab28517..53d44f6 100644
@@ -230,12 +230,12 @@
 #ifndef __ASSEMBLER__
 
 /* Power/reset management domain register get/set */
-extern u32 prm_read_mod_reg(s16 module, u16 idx);
-extern void prm_write_mod_reg(u32 val, s16 module, u16 idx);
-extern u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
-extern u32 prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx);
-extern u32 prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx);
-extern u32 prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask);
+extern u32 omap2_prm_read_mod_reg(s16 module, u16 idx);
+extern void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx);
+extern u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
+extern u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx);
+extern u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx);
+extern u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask);
 
 /* These omap2_ PRM functions apply to both OMAP2 and 3 */
 extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift);
arch/arm/mach-omap2/sdrc2xxx.c +4 -0
index 64778b6..ccdb010 100644
@@ -99,6 +99,10 @@ u32 omap2xxx_sdrc_reprogram(u32 level, u32 force)
 	m_type = omap2xxx_sdrc_get_type();
 
 	local_irq_save(flags);
+	/*
+	 * XXX These calls should be abstracted out through a
+	 * prm2xxx.c function
+	 */
 	if (cpu_is_omap2420())
 		__raw_writel(0xffff, OMAP2420_PRCM_VOLTSETUP);
 	else
arch/arm/mach-omap2/serial.c +1 -0
index a60ac51..149b896 100644
@@ -492,6 +492,7 @@ static void omap_uart_idle_init(struct omap_uart_state *uart)
 		u32 wk_mask = 0;
 		u32 padconf = 0;
 
+		/* XXX These PRM accesses do not belong here */
 		uart->wk_en = OMAP34XX_PRM_REGADDR(mod, PM_WKEN1);
 		uart->wk_st = OMAP34XX_PRM_REGADDR(mod, PM_WKST1);
 		switch (uart->num) {
arch/arm/plat-omap/mcbsp.c +4 -4
index e66ad3e..9634d39 100644
@@ -236,9 +236,9 @@ static void omap_st_on(struct omap_mcbsp *mcbsp)
 	 * Sidetone uses McBSP ICLK - which must not idle when sidetones
 	 * are enabled or sidetones start sounding ugly.
 	 */
-	w = cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
+	w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
 	w &= ~(1 << (mcbsp->id - 2));
-	cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
+	omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
 
 	/* Enable McBSP Sidetone */
 	w = MCBSP_READ(mcbsp, SSELCR);
@@ -265,9 +265,9 @@ static void omap_st_off(struct omap_mcbsp *mcbsp)
 	w = MCBSP_READ(mcbsp, SSELCR);
 	MCBSP_WRITE(mcbsp, SSELCR, w & ~(SIDETONEEN));
 
-	w = cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
+	w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
 	w |= 1 << (mcbsp->id - 2);
-	cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
+	omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
 }
 
 static void omap_st_fir_write(struct omap_mcbsp *mcbsp, s16 *fir)
author maintainer
#16 lore raw

PATCH 4/11 OMAP4: powerdomains: add PRCM partition data; use OMAP4 PRM functions

In reply to Paul Walmsley

OMAP4 powerdomain control registers are split between the PRM hardware module and the PRCM_MPU local PRCM. Add this PRCM partition information to each OMAP4 powerdomain record, and convert the OMAP4 powerdomain function implementations to use the OMAP4 PRM instance functions.

Also fixes a potential null pointer dereference of pwrdm->name.

The autogeneration scripts have been updated.

Cc Rajendra Nayak <[email protected]>
Cc Santosh Shilimkar <[email protected]>
Cc Beno?t Cousson <[email protected]>
---
 arch/arm/mach-omap2/powerdomain.c             |   10 ++
 arch/arm/mach-omap2/powerdomain44xx.c         |  122 +++++++++++++++++--------
 arch/arm/mach-omap2/powerdomains44xx_data.c   |   17 +++
 arch/arm/plat-omap/include/plat/powerdomain.h |    7 +
 4 files changed, 115 insertions(+), 41 deletions(-)
arch/arm/mach-omap2/powerdomain.c +9 -1
index 8a0dcd0..a76ad3f 100644
@@ -20,6 +20,7 @@
 #include <linux/errno.h>
 #include <linux/string.h>
 #include "cm2xxx_3xxx.h"
+#include "prcm44xx.h"
 #include "cm44xx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
@@ -72,12 +73,19 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
 {
 	int i;
 
-	if (!pwrdm)
+	if (!pwrdm || !pwrdm->name)
 		return -EINVAL;
 
 	if (!omap_chip_is(pwrdm->omap_chip))
 		return -EINVAL;
 
+	if (cpu_is_omap44xx() &&
+	    pwrdm->prcm_partition == OMAP4430_INVALID_PRCM_PARTITION) {
+		pr_err("powerdomain: %s: missing OMAP4 PRCM partition ID\n",
+		       pwrdm->name);
+		return -EINVAL;
+	}
+
 	if (_pwrdm_lookup(pwrdm->name))
 		return -EEXIST;
 
arch/arm/mach-omap2/powerdomain44xx.c +84 -38

215 lines not on this page · raw message

arch/arm/mach-omap2/powerdomains44xx_data.c +17 -0
index 069a21d..823f477 100644
@@ -26,6 +26,7 @@
 #include "powerdomains.h"
 
 #include "prcm-common.h"
+#include "prcm44xx.h"
 #include "prm-regbits-44xx.h"
 #include "prm44xx.h"
 #include "prcm_mpu44xx.h"
@@ -34,6 +35,7 @@
 static struct powerdomain core_44xx_pwrdm = {
 	.name		  = "core_pwrdm",
 	.prcm_offs	  = OMAP4430_PRM_CORE_INST,
+	.prcm_partition	  = OMAP4430_PRM_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_RET_ON,
 	.pwrsts_logic_ret = PWRSTS_OFF_RET,
@@ -59,6 +61,7 @@ static struct powerdomain core_44xx_pwrdm = {
 static struct powerdomain gfx_44xx_pwrdm = {
 	.name		  = "gfx_pwrdm",
 	.prcm_offs	  = OMAP4430_PRM_GFX_INST,
+	.prcm_partition	  = OMAP4430_PRM_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_OFF_ON,
 	.banks		  = 1,
@@ -75,6 +78,7 @@ static struct powerdomain gfx_44xx_pwrdm = {
 static struct powerdomain abe_44xx_pwrdm = {
 	.name		  = "abe_pwrdm",
 	.prcm_offs	  = OMAP4430_PRM_ABE_INST,
+	.prcm_partition	  = OMAP4430_PRM_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_OFF_RET_ON,
 	.pwrsts_logic_ret = PWRDM_POWER_OFF,
@@ -94,6 +98,7 @@ static struct powerdomain abe_44xx_pwrdm = {
 static struct powerdomain dss_44xx_pwrdm = {
 	.name		  = "dss_pwrdm",
 	.prcm_offs	  = OMAP4430_PRM_DSS_INST,
+	.prcm_partition	  = OMAP4430_PRM_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_OFF_RET_ON,
 	.pwrsts_logic_ret = PWRSTS_OFF,
@@ -111,6 +116,7 @@ static struct powerdomain dss_44xx_pwrdm = {
 static struct powerdomain tesla_44xx_pwrdm = {
 	.name		  = "tesla_pwrdm",
 	.prcm_offs	  = OMAP4430_PRM_TESLA_INST,
+	.prcm_partition	  = OMAP4430_PRM_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_OFF_RET_ON,
 	.pwrsts_logic_ret = PWRSTS_OFF_RET,
@@ -132,6 +138,7 @@ static struct powerdomain tesla_44xx_pwrdm = {
 static struct powerdomain wkup_44xx_pwrdm = {
 	.name		  = "wkup_pwrdm",
 	.prcm_offs	  = OMAP4430_PRM_WKUP_INST,
+	.prcm_partition	  = OMAP4430_PRM_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_ON,
 	.banks		  = 1,
@@ -147,6 +154,7 @@ static struct powerdomain wkup_44xx_pwrdm = {
 static struct powerdomain cpu0_44xx_pwrdm = {
 	.name		  = "cpu0_pwrdm",
 	.prcm_offs	  = OMAP4430_PRCM_MPU_CPU0_INST,
+	.prcm_partition	  = OMAP4430_PRCM_MPU_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_OFF_RET_ON,
 	.pwrsts_logic_ret = PWRSTS_OFF_RET,
@@ -163,6 +171,7 @@ static struct powerdomain cpu0_44xx_pwrdm = {
 static struct powerdomain cpu1_44xx_pwrdm = {
 	.name		  = "cpu1_pwrdm",
 	.prcm_offs	  = OMAP4430_PRCM_MPU_CPU1_INST,
+	.prcm_partition	  = OMAP4430_PRCM_MPU_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_OFF_RET_ON,
 	.pwrsts_logic_ret = PWRSTS_OFF_RET,
@@ -179,6 +188,7 @@ static struct powerdomain cpu1_44xx_pwrdm = {
 static struct powerdomain emu_44xx_pwrdm = {
 	.name		  = "emu_pwrdm",
 	.prcm_offs	  = OMAP4430_PRM_EMU_INST,
+	.prcm_partition	  = OMAP4430_PRM_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_OFF_ON,
 	.banks		  = 1,
@@ -194,6 +204,7 @@ static struct powerdomain emu_44xx_pwrdm = {
 static struct powerdomain mpu_44xx_pwrdm = {
 	.name		  = "mpu_pwrdm",
 	.prcm_offs	  = OMAP4430_PRM_MPU_INST,
+	.prcm_partition	  = OMAP4430_PRM_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_OFF_RET_ON,
 	.pwrsts_logic_ret = PWRSTS_OFF_RET,
@@ -214,6 +225,7 @@ static struct powerdomain mpu_44xx_pwrdm = {
 static struct powerdomain ivahd_44xx_pwrdm = {
 	.name		  = "ivahd_pwrdm",
 	.prcm_offs	  = OMAP4430_PRM_IVAHD_INST,
+	.prcm_partition	  = OMAP4430_PRM_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_OFF_RET_ON,
 	.pwrsts_logic_ret = PWRDM_POWER_OFF,
@@ -237,6 +249,7 @@ static struct powerdomain ivahd_44xx_pwrdm = {
 static struct powerdomain cam_44xx_pwrdm = {
 	.name		  = "cam_pwrdm",
 	.prcm_offs	  = OMAP4430_PRM_CAM_INST,
+	.prcm_partition	  = OMAP4430_PRM_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_OFF_ON,
 	.banks		  = 1,
@@ -253,6 +266,7 @@ static struct powerdomain cam_44xx_pwrdm = {
 static struct powerdomain l3init_44xx_pwrdm = {
 	.name		  = "l3init_pwrdm",
 	.prcm_offs	  = OMAP4430_PRM_L3INIT_INST,
+	.prcm_partition	  = OMAP4430_PRM_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_OFF_RET_ON,
 	.pwrsts_logic_ret = PWRSTS_OFF_RET,
@@ -270,6 +284,7 @@ static struct powerdomain l3init_44xx_pwrdm = {
 static struct powerdomain l4per_44xx_pwrdm = {
 	.name		  = "l4per_pwrdm",
 	.prcm_offs	  = OMAP4430_PRM_L4PER_INST,
+	.prcm_partition	  = OMAP4430_PRM_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_OFF_RET_ON,
 	.pwrsts_logic_ret = PWRSTS_OFF_RET,
@@ -292,6 +307,7 @@ static struct powerdomain l4per_44xx_pwrdm = {
 static struct powerdomain always_on_core_44xx_pwrdm = {
 	.name		  = "always_on_core_pwrdm",
 	.prcm_offs	  = OMAP4430_PRM_ALWAYS_ON_INST,
+	.prcm_partition	  = OMAP4430_PRM_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_ON,
 };
@@ -300,6 +316,7 @@ static struct powerdomain always_on_core_44xx_pwrdm = {
 static struct powerdomain cefuse_44xx_pwrdm = {
 	.name		  = "cefuse_pwrdm",
 	.prcm_offs	  = OMAP4430_PRM_CEFUSE_INST,
+	.prcm_partition	  = OMAP4430_PRM_PARTITION,
 	.omap_chip	  = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 	.pwrsts		  = PWRSTS_OFF_ON,
 };
arch/arm/plat-omap/include/plat/powerdomain.h +5 -2
index b79eebb..a0d3a30 100644
@@ -1,5 +1,5 @@
 /*
- * OMAP2/3 powerdomain control
+ * OMAP2/3/4 powerdomain control
  *
  * Copyright (C) 2007-2008 Texas Instruments, Inc.
  * Copyright (C) 2007-2010 Nokia Corporation
@@ -24,7 +24,6 @@
 
 #include <plat/cpu.h>
 
-
 /* Powerdomain basic power states */
 #define PWRDM_POWER_OFF		0x0
 #define PWRDM_POWER_RET		0x1
@@ -84,6 +83,7 @@ struct powerdomain;
  * @name: Powerdomain name
  * @omap_chip: represents the OMAP chip types containing this pwrdm
  * @prcm_offs: the address offset from CM_BASE/PRM_BASE
+ * @prcm_partition: (OMAP4 only) the PRCM partition ID containing @prcm_offs
  * @pwrsts: Possible powerdomain power states
  * @pwrsts_logic_ret: Possible logic power states when pwrdm in RETENTION
  * @flags: Powerdomain flags
@@ -96,6 +96,8 @@ struct powerdomain;
  * @state_counter:
  * @timer:
  * @state_timer:
+ *
+ * @prcm_partition possible values are defined in mach-omap2/prcm44xx.h.
  */
 struct powerdomain {
 	const char *name;
@@ -107,6 +109,7 @@ struct powerdomain {
 	const u8 banks;
 	const u8 pwrsts_mem_ret[PWRDM_MAX_MEM_BANKS];
 	const u8 pwrsts_mem_on[PWRDM_MAX_MEM_BANKS];
+	const u8 prcm_partition;
 	struct clockdomain *pwrdm_clkdms[PWRDM_MAX_CLKDMS];
 	struct list_head node;
 	int state;
author maintainer
#17 lore raw

PATCH 5/11 OMAP2+: clockdomains: split the clkdm hwsup enable/disable function

In reply to Paul Walmsley

Split _omap2_clkdm_set_hwsup() into _disable_hwsup() and _enable_hwsup().

While here, also document that the autodeps are deprecated and that they should be removed at the earliest opportunity.

---
 arch/arm/mach-omap2/clockdomain.c |   67 +++++++++++++++++++++++++++----------
 1 files changed, 49 insertions(+), 18 deletions(-)
arch/arm/mach-omap2/clockdomain.c +49 -18
index da74f71..b1a6908 100644
@@ -140,6 +140,9 @@ static struct clkdm_dep *_clkdm_deps_lookup(struct clockdomain *clkdm,
  * clockdomain is in hardware-supervised mode.	Meant to be called
  * once at clockdomain layer initialization, since these should remain
  * fixed for a particular architecture.  No return value.
+ *
+ * XXX autodeps are deprecated and should be removed at the earliest
+ * opportunity
  */
 static void _autodep_lookup(struct clkdm_autodep *autodep)
 {
@@ -167,6 +170,9 @@ static void _autodep_lookup(struct clkdm_autodep *autodep)
  * Add the "autodep" sleep & wakeup dependencies to clockdomain 'clkdm'
  * in hardware-supervised mode.  Meant to be called from clock framework
  * when a clock inside clockdomain 'clkdm' is enabled.	No return value.
+ *
+ * XXX autodeps are deprecated and should be removed at the earliest
+ * opportunity
  */
 static void _clkdm_add_autodeps(struct clockdomain *clkdm)
 {
@@ -198,6 +204,9 @@ static void _clkdm_add_autodeps(struct clockdomain *clkdm)
  * Remove the "autodep" sleep & wakeup dependencies from clockdomain 'clkdm'
  * in hardware-supervised mode.  Meant to be called from clock framework
  * when a clock inside clockdomain 'clkdm' is disabled.  No return value.
+ *
+ * XXX autodeps are deprecated and should be removed at the earliest
+ * opportunity
  */
 static void _clkdm_del_autodeps(struct clockdomain *clkdm)
 {
@@ -222,28 +231,50 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm)
 	}
 }
 
-/*
- * _omap2_clkdm_set_hwsup - set the hwsup idle transition bit
+/**
+ * _enable_hwsup - set the hwsup idle transition bit
+ * @clkdm: struct clockdomain *
+ *
+ * XXX fix doco
+ * Internal helper for actually switching the bit that controls hwsup
+ * idle transitions for clkdm.
+ */
+static void _enable_hwsup(struct clockdomain *clkdm)
+{
+	u32 bits, v;
+
+	if (cpu_is_omap24xx())
+		bits = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
+	else if (cpu_is_omap34xx() || cpu_is_omap44xx())
+		bits = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
+	else
+		BUG();
+
+	bits = bits << __ffs(clkdm->clktrctrl_mask);
+
+	v = __raw_readl(clkdm->clkstctrl_reg);
+	v &= ~(clkdm->clktrctrl_mask);
+	v |= bits;
+	__raw_writel(v, clkdm->clkstctrl_reg);
+
+}
+
+/**
+ * _disable_hwsup - set the hwsup idle transition bit
  * @clkdm: struct clockdomain *
- * @enable: int 0 to disable, 1 to enable
  *
+ * XXX fix doco
  * Internal helper for actually switching the bit that controls hwsup
  * idle transitions for clkdm.
  */
-static void _omap2_clkdm_set_hwsup(struct clockdomain *clkdm, int enable)
+static void _disable_hwsup(struct clockdomain *clkdm)
 {
 	u32 bits, v;
 
 	if (cpu_is_omap24xx()) {
-		if (enable)
-			bits = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
-		else
-			bits = OMAP24XX_CLKSTCTRL_DISABLE_AUTO;
+		bits = OMAP24XX_CLKSTCTRL_DISABLE_AUTO;
 	} else if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
-		if (enable)
-			bits = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
-		else
-			bits = OMAP34XX_CLKSTCTRL_DISABLE_AUTO;
+		bits = OMAP34XX_CLKSTCTRL_DISABLE_AUTO;
 	} else {
 		BUG();
 	}
@@ -828,7 +859,7 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
 			_clkdm_add_autodeps(clkdm);
 	}
 
-	_omap2_clkdm_set_hwsup(clkdm, 1);
+	_enable_hwsup(clkdm);
 
 	pwrdm_clkdm_state_switch(clkdm);
 }
@@ -856,7 +887,7 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
 	pr_debug("clockdomain: disabling automatic idle transitions for %s\n",
 		 clkdm->name);
 
-	_omap2_clkdm_set_hwsup(clkdm, 0);
+	_disable_hwsup(clkdm);
 
 	/*
 	 * XXX This should be removed once TI adds wakeup/sleep
@@ -916,9 +947,9 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
 	if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ||
 	    (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) {
 		/* Disable HW transitions when we are changing deps */
-		_omap2_clkdm_set_hwsup(clkdm, 0);
+		_disable_hwsup(clkdm);
 		_clkdm_add_autodeps(clkdm);
-		_omap2_clkdm_set_hwsup(clkdm, 1);
+		_enable_hwsup(clkdm);
 	} else {
 		omap2_clkdm_wakeup(clkdm);
 	}
@@ -978,9 +1009,9 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
 	if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ||
 	    (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) {
 		/* Disable HW transitions when we are changing deps */
-		_omap2_clkdm_set_hwsup(clkdm, 0);
+		_disable_hwsup(clkdm);
 		_clkdm_del_autodeps(clkdm);
-		_omap2_clkdm_set_hwsup(clkdm, 1);
+		_enable_hwsup(clkdm);
 	} else {
 		omap2_clkdm_sleep(clkdm);
 	}
#18 lore raw

PATCH 5/11 OMAP2+: clockdomains: split the clkdm hwsup enable/disable function

Quoted 6 lines · Paul Walmsley

Split _omap2_clkdm_set_hwsup() into _disable_hwsup() and _enable_hwsup().

While here, also document that the autodeps are deprecated and that they should be removed at the earliest opportunity.

[...]

arch/arm/mach-omap2/clockdomain.c static void _clkdm_del_autodeps(struct clockdomain *clkdm) · line 238

Quoted 11 lines
arch/arm/mach-omap2/clockdomain.c +5 -2
@@ -222,28 +231,50 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm)
 	}
 }
 
-/*
- * _omap2_clkdm_set_hwsup - set the hwsup idle transition bit
+/**
+ * _enable_hwsup - set the hwsup idle transition bit
+ * @clkdm: struct clockdomain *
+ *
+ * XXX fix doco

hmm, 'doco' must be a new lingo I haven't learned yet.

Quoted 19 lines
arch/arm/mach-omap2/clockdomain.c +19 -0
+ * Internal helper for actually switching the bit that controls hwsup
+ * idle transitions for clkdm.
+ */
+static void _enable_hwsup(struct clockdomain *clkdm)
+{
+	u32 bits, v;
+
+	if (cpu_is_omap24xx())
+		bits = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
+	else if (cpu_is_omap34xx() || cpu_is_omap44xx())
+		bits = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
+	else
+		BUG();
+
+	bits = bits << __ffs(clkdm->clktrctrl_mask);
+
+	v = __raw_readl(clkdm->clkstctrl_reg);
+	v &= ~(clkdm->clktrctrl_mask);
+	v |= bits;

arch/arm/mach-omap2/clockdomain.c static void _clkdm_del_autodeps(struct clockdomain *clkdm) · line 266

Quoted 10 lines
arch/arm/mach-omap2/clockdomain.c +7 -1
+	__raw_writel(v, clkdm->clkstctrl_reg);
+
+}
+
+/**
+ * _disable_hwsup - set the hwsup idle transition bit
  * @clkdm: struct clockdomain *
- * @enable: int 0 to disable, 1 to enable
  *
+ * XXX fix doco

here too

Kevin

author maintainer
#19 lore raw

PATCH 5/11 OMAP2+: clockdomains: split the clkdm hwsup enable/disable function

Quoted 10 lines · Kevin Hilman
Quoted 6 lines · Paul Walmsley

- * _omap2_clkdm_set_hwsup - set the hwsup idle transition bit +/**
+ * _enable_hwsup - set the hwsup idle transition bit
+ * @clkdm: struct clockdomain *
+ *
+ * XXX fix doco

hmm, 'doco' must be a new lingo I haven't learned yet.

Thanks, will fix these.

- Paul

author maintainer
#20 lore raw

PATCH 5/11 OMAP2+: clockdomains: split the clkdm hwsup enable/disable function

Quoted 11 lines · Paul Walmsley
Quoted 9 lines · Kevin Hilman
Quoted 6 lines · Paul Walmsley

- * _omap2_clkdm_set_hwsup - set the hwsup idle transition bit +/**
+ * _enable_hwsup - set the hwsup idle transition bit
+ * @clkdm: struct clockdomain *
+ *
+ * XXX fix doco

Quoted 3 lines
Quoted 1 line

hmm, 'doco' must be a new lingo I haven't learned yet.

Thanks, will fix these.

Here's the revised patch.

- Paul

author maintainer
#21 lore raw

PATCH 6/11 OMAP4: CM instances: add clockdomain register offsets

In reply to Paul Walmsley

In OMAP4 CM instances, some registers (CM_CLKSTCTRL, CM_STATICDEP, CM_DYNAMICDEP, and the module-specific registers underneath) are organized by clockdomain. Add the clockdomain offset macros to the appropriate PRCM module header files.

This data was almost completely autogenerated from the TI hardware database; the autogeneration scripts have been updated.

---
 arch/arm/mach-omap2/cm1_44xx.h     |    5 +++++
 arch/arm/mach-omap2/cm2_44xx.h     |   19 +++++++++++++++++++
 arch/arm/mach-omap2/prcm_mpu44xx.h |    5 +++++
 arch/arm/mach-omap2/prm44xx.h      |   15 +++++++++++++++
 4 files changed, 44 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/cm1_44xx.h +5 -0
index 63ef9e3..e2d7a56 100644
@@ -40,6 +40,11 @@
 #define OMAP4430_CM1_RESTORE_INST	0x0e00
 #define OMAP4430_CM1_INSTR_INST		0x0f00
 
+/* CM1 clockdomain register offsets (from instance start) */
+#define OMAP4430_CM1_ABE_ABE_CDOFFS		0x0000
+#define OMAP4430_CM1_MPU_MPU_CDOFFS		0x0000
+#define OMAP4430_CM1_TESLA_TESLA_CDOFFS		0x0000
+
 /* CM1 */
 
 /* CM1.OCP_SOCKET_CM1 register offsets */
arch/arm/mach-omap2/cm2_44xx.h +19 -0
index 0fd0210..aa47450 100644
@@ -46,6 +46,25 @@
 #define OMAP4430_CM2_RESTORE_INST	0x1e00
 #define OMAP4430_CM2_INSTR_INST		0x1f00
 
+/* CM2 clockdomain register offsets (from instance start) */
+#define OMAP4430_CM2_ALWAYS_ON_ALWON_CDOFFS	0x0000
+#define OMAP4430_CM2_CORE_L3_1_CDOFFS		0x0000
+#define OMAP4430_CM2_CORE_L3_2_CDOFFS		0x0100
+#define OMAP4430_CM2_CORE_DUCATI_CDOFFS		0x0200
+#define OMAP4430_CM2_CORE_SDMA_CDOFFS		0x0300
+#define OMAP4430_CM2_CORE_MEMIF_CDOFFS		0x0400
+#define OMAP4430_CM2_CORE_D2D_CDOFFS		0x0500
+#define OMAP4430_CM2_CORE_L4CFG_CDOFFS		0x0600
+#define OMAP4430_CM2_CORE_L3INSTR_CDOFFS	0x0700
+#define OMAP4430_CM2_IVAHD_IVAHD_CDOFFS		0x0000
+#define OMAP4430_CM2_CAM_CAM_CDOFFS		0x0000
+#define OMAP4430_CM2_DSS_DSS_CDOFFS		0x0000
+#define OMAP4430_CM2_GFX_GFX_CDOFFS		0x0000
+#define OMAP4430_CM2_L3INIT_L3INIT_CDOFFS	0x0000
+#define OMAP4430_CM2_L4PER_L4PER_CDOFFS		0x0000
+#define OMAP4430_CM2_L4PER_L4SEC_CDOFFS		0x0180
+#define OMAP4430_CM2_CEFUSE_CEFUSE_CDOFFS	0x0000
+
 
 /* CM2 */
 
arch/arm/mach-omap2/prcm_mpu44xx.h +5 -0
index e5190e9..729a644 100644
@@ -37,6 +37,11 @@
 #define OMAP4430_PRCM_MPU_CPU0_INST		0x0400
 #define OMAP4430_PRCM_MPU_CPU1_INST		0x0800
 
+/* PRCM_MPU clockdomain register offsets (from instance start) */
+#define OMAP4430_PRCM_MPU_CPU0_MPU_CDOFFS	0x0000
+#define OMAP4430_PRCM_MPU_CPU1_MPU_CDOFFS	0x0000
+
+
 /*
  * PRCM_MPU
  *
arch/arm/mach-omap2/prm44xx.h +15 -0
index 95542ae..67a0d3f 100644
@@ -56,6 +56,21 @@
 #define OMAP4430_PRM_DEVICE_INST		0x1b00
 #define OMAP4430_PRM_INSTR_INST		0x1f00
 
+/* PRM clockdomain register offsets (from instance start) */
+#define OMAP4430_PRM_MPU_MPU_CDOFFS		0x0000
+#define OMAP4430_PRM_TESLA_TESLA_CDOFFS		0x0000
+#define OMAP4430_PRM_ABE_ABE_CDOFFS		0x0000
+#define OMAP4430_PRM_CORE_CORE_CDOFFS		0x0000
+#define OMAP4430_PRM_IVAHD_IVAHD_CDOFFS		0x0000
+#define OMAP4430_PRM_CAM_CAM_CDOFFS		0x0000
+#define OMAP4430_PRM_DSS_DSS_CDOFFS		0x0000
+#define OMAP4430_PRM_GFX_GFX_CDOFFS		0x0000
+#define OMAP4430_PRM_L3INIT_L3INIT_CDOFFS	0x0000
+#define OMAP4430_PRM_L4PER_L4PER_CDOFFS		0x0000
+#define OMAP4430_PRM_CEFUSE_CEFUSE_CDOFFS	0x0000
+#define OMAP4430_PRM_WKUP_CM_WKUP_CDOFFS	0x0000
+#define OMAP4430_PRM_EMU_EMU_CDOFFS		0x0000
+#define OMAP4430_PRM_EMU_CM_EMU_CDOFFS		0x0000
 
 /* OMAP4 specific register offsets */
 #define OMAP4_RM_RSTCTRL				0x0000
author maintainer
#22 lore raw

PATCH 7/11 OMAP4: clockdomains: add OMAP4 PRCM data and OMAP4 support

In reply to Paul Walmsley

Add PRCM partition, CM instance register address offset, and clockdomain register address offset to each OMAP4 struct clockdomain record. Add OMAP4 clockdomain code to use this new data to access registers properly.

While here, clean up some nearby clockdomain code to allocate auto variables in my recollection of Linus's preferred style.

The autogeneration scripts have been updated.

Cc Rajendra Nayak <[email protected]>
Cc Santosh Shilimkar <[email protected]>
Cc Beno?t Cousson <[email protected]>
---
 arch/arm/mach-omap2/clockdomain.c             |   75 ++++++++++++---
 arch/arm/mach-omap2/clockdomains44xx_data.c   |  121 +++++++++++++++----------
 arch/arm/mach-omap2/cm-regbits-34xx.h         |   11 ++
 arch/arm/mach-omap2/cminst44xx.c              |  105 ++++++++++++++++++++++
 arch/arm/plat-omap/include/plat/clockdomain.h |   20 +++-
 5 files changed, 260 insertions(+), 72 deletions(-)
arch/arm/mach-omap2/clockdomain.c +57 -18
index b1a6908..f83a1d4 100644
@@ -29,6 +29,9 @@
 #include "prm2xxx_3xxx.h"
 #include "prm-regbits-24xx.h"
 #include "cm2xxx_3xxx.h"
+#include "cm-regbits-34xx.h"
+#include "cminst44xx.h"
+#include "prcm44xx.h"
 
 #include <plat/clock.h>
 #include <plat/powerdomain.h>
@@ -245,13 +248,21 @@ static void _enable_hwsup(struct clockdomain *clkdm)
 
 	if (cpu_is_omap24xx())
 		bits = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
-	else if (cpu_is_omap34xx() || cpu_is_omap44xx())
+	else if (cpu_is_omap34xx())
 		bits = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
+	else if (cpu_is_omap44xx())
+		return omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
+						       clkdm->cm_inst,
+						       clkdm->clkdm_offs);
 	else
 		BUG();
 
 	bits = bits << __ffs(clkdm->clktrctrl_mask);
 
+	/*
+	 * XXX clkstctrl_reg is known on OMAP2 - this clkdm
+	 * field is not needed
+	 */
 	v = __raw_readl(clkdm->clkstctrl_reg);
 	v &= ~(clkdm->clktrctrl_mask);
 	v |= bits;
@@ -271,21 +282,27 @@ static void _disable_hwsup(struct clockdomain *clkdm)
 {
 	u32 bits, v;
 
-	if (cpu_is_omap24xx()) {
+	if (cpu_is_omap24xx())
 		bits = OMAP24XX_CLKSTCTRL_DISABLE_AUTO;
-	} else if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
+	else if (cpu_is_omap34xx())
 		bits = OMAP34XX_CLKSTCTRL_DISABLE_AUTO;
-	} else {
+	else if (cpu_is_omap44xx())
+		return omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
+							clkdm->cm_inst,
+							clkdm->clkdm_offs);
+	else
 		BUG();
-	}
 
 	bits = bits << __ffs(clkdm->clktrctrl_mask);
 
+	/*
+	 * XXX clkstctrl_reg is known on OMAP2 - this clkdm
+	 * field is not needed
+	 */
 	v = __raw_readl(clkdm->clkstctrl_reg);
 	v &= ~(clkdm->clktrctrl_mask);
 	v |= bits;
 	__raw_writel(v, clkdm->clkstctrl_reg);
-
 }
 
 /* Public functions */
@@ -723,14 +740,20 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
  */
 static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm)
 {
-	u32 v;
+	u32 v = 0;
 
 	if (!clkdm)
 		return -EINVAL;
 
-	v = __raw_readl(clkdm->clkstctrl_reg);
-	v &= clkdm->clktrctrl_mask;
-	v >>= __ffs(clkdm->clktrctrl_mask);
+	if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
+		v = __raw_readl(clkdm->clkstctrl_reg);
+		v &= clkdm->clktrctrl_mask;
+		v >>= __ffs(clkdm->clktrctrl_mask);
+	} else if (cpu_is_omap44xx()) {
+		pr_warn("OMAP4 clockdomain: missing wakeup/sleep deps\n");
+	} else {
+		BUG();
+	}
 
 	return v;
 }
@@ -746,6 +769,8 @@ static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm)
  */
 int omap2_clkdm_sleep(struct clockdomain *clkdm)
 {
+	u32 bits, v;
+
 	if (!clkdm)
 		return -EINVAL;
 
@@ -762,16 +787,22 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
 		omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
 			    clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL);
 
-	} else if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
+	} else if (cpu_is_omap34xx()) {
 
-		u32 bits = (OMAP34XX_CLKSTCTRL_FORCE_SLEEP <<
-			 __ffs(clkdm->clktrctrl_mask));
+		bits = (OMAP34XX_CLKSTCTRL_FORCE_SLEEP <<
+			__ffs(clkdm->clktrctrl_mask));
 
-		u32 v = __raw_readl(clkdm->clkstctrl_reg);
+		v = __raw_readl(clkdm->clkstctrl_reg);
 		v &= ~(clkdm->clktrctrl_mask);
 		v |= bits;
 		__raw_writel(v, clkdm->clkstctrl_reg);
 
+	} else if (cpu_is_omap44xx()) {
+
+		omap4_cminst_clkdm_force_sleep(clkdm->prcm_partition,
+					       clkdm->cm_inst,
+					       clkdm->clkdm_offs);
+
 	} else {
 		BUG();
 	};
@@ -790,6 +821,8 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
  */
 int omap2_clkdm_wakeup(struct clockdomain *clkdm)
 {
+	u32 bits, v;
+
 	if (!clkdm)
 		return -EINVAL;
 
@@ -806,16 +839,22 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
 		omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
 			      clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL);
 
-	} else if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
+	} else if (cpu_is_omap34xx()) {
 
-		u32 bits = (OMAP34XX_CLKSTCTRL_FORCE_WAKEUP <<
-			 __ffs(clkdm->clktrctrl_mask));
+		bits = (OMAP34XX_CLKSTCTRL_FORCE_WAKEUP <<
+			__ffs(clkdm->clktrctrl_mask));
 
-		u32 v = __raw_readl(clkdm->clkstctrl_reg);
+		v = __raw_readl(clkdm->clkstctrl_reg);
 		v &= ~(clkdm->clktrctrl_mask);
 		v |= bits;
 		__raw_writel(v, clkdm->clkstctrl_reg);
 
+	} else if (cpu_is_omap44xx()) {
+
+		omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
+						clkdm->cm_inst,
+						clkdm->clkdm_offs);
+
 	} else {
 		BUG();
 	};
arch/arm/mach-omap2/clockdomains44xx_data.c +73 -48

271 lines not on this page · raw message

arch/arm/mach-omap2/cm-regbits-34xx.h +11 -0
index cd9ff8b..b912759 100644
@@ -798,4 +798,15 @@
 #define OMAP3430ES2_CLKACTIVITY_USBHOST_SHIFT		0
 #define OMAP3430ES2_CLKACTIVITY_USBHOST_MASK		(1 << 0)
 
+/*
+ *
+ */
+
+/* OMAP3XXX CM_CLKSTCTRL_*.CLKTRCTRL_* register bit values */
+#define OMAP34XX_CLKSTCTRL_DISABLE_AUTO		0x0
+#define OMAP34XX_CLKSTCTRL_FORCE_SLEEP		0x1
+#define OMAP34XX_CLKSTCTRL_FORCE_WAKEUP		0x2
+#define OMAP34XX_CLKSTCTRL_ENABLE_AUTO		0x3
+
+
 #endif
arch/arm/mach-omap2/cminst44xx.c +105 -0

117 lines not on this page · raw message

arch/arm/plat-omap/include/plat/clockdomain.h +14 -6
index a5f8579..ec433c3 100644
@@ -38,12 +38,6 @@
 #define OMAP24XX_CLKSTCTRL_DISABLE_AUTO		0x0
 #define OMAP24XX_CLKSTCTRL_ENABLE_AUTO		0x1
 
-/* OMAP3XXX CM_CLKSTCTRL_*.CLKTRCTRL_* register bit values */
-#define OMAP34XX_CLKSTCTRL_DISABLE_AUTO		0x0
-#define OMAP34XX_CLKSTCTRL_FORCE_SLEEP		0x1
-#define OMAP34XX_CLKSTCTRL_FORCE_WAKEUP		0x2
-#define OMAP34XX_CLKSTCTRL_ENABLE_AUTO		0x3
-
 /**
  * struct clkdm_autodep - clkdm deps to add when entering/exiting hwsup mode
  * @clkdm: clockdomain to add wkdep+sleepdep on - set name member only
@@ -94,11 +88,20 @@ struct clkdm_dep {
  * @clktrctrl_mask: CLKTRCTRL/AUTOSTATE field mask in CM_CLKSTCTRL reg
  * @flags: Clockdomain capability flags
  * @dep_bit: Bit shift of this clockdomain's PM_WKDEP/CM_SLEEPDEP bit
+ * @prcm_partition: (OMAP4 only) PRCM partition ID for this clkdm's registers
+ * @cm_inst: (OMAP4 only) CM instance register offset
+ * @clkdm_offs: (OMAP4 only) CM clockdomain register offset
  * @wkdep_srcs: Clockdomains that can be told to wake this powerdomain up
  * @sleepdep_srcs: Clockdomains that can be told to keep this clkdm from inact
  * @omap_chip: OMAP chip types that this clockdomain is valid on
  * @usecount: Usecount tracking
  * @node: list_head to link all clockdomains together
+ *
+ * @prcm_partition should be a macro from mach-omap2/prcm44xx.h (OMAP4 only)
+ * @cm_inst should be a macro ending in _INST from the OMAP4 CM instance
+ *     definitions (OMAP4 only)
+ * @clkdm_offs should be a macro ending in _CDOFFS from the OMAP4 CM instance
+ *     definitions (OMAP4 only)
  */
 struct clockdomain {
 	const char *name;
@@ -106,10 +109,15 @@ struct clockdomain {
 		const char *name;
 		struct powerdomain *ptr;
 	} pwrdm;
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 	void __iomem *clkstctrl_reg;
 	const u16 clktrctrl_mask;
+#endif
 	const u8 flags;
 	const u8 dep_bit;
+	const u8 prcm_partition;
+	const s16 cm_inst;
+	const u16 clkdm_offs;
 	struct clkdm_dep *wkdep_srcs;
 	struct clkdm_dep *sleepdep_srcs;
 	const struct omap_chip_id omap_chip;
author maintainer
#23 lore raw

PATCH 8/11 OMAP2/3: clockdomain: remove unneeded .clkstctrl_reg, remove some direct CM register accesses

In reply to Paul Walmsley

Reverse some of the effects of commit 84c0c39aec31a09571fc08a752a2f4da0fe9fcf2 ("ARM: OMAP4: PM: Make OMAP3 Clock-domain framework compatible for OMAP4"). On OMAP2/3, the CM_CLKSTCTRL register is at a constant offset from the powerdomain's CM instance.

Also, remove some of the direct CM register access from the clockdomain code, moving it to the OMAP2/3 CM code instead. The intention here is to simplify the clockdomain code. (The long-term goal is to move all direct CM register access across the OMAP core code to the appropriate cm*.c file.)

---
 arch/arm/mach-omap2/clockdomain.c                |  135 +++++++---------------
 arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c |   40 -------
 arch/arm/mach-omap2/cm-regbits-24xx.h            |    5 +
 arch/arm/mach-omap2/cm2xxx_3xxx.c                |   68 +++++++++++
 arch/arm/mach-omap2/cm2xxx_3xxx.h                |    9 +
 arch/arm/plat-omap/include/plat/clockdomain.h    |    5 -
 6 files changed, 127 insertions(+), 135 deletions(-)
arch/arm/mach-omap2/clockdomain.c +45 -90
index f83a1d4..84cdd1d 100644
@@ -29,7 +29,7 @@
 #include "prm2xxx_3xxx.h"
 #include "prm-regbits-24xx.h"
 #include "cm2xxx_3xxx.h"
-#include "cm-regbits-34xx.h"
+#include "cm-regbits-24xx.h"
 #include "cminst44xx.h"
 #include "prcm44xx.h"
 
@@ -244,30 +244,18 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm)
  */
 static void _enable_hwsup(struct clockdomain *clkdm)
 {
-	u32 bits, v;
-
 	if (cpu_is_omap24xx())
-		bits = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
+		omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+					       clkdm->clktrctrl_mask);
 	else if (cpu_is_omap34xx())
-		bits = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
+		omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+					       clkdm->clktrctrl_mask);
 	else if (cpu_is_omap44xx())
 		return omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
 						       clkdm->cm_inst,
 						       clkdm->clkdm_offs);
 	else
 		BUG();
-
-	bits = bits << __ffs(clkdm->clktrctrl_mask);
-
-	/*
-	 * XXX clkstctrl_reg is known on OMAP2 - this clkdm
-	 * field is not needed
-	 */
-	v = __raw_readl(clkdm->clkstctrl_reg);
-	v &= ~(clkdm->clktrctrl_mask);
-	v |= bits;
-	__raw_writel(v, clkdm->clkstctrl_reg);
-
 }
 
 /**
@@ -280,29 +268,18 @@ static void _enable_hwsup(struct clockdomain *clkdm)
  */
 static void _disable_hwsup(struct clockdomain *clkdm)
 {
-	u32 bits, v;
-
 	if (cpu_is_omap24xx())
-		bits = OMAP24XX_CLKSTCTRL_DISABLE_AUTO;
+		omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+						clkdm->clktrctrl_mask);
 	else if (cpu_is_omap34xx())
-		bits = OMAP34XX_CLKSTCTRL_DISABLE_AUTO;
+		omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+						clkdm->clktrctrl_mask);
 	else if (cpu_is_omap44xx())
 		return omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
 							clkdm->cm_inst,
 							clkdm->clkdm_offs);
 	else
 		BUG();
-
-	bits = bits << __ffs(clkdm->clktrctrl_mask);
-
-	/*
-	 * XXX clkstctrl_reg is known on OMAP2 - this clkdm
-	 * field is not needed
-	 */
-	v = __raw_readl(clkdm->clkstctrl_reg);
-	v &= ~(clkdm->clktrctrl_mask);
-	v |= bits;
-	__raw_writel(v, clkdm->clkstctrl_reg);
 }
 
 /* Public functions */
@@ -731,34 +708,6 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
 }
 
 /**
- * omap2_clkdm_clktrctrl_read - read the clkdm's current state transition mode
- * @clkdm: struct clkdm * of a clockdomain
- *
- * Return the clockdomain @clkdm current state transition mode from the
- * corresponding domain CM_CLKSTCTRL register.	Returns -EINVAL if @clkdm
- * is NULL or the current mode upon success.
- */
-static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm)
-{
-	u32 v = 0;
-
-	if (!clkdm)
-		return -EINVAL;
-
-	if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
-		v = __raw_readl(clkdm->clkstctrl_reg);
-		v &= clkdm->clktrctrl_mask;
-		v >>= __ffs(clkdm->clktrctrl_mask);
-	} else if (cpu_is_omap44xx()) {
-		pr_warn("OMAP4 clockdomain: missing wakeup/sleep deps\n");
-	} else {
-		BUG();
-	}
-
-	return v;
-}
-
-/**
  * omap2_clkdm_sleep - force clockdomain sleep transition
  * @clkdm: struct clockdomain *
  *
@@ -769,8 +718,6 @@ static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm)
  */
 int omap2_clkdm_sleep(struct clockdomain *clkdm)
 {
-	u32 bits, v;
-
 	if (!clkdm)
 		return -EINVAL;
 
@@ -789,13 +736,8 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
 
 	} else if (cpu_is_omap34xx()) {
 
-		bits = (OMAP34XX_CLKSTCTRL_FORCE_SLEEP <<
-			__ffs(clkdm->clktrctrl_mask));
-
-		v = __raw_readl(clkdm->clkstctrl_reg);
-		v &= ~(clkdm->clktrctrl_mask);
-		v |= bits;
-		__raw_writel(v, clkdm->clkstctrl_reg);
+		omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
+					      clkdm->clktrctrl_mask);
 
 	} else if (cpu_is_omap44xx()) {
 
@@ -821,8 +763,6 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
  */
 int omap2_clkdm_wakeup(struct clockdomain *clkdm)
 {
-	u32 bits, v;
-
 	if (!clkdm)
 		return -EINVAL;
 
@@ -841,13 +781,8 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
 
 	} else if (cpu_is_omap34xx()) {
 
-		bits = (OMAP34XX_CLKSTCTRL_FORCE_WAKEUP <<
-			__ffs(clkdm->clktrctrl_mask));
-
-		v = __raw_readl(clkdm->clkstctrl_reg);
-		v &= ~(clkdm->clktrctrl_mask);
-		v |= bits;
-		__raw_writel(v, clkdm->clkstctrl_reg);
+		omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
+					       clkdm->clktrctrl_mask);
 
 	} else if (cpu_is_omap44xx()) {
 
@@ -960,7 +895,7 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
  */
 int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
 {
-	int v;
+	bool hwsup = false;
 
 	/*
 	 * XXX Rewrite this code to maintain a list of enabled
@@ -978,13 +913,23 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
 	pr_debug("clockdomain: clkdm %s: clk %s now enabled\n", clkdm->name,
 		 clk->name);
 
-	if (!clkdm->clkstctrl_reg)
-		return 0;
+	if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
 
-	v = omap2_clkdm_clktrctrl_read(clkdm);
+		if (!clkdm->clktrctrl_mask)
+			return 0;
+
+		hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+						   clkdm->clktrctrl_mask);
+
+	} else if (cpu_is_omap44xx()) {
+
+		hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
+						       clkdm->cm_inst,
+						       clkdm->clkdm_offs);
 
-	if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ||
-	    (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) {
+	}
+
+	if (hwsup) {
 		/* Disable HW transitions when we are changing deps */
 		_disable_hwsup(clkdm);
 		_clkdm_add_autodeps(clkdm);
@@ -1015,7 +960,7 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
  */
 int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
 {
-	int v;
+	bool hwsup = false;
 
 	/*
 	 * XXX Rewrite this code to maintain a list of enabled
@@ -1040,13 +985,23 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
 	pr_debug("clockdomain: clkdm %s: clk %s now disabled\n", clkdm->name,
 		 clk->name);
 
-	if (!clkdm->clkstctrl_reg)
-		return 0;
+	if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
+
+		if (!clkdm->clktrctrl_mask)
+			return 0;
+
+		hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+						   clkdm->clktrctrl_mask);
 
-	v = omap2_clkdm_clktrctrl_read(clkdm);
+	} else if (cpu_is_omap44xx()) {
+
+		hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
+						       clkdm->cm_inst,
+						       clkdm->clkdm_offs);
+
+	}
 
-	if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ||
-	    (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) {
+	if (hwsup) {
 		/* Disable HW transitions when we are changing deps */
 		_disable_hwsup(clkdm);
 		_clkdm_del_autodeps(clkdm);
arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c +0 -40
index de1d3b7..6e9ec49 100644
@@ -456,7 +456,6 @@ static struct clockdomain mpu_2420_clkdm = {
 	.name		= "mpu_clkdm",
 	.pwrdm		= { .name = "mpu_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP,
-	.clkstctrl_reg  = OMAP2420_CM_REGADDR(MPU_MOD, OMAP2_CM_CLKSTCTRL),
 	.wkdep_srcs	= mpu_24xx_wkdeps,
 	.clktrctrl_mask = OMAP24XX_AUTOSTATE_MPU_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
@@ -466,8 +465,6 @@ static struct clockdomain iva1_2420_clkdm = {
 	.name		= "iva1_clkdm",
 	.pwrdm		= { .name = "dsp_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg  = OMAP2420_CM_REGADDR(OMAP24XX_DSP_MOD,
-						 OMAP2_CM_CLKSTCTRL),
 	.dep_bit	= OMAP24XX_PM_WKDEP_MPU_EN_DSP_SHIFT,
 	.wkdep_srcs	= dsp_24xx_wkdeps,
 	.clktrctrl_mask = OMAP2420_AUTOSTATE_IVA_MASK,
@@ -478,8 +475,6 @@ static struct clockdomain dsp_2420_clkdm = {
 	.name		= "dsp_clkdm",
 	.pwrdm		= { .name = "dsp_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg  = OMAP2420_CM_REGADDR(OMAP24XX_DSP_MOD,
-						 OMAP2_CM_CLKSTCTRL),
 	.clktrctrl_mask = OMAP24XX_AUTOSTATE_DSP_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
@@ -488,7 +483,6 @@ static struct clockdomain gfx_2420_clkdm = {
 	.name		= "gfx_clkdm",
 	.pwrdm		= { .name = "gfx_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg  = OMAP2420_CM_REGADDR(GFX_MOD, OMAP2_CM_CLKSTCTRL),
 	.wkdep_srcs	= gfx_sgx_wkdeps,
 	.clktrctrl_mask = OMAP24XX_AUTOSTATE_GFX_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
@@ -498,7 +492,6 @@ static struct clockdomain core_l3_2420_clkdm = {
 	.name		= "core_l3_clkdm",
 	.pwrdm		= { .name = "core_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP,
-	.clkstctrl_reg  = OMAP2420_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
 	.wkdep_srcs	= core_24xx_wkdeps,
 	.clktrctrl_mask = OMAP24XX_AUTOSTATE_L3_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
@@ -508,7 +501,6 @@ static struct clockdomain core_l4_2420_clkdm = {
 	.name		= "core_l4_clkdm",
 	.pwrdm		= { .name = "core_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP,
-	.clkstctrl_reg  = OMAP2420_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
 	.wkdep_srcs	= core_24xx_wkdeps,
 	.clktrctrl_mask = OMAP24XX_AUTOSTATE_L4_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
@@ -518,7 +510,6 @@ static struct clockdomain dss_2420_clkdm = {
 	.name		= "dss_clkdm",
 	.pwrdm		= { .name = "core_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP,
-	.clkstctrl_reg  = OMAP2420_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
 	.clktrctrl_mask = OMAP24XX_AUTOSTATE_DSS_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
@@ -536,8 +527,6 @@ static struct clockdomain mpu_2430_clkdm = {
 	.name		= "mpu_clkdm",
 	.pwrdm		= { .name = "mpu_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg  = OMAP2430_CM_REGADDR(MPU_MOD,
-						 OMAP2_CM_CLKSTCTRL),
 	.wkdep_srcs	= mpu_24xx_wkdeps,
 	.clktrctrl_mask = OMAP24XX_AUTOSTATE_MPU_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
@@ -548,8 +537,6 @@ static struct clockdomain mdm_clkdm = {
 	.name		= "mdm_clkdm",
 	.pwrdm		= { .name = "mdm_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg  = OMAP2430_CM_REGADDR(OMAP2430_MDM_MOD,
-						 OMAP2_CM_CLKSTCTRL),
 	.dep_bit	= OMAP2430_PM_WKDEP_MPU_EN_MDM_SHIFT,
 	.wkdep_srcs	= mdm_2430_wkdeps,
 	.clktrctrl_mask = OMAP2430_AUTOSTATE_MDM_MASK,
@@ -560,8 +547,6 @@ static struct clockdomain dsp_2430_clkdm = {
 	.name		= "dsp_clkdm",
 	.pwrdm		= { .name = "dsp_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg  = OMAP2430_CM_REGADDR(OMAP24XX_DSP_MOD,
-						 OMAP2_CM_CLKSTCTRL),
 	.dep_bit	= OMAP24XX_PM_WKDEP_MPU_EN_DSP_SHIFT,
 	.wkdep_srcs	= dsp_24xx_wkdeps,
 	.clktrctrl_mask = OMAP24XX_AUTOSTATE_DSP_MASK,
@@ -572,7 +557,6 @@ static struct clockdomain gfx_2430_clkdm = {
 	.name		= "gfx_clkdm",
 	.pwrdm		= { .name = "gfx_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg  = OMAP2430_CM_REGADDR(GFX_MOD, OMAP2_CM_CLKSTCTRL),
 	.wkdep_srcs	= gfx_sgx_wkdeps,
 	.clktrctrl_mask = OMAP24XX_AUTOSTATE_GFX_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
@@ -587,7 +571,6 @@ static struct clockdomain core_l3_2430_clkdm = {
 	.name		= "core_l3_clkdm",
 	.pwrdm		= { .name = "core_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP,
-	.clkstctrl_reg  = OMAP2430_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
 	.dep_bit	= OMAP24XX_EN_CORE_SHIFT,
 	.wkdep_srcs	= core_24xx_wkdeps,
 	.clktrctrl_mask = OMAP24XX_AUTOSTATE_L3_MASK,
@@ -603,7 +586,6 @@ static struct clockdomain core_l4_2430_clkdm = {
 	.name		= "core_l4_clkdm",
 	.pwrdm		= { .name = "core_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP,
-	.clkstctrl_reg  = OMAP2430_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
 	.dep_bit	= OMAP24XX_EN_CORE_SHIFT,
 	.wkdep_srcs	= core_24xx_wkdeps,
 	.clktrctrl_mask = OMAP24XX_AUTOSTATE_L4_MASK,
@@ -614,7 +596,6 @@ static struct clockdomain dss_2430_clkdm = {
 	.name		= "dss_clkdm",
 	.pwrdm		= { .name = "core_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP,
-	.clkstctrl_reg  = OMAP2430_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
 	.clktrctrl_mask = OMAP24XX_AUTOSTATE_DSS_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
@@ -632,7 +613,6 @@ static struct clockdomain mpu_3xxx_clkdm = {
 	.name		= "mpu_clkdm",
 	.pwrdm		= { .name = "mpu_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP | CLKDM_CAN_FORCE_WAKEUP,
-	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(MPU_MOD, OMAP2_CM_CLKSTCTRL),
 	.dep_bit	= OMAP3430_EN_MPU_SHIFT,
 	.wkdep_srcs	= mpu_3xxx_wkdeps,
 	.clktrctrl_mask = OMAP3430_CLKTRCTRL_MPU_MASK,
@@ -643,8 +623,6 @@ static struct clockdomain neon_clkdm = {
 	.name		= "neon_clkdm",
 	.pwrdm		= { .name = "neon_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430_NEON_MOD,
-						 OMAP2_CM_CLKSTCTRL),
 	.wkdep_srcs	= neon_wkdeps,
 	.clktrctrl_mask = OMAP3430_CLKTRCTRL_NEON_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
@@ -654,8 +632,6 @@ static struct clockdomain iva2_clkdm = {
 	.name		= "iva2_clkdm",
 	.pwrdm		= { .name = "iva2_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430_IVA2_MOD,
-						 OMAP2_CM_CLKSTCTRL),
 	.dep_bit	= OMAP3430_PM_WKDEP_MPU_EN_IVA2_SHIFT,
 	.wkdep_srcs	= iva2_wkdeps,
 	.clktrctrl_mask = OMAP3430_CLKTRCTRL_IVA2_MASK,
@@ -666,7 +642,6 @@ static struct clockdomain gfx_3430es1_clkdm = {
 	.name		= "gfx_clkdm",
 	.pwrdm		= { .name = "gfx_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(GFX_MOD, OMAP2_CM_CLKSTCTRL),
 	.wkdep_srcs	= gfx_sgx_wkdeps,
 	.sleepdep_srcs	= gfx_sgx_sleepdeps,
 	.clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_GFX_MASK,
@@ -677,8 +652,6 @@ static struct clockdomain sgx_clkdm = {
 	.name		= "sgx_clkdm",
 	.pwrdm		= { .name = "sgx_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430ES2_SGX_MOD,
-						 OMAP2_CM_CLKSTCTRL),
 	.wkdep_srcs	= gfx_sgx_wkdeps,
 	.sleepdep_srcs	= gfx_sgx_sleepdeps,
 	.clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_SGX_MASK,
@@ -696,7 +669,6 @@ static struct clockdomain d2d_clkdm = {
 	.name		= "d2d_clkdm",
 	.pwrdm		= { .name = "core_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
 	.clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_D2D_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
@@ -710,7 +682,6 @@ static struct clockdomain core_l3_3xxx_clkdm = {
 	.name		= "core_l3_clkdm",
 	.pwrdm		= { .name = "core_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP,
-	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
 	.dep_bit	= OMAP3430_EN_CORE_SHIFT,
 	.clktrctrl_mask = OMAP3430_CLKTRCTRL_L3_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
@@ -725,7 +696,6 @@ static struct clockdomain core_l4_3xxx_clkdm = {
 	.name		= "core_l4_clkdm",
 	.pwrdm		= { .name = "core_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP,
-	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
 	.dep_bit	= OMAP3430_EN_CORE_SHIFT,
 	.clktrctrl_mask = OMAP3430_CLKTRCTRL_L4_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
@@ -736,8 +706,6 @@ static struct clockdomain dss_3xxx_clkdm = {
 	.name		= "dss_clkdm",
 	.pwrdm		= { .name = "dss_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430_DSS_MOD,
-						 OMAP2_CM_CLKSTCTRL),
 	.dep_bit	= OMAP3430_PM_WKDEP_MPU_EN_DSS_SHIFT,
 	.wkdep_srcs	= dss_wkdeps,
 	.sleepdep_srcs	= dss_sleepdeps,
@@ -749,8 +717,6 @@ static struct clockdomain cam_clkdm = {
 	.name		= "cam_clkdm",
 	.pwrdm		= { .name = "cam_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430_CAM_MOD,
-						 OMAP2_CM_CLKSTCTRL),
 	.wkdep_srcs	= cam_wkdeps,
 	.sleepdep_srcs	= cam_sleepdeps,
 	.clktrctrl_mask = OMAP3430_CLKTRCTRL_CAM_MASK,
@@ -761,8 +727,6 @@ static struct clockdomain usbhost_clkdm = {
 	.name		= "usbhost_clkdm",
 	.pwrdm		= { .name = "usbhost_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430ES2_USBHOST_MOD,
-						 OMAP2_CM_CLKSTCTRL),
 	.wkdep_srcs	= usbhost_wkdeps,
 	.sleepdep_srcs	= usbhost_sleepdeps,
 	.clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_USBHOST_MASK,
@@ -773,8 +737,6 @@ static struct clockdomain per_clkdm = {
 	.name		= "per_clkdm",
 	.pwrdm		= { .name = "per_pwrdm" },
 	.flags		= CLKDM_CAN_HWSUP_SWSUP,
-	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430_PER_MOD,
-						 OMAP2_CM_CLKSTCTRL),
 	.dep_bit	= OMAP3430_EN_PER_SHIFT,
 	.wkdep_srcs	= per_wkdeps,
 	.sleepdep_srcs	= per_sleepdeps,
@@ -790,8 +752,6 @@ static struct clockdomain emu_clkdm = {
 	.name		= "emu_clkdm",
 	.pwrdm		= { .name = "emu_pwrdm" },
 	.flags		= /* CLKDM_CAN_ENABLE_AUTO |  */CLKDM_CAN_SWSUP,
-	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430_EMU_MOD,
-						 OMAP2_CM_CLKSTCTRL),
 	.clktrctrl_mask = OMAP3430_CLKTRCTRL_EMU_MASK,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
arch/arm/mach-omap2/cm-regbits-24xx.h +5 -0
index bab62ee..82286bc 100644
@@ -430,4 +430,9 @@
 #define OMAP2430_AUTOSTATE_MDM_SHIFT			0
 #define OMAP2430_AUTOSTATE_MDM_MASK			(1 << 0)
 
+/* OMAP24XX CM_CLKSTCTRL_*.AUTOSTATE_* register bit values */
+#define OMAP24XX_CLKSTCTRL_DISABLE_AUTO		0x0
+#define OMAP24XX_CLKSTCTRL_ENABLE_AUTO		0x1
+
+
 #endif
arch/arm/mach-omap2/cm2xxx_3xxx.c +68 -0

74 lines not on this page · raw message

arch/arm/mach-omap2/cm2xxx_3xxx.h +9 -0
index ff24edf..5e9ea5b 100644
@@ -113,6 +113,15 @@ extern int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
 extern u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx);
 extern u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx);
 
+extern bool omap2_cm_is_clkdm_in_hwsup(s16 module, u32 mask);
+extern void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
+extern void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
+
+extern void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
+extern void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
+extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask);
+extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask);
+
 #endif
 
 /* CM register bits shared between 24XX and 3430 */
arch/arm/plat-omap/include/plat/clockdomain.h +0 -5
index ec433c3..e91ae92 100644
@@ -34,10 +34,6 @@
 #define CLKDM_CAN_SWSUP		(CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP)
 #define CLKDM_CAN_HWSUP_SWSUP	(CLKDM_CAN_SWSUP | CLKDM_CAN_HWSUP)
 
-/* OMAP24XX CM_CLKSTCTRL_*.AUTOSTATE_* register bit values */
-#define OMAP24XX_CLKSTCTRL_DISABLE_AUTO		0x0
-#define OMAP24XX_CLKSTCTRL_ENABLE_AUTO		0x1
-
 /**
  * struct clkdm_autodep - clkdm deps to add when entering/exiting hwsup mode
  * @clkdm: clockdomain to add wkdep+sleepdep on - set name member only
@@ -110,7 +106,6 @@ struct clockdomain {
 		struct powerdomain *ptr;
 	} pwrdm;
 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
-	void __iomem *clkstctrl_reg;
 	const u16 clktrctrl_mask;
 #endif
 	const u8 flags;
author maintainer
#24 lore raw

PATCH 9/11 OMAP2+: clockdomain: move header file from plat-omap to mach-omap2

In reply to Paul Walmsley

The OMAP clockdomain code and data is all OMAP2+-specific. This seems unlikely to change any time soon. Move plat-omap/include/plat/clockdomain.h to mach-omap2/clockdomain.h. The primary point of doing this is to remove the temptation for unrelated upper-layer code to access clockdomain code and data directly.

---
 arch/arm/mach-omap2/clock.c                      |    2 +-
 arch/arm/mach-omap2/clockdomain.c                |    2 +-
 arch/arm/mach-omap2/clockdomain.h                |    6 ++----
 arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c |    2 +-
 arch/arm/mach-omap2/clockdomains44xx_data.c      |    2 +-
 arch/arm/mach-omap2/cpuidle34xx.c                |    2 +-
 arch/arm/mach-omap2/io.c                         |    2 +-
 arch/arm/mach-omap2/omap_hwmod.c                 |    2 +-
 arch/arm/mach-omap2/pm-debug.c                   |    2 +-
 arch/arm/mach-omap2/pm.c                         |    2 +-
 arch/arm/mach-omap2/pm24xx.c                     |    2 +-
 arch/arm/mach-omap2/pm34xx.c                     |    2 +-
 arch/arm/mach-omap2/powerdomain.c                |    2 +-
 13 files changed, 14 insertions(+), 16 deletions(-)
 rename arch/arm/{plat-omap/include/plat/clockdomain.h => mach-omap2/clockdomain.h} (97%)
arch/arm/mach-omap2/clock.c +1 -1
index cda2f1d..2a2f152 100644
@@ -24,7 +24,7 @@
 #include <linux/bitops.h>
 
 #include <plat/clock.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/cpu.h>
 #include <plat/prcm.h>
 
arch/arm/mach-omap2/clockdomain.c +1 -1
index 84cdd1d..dadfb3f 100644
@@ -35,7 +35,7 @@
 
 #include <plat/clock.h>
 #include <plat/powerdomain.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/prcm.h>
 
 /* clkdm_list contains all registered struct clockdomains */
arch/arm/mach-omap2/clockdomain.h renamed from arch/arm/plat-omap/include/plat/clockdomain.h +2 -4
similarity index 97%
rename from arch/arm/plat-omap/include/plat/clockdomain.h
rename to arch/arm/mach-omap2/clockdomain.h
index e91ae92..372c646 100644
@@ -11,12 +11,10 @@
  * 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.
- *
- * XXX This should be moved to mach-omap2/ at the earliest opportunity.
  */
 
-#ifndef __ASM_ARM_ARCH_OMAP_CLOCKDOMAIN_H
-#define __ASM_ARM_ARCH_OMAP_CLOCKDOMAIN_H
+#ifndef __ARCH_ARM_MACH_OMAP2_CLOCKDOMAIN_H
+#define __ARCH_ARM_MACH_OMAP2_CLOCKDOMAIN_H
 
 #include <linux/init.h>
 
arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c +1 -1
index 6e9ec49..e4a7133 100644
@@ -35,7 +35,7 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include "prm2xxx_3xxx.h"
 #include "cm2xxx_3xxx.h"
 #include "cm-regbits-24xx.h"
arch/arm/mach-omap2/clockdomains44xx_data.c +1 -1
index 2d3d1ef..51920fc 100644
@@ -26,7 +26,7 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include "cm1_44xx.h"
 #include "cm2_44xx.h"
 
arch/arm/mach-omap2/cpuidle34xx.c +1 -1
index 0d50b45..568dff7 100644
@@ -28,7 +28,7 @@
 #include <plat/prcm.h>
 #include <plat/irqs.h>
 #include <plat/powerdomain.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/serial.h>
 
 #include "pm.h"
arch/arm/mach-omap2/io.c +1 -1
index d05638ac..1151f4a 100644
@@ -41,7 +41,7 @@
 #include <plat/omap-pm.h>
 #include <plat/powerdomain.h>
 
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/omap_hwmod.h>
 
 /*
arch/arm/mach-omap2/omap_hwmod.c +1 -1
index 63d3f4d..10bd001 100644
@@ -138,7 +138,7 @@
 
 #include <plat/common.h>
 #include <plat/cpu.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/powerdomain.h>
 #include <plat/clock.h>
 #include <plat/omap_hwmod.h>
arch/arm/mach-omap2/pm-debug.c +1 -1
index 73f8ec0..3fc7707 100644
@@ -30,7 +30,7 @@
 #include <plat/clock.h>
 #include <plat/board.h>
 #include <plat/powerdomain.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/dmtimer.h>
 
 #include "cm2xxx_3xxx.h"
arch/arm/mach-omap2/pm.c +1 -1
index 59ca03b..60cfe67 100644
@@ -19,7 +19,7 @@
 #include <plat/common.h>
 
 #include <plat/powerdomain.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 
 static struct omap_device_pm_latency *pm_lats;
 
arch/arm/mach-omap2/pm24xx.c +1 -1
index f13e2ca..7d4933b 100644
@@ -51,7 +51,7 @@
 #include "control.h"
 
 #include <plat/powerdomain.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 
 static void (*omap2_sram_idle)(void);
 static void (*omap2_sram_suspend)(u32 dllctrl, void __iomem *sdrc_dlla_ctrl,
arch/arm/mach-omap2/pm34xx.c +1 -1
index 8ea8051..43c1a43 100644
@@ -31,7 +31,7 @@
 #include <linux/console.h>
 
 #include <plat/sram.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/powerdomain.h>
 #include <plat/serial.h>
 #include <plat/sdrc.h>
arch/arm/mach-omap2/powerdomain.c +1 -1
index a76ad3f..7eb7ba4 100644
@@ -27,7 +27,7 @@
 
 #include <plat/cpu.h>
 #include <plat/powerdomain.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/prcm.h>
 
 #include "pm.h"
author maintainer
#25 lore raw

PATCH 9/11 OMAP2+: clockdomain: move header file from plat-omap to mach-omap2

Quoted 8 lines · Paul Walmsley

The OMAP clockdomain code and data is all OMAP2+-specific. This seems unlikely to change any time soon. Move plat-omap/include/plat/clockdomain.h to mach-omap2/clockdomain.h. The primary point of doing this is to remove the temptation for unrelated upper-layer code to access clockdomain code and data directly.

This patch has been updated to get DSPBridge building again.

The DSPBridge should not be touching the clockdomain headers; this is just a temporary workaround until the DSPBridge people fix the code.

- Paul

From: Paul Walmsley <[email protected]>
Date: Tue, 14 Dec 2010 13:03:49 -0700
Subject: [PATCH] OMAP2+: clockdomain: move header file from plat-omap to mach-omap2

The OMAP clockdomain code and data is all OMAP2+-specific. This seems unlikely to change any time soon. Move plat-omap/include/plat/clockdomain.h to mach-omap2/clockdomain.h. The primary point of doing this is to remove the temptation for unrelated upper-layer code to access clockdomain code and data directly.

DSPBridge also uses the clockdomain headers for some reason, so, modify it also. The DSPBridge code should not be including the clockdomain headers; these should be removed.

Cc Kevin Hilman <[email protected]>
Cc Omar Ramirez Luna <[email protected]>
Cc Felipe Contreras <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 arch/arm/mach-omap2/clock.c                        |    2 +-
 arch/arm/mach-omap2/clockdomain.c                  |    2 +-
 .../include/plat => mach-omap2}/clockdomain.h      |    6 ++----
 arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c   |    2 +-
 arch/arm/mach-omap2/clockdomains44xx_data.c        |    2 +-
 arch/arm/mach-omap2/cpuidle34xx.c                  |    2 +-
 arch/arm/mach-omap2/io.c                           |    2 +-
 arch/arm/mach-omap2/omap_hwmod.c                   |    2 +-
 arch/arm/mach-omap2/pm-debug.c                     |    2 +-
 arch/arm/mach-omap2/pm.c                           |    2 +-
 arch/arm/mach-omap2/pm24xx.c                       |    2 +-
 arch/arm/mach-omap2/pm34xx.c                       |    2 +-
 arch/arm/mach-omap2/powerdomain.c                  |    2 +-
 drivers/staging/tidspbridge/core/_tiomap.h         |    7 ++++++-
 14 files changed, 20 insertions(+), 17 deletions(-)
 rename arch/arm/{plat-omap/include/plat => mach-omap2}/clockdomain.h (97%)
arch/arm/mach-omap2/clock.c +1 -1
index cda2f1d..2a2f152 100644
@@ -24,7 +24,7 @@
 #include <linux/bitops.h>
 
 #include <plat/clock.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/cpu.h>
 #include <plat/prcm.h>
 
arch/arm/mach-omap2/clockdomain.c +1 -1
index e5605c2..650bf68 100644
@@ -35,7 +35,7 @@
 
 #include <plat/clock.h>
 #include <plat/powerdomain.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/prcm.h>
 
 /* clkdm_list contains all registered struct clockdomains */
arch/arm/mach-omap2/clockdomain.h renamed from arch/arm/plat-omap/include/plat/clockdomain.h +2 -4
similarity index 97%
rename from arch/arm/plat-omap/include/plat/clockdomain.h
rename to arch/arm/mach-omap2/clockdomain.h
index e91ae92..372c646 100644
@@ -11,12 +11,10 @@
  * 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.
- *
- * XXX This should be moved to mach-omap2/ at the earliest opportunity.
  */
 
-#ifndef __ASM_ARM_ARCH_OMAP_CLOCKDOMAIN_H
-#define __ASM_ARM_ARCH_OMAP_CLOCKDOMAIN_H
+#ifndef __ARCH_ARM_MACH_OMAP2_CLOCKDOMAIN_H
+#define __ARCH_ARM_MACH_OMAP2_CLOCKDOMAIN_H
 
 #include <linux/init.h>
 
arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c +1 -1
index 6e9ec49..e4a7133 100644
@@ -35,7 +35,7 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include "prm2xxx_3xxx.h"
 #include "cm2xxx_3xxx.h"
 #include "cm-regbits-24xx.h"
arch/arm/mach-omap2/clockdomains44xx_data.c +1 -1
index 2d3d1ef..51920fc 100644
@@ -26,7 +26,7 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include "cm1_44xx.h"
 #include "cm2_44xx.h"
 
arch/arm/mach-omap2/cpuidle34xx.c +1 -1
index 0d50b45..568dff7 100644
@@ -28,7 +28,7 @@
 #include <plat/prcm.h>
 #include <plat/irqs.h>
 #include <plat/powerdomain.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/serial.h>
 
 #include "pm.h"
arch/arm/mach-omap2/io.c +1 -1
index 1732fb3..ab2d1ed 100644
@@ -41,7 +41,7 @@
 #include <plat/omap-pm.h>
 #include <plat/powerdomain.h>
 
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/omap_hwmod.h>
 #include <plat/multi.h>
 
arch/arm/mach-omap2/omap_hwmod.c +1 -1
index 1312ce2..e1358ba 100644
@@ -139,7 +139,7 @@
 
 #include <plat/common.h>
 #include <plat/cpu.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/powerdomain.h>
 #include <plat/clock.h>
 #include <plat/omap_hwmod.h>
arch/arm/mach-omap2/pm-debug.c +1 -1
index 73f8ec0..3fc7707 100644
@@ -30,7 +30,7 @@
 #include <plat/clock.h>
 #include <plat/board.h>
 #include <plat/powerdomain.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/dmtimer.h>
 
 #include "cm2xxx_3xxx.h"
arch/arm/mach-omap2/pm.c +1 -1
index 59ca03b..60cfe67 100644
@@ -19,7 +19,7 @@
 #include <plat/common.h>
 
 #include <plat/powerdomain.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 
 static struct omap_device_pm_latency *pm_lats;
 
arch/arm/mach-omap2/pm24xx.c +1 -1
index f13e2ca..7d4933b 100644
@@ -51,7 +51,7 @@
 #include "control.h"
 
 #include <plat/powerdomain.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 
 static void (*omap2_sram_idle)(void);
 static void (*omap2_sram_suspend)(u32 dllctrl, void __iomem *sdrc_dlla_ctrl,
arch/arm/mach-omap2/pm34xx.c +1 -1
index 8ea8051..43c1a43 100644
@@ -31,7 +31,7 @@
 #include <linux/console.h>
 
 #include <plat/sram.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/powerdomain.h>
 #include <plat/serial.h>
 #include <plat/sdrc.h>
arch/arm/mach-omap2/powerdomain.c +1 -1
index a76ad3f..7eb7ba4 100644
@@ -27,7 +27,7 @@
 
 #include <plat/cpu.h>
 #include <plat/powerdomain.h>
-#include <plat/clockdomain.h>
+#include "clockdomain.h"
 #include <plat/prcm.h>
 
 #include "pm.h"
drivers/staging/tidspbridge/core/_tiomap.h +6 -1
index 7fac488..a3190e7 100644
@@ -19,8 +19,13 @@
 #ifndef _TIOMAP_
 #define _TIOMAP_
 
+/*
+ * XXX These powerdomain.h/clockdomain.h includes are wrong and should
+ * be removed.  No driver should call pwrdm_* or clkdm_* functions
+ * directly; they should rely on OMAP core code to do this.
+ */
 #include <plat/powerdomain.h>
-#include <plat/clockdomain.h>
+#include <mach-omap2/clockdomain.h>
 /*
  * XXX These mach-omap2/ includes are wrong and should be removed.  No
  * driver should read or write to PRM/CM registers directly; they
Signature · 1 line
1.7.2.3
author maintainer
#26 lore raw

PATCH 10/11 OMAP2+: powerdomain: move header file from plat-omap to mach-omap2

In reply to Paul Walmsley

The OMAP powerdomain code and data is all OMAP2+-specific. This seems unlikely to change any time soon. Move plat-omap/include/plat/powerdomain.h to mach-omap2/powerdomain.h. The primary point of doing this is to remove the temptation for unrelated upper-layer code to access powerdomain code and data directly.

As part of this process, remove the references to powerdomain data from the GPIO "driver" and the OMAP PM no-op layer, both in plat-omap.

---
 arch/arm/mach-omap2/clockdomain.c                |    2 +
 arch/arm/mach-omap2/clockdomain.h                |    2 +
 arch/arm/mach-omap2/cpuidle34xx.c                |    2 +
 arch/arm/mach-omap2/io.c                         |    2 +
 arch/arm/mach-omap2/omap_hwmod.c                 |    2 +
 arch/arm/mach-omap2/pm-debug.c                   |    2 +
 arch/arm/mach-omap2/pm.c                         |    2 +
 arch/arm/mach-omap2/pm.h                         |    2 +
 arch/arm/mach-omap2/pm24xx.c                     |    4 +--
 arch/arm/mach-omap2/pm34xx.c                     |    6 +++-
 arch/arm/mach-omap2/pm44xx.c                     |    2 +
 arch/arm/mach-omap2/powerdomain-common.c         |    1 -
 arch/arm/mach-omap2/powerdomain.c                |    2 +
 arch/arm/mach-omap2/powerdomain.h                |   23 +++++++++++++----
 arch/arm/mach-omap2/powerdomain2xxx_3xxx.c       |    2 +
 arch/arm/mach-omap2/powerdomain44xx.c            |    3 +-
 arch/arm/mach-omap2/powerdomains.h               |   30 ----------------------
 arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c |    4 +--
 arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.h |    2 +
 arch/arm/mach-omap2/powerdomains2xxx_data.c      |    3 +-
 arch/arm/mach-omap2/powerdomains3xxx_data.c      |    3 +-
 arch/arm/mach-omap2/powerdomains44xx_data.c      |    3 +-
 arch/arm/plat-omap/gpio.c                        |    5 +---
 arch/arm/plat-omap/include/plat/gpio.h           |    2 +
 arch/arm/plat-omap/include/plat/omap-pm.h        |    2 -
 arch/arm/plat-omap/omap-pm-noop.c                |    2 -
 26 files changed, 44 insertions(+), 71 deletions(-)
 rename arch/arm/{plat-omap/include/plat/powerdomain.h => mach-omap2/powerdomain.h} (92%)
 delete mode 100644 arch/arm/mach-omap2/powerdomains.h
arch/arm/mach-omap2/clockdomain.c +1 -1
index dadfb3f..4ebfa26 100644
@@ -34,7 +34,7 @@
 #include "prcm44xx.h"
 
 #include <plat/clock.h>
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "clockdomain.h"
 #include <plat/prcm.h>
 
arch/arm/mach-omap2/clockdomain.h +1 -1
index 372c646..de3faa2 100644
@@ -18,7 +18,7 @@
 
 #include <linux/init.h>
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include <plat/clock.h>
 #include <plat/cpu.h>
 
arch/arm/mach-omap2/cpuidle34xx.c +1 -1
index 568dff7..81b0a90 100644
@@ -27,7 +27,7 @@
 
 #include <plat/prcm.h>
 #include <plat/irqs.h>
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "clockdomain.h"
 #include <plat/serial.h>
 
arch/arm/mach-omap2/io.c +1 -1
index 1151f4a..a31acff 100644
@@ -39,7 +39,7 @@
 #include "io.h"
 
 #include <plat/omap-pm.h>
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 
 #include "clockdomain.h"
 #include <plat/omap_hwmod.h>
arch/arm/mach-omap2/omap_hwmod.c +1 -1
index 10bd001..38652d0 100644
@@ -139,7 +139,7 @@
 #include <plat/common.h>
 #include <plat/cpu.h>
 #include "clockdomain.h"
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include <plat/clock.h>
 #include <plat/omap_hwmod.h>
 #include <plat/prcm.h>
arch/arm/mach-omap2/pm-debug.c +1 -1
index 3fc7707..ed892ae 100644
@@ -29,7 +29,7 @@
 
 #include <plat/clock.h>
 #include <plat/board.h>
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "clockdomain.h"
 #include <plat/dmtimer.h>
 
arch/arm/mach-omap2/pm.c +1 -1
index 60cfe67..cf1c4c9 100644
@@ -18,7 +18,7 @@
 #include <plat/omap_device.h>
 #include <plat/common.h>
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "clockdomain.h"
 
 static struct omap_device_pm_latency *pm_lats;
arch/arm/mach-omap2/pm.h +1 -1
index 0d75bfd..642e519 100644
@@ -11,7 +11,7 @@
 #ifndef __ARCH_ARM_MACH_OMAP2_PM_H
 #define __ARCH_ARM_MACH_OMAP2_PM_H
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 
 extern void *omap3_secure_ram_storage;
 extern void omap3_pm_off_mode_enable(int);
arch/arm/mach-omap2/pm24xx.c +2 -2
index 7d4933b..0413314 100644
@@ -50,7 +50,7 @@
 #include "pm.h"
 #include "control.h"
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "clockdomain.h"
 
 static void (*omap2_sram_idle)(void);
@@ -107,7 +107,7 @@ static void omap2_enter_full_retention(void)
 	l = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0) | OMAP24XX_USBSTANDBYCTRL;
 	omap_ctrl_writel(l, OMAP2_CONTROL_DEVCONF0);
 
-	omap2_gpio_prepare_for_idle(PWRDM_POWER_RET);
+	omap2_gpio_prepare_for_idle(0);
 
 	if (omap2_pm_debug) {
 		omap2_pm_dump(0, 0, 0);
arch/arm/mach-omap2/pm34xx.c +4 -2
index 43c1a43..e804a9f 100644
@@ -32,7 +32,7 @@
 
 #include <plat/sram.h>
 #include "clockdomain.h"
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include <plat/serial.h>
 #include <plat/sdrc.h>
 #include <plat/prcm.h>
@@ -344,6 +344,7 @@ void omap_sram_idle(void)
 	int mpu_next_state = PWRDM_POWER_ON;
 	int per_next_state = PWRDM_POWER_ON;
 	int core_next_state = PWRDM_POWER_ON;
+	int per_going_off;
 	int core_prev_state, per_prev_state;
 	u32 sdrc_pwr = 0;
 
@@ -394,9 +395,10 @@ void omap_sram_idle(void)
 
 	/* PER */
 	if (per_next_state < PWRDM_POWER_ON) {
+		per_going_off = (per_next_state == PWRDM_POWER_OFF) ? 1 : 0;
 		omap_uart_prepare_idle(2);
 		omap_uart_prepare_idle(3);
-		omap2_gpio_prepare_for_idle(per_next_state);
+		omap2_gpio_prepare_for_idle(per_going_off);
 		if (per_next_state == PWRDM_POWER_OFF)
 				omap3_per_save_context();
 	}
arch/arm/mach-omap2/pm44xx.c +1 -1
index 54544b4..32d02cb 100644
@@ -16,7 +16,7 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include <mach/omap4-common.h>
 
 struct power_state {
arch/arm/mach-omap2/powerdomain-common.c +0 -1
index cb01c7a..171fccd 100644
@@ -20,7 +20,6 @@
 #include "cm-regbits-44xx.h"
 #include "prm-regbits-34xx.h"
 #include "prm-regbits-44xx.h"
-#include "powerdomains.h"
 
 /*
  * OMAP3 and OMAP4 specific register bit initialisations
arch/arm/mach-omap2/powerdomain.c +1 -1
index 7eb7ba4..06ef60ee 100644
@@ -26,7 +26,7 @@
 #include "prm44xx.h"
 
 #include <plat/cpu.h>
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "clockdomain.h"
 #include <plat/prcm.h>
 
arch/arm/mach-omap2/powerdomain.h renamed from arch/arm/plat-omap/include/plat/powerdomain.h +18 -5
similarity index 92%
rename from arch/arm/plat-omap/include/plat/powerdomain.h
rename to arch/arm/mach-omap2/powerdomain.h
index a0d3a30..35b5b48 100644
@@ -1,10 +1,10 @@
 /*
  * OMAP2/3/4 powerdomain control
  *
- * Copyright (C) 2007-2008 Texas Instruments, Inc.
+ * Copyright (C) 2007-2008, 2010 Texas Instruments, Inc.
  * Copyright (C) 2007-2010 Nokia Corporation
  *
- * Written by Paul Walmsley
+ * Paul Walmsley
  *
  * 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
@@ -14,13 +14,13 @@
  * opportunity.
  */
 
-#ifndef ASM_ARM_PLAT_OMAP_INCLUDE_PLAT_POWERDOMAIN
-#define ASM_ARM_PLAT_OMAP_INCLUDE_PLAT_POWERDOMAIN
+#ifndef __ARCH_ARM_MACH_OMAP2_POWERDOMAIN_H
+#define __ARCH_ARM_MACH_OMAP2_POWERDOMAIN_H
 
 #include <linux/types.h>
 #include <linux/list.h>
 
-#include <asm/atomic.h>
+#include <linux/atomic.h>
 
 #include <plat/cpu.h>
 
@@ -216,4 +216,17 @@ extern void omap2xxx_powerdomains_init(void);
 extern void omap3xxx_powerdomains_init(void);
 extern void omap44xx_powerdomains_init(void);
 
+extern struct pwrdm_ops omap2_pwrdm_operations;
+extern struct pwrdm_ops omap3_pwrdm_operations;
+extern struct pwrdm_ops omap4_pwrdm_operations;
+
+/* Common Internal functions used across OMAP rev's */
+extern u32 omap2_pwrdm_get_mem_bank_onstate_mask(u8 bank);
+extern u32 omap2_pwrdm_get_mem_bank_retst_mask(u8 bank);
+extern u32 omap2_pwrdm_get_mem_bank_stst_mask(u8 bank);
+
+extern struct powerdomain wkup_omap2_pwrdm;
+extern struct powerdomain gfx_omap2_pwrdm;
+
+
 #endif
arch/arm/mach-omap2/powerdomain2xxx_3xxx.c +1 -1
index b5e9e4d..d523389 100644
@@ -18,8 +18,8 @@
 
 #include <plat/prcm.h>
 
+#include "powerdomain.h"
 #include "prm-regbits-34xx.h"
-#include "powerdomains.h"
 #include "prm.h"
 #include "prm-regbits-24xx.h"
 #include "prm-regbits-34xx.h"
arch/arm/mach-omap2/powerdomain44xx.c +1 -2
index 28bf5e3..a7880af 100644
@@ -16,13 +16,12 @@
 #include <linux/errno.h>
 #include <linux/delay.h>
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include <plat/prcm.h>
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
 #include "prminst44xx.h"
 #include "prm-regbits-44xx.h"
-#include "powerdomains.h"
 
 static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
 {
arch/arm/mach-omap2/powerdomains.h deleted +0 -30
deleted file mode 100644
index f83adaf..0000000
@@ -1,30 +0,0 @@
-/*
- * OMAP2+ powerdomain prototypes
- *
- * Copyright (C) 2010 Texas Instruments, Inc.
- *
- * Rajendra Nayak <[email protected]>
- *
- * 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_H
-#define ARCH_ARM_MACH_OMAP2_POWERDOMAINS_H
-
-#include <plat/powerdomain.h>
-
-extern struct pwrdm_ops omap2_pwrdm_operations;
-extern struct pwrdm_ops omap3_pwrdm_operations;
-extern struct pwrdm_ops omap4_pwrdm_operations;
-
-/* Common Internal functions used across OMAP rev's */
-extern u32 omap2_pwrdm_get_mem_bank_onstate_mask(u8 bank);
-extern u32 omap2_pwrdm_get_mem_bank_retst_mask(u8 bank);
-extern u32 omap2_pwrdm_get_mem_bank_stst_mask(u8 bank);
-
-extern struct powerdomain wkup_omap2_pwrdm;
-extern struct powerdomain gfx_omap2_pwrdm;
-
-#endif
arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c +1 -3
index 14c6ef7..5b4dd97 100644
@@ -45,13 +45,11 @@
  * address offset is different between the C55 and C64 DSPs.
  */
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 
 #include "prcm-common.h"
 #include "prm.h"
 
-#include "powerdomains.h"
-
 /* OMAP2/3-common powerdomains */
 
 /*
arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.h +1 -1
index 45d684a..fa31166 100644
@@ -14,7 +14,7 @@
 #ifndef __ARCH_ARM_MACH_OMAP2_POWERDOMAINS2XXX_3XXX_DATA_H
 #define __ARCH_ARM_MACH_OMAP2_POWERDOMAINS2XXX_3XXX_DATA_H
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 
 extern struct powerdomain gfx_omap2_pwrdm;
 extern struct powerdomain wkup_omap2_pwrdm;
arch/arm/mach-omap2/powerdomains2xxx_data.c +1 -2
index e136895..9b1a335 100644
@@ -14,9 +14,8 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "powerdomains2xxx_3xxx_data.h"
-#include "powerdomains.h"
 
 #include "prcm-common.h"
 #include "prm2xxx_3xxx.h"
arch/arm/mach-omap2/powerdomains3xxx_data.c +1 -2
index f383784..7e712b0 100644
@@ -14,9 +14,8 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "powerdomains2xxx_3xxx_data.h"
-#include "powerdomains.h"
 
 #include "prcm-common.h"
 #include "prm2xxx_3xxx.h"
arch/arm/mach-omap2/powerdomains44xx_data.c +1 -2
index 823f477..5fdf485 100644
@@ -22,8 +22,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 
-#include <plat/powerdomain.h>
-#include "powerdomains.h"
+#include "powerdomain.h"
 
 #include "prcm-common.h"
 #include "prcm44xx.h"
arch/arm/plat-omap/gpio.c +2 -3
index c05c653..fa6d18d 100644
@@ -27,7 +27,6 @@
 #include <mach/irqs.h>
 #include <mach/gpio.h>
 #include <asm/mach/irq.h>
-#include <plat/powerdomain.h>
 
 /*
  * OMAP1510 GPIO registers
@@ -2074,7 +2073,7 @@ static struct sys_device omap_gpio_device = {
 
 static int workaround_enabled;
 
-void omap2_gpio_prepare_for_idle(int power_state)
+void omap2_gpio_prepare_for_idle(int off_mode)
 {
 	int i, c = 0;
 	int min = 0;
@@ -2090,7 +2089,7 @@ void omap2_gpio_prepare_for_idle(int power_state)
 		for (j = 0; j < hweight_long(bank->dbck_enable_mask); j++)
 			clk_disable(bank->dbck);
 
-		if (power_state > PWRDM_POWER_OFF)
+		if (!off_mode)
 			continue;
 
 		/* If going to OFF, remove triggering for all
arch/arm/plat-omap/include/plat/gpio.h +1 -1
index de1c604..d5634c5 100644
@@ -72,7 +72,7 @@
 				 IH_GPIO_BASE + (nr))
 
 extern int omap_gpio_init(void);	/* Call from board init only */
-extern void omap2_gpio_prepare_for_idle(int power_state);
+extern void omap2_gpio_prepare_for_idle(int off_mode);
 extern void omap2_gpio_resume_after_idle(void);
 extern void omap_set_gpio_debounce(int gpio, int enable);
 extern void omap_set_gpio_debounce_time(int gpio, int enable);
arch/arm/plat-omap/include/plat/omap-pm.h +0 -2
index 728fbb9..639bf91 100644
@@ -18,8 +18,6 @@
 #include <linux/cpufreq.h>
 #include <linux/clk.h>
 
-#include "powerdomain.h"
-
 /**
  * struct omap_opp - clock frequency-to-OPP ID table for DSP, MPU
  * @rate: target clock rate
arch/arm/plat-omap/omap-pm-noop.c +0 -2
index e129ce8..81b4ac1 100644
@@ -24,8 +24,6 @@
 /* Interface documentation is in mach/omap-pm.h */
 #include <plat/omap-pm.h>
 
-#include <plat/powerdomain.h>
-
 struct omap_opp *dsp_opps;
 struct omap_opp *mpu_opps;
 struct omap_opp *l3_opps;
author maintainer
#27 lore raw

PATCH 10/11 OMAP2+: powerdomain: move header file from plat-omap to mach-omap2

Quoted 11 lines · Paul Walmsley

The OMAP powerdomain code and data is all OMAP2+-specific. This seems unlikely to change any time soon. Move plat-omap/include/plat/powerdomain.h to mach-omap2/powerdomain.h. The primary point of doing this is to remove the temptation for unrelated upper-layer code to access powerdomain code and data directly.

As part of this process, remove the references to powerdomain data from the GPIO "driver" and the OMAP PM no-op layer, both in plat-omap.

This patch has been updated to get DSPBridge building again. The DSPBridge should not be touching the powerdomain headers; this is just a temporary workaround until the DSPBridge people fix the code.

- Paul

From: Paul Walmsley <[email protected]>
Date: Tue, 14 Dec 2010 13:03:49 -0700
Subject: [PATCH] OMAP2+: powerdomain: move header file from plat-omap to mach-omap2

The OMAP powerdomain code and data is all OMAP2+-specific. This seems unlikely to change any time soon. Move plat-omap/include/plat/powerdomain.h to mach-omap2/powerdomain.h. The primary point of doing this is to remove the temptation for unrelated upper-layer code to access powerdomain code and data directly.

As part of this process, remove the references to powerdomain data from the GPIO "driver" and the OMAP PM no-op layer, both in plat-omap. Change the DSPBridge code to point to the new location for the powerdomain headers. The DSPBridge code should not be including the powerdomain headers; these should be removed.

Cc Kevin Hilman <[email protected]>
Cc Omar Ramirez Luna <[email protected]>
Cc Felipe Contreras <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 arch/arm/mach-omap2/clockdomain.c                  |    2 +-
 arch/arm/mach-omap2/clockdomain.h                  |    2 +-
 arch/arm/mach-omap2/cpuidle34xx.c                  |    2 +-
 arch/arm/mach-omap2/io.c                           |    2 +-
 arch/arm/mach-omap2/omap_hwmod.c                   |    2 +-
 arch/arm/mach-omap2/pm-debug.c                     |    2 +-
 arch/arm/mach-omap2/pm.c                           |    2 +-
 arch/arm/mach-omap2/pm.h                           |    2 +-
 arch/arm/mach-omap2/pm24xx.c                       |    4 +-
 arch/arm/mach-omap2/pm34xx.c                       |    6 ++-
 arch/arm/mach-omap2/pm44xx.c                       |    2 +-
 arch/arm/mach-omap2/powerdomain-common.c           |    1 -
 arch/arm/mach-omap2/powerdomain.c                  |    2 +-
 .../include/plat => mach-omap2}/powerdomain.h      |   23 ++++++++++++---
 arch/arm/mach-omap2/powerdomain2xxx_3xxx.c         |    2 +-
 arch/arm/mach-omap2/powerdomain44xx.c              |    3 +-
 arch/arm/mach-omap2/powerdomains.h                 |   30 --------------------
 arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c   |    4 +--
 arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.h   |    2 +-
 arch/arm/mach-omap2/powerdomains2xxx_data.c        |    3 +-
 arch/arm/mach-omap2/powerdomains3xxx_data.c        |    3 +-
 arch/arm/mach-omap2/powerdomains44xx_data.c        |    3 +-
 arch/arm/plat-omap/gpio.c                          |    5 +--
 arch/arm/plat-omap/include/plat/gpio.h             |    2 +-
 arch/arm/plat-omap/include/plat/omap-pm.h          |    2 -
 arch/arm/plat-omap/omap-pm-noop.c                  |    2 -
 26 files changed, 44 insertions(+), 71 deletions(-)
 rename arch/arm/{plat-omap/include/plat => mach-omap2}/powerdomain.h (92%)
 delete mode 100644 arch/arm/mach-omap2/powerdomains.h
arch/arm/mach-omap2/clockdomain.c +1 -1
index 650bf68..e20b986 100644
@@ -34,7 +34,7 @@
 #include "prcm44xx.h"
 
 #include <plat/clock.h>
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "clockdomain.h"
 #include <plat/prcm.h>
 
arch/arm/mach-omap2/clockdomain.h +1 -1
index 372c646..de3faa2 100644
@@ -18,7 +18,7 @@
 
 #include <linux/init.h>
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include <plat/clock.h>
 #include <plat/cpu.h>
 
arch/arm/mach-omap2/cpuidle34xx.c +1 -1
index 568dff7..81b0a90 100644
@@ -27,7 +27,7 @@
 
 #include <plat/prcm.h>
 #include <plat/irqs.h>
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "clockdomain.h"
 #include <plat/serial.h>
 
arch/arm/mach-omap2/io.c +1 -1
index ab2d1ed..9ccb239 100644
@@ -39,7 +39,7 @@
 #include "io.h"
 
 #include <plat/omap-pm.h>
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 
 #include "clockdomain.h"
 #include <plat/omap_hwmod.h>
arch/arm/mach-omap2/omap_hwmod.c +1 -1
index e1358ba..12856eb 100644
@@ -140,7 +140,7 @@
 #include <plat/common.h>
 #include <plat/cpu.h>
 #include "clockdomain.h"
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include <plat/clock.h>
 #include <plat/omap_hwmod.h>
 #include <plat/prcm.h>
arch/arm/mach-omap2/pm-debug.c +1 -1
index 3fc7707..ed892ae 100644
@@ -29,7 +29,7 @@
 
 #include <plat/clock.h>
 #include <plat/board.h>
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "clockdomain.h"
 #include <plat/dmtimer.h>
 
arch/arm/mach-omap2/pm.c +1 -1
index 60cfe67..cf1c4c9 100644
@@ -18,7 +18,7 @@
 #include <plat/omap_device.h>
 #include <plat/common.h>
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "clockdomain.h"
 
 static struct omap_device_pm_latency *pm_lats;
arch/arm/mach-omap2/pm.h +1 -1
index 0d75bfd..642e519 100644
@@ -11,7 +11,7 @@
 #ifndef __ARCH_ARM_MACH_OMAP2_PM_H
 #define __ARCH_ARM_MACH_OMAP2_PM_H
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 
 extern void *omap3_secure_ram_storage;
 extern void omap3_pm_off_mode_enable(int);
arch/arm/mach-omap2/pm24xx.c +2 -2
index 7d4933b..0413314 100644
@@ -50,7 +50,7 @@
 #include "pm.h"
 #include "control.h"
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "clockdomain.h"
 
 static void (*omap2_sram_idle)(void);
@@ -107,7 +107,7 @@ static void omap2_enter_full_retention(void)
 	l = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0) | OMAP24XX_USBSTANDBYCTRL;
 	omap_ctrl_writel(l, OMAP2_CONTROL_DEVCONF0);
 
-	omap2_gpio_prepare_for_idle(PWRDM_POWER_RET);
+	omap2_gpio_prepare_for_idle(0);
 
 	if (omap2_pm_debug) {
 		omap2_pm_dump(0, 0, 0);
arch/arm/mach-omap2/pm34xx.c +4 -2
index 43c1a43..e804a9f 100644
@@ -32,7 +32,7 @@
 
 #include <plat/sram.h>
 #include "clockdomain.h"
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include <plat/serial.h>
 #include <plat/sdrc.h>
 #include <plat/prcm.h>
@@ -344,6 +344,7 @@ void omap_sram_idle(void)
 	int mpu_next_state = PWRDM_POWER_ON;
 	int per_next_state = PWRDM_POWER_ON;
 	int core_next_state = PWRDM_POWER_ON;
+	int per_going_off;
 	int core_prev_state, per_prev_state;
 	u32 sdrc_pwr = 0;
 
@@ -394,9 +395,10 @@ void omap_sram_idle(void)
 
 	/* PER */
 	if (per_next_state < PWRDM_POWER_ON) {
+		per_going_off = (per_next_state == PWRDM_POWER_OFF) ? 1 : 0;
 		omap_uart_prepare_idle(2);
 		omap_uart_prepare_idle(3);
-		omap2_gpio_prepare_for_idle(per_next_state);
+		omap2_gpio_prepare_for_idle(per_going_off);
 		if (per_next_state == PWRDM_POWER_OFF)
 				omap3_per_save_context();
 	}
arch/arm/mach-omap2/pm44xx.c +1 -1
index 54544b4..32d02cb 100644
@@ -16,7 +16,7 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include <mach/omap4-common.h>
 
 struct power_state {
arch/arm/mach-omap2/powerdomain-common.c +0 -1
index cb01c7a..171fccd 100644
@@ -20,7 +20,6 @@
 #include "cm-regbits-44xx.h"
 #include "prm-regbits-34xx.h"
 #include "prm-regbits-44xx.h"
-#include "powerdomains.h"
 
 /*
  * OMAP3 and OMAP4 specific register bit initialisations
arch/arm/mach-omap2/powerdomain.c +1 -1
index 7eb7ba4..06ef60ee 100644
@@ -26,7 +26,7 @@
 #include "prm44xx.h"
 
 #include <plat/cpu.h>
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "clockdomain.h"
 #include <plat/prcm.h>
 
arch/arm/mach-omap2/powerdomain.h renamed from arch/arm/plat-omap/include/plat/powerdomain.h +18 -5
similarity index 92%
rename from arch/arm/plat-omap/include/plat/powerdomain.h
rename to arch/arm/mach-omap2/powerdomain.h
index a0d3a30..35b5b48 100644
@@ -1,10 +1,10 @@
 /*
  * OMAP2/3/4 powerdomain control
  *
- * Copyright (C) 2007-2008 Texas Instruments, Inc.
+ * Copyright (C) 2007-2008, 2010 Texas Instruments, Inc.
  * Copyright (C) 2007-2010 Nokia Corporation
  *
- * Written by Paul Walmsley
+ * Paul Walmsley
  *
  * 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
@@ -14,13 +14,13 @@
  * opportunity.
  */
 
-#ifndef ASM_ARM_PLAT_OMAP_INCLUDE_PLAT_POWERDOMAIN
-#define ASM_ARM_PLAT_OMAP_INCLUDE_PLAT_POWERDOMAIN
+#ifndef __ARCH_ARM_MACH_OMAP2_POWERDOMAIN_H
+#define __ARCH_ARM_MACH_OMAP2_POWERDOMAIN_H
 
 #include <linux/types.h>
 #include <linux/list.h>
 
-#include <asm/atomic.h>
+#include <linux/atomic.h>
 
 #include <plat/cpu.h>
 
@@ -216,4 +216,17 @@ extern void omap2xxx_powerdomains_init(void);
 extern void omap3xxx_powerdomains_init(void);
 extern void omap44xx_powerdomains_init(void);
 
+extern struct pwrdm_ops omap2_pwrdm_operations;
+extern struct pwrdm_ops omap3_pwrdm_operations;
+extern struct pwrdm_ops omap4_pwrdm_operations;
+
+/* Common Internal functions used across OMAP rev's */
+extern u32 omap2_pwrdm_get_mem_bank_onstate_mask(u8 bank);
+extern u32 omap2_pwrdm_get_mem_bank_retst_mask(u8 bank);
+extern u32 omap2_pwrdm_get_mem_bank_stst_mask(u8 bank);
+
+extern struct powerdomain wkup_omap2_pwrdm;
+extern struct powerdomain gfx_omap2_pwrdm;
+
+
 #endif
arch/arm/mach-omap2/powerdomain2xxx_3xxx.c +1 -1
index b5e9e4d..d523389 100644
@@ -18,8 +18,8 @@
 
 #include <plat/prcm.h>
 
+#include "powerdomain.h"
 #include "prm-regbits-34xx.h"
-#include "powerdomains.h"
 #include "prm.h"
 #include "prm-regbits-24xx.h"
 #include "prm-regbits-34xx.h"
arch/arm/mach-omap2/powerdomain44xx.c +1 -2
index 28bf5e3..a7880af 100644
@@ -16,13 +16,12 @@
 #include <linux/errno.h>
 #include <linux/delay.h>
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include <plat/prcm.h>
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
 #include "prminst44xx.h"
 #include "prm-regbits-44xx.h"
-#include "powerdomains.h"
 
 static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
 {
arch/arm/mach-omap2/powerdomains.h deleted +0 -30
deleted file mode 100644
index f83adaf..0000000
@@ -1,30 +0,0 @@
-/*
- * OMAP2+ powerdomain prototypes
- *
- * Copyright (C) 2010 Texas Instruments, Inc.
- *
- * Rajendra Nayak <[email protected]>
- *
- * 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_H
-#define ARCH_ARM_MACH_OMAP2_POWERDOMAINS_H
-
-#include <plat/powerdomain.h>
-
-extern struct pwrdm_ops omap2_pwrdm_operations;
-extern struct pwrdm_ops omap3_pwrdm_operations;
-extern struct pwrdm_ops omap4_pwrdm_operations;
-
-/* Common Internal functions used across OMAP rev's */
-extern u32 omap2_pwrdm_get_mem_bank_onstate_mask(u8 bank);
-extern u32 omap2_pwrdm_get_mem_bank_retst_mask(u8 bank);
-extern u32 omap2_pwrdm_get_mem_bank_stst_mask(u8 bank);
-
-extern struct powerdomain wkup_omap2_pwrdm;
-extern struct powerdomain gfx_omap2_pwrdm;
-
-#endif
arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c +1 -3
index 14c6ef7..5b4dd97 100644
@@ -45,13 +45,11 @@
  * address offset is different between the C55 and C64 DSPs.
  */
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 
 #include "prcm-common.h"
 #include "prm.h"
 
-#include "powerdomains.h"
-
 /* OMAP2/3-common powerdomains */
 
 /*
arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.h +1 -1
index 45d684a..fa31166 100644
@@ -14,7 +14,7 @@
 #ifndef __ARCH_ARM_MACH_OMAP2_POWERDOMAINS2XXX_3XXX_DATA_H
 #define __ARCH_ARM_MACH_OMAP2_POWERDOMAINS2XXX_3XXX_DATA_H
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 
 extern struct powerdomain gfx_omap2_pwrdm;
 extern struct powerdomain wkup_omap2_pwrdm;
arch/arm/mach-omap2/powerdomains2xxx_data.c +1 -2
index e136895..9b1a335 100644
@@ -14,9 +14,8 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "powerdomains2xxx_3xxx_data.h"
-#include "powerdomains.h"
 
 #include "prcm-common.h"
 #include "prm2xxx_3xxx.h"
arch/arm/mach-omap2/powerdomains3xxx_data.c +1 -2
index f383784..7e712b0 100644
@@ -14,9 +14,8 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 
-#include <plat/powerdomain.h>
+#include "powerdomain.h"
 #include "powerdomains2xxx_3xxx_data.h"
-#include "powerdomains.h"
 
 #include "prcm-common.h"
 #include "prm2xxx_3xxx.h"
arch/arm/mach-omap2/powerdomains44xx_data.c +1 -2
index 823f477..5fdf485 100644
@@ -22,8 +22,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 
-#include <plat/powerdomain.h>
-#include "powerdomains.h"
+#include "powerdomain.h"
 
 #include "prcm-common.h"
 #include "prcm44xx.h"
arch/arm/plat-omap/gpio.c +2 -3
index 8d493b9..1f98e0b 100644
@@ -29,7 +29,6 @@
 #include <mach/irqs.h>
 #include <mach/gpio.h>
 #include <asm/mach/irq.h>
-#include <plat/powerdomain.h>
 
 /*
  * OMAP1510 GPIO registers
@@ -1864,7 +1863,7 @@ static struct sys_device omap_gpio_device = {
 
 static int workaround_enabled;
 
-void omap2_gpio_prepare_for_idle(int power_state)
+void omap2_gpio_prepare_for_idle(int off_mode)
 {
 	int i, c = 0;
 	int min = 0;
@@ -1880,7 +1879,7 @@ void omap2_gpio_prepare_for_idle(int power_state)
 		for (j = 0; j < hweight_long(bank->dbck_enable_mask); j++)
 			clk_disable(bank->dbck);
 
-		if (power_state > PWRDM_POWER_OFF)
+		if (!off_mode)
 			continue;
 
 		/* If going to OFF, remove triggering for all
arch/arm/plat-omap/include/plat/gpio.h +1 -1
index 41ff2f8..d6f9fa0 100644
@@ -82,7 +82,7 @@ struct omap_gpio_platform_data {
 /* TODO: Analyze removing gpio_bank_count usage from driver code */
 extern int gpio_bank_count;
 
-extern void omap2_gpio_prepare_for_idle(int power_state);
+extern void omap2_gpio_prepare_for_idle(int off_mode);
 extern void omap2_gpio_resume_after_idle(void);
 extern void omap_set_gpio_debounce(int gpio, int enable);
 extern void omap_set_gpio_debounce_time(int gpio, int enable);
arch/arm/plat-omap/include/plat/omap-pm.h +0 -2
index 728fbb9..639bf91 100644
@@ -18,8 +18,6 @@
 #include <linux/cpufreq.h>
 #include <linux/clk.h>
 
-#include "powerdomain.h"
-
 /**
  * struct omap_opp - clock frequency-to-OPP ID table for DSP, MPU
  * @rate: target clock rate
arch/arm/plat-omap/omap-pm-noop.c +0 -2
index e129ce8..81b4ac1 100644
@@ -24,8 +24,6 @@
 /* Interface documentation is in mach/omap-pm.h */
 #include <plat/omap-pm.h>
 
-#include <plat/powerdomain.h>
-
 struct omap_opp *dsp_opps;
 struct omap_opp *mpu_opps;
 struct omap_opp *l3_opps;
Signature · 1 line
1.7.2.3
author maintainer
#28 lore raw

PATCH 10/11 OMAP2+: powerdomain: move header file from plat-omap to mach-omap2

Quoted 11 lines · Paul Walmsley
Quoted 9 lines · Paul Walmsley

The OMAP powerdomain code and data is all OMAP2+-specific. This seems unlikely to change any time soon. Move plat-omap/include/plat/powerdomain.h to mach-omap2/powerdomain.h. The primary point of doing this is to remove the temptation for unrelated upper-layer code to access powerdomain code and data directly.

As part of this process, remove the references to powerdomain data from the GPIO "driver" and the OMAP PM no-op layer, both in plat-omap.

Quoted 6 lines
Quoted 2 lines

This patch has been updated to get DSPBridge building again. The DSPBridge should not be touching the powerdomain headers; this is just a temporary workaround until the DSPBridge people fix the code.

An old version of this patch was inadvertently sent. The crucial diff (for review purposes anyway) from the previous patch is below. Nothing earthshattering.

The updated integration tag that contains all of these updated changes is 'integration-2.6.38-20101214-013' available from
git://git.pwsan.com/linux-integration

- Paul

drivers/staging/tidspbridge/core/_tiomap.h +1 -1
index a3190e7..1159a50 100644
@@ -24,7 +24,7 @@
  * be removed.  No driver should call pwrdm_* or clkdm_* functions
  * directly; they should rely on OMAP core code to do this.
  */
-#include <plat/powerdomain.h>
+#include <mach-omap2/powerdomain.h>
 #include <mach-omap2/clockdomain.h>
 /*
  * XXX These mach-omap2/ includes are wrong and should be removed.  No
author maintainer
#29 lore raw

PATCH 11/11 OMAP3: control/PM: move padconf save code to mach-omap2/control.c

In reply to Paul Walmsley

Move the padconf save code from pm34xx.c to the System Control Module code in mach-omap2/control.c. This is part of the general push to move direct register access from middle-layer core code to low-level core code, so the middle-layer code can be abstracted to work on multiple platforms and cleaned up.

In the medium-to-long term, this code should be called by the mux layer code, not the PM idle code. This is because, according to the TRM, saving the padconf only needs to be done when the padconf changes[1].

Cc Kevin Hilman <[email protected]>
Cc Tony Lindgren <[email protected]>

1. OMAP34xx Multimedia Device Silicon Revision 3.1.x [Rev. ZH] [SWPU222H] Section 4.11.4 "Device Off-Mode Sequences"

---
 arch/arm/mach-omap2/control.c          |   32 ++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/control.h          |    1 +
 arch/arm/mach-omap2/pm34xx.c           |   11 +----------
 arch/arm/plat-omap/include/plat/prcm.h |    3 ---
 4 files changed, 34 insertions(+), 13 deletions(-)
arch/arm/mach-omap2/control.c +32 -0
index 16bde76..891df18 100644
@@ -26,6 +26,10 @@
 #include "pm.h"
 #include "control.h"
 
+/* Used by omap3_ctrl_save_padconf() */
+#define START_PADCONF_SAVE		0x2
+#define PADCONF_SAVE_DONE		0x1
+
 static void __iomem *omap2_ctrl_base;
 static void __iomem *omap4_ctrl_pad_base;
 
@@ -512,4 +516,32 @@ void omap3_control_restore_context(void)
 			 OMAP343X_CONTROL_PADCONF_SYSNIRQ);
 	return;
 }
+
+/**
+ * omap3_ctrl_save_padconf - save padconf registers to scratchpad RAM
+ *
+ * Tell the SCM to start saving the padconf registers, then wait for
+ * the process to complete.  Returns 0 unconditionally, although it
+ * should also eventually be able to return -ETIMEDOUT, if the save
+ * does not complete.
+ *
+ * XXX This function is missing a timeout.  What should it be?
+ */
+int omap3_ctrl_save_padconf(void)
+{
+	u32 cpo;
+
+	/* Save the padconf registers */
+	cpo = omap_ctrl_readl(OMAP343X_CONTROL_PADCONF_OFF);
+	cpo |= START_PADCONF_SAVE;
+	omap_ctrl_writel(cpo, OMAP343X_CONTROL_PADCONF_OFF);
+
+	/* wait for the save to complete */
+	while (!(omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS)
+		 & PADCONF_SAVE_DONE))
+		udelay(1);
+
+	return 0;
+}
+
 #endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */
arch/arm/mach-omap2/control.h +1 -0
index a9325ad..5289461 100644
@@ -351,6 +351,7 @@ extern u32 omap3_arm_context[128];
 extern void omap3_control_save_context(void);
 extern void omap3_control_restore_context(void);
 extern void omap3_ctrl_write_boot_mode(u8 bootmode);
+extern int omap3_ctrl_save_padconf(void);
 
 #else
 #define omap_ctrl_base_get()		0
arch/arm/mach-omap2/pm34xx.c +1 -10
index e804a9f..be755a6 100644
@@ -117,16 +117,7 @@ static void omap3_disable_io_chain(void)
 
 static void omap3_core_save_context(void)
 {
-	u32 control_padconf_off;
-
-	/* Save the padconf registers */
-	control_padconf_off = omap_ctrl_readl(OMAP343X_CONTROL_PADCONF_OFF);
-	control_padconf_off |= START_PADCONF_SAVE;
-	omap_ctrl_writel(control_padconf_off, OMAP343X_CONTROL_PADCONF_OFF);
-	/* wait for the save to complete */
-	while (!(omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS)
-			& PADCONF_SAVE_DONE))
-		udelay(1);
+	omap3_ctrl_save_padconf();
 
 	/*
 	 * Force write last pad into memory, as this can fail in some
arch/arm/plat-omap/include/plat/prcm.h +0 -3
index 078906d..2fdf8c8 100644
@@ -32,9 +32,6 @@ void omap_prcm_arch_reset(char mode, const char *cmd);
 int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
 			 const char *name);
 
-#define START_PADCONF_SAVE 0x2
-#define PADCONF_SAVE_DONE  0x1
-
 #endif
 
 
#30 lore raw

cover OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38, part two

In reply to Paul Walmsley
Quoted 5 lines · On Tue, 07 Dec 2010 23:18:28 -0700 Paul Walmsley <[email protected]> wrote:

This series is available via git from git://git.pwsan.com/linux-2.6 in the branch 'pwrdm_prcm_b_2.6.38'. It applies on top of the "OMAP:
PRCM/powerdomain/clockdomain patches for 2.6.38, part one" series, sent earlier.

Quoted 8 lines

Kevin and OMAP ASoC-hackers, I'd appreciate review and acks, if appropriate, on the patches that touch code that you maintain. TI OMAP4 PM people, I would appreciate any testing assistance that you may be able to provide. Benoît, I've tried to keep the kernel data files and the output of the scripts relatively similar, but we might need to do some tweaking of the scripts or data files to align them in the way that makes the most sense.

Is there some patch missing? Part one compiles but this set does not.

CC arch/arm/mach-omap2/clockdomain.o
arch/arm/mach-omap2/clockdomain.c:33: fatal error: cminst44xx.h: No such file or directory compilation terminated.
make[1]: *** [arch/arm/mach-omap2/clockdomain.o] Error 1
make: *** [arch/arm/mach-omap2] Error 2

Signature · 5 lines
Jarkko
--
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
#31 lore raw

cover OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38, part two

Hello Jarkko

Quoted 16 lines · Jarkko Nikula
Quoted 5 lines · On Tue, 07 Dec 2010 23:18:28 -0700 Paul Walmsley <[email protected]> wrote:

This series is available via git from git://git.pwsan.com/linux-2.6 in the branch 'pwrdm_prcm_b_2.6.38'. It applies on top of the "OMAP:
PRCM/powerdomain/clockdomain patches for 2.6.38, part one" series, sent earlier.

Quoted 8 lines

Kevin and OMAP ASoC-hackers, I'd appreciate review and acks, if appropriate, on the patches that touch code that you maintain. TI OMAP4 PM people, I would appreciate any testing assistance that you may be able to provide. Beno?t, I've tried to keep the kernel data files and the output of the scripts relatively similar, but we might need to do some tweaking of the scripts or data files to align them in the way that makes the most sense.

Quoted 1 line

Is there some patch missing? Part one compiles but this set does not.

Yes, mach-omap2/cminst44xx.h is missing from the posted series. It's been added to the branch on the git server and posted here:

http://www.spinics.net/lists/arm-kernel/msg106850.html

Will repost the updated series after handling some of the other comments.

- Paul

#32 lore raw

cover OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38,part two

In reply to Paul Walmsley
Quoted 5 lines

-----Original Message-----
From: Paul Walmsley [mailto:paul at pwsan.com]
Sent: Wednesday, December 08, 2010 11:48 AM
To: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
Cc: Mark Brown; Beno?t Cousson; Kevin Hilman; Rajendra Nayak; Peter

Ujfalusi; Santosh Shilimkar; Jarkko Nikula; Liam

Quoted 2 lines

Girdwood
Subject: [PATCH 00/11] OMAP: PRCM/powerdomain/clockdomain patches for

2.6.38,part two

Quoted 10 lines

This patch series, intended for 2.6.38:

- adds OMAP4-specific PRM and CM instance functions, which are capable of writing to PRM/CM instances, no matter what PRCM partition they appear in;

- renames the old OMAP2/3 PRM and CM functions to prefix them with 'omap2_';

Quoted 6 lines

- adds OMAP4 clockdomain offset addressing to the OMAP4 clockdomain definitions;

- removes the (now unused) OMAP clockdomain .clkstctrl_reg field;

- moves plat-omap/include/plat/{clock,power}domain.h to mach-omap2/,

since

Quoted 3 lines

these are OMAP2-specific;

- moves the OMAP3 SCM padconf save code from pm34xx.c into the SCM

common

Quoted 15 lines

code.

This series is available via git from git://git.pwsan.com/linux-2.6 in the branch 'pwrdm_prcm_b_2.6.38'. It applies on top of the "OMAP:
PRCM/powerdomain/clockdomain patches for 2.6.38, part one" series, sent earlier.

Kevin and OMAP ASoC-hackers, I'd appreciate review and acks, if appropriate, on the patches that touch code that you maintain. TI OMAP4 PM people, I would appreciate any testing assistance that you may be able to provide. Beno?t, I've tried to keep the kernel data files and the output of the scripts relatively similar, but we might need to do some tweaking of the scripts or data files to align them in the way that makes the most sense.

Quoted 1 line

Boot-tested on N800, OMAP35xx Beagle, and OMAP4430ES2 Panda.

Boot tested on 2430/3430/4430SDP. Tested RET/OFF mode in suspend on 3430SDP with minimal config (omap3_pm_defconfig).

Quoted 6 lines

- Paul

---

Quoted 8 lines

pwrdm_prcm_b_2.6.38
text data bss dec hex filename
5709988 473952 5608800 11792740 b3f164 vmlinux.orig
5712868 474496 5608800 11796164 b3fec4 vmlinux.patched

Paul Walmsley (11):
OMAP4: PRCM: add OMAP4-specific accessor/mutator functions
OMAP4: PRCM: move global reset function for OMAP4 to an

OMAP4-specific file

Quoted 2 lines

OMAP2/3: PRM/CM: prefix OMAP2 PRM/CM functions with "omap2_"
OMAP4: powerdomains: add PRCM partition data; use OMAP4 PRM

functions

Quoted 1 line

OMAP2+: clockdomains: split the clkdm hwsup enable/disable

function

Quoted 3 lines

OMAP4: CM instances: add clockdomain register offsets
OMAP4: clockdomains: add OMAP4 PRCM data and OMAP4 support OMAP2/3: clockdomain: remove unneeded .clkstctrl_reg, remove some

direct CM register accesses

Quoted 5 lines

OMAP2+: clockdomain: move header file from plat-omap to mach-omap2 OMAP2+: powerdomain: move header file from plat-omap to mach-omap2
OMAP3: control/PM: move padconf save code to mach-omap2/control.c

Quoted 14 lines
 arch/arm/mach-omap2/Makefile                     |    4
 arch/arm/mach-omap2/clkt2xxx_apll.c              |   10 -
 arch/arm/mach-omap2/clkt2xxx_dpllcore.c          |    8
 arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c     |   12 -
 arch/arm/mach-omap2/clock.c                      |    2
 arch/arm/mach-omap2/clockdomain.c                |  209 ++++++-----
 arch/arm/mach-omap2/clockdomain.h                |   33 +-
 arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c |   42 --
 arch/arm/mach-omap2/clockdomains44xx_data.c      |  123 ++++--
 arch/arm/mach-omap2/cm-regbits-24xx.h            |    5
 arch/arm/mach-omap2/cm-regbits-34xx.h            |   11 +
 arch/arm/mach-omap2/cm1_44xx.h                   |   10 +
 arch/arm/mach-omap2/cm2_44xx.h                   |   25 +
 arch/arm/mach-omap2/cm2xxx_3xxx.c                |  420

+++++++++++++---------

Quoted 38 lines
 arch/arm/mach-omap2/cm2xxx_3xxx.h                |   19 +
 arch/arm/mach-omap2/cm44xx.c                     |   52 +++
 arch/arm/mach-omap2/cm4xxx.c                     |   62 ---
 arch/arm/mach-omap2/cminst44xx.c                 |  223 ++++++++++++
 arch/arm/mach-omap2/control.c                    |   72 +++-
 arch/arm/mach-omap2/control.h                    |    1
 arch/arm/mach-omap2/cpuidle34xx.c                |    4
 arch/arm/mach-omap2/io.c                         |    4
 arch/arm/mach-omap2/omap_hwmod.c                 |    4
 arch/arm/mach-omap2/pm-debug.c                   |   12 -
 arch/arm/mach-omap2/pm.c                         |    4
 arch/arm/mach-omap2/pm.h                         |    2
 arch/arm/mach-omap2/pm24xx.c                     |  200 +++++-----
 arch/arm/mach-omap2/pm34xx.c                     |  162 ++++----
 arch/arm/mach-omap2/pm44xx.c                     |    2
 arch/arm/mach-omap2/powerdomain-common.c         |    1
 arch/arm/mach-omap2/powerdomain.c                |   14 +
 arch/arm/mach-omap2/powerdomain.h                |   30 +-
 arch/arm/mach-omap2/powerdomain2xxx_3xxx.c       |   68 ++--
 arch/arm/mach-omap2/powerdomain44xx.c            |  122 ++++--
 arch/arm/mach-omap2/powerdomains.h               |   30 --
 arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c |    4
 arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.h |    2
 arch/arm/mach-omap2/powerdomains2xxx_data.c      |    3
 arch/arm/mach-omap2/powerdomains3xxx_data.c      |    3
 arch/arm/mach-omap2/powerdomains44xx_data.c      |   20 +
 arch/arm/mach-omap2/prcm.c                       |   51 +--
 arch/arm/mach-omap2/prcm44xx.h                   |   42 ++
 arch/arm/mach-omap2/prcm_mpu44xx.c               |   45 ++
 arch/arm/mach-omap2/prcm_mpu44xx.h               |   13 +
 arch/arm/mach-omap2/prm2xxx_3xxx.c               |   34 +-
 arch/arm/mach-omap2/prm2xxx_3xxx.h               |   12 -
 arch/arm/mach-omap2/prm44xx.c                    |   79 ++++
 arch/arm/mach-omap2/prm44xx.h                    |   23 +
 arch/arm/mach-omap2/prminst44xx.c                |   74 ++++
 arch/arm/mach-omap2/prminst44xx.h                |   25 +
 arch/arm/mach-omap2/sdrc2xxx.c                   |    4
 arch/arm/mach-omap2/serial.c                     |    1
Quoted 8 lines
 arch/arm/plat-omap/gpio.c                        |    5
 arch/arm/plat-omap/include/plat/gpio.h           |    2
 arch/arm/plat-omap/include/plat/omap-pm.h        |    2
 arch/arm/plat-omap/include/plat/prcm.h           |   10 -
 arch/arm/plat-omap/mcbsp.c                       |    8
 arch/arm/plat-omap/omap-pm-noop.c                |    2
 58 files changed, 1597 insertions(+), 869 deletions(-)
 rename arch/arm/{plat-omap/include/plat/clockdomain.h =>

mach-omap2/clockdomain.h} (86%)

Quoted 4 lines
 create mode 100644 arch/arm/mach-omap2/cm44xx.c
 delete mode 100644 arch/arm/mach-omap2/cm4xxx.c
 create mode 100644 arch/arm/mach-omap2/cminst44xx.c
 rename arch/arm/{plat-omap/include/plat/powerdomain.h =>

mach-omap2/powerdomain.h} (90%)

Quoted 5 lines
 delete mode 100644 arch/arm/mach-omap2/powerdomains.h
 create mode 100644 arch/arm/mach-omap2/prcm44xx.h
 create mode 100644 arch/arm/mach-omap2/prcm_mpu44xx.c
 create mode 100644 arch/arm/mach-omap2/prminst44xx.c
 create mode 100644 arch/arm/mach-omap2/prminst44xx.h
author maintainer
#33 lore raw

cover OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38,part two

Quoted 2 lines · Rajendra Nayak

Boot tested on 2430/3430/4430SDP. Tested RET/OFF mode in suspend on 3430SDP with minimal config (omap3_pm_defconfig).

Thanks for testing this. Would you like me to add Tested-by:'s ?

Also, I still plan to make that change that you proposed to cause the prminst, cminst functions to read/write directly to the registers... soon...

- Paul

#34 lore raw

cover OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38,part two

Quoted 5 lines

-----Original Message-----
From: Paul Walmsley [mailto:paul at pwsan.com]
Sent: Wednesday, December 15, 2010 9:28 AM
To: Rajendra Nayak
Cc: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org;

Mark Brown; Benoit Cousson; Kevin Hilman;

Quoted 2 lines

Peter Ujfalusi; Santosh Shilimkar; Jarkko Nikula; Liam Girdwood
Subject: RE: [PATCH 00/11] OMAP: PRCM/powerdomain/clockdomain patches

for 2.6.38,part two

Quoted 7 lines · Rajendra Nayak
Quoted 3 lines

Boot tested on 2430/3430/4430SDP. Tested RET/OFF mode in suspend on 3430SDP with minimal config (omap3_pm_defconfig).

Thanks for testing this. Would you like me to add Tested-by:'s ?

Sure,

Quoted 4 lines

Also, I still plan to make that change that you proposed to cause the prminst, cminst functions to read/write directly to the registers... soon...

Thanks, already had a look.

Quoted 3 lines

- Paul

#35 lore raw

cover OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38,part two

In reply to Paul Walmsley

Paul,

Quoted 18 lines

-----Original Message-----
From: Paul Walmsley [mailto:paul at pwsan.com]
Sent: Wednesday, December 08, 2010 11:48 AM
To: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
Cc: Mark Brown; Beno?t Cousson; Kevin Hilman; Rajendra Nayak; Peter Ujfalusi; Santosh Shilimkar; Jarkko Nikula; Liam Girdwood
Subject: [PATCH 00/11] OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38,part two

This patch series, intended for 2.6.38:

- adds OMAP4-specific PRM and CM instance functions, which are capable of writing to PRM/CM instances, no matter what PRCM partition they appear in;

- renames the old OMAP2/3 PRM and CM functions to prefix them with 'omap2_';

Quoted 6 lines

- adds OMAP4 clockdomain offset addressing to the OMAP4 clockdomain definitions;

- removes the (now unused) OMAP clockdomain .clkstctrl_reg field;

- moves plat-omap/include/plat/{clock,power}domain.h to mach-omap2/,

since

Quoted 3 lines

these are OMAP2-specific;

- moves the OMAP3 SCM padconf save code from pm34xx.c into the SCM

common

Quoted 15 lines

code.

This series is available via git from git://git.pwsan.com/linux-2.6 in the branch 'pwrdm_prcm_b_2.6.38'. It applies on top of the "OMAP:
PRCM/powerdomain/clockdomain patches for 2.6.38, part one" series, sent earlier.

Kevin and OMAP ASoC-hackers, I'd appreciate review and acks, if appropriate, on the patches that touch code that you maintain. TI OMAP4 PM people, I would appreciate any testing assistance that you may be able to provide. Beno?t, I've tried to keep the kernel data files and the output of the scripts relatively similar, but we might need to do some tweaking of the scripts or data files to align them in the way that makes the most sense.

Quoted 3 lines

Boot-tested on N800, OMAP35xx Beagle, and OMAP4430ES2 Panda.

Have tested both part1 and part2 of your series on OMAP4 and OMAP3 SDPs. OFF mode works on OMAP3 SPD with this series.
Was planning to do some more testing with some porting of OMAP4 PM but it's taking bit more time.

Regards,
Santosh

author maintainer
#36 lore raw

cover OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38,part two

Hi Santosh

Quoted 4 lines · Santosh Shilimkar

Have tested both part1 and part2 of your series on OMAP4 and OMAP3 SDPs. OFF mode works on OMAP3 SPD with this series.
Was planning to do some more testing with some porting of OMAP4 PM but it's taking bit more time.

thanks for the testing, would you like me to add Tested-by:'s ?

- Paul

#37 lore raw

cover OMAP: PRCM/powerdomain/clockdomain patches for 2.6.38,part two

Quoted 5 lines

-----Original Message-----
From: Paul Walmsley [mailto:paul at pwsan.com]
Sent: Wednesday, December 15, 2010 9:57 AM
To: Santosh Shilimkar
Cc: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org;

Mark

Quoted 3 lines

Brown; Benoit Cousson; Kevin Hilman; Rajendra Nayak; Peter Ujfalusi; Jarkko Nikula; Liam Girdwood
Subject: RE: [PATCH 00/11] OMAP: PRCM/powerdomain/clockdomain patches

for

Quoted 7 lines

2.6.38,part two

Hi Santosh

Quoted 1 line · Santosh Shilimkar

Have tested both part1 and part2 of your series on OMAP4 and OMAP3

SDPs.

Quoted 6 lines
Quoted 3 lines

OFF mode works on OMAP3 SPD with this series.
Was planning to do some more testing with some porting of OMAP4 PM but it's taking bit more time.

thanks for the testing, would you like me to add Tested-by:'s ?

Sure.