1 #ifndef __ARCH_ARM_MACH_OMAP2_SDRC_H
2 #define __ARCH_ARM_MACH_OMAP2_SDRC_H
5 * OMAP2 SDRC register definitions
7 * Copyright (C) 2007 Texas Instruments, Inc.
8 * Copyright (C) 2007 Nokia Corporation
10 * Written by Paul Walmsley
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.
17 #include <linux/kernel.h>
18 #include <asm/arch/io.h>
21 #define OMAP_SDRC_REGADDR(reg) (void __iomem *)IO_ADDRESS(OMAP2_SDRC_BASE + reg)
23 /* SDRC register offsets - read/write with sdrc_{read,write}_reg() */
25 #define SDRC_SYSCONFIG 0x010
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_MR_0 0x084
34 /* SDRC global register get/set */
36 static void __attribute__((unused)) sdrc_write_reg(u32 val, u16 reg)
38 pr_debug("sdrc_write_reg: writing 0x%0x to 0x%0x\n", val,
39 (u32)OMAP_SDRC_REGADDR(reg));
41 __raw_writel(val, OMAP_SDRC_REGADDR(reg));
44 static u32 __attribute__((unused)) sdrc_read_reg(u16 reg)
46 return __raw_readl(OMAP_SDRC_REGADDR(reg));
50 * These values represent the number of memory clock cycles between
51 * autorefresh initiation. They assume 1 refresh per 64 ms (JEDEC), 8192
52 * rows per device, and include a subtraction of a 50 cycle window in the
53 * event that the autorefresh command is delayed due to other SDRC activity.
54 * The '| 1' sets the ARE field to send one autorefresh when the autorefresh
57 * These represent optimal values for common parts, it won't work for all.
58 * As long as you scale down, most parameters are still work, they just
59 * become sub-optimal. The RFR value goes in the opposite direction. If you
60 * don't adjust it down as your clock period increases the refresh interval
61 * will not be met. Setting all parameters for complete worst case may work,
62 * but may cut memory performance by 2x. Due to errata the DLLs need to be
63 * unlocked and their value needs run time calibration. A dynamic call is
64 * need for that as no single right value exists acorss production samples.
66 * Only the FULL speed values are given. Current code is such that rate
67 * changes must be made at DPLLoutx2. The actual value adjustment for low
68 * frequency operation will be handled by omap_set_performance()
70 * By having the boot loader boot up in the fastest L4 speed available likely
71 * will result in something which you can switch between.
73 #define SDRC_RFR_CTRL_165MHz (0x00044c00 | 1)
74 #define SDRC_RFR_CTRL_133MHz (0x0003de00 | 1)
75 #define SDRC_RFR_CTRL_100MHz (0x0002da01 | 1)
76 #define SDRC_RFR_CTRL_110MHz (0x0002da01 | 1) /* Need to calc */
77 #define SDRC_RFR_CTRL_BYPASS (0x00005000 | 1) /* Need to calc */