diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-02 16:34:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-02 16:34:00 -0400 |
commit | 1810b6cb162e0c19e0ecbbacbcfd66f578f335ec (patch) | |
tree | 810494ca945483bf669a062d445d49d3bfb7d6a7 /arch/arm/mach-omap2/memory.c | |
parent | ef7a4567dc542d8cc563755478464ea928fede41 (diff) | |
parent | 9b6553cd01ce3ea7a6a532f7b7e62e3535d6b102 (diff) |
Merge master.kernel.org:/home/rmk/linux-2.6-arm
* master.kernel.org:/home/rmk/linux-2.6-arm: (27 commits)
[ARM] 3433/1: ARM: OMAP: 8/8 Update board files
[ARM] 3455/1: ARM: OMAP: 7/8 Misc updates, take 2
[ARM] 3454/1: ARM: OMAP: 6/8 Update framebuffer low-level init code, take 2
[ARM] 3430/1: ARM: OMAP: 5/8 Update PM
[ARM] 3429/1: ARM: OMAP: 4/8 Update GPIO
[ARM] 3428/1: ARM: OMAP: 3/8 Update pin multiplexing
[ARM] 3427/1: ARM: OMAP: 2/8 Update timers
[ARM] 3426/1: ARM: OMAP: 1/8 Update clock framework
[ARM] 3396/2: AT91RM9200 Platform devices update
[ARM] 3395/2: AT91RM9200 Dataflash Card vs MMC selection
[ARM] 3393/2: AT91RM9200 LED support
[ARM] 3453/1: Poodle: Correctly set the memory size
[ARM] 3446/1: i.MX: MMC/SD SDHC controller registration for i.MX/MX1 MX1ADS board
[ARM] 3444/1: i.MX: Scatter-gather DMA emulation for i.MX/MX1
[ARM] 3451/1: ep93xx: use the m48t86 rtc driver on the ts72xx platform
[ARM] 3450/1: ep93xx: use the ep93xx rtc driver
[ARM] 3452/1: [S3C2410] RX3715 - add nand information
[ARM] 3449/1: [S3C2410] Anubis - fix NAND timings
[ARM] 3448/1: [S3C2410] Settle delay when _enabling_ USB PLL
[ARM] 3442/1: [S3C2410] SMDK: NAND device setup
...
Diffstat (limited to 'arch/arm/mach-omap2/memory.c')
-rw-r--r-- | arch/arm/mach-omap2/memory.c | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/memory.c b/arch/arm/mach-omap2/memory.c new file mode 100644 index 000000000000..1d925d69fc35 --- /dev/null +++ b/arch/arm/mach-omap2/memory.c | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap2/memory.c | ||
3 | * | ||
4 | * Memory timing related functions for OMAP24XX | ||
5 | * | ||
6 | * Copyright (C) 2005 Texas Instruments Inc. | ||
7 | * Richard Woodruff <r-woodruff2@ti.com> | ||
8 | * | ||
9 | * Copyright (C) 2005 Nokia Corporation | ||
10 | * Tony Lindgren <tony@atomide.com> | ||
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 | |||
17 | #include <linux/config.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/device.h> | ||
21 | #include <linux/list.h> | ||
22 | #include <linux/errno.h> | ||
23 | #include <linux/delay.h> | ||
24 | #include <linux/clk.h> | ||
25 | |||
26 | #include <asm/io.h> | ||
27 | |||
28 | #include <asm/arch/clock.h> | ||
29 | #include <asm/arch/sram.h> | ||
30 | |||
31 | #include "prcm-regs.h" | ||
32 | #include "memory.h" | ||
33 | |||
34 | static struct memory_timings mem_timings; | ||
35 | |||
36 | u32 omap2_memory_get_slow_dll_ctrl(void) | ||
37 | { | ||
38 | return mem_timings.slow_dll_ctrl; | ||
39 | } | ||
40 | |||
41 | u32 omap2_memory_get_fast_dll_ctrl(void) | ||
42 | { | ||
43 | return mem_timings.fast_dll_ctrl; | ||
44 | } | ||
45 | |||
46 | u32 omap2_memory_get_type(void) | ||
47 | { | ||
48 | return mem_timings.m_type; | ||
49 | } | ||
50 | |||
51 | void omap2_init_memory_params(u32 force_lock_to_unlock_mode) | ||
52 | { | ||
53 | unsigned long dll_cnt; | ||
54 | u32 fast_dll = 0; | ||
55 | |||
56 | mem_timings.m_type = !((SDRC_MR_0 & 0x3) == 0x1); /* DDR = 1, SDR = 0 */ | ||
57 | |||
58 | /* 2422 es2.05 and beyond has a single SIP DDR instead of 2 like others. | ||
59 | * In the case of 2422, its ok to use CS1 instead of CS0. | ||
60 | */ | ||
61 | if (cpu_is_omap2422()) | ||
62 | mem_timings.base_cs = 1; | ||
63 | else | ||
64 | mem_timings.base_cs = 0; | ||
65 | |||
66 | if (mem_timings.m_type != M_DDR) | ||
67 | return; | ||
68 | |||
69 | /* With DDR we need to determine the low frequency DLL value */ | ||
70 | if (((mem_timings.fast_dll_ctrl & (1 << 2)) == M_LOCK_CTRL)) | ||
71 | mem_timings.dll_mode = M_UNLOCK; | ||
72 | else | ||
73 | mem_timings.dll_mode = M_LOCK; | ||
74 | |||
75 | if (mem_timings.base_cs == 0) { | ||
76 | fast_dll = SDRC_DLLA_CTRL; | ||
77 | dll_cnt = SDRC_DLLA_STATUS & 0xff00; | ||
78 | } else { | ||
79 | fast_dll = SDRC_DLLB_CTRL; | ||
80 | dll_cnt = SDRC_DLLB_STATUS & 0xff00; | ||
81 | } | ||
82 | if (force_lock_to_unlock_mode) { | ||
83 | fast_dll &= ~0xff00; | ||
84 | fast_dll |= dll_cnt; /* Current lock mode */ | ||
85 | } | ||
86 | /* set fast timings with DLL filter disabled */ | ||
87 | mem_timings.fast_dll_ctrl = (fast_dll | (3 << 8)); | ||
88 | |||
89 | /* No disruptions, DDR will be offline & C-ABI not followed */ | ||
90 | omap2_sram_ddr_init(&mem_timings.slow_dll_ctrl, | ||
91 | mem_timings.fast_dll_ctrl, | ||
92 | mem_timings.base_cs, | ||
93 | force_lock_to_unlock_mode); | ||
94 | mem_timings.slow_dll_ctrl &= 0xff00; /* Keep lock value */ | ||
95 | |||
96 | /* Turn status into unlock ctrl */ | ||
97 | mem_timings.slow_dll_ctrl |= | ||
98 | ((mem_timings.fast_dll_ctrl & 0xF) | (1 << 2)); | ||
99 | |||
100 | /* 90 degree phase for anything below 133Mhz + disable DLL filter */ | ||
101 | mem_timings.slow_dll_ctrl |= ((1 << 1) | (3 << 8)); | ||
102 | } | ||