aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/prcm.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2008-07-03 05:24:44 -0400
committerTony Lindgren <tony@atomide.com>2008-07-03 05:24:44 -0400
commita58caad11301a5bdc2d7b76596ab5477221f7a9b (patch)
tree95bb4df0ad450b0439cdf6256d2a2b2345b03231 /arch/arm/mach-omap2/prcm.c
parente1f80bfca86ab48b7bed731b32262fb1a2835de5 (diff)
ARM: OMAP: Introduce omap_globals and prcm access functions for multi-omap
New struct omap_globals contains the omap processor specific module bases. Use omap_globals to set the various base addresses to make detecting omap chip type simpler. Also introduce OMAP1_IO_ADDRESS and OMAP2_IO_ADDRESS for future multi-omap patches. Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/prcm.c')
-rw-r--r--arch/arm/mach-omap2/prcm.c55
1 files changed, 54 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index b12f423b8595..9584376d055a 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -16,12 +16,18 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/io.h>
19 20
20#include <asm/io.h> 21#include <asm/arch/common.h>
22#include <asm/arch/prcm.h>
21 23
24#include "clock.h"
22#include "prm.h" 25#include "prm.h"
23#include "prm-regbits-24xx.h" 26#include "prm-regbits-24xx.h"
24 27
28static void __iomem *prm_base;
29static void __iomem *cm_base;
30
25extern void omap2_clk_prepare_for_reboot(void); 31extern void omap2_clk_prepare_for_reboot(void);
26 32
27u32 omap_prcm_get_reset_sources(void) 33u32 omap_prcm_get_reset_sources(void)
@@ -41,3 +47,50 @@ void omap_prcm_arch_reset(char mode)
41 prm_write_mod_reg(wkup, WKUP_MOD, RM_RSTCTRL); 47 prm_write_mod_reg(wkup, WKUP_MOD, RM_RSTCTRL);
42 } 48 }
43} 49}
50
51static inline u32 __omap_prcm_read(void __iomem *base, s16 module, u16 reg)
52{
53 BUG_ON(!base);
54 return __raw_readl(base + module + reg);
55}
56
57static inline void __omap_prcm_write(u32 value, void __iomem *base,
58 s16 module, u16 reg)
59{
60 BUG_ON(!base);
61 __raw_writel(value, base + module + reg);
62}
63
64/* Read a register in a PRM module */
65u32 prm_read_mod_reg(s16 module, u16 idx)
66{
67 return __omap_prcm_read(prm_base, module, idx);
68}
69EXPORT_SYMBOL(prm_read_mod_reg);
70
71/* Write into a register in a PRM module */
72void prm_write_mod_reg(u32 val, s16 module, u16 idx)
73{
74 __omap_prcm_write(val, prm_base, module, idx);
75}
76EXPORT_SYMBOL(prm_write_mod_reg);
77
78/* Read a register in a CM module */
79u32 cm_read_mod_reg(s16 module, u16 idx)
80{
81 return __omap_prcm_read(cm_base, module, idx);
82}
83EXPORT_SYMBOL(cm_read_mod_reg);
84
85/* Write into a register in a CM module */
86void cm_write_mod_reg(u32 val, s16 module, u16 idx)
87{
88 __omap_prcm_write(val, cm_base, module, idx);
89}
90EXPORT_SYMBOL(cm_write_mod_reg);
91
92void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
93{
94 prm_base = omap2_globals->prm;
95 cm_base = omap2_globals->cm;
96}