This source file includes following definitions.
- sa1100_update_dram_timings
- sa1100_target
- sa1100_cpu_init
- sa1100_dram_init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70 #include <linux/kernel.h>
71 #include <linux/types.h>
72 #include <linux/init.h>
73 #include <linux/cpufreq.h>
74 #include <linux/io.h>
75
76 #include <asm/cputype.h>
77
78 #include <mach/generic.h>
79 #include <mach/hardware.h>
80
81 struct sa1100_dram_regs {
82 int speed;
83 u32 mdcnfg;
84 u32 mdcas0;
85 u32 mdcas1;
86 u32 mdcas2;
87 };
88
89
90 static struct cpufreq_driver sa1100_driver;
91
92 static struct sa1100_dram_regs sa1100_dram_settings[] = {
93
94 { 59000, 0x00dc88a3, 0xcccccccf, 0xfffffffc, 0xffffffff},
95 { 73700, 0x011490a3, 0xcccccccf, 0xfffffffc, 0xffffffff},
96 { 88500, 0x014e90a3, 0xcccccccf, 0xfffffffc, 0xffffffff},
97 {103200, 0x01889923, 0xcccccccf, 0xfffffffc, 0xffffffff},
98 {118000, 0x01c29923, 0x9999998f, 0xfffffff9, 0xffffffff},
99 {132700, 0x01fb2123, 0x9999998f, 0xfffffff9, 0xffffffff},
100 {147500, 0x02352123, 0x3333330f, 0xfffffff3, 0xffffffff},
101 {162200, 0x026b29a3, 0x38e38e1f, 0xfff8e38e, 0xffffffff},
102 {176900, 0x02a329a3, 0x71c71c1f, 0xfff1c71c, 0xffffffff},
103 {191700, 0x02dd31a3, 0xe38e383f, 0xffe38e38, 0xffffffff},
104 {206400, 0x03153223, 0xc71c703f, 0xffc71c71, 0xffffffff},
105 {221200, 0x034fba23, 0xc71c703f, 0xffc71c71, 0xffffffff},
106 {235900, 0x03853a23, 0xe1e1e07f, 0xe1e1e1e1, 0xffffffe1},
107 {250700, 0x03bf3aa3, 0xc3c3c07f, 0xc3c3c3c3, 0xffffffc3},
108 {265400, 0x03f7c2a3, 0xc3c3c07f, 0xc3c3c3c3, 0xffffffc3},
109 {280200, 0x0431c2a3, 0x878780ff, 0x87878787, 0xffffff87},
110 { 0, 0, 0, 0, 0 }
111 };
112
113 static void sa1100_update_dram_timings(int current_speed, int new_speed)
114 {
115 struct sa1100_dram_regs *settings = sa1100_dram_settings;
116
117
118 while (settings->speed != 0) {
119 if (new_speed == settings->speed)
120 break;
121
122 settings++;
123 }
124
125 if (settings->speed == 0) {
126 panic("%s: couldn't find dram setting for speed %d\n",
127 __func__, new_speed);
128 }
129
130
131 if (new_speed > current_speed) {
132
133
134
135
136
137 MDCNFG |= MDCNFG_CDB2;
138
139
140
141
142 MDCAS2 = settings->mdcas2;
143 MDCAS1 = settings->mdcas1;
144 MDCAS0 = settings->mdcas0;
145 MDCNFG = settings->mdcnfg;
146 } else {
147
148
149
150
151
152 MDCNFG |= MDCNFG_CDB2;
153
154
155
156
157 MDCAS0 = settings->mdcas0;
158 MDCAS1 = settings->mdcas1;
159 MDCAS2 = settings->mdcas2;
160 MDCNFG = settings->mdcnfg;
161 }
162 }
163
164 static int sa1100_target(struct cpufreq_policy *policy, unsigned int ppcr)
165 {
166 unsigned int cur = sa11x0_getspeed(0);
167 unsigned int new_freq;
168
169 new_freq = sa11x0_freq_table[ppcr].frequency;
170
171 if (new_freq > cur)
172 sa1100_update_dram_timings(cur, new_freq);
173
174 PPCR = ppcr;
175
176 if (new_freq < cur)
177 sa1100_update_dram_timings(cur, new_freq);
178
179 return 0;
180 }
181
182 static int __init sa1100_cpu_init(struct cpufreq_policy *policy)
183 {
184 cpufreq_generic_init(policy, sa11x0_freq_table, 0);
185 return 0;
186 }
187
188 static struct cpufreq_driver sa1100_driver __refdata = {
189 .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK |
190 CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING,
191 .verify = cpufreq_generic_frequency_table_verify,
192 .target_index = sa1100_target,
193 .get = sa11x0_getspeed,
194 .init = sa1100_cpu_init,
195 .name = "sa1100",
196 };
197
198 static int __init sa1100_dram_init(void)
199 {
200 if (cpu_is_sa1100())
201 return cpufreq_register_driver(&sa1100_driver);
202 else
203 return -ENODEV;
204 }
205
206 arch_initcall(sa1100_dram_init);