Paul Walmsley | 69d88a0 | 2008-03-18 10:02:50 +0200 | [diff] [blame] | 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 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 18 | #include <mach/sdrc.h> |
Paul Walmsley | 69d88a0 | 2008-03-18 10:02:50 +0200 | [diff] [blame] | 19 | |
| 20 | #ifndef __ASSEMBLER__ |
Tony Lindgren | a58caad | 2008-07-03 12:24:44 +0300 | [diff] [blame] | 21 | extern void __iomem *omap2_sdrc_base; |
| 22 | extern void __iomem *omap2_sms_base; |
Paul Walmsley | 69d88a0 | 2008-03-18 10:02:50 +0200 | [diff] [blame] | 23 | |
Tony Lindgren | a58caad | 2008-07-03 12:24:44 +0300 | [diff] [blame] | 24 | #define OMAP_SDRC_REGADDR(reg) (omap2_sdrc_base + (reg)) |
| 25 | #define OMAP_SMS_REGADDR(reg) (omap2_sms_base + (reg)) |
Paul Walmsley | 69d88a0 | 2008-03-18 10:02:50 +0200 | [diff] [blame] | 26 | |
| 27 | /* SDRC global register get/set */ |
| 28 | |
| 29 | static inline void sdrc_write_reg(u32 val, u16 reg) |
| 30 | { |
| 31 | __raw_writel(val, OMAP_SDRC_REGADDR(reg)); |
| 32 | } |
| 33 | |
| 34 | static inline u32 sdrc_read_reg(u16 reg) |
| 35 | { |
| 36 | return __raw_readl(OMAP_SDRC_REGADDR(reg)); |
| 37 | } |
| 38 | |
| 39 | /* SMS global register get/set */ |
| 40 | |
| 41 | static inline void sms_write_reg(u32 val, u16 reg) |
| 42 | { |
| 43 | __raw_writel(val, OMAP_SMS_REGADDR(reg)); |
| 44 | } |
| 45 | |
| 46 | static inline u32 sms_read_reg(u16 reg) |
| 47 | { |
| 48 | return __raw_readl(OMAP_SMS_REGADDR(reg)); |
| 49 | } |
| 50 | #else |
| 51 | #define OMAP242X_SDRC_REGADDR(reg) IO_ADDRESS(OMAP2420_SDRC_BASE + (reg)) |
| 52 | #define OMAP243X_SDRC_REGADDR(reg) IO_ADDRESS(OMAP243X_SDRC_BASE + (reg)) |
| 53 | #define OMAP34XX_SDRC_REGADDR(reg) IO_ADDRESS(OMAP343X_SDRC_BASE + (reg)) |
| 54 | #endif /* __ASSEMBLER__ */ |
| 55 | |
| 56 | #endif |