blob: 12fc7dafec2b56960d7199219ea5fc5d1b1ad2ec [file] [log] [blame]
Paul Walmsley69d88a02008-03-18 10:02:50 +02001#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
Tony Lindgrence491cf2009-10-20 09:40:47 -070018#include <plat/sdrc.h>
Paul Walmsley69d88a02008-03-18 10:02:50 +020019
20#ifndef __ASSEMBLER__
Tony Lindgrena58caad2008-07-03 12:24:44 +030021extern void __iomem *omap2_sdrc_base;
22extern void __iomem *omap2_sms_base;
Paul Walmsley69d88a02008-03-18 10:02:50 +020023
Tony Lindgrena58caad2008-07-03 12:24:44 +030024#define OMAP_SDRC_REGADDR(reg) (omap2_sdrc_base + (reg))
25#define OMAP_SMS_REGADDR(reg) (omap2_sms_base + (reg))
Paul Walmsley69d88a02008-03-18 10:02:50 +020026
27/* SDRC global register get/set */
28
29static inline void sdrc_write_reg(u32 val, u16 reg)
30{
31 __raw_writel(val, OMAP_SDRC_REGADDR(reg));
32}
33
34static 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
41static inline void sms_write_reg(u32 val, u16 reg)
42{
43 __raw_writel(val, OMAP_SMS_REGADDR(reg));
44}
45
46static inline u32 sms_read_reg(u16 reg)
47{
48 return __raw_readl(OMAP_SMS_REGADDR(reg));
49}
50#else
Santosh Shilimkar233fd642009-10-19 15:25:31 -070051#define OMAP242X_SDRC_REGADDR(reg) \
52 OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg))
53#define OMAP243X_SDRC_REGADDR(reg) \
54 OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg))
55#define OMAP34XX_SDRC_REGADDR(reg) \
56 OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg))
Paul Walmsley69d88a02008-03-18 10:02:50 +020057#endif /* __ASSEMBLER__ */
58
Paul Walmsley55d8a652009-12-08 16:18:47 -070059/* Minimum frequency that the SDRC DLL can lock at */
60#define MIN_SDRC_DLL_LOCK_FREQ 83000000
61
62/* Scale factor for fixed-point arith in omap3_core_dpll_m2_set_rate() */
63#define SDRC_MPURATE_SCALE 8
64
65/* 2^SDRC_MPURATE_BASE_SHIFT: MPU MHz that SDRC_MPURATE_LOOPS is defined for */
66#define SDRC_MPURATE_BASE_SHIFT 9
67
68/*
69 * SDRC_MPURATE_LOOPS: Number of MPU loops to execute at
70 * 2^MPURATE_BASE_SHIFT MHz for SDRC to stabilize
71 */
72#define SDRC_MPURATE_LOOPS 96
73
74
Paul Walmsley69d88a02008-03-18 10:02:50 +020075#endif