aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c1
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_dpllcore.c2
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c2
-rw-r--r--arch/arm/mach-omap2/clkt34xx_dpll3m2.c1
-rw-r--r--arch/arm/mach-omap2/control.c4
-rw-r--r--arch/arm/mach-omap2/gpmc.c1
-rw-r--r--arch/arm/mach-omap2/io.c2
-rw-r--r--arch/arm/mach-omap2/pm34xx.c1
-rw-r--r--arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h2
-rw-r--r--arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h2
-rw-r--r--arch/arm/mach-omap2/sdram-nokia.c2
-rw-r--r--arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h2
-rw-r--r--arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h2
-rw-r--r--arch/arm/mach-omap2/sdrc.c1
-rw-r--r--arch/arm/mach-omap2/sdrc.h146
-rw-r--r--arch/arm/mach-omap2/sdrc2xxx.c1
-rw-r--r--arch/arm/plat-omap/include/plat/sdrc.h157
17 files changed, 149 insertions, 180 deletions
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index 7bd8253b5d1d..cbcea420e332 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -36,7 +36,6 @@
36 36
37#include "gpmc-smsc911x.h" 37#include "gpmc-smsc911x.h"
38#include <plat/gpmc.h> 38#include <plat/gpmc.h>
39#include <plat/sdrc.h>
40#include <plat/usb.h> 39#include <plat/usb.h>
41 40
42#include "common.h" 41#include "common.h"
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
index 4ae439222085..35076592189e 100644
--- a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
+++ b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
@@ -27,13 +27,13 @@
27 27
28#include <plat/clock.h> 28#include <plat/clock.h>
29#include <plat/sram.h> 29#include <plat/sram.h>
30#include <plat/sdrc.h>
31 30
32#include "clock.h" 31#include "clock.h"
33#include "clock2xxx.h" 32#include "clock2xxx.h"
34#include "opp2xxx.h" 33#include "opp2xxx.h"
35#include "cm2xxx_3xxx.h" 34#include "cm2xxx_3xxx.h"
36#include "cm-regbits-24xx.h" 35#include "cm-regbits-24xx.h"
36#include "sdrc.h"
37 37
38/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */ 38/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */
39 39
diff --git a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
index 3524f0e7b6d5..0cf63e7c6102 100644
--- a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
+++ b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
@@ -35,7 +35,6 @@
35 35
36#include <plat/clock.h> 36#include <plat/clock.h>
37#include <plat/sram.h> 37#include <plat/sram.h>
38#include <plat/sdrc.h>
39 38
40#include "soc.h" 39#include "soc.h"
41#include "clock.h" 40#include "clock.h"
@@ -43,6 +42,7 @@
43#include "opp2xxx.h" 42#include "opp2xxx.h"
44#include "cm2xxx_3xxx.h" 43#include "cm2xxx_3xxx.h"
45#include "cm-regbits-24xx.h" 44#include "cm-regbits-24xx.h"
45#include "sdrc.h"
46 46
47const struct prcm_config *curr_prcm_set; 47const struct prcm_config *curr_prcm_set;
48const struct prcm_config *rate_table; 48const struct prcm_config *rate_table;
diff --git a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
index 7c6da2f731dc..aff6ca4fd3a4 100644
--- a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
+++ b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
@@ -23,7 +23,6 @@
23 23
24#include <plat/clock.h> 24#include <plat/clock.h>
25#include <plat/sram.h> 25#include <plat/sram.h>
26#include <plat/sdrc.h>
27 26
28#include "clock.h" 27#include "clock.h"
29#include "clock3xxx.h" 28#include "clock3xxx.h"
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index d1ff8399a222..bf2be5c5468d 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2/3 System Control Module register access 2 * OMAP2/3 System Control Module register access
3 * 3 *
4 * Copyright (C) 2007 Texas Instruments, Inc. 4 * Copyright (C) 2007, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007 Nokia Corporation 5 * Copyright (C) 2007 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
@@ -15,8 +15,6 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/io.h> 16#include <linux/io.h>
17 17
18#include <plat/sdrc.h>
19
20#include "soc.h" 18#include "soc.h"
21#include "iomap.h" 19#include "iomap.h"
22#include "common.h" 20#include "common.h"
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 5ac5cf30406a..e7f2b80721c4 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -31,7 +31,6 @@
31 31
32#include <plat/cpu.h> 32#include <plat/cpu.h>
33#include <plat/gpmc.h> 33#include <plat/gpmc.h>
34#include <plat/sdrc.h>
35#include <plat/omap_device.h> 34#include <plat/omap_device.h>
36 35
37#include "soc.h" 36#include "soc.h"
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 4234d28dc171..ab82dbe92e02 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -26,7 +26,6 @@
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27 27
28#include <plat/sram.h> 28#include <plat/sram.h>
29#include <plat/sdrc.h>
30#include <plat/serial.h> 29#include <plat/serial.h>
31#include <plat/omap-pm.h> 30#include <plat/omap-pm.h>
32#include <plat/omap_hwmod.h> 31#include <plat/omap_hwmod.h>
@@ -43,6 +42,7 @@
43#include "clock2xxx.h" 42#include "clock2xxx.h"
44#include "clock3xxx.h" 43#include "clock3xxx.h"
45#include "clock44xx.h" 44#include "clock44xx.h"
45#include "sdrc.h"
46 46
47/* 47/*
48 * The machine specific code may provide the extra mapping besides the 48 * The machine specific code may provide the extra mapping besides the
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index ba670db1fd37..ee0bffc614be 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -38,7 +38,6 @@
38#include <plat/sram.h> 38#include <plat/sram.h>
39#include "clockdomain.h" 39#include "clockdomain.h"
40#include "powerdomain.h" 40#include "powerdomain.h"
41#include <plat/sdrc.h>
42#include <plat/prcm.h> 41#include <plat/prcm.h>
43#include <plat/gpmc.h> 42#include <plat/gpmc.h>
44#include <plat/dma.h> 43#include <plat/dma.h>
diff --git a/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h b/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h
index 8bfaf342a028..1ee58c281a31 100644
--- a/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h
+++ b/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h
@@ -11,7 +11,7 @@
11#ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM 11#ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM
12#define __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM 12#define __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM
13 13
14#include <plat/sdrc.h> 14#include "sdrc.h"
15 15
16/* Hynix H8MBX00U0MER-0EM */ 16/* Hynix H8MBX00U0MER-0EM */
17static struct omap_sdrc_params h8mbx00u0mer0em_sdrc_params[] = { 17static struct omap_sdrc_params h8mbx00u0mer0em_sdrc_params[] = {
diff --git a/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h b/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h
index a391b4939f74..85cccc004c06 100644
--- a/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h
+++ b/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h
@@ -14,7 +14,7 @@
14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF 14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF
15#define ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF 15#define ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF
16 16
17#include <plat/sdrc.h> 17#include "sdrc.h"
18 18
19/* Micron MT46H32M32LF-6 */ 19/* Micron MT46H32M32LF-6 */
20/* XXX Using ARE = 0x1 (no autorefresh burst) -- can this be changed? */ 20/* XXX Using ARE = 0x1 (no autorefresh burst) -- can this be changed? */
diff --git a/arch/arm/mach-omap2/sdram-nokia.c b/arch/arm/mach-omap2/sdram-nokia.c
index 845c4fd2b125..5e5702cd410d 100644
--- a/arch/arm/mach-omap2/sdram-nokia.c
+++ b/arch/arm/mach-omap2/sdram-nokia.c
@@ -19,9 +19,9 @@
19 19
20#include "common.h" 20#include "common.h"
21#include <plat/clock.h> 21#include <plat/clock.h>
22#include <plat/sdrc.h>
23 22
24#include "sdram-nokia.h" 23#include "sdram-nokia.h"
24#include "sdrc.h"
25 25
26/* In picoseconds, except for tREF (ns), tXP, tCKE, tWTR (clks) */ 26/* In picoseconds, except for tREF (ns), tXP, tCKE, tWTR (clks) */
27struct sdram_timings { 27struct sdram_timings {
diff --git a/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h b/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h
index cd4352917022..003f7bf4e2e3 100644
--- a/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h
+++ b/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h
@@ -11,7 +11,7 @@
11#ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM 11#ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM
12#define __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM 12#define __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM
13 13
14#include <plat/sdrc.h> 14#include "sdrc.h"
15 15
16/* Numonyx M65KXXXXAM */ 16/* Numonyx M65KXXXXAM */
17static struct omap_sdrc_params m65kxxxxam_sdrc_params[] = { 17static struct omap_sdrc_params m65kxxxxam_sdrc_params[] = {
diff --git a/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h b/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h
index 0e518a72831f..8dc3de5ebb5b 100644
--- a/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h
+++ b/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h
@@ -14,7 +14,7 @@
14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6 14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6
15#define ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6 15#define ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6
16 16
17#include <plat/sdrc.h> 17#include "sdrc.h"
18 18
19/* Qimonda HYB18M512160AF-6 */ 19/* Qimonda HYB18M512160AF-6 */
20static struct omap_sdrc_params hyb18m512160af6_sdrc_params[] = { 20static struct omap_sdrc_params hyb18m512160af6_sdrc_params[] = {
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c
index 4282e6e967d6..761a781a99c5 100644
--- a/arch/arm/mach-omap2/sdrc.c
+++ b/arch/arm/mach-omap2/sdrc.c
@@ -27,7 +27,6 @@
27#include <plat/clock.h> 27#include <plat/clock.h>
28#include <plat/sram.h> 28#include <plat/sram.h>
29 29
30#include <plat/sdrc.h>
31#include "sdrc.h" 30#include "sdrc.h"
32 31
33static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1; 32static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1;
diff --git a/arch/arm/mach-omap2/sdrc.h b/arch/arm/mach-omap2/sdrc.h
index b3f83799e6cf..69c4b329452e 100644
--- a/arch/arm/mach-omap2/sdrc.h
+++ b/arch/arm/mach-omap2/sdrc.h
@@ -2,12 +2,14 @@
2#define __ARCH_ARM_MACH_OMAP2_SDRC_H 2#define __ARCH_ARM_MACH_OMAP2_SDRC_H
3 3
4/* 4/*
5 * OMAP2 SDRC register definitions 5 * OMAP2/3 SDRC/SMS macros and prototypes
6 * 6 *
7 * Copyright (C) 2007 Texas Instruments, Inc. 7 * Copyright (C) 2007-2008, 2012 Texas Instruments, Inc.
8 * Copyright (C) 2007 Nokia Corporation 8 * Copyright (C) 2007-2008 Nokia Corporation
9 * 9 *
10 * Written by Paul Walmsley 10 * Paul Walmsley
11 * Tony Lindgren
12 * Richard Woodruff
11 * 13 *
12 * This program is free software; you can redistribute it and/or modify 14 * 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 15 * it under the terms of the GNU General Public License version 2 as
@@ -15,8 +17,6 @@
15 */ 17 */
16#undef DEBUG 18#undef DEBUG
17 19
18#include <plat/sdrc.h>
19
20#ifndef __ASSEMBLER__ 20#ifndef __ASSEMBLER__
21 21
22#include <linux/io.h> 22#include <linux/io.h>
@@ -50,6 +50,58 @@ static inline u32 sms_read_reg(u16 reg)
50{ 50{
51 return __raw_readl(OMAP_SMS_REGADDR(reg)); 51 return __raw_readl(OMAP_SMS_REGADDR(reg));
52} 52}
53
54
55/**
56 * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate
57 * @rate: SDRC clock rate (in Hz)
58 * @actim_ctrla: Value to program to SDRC_ACTIM_CTRLA for this rate
59 * @actim_ctrlb: Value to program to SDRC_ACTIM_CTRLB for this rate
60 * @rfr_ctrl: Value to program to SDRC_RFR_CTRL for this rate
61 * @mr: Value to program to SDRC_MR for this rate
62 *
63 * This structure holds a pre-computed set of register values for the
64 * SDRC for a given SDRC clock rate and SDRAM chip. These are
65 * intended to be pre-computed and specified in an array in the board-*.c
66 * files. The structure is keyed off the 'rate' field.
67 */
68struct omap_sdrc_params {
69 unsigned long rate;
70 u32 actim_ctrla;
71 u32 actim_ctrlb;
72 u32 rfr_ctrl;
73 u32 mr;
74};
75
76#ifdef CONFIG_SOC_HAS_OMAP2_SDRC
77void omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
78 struct omap_sdrc_params *sdrc_cs1);
79#else
80static inline void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
81 struct omap_sdrc_params *sdrc_cs1) {};
82#endif
83
84int omap2_sdrc_get_params(unsigned long r,
85 struct omap_sdrc_params **sdrc_cs0,
86 struct omap_sdrc_params **sdrc_cs1);
87void omap2_sms_save_context(void);
88void omap2_sms_restore_context(void);
89
90struct memory_timings {
91 u32 m_type; /* ddr = 1, sdr = 0 */
92 u32 dll_mode; /* use lock mode = 1, unlock mode = 0 */
93 u32 slow_dll_ctrl; /* unlock mode, dll value for slow speed */
94 u32 fast_dll_ctrl; /* unlock mode, dll value for fast speed */
95 u32 base_cs; /* base chip select to use for calculations */
96};
97
98extern void omap2xxx_sdrc_init_params(u32 force_lock_to_unlock_mode);
99struct omap_sdrc_params *rx51_get_sdram_timings(void);
100
101u32 omap2xxx_sdrc_dll_is_unlocked(void);
102u32 omap2xxx_sdrc_reprogram(u32 level, u32 force);
103
104
53#else 105#else
54#define OMAP242X_SDRC_REGADDR(reg) \ 106#define OMAP242X_SDRC_REGADDR(reg) \
55 OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg)) 107 OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg))
@@ -57,6 +109,7 @@ static inline u32 sms_read_reg(u16 reg)
57 OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg)) 109 OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg))
58#define OMAP34XX_SDRC_REGADDR(reg) \ 110#define OMAP34XX_SDRC_REGADDR(reg) \
59 OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg)) 111 OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg))
112
60#endif /* __ASSEMBLER__ */ 113#endif /* __ASSEMBLER__ */
61 114
62/* Minimum frequency that the SDRC DLL can lock at */ 115/* Minimum frequency that the SDRC DLL can lock at */
@@ -74,4 +127,85 @@ static inline u32 sms_read_reg(u16 reg)
74 */ 127 */
75#define SDRC_MPURATE_LOOPS 96 128#define SDRC_MPURATE_LOOPS 96
76 129
130/* SDRC register offsets - read/write with sdrc_{read,write}_reg() */
131
132#define SDRC_SYSCONFIG 0x010
133#define SDRC_CS_CFG 0x040
134#define SDRC_SHARING 0x044
135#define SDRC_ERR_TYPE 0x04C
136#define SDRC_DLLA_CTRL 0x060
137#define SDRC_DLLA_STATUS 0x064
138#define SDRC_DLLB_CTRL 0x068
139#define SDRC_DLLB_STATUS 0x06C
140#define SDRC_POWER 0x070
141#define SDRC_MCFG_0 0x080
142#define SDRC_MR_0 0x084
143#define SDRC_EMR2_0 0x08c
144#define SDRC_ACTIM_CTRL_A_0 0x09c
145#define SDRC_ACTIM_CTRL_B_0 0x0a0
146#define SDRC_RFR_CTRL_0 0x0a4
147#define SDRC_MANUAL_0 0x0a8
148#define SDRC_MCFG_1 0x0B0
149#define SDRC_MR_1 0x0B4
150#define SDRC_EMR2_1 0x0BC
151#define SDRC_ACTIM_CTRL_A_1 0x0C4
152#define SDRC_ACTIM_CTRL_B_1 0x0C8
153#define SDRC_RFR_CTRL_1 0x0D4
154#define SDRC_MANUAL_1 0x0D8
155
156#define SDRC_POWER_AUTOCOUNT_SHIFT 8
157#define SDRC_POWER_AUTOCOUNT_MASK (0xffff << SDRC_POWER_AUTOCOUNT_SHIFT)
158#define SDRC_POWER_CLKCTRL_SHIFT 4
159#define SDRC_POWER_CLKCTRL_MASK (0x3 << SDRC_POWER_CLKCTRL_SHIFT)
160#define SDRC_SELF_REFRESH_ON_AUTOCOUNT (0x2 << SDRC_POWER_CLKCTRL_SHIFT)
161
162/*
163 * These values represent the number of memory clock cycles between
164 * autorefresh initiation. They assume 1 refresh per 64 ms (JEDEC), 8192
165 * rows per device, and include a subtraction of a 50 cycle window in the
166 * event that the autorefresh command is delayed due to other SDRC activity.
167 * The '| 1' sets the ARE field to send one autorefresh when the autorefresh
168 * counter reaches 0.
169 *
170 * These represent optimal values for common parts, it won't work for all.
171 * As long as you scale down, most parameters are still work, they just
172 * become sub-optimal. The RFR value goes in the opposite direction. If you
173 * don't adjust it down as your clock period increases the refresh interval
174 * will not be met. Setting all parameters for complete worst case may work,
175 * but may cut memory performance by 2x. Due to errata the DLLs need to be
176 * unlocked and their value needs run time calibration. A dynamic call is
177 * need for that as no single right value exists acorss production samples.
178 *
179 * Only the FULL speed values are given. Current code is such that rate
180 * changes must be made at DPLLoutx2. The actual value adjustment for low
181 * frequency operation will be handled by omap_set_performance()
182 *
183 * By having the boot loader boot up in the fastest L4 speed available likely
184 * will result in something which you can switch between.
185 */
186#define SDRC_RFR_CTRL_165MHz (0x00044c00 | 1)
187#define SDRC_RFR_CTRL_133MHz (0x0003de00 | 1)
188#define SDRC_RFR_CTRL_100MHz (0x0002da01 | 1)
189#define SDRC_RFR_CTRL_110MHz (0x0002da01 | 1) /* Need to calc */
190#define SDRC_RFR_CTRL_BYPASS (0x00005000 | 1) /* Need to calc */
191
192
193/*
194 * SMS register access
195 */
196
197#define OMAP242X_SMS_REGADDR(reg) \
198 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE + reg)
199#define OMAP243X_SMS_REGADDR(reg) \
200 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE + reg)
201#define OMAP343X_SMS_REGADDR(reg) \
202 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE + reg)
203
204/* SMS register offsets - read/write with sms_{read,write}_reg() */
205
206#define SMS_SYSCONFIG 0x010
207/* REVISIT: fill in other SMS registers here */
208
209
210
77#endif 211#endif
diff --git a/arch/arm/mach-omap2/sdrc2xxx.c b/arch/arm/mach-omap2/sdrc2xxx.c
index 73e55e485329..f7074ff1d084 100644
--- a/arch/arm/mach-omap2/sdrc2xxx.c
+++ b/arch/arm/mach-omap2/sdrc2xxx.c
@@ -26,7 +26,6 @@
26 26
27#include <plat/clock.h> 27#include <plat/clock.h>
28#include <plat/sram.h> 28#include <plat/sram.h>
29#include <plat/sdrc.h>
30 29
31#include "soc.h" 30#include "soc.h"
32#include "iomap.h" 31#include "iomap.h"
diff --git a/arch/arm/plat-omap/include/plat/sdrc.h b/arch/arm/plat-omap/include/plat/sdrc.h
deleted file mode 100644
index c68bab29cfc5..000000000000
--- a/arch/arm/plat-omap/include/plat/sdrc.h
+++ /dev/null
@@ -1,157 +0,0 @@
1#ifndef ____ASM_ARCH_SDRC_H
2#define ____ASM_ARCH_SDRC_H
3
4/*
5 * OMAP2/3 SDRC/SMS register definitions
6 *
7 * Copyright (C) 2007-2008 Texas Instruments, Inc.
8 * Copyright (C) 2007-2008 Nokia Corporation
9 *
10 * Tony Lindgren
11 * Paul Walmsley
12 * Richard Woodruff
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18
19
20/* SDRC register offsets - read/write with sdrc_{read,write}_reg() */
21
22#define SDRC_SYSCONFIG 0x010
23#define SDRC_CS_CFG 0x040
24#define SDRC_SHARING 0x044
25#define SDRC_ERR_TYPE 0x04C
26#define SDRC_DLLA_CTRL 0x060
27#define SDRC_DLLA_STATUS 0x064
28#define SDRC_DLLB_CTRL 0x068
29#define SDRC_DLLB_STATUS 0x06C
30#define SDRC_POWER 0x070
31#define SDRC_MCFG_0 0x080
32#define SDRC_MR_0 0x084
33#define SDRC_EMR2_0 0x08c
34#define SDRC_ACTIM_CTRL_A_0 0x09c
35#define SDRC_ACTIM_CTRL_B_0 0x0a0
36#define SDRC_RFR_CTRL_0 0x0a4
37#define SDRC_MANUAL_0 0x0a8
38#define SDRC_MCFG_1 0x0B0
39#define SDRC_MR_1 0x0B4
40#define SDRC_EMR2_1 0x0BC
41#define SDRC_ACTIM_CTRL_A_1 0x0C4
42#define SDRC_ACTIM_CTRL_B_1 0x0C8
43#define SDRC_RFR_CTRL_1 0x0D4
44#define SDRC_MANUAL_1 0x0D8
45
46#define SDRC_POWER_AUTOCOUNT_SHIFT 8
47#define SDRC_POWER_AUTOCOUNT_MASK (0xffff << SDRC_POWER_AUTOCOUNT_SHIFT)
48#define SDRC_POWER_CLKCTRL_SHIFT 4
49#define SDRC_POWER_CLKCTRL_MASK (0x3 << SDRC_POWER_CLKCTRL_SHIFT)
50#define SDRC_SELF_REFRESH_ON_AUTOCOUNT (0x2 << SDRC_POWER_CLKCTRL_SHIFT)
51
52/*
53 * These values represent the number of memory clock cycles between
54 * autorefresh initiation. They assume 1 refresh per 64 ms (JEDEC), 8192
55 * rows per device, and include a subtraction of a 50 cycle window in the
56 * event that the autorefresh command is delayed due to other SDRC activity.
57 * The '| 1' sets the ARE field to send one autorefresh when the autorefresh
58 * counter reaches 0.
59 *
60 * These represent optimal values for common parts, it won't work for all.
61 * As long as you scale down, most parameters are still work, they just
62 * become sub-optimal. The RFR value goes in the opposite direction. If you
63 * don't adjust it down as your clock period increases the refresh interval
64 * will not be met. Setting all parameters for complete worst case may work,
65 * but may cut memory performance by 2x. Due to errata the DLLs need to be
66 * unlocked and their value needs run time calibration. A dynamic call is
67 * need for that as no single right value exists acorss production samples.
68 *
69 * Only the FULL speed values are given. Current code is such that rate
70 * changes must be made at DPLLoutx2. The actual value adjustment for low
71 * frequency operation will be handled by omap_set_performance()
72 *
73 * By having the boot loader boot up in the fastest L4 speed available likely
74 * will result in something which you can switch between.
75 */
76#define SDRC_RFR_CTRL_165MHz (0x00044c00 | 1)
77#define SDRC_RFR_CTRL_133MHz (0x0003de00 | 1)
78#define SDRC_RFR_CTRL_100MHz (0x0002da01 | 1)
79#define SDRC_RFR_CTRL_110MHz (0x0002da01 | 1) /* Need to calc */
80#define SDRC_RFR_CTRL_BYPASS (0x00005000 | 1) /* Need to calc */
81
82
83/*
84 * SMS register access
85 */
86
87#define OMAP242X_SMS_REGADDR(reg) \
88 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE + reg)
89#define OMAP243X_SMS_REGADDR(reg) \
90 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE + reg)
91#define OMAP343X_SMS_REGADDR(reg) \
92 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE + reg)
93
94/* SMS register offsets - read/write with sms_{read,write}_reg() */
95
96#define SMS_SYSCONFIG 0x010
97/* REVISIT: fill in other SMS registers here */
98
99
100#ifndef __ASSEMBLER__
101
102/**
103 * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate
104 * @rate: SDRC clock rate (in Hz)
105 * @actim_ctrla: Value to program to SDRC_ACTIM_CTRLA for this rate
106 * @actim_ctrlb: Value to program to SDRC_ACTIM_CTRLB for this rate
107 * @rfr_ctrl: Value to program to SDRC_RFR_CTRL for this rate
108 * @mr: Value to program to SDRC_MR for this rate
109 *
110 * This structure holds a pre-computed set of register values for the
111 * SDRC for a given SDRC clock rate and SDRAM chip. These are
112 * intended to be pre-computed and specified in an array in the board-*.c
113 * files. The structure is keyed off the 'rate' field.
114 */
115struct omap_sdrc_params {
116 unsigned long rate;
117 u32 actim_ctrla;
118 u32 actim_ctrlb;
119 u32 rfr_ctrl;
120 u32 mr;
121};
122
123#ifdef CONFIG_SOC_HAS_OMAP2_SDRC
124void omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
125 struct omap_sdrc_params *sdrc_cs1);
126#else
127static inline void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
128 struct omap_sdrc_params *sdrc_cs1) {};
129#endif
130
131int omap2_sdrc_get_params(unsigned long r,
132 struct omap_sdrc_params **sdrc_cs0,
133 struct omap_sdrc_params **sdrc_cs1);
134void omap2_sms_save_context(void);
135void omap2_sms_restore_context(void);
136
137#ifdef CONFIG_ARCH_OMAP2
138
139struct memory_timings {
140 u32 m_type; /* ddr = 1, sdr = 0 */
141 u32 dll_mode; /* use lock mode = 1, unlock mode = 0 */
142 u32 slow_dll_ctrl; /* unlock mode, dll value for slow speed */
143 u32 fast_dll_ctrl; /* unlock mode, dll value for fast speed */
144 u32 base_cs; /* base chip select to use for calculations */
145};
146
147extern void omap2xxx_sdrc_init_params(u32 force_lock_to_unlock_mode);
148struct omap_sdrc_params *rx51_get_sdram_timings(void);
149
150u32 omap2xxx_sdrc_dll_is_unlocked(void);
151u32 omap2xxx_sdrc_reprogram(u32 level, u32 force);
152
153#endif /* CONFIG_ARCH_OMAP2 */
154
155#endif /* __ASSEMBLER__ */
156
157#endif