2 * OMAP2/3 System Control Module register access
4 * Copyright (C) 2007 Texas Instruments, Inc.
5 * Copyright (C) 2007 Nokia Corporation
7 * Written by Paul Walmsley
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.
15 #include <linux/kernel.h>
19 #include <asm/arch/control.h>
21 static u32 omap2_ctrl_base;
23 #define OMAP_CTRL_REGADDR(reg) (void __iomem *)IO_ADDRESS(omap2_ctrl_base \
26 void omap_ctrl_base_set(u32 base)
28 omap2_ctrl_base = base;
31 u32 omap_ctrl_base_get(void)
33 return omap2_ctrl_base;
36 u8 omap_ctrl_readb(u16 offset)
38 return __raw_readb(OMAP_CTRL_REGADDR(offset));
41 u16 omap_ctrl_readw(u16 offset)
43 return __raw_readw(OMAP_CTRL_REGADDR(offset));
46 u32 omap_ctrl_readl(u16 offset)
48 return __raw_readl(OMAP_CTRL_REGADDR(offset));
51 void omap_ctrl_writeb(u8 val, u16 offset)
53 pr_debug("omap_ctrl_writeb: writing 0x%0x to 0x%0x\n", val,
54 (u32)OMAP_CTRL_REGADDR(offset));
56 __raw_writeb(val, OMAP_CTRL_REGADDR(offset));
59 void omap_ctrl_writew(u16 val, u16 offset)
61 pr_debug("omap_ctrl_writew: writing 0x%0x to 0x%0x\n", val,
62 (u32)OMAP_CTRL_REGADDR(offset));
64 __raw_writew(val, OMAP_CTRL_REGADDR(offset));
67 void omap_ctrl_writel(u32 val, u16 offset)
69 pr_debug("omap_ctrl_writel: writing 0x%0x to 0x%0x\n", val,
70 (u32)OMAP_CTRL_REGADDR(offset));
72 __raw_writel(val, OMAP_CTRL_REGADDR(offset));