]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/control.c
400114bdb8cfa3fed5e1ca60023f30365dc47df6
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / control.c
1 /*
2  * OMAP2/3 System Control Module register access
3  *
4  * Copyright (C) 2007 Texas Instruments, Inc.
5  * Copyright (C) 2007 Nokia Corporation
6  *
7  * Written by Paul Walmsley
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  */
13 #undef DEBUG
14
15 #include <linux/kernel.h>
16 #include <linux/io.h>
17
18 #include <asm/arch/control.h>
19
20 static u32 omap2_ctrl_base;
21
22 #define OMAP_CTRL_REGADDR(reg)                                  \
23         (__force void __iomem *)IO_ADDRESS(omap2_ctrl_base + (reg))
24
25 void omap_ctrl_base_set(u32 base)
26 {
27         omap2_ctrl_base = base;
28 }
29
30 u32 omap_ctrl_base_get(void)
31 {
32         return omap2_ctrl_base;
33 }
34
35 u8 omap_ctrl_readb(u16 offset)
36 {
37         return __raw_readb(OMAP_CTRL_REGADDR(offset));
38 }
39
40 u16 omap_ctrl_readw(u16 offset)
41 {
42         return __raw_readw(OMAP_CTRL_REGADDR(offset));
43 }
44
45 u32 omap_ctrl_readl(u16 offset)
46 {
47         return __raw_readl(OMAP_CTRL_REGADDR(offset));
48 }
49
50 void omap_ctrl_writeb(u8 val, u16 offset)
51 {
52         pr_debug("omap_ctrl_writeb: writing 0x%0x to 0x%0x\n", val,
53                  (__force u32)OMAP_CTRL_REGADDR(offset));
54
55         __raw_writeb(val, OMAP_CTRL_REGADDR(offset));
56 }
57
58 void omap_ctrl_writew(u16 val, u16 offset)
59 {
60         pr_debug("omap_ctrl_writew: writing 0x%0x to 0x%0x\n", val,
61                  (__force u32)OMAP_CTRL_REGADDR(offset));
62
63         __raw_writew(val, OMAP_CTRL_REGADDR(offset));
64 }
65
66 void omap_ctrl_writel(u32 val, u16 offset)
67 {
68         pr_debug("omap_ctrl_writel: writing 0x%0x to 0x%0x\n", val,
69                  (__force u32)OMAP_CTRL_REGADDR(offset));
70
71         __raw_writel(val, OMAP_CTRL_REGADDR(offset));
72 }
73