]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/sdrc.h
ce3be73ff3ea5667a746d10dd6280a4afd2cdedf
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / sdrc.h
1 #ifndef __ARCH_ARM_MACH_OMAP2_SDRC_H
2 #define __ARCH_ARM_MACH_OMAP2_SDRC_H
3
4 /*
5  * OMAP2 SDRC register definitions
6  *
7  * Copyright (C) 2007 Texas Instruments, Inc.
8  * Copyright (C) 2007 Nokia Corporation
9  *
10  * Written by Paul Walmsley
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License version 2 as
14  * published by the Free Software Foundation.
15  */
16 #undef DEBUG
17
18 #include <asm/arch/sdrc.h>
19
20 #ifndef __ASSEMBLER__
21 extern unsigned long omap2_sdrc_base;
22 extern unsigned long omap2_sms_base;
23
24 #define OMAP_SDRC_REGADDR(reg)                                          \
25                 (void __iomem *)IO_ADDRESS(omap2_sdrc_base + (reg))
26 #define OMAP_SMS_REGADDR(reg)                                           \
27                 (void __iomem *)IO_ADDRESS(omap2_sms_base + (reg))
28
29 /* SDRC global register get/set */
30
31 static void __attribute__((unused)) sdrc_write_reg(u32 val, u16 reg)
32 {
33         pr_debug("sdrc_write_reg: writing 0x%0x to 0x%0x\n", val,
34                  (__force u32)OMAP_SDRC_REGADDR(reg));
35
36         __raw_writel(val, OMAP_SDRC_REGADDR(reg));
37 }
38
39 static u32 __attribute__((unused)) sdrc_read_reg(u16 reg)
40 {
41         return __raw_readl(OMAP_SDRC_REGADDR(reg));
42 }
43
44 /* SMS global register get/set */
45
46 static void __attribute__((unused)) sms_write_reg(u32 val, u16 reg)
47 {
48         pr_debug("sms_write_reg: writing 0x%0x to 0x%0x\n", val,
49                  (__force u32)OMAP_SMS_REGADDR(reg));
50
51         __raw_writel(val, OMAP_SMS_REGADDR(reg));
52 }
53
54 static u32 __attribute__((unused)) sms_read_reg(u16 reg)
55 {
56         return __raw_readl(OMAP_SMS_REGADDR(reg));
57 }
58 #else
59 #define OMAP242X_SDRC_REGADDR(reg)      IO_ADDRESS(OMAP2420_SDRC_BASE + (reg))
60 #define OMAP243X_SDRC_REGADDR(reg)      IO_ADDRESS(OMAP243X_SDRC_BASE + (reg))
61 #define OMAP34XX_SDRC_REGADDR(reg)      IO_ADDRESS(OMAP343X_SDRC_BASE + (reg))
62 #endif  /* __ASSEMBLER__ */
63
64 #endif