diff options
Diffstat (limited to 'arch/arm/plat-omap')
84 files changed, 13823 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c new file mode 100644 index 00000000000..3ba4d11ca73 --- /dev/null +++ b/arch/arm/plat-omap/clock.c | |||
@@ -0,0 +1,594 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/plat-omap/clock.c | ||
3 | * | ||
4 | * Copyright (C) 2004 - 2008 Nokia corporation | ||
5 | * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> | ||
6 | * | ||
7 | * Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/list.h> | ||
16 | #include <linux/errno.h> | ||
17 | #include <linux/err.h> | ||
18 | #include <linux/string.h> | ||
19 | #include <linux/clk.h> | ||
20 | #include <linux/mutex.h> | ||
21 | #include <linux/cpufreq.h> | ||
22 | #include <linux/debugfs.h> | ||
23 | #include <linux/io.h> | ||
24 | |||
25 | #include <plat/clock.h> | ||
26 | |||
27 | static LIST_HEAD(clocks); | ||
28 | static DEFINE_MUTEX(clocks_mutex); | ||
29 | static DEFINE_SPINLOCK(clockfw_lock); | ||
30 | |||
31 | static struct clk_functions *arch_clock; | ||
32 | |||
33 | /* | ||
34 | * Standard clock functions defined in include/linux/clk.h | ||
35 | */ | ||
36 | |||
37 | int clk_enable(struct clk *clk) | ||
38 | { | ||
39 | unsigned long flags; | ||
40 | int ret; | ||
41 | |||
42 | if (clk == NULL || IS_ERR(clk)) | ||
43 | return -EINVAL; | ||
44 | |||
45 | if (!arch_clock || !arch_clock->clk_enable) | ||
46 | return -EINVAL; | ||
47 | |||
48 | spin_lock_irqsave(&clockfw_lock, flags); | ||
49 | ret = arch_clock->clk_enable(clk); | ||
50 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
51 | |||
52 | return ret; | ||
53 | } | ||
54 | EXPORT_SYMBOL(clk_enable); | ||
55 | |||
56 | void clk_disable(struct clk *clk) | ||
57 | { | ||
58 | unsigned long flags; | ||
59 | |||
60 | if (clk == NULL || IS_ERR(clk)) | ||
61 | return; | ||
62 | |||
63 | if (!arch_clock || !arch_clock->clk_disable) | ||
64 | return; | ||
65 | |||
66 | spin_lock_irqsave(&clockfw_lock, flags); | ||
67 | if (clk->usecount == 0) { | ||
68 | pr_err("Trying disable clock %s with 0 usecount\n", | ||
69 | clk->name); | ||
70 | WARN_ON(1); | ||
71 | goto out; | ||
72 | } | ||
73 | |||
74 | arch_clock->clk_disable(clk); | ||
75 | |||
76 | out: | ||
77 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
78 | } | ||
79 | EXPORT_SYMBOL(clk_disable); | ||
80 | |||
81 | unsigned long clk_get_rate(struct clk *clk) | ||
82 | { | ||
83 | unsigned long flags; | ||
84 | unsigned long ret; | ||
85 | |||
86 | if (clk == NULL || IS_ERR(clk)) | ||
87 | return 0; | ||
88 | |||
89 | spin_lock_irqsave(&clockfw_lock, flags); | ||
90 | ret = clk->rate; | ||
91 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
92 | |||
93 | return ret; | ||
94 | } | ||
95 | EXPORT_SYMBOL(clk_get_rate); | ||
96 | |||
97 | /* | ||
98 | * Optional clock functions defined in include/linux/clk.h | ||
99 | */ | ||
100 | |||
101 | long clk_round_rate(struct clk *clk, unsigned long rate) | ||
102 | { | ||
103 | unsigned long flags; | ||
104 | long ret; | ||
105 | |||
106 | if (clk == NULL || IS_ERR(clk)) | ||
107 | return 0; | ||
108 | |||
109 | if (!arch_clock || !arch_clock->clk_round_rate) | ||
110 | return 0; | ||
111 | |||
112 | spin_lock_irqsave(&clockfw_lock, flags); | ||
113 | ret = arch_clock->clk_round_rate(clk, rate); | ||
114 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
115 | |||
116 | return ret; | ||
117 | } | ||
118 | EXPORT_SYMBOL(clk_round_rate); | ||
119 | |||
120 | int clk_set_rate(struct clk *clk, unsigned long rate) | ||
121 | { | ||
122 | unsigned long flags; | ||
123 | int ret = -EINVAL; | ||
124 | |||
125 | if (clk == NULL || IS_ERR(clk)) | ||
126 | return ret; | ||
127 | |||
128 | if (!arch_clock || !arch_clock->clk_set_rate) | ||
129 | return ret; | ||
130 | |||
131 | spin_lock_irqsave(&clockfw_lock, flags); | ||
132 | ret = arch_clock->clk_set_rate(clk, rate); | ||
133 | if (ret == 0) | ||
134 | propagate_rate(clk); | ||
135 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
136 | |||
137 | return ret; | ||
138 | } | ||
139 | EXPORT_SYMBOL(clk_set_rate); | ||
140 | |||
141 | int clk_set_parent(struct clk *clk, struct clk *parent) | ||
142 | { | ||
143 | unsigned long flags; | ||
144 | int ret = -EINVAL; | ||
145 | |||
146 | if (clk == NULL || IS_ERR(clk) || parent == NULL || IS_ERR(parent)) | ||
147 | return ret; | ||
148 | |||
149 | if (!arch_clock || !arch_clock->clk_set_parent) | ||
150 | return ret; | ||
151 | |||
152 | spin_lock_irqsave(&clockfw_lock, flags); | ||
153 | if (clk->usecount == 0) { | ||
154 | ret = arch_clock->clk_set_parent(clk, parent); | ||
155 | if (ret == 0) | ||
156 | propagate_rate(clk); | ||
157 | } else | ||
158 | ret = -EBUSY; | ||
159 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
160 | |||
161 | return ret; | ||
162 | } | ||
163 | EXPORT_SYMBOL(clk_set_parent); | ||
164 | |||
165 | struct clk *clk_get_parent(struct clk *clk) | ||
166 | { | ||
167 | return clk->parent; | ||
168 | } | ||
169 | EXPORT_SYMBOL(clk_get_parent); | ||
170 | |||
171 | /* | ||
172 | * OMAP specific clock functions shared between omap1 and omap2 | ||
173 | */ | ||
174 | |||
175 | int __initdata mpurate; | ||
176 | |||
177 | /* | ||
178 | * By default we use the rate set by the bootloader. | ||
179 | * You can override this with mpurate= cmdline option. | ||
180 | */ | ||
181 | static int __init omap_clk_setup(char *str) | ||
182 | { | ||
183 | get_option(&str, &mpurate); | ||
184 | |||
185 | if (!mpurate) | ||
186 | return 1; | ||
187 | |||
188 | if (mpurate < 1000) | ||
189 | mpurate *= 1000000; | ||
190 | |||
191 | return 1; | ||
192 | } | ||
193 | __setup("mpurate=", omap_clk_setup); | ||
194 | |||
195 | /* Used for clocks that always have same value as the parent clock */ | ||
196 | unsigned long followparent_recalc(struct clk *clk) | ||
197 | { | ||
198 | return clk->parent->rate; | ||
199 | } | ||
200 | |||
201 | /* | ||
202 | * Used for clocks that have the same value as the parent clock, | ||
203 | * divided by some factor | ||
204 | */ | ||
205 | unsigned long omap_fixed_divisor_recalc(struct clk *clk) | ||
206 | { | ||
207 | WARN_ON(!clk->fixed_div); | ||
208 | |||
209 | return clk->parent->rate / clk->fixed_div; | ||
210 | } | ||
211 | |||
212 | void clk_reparent(struct clk *child, struct clk *parent) | ||
213 | { | ||
214 | list_del_init(&child->sibling); | ||
215 | if (parent) | ||
216 | list_add(&child->sibling, &parent->children); | ||
217 | child->parent = parent; | ||
218 | |||
219 | /* now do the debugfs renaming to reattach the child | ||
220 | to the proper parent */ | ||
221 | } | ||
222 | |||
223 | /* Propagate rate to children */ | ||
224 | void propagate_rate(struct clk *tclk) | ||
225 | { | ||
226 | struct clk *clkp; | ||
227 | |||
228 | list_for_each_entry(clkp, &tclk->children, sibling) { | ||
229 | if (clkp->recalc) | ||
230 | clkp->rate = clkp->recalc(clkp); | ||
231 | propagate_rate(clkp); | ||
232 | } | ||
233 | } | ||
234 | |||
235 | static LIST_HEAD(root_clks); | ||
236 | |||
237 | /** | ||
238 | * recalculate_root_clocks - recalculate and propagate all root clocks | ||
239 | * | ||
240 | * Recalculates all root clocks (clocks with no parent), which if the | ||
241 | * clock's .recalc is set correctly, should also propagate their rates. | ||
242 | * Called at init. | ||
243 | */ | ||
244 | void recalculate_root_clocks(void) | ||
245 | { | ||
246 | struct clk *clkp; | ||
247 | |||
248 | list_for_each_entry(clkp, &root_clks, sibling) { | ||
249 | if (clkp->recalc) | ||
250 | clkp->rate = clkp->recalc(clkp); | ||
251 | propagate_rate(clkp); | ||
252 | } | ||
253 | } | ||
254 | |||
255 | /** | ||
256 | * clk_preinit - initialize any fields in the struct clk before clk init | ||
257 | * @clk: struct clk * to initialize | ||
258 | * | ||
259 | * Initialize any struct clk fields needed before normal clk initialization | ||
260 | * can run. No return value. | ||
261 | */ | ||
262 | void clk_preinit(struct clk *clk) | ||
263 | { | ||
264 | INIT_LIST_HEAD(&clk->children); | ||
265 | } | ||
266 | |||
267 | int clk_register(struct clk *clk) | ||
268 | { | ||
269 | if (clk == NULL || IS_ERR(clk)) | ||
270 | return -EINVAL; | ||
271 | |||
272 | /* | ||
273 | * trap out already registered clocks | ||
274 | */ | ||
275 | if (clk->node.next || clk->node.prev) | ||
276 | return 0; | ||
277 | |||
278 | mutex_lock(&clocks_mutex); | ||
279 | if (clk->parent) | ||
280 | list_add(&clk->sibling, &clk->parent->children); | ||
281 | else | ||
282 | list_add(&clk->sibling, &root_clks); | ||
283 | |||
284 | list_add(&clk->node, &clocks); | ||
285 | if (clk->init) | ||
286 | clk->init(clk); | ||
287 | mutex_unlock(&clocks_mutex); | ||
288 | |||
289 | return 0; | ||
290 | } | ||
291 | EXPORT_SYMBOL(clk_register); | ||
292 | |||
293 | void clk_unregister(struct clk *clk) | ||
294 | { | ||
295 | if (clk == NULL || IS_ERR(clk)) | ||
296 | return; | ||
297 | |||
298 | mutex_lock(&clocks_mutex); | ||
299 | list_del(&clk->sibling); | ||
300 | list_del(&clk->node); | ||
301 | mutex_unlock(&clocks_mutex); | ||
302 | } | ||
303 | EXPORT_SYMBOL(clk_unregister); | ||
304 | |||
305 | void clk_enable_init_clocks(void) | ||
306 | { | ||
307 | struct clk *clkp; | ||
308 | |||
309 | list_for_each_entry(clkp, &clocks, node) { | ||
310 | if (clkp->flags & ENABLE_ON_INIT) | ||
311 | clk_enable(clkp); | ||
312 | } | ||
313 | } | ||
314 | |||
315 | /** | ||
316 | * omap_clk_get_by_name - locate OMAP struct clk by its name | ||
317 | * @name: name of the struct clk to locate | ||
318 | * | ||
319 | * Locate an OMAP struct clk by its name. Assumes that struct clk | ||
320 | * names are unique. Returns NULL if not found or a pointer to the | ||
321 | * struct clk if found. | ||
322 | */ | ||
323 | struct clk *omap_clk_get_by_name(const char *name) | ||
324 | { | ||
325 | struct clk *c; | ||
326 | struct clk *ret = NULL; | ||
327 | |||
328 | mutex_lock(&clocks_mutex); | ||
329 | |||
330 | list_for_each_entry(c, &clocks, node) { | ||
331 | if (!strcmp(c->name, name)) { | ||
332 | ret = c; | ||
333 | break; | ||
334 | } | ||
335 | } | ||
336 | |||
337 | mutex_unlock(&clocks_mutex); | ||
338 | |||
339 | return ret; | ||
340 | } | ||
341 | |||
342 | int omap_clk_enable_autoidle_all(void) | ||
343 | { | ||
344 | struct clk *c; | ||
345 | unsigned long flags; | ||
346 | |||
347 | spin_lock_irqsave(&clockfw_lock, flags); | ||
348 | |||
349 | list_for_each_entry(c, &clocks, node) | ||
350 | if (c->ops->allow_idle) | ||
351 | c->ops->allow_idle(c); | ||
352 | |||
353 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
354 | |||
355 | return 0; | ||
356 | } | ||
357 | |||
358 | int omap_clk_disable_autoidle_all(void) | ||
359 | { | ||
360 | struct clk *c; | ||
361 | unsigned long flags; | ||
362 | |||
363 | spin_lock_irqsave(&clockfw_lock, flags); | ||
364 | |||
365 | list_for_each_entry(c, &clocks, node) | ||
366 | if (c->ops->deny_idle) | ||
367 | c->ops->deny_idle(c); | ||
368 | |||
369 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
370 | |||
371 | return 0; | ||
372 | } | ||
373 | |||
374 | /* | ||
375 | * Low level helpers | ||
376 | */ | ||
377 | static int clkll_enable_null(struct clk *clk) | ||
378 | { | ||
379 | return 0; | ||
380 | } | ||
381 | |||
382 | static void clkll_disable_null(struct clk *clk) | ||
383 | { | ||
384 | } | ||
385 | |||
386 | const struct clkops clkops_null = { | ||
387 | .enable = clkll_enable_null, | ||
388 | .disable = clkll_disable_null, | ||
389 | }; | ||
390 | |||
391 | /* | ||
392 | * Dummy clock | ||
393 | * | ||
394 | * Used for clock aliases that are needed on some OMAPs, but not others | ||
395 | */ | ||
396 | struct clk dummy_ck = { | ||
397 | .name = "dummy", | ||
398 | .ops = &clkops_null, | ||
399 | }; | ||
400 | |||
401 | #ifdef CONFIG_CPU_FREQ | ||
402 | void clk_init_cpufreq_table(struct cpufreq_frequency_table **table) | ||
403 | { | ||
404 | unsigned long flags; | ||
405 | |||
406 | if (!arch_clock || !arch_clock->clk_init_cpufreq_table) | ||
407 | return; | ||
408 | |||
409 | spin_lock_irqsave(&clockfw_lock, flags); | ||
410 | arch_clock->clk_init_cpufreq_table(table); | ||
411 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
412 | } | ||
413 | |||
414 | void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table) | ||
415 | { | ||
416 | unsigned long flags; | ||
417 | |||
418 | if (!arch_clock || !arch_clock->clk_exit_cpufreq_table) | ||
419 | return; | ||
420 | |||
421 | spin_lock_irqsave(&clockfw_lock, flags); | ||
422 | arch_clock->clk_exit_cpufreq_table(table); | ||
423 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
424 | } | ||
425 | #endif | ||
426 | |||
427 | /* | ||
428 | * | ||
429 | */ | ||
430 | |||
431 | #ifdef CONFIG_OMAP_RESET_CLOCKS | ||
432 | /* | ||
433 | * Disable any unused clocks left on by the bootloader | ||
434 | */ | ||
435 | static int __init clk_disable_unused(void) | ||
436 | { | ||
437 | struct clk *ck; | ||
438 | unsigned long flags; | ||
439 | |||
440 | if (!arch_clock || !arch_clock->clk_disable_unused) | ||
441 | return 0; | ||
442 | |||
443 | pr_info("clock: disabling unused clocks to save power\n"); | ||
444 | list_for_each_entry(ck, &clocks, node) { | ||
445 | if (ck->ops == &clkops_null) | ||
446 | continue; | ||
447 | |||
448 | if (ck->usecount > 0 || !ck->enable_reg) | ||
449 | continue; | ||
450 | |||
451 | spin_lock_irqsave(&clockfw_lock, flags); | ||
452 | arch_clock->clk_disable_unused(ck); | ||
453 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
454 | } | ||
455 | |||
456 | return 0; | ||
457 | } | ||
458 | late_initcall(clk_disable_unused); | ||
459 | late_initcall(omap_clk_enable_autoidle_all); | ||
460 | #endif | ||
461 | |||
462 | int __init clk_init(struct clk_functions * custom_clocks) | ||
463 | { | ||
464 | if (!custom_clocks) { | ||
465 | pr_err("No custom clock functions registered\n"); | ||
466 | BUG(); | ||
467 | } | ||
468 | |||
469 | arch_clock = custom_clocks; | ||
470 | |||
471 | return 0; | ||
472 | } | ||
473 | |||
474 | #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) | ||
475 | /* | ||
476 | * debugfs support to trace clock tree hierarchy and attributes | ||
477 | */ | ||
478 | |||
479 | #include <linux/debugfs.h> | ||
480 | #include <linux/seq_file.h> | ||
481 | |||
482 | static struct dentry *clk_debugfs_root; | ||
483 | |||
484 | static int clk_dbg_show_summary(struct seq_file *s, void *unused) | ||
485 | { | ||
486 | struct clk *c; | ||
487 | struct clk *pa; | ||
488 | |||
489 | seq_printf(s, "%-30s %-30s %-10s %s\n", | ||
490 | "clock-name", "parent-name", "rate", "use-count"); | ||
491 | |||
492 | list_for_each_entry(c, &clocks, node) { | ||
493 | pa = c->parent; | ||
494 | seq_printf(s, "%-30s %-30s %-10lu %d\n", | ||
495 | c->name, pa ? pa->name : "none", c->rate, c->usecount); | ||
496 | } | ||
497 | |||
498 | return 0; | ||
499 | } | ||
500 | |||
501 | static int clk_dbg_open(struct inode *inode, struct file *file) | ||
502 | { | ||
503 | return single_open(file, clk_dbg_show_summary, inode->i_private); | ||
504 | } | ||
505 | |||
506 | static const struct file_operations debug_clock_fops = { | ||
507 | .open = clk_dbg_open, | ||
508 | .read = seq_read, | ||
509 | .llseek = seq_lseek, | ||
510 | .release = single_release, | ||
511 | }; | ||
512 | |||
513 | static int clk_debugfs_register_one(struct clk *c) | ||
514 | { | ||
515 | int err; | ||
516 | struct dentry *d; | ||
517 | struct clk *pa = c->parent; | ||
518 | |||
519 | d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root); | ||
520 | if (!d) | ||
521 | return -ENOMEM; | ||
522 | c->dent = d; | ||
523 | |||
524 | d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount); | ||
525 | if (!d) { | ||
526 | err = -ENOMEM; | ||
527 | goto err_out; | ||
528 | } | ||
529 | d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate); | ||
530 | if (!d) { | ||
531 | err = -ENOMEM; | ||
532 | goto err_out; | ||
533 | } | ||
534 | d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags); | ||
535 | if (!d) { | ||
536 | err = -ENOMEM; | ||
537 | goto err_out; | ||
538 | } | ||
539 | return 0; | ||
540 | |||
541 | err_out: | ||
542 | debugfs_remove_recursive(c->dent); | ||
543 | return err; | ||
544 | } | ||
545 | |||
546 | static int clk_debugfs_register(struct clk *c) | ||
547 | { | ||
548 | int err; | ||
549 | struct clk *pa = c->parent; | ||
550 | |||
551 | if (pa && !pa->dent) { | ||
552 | err = clk_debugfs_register(pa); | ||
553 | if (err) | ||
554 | return err; | ||
555 | } | ||
556 | |||
557 | if (!c->dent) { | ||
558 | err = clk_debugfs_register_one(c); | ||
559 | if (err) | ||
560 | return err; | ||
561 | } | ||
562 | return 0; | ||
563 | } | ||
564 | |||
565 | static int __init clk_debugfs_init(void) | ||
566 | { | ||
567 | struct clk *c; | ||
568 | struct dentry *d; | ||
569 | int err; | ||
570 | |||
571 | d = debugfs_create_dir("clock", NULL); | ||
572 | if (!d) | ||
573 | return -ENOMEM; | ||
574 | clk_debugfs_root = d; | ||
575 | |||
576 | list_for_each_entry(c, &clocks, node) { | ||
577 | err = clk_debugfs_register(c); | ||
578 | if (err) | ||
579 | goto err_out; | ||
580 | } | ||
581 | |||
582 | d = debugfs_create_file("summary", S_IRUGO, | ||
583 | d, NULL, &debug_clock_fops); | ||
584 | if (!d) | ||
585 | return -ENOMEM; | ||
586 | |||
587 | return 0; | ||
588 | err_out: | ||
589 | debugfs_remove_recursive(clk_debugfs_root); | ||
590 | return err; | ||
591 | } | ||
592 | late_initcall(clk_debugfs_init); | ||
593 | |||
594 | #endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */ | ||
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c new file mode 100644 index 00000000000..d9f10a31e60 --- /dev/null +++ b/arch/arm/plat-omap/common.c | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/plat-omap/common.c | ||
3 | * | ||
4 | * Code common to all OMAP machines. | ||
5 | * The file is created by Tony Lindgren <tony@atomide.com> | ||
6 | * | ||
7 | * Copyright (C) 2009 Texas Instruments | ||
8 | * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/omapfb.h> | ||
18 | |||
19 | #include <plat/common.h> | ||
20 | #include <plat/board.h> | ||
21 | #include <plat/vram.h> | ||
22 | #include <plat/dsp.h> | ||
23 | |||
24 | |||
25 | #define NO_LENGTH_CHECK 0xffffffff | ||
26 | |||
27 | struct omap_board_config_kernel *omap_board_config __initdata; | ||
28 | int omap_board_config_size; | ||
29 | |||
30 | static const void *__init get_config(u16 tag, size_t len, | ||
31 | int skip, size_t *len_out) | ||
32 | { | ||
33 | struct omap_board_config_kernel *kinfo = NULL; | ||
34 | int i; | ||
35 | |||
36 | /* Try to find the config from the board-specific structures | ||
37 | * in the kernel. */ | ||
38 | for (i = 0; i < omap_board_config_size; i++) { | ||
39 | if (omap_board_config[i].tag == tag) { | ||
40 | if (skip == 0) { | ||
41 | kinfo = &omap_board_config[i]; | ||
42 | break; | ||
43 | } else { | ||
44 | skip--; | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | if (kinfo == NULL) | ||
49 | return NULL; | ||
50 | return kinfo->data; | ||
51 | } | ||
52 | |||
53 | const void *__init __omap_get_config(u16 tag, size_t len, int nr) | ||
54 | { | ||
55 | return get_config(tag, len, nr, NULL); | ||
56 | } | ||
57 | |||
58 | const void *__init omap_get_var_config(u16 tag, size_t *len) | ||
59 | { | ||
60 | return get_config(tag, NO_LENGTH_CHECK, 0, len); | ||
61 | } | ||
62 | |||
63 | void __init omap_reserve(void) | ||
64 | { | ||
65 | omapfb_reserve_sdram_memblock(); | ||
66 | omap_vram_reserve_sdram_memblock(); | ||
67 | omap_dsp_reserve_sdram_memblock(); | ||
68 | } | ||
diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c new file mode 100644 index 00000000000..da4f68dbba1 --- /dev/null +++ b/arch/arm/plat-omap/cpu-omap.c | |||
@@ -0,0 +1,171 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/plat-omap/cpu-omap.c | ||
3 | * | ||
4 | * CPU frequency scaling for OMAP | ||
5 | * | ||
6 | * Copyright (C) 2005 Nokia Corporation | ||
7 | * Written by Tony Lindgren <tony@atomide.com> | ||
8 | * | ||
9 | * Based on cpu-sa1110.c, Copyright (C) 2001 Russell King | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/sched.h> | ||
18 | #include <linux/cpufreq.h> | ||
19 | #include <linux/delay.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/err.h> | ||
22 | #include <linux/clk.h> | ||
23 | #include <linux/io.h> | ||
24 | |||
25 | #include <mach/hardware.h> | ||
26 | #include <plat/clock.h> | ||
27 | #include <asm/system.h> | ||
28 | |||
29 | #define VERY_HI_RATE 900000000 | ||
30 | |||
31 | static struct cpufreq_frequency_table *freq_table; | ||
32 | |||
33 | #ifdef CONFIG_ARCH_OMAP1 | ||
34 | #define MPU_CLK "mpu" | ||
35 | #else | ||
36 | #define MPU_CLK "virt_prcm_set" | ||
37 | #endif | ||
38 | |||
39 | static struct clk *mpu_clk; | ||
40 | |||
41 | /* TODO: Add support for SDRAM timing changes */ | ||
42 | |||
43 | static int omap_verify_speed(struct cpufreq_policy *policy) | ||
44 | { | ||
45 | if (freq_table) | ||
46 | return cpufreq_frequency_table_verify(policy, freq_table); | ||
47 | |||
48 | if (policy->cpu) | ||
49 | return -EINVAL; | ||
50 | |||
51 | cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, | ||
52 | policy->cpuinfo.max_freq); | ||
53 | |||
54 | policy->min = clk_round_rate(mpu_clk, policy->min * 1000) / 1000; | ||
55 | policy->max = clk_round_rate(mpu_clk, policy->max * 1000) / 1000; | ||
56 | cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, | ||
57 | policy->cpuinfo.max_freq); | ||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | static unsigned int omap_getspeed(unsigned int cpu) | ||
62 | { | ||
63 | unsigned long rate; | ||
64 | |||
65 | if (cpu) | ||
66 | return 0; | ||
67 | |||
68 | rate = clk_get_rate(mpu_clk) / 1000; | ||
69 | return rate; | ||
70 | } | ||
71 | |||
72 | static int omap_target(struct cpufreq_policy *policy, | ||
73 | unsigned int target_freq, | ||
74 | unsigned int relation) | ||
75 | { | ||
76 | struct cpufreq_freqs freqs; | ||
77 | int ret = 0; | ||
78 | |||
79 | /* Ensure desired rate is within allowed range. Some govenors | ||
80 | * (ondemand) will just pass target_freq=0 to get the minimum. */ | ||
81 | if (target_freq < policy->min) | ||
82 | target_freq = policy->min; | ||
83 | if (target_freq > policy->max) | ||
84 | target_freq = policy->max; | ||
85 | |||
86 | freqs.old = omap_getspeed(0); | ||
87 | freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000; | ||
88 | freqs.cpu = 0; | ||
89 | |||
90 | if (freqs.old == freqs.new) | ||
91 | return ret; | ||
92 | |||
93 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
94 | #ifdef CONFIG_CPU_FREQ_DEBUG | ||
95 | printk(KERN_DEBUG "cpufreq-omap: transition: %u --> %u\n", | ||
96 | freqs.old, freqs.new); | ||
97 | #endif | ||
98 | ret = clk_set_rate(mpu_clk, freqs.new * 1000); | ||
99 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
100 | |||
101 | return ret; | ||
102 | } | ||
103 | |||
104 | static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy) | ||
105 | { | ||
106 | int result = 0; | ||
107 | |||
108 | mpu_clk = clk_get(NULL, MPU_CLK); | ||
109 | if (IS_ERR(mpu_clk)) | ||
110 | return PTR_ERR(mpu_clk); | ||
111 | |||
112 | if (policy->cpu != 0) | ||
113 | return -EINVAL; | ||
114 | |||
115 | policy->cur = policy->min = policy->max = omap_getspeed(0); | ||
116 | |||
117 | clk_init_cpufreq_table(&freq_table); | ||
118 | if (freq_table) { | ||
119 | result = cpufreq_frequency_table_cpuinfo(policy, freq_table); | ||
120 | if (!result) | ||
121 | cpufreq_frequency_table_get_attr(freq_table, | ||
122 | policy->cpu); | ||
123 | } else { | ||
124 | policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000; | ||
125 | policy->cpuinfo.max_freq = clk_round_rate(mpu_clk, | ||
126 | VERY_HI_RATE) / 1000; | ||
127 | } | ||
128 | |||
129 | /* FIXME: what's the actual transition time? */ | ||
130 | policy->cpuinfo.transition_latency = 300 * 1000; | ||
131 | |||
132 | return 0; | ||
133 | } | ||
134 | |||
135 | static int omap_cpu_exit(struct cpufreq_policy *policy) | ||
136 | { | ||
137 | clk_exit_cpufreq_table(&freq_table); | ||
138 | clk_put(mpu_clk); | ||
139 | return 0; | ||
140 | } | ||
141 | |||
142 | static struct freq_attr *omap_cpufreq_attr[] = { | ||
143 | &cpufreq_freq_attr_scaling_available_freqs, | ||
144 | NULL, | ||
145 | }; | ||
146 | |||
147 | static struct cpufreq_driver omap_driver = { | ||
148 | .flags = CPUFREQ_STICKY, | ||
149 | .verify = omap_verify_speed, | ||
150 | .target = omap_target, | ||
151 | .get = omap_getspeed, | ||
152 | .init = omap_cpu_init, | ||
153 | .exit = omap_cpu_exit, | ||
154 | .name = "omap", | ||
155 | .attr = omap_cpufreq_attr, | ||
156 | }; | ||
157 | |||
158 | static int __init omap_cpufreq_init(void) | ||
159 | { | ||
160 | return cpufreq_register_driver(&omap_driver); | ||
161 | } | ||
162 | |||
163 | arch_initcall(omap_cpufreq_init); | ||
164 | |||
165 | /* | ||
166 | * if ever we want to remove this, upon cleanup call: | ||
167 | * | ||
168 | * cpufreq_unregister_driver() | ||
169 | * cpufreq_frequency_table_put_attr() | ||
170 | */ | ||
171 | |||
diff --git a/arch/arm/plat-omap/debug-devices.c b/arch/arm/plat-omap/debug-devices.c new file mode 100644 index 00000000000..923c9621096 --- /dev/null +++ b/arch/arm/plat-omap/debug-devices.c | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/plat-omap/debug-devices.c | ||
3 | * | ||
4 | * Copyright (C) 2005 Nokia Corporation | ||
5 | * Modified from mach-omap2/board-h4.c | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/smc91x.h> | ||
17 | |||
18 | #include <mach/hardware.h> | ||
19 | |||
20 | #include <plat/board.h> | ||
21 | #include <mach/gpio.h> | ||
22 | |||
23 | |||
24 | /* Many OMAP development platforms reuse the same "debug board"; these | ||
25 | * platforms include H2, H3, H4, and Perseus2. | ||
26 | */ | ||
27 | |||
28 | static struct smc91x_platdata smc91x_info = { | ||
29 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, | ||
30 | .leda = RPC_LED_100_10, | ||
31 | .ledb = RPC_LED_TX_RX, | ||
32 | }; | ||
33 | |||
34 | static struct resource smc91x_resources[] = { | ||
35 | [0] = { | ||
36 | .flags = IORESOURCE_MEM, | ||
37 | }, | ||
38 | [1] = { | ||
39 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, | ||
40 | }, | ||
41 | }; | ||
42 | |||
43 | static struct platform_device smc91x_device = { | ||
44 | .name = "smc91x", | ||
45 | .id = -1, | ||
46 | .dev = { | ||
47 | .platform_data = &smc91x_info, | ||
48 | }, | ||
49 | .num_resources = ARRAY_SIZE(smc91x_resources), | ||
50 | .resource = smc91x_resources, | ||
51 | }; | ||
52 | |||
53 | static struct resource led_resources[] = { | ||
54 | [0] = { | ||
55 | .flags = IORESOURCE_MEM, | ||
56 | }, | ||
57 | }; | ||
58 | |||
59 | static struct platform_device led_device = { | ||
60 | .name = "omap_dbg_led", | ||
61 | .id = -1, | ||
62 | .num_resources = ARRAY_SIZE(led_resources), | ||
63 | .resource = led_resources, | ||
64 | }; | ||
65 | |||
66 | static struct platform_device *debug_devices[] __initdata = { | ||
67 | &smc91x_device, | ||
68 | &led_device, | ||
69 | /* ps2 kbd + mouse ports */ | ||
70 | /* 4 extra uarts */ | ||
71 | /* 6 input dip switches */ | ||
72 | /* 8 output pins */ | ||
73 | }; | ||
74 | |||
75 | int __init debug_card_init(u32 addr, unsigned gpio) | ||
76 | { | ||
77 | int status; | ||
78 | |||
79 | smc91x_resources[0].start = addr + 0x300; | ||
80 | smc91x_resources[0].end = addr + 0x30f; | ||
81 | |||
82 | smc91x_resources[1].start = gpio_to_irq(gpio); | ||
83 | smc91x_resources[1].end = gpio_to_irq(gpio); | ||
84 | |||
85 | status = gpio_request(gpio, "SMC91x irq"); | ||
86 | if (status < 0) { | ||
87 | printk(KERN_ERR "GPIO%d unavailable for smc91x IRQ\n", gpio); | ||
88 | return status; | ||
89 | } | ||
90 | gpio_direction_input(gpio); | ||
91 | |||
92 | led_resources[0].start = addr; | ||
93 | led_resources[0].end = addr + SZ_4K - 1; | ||
94 | |||
95 | return platform_add_devices(debug_devices, ARRAY_SIZE(debug_devices)); | ||
96 | } | ||
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c new file mode 100644 index 00000000000..ea28f98d5d6 --- /dev/null +++ b/arch/arm/plat-omap/devices.c | |||
@@ -0,0 +1,298 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/plat-omap/devices.c | ||
3 | * | ||
4 | * Common platform device setup/initialization for OMAP1 and OMAP2 | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/slab.h> | ||
18 | #include <linux/memblock.h> | ||
19 | |||
20 | #include <mach/hardware.h> | ||
21 | #include <asm/mach-types.h> | ||
22 | #include <asm/mach/map.h> | ||
23 | |||
24 | #include <plat/tc.h> | ||
25 | #include <plat/board.h> | ||
26 | #include <plat/mmc.h> | ||
27 | #include <mach/gpio.h> | ||
28 | #include <plat/menelaus.h> | ||
29 | #include <plat/mcbsp.h> | ||
30 | #include <plat/omap44xx.h> | ||
31 | |||
32 | /*-------------------------------------------------------------------------*/ | ||
33 | |||
34 | #if defined(CONFIG_OMAP_MCBSP) || defined(CONFIG_OMAP_MCBSP_MODULE) | ||
35 | |||
36 | static struct platform_device **omap_mcbsp_devices; | ||
37 | |||
38 | void omap_mcbsp_register_board_cfg(struct resource *res, int res_count, | ||
39 | struct omap_mcbsp_platform_data *config, int size) | ||
40 | { | ||
41 | int i; | ||
42 | |||
43 | omap_mcbsp_devices = kzalloc(size * sizeof(struct platform_device *), | ||
44 | GFP_KERNEL); | ||
45 | if (!omap_mcbsp_devices) { | ||
46 | printk(KERN_ERR "Could not register McBSP devices\n"); | ||
47 | return; | ||
48 | } | ||
49 | |||
50 | for (i = 0; i < size; i++) { | ||
51 | struct platform_device *new_mcbsp; | ||
52 | int ret; | ||
53 | |||
54 | new_mcbsp = platform_device_alloc("omap-mcbsp", i + 1); | ||
55 | if (!new_mcbsp) | ||
56 | continue; | ||
57 | platform_device_add_resources(new_mcbsp, &res[i * res_count], | ||
58 | res_count); | ||
59 | new_mcbsp->dev.platform_data = &config[i]; | ||
60 | ret = platform_device_add(new_mcbsp); | ||
61 | if (ret) { | ||
62 | platform_device_put(new_mcbsp); | ||
63 | continue; | ||
64 | } | ||
65 | omap_mcbsp_devices[i] = new_mcbsp; | ||
66 | } | ||
67 | } | ||
68 | |||
69 | #else | ||
70 | void omap_mcbsp_register_board_cfg(struct resource *res, int res_count, | ||
71 | struct omap_mcbsp_platform_data *config, int size) | ||
72 | { } | ||
73 | #endif | ||
74 | |||
75 | /*-------------------------------------------------------------------------*/ | ||
76 | |||
77 | #if defined(CONFIG_SND_OMAP_SOC_MCPDM) || \ | ||
78 | defined(CONFIG_SND_OMAP_SOC_MCPDM_MODULE) | ||
79 | |||
80 | static struct resource mcpdm_resources[] = { | ||
81 | { | ||
82 | .name = "mcpdm_mem", | ||
83 | .start = OMAP44XX_MCPDM_BASE, | ||
84 | .end = OMAP44XX_MCPDM_BASE + SZ_4K, | ||
85 | .flags = IORESOURCE_MEM, | ||
86 | }, | ||
87 | { | ||
88 | .name = "mcpdm_irq", | ||
89 | .start = OMAP44XX_IRQ_MCPDM, | ||
90 | .end = OMAP44XX_IRQ_MCPDM, | ||
91 | .flags = IORESOURCE_IRQ, | ||
92 | }, | ||
93 | }; | ||
94 | |||
95 | static struct platform_device omap_mcpdm_device = { | ||
96 | .name = "omap-mcpdm", | ||
97 | .id = -1, | ||
98 | .num_resources = ARRAY_SIZE(mcpdm_resources), | ||
99 | .resource = mcpdm_resources, | ||
100 | }; | ||
101 | |||
102 | static void omap_init_mcpdm(void) | ||
103 | { | ||
104 | (void) platform_device_register(&omap_mcpdm_device); | ||
105 | } | ||
106 | #else | ||
107 | static inline void omap_init_mcpdm(void) {} | ||
108 | #endif | ||
109 | |||
110 | /*-------------------------------------------------------------------------*/ | ||
111 | |||
112 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ | ||
113 | defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) | ||
114 | |||
115 | #define OMAP_MMC_NR_RES 2 | ||
116 | |||
117 | /* | ||
118 | * Register MMC devices. Called from mach-omap1 and mach-omap2 device init. | ||
119 | */ | ||
120 | int __init omap_mmc_add(const char *name, int id, unsigned long base, | ||
121 | unsigned long size, unsigned int irq, | ||
122 | struct omap_mmc_platform_data *data) | ||
123 | { | ||
124 | struct platform_device *pdev; | ||
125 | struct resource res[OMAP_MMC_NR_RES]; | ||
126 | int ret; | ||
127 | |||
128 | pdev = platform_device_alloc(name, id); | ||
129 | if (!pdev) | ||
130 | return -ENOMEM; | ||
131 | |||
132 | memset(res, 0, OMAP_MMC_NR_RES * sizeof(struct resource)); | ||
133 | res[0].start = base; | ||
134 | res[0].end = base + size - 1; | ||
135 | res[0].flags = IORESOURCE_MEM; | ||
136 | res[1].start = res[1].end = irq; | ||
137 | res[1].flags = IORESOURCE_IRQ; | ||
138 | |||
139 | ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); | ||
140 | if (ret == 0) | ||
141 | ret = platform_device_add_data(pdev, data, sizeof(*data)); | ||
142 | if (ret) | ||
143 | goto fail; | ||
144 | |||
145 | ret = platform_device_add(pdev); | ||
146 | if (ret) | ||
147 | goto fail; | ||
148 | |||
149 | /* return device handle to board setup code */ | ||
150 | data->dev = &pdev->dev; | ||
151 | return 0; | ||
152 | |||
153 | fail: | ||
154 | platform_device_put(pdev); | ||
155 | return ret; | ||
156 | } | ||
157 | |||
158 | #endif | ||
159 | |||
160 | /*-------------------------------------------------------------------------*/ | ||
161 | |||
162 | #if defined(CONFIG_HW_RANDOM_OMAP) || defined(CONFIG_HW_RANDOM_OMAP_MODULE) | ||
163 | |||
164 | #ifdef CONFIG_ARCH_OMAP2 | ||
165 | #define OMAP_RNG_BASE 0x480A0000 | ||
166 | #else | ||
167 | #define OMAP_RNG_BASE 0xfffe5000 | ||
168 | #endif | ||
169 | |||
170 | static struct resource rng_resources[] = { | ||
171 | { | ||
172 | .start = OMAP_RNG_BASE, | ||
173 | .end = OMAP_RNG_BASE + 0x4f, | ||
174 | .flags = IORESOURCE_MEM, | ||
175 | }, | ||
176 | }; | ||
177 | |||
178 | static struct platform_device omap_rng_device = { | ||
179 | .name = "omap_rng", | ||
180 | .id = -1, | ||
181 | .num_resources = ARRAY_SIZE(rng_resources), | ||
182 | .resource = rng_resources, | ||
183 | }; | ||
184 | |||
185 | static void omap_init_rng(void) | ||
186 | { | ||
187 | (void) platform_device_register(&omap_rng_device); | ||
188 | } | ||
189 | #else | ||
190 | static inline void omap_init_rng(void) {} | ||
191 | #endif | ||
192 | |||
193 | /*-------------------------------------------------------------------------*/ | ||
194 | |||
195 | /* Numbering for the SPI-capable controllers when used for SPI: | ||
196 | * spi = 1 | ||
197 | * uwire = 2 | ||
198 | * mmc1..2 = 3..4 | ||
199 | * mcbsp1..3 = 5..7 | ||
200 | */ | ||
201 | |||
202 | #if defined(CONFIG_SPI_OMAP_UWIRE) || defined(CONFIG_SPI_OMAP_UWIRE_MODULE) | ||
203 | |||
204 | #define OMAP_UWIRE_BASE 0xfffb3000 | ||
205 | |||
206 | static struct resource uwire_resources[] = { | ||
207 | { | ||
208 | .start = OMAP_UWIRE_BASE, | ||
209 | .end = OMAP_UWIRE_BASE + 0x20, | ||
210 | .flags = IORESOURCE_MEM, | ||
211 | }, | ||
212 | }; | ||
213 | |||
214 | static struct platform_device omap_uwire_device = { | ||
215 | .name = "omap_uwire", | ||
216 | .id = -1, | ||
217 | .num_resources = ARRAY_SIZE(uwire_resources), | ||
218 | .resource = uwire_resources, | ||
219 | }; | ||
220 | |||
221 | static void omap_init_uwire(void) | ||
222 | { | ||
223 | /* FIXME define and use a boot tag; not all boards will be hooking | ||
224 | * up devices to the microwire controller, and multi-board configs | ||
225 | * mean that CONFIG_SPI_OMAP_UWIRE may be configured anyway... | ||
226 | */ | ||
227 | |||
228 | /* board-specific code must configure chipselects (only a few | ||
229 | * are normally used) and SCLK/SDI/SDO (each has two choices). | ||
230 | */ | ||
231 | (void) platform_device_register(&omap_uwire_device); | ||
232 | } | ||
233 | #else | ||
234 | static inline void omap_init_uwire(void) {} | ||
235 | #endif | ||
236 | |||
237 | #if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE) | ||
238 | |||
239 | static phys_addr_t omap_dsp_phys_mempool_base; | ||
240 | |||
241 | void __init omap_dsp_reserve_sdram_memblock(void) | ||
242 | { | ||
243 | phys_addr_t size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE; | ||
244 | phys_addr_t paddr; | ||
245 | |||
246 | if (!size) | ||
247 | return; | ||
248 | |||
249 | paddr = memblock_alloc(size, SZ_1M); | ||
250 | if (!paddr) { | ||
251 | pr_err("%s: failed to reserve %x bytes\n", | ||
252 | __func__, size); | ||
253 | return; | ||
254 | } | ||
255 | memblock_free(paddr, size); | ||
256 | memblock_remove(paddr, size); | ||
257 | |||
258 | omap_dsp_phys_mempool_base = paddr; | ||
259 | } | ||
260 | |||
261 | phys_addr_t omap_dsp_get_mempool_base(void) | ||
262 | { | ||
263 | return omap_dsp_phys_mempool_base; | ||
264 | } | ||
265 | EXPORT_SYMBOL(omap_dsp_get_mempool_base); | ||
266 | #endif | ||
267 | |||
268 | /* | ||
269 | * This gets called after board-specific INIT_MACHINE, and initializes most | ||
270 | * on-chip peripherals accessible on this board (except for few like USB): | ||
271 | * | ||
272 | * (a) Does any "standard config" pin muxing needed. Board-specific | ||
273 | * code will have muxed GPIO pins and done "nonstandard" setup; | ||
274 | * that code could live in the boot loader. | ||
275 | * (b) Populating board-specific platform_data with the data drivers | ||
276 | * rely on to handle wiring variations. | ||
277 | * (c) Creating platform devices as meaningful on this board and | ||
278 | * with this kernel configuration. | ||
279 | * | ||
280 | * Claiming GPIOs, and setting their direction and initial values, is the | ||
281 | * responsibility of the device drivers. So is responding to probe(). | ||
282 | * | ||
283 | * Board-specific knowledge like creating devices or pin setup is to be | ||
284 | * kept out of drivers as much as possible. In particular, pin setup | ||
285 | * may be handled by the boot loader, and drivers should expect it will | ||
286 | * normally have been done by the time they're probed. | ||
287 | */ | ||
288 | static int __init omap_init_devices(void) | ||
289 | { | ||
290 | /* please keep these calls, and their implementations above, | ||
291 | * in alphabetical order so they're easier to sort through. | ||
292 | */ | ||
293 | omap_init_rng(); | ||
294 | omap_init_mcpdm(); | ||
295 | omap_init_uwire(); | ||
296 | return 0; | ||
297 | } | ||
298 | arch_initcall(omap_init_devices); | ||
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c new file mode 100644 index 00000000000..c9e5d7298c4 --- /dev/null +++ b/arch/arm/plat-omap/fb.c | |||
@@ -0,0 +1,421 @@ | |||
1 | /* | ||
2 | * File: arch/arm/plat-omap/fb.c | ||
3 | * | ||
4 | * Framebuffer device registration for TI OMAP platforms | ||
5 | * | ||
6 | * Copyright (C) 2006 Nokia Corporation | ||
7 | * Author: Imre Deak <imre.deak@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License along | ||
20 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
22 | */ | ||
23 | |||
24 | #include <linux/module.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/mm.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/platform_device.h> | ||
29 | #include <linux/memblock.h> | ||
30 | #include <linux/io.h> | ||
31 | #include <linux/omapfb.h> | ||
32 | |||
33 | #include <mach/hardware.h> | ||
34 | #include <asm/mach/map.h> | ||
35 | |||
36 | #include <plat/board.h> | ||
37 | #include <plat/sram.h> | ||
38 | |||
39 | #include "fb.h" | ||
40 | |||
41 | #if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE) | ||
42 | |||
43 | static struct omapfb_platform_data omapfb_config; | ||
44 | static int config_invalid; | ||
45 | static int configured_regions; | ||
46 | |||
47 | static u64 omap_fb_dma_mask = ~(u32)0; | ||
48 | |||
49 | static struct platform_device omap_fb_device = { | ||
50 | .name = "omapfb", | ||
51 | .id = -1, | ||
52 | .dev = { | ||
53 | .dma_mask = &omap_fb_dma_mask, | ||
54 | .coherent_dma_mask = ~(u32)0, | ||
55 | .platform_data = &omapfb_config, | ||
56 | }, | ||
57 | .num_resources = 0, | ||
58 | }; | ||
59 | |||
60 | void omapfb_set_platform_data(struct omapfb_platform_data *data) | ||
61 | { | ||
62 | } | ||
63 | |||
64 | static inline int ranges_overlap(unsigned long start1, unsigned long size1, | ||
65 | unsigned long start2, unsigned long size2) | ||
66 | { | ||
67 | return (start1 >= start2 && start1 < start2 + size2) || | ||
68 | (start2 >= start1 && start2 < start1 + size1); | ||
69 | } | ||
70 | |||
71 | static inline int range_included(unsigned long start1, unsigned long size1, | ||
72 | unsigned long start2, unsigned long size2) | ||
73 | { | ||
74 | return start1 >= start2 && start1 + size1 <= start2 + size2; | ||
75 | } | ||
76 | |||
77 | |||
78 | /* Check if there is an overlapping region. */ | ||
79 | static int fbmem_region_reserved(unsigned long start, size_t size) | ||
80 | { | ||
81 | struct omapfb_mem_region *rg; | ||
82 | int i; | ||
83 | |||
84 | rg = &omapfb_config.mem_desc.region[0]; | ||
85 | for (i = 0; i < OMAPFB_PLANE_NUM; i++, rg++) { | ||
86 | if (!rg->paddr) | ||
87 | /* Empty slot. */ | ||
88 | continue; | ||
89 | if (ranges_overlap(start, size, rg->paddr, rg->size)) | ||
90 | return 1; | ||
91 | } | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | /* | ||
96 | * Get the region_idx`th region from board config/ATAG and convert it to | ||
97 | * our internal format. | ||
98 | */ | ||
99 | static int __init get_fbmem_region(int region_idx, struct omapfb_mem_region *rg) | ||
100 | { | ||
101 | const struct omap_fbmem_config *conf; | ||
102 | u32 paddr; | ||
103 | |||
104 | conf = omap_get_nr_config(OMAP_TAG_FBMEM, | ||
105 | struct omap_fbmem_config, region_idx); | ||
106 | if (conf == NULL) | ||
107 | return -ENOENT; | ||
108 | |||
109 | paddr = conf->start; | ||
110 | /* | ||
111 | * Low bits encode the page allocation mode, if high bits | ||
112 | * are zero. Otherwise we need a page aligned fixed | ||
113 | * address. | ||
114 | */ | ||
115 | memset(rg, 0, sizeof(*rg)); | ||
116 | rg->type = paddr & ~PAGE_MASK; | ||
117 | rg->paddr = paddr & PAGE_MASK; | ||
118 | rg->size = PAGE_ALIGN(conf->size); | ||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | static int set_fbmem_region_type(struct omapfb_mem_region *rg, int mem_type, | ||
123 | unsigned long mem_start, | ||
124 | unsigned long mem_size) | ||
125 | { | ||
126 | /* | ||
127 | * Check if the configuration specifies the type explicitly. | ||
128 | * type = 0 && paddr = 0, a default don't care case maps to | ||
129 | * the SDRAM type. | ||
130 | */ | ||
131 | if (rg->type || !rg->paddr) | ||
132 | return 0; | ||
133 | if (ranges_overlap(rg->paddr, rg->size, mem_start, mem_size)) { | ||
134 | rg->type = mem_type; | ||
135 | return 0; | ||
136 | } | ||
137 | /* Can't determine it. */ | ||
138 | return -1; | ||
139 | } | ||
140 | |||
141 | static int check_fbmem_region(int region_idx, struct omapfb_mem_region *rg, | ||
142 | unsigned long start_avail, unsigned size_avail) | ||
143 | { | ||
144 | unsigned long paddr = rg->paddr; | ||
145 | size_t size = rg->size; | ||
146 | |||
147 | if (rg->type > OMAPFB_MEMTYPE_MAX) { | ||
148 | printk(KERN_ERR | ||
149 | "Invalid start address for FB region %d\n", region_idx); | ||
150 | return -EINVAL; | ||
151 | } | ||
152 | |||
153 | if (!rg->size) { | ||
154 | printk(KERN_ERR "Zero size for FB region %d\n", region_idx); | ||
155 | return -EINVAL; | ||
156 | } | ||
157 | |||
158 | if (!paddr) | ||
159 | /* Allocate this dynamically, leave paddr 0 for now. */ | ||
160 | return 0; | ||
161 | |||
162 | /* | ||
163 | * Fixed region for the given RAM range. Check if it's already | ||
164 | * reserved by the FB code or someone else. | ||
165 | */ | ||
166 | if (fbmem_region_reserved(paddr, size) || | ||
167 | !range_included(paddr, size, start_avail, size_avail)) { | ||
168 | printk(KERN_ERR "Trying to use reserved memory " | ||
169 | "for FB region %d\n", region_idx); | ||
170 | return -EINVAL; | ||
171 | } | ||
172 | |||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | static int valid_sdram(unsigned long addr, unsigned long size) | ||
177 | { | ||
178 | return memblock_is_region_memory(addr, size); | ||
179 | } | ||
180 | |||
181 | static int reserve_sdram(unsigned long addr, unsigned long size) | ||
182 | { | ||
183 | if (memblock_is_region_reserved(addr, size)) | ||
184 | return -EBUSY; | ||
185 | if (memblock_reserve(addr, size)) | ||
186 | return -ENOMEM; | ||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | /* | ||
191 | * Called from map_io. We need to call to this early enough so that we | ||
192 | * can reserve the fixed SDRAM regions before VM could get hold of them. | ||
193 | */ | ||
194 | void __init omapfb_reserve_sdram_memblock(void) | ||
195 | { | ||
196 | unsigned long reserved = 0; | ||
197 | int i; | ||
198 | |||
199 | if (config_invalid) | ||
200 | return; | ||
201 | |||
202 | for (i = 0; ; i++) { | ||
203 | struct omapfb_mem_region rg; | ||
204 | |||
205 | if (get_fbmem_region(i, &rg) < 0) | ||
206 | break; | ||
207 | |||
208 | if (i == OMAPFB_PLANE_NUM) { | ||
209 | pr_err("Extraneous FB mem configuration entries\n"); | ||
210 | config_invalid = 1; | ||
211 | return; | ||
212 | } | ||
213 | |||
214 | /* Check if it's our memory type. */ | ||
215 | if (rg.type != OMAPFB_MEMTYPE_SDRAM) | ||
216 | continue; | ||
217 | |||
218 | /* Check if the region falls within SDRAM */ | ||
219 | if (rg.paddr && !valid_sdram(rg.paddr, rg.size)) | ||
220 | continue; | ||
221 | |||
222 | if (rg.size == 0) { | ||
223 | pr_err("Zero size for FB region %d\n", i); | ||
224 | config_invalid = 1; | ||
225 | return; | ||
226 | } | ||
227 | |||
228 | if (rg.paddr) { | ||
229 | if (reserve_sdram(rg.paddr, rg.size)) { | ||
230 | pr_err("Trying to use reserved memory for FB region %d\n", | ||
231 | i); | ||
232 | config_invalid = 1; | ||
233 | return; | ||
234 | } | ||
235 | reserved += rg.size; | ||
236 | } | ||
237 | |||
238 | if (omapfb_config.mem_desc.region[i].size) { | ||
239 | pr_err("FB region %d already set\n", i); | ||
240 | config_invalid = 1; | ||
241 | return; | ||
242 | } | ||
243 | |||
244 | omapfb_config.mem_desc.region[i] = rg; | ||
245 | configured_regions++; | ||
246 | } | ||
247 | omapfb_config.mem_desc.region_cnt = i; | ||
248 | if (reserved) | ||
249 | pr_info("Reserving %lu bytes SDRAM for frame buffer\n", | ||
250 | reserved); | ||
251 | } | ||
252 | |||
253 | /* | ||
254 | * Called at sram init time, before anything is pushed to the SRAM stack. | ||
255 | * Because of the stack scheme, we will allocate everything from the | ||
256 | * start of the lowest address region to the end of SRAM. This will also | ||
257 | * include padding for page alignment and possible holes between regions. | ||
258 | * | ||
259 | * As opposed to the SDRAM case, we'll also do any dynamic allocations at | ||
260 | * this point, since the driver built as a module would have problem with | ||
261 | * freeing / reallocating the regions. | ||
262 | */ | ||
263 | unsigned long __init omapfb_reserve_sram(unsigned long sram_pstart, | ||
264 | unsigned long sram_vstart, | ||
265 | unsigned long sram_size, | ||
266 | unsigned long pstart_avail, | ||
267 | unsigned long size_avail) | ||
268 | { | ||
269 | struct omapfb_mem_region rg; | ||
270 | unsigned long pend_avail; | ||
271 | unsigned long reserved; | ||
272 | int i; | ||
273 | |||
274 | if (config_invalid) | ||
275 | return 0; | ||
276 | |||
277 | reserved = 0; | ||
278 | pend_avail = pstart_avail + size_avail; | ||
279 | for (i = 0; ; i++) { | ||
280 | if (get_fbmem_region(i, &rg) < 0) | ||
281 | break; | ||
282 | if (i == OMAPFB_PLANE_NUM) { | ||
283 | printk(KERN_ERR | ||
284 | "Extraneous FB mem configuration entries\n"); | ||
285 | config_invalid = 1; | ||
286 | return 0; | ||
287 | } | ||
288 | |||
289 | /* Check if it's our memory type. */ | ||
290 | if (set_fbmem_region_type(&rg, OMAPFB_MEMTYPE_SRAM, | ||
291 | sram_pstart, sram_size) < 0 || | ||
292 | (rg.type != OMAPFB_MEMTYPE_SRAM)) | ||
293 | continue; | ||
294 | BUG_ON(omapfb_config.mem_desc.region[i].size); | ||
295 | |||
296 | if (check_fbmem_region(i, &rg, pstart_avail, size_avail) < 0) { | ||
297 | config_invalid = 1; | ||
298 | return 0; | ||
299 | } | ||
300 | |||
301 | if (!rg.paddr) { | ||
302 | /* Dynamic allocation */ | ||
303 | if ((size_avail & PAGE_MASK) < rg.size) { | ||
304 | printk("Not enough SRAM for FB region %d\n", | ||
305 | i); | ||
306 | config_invalid = 1; | ||
307 | return 0; | ||
308 | } | ||
309 | size_avail = (size_avail - rg.size) & PAGE_MASK; | ||
310 | rg.paddr = pstart_avail + size_avail; | ||
311 | } | ||
312 | /* Reserve everything above the start of the region. */ | ||
313 | if (pend_avail - rg.paddr > reserved) | ||
314 | reserved = pend_avail - rg.paddr; | ||
315 | size_avail = pend_avail - reserved - pstart_avail; | ||
316 | |||
317 | /* | ||
318 | * We have a kernel mapping for this already, so the | ||
319 | * driver won't have to make one. | ||
320 | */ | ||
321 | rg.vaddr = (void *)(sram_vstart + rg.paddr - sram_pstart); | ||
322 | omapfb_config.mem_desc.region[i] = rg; | ||
323 | configured_regions++; | ||
324 | } | ||
325 | omapfb_config.mem_desc.region_cnt = i; | ||
326 | if (reserved) | ||
327 | pr_info("Reserving %lu bytes SRAM for frame buffer\n", | ||
328 | reserved); | ||
329 | return reserved; | ||
330 | } | ||
331 | |||
332 | void omapfb_set_ctrl_platform_data(void *data) | ||
333 | { | ||
334 | omapfb_config.ctrl_platform_data = data; | ||
335 | } | ||
336 | |||
337 | static int __init omap_init_fb(void) | ||
338 | { | ||
339 | const struct omap_lcd_config *conf; | ||
340 | |||
341 | if (config_invalid) | ||
342 | return 0; | ||
343 | if (configured_regions != omapfb_config.mem_desc.region_cnt) { | ||
344 | printk(KERN_ERR "Invalid FB mem configuration entries\n"); | ||
345 | return 0; | ||
346 | } | ||
347 | conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config); | ||
348 | if (conf == NULL) { | ||
349 | if (configured_regions) | ||
350 | /* FB mem config, but no LCD config? */ | ||
351 | printk(KERN_ERR "Missing LCD configuration\n"); | ||
352 | return 0; | ||
353 | } | ||
354 | omapfb_config.lcd = *conf; | ||
355 | |||
356 | return platform_device_register(&omap_fb_device); | ||
357 | } | ||
358 | |||
359 | arch_initcall(omap_init_fb); | ||
360 | |||
361 | #elif defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) | ||
362 | |||
363 | static u64 omap_fb_dma_mask = ~(u32)0; | ||
364 | static struct omapfb_platform_data omapfb_config; | ||
365 | |||
366 | static struct platform_device omap_fb_device = { | ||
367 | .name = "omapfb", | ||
368 | .id = -1, | ||
369 | .dev = { | ||
370 | .dma_mask = &omap_fb_dma_mask, | ||
371 | .coherent_dma_mask = ~(u32)0, | ||
372 | .platform_data = &omapfb_config, | ||
373 | }, | ||
374 | .num_resources = 0, | ||
375 | }; | ||
376 | |||
377 | void omapfb_set_platform_data(struct omapfb_platform_data *data) | ||
378 | { | ||
379 | omapfb_config = *data; | ||
380 | } | ||
381 | |||
382 | static int __init omap_init_fb(void) | ||
383 | { | ||
384 | return platform_device_register(&omap_fb_device); | ||
385 | } | ||
386 | |||
387 | arch_initcall(omap_init_fb); | ||
388 | |||
389 | void omapfb_reserve_sdram_memblock(void) | ||
390 | { | ||
391 | } | ||
392 | |||
393 | unsigned long __init omapfb_reserve_sram(unsigned long sram_pstart, | ||
394 | unsigned long sram_vstart, | ||
395 | unsigned long sram_size, | ||
396 | unsigned long start_avail, | ||
397 | unsigned long size_avail) | ||
398 | { | ||
399 | return 0; | ||
400 | } | ||
401 | |||
402 | #else | ||
403 | |||
404 | void omapfb_set_platform_data(struct omapfb_platform_data *data) | ||
405 | { | ||
406 | } | ||
407 | |||
408 | void omapfb_reserve_sdram_memblock(void) | ||
409 | { | ||
410 | } | ||
411 | |||
412 | unsigned long __init omapfb_reserve_sram(unsigned long sram_pstart, | ||
413 | unsigned long sram_vstart, | ||
414 | unsigned long sram_size, | ||
415 | unsigned long start_avail, | ||
416 | unsigned long size_avail) | ||
417 | { | ||
418 | return 0; | ||
419 | } | ||
420 | |||
421 | #endif | ||
diff --git a/arch/arm/plat-omap/fb.h b/arch/arm/plat-omap/fb.h new file mode 100644 index 00000000000..d765d0bd852 --- /dev/null +++ b/arch/arm/plat-omap/fb.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __PLAT_OMAP_FB_H__ | ||
2 | #define __PLAT_OMAP_FB_H__ | ||
3 | |||
4 | extern unsigned long omapfb_reserve_sram(unsigned long sram_pstart, | ||
5 | unsigned long sram_vstart, | ||
6 | unsigned long sram_size, | ||
7 | unsigned long pstart_avail, | ||
8 | unsigned long size_avail); | ||
9 | |||
10 | #endif /* __PLAT_OMAP_FB_H__ */ | ||
diff --git a/arch/arm/plat-omap/include/plat/blizzard.h b/arch/arm/plat-omap/include/plat/blizzard.h new file mode 100644 index 00000000000..56e7f2e7d12 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/blizzard.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef _BLIZZARD_H | ||
2 | #define _BLIZZARD_H | ||
3 | |||
4 | struct blizzard_platform_data { | ||
5 | void (*power_up)(struct device *dev); | ||
6 | void (*power_down)(struct device *dev); | ||
7 | unsigned long (*get_clock_rate)(struct device *dev); | ||
8 | |||
9 | unsigned te_connected:1; | ||
10 | }; | ||
11 | |||
12 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/board-ams-delta.h b/arch/arm/plat-omap/include/plat/board-ams-delta.h new file mode 100644 index 00000000000..51b102dc906 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/board-ams-delta.h | ||
3 | * | ||
4 | * Copyright (C) 2006 Jonathan McDowell <noodles@earth.li> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
12 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
13 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
14 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
15 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
16 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
17 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
18 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
19 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
20 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License along | ||
23 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
24 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | */ | ||
26 | #ifndef __ASM_ARCH_OMAP_AMS_DELTA_H | ||
27 | #define __ASM_ARCH_OMAP_AMS_DELTA_H | ||
28 | |||
29 | #if defined (CONFIG_MACH_AMS_DELTA) | ||
30 | |||
31 | #define AMS_DELTA_LATCH1_PHYS 0x01000000 | ||
32 | #define AMS_DELTA_LATCH1_VIRT 0xEA000000 | ||
33 | #define AMS_DELTA_MODEM_PHYS 0x04000000 | ||
34 | #define AMS_DELTA_MODEM_VIRT 0xEB000000 | ||
35 | #define AMS_DELTA_LATCH2_PHYS 0x08000000 | ||
36 | #define AMS_DELTA_LATCH2_VIRT 0xEC000000 | ||
37 | |||
38 | #define AMS_DELTA_LATCH1_LED_CAMERA 0x01 | ||
39 | #define AMS_DELTA_LATCH1_LED_ADVERT 0x02 | ||
40 | #define AMS_DELTA_LATCH1_LED_EMAIL 0x04 | ||
41 | #define AMS_DELTA_LATCH1_LED_HANDSFREE 0x08 | ||
42 | #define AMS_DELTA_LATCH1_LED_VOICEMAIL 0x10 | ||
43 | #define AMS_DELTA_LATCH1_LED_VOICE 0x20 | ||
44 | |||
45 | #define AMS_DELTA_LATCH2_LCD_VBLEN 0x0001 | ||
46 | #define AMS_DELTA_LATCH2_LCD_NDISP 0x0002 | ||
47 | #define AMS_DELTA_LATCH2_NAND_NCE 0x0004 | ||
48 | #define AMS_DELTA_LATCH2_NAND_NRE 0x0008 | ||
49 | #define AMS_DELTA_LATCH2_NAND_NWP 0x0010 | ||
50 | #define AMS_DELTA_LATCH2_NAND_NWE 0x0020 | ||
51 | #define AMS_DELTA_LATCH2_NAND_ALE 0x0040 | ||
52 | #define AMS_DELTA_LATCH2_NAND_CLE 0x0080 | ||
53 | #define AMD_DELTA_LATCH2_KEYBRD_PWR 0x0100 | ||
54 | #define AMD_DELTA_LATCH2_KEYBRD_DATA 0x0200 | ||
55 | #define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400 | ||
56 | #define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800 | ||
57 | #define AMS_DELTA_LATCH2_MODEM_NRESET 0x1000 | ||
58 | #define AMS_DELTA_LATCH2_MODEM_CODEC 0x2000 | ||
59 | |||
60 | #define AMS_DELTA_GPIO_PIN_KEYBRD_DATA 0 | ||
61 | #define AMS_DELTA_GPIO_PIN_KEYBRD_CLK 1 | ||
62 | #define AMS_DELTA_GPIO_PIN_MODEM_IRQ 2 | ||
63 | #define AMS_DELTA_GPIO_PIN_HOOK_SWITCH 4 | ||
64 | #define AMS_DELTA_GPIO_PIN_SCARD_NOFF 6 | ||
65 | #define AMS_DELTA_GPIO_PIN_SCARD_IO 7 | ||
66 | #define AMS_DELTA_GPIO_PIN_CONFIG 11 | ||
67 | #define AMS_DELTA_GPIO_PIN_NAND_RB 12 | ||
68 | |||
69 | #ifndef __ASSEMBLY__ | ||
70 | void ams_delta_latch1_write(u8 mask, u8 value); | ||
71 | void ams_delta_latch2_write(u16 mask, u16 value); | ||
72 | #endif | ||
73 | |||
74 | #endif /* CONFIG_MACH_AMS_DELTA */ | ||
75 | |||
76 | #endif /* __ASM_ARCH_OMAP_AMS_DELTA_H */ | ||
diff --git a/arch/arm/plat-omap/include/plat/board-sx1.h b/arch/arm/plat-omap/include/plat/board-sx1.h new file mode 100644 index 00000000000..355adbdaae3 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/board-sx1.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Siemens SX1 board definitions | ||
3 | * | ||
4 | * Copyright: Vovan888 at gmail com | ||
5 | * | ||
6 | * This package is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | ||
11 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | ||
12 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | */ | ||
14 | |||
15 | #ifndef __ASM_ARCH_SX1_I2C_CHIPS_H | ||
16 | #define __ASM_ARCH_SX1_I2C_CHIPS_H | ||
17 | |||
18 | #define SOFIA_MAX_LIGHT_VAL 0x2B | ||
19 | |||
20 | #define SOFIA_I2C_ADDR 0x32 | ||
21 | /* Sofia reg 3 bits masks */ | ||
22 | #define SOFIA_POWER1_REG 0x03 | ||
23 | |||
24 | #define SOFIA_USB_POWER 0x01 | ||
25 | #define SOFIA_MMC_POWER 0x04 | ||
26 | #define SOFIA_BLUETOOTH_POWER 0x08 | ||
27 | #define SOFIA_MMILIGHT_POWER 0x20 | ||
28 | |||
29 | #define SOFIA_POWER2_REG 0x04 | ||
30 | #define SOFIA_BACKLIGHT_REG 0x06 | ||
31 | #define SOFIA_KEYLIGHT_REG 0x07 | ||
32 | #define SOFIA_DIMMING_REG 0x09 | ||
33 | |||
34 | |||
35 | /* Function Prototypes for SX1 devices control on I2C bus */ | ||
36 | |||
37 | int sx1_setbacklight(u8 backlight); | ||
38 | int sx1_getbacklight(u8 *backlight); | ||
39 | int sx1_setkeylight(u8 keylight); | ||
40 | int sx1_getkeylight(u8 *keylight); | ||
41 | |||
42 | int sx1_setmmipower(u8 onoff); | ||
43 | int sx1_setusbpower(u8 onoff); | ||
44 | int sx1_i2c_read_byte(u8 devaddr, u8 regoffset, u8 *value); | ||
45 | int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value); | ||
46 | |||
47 | /* MMC prototypes */ | ||
48 | |||
49 | extern void sx1_mmc_init(void); | ||
50 | extern void sx1_mmc_slot_cover_handler(void *arg, int state); | ||
51 | |||
52 | #endif /* __ASM_ARCH_SX1_I2C_CHIPS_H */ | ||
diff --git a/arch/arm/plat-omap/include/plat/board-voiceblue.h b/arch/arm/plat-omap/include/plat/board-voiceblue.h new file mode 100644 index 00000000000..27916b210f5 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/board-voiceblue.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 2N Telekomunikace, Ladislav Michl <michl@2n.cz> | ||
3 | * | ||
4 | * Hardware definitions for OMAP5910 based VoiceBlue board. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASM_ARCH_VOICEBLUE_H | ||
12 | #define __ASM_ARCH_VOICEBLUE_H | ||
13 | |||
14 | extern void voiceblue_wdt_enable(void); | ||
15 | extern void voiceblue_wdt_disable(void); | ||
16 | extern void voiceblue_wdt_ping(void); | ||
17 | |||
18 | #endif /* __ASM_ARCH_VOICEBLUE_H */ | ||
19 | |||
diff --git a/arch/arm/plat-omap/include/plat/board.h b/arch/arm/plat-omap/include/plat/board.h new file mode 100644 index 00000000000..97126dfd288 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/board.h | |||
@@ -0,0 +1,176 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/board.h | ||
3 | * | ||
4 | * Information structures for board-specific data | ||
5 | * | ||
6 | * Copyright (C) 2004 Nokia Corporation | ||
7 | * Written by Juha Yrjölä <juha.yrjola@nokia.com> | ||
8 | */ | ||
9 | |||
10 | #ifndef _OMAP_BOARD_H | ||
11 | #define _OMAP_BOARD_H | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | |||
15 | #include <plat/gpio-switch.h> | ||
16 | |||
17 | /* | ||
18 | * OMAP35x EVM revision | ||
19 | * Run time detection of EVM revision is done by reading Ethernet | ||
20 | * PHY ID - | ||
21 | * GEN_1 = 0x01150000 | ||
22 | * GEN_2 = 0x92200000 | ||
23 | */ | ||
24 | enum { | ||
25 | OMAP3EVM_BOARD_GEN_1 = 0, /* EVM Rev between A - D */ | ||
26 | OMAP3EVM_BOARD_GEN_2, /* EVM Rev >= Rev E */ | ||
27 | }; | ||
28 | |||
29 | /* Different peripheral ids */ | ||
30 | #define OMAP_TAG_CLOCK 0x4f01 | ||
31 | #define OMAP_TAG_LCD 0x4f05 | ||
32 | #define OMAP_TAG_GPIO_SWITCH 0x4f06 | ||
33 | #define OMAP_TAG_FBMEM 0x4f08 | ||
34 | #define OMAP_TAG_STI_CONSOLE 0x4f09 | ||
35 | #define OMAP_TAG_CAMERA_SENSOR 0x4f0a | ||
36 | |||
37 | #define OMAP_TAG_BOOT_REASON 0x4f80 | ||
38 | #define OMAP_TAG_FLASH_PART 0x4f81 | ||
39 | #define OMAP_TAG_VERSION_STR 0x4f82 | ||
40 | |||
41 | struct omap_clock_config { | ||
42 | /* 0 for 12 MHz, 1 for 13 MHz and 2 for 19.2 MHz */ | ||
43 | u8 system_clock_type; | ||
44 | }; | ||
45 | |||
46 | struct omap_serial_console_config { | ||
47 | u8 console_uart; | ||
48 | u32 console_speed; | ||
49 | }; | ||
50 | |||
51 | struct omap_sti_console_config { | ||
52 | unsigned enable:1; | ||
53 | u8 channel; | ||
54 | }; | ||
55 | |||
56 | struct omap_camera_sensor_config { | ||
57 | u16 reset_gpio; | ||
58 | int (*power_on)(void * data); | ||
59 | int (*power_off)(void * data); | ||
60 | }; | ||
61 | |||
62 | struct omap_usb_config { | ||
63 | /* Configure drivers according to the connectors on your board: | ||
64 | * - "A" connector (rectagular) | ||
65 | * ... for host/OHCI use, set "register_host". | ||
66 | * - "B" connector (squarish) or "Mini-B" | ||
67 | * ... for device/gadget use, set "register_dev". | ||
68 | * - "Mini-AB" connector (very similar to Mini-B) | ||
69 | * ... for OTG use as device OR host, initialize "otg" | ||
70 | */ | ||
71 | unsigned register_host:1; | ||
72 | unsigned register_dev:1; | ||
73 | u8 otg; /* port number, 1-based: usb1 == 2 */ | ||
74 | |||
75 | u8 hmc_mode; | ||
76 | |||
77 | /* implicitly true if otg: host supports remote wakeup? */ | ||
78 | u8 rwc; | ||
79 | |||
80 | /* signaling pins used to talk to transceiver on usbN: | ||
81 | * 0 == usbN unused | ||
82 | * 2 == usb0-only, using internal transceiver | ||
83 | * 3 == 3 wire bidirectional | ||
84 | * 4 == 4 wire bidirectional | ||
85 | * 6 == 6 wire unidirectional (or TLL) | ||
86 | */ | ||
87 | u8 pins[3]; | ||
88 | |||
89 | struct platform_device *udc_device; | ||
90 | struct platform_device *ohci_device; | ||
91 | struct platform_device *otg_device; | ||
92 | |||
93 | u32 (*usb0_init)(unsigned nwires, unsigned is_device); | ||
94 | u32 (*usb1_init)(unsigned nwires); | ||
95 | u32 (*usb2_init)(unsigned nwires, unsigned alt_pingroup); | ||
96 | }; | ||
97 | |||
98 | struct omap_lcd_config { | ||
99 | char panel_name[16]; | ||
100 | char ctrl_name[16]; | ||
101 | s16 nreset_gpio; | ||
102 | u8 data_lines; | ||
103 | }; | ||
104 | |||
105 | struct device; | ||
106 | struct fb_info; | ||
107 | struct omap_backlight_config { | ||
108 | int default_intensity; | ||
109 | int (*set_power)(struct device *dev, int state); | ||
110 | }; | ||
111 | |||
112 | struct omap_fbmem_config { | ||
113 | u32 start; | ||
114 | u32 size; | ||
115 | }; | ||
116 | |||
117 | struct omap_pwm_led_platform_data { | ||
118 | const char *name; | ||
119 | int intensity_timer; | ||
120 | int blink_timer; | ||
121 | void (*set_power)(struct omap_pwm_led_platform_data *self, int on_off); | ||
122 | }; | ||
123 | |||
124 | struct omap_uart_config { | ||
125 | /* Bit field of UARTs present; bit 0 --> UART1 */ | ||
126 | unsigned int enabled_uarts; | ||
127 | }; | ||
128 | |||
129 | |||
130 | struct omap_flash_part_config { | ||
131 | char part_table[0]; | ||
132 | }; | ||
133 | |||
134 | struct omap_boot_reason_config { | ||
135 | char reason_str[12]; | ||
136 | }; | ||
137 | |||
138 | struct omap_version_config { | ||
139 | char component[12]; | ||
140 | char version[12]; | ||
141 | }; | ||
142 | |||
143 | struct omap_board_config_entry { | ||
144 | u16 tag; | ||
145 | u16 len; | ||
146 | u8 data[0]; | ||
147 | }; | ||
148 | |||
149 | struct omap_board_config_kernel { | ||
150 | u16 tag; | ||
151 | const void *data; | ||
152 | }; | ||
153 | |||
154 | extern const void *__init __omap_get_config(u16 tag, size_t len, int nr); | ||
155 | |||
156 | #define omap_get_config(tag, type) \ | ||
157 | ((const type *) __omap_get_config((tag), sizeof(type), 0)) | ||
158 | #define omap_get_nr_config(tag, type, nr) \ | ||
159 | ((const type *) __omap_get_config((tag), sizeof(type), (nr))) | ||
160 | |||
161 | extern const void *__init omap_get_var_config(u16 tag, size_t *len); | ||
162 | |||
163 | extern struct omap_board_config_kernel *omap_board_config; | ||
164 | extern int omap_board_config_size; | ||
165 | |||
166 | |||
167 | /* for TI reference platforms sharing the same debug card */ | ||
168 | extern int debug_card_init(u32 addr, unsigned gpio); | ||
169 | |||
170 | /* OMAP3EVM revision */ | ||
171 | #if defined(CONFIG_MACH_OMAP3EVM) | ||
172 | u8 get_omap3_evm_rev(void); | ||
173 | #else | ||
174 | #define get_omap3_evm_rev() (-EINVAL) | ||
175 | #endif | ||
176 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/clkdev_omap.h b/arch/arm/plat-omap/include/plat/clkdev_omap.h new file mode 100644 index 00000000000..387a9638991 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/clkdev_omap.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * clkdev <-> OMAP integration | ||
3 | * | ||
4 | * Russell King <linux@arm.linux.org.uk> | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_CLKDEV_OMAP_H | ||
9 | #define __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_CLKDEV_OMAP_H | ||
10 | |||
11 | #include <linux/clkdev.h> | ||
12 | |||
13 | struct omap_clk { | ||
14 | u16 cpu; | ||
15 | struct clk_lookup lk; | ||
16 | }; | ||
17 | |||
18 | #define CLK(dev, con, ck, cp) \ | ||
19 | { \ | ||
20 | .cpu = cp, \ | ||
21 | .lk = { \ | ||
22 | .dev_id = dev, \ | ||
23 | .con_id = con, \ | ||
24 | .clk = ck, \ | ||
25 | }, \ | ||
26 | } | ||
27 | |||
28 | /* Platform flags for the clkdev-OMAP integration code */ | ||
29 | #define CK_310 (1 << 0) | ||
30 | #define CK_7XX (1 << 1) /* 7xx, 850 */ | ||
31 | #define CK_1510 (1 << 2) | ||
32 | #define CK_16XX (1 << 3) /* 16xx, 17xx, 5912 */ | ||
33 | #define CK_242X (1 << 4) | ||
34 | #define CK_243X (1 << 5) /* 243x, 253x */ | ||
35 | #define CK_3430ES1 (1 << 6) /* 34xxES1 only */ | ||
36 | #define CK_3430ES2PLUS (1 << 7) /* 34xxES2, ES3, non-Sitara 35xx only */ | ||
37 | #define CK_3505 (1 << 8) | ||
38 | #define CK_3517 (1 << 9) | ||
39 | #define CK_36XX (1 << 10) /* 36xx/37xx-specific clocks */ | ||
40 | #define CK_443X (1 << 11) | ||
41 | #define CK_TI816X (1 << 12) | ||
42 | #define CK_446X (1 << 13) | ||
43 | |||
44 | |||
45 | #define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS) | ||
46 | #define CK_AM35XX (CK_3505 | CK_3517) /* all Sitara AM35xx */ | ||
47 | #define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX) | ||
48 | |||
49 | |||
50 | #endif | ||
51 | |||
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h new file mode 100644 index 00000000000..df4b9683f17 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/clock.h | |||
@@ -0,0 +1,316 @@ | |||
1 | /* | ||
2 | * OMAP clock: data structure definitions, function prototypes, shared macros | ||
3 | * | ||
4 | * Copyright (C) 2004-2005, 2008-2010 Nokia Corporation | ||
5 | * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> | ||
6 | * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ARCH_ARM_OMAP_CLOCK_H | ||
14 | #define __ARCH_ARM_OMAP_CLOCK_H | ||
15 | |||
16 | #include <linux/list.h> | ||
17 | |||
18 | struct module; | ||
19 | struct clk; | ||
20 | struct clockdomain; | ||
21 | |||
22 | /** | ||
23 | * struct clkops - some clock function pointers | ||
24 | * @enable: fn ptr that enables the current clock in hardware | ||
25 | * @disable: fn ptr that enables the current clock in hardware | ||
26 | * @find_idlest: function returning the IDLEST register for the clock's IP blk | ||
27 | * @find_companion: function returning the "companion" clk reg for the clock | ||
28 | * @allow_idle: fn ptr that enables autoidle for the current clock in hardware | ||
29 | * @deny_idle: fn ptr that disables autoidle for the current clock in hardware | ||
30 | * | ||
31 | * A "companion" clk is an accompanying clock to the one being queried | ||
32 | * that must be enabled for the IP module connected to the clock to | ||
33 | * become accessible by the hardware. Neither @find_idlest nor | ||
34 | * @find_companion should be needed; that information is IP | ||
35 | * block-specific; the hwmod code has been created to handle this, but | ||
36 | * until hwmod data is ready and drivers have been converted to use PM | ||
37 | * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and | ||
38 | * @find_companion must, unfortunately, remain. | ||
39 | */ | ||
40 | struct clkops { | ||
41 | int (*enable)(struct clk *); | ||
42 | void (*disable)(struct clk *); | ||
43 | void (*find_idlest)(struct clk *, void __iomem **, | ||
44 | u8 *, u8 *); | ||
45 | void (*find_companion)(struct clk *, void __iomem **, | ||
46 | u8 *); | ||
47 | void (*allow_idle)(struct clk *); | ||
48 | void (*deny_idle)(struct clk *); | ||
49 | }; | ||
50 | |||
51 | #ifdef CONFIG_ARCH_OMAP2PLUS | ||
52 | |||
53 | /* struct clksel_rate.flags possibilities */ | ||
54 | #define RATE_IN_242X (1 << 0) | ||
55 | #define RATE_IN_243X (1 << 1) | ||
56 | #define RATE_IN_3430ES1 (1 << 2) /* 3430ES1 rates only */ | ||
57 | #define RATE_IN_3430ES2PLUS (1 << 3) /* 3430 ES >= 2 rates only */ | ||
58 | #define RATE_IN_36XX (1 << 4) | ||
59 | #define RATE_IN_4430 (1 << 5) | ||
60 | #define RATE_IN_TI816X (1 << 6) | ||
61 | #define RATE_IN_4460 (1 << 7) | ||
62 | |||
63 | #define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X) | ||
64 | #define RATE_IN_34XX (RATE_IN_3430ES1 | RATE_IN_3430ES2PLUS) | ||
65 | #define RATE_IN_3XXX (RATE_IN_34XX | RATE_IN_36XX) | ||
66 | #define RATE_IN_44XX (RATE_IN_4430 | RATE_IN_4460) | ||
67 | |||
68 | /* RATE_IN_3430ES2PLUS_36XX includes 34xx/35xx with ES >=2, and all 36xx/37xx */ | ||
69 | #define RATE_IN_3430ES2PLUS_36XX (RATE_IN_3430ES2PLUS | RATE_IN_36XX) | ||
70 | |||
71 | |||
72 | /** | ||
73 | * struct clksel_rate - register bitfield values corresponding to clk divisors | ||
74 | * @val: register bitfield value (shifted to bit 0) | ||
75 | * @div: clock divisor corresponding to @val | ||
76 | * @flags: (see "struct clksel_rate.flags possibilities" above) | ||
77 | * | ||
78 | * @val should match the value of a read from struct clk.clksel_reg | ||
79 | * AND'ed with struct clk.clksel_mask, shifted right to bit 0. | ||
80 | * | ||
81 | * @div is the divisor that should be applied to the parent clock's rate | ||
82 | * to produce the current clock's rate. | ||
83 | * | ||
84 | * XXX @flags probably should be replaced with an struct omap_chip. | ||
85 | */ | ||
86 | struct clksel_rate { | ||
87 | u32 val; | ||
88 | u8 div; | ||
89 | u8 flags; | ||
90 | }; | ||
91 | |||
92 | /** | ||
93 | * struct clksel - available parent clocks, and a pointer to their divisors | ||
94 | * @parent: struct clk * to a possible parent clock | ||
95 | * @rates: available divisors for this parent clock | ||
96 | * | ||
97 | * A struct clksel is always associated with one or more struct clks | ||
98 | * and one or more struct clksel_rates. | ||
99 | */ | ||
100 | struct clksel { | ||
101 | struct clk *parent; | ||
102 | const struct clksel_rate *rates; | ||
103 | }; | ||
104 | |||
105 | /** | ||
106 | * struct dpll_data - DPLL registers and integration data | ||
107 | * @mult_div1_reg: register containing the DPLL M and N bitfields | ||
108 | * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg | ||
109 | * @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg | ||
110 | * @clk_bypass: struct clk pointer to the clock's bypass clock input | ||
111 | * @clk_ref: struct clk pointer to the clock's reference clock input | ||
112 | * @control_reg: register containing the DPLL mode bitfield | ||
113 | * @enable_mask: mask of the DPLL mode bitfield in @control_reg | ||
114 | * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate() | ||
115 | * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate() | ||
116 | * @max_multiplier: maximum valid non-bypass multiplier value (actual) | ||
117 | * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate() | ||
118 | * @min_divider: minimum valid non-bypass divider value (actual) | ||
119 | * @max_divider: maximum valid non-bypass divider value (actual) | ||
120 | * @modes: possible values of @enable_mask | ||
121 | * @autoidle_reg: register containing the DPLL autoidle mode bitfield | ||
122 | * @idlest_reg: register containing the DPLL idle status bitfield | ||
123 | * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg | ||
124 | * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg | ||
125 | * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg | ||
126 | * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg | ||
127 | * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs | ||
128 | * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs | ||
129 | * @flags: DPLL type/features (see below) | ||
130 | * | ||
131 | * Possible values for @flags: | ||
132 | * DPLL_J_TYPE: "J-type DPLL" (only some 36xx, 4xxx DPLLs) | ||
133 | * | ||
134 | * @freqsel_mask is only used on the OMAP34xx family and AM35xx. | ||
135 | * | ||
136 | * XXX Some DPLLs have multiple bypass inputs, so it's not technically | ||
137 | * correct to only have one @clk_bypass pointer. | ||
138 | * | ||
139 | * XXX The runtime-variable fields (@last_rounded_rate, @last_rounded_m, | ||
140 | * @last_rounded_n) should be separated from the runtime-fixed fields | ||
141 | * and placed into a different structure, so that the runtime-fixed data | ||
142 | * can be placed into read-only space. | ||
143 | */ | ||
144 | struct dpll_data { | ||
145 | void __iomem *mult_div1_reg; | ||
146 | u32 mult_mask; | ||
147 | u32 div1_mask; | ||
148 | struct clk *clk_bypass; | ||
149 | struct clk *clk_ref; | ||
150 | void __iomem *control_reg; | ||
151 | u32 enable_mask; | ||
152 | unsigned long last_rounded_rate; | ||
153 | u16 last_rounded_m; | ||
154 | u16 max_multiplier; | ||
155 | u8 last_rounded_n; | ||
156 | u8 min_divider; | ||
157 | u16 max_divider; | ||
158 | u8 modes; | ||
159 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) | ||
160 | void __iomem *autoidle_reg; | ||
161 | void __iomem *idlest_reg; | ||
162 | u32 autoidle_mask; | ||
163 | u32 freqsel_mask; | ||
164 | u32 idlest_mask; | ||
165 | u32 dco_mask; | ||
166 | u32 sddiv_mask; | ||
167 | u8 auto_recal_bit; | ||
168 | u8 recal_en_bit; | ||
169 | u8 recal_st_bit; | ||
170 | u8 flags; | ||
171 | # endif | ||
172 | }; | ||
173 | |||
174 | #endif | ||
175 | |||
176 | /* | ||
177 | * struct clk.flags possibilities | ||
178 | * | ||
179 | * XXX document the rest of the clock flags here | ||
180 | * | ||
181 | * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL | ||
182 | * bits share the same register. This flag allows the | ||
183 | * omap4_dpllmx*() code to determine which GATE_CTRL bit field | ||
184 | * should be used. This is a temporary solution - a better approach | ||
185 | * would be to associate clock type-specific data with the clock, | ||
186 | * similar to the struct dpll_data approach. | ||
187 | */ | ||
188 | #define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */ | ||
189 | #define CLOCK_IDLE_CONTROL (1 << 1) | ||
190 | #define CLOCK_NO_IDLE_PARENT (1 << 2) | ||
191 | #define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */ | ||
192 | #define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */ | ||
193 | #define CLOCK_CLKOUTX2 (1 << 5) | ||
194 | |||
195 | /** | ||
196 | * struct clk - OMAP struct clk | ||
197 | * @node: list_head connecting this clock into the full clock list | ||
198 | * @ops: struct clkops * for this clock | ||
199 | * @name: the name of the clock in the hardware (used in hwmod data and debug) | ||
200 | * @parent: pointer to this clock's parent struct clk | ||
201 | * @children: list_head connecting to the child clks' @sibling list_heads | ||
202 | * @sibling: list_head connecting this clk to its parent clk's @children | ||
203 | * @rate: current clock rate | ||
204 | * @enable_reg: register to write to enable the clock (see @enable_bit) | ||
205 | * @recalc: fn ptr that returns the clock's current rate | ||
206 | * @set_rate: fn ptr that can change the clock's current rate | ||
207 | * @round_rate: fn ptr that can round the clock's current rate | ||
208 | * @init: fn ptr to do clock-specific initialization | ||
209 | * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg) | ||
210 | * @usecount: number of users that have requested this clock to be enabled | ||
211 | * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div | ||
212 | * @flags: see "struct clk.flags possibilities" above | ||
213 | * @clksel_reg: for clksel clks, register va containing src/divisor select | ||
214 | * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector | ||
215 | * @clksel: for clksel clks, pointer to struct clksel for this clock | ||
216 | * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock | ||
217 | * @clkdm_name: clockdomain name that this clock is contained in | ||
218 | * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime | ||
219 | * @rate_offset: bitshift for rate selection bitfield (OMAP1 only) | ||
220 | * @src_offset: bitshift for source selection bitfield (OMAP1 only) | ||
221 | * | ||
222 | * XXX @rate_offset, @src_offset should probably be removed and OMAP1 | ||
223 | * clock code converted to use clksel. | ||
224 | * | ||
225 | * XXX @usecount is poorly named. It should be "enable_count" or | ||
226 | * something similar. "users" in the description refers to kernel | ||
227 | * code (core code or drivers) that have called clk_enable() and not | ||
228 | * yet called clk_disable(); the usecount of parent clocks is also | ||
229 | * incremented by the clock code when clk_enable() is called on child | ||
230 | * clocks and decremented by the clock code when clk_disable() is | ||
231 | * called on child clocks. | ||
232 | * | ||
233 | * XXX @clkdm, @usecount, @children, @sibling should be marked for | ||
234 | * internal use only. | ||
235 | * | ||
236 | * @children and @sibling are used to optimize parent-to-child clock | ||
237 | * tree traversals. (child-to-parent traversals use @parent.) | ||
238 | * | ||
239 | * XXX The notion of the clock's current rate probably needs to be | ||
240 | * separated from the clock's target rate. | ||
241 | */ | ||
242 | struct clk { | ||
243 | struct list_head node; | ||
244 | const struct clkops *ops; | ||
245 | const char *name; | ||
246 | struct clk *parent; | ||
247 | struct list_head children; | ||
248 | struct list_head sibling; /* node for children */ | ||
249 | unsigned long rate; | ||
250 | void __iomem *enable_reg; | ||
251 | unsigned long (*recalc)(struct clk *); | ||
252 | int (*set_rate)(struct clk *, unsigned long); | ||
253 | long (*round_rate)(struct clk *, unsigned long); | ||
254 | void (*init)(struct clk *); | ||
255 | u8 enable_bit; | ||
256 | s8 usecount; | ||
257 | u8 fixed_div; | ||
258 | u8 flags; | ||
259 | #ifdef CONFIG_ARCH_OMAP2PLUS | ||
260 | void __iomem *clksel_reg; | ||
261 | u32 clksel_mask; | ||
262 | const struct clksel *clksel; | ||
263 | struct dpll_data *dpll_data; | ||
264 | const char *clkdm_name; | ||
265 | struct clockdomain *clkdm; | ||
266 | #else | ||
267 | u8 rate_offset; | ||
268 | u8 src_offset; | ||
269 | #endif | ||
270 | #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) | ||
271 | struct dentry *dent; /* For visible tree hierarchy */ | ||
272 | #endif | ||
273 | }; | ||
274 | |||
275 | struct cpufreq_frequency_table; | ||
276 | |||
277 | struct clk_functions { | ||
278 | int (*clk_enable)(struct clk *clk); | ||
279 | void (*clk_disable)(struct clk *clk); | ||
280 | long (*clk_round_rate)(struct clk *clk, unsigned long rate); | ||
281 | int (*clk_set_rate)(struct clk *clk, unsigned long rate); | ||
282 | int (*clk_set_parent)(struct clk *clk, struct clk *parent); | ||
283 | void (*clk_allow_idle)(struct clk *clk); | ||
284 | void (*clk_deny_idle)(struct clk *clk); | ||
285 | void (*clk_disable_unused)(struct clk *clk); | ||
286 | #ifdef CONFIG_CPU_FREQ | ||
287 | void (*clk_init_cpufreq_table)(struct cpufreq_frequency_table **); | ||
288 | void (*clk_exit_cpufreq_table)(struct cpufreq_frequency_table **); | ||
289 | #endif | ||
290 | }; | ||
291 | |||
292 | extern int mpurate; | ||
293 | |||
294 | extern int clk_init(struct clk_functions *custom_clocks); | ||
295 | extern void clk_preinit(struct clk *clk); | ||
296 | extern int clk_register(struct clk *clk); | ||
297 | extern void clk_reparent(struct clk *child, struct clk *parent); | ||
298 | extern void clk_unregister(struct clk *clk); | ||
299 | extern void propagate_rate(struct clk *clk); | ||
300 | extern void recalculate_root_clocks(void); | ||
301 | extern unsigned long followparent_recalc(struct clk *clk); | ||
302 | extern void clk_enable_init_clocks(void); | ||
303 | unsigned long omap_fixed_divisor_recalc(struct clk *clk); | ||
304 | #ifdef CONFIG_CPU_FREQ | ||
305 | extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table); | ||
306 | extern void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table); | ||
307 | #endif | ||
308 | extern struct clk *omap_clk_get_by_name(const char *name); | ||
309 | extern int omap_clk_enable_autoidle_all(void); | ||
310 | extern int omap_clk_disable_autoidle_all(void); | ||
311 | |||
312 | extern const struct clkops clkops_null; | ||
313 | |||
314 | extern struct clk dummy_ck; | ||
315 | |||
316 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h new file mode 100644 index 00000000000..4564cc697d7 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/common.h | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/common.h | ||
3 | * | ||
4 | * Header for code common to all OMAP machines. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
12 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
13 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
14 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
15 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
16 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
17 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
18 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
19 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
20 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License along | ||
23 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
24 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | */ | ||
26 | |||
27 | #ifndef __ARCH_ARM_MACH_OMAP_COMMON_H | ||
28 | #define __ARCH_ARM_MACH_OMAP_COMMON_H | ||
29 | |||
30 | #include <linux/delay.h> | ||
31 | |||
32 | #include <plat/i2c.h> | ||
33 | |||
34 | struct sys_timer; | ||
35 | |||
36 | extern void omap_map_common_io(void); | ||
37 | extern struct sys_timer omap1_timer; | ||
38 | extern struct sys_timer omap2_timer; | ||
39 | extern struct sys_timer omap3_timer; | ||
40 | extern struct sys_timer omap3_secure_timer; | ||
41 | extern struct sys_timer omap4_timer; | ||
42 | extern bool omap_32k_timer_init(void); | ||
43 | extern int __init omap_init_clocksource_32k(void); | ||
44 | extern unsigned long long notrace omap_32k_sched_clock(void); | ||
45 | |||
46 | extern void omap_reserve(void); | ||
47 | |||
48 | /* | ||
49 | * IO bases for various OMAP processors | ||
50 | * Except the tap base, rest all the io bases | ||
51 | * listed are physical addresses. | ||
52 | */ | ||
53 | struct omap_globals { | ||
54 | u32 class; /* OMAP class to detect */ | ||
55 | void __iomem *tap; /* Control module ID code */ | ||
56 | unsigned long sdrc; /* SDRAM Controller */ | ||
57 | unsigned long sms; /* SDRAM Memory Scheduler */ | ||
58 | unsigned long ctrl; /* System Control Module */ | ||
59 | unsigned long ctrl_pad; /* PAD Control Module */ | ||
60 | unsigned long prm; /* Power and Reset Management */ | ||
61 | unsigned long cm; /* Clock Management */ | ||
62 | unsigned long cm2; | ||
63 | }; | ||
64 | |||
65 | void omap2_set_globals_242x(void); | ||
66 | void omap2_set_globals_243x(void); | ||
67 | void omap2_set_globals_3xxx(void); | ||
68 | void omap2_set_globals_443x(void); | ||
69 | void omap2_set_globals_ti816x(void); | ||
70 | |||
71 | /* These get called from omap2_set_globals_xxxx(), do not call these */ | ||
72 | void omap2_set_globals_tap(struct omap_globals *); | ||
73 | void omap2_set_globals_sdrc(struct omap_globals *); | ||
74 | void omap2_set_globals_control(struct omap_globals *); | ||
75 | void omap2_set_globals_prcm(struct omap_globals *); | ||
76 | |||
77 | void omap3_map_io(void); | ||
78 | |||
79 | /** | ||
80 | * omap_test_timeout - busy-loop, testing a condition | ||
81 | * @cond: condition to test until it evaluates to true | ||
82 | * @timeout: maximum number of microseconds in the timeout | ||
83 | * @index: loop index (integer) | ||
84 | * | ||
85 | * Loop waiting for @cond to become true or until at least @timeout | ||
86 | * microseconds have passed. To use, define some integer @index in the | ||
87 | * calling code. After running, if @index == @timeout, then the loop has | ||
88 | * timed out. | ||
89 | */ | ||
90 | #define omap_test_timeout(cond, timeout, index) \ | ||
91 | ({ \ | ||
92 | for (index = 0; index < timeout; index++) { \ | ||
93 | if (cond) \ | ||
94 | break; \ | ||
95 | udelay(1); \ | ||
96 | } \ | ||
97 | }) | ||
98 | |||
99 | extern struct device *omap2_get_mpuss_device(void); | ||
100 | extern struct device *omap2_get_iva_device(void); | ||
101 | extern struct device *omap2_get_l3_device(void); | ||
102 | extern struct device *omap4_get_dsp_device(void); | ||
103 | |||
104 | #endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */ | ||
diff --git a/arch/arm/plat-omap/include/plat/dma-44xx.h b/arch/arm/plat-omap/include/plat/dma-44xx.h new file mode 100644 index 00000000000..1f767cb2f38 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/dma-44xx.h | |||
@@ -0,0 +1,147 @@ | |||
1 | /* | ||
2 | * OMAP4 SDMA channel definitions | ||
3 | * | ||
4 | * Copyright (C) 2009-2010 Texas Instruments, Inc. | ||
5 | * Copyright (C) 2009-2010 Nokia Corporation | ||
6 | * | ||
7 | * Santosh Shilimkar (santosh.shilimkar@ti.com) | ||
8 | * Benoit Cousson (b-cousson@ti.com) | ||
9 | * Paul Walmsley (paul@pwsan.com) | ||
10 | * | ||
11 | * This file is automatically generated from the OMAP hardware databases. | ||
12 | * We respectfully ask that any modifications to this file be coordinated | ||
13 | * with the public linux-omap@vger.kernel.org mailing list and the | ||
14 | * authors above to ensure that the autogeneration scripts are kept | ||
15 | * up-to-date with the file contents. | ||
16 | * | ||
17 | * This program is free software; you can redistribute it and/or modify | ||
18 | * it under the terms of the GNU General Public License version 2 as | ||
19 | * published by the Free Software Foundation. | ||
20 | */ | ||
21 | |||
22 | #ifndef __ARCH_ARM_MACH_OMAP2_OMAP44XX_DMA_H | ||
23 | #define __ARCH_ARM_MACH_OMAP2_OMAP44XX_DMA_H | ||
24 | |||
25 | #define OMAP44XX_DMA_SYS_REQ0 2 | ||
26 | #define OMAP44XX_DMA_SYS_REQ1 3 | ||
27 | #define OMAP44XX_DMA_GPMC 4 | ||
28 | #define OMAP44XX_DMA_DSS_DISPC_REQ 6 | ||
29 | #define OMAP44XX_DMA_SYS_REQ2 7 | ||
30 | #define OMAP44XX_DMA_MCASP1_AXEVT 8 | ||
31 | #define OMAP44XX_DMA_ISS_REQ1 9 | ||
32 | #define OMAP44XX_DMA_ISS_REQ2 10 | ||
33 | #define OMAP44XX_DMA_MCASP1_AREVT 11 | ||
34 | #define OMAP44XX_DMA_ISS_REQ3 12 | ||
35 | #define OMAP44XX_DMA_ISS_REQ4 13 | ||
36 | #define OMAP44XX_DMA_DSS_RFBI_REQ 14 | ||
37 | #define OMAP44XX_DMA_SPI3_TX0 15 | ||
38 | #define OMAP44XX_DMA_SPI3_RX0 16 | ||
39 | #define OMAP44XX_DMA_MCBSP2_TX 17 | ||
40 | #define OMAP44XX_DMA_MCBSP2_RX 18 | ||
41 | #define OMAP44XX_DMA_MCBSP3_TX 19 | ||
42 | #define OMAP44XX_DMA_MCBSP3_RX 20 | ||
43 | #define OMAP44XX_DMA_C2C_SSCM_GPO0 21 | ||
44 | #define OMAP44XX_DMA_C2C_SSCM_GPO1 22 | ||
45 | #define OMAP44XX_DMA_SPI3_TX1 23 | ||
46 | #define OMAP44XX_DMA_SPI3_RX1 24 | ||
47 | #define OMAP44XX_DMA_I2C3_TX 25 | ||
48 | #define OMAP44XX_DMA_I2C3_RX 26 | ||
49 | #define OMAP44XX_DMA_I2C1_TX 27 | ||
50 | #define OMAP44XX_DMA_I2C1_RX 28 | ||
51 | #define OMAP44XX_DMA_I2C2_TX 29 | ||
52 | #define OMAP44XX_DMA_I2C2_RX 30 | ||
53 | #define OMAP44XX_DMA_MCBSP4_TX 31 | ||
54 | #define OMAP44XX_DMA_MCBSP4_RX 32 | ||
55 | #define OMAP44XX_DMA_MCBSP1_TX 33 | ||
56 | #define OMAP44XX_DMA_MCBSP1_RX 34 | ||
57 | #define OMAP44XX_DMA_SPI1_TX0 35 | ||
58 | #define OMAP44XX_DMA_SPI1_RX0 36 | ||
59 | #define OMAP44XX_DMA_SPI1_TX1 37 | ||
60 | #define OMAP44XX_DMA_SPI1_RX1 38 | ||
61 | #define OMAP44XX_DMA_SPI1_TX2 39 | ||
62 | #define OMAP44XX_DMA_SPI1_RX2 40 | ||
63 | #define OMAP44XX_DMA_SPI1_TX3 41 | ||
64 | #define OMAP44XX_DMA_SPI1_RX3 42 | ||
65 | #define OMAP44XX_DMA_SPI2_TX0 43 | ||
66 | #define OMAP44XX_DMA_SPI2_RX0 44 | ||
67 | #define OMAP44XX_DMA_SPI2_TX1 45 | ||
68 | #define OMAP44XX_DMA_SPI2_RX1 46 | ||
69 | #define OMAP44XX_DMA_MMC2_TX 47 | ||
70 | #define OMAP44XX_DMA_MMC2_RX 48 | ||
71 | #define OMAP44XX_DMA_UART1_TX 49 | ||
72 | #define OMAP44XX_DMA_UART1_RX 50 | ||
73 | #define OMAP44XX_DMA_UART2_TX 51 | ||
74 | #define OMAP44XX_DMA_UART2_RX 52 | ||
75 | #define OMAP44XX_DMA_UART3_TX 53 | ||
76 | #define OMAP44XX_DMA_UART3_RX 54 | ||
77 | #define OMAP44XX_DMA_UART4_TX 55 | ||
78 | #define OMAP44XX_DMA_UART4_RX 56 | ||
79 | #define OMAP44XX_DMA_MMC4_TX 57 | ||
80 | #define OMAP44XX_DMA_MMC4_RX 58 | ||
81 | #define OMAP44XX_DMA_MMC5_TX 59 | ||
82 | #define OMAP44XX_DMA_MMC5_RX 60 | ||
83 | #define OMAP44XX_DMA_MMC1_TX 61 | ||
84 | #define OMAP44XX_DMA_MMC1_RX 62 | ||
85 | #define OMAP44XX_DMA_SYS_REQ3 64 | ||
86 | #define OMAP44XX_DMA_MCPDM_UP 65 | ||
87 | #define OMAP44XX_DMA_MCPDM_DL 66 | ||
88 | #define OMAP44XX_DMA_DMIC_REQ 67 | ||
89 | #define OMAP44XX_DMA_C2C_SSCM_GPO2 68 | ||
90 | #define OMAP44XX_DMA_C2C_SSCM_GPO3 69 | ||
91 | #define OMAP44XX_DMA_SPI4_TX0 70 | ||
92 | #define OMAP44XX_DMA_SPI4_RX0 71 | ||
93 | #define OMAP44XX_DMA_DSS_DSI1_REQ0 72 | ||
94 | #define OMAP44XX_DMA_DSS_DSI1_REQ1 73 | ||
95 | #define OMAP44XX_DMA_DSS_DSI1_REQ2 74 | ||
96 | #define OMAP44XX_DMA_DSS_DSI1_REQ3 75 | ||
97 | #define OMAP44XX_DMA_DSS_HDMI_REQ 76 | ||
98 | #define OMAP44XX_DMA_MMC3_TX 77 | ||
99 | #define OMAP44XX_DMA_MMC3_RX 78 | ||
100 | #define OMAP44XX_DMA_USIM_TX 79 | ||
101 | #define OMAP44XX_DMA_USIM_RX 80 | ||
102 | #define OMAP44XX_DMA_DSS_DSI2_REQ0 81 | ||
103 | #define OMAP44XX_DMA_DSS_DSI2_REQ1 82 | ||
104 | #define OMAP44XX_DMA_DSS_DSI2_REQ2 83 | ||
105 | #define OMAP44XX_DMA_DSS_DSI2_REQ3 84 | ||
106 | #define OMAP44XX_DMA_SLIMBUS1_TX0 85 | ||
107 | #define OMAP44XX_DMA_SLIMBUS1_TX1 86 | ||
108 | #define OMAP44XX_DMA_SLIMBUS1_TX2 87 | ||
109 | #define OMAP44XX_DMA_SLIMBUS1_TX3 88 | ||
110 | #define OMAP44XX_DMA_SLIMBUS1_RX0 89 | ||
111 | #define OMAP44XX_DMA_SLIMBUS1_RX1 90 | ||
112 | #define OMAP44XX_DMA_SLIMBUS1_RX2 91 | ||
113 | #define OMAP44XX_DMA_SLIMBUS1_RX3 92 | ||
114 | #define OMAP44XX_DMA_SLIMBUS2_TX0 93 | ||
115 | #define OMAP44XX_DMA_SLIMBUS2_TX1 94 | ||
116 | #define OMAP44XX_DMA_SLIMBUS2_TX2 95 | ||
117 | #define OMAP44XX_DMA_SLIMBUS2_TX3 96 | ||
118 | #define OMAP44XX_DMA_SLIMBUS2_RX0 97 | ||
119 | #define OMAP44XX_DMA_SLIMBUS2_RX1 98 | ||
120 | #define OMAP44XX_DMA_SLIMBUS2_RX2 99 | ||
121 | #define OMAP44XX_DMA_SLIMBUS2_RX3 100 | ||
122 | #define OMAP44XX_DMA_ABE_REQ_0 101 | ||
123 | #define OMAP44XX_DMA_ABE_REQ_1 102 | ||
124 | #define OMAP44XX_DMA_ABE_REQ_2 103 | ||
125 | #define OMAP44XX_DMA_ABE_REQ_3 104 | ||
126 | #define OMAP44XX_DMA_ABE_REQ_4 105 | ||
127 | #define OMAP44XX_DMA_ABE_REQ_5 106 | ||
128 | #define OMAP44XX_DMA_ABE_REQ_6 107 | ||
129 | #define OMAP44XX_DMA_ABE_REQ_7 108 | ||
130 | #define OMAP44XX_DMA_AES1_P_CTX_IN_REQ 109 | ||
131 | #define OMAP44XX_DMA_AES1_P_DATA_IN_REQ 110 | ||
132 | #define OMAP44XX_DMA_AES1_P_DATA_OUT_REQ 111 | ||
133 | #define OMAP44XX_DMA_AES2_P_CTX_IN_REQ 112 | ||
134 | #define OMAP44XX_DMA_AES2_P_DATA_IN_REQ 113 | ||
135 | #define OMAP44XX_DMA_AES2_P_DATA_OUT_REQ 114 | ||
136 | #define OMAP44XX_DMA_DES_P_CTX_IN_REQ 115 | ||
137 | #define OMAP44XX_DMA_DES_P_DATA_IN_REQ 116 | ||
138 | #define OMAP44XX_DMA_DES_P_DATA_OUT_REQ 117 | ||
139 | #define OMAP44XX_DMA_SHA2_CTXIN_P 118 | ||
140 | #define OMAP44XX_DMA_SHA2_DIN_P 119 | ||
141 | #define OMAP44XX_DMA_SHA2_CTXOUT_P 120 | ||
142 | #define OMAP44XX_DMA_AES1_P_CONTEXT_OUT_REQ 121 | ||
143 | #define OMAP44XX_DMA_AES2_P_CONTEXT_OUT_REQ 122 | ||
144 | #define OMAP44XX_DMA_I2C4_TX 124 | ||
145 | #define OMAP44XX_DMA_I2C4_RX 125 | ||
146 | |||
147 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/dma.h b/arch/arm/plat-omap/include/plat/dma.h new file mode 100644 index 00000000000..dc562a5c0a8 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/dma.h | |||
@@ -0,0 +1,538 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/dma.h | ||
3 | * | ||
4 | * Copyright (C) 2003 Nokia Corporation | ||
5 | * Author: Juha Yrjölä <juha.yrjola@nokia.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | #ifndef __ASM_ARCH_DMA_H | ||
22 | #define __ASM_ARCH_DMA_H | ||
23 | |||
24 | #include <linux/platform_device.h> | ||
25 | |||
26 | /* | ||
27 | * TODO: These dma channel defines should go away once all | ||
28 | * the omap drivers hwmod adapted. | ||
29 | */ | ||
30 | |||
31 | /* Move omap4 specific defines to dma-44xx.h */ | ||
32 | #include "dma-44xx.h" | ||
33 | |||
34 | /* DMA channels for omap1 */ | ||
35 | #define OMAP_DMA_NO_DEVICE 0 | ||
36 | #define OMAP_DMA_MCSI1_TX 1 | ||
37 | #define OMAP_DMA_MCSI1_RX 2 | ||
38 | #define OMAP_DMA_I2C_RX 3 | ||
39 | #define OMAP_DMA_I2C_TX 4 | ||
40 | #define OMAP_DMA_EXT_NDMA_REQ 5 | ||
41 | #define OMAP_DMA_EXT_NDMA_REQ2 6 | ||
42 | #define OMAP_DMA_UWIRE_TX 7 | ||
43 | #define OMAP_DMA_MCBSP1_TX 8 | ||
44 | #define OMAP_DMA_MCBSP1_RX 9 | ||
45 | #define OMAP_DMA_MCBSP3_TX 10 | ||
46 | #define OMAP_DMA_MCBSP3_RX 11 | ||
47 | #define OMAP_DMA_UART1_TX 12 | ||
48 | #define OMAP_DMA_UART1_RX 13 | ||
49 | #define OMAP_DMA_UART2_TX 14 | ||
50 | #define OMAP_DMA_UART2_RX 15 | ||
51 | #define OMAP_DMA_MCBSP2_TX 16 | ||
52 | #define OMAP_DMA_MCBSP2_RX 17 | ||
53 | #define OMAP_DMA_UART3_TX 18 | ||
54 | #define OMAP_DMA_UART3_RX 19 | ||
55 | #define OMAP_DMA_CAMERA_IF_RX 20 | ||
56 | #define OMAP_DMA_MMC_TX 21 | ||
57 | #define OMAP_DMA_MMC_RX 22 | ||
58 | #define OMAP_DMA_NAND 23 | ||
59 | #define OMAP_DMA_IRQ_LCD_LINE 24 | ||
60 | #define OMAP_DMA_MEMORY_STICK 25 | ||
61 | #define OMAP_DMA_USB_W2FC_RX0 26 | ||
62 | #define OMAP_DMA_USB_W2FC_RX1 27 | ||
63 | #define OMAP_DMA_USB_W2FC_RX2 28 | ||
64 | #define OMAP_DMA_USB_W2FC_TX0 29 | ||
65 | #define OMAP_DMA_USB_W2FC_TX1 30 | ||
66 | #define OMAP_DMA_USB_W2FC_TX2 31 | ||
67 | |||
68 | /* These are only for 1610 */ | ||
69 | #define OMAP_DMA_CRYPTO_DES_IN 32 | ||
70 | #define OMAP_DMA_SPI_TX 33 | ||
71 | #define OMAP_DMA_SPI_RX 34 | ||
72 | #define OMAP_DMA_CRYPTO_HASH 35 | ||
73 | #define OMAP_DMA_CCP_ATTN 36 | ||
74 | #define OMAP_DMA_CCP_FIFO_NOT_EMPTY 37 | ||
75 | #define OMAP_DMA_CMT_APE_TX_CHAN_0 38 | ||
76 | #define OMAP_DMA_CMT_APE_RV_CHAN_0 39 | ||
77 | #define OMAP_DMA_CMT_APE_TX_CHAN_1 40 | ||
78 | #define OMAP_DMA_CMT_APE_RV_CHAN_1 41 | ||
79 | #define OMAP_DMA_CMT_APE_TX_CHAN_2 42 | ||
80 | #define OMAP_DMA_CMT_APE_RV_CHAN_2 43 | ||
81 | #define OMAP_DMA_CMT_APE_TX_CHAN_3 44 | ||
82 | #define OMAP_DMA_CMT_APE_RV_CHAN_3 45 | ||
83 | #define OMAP_DMA_CMT_APE_TX_CHAN_4 46 | ||
84 | #define OMAP_DMA_CMT_APE_RV_CHAN_4 47 | ||
85 | #define OMAP_DMA_CMT_APE_TX_CHAN_5 48 | ||
86 | #define OMAP_DMA_CMT_APE_RV_CHAN_5 49 | ||
87 | #define OMAP_DMA_CMT_APE_TX_CHAN_6 50 | ||
88 | #define OMAP_DMA_CMT_APE_RV_CHAN_6 51 | ||
89 | #define OMAP_DMA_CMT_APE_TX_CHAN_7 52 | ||
90 | #define OMAP_DMA_CMT_APE_RV_CHAN_7 53 | ||
91 | #define OMAP_DMA_MMC2_TX 54 | ||
92 | #define OMAP_DMA_MMC2_RX 55 | ||
93 | #define OMAP_DMA_CRYPTO_DES_OUT 56 | ||
94 | |||
95 | /* DMA channels for 24xx */ | ||
96 | #define OMAP24XX_DMA_NO_DEVICE 0 | ||
97 | #define OMAP24XX_DMA_XTI_DMA 1 /* S_DMA_0 */ | ||
98 | #define OMAP24XX_DMA_EXT_DMAREQ0 2 /* S_DMA_1 */ | ||
99 | #define OMAP24XX_DMA_EXT_DMAREQ1 3 /* S_DMA_2 */ | ||
100 | #define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */ | ||
101 | #define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */ | ||
102 | #define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */ | ||
103 | #define OMAP242X_DMA_VLYNQ_TX 7 /* S_DMA_6 */ | ||
104 | #define OMAP24XX_DMA_EXT_DMAREQ2 7 /* S_DMA_6 */ | ||
105 | #define OMAP24XX_DMA_CWT 8 /* S_DMA_7 */ | ||
106 | #define OMAP24XX_DMA_AES_TX 9 /* S_DMA_8 */ | ||
107 | #define OMAP24XX_DMA_AES_RX 10 /* S_DMA_9 */ | ||
108 | #define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */ | ||
109 | #define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */ | ||
110 | #define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */ | ||
111 | #define OMAP34XX_DMA_SHA2MD5_RX 13 /* S_DMA_12 */ | ||
112 | #define OMAP242X_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */ | ||
113 | #define OMAP242X_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */ | ||
114 | #define OMAP242X_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */ | ||
115 | #define OMAP242X_DMA_EAC_AC_RD 17 /* S_DMA_16 */ | ||
116 | #define OMAP242X_DMA_EAC_AC_WR 18 /* S_DMA_17 */ | ||
117 | #define OMAP242X_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */ | ||
118 | #define OMAP242X_DMA_EAC_MD_UL_WR 20 /* S_DMA_19 */ | ||
119 | #define OMAP242X_DMA_EAC_MD_DL_RD 21 /* S_DMA_20 */ | ||
120 | #define OMAP242X_DMA_EAC_MD_DL_WR 22 /* S_DMA_21 */ | ||
121 | #define OMAP242X_DMA_EAC_BT_UL_RD 23 /* S_DMA_22 */ | ||
122 | #define OMAP242X_DMA_EAC_BT_UL_WR 24 /* S_DMA_23 */ | ||
123 | #define OMAP242X_DMA_EAC_BT_DL_RD 25 /* S_DMA_24 */ | ||
124 | #define OMAP242X_DMA_EAC_BT_DL_WR 26 /* S_DMA_25 */ | ||
125 | #define OMAP243X_DMA_EXT_DMAREQ3 14 /* S_DMA_13 */ | ||
126 | #define OMAP24XX_DMA_SPI3_TX0 15 /* S_DMA_14 */ | ||
127 | #define OMAP24XX_DMA_SPI3_RX0 16 /* S_DMA_15 */ | ||
128 | #define OMAP24XX_DMA_MCBSP3_TX 17 /* S_DMA_16 */ | ||
129 | #define OMAP24XX_DMA_MCBSP3_RX 18 /* S_DMA_17 */ | ||
130 | #define OMAP24XX_DMA_MCBSP4_TX 19 /* S_DMA_18 */ | ||
131 | #define OMAP24XX_DMA_MCBSP4_RX 20 /* S_DMA_19 */ | ||
132 | #define OMAP24XX_DMA_MCBSP5_TX 21 /* S_DMA_20 */ | ||
133 | #define OMAP24XX_DMA_MCBSP5_RX 22 /* S_DMA_21 */ | ||
134 | #define OMAP24XX_DMA_SPI3_TX1 23 /* S_DMA_22 */ | ||
135 | #define OMAP24XX_DMA_SPI3_RX1 24 /* S_DMA_23 */ | ||
136 | #define OMAP243X_DMA_EXT_DMAREQ4 25 /* S_DMA_24 */ | ||
137 | #define OMAP243X_DMA_EXT_DMAREQ5 26 /* S_DMA_25 */ | ||
138 | #define OMAP34XX_DMA_I2C3_TX 25 /* S_DMA_24 */ | ||
139 | #define OMAP34XX_DMA_I2C3_RX 26 /* S_DMA_25 */ | ||
140 | #define OMAP24XX_DMA_I2C1_TX 27 /* S_DMA_26 */ | ||
141 | #define OMAP24XX_DMA_I2C1_RX 28 /* S_DMA_27 */ | ||
142 | #define OMAP24XX_DMA_I2C2_TX 29 /* S_DMA_28 */ | ||
143 | #define OMAP24XX_DMA_I2C2_RX 30 /* S_DMA_29 */ | ||
144 | #define OMAP24XX_DMA_MCBSP1_TX 31 /* S_DMA_30 */ | ||
145 | #define OMAP24XX_DMA_MCBSP1_RX 32 /* S_DMA_31 */ | ||
146 | #define OMAP24XX_DMA_MCBSP2_TX 33 /* S_DMA_32 */ | ||
147 | #define OMAP24XX_DMA_MCBSP2_RX 34 /* S_DMA_33 */ | ||
148 | #define OMAP24XX_DMA_SPI1_TX0 35 /* S_DMA_34 */ | ||
149 | #define OMAP24XX_DMA_SPI1_RX0 36 /* S_DMA_35 */ | ||
150 | #define OMAP24XX_DMA_SPI1_TX1 37 /* S_DMA_36 */ | ||
151 | #define OMAP24XX_DMA_SPI1_RX1 38 /* S_DMA_37 */ | ||
152 | #define OMAP24XX_DMA_SPI1_TX2 39 /* S_DMA_38 */ | ||
153 | #define OMAP24XX_DMA_SPI1_RX2 40 /* S_DMA_39 */ | ||
154 | #define OMAP24XX_DMA_SPI1_TX3 41 /* S_DMA_40 */ | ||
155 | #define OMAP24XX_DMA_SPI1_RX3 42 /* S_DMA_41 */ | ||
156 | #define OMAP24XX_DMA_SPI2_TX0 43 /* S_DMA_42 */ | ||
157 | #define OMAP24XX_DMA_SPI2_RX0 44 /* S_DMA_43 */ | ||
158 | #define OMAP24XX_DMA_SPI2_TX1 45 /* S_DMA_44 */ | ||
159 | #define OMAP24XX_DMA_SPI2_RX1 46 /* S_DMA_45 */ | ||
160 | #define OMAP24XX_DMA_MMC2_TX 47 /* S_DMA_46 */ | ||
161 | #define OMAP24XX_DMA_MMC2_RX 48 /* S_DMA_47 */ | ||
162 | #define OMAP24XX_DMA_UART1_TX 49 /* S_DMA_48 */ | ||
163 | #define OMAP24XX_DMA_UART1_RX 50 /* S_DMA_49 */ | ||
164 | #define OMAP24XX_DMA_UART2_TX 51 /* S_DMA_50 */ | ||
165 | #define OMAP24XX_DMA_UART2_RX 52 /* S_DMA_51 */ | ||
166 | #define OMAP24XX_DMA_UART3_TX 53 /* S_DMA_52 */ | ||
167 | #define OMAP24XX_DMA_UART3_RX 54 /* S_DMA_53 */ | ||
168 | #define OMAP24XX_DMA_USB_W2FC_TX0 55 /* S_DMA_54 */ | ||
169 | #define OMAP24XX_DMA_USB_W2FC_RX0 56 /* S_DMA_55 */ | ||
170 | #define OMAP24XX_DMA_USB_W2FC_TX1 57 /* S_DMA_56 */ | ||
171 | #define OMAP24XX_DMA_USB_W2FC_RX1 58 /* S_DMA_57 */ | ||
172 | #define OMAP24XX_DMA_USB_W2FC_TX2 59 /* S_DMA_58 */ | ||
173 | #define OMAP24XX_DMA_USB_W2FC_RX2 60 /* S_DMA_59 */ | ||
174 | #define OMAP24XX_DMA_MMC1_TX 61 /* S_DMA_60 */ | ||
175 | #define OMAP24XX_DMA_MMC1_RX 62 /* S_DMA_61 */ | ||
176 | #define OMAP24XX_DMA_MS 63 /* S_DMA_62 */ | ||
177 | #define OMAP242X_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */ | ||
178 | #define OMAP243X_DMA_EXT_DMAREQ6 64 /* S_DMA_63 */ | ||
179 | #define OMAP34XX_DMA_EXT_DMAREQ3 64 /* S_DMA_63 */ | ||
180 | #define OMAP34XX_DMA_AES2_TX 65 /* S_DMA_64 */ | ||
181 | #define OMAP34XX_DMA_AES2_RX 66 /* S_DMA_65 */ | ||
182 | #define OMAP34XX_DMA_DES2_TX 67 /* S_DMA_66 */ | ||
183 | #define OMAP34XX_DMA_DES2_RX 68 /* S_DMA_67 */ | ||
184 | #define OMAP34XX_DMA_SHA1MD5_RX 69 /* S_DMA_68 */ | ||
185 | #define OMAP34XX_DMA_SPI4_TX0 70 /* S_DMA_69 */ | ||
186 | #define OMAP34XX_DMA_SPI4_RX0 71 /* S_DMA_70 */ | ||
187 | #define OMAP34XX_DSS_DMA0 72 /* S_DMA_71 */ | ||
188 | #define OMAP34XX_DSS_DMA1 73 /* S_DMA_72 */ | ||
189 | #define OMAP34XX_DSS_DMA2 74 /* S_DMA_73 */ | ||
190 | #define OMAP34XX_DSS_DMA3 75 /* S_DMA_74 */ | ||
191 | #define OMAP34XX_DMA_MMC3_TX 77 /* S_DMA_76 */ | ||
192 | #define OMAP34XX_DMA_MMC3_RX 78 /* S_DMA_77 */ | ||
193 | #define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */ | ||
194 | #define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */ | ||
195 | |||
196 | #define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */ | ||
197 | #define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */ | ||
198 | |||
199 | /* Only for AM35xx */ | ||
200 | #define AM35XX_DMA_UART4_TX 54 | ||
201 | #define AM35XX_DMA_UART4_RX 55 | ||
202 | |||
203 | /*----------------------------------------------------------------------------*/ | ||
204 | |||
205 | #define OMAP1_DMA_TOUT_IRQ (1 << 0) | ||
206 | #define OMAP_DMA_DROP_IRQ (1 << 1) | ||
207 | #define OMAP_DMA_HALF_IRQ (1 << 2) | ||
208 | #define OMAP_DMA_FRAME_IRQ (1 << 3) | ||
209 | #define OMAP_DMA_LAST_IRQ (1 << 4) | ||
210 | #define OMAP_DMA_BLOCK_IRQ (1 << 5) | ||
211 | #define OMAP1_DMA_SYNC_IRQ (1 << 6) | ||
212 | #define OMAP2_DMA_PKT_IRQ (1 << 7) | ||
213 | #define OMAP2_DMA_TRANS_ERR_IRQ (1 << 8) | ||
214 | #define OMAP2_DMA_SECURE_ERR_IRQ (1 << 9) | ||
215 | #define OMAP2_DMA_SUPERVISOR_ERR_IRQ (1 << 10) | ||
216 | #define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11) | ||
217 | |||
218 | #define OMAP_DMA_CCR_EN (1 << 7) | ||
219 | #define OMAP_DMA_CCR_RD_ACTIVE (1 << 9) | ||
220 | #define OMAP_DMA_CCR_WR_ACTIVE (1 << 10) | ||
221 | #define OMAP_DMA_CCR_SEL_SRC_DST_SYNC (1 << 24) | ||
222 | #define OMAP_DMA_CCR_BUFFERING_DISABLE (1 << 25) | ||
223 | |||
224 | #define OMAP_DMA_DATA_TYPE_S8 0x00 | ||
225 | #define OMAP_DMA_DATA_TYPE_S16 0x01 | ||
226 | #define OMAP_DMA_DATA_TYPE_S32 0x02 | ||
227 | |||
228 | #define OMAP_DMA_SYNC_ELEMENT 0x00 | ||
229 | #define OMAP_DMA_SYNC_FRAME 0x01 | ||
230 | #define OMAP_DMA_SYNC_BLOCK 0x02 | ||
231 | #define OMAP_DMA_SYNC_PACKET 0x03 | ||
232 | |||
233 | #define OMAP_DMA_DST_SYNC_PREFETCH 0x02 | ||
234 | #define OMAP_DMA_SRC_SYNC 0x01 | ||
235 | #define OMAP_DMA_DST_SYNC 0x00 | ||
236 | |||
237 | #define OMAP_DMA_PORT_EMIFF 0x00 | ||
238 | #define OMAP_DMA_PORT_EMIFS 0x01 | ||
239 | #define OMAP_DMA_PORT_OCP_T1 0x02 | ||
240 | #define OMAP_DMA_PORT_TIPB 0x03 | ||
241 | #define OMAP_DMA_PORT_OCP_T2 0x04 | ||
242 | #define OMAP_DMA_PORT_MPUI 0x05 | ||
243 | |||
244 | #define OMAP_DMA_AMODE_CONSTANT 0x00 | ||
245 | #define OMAP_DMA_AMODE_POST_INC 0x01 | ||
246 | #define OMAP_DMA_AMODE_SINGLE_IDX 0x02 | ||
247 | #define OMAP_DMA_AMODE_DOUBLE_IDX 0x03 | ||
248 | |||
249 | #define DMA_DEFAULT_FIFO_DEPTH 0x10 | ||
250 | #define DMA_DEFAULT_ARB_RATE 0x01 | ||
251 | /* Pass THREAD_RESERVE ORed with THREAD_FIFO for tparams */ | ||
252 | #define DMA_THREAD_RESERVE_NORM (0x00 << 12) /* Def */ | ||
253 | #define DMA_THREAD_RESERVE_ONET (0x01 << 12) | ||
254 | #define DMA_THREAD_RESERVE_TWOT (0x02 << 12) | ||
255 | #define DMA_THREAD_RESERVE_THREET (0x03 << 12) | ||
256 | #define DMA_THREAD_FIFO_NONE (0x00 << 14) /* Def */ | ||
257 | #define DMA_THREAD_FIFO_75 (0x01 << 14) | ||
258 | #define DMA_THREAD_FIFO_25 (0x02 << 14) | ||
259 | #define DMA_THREAD_FIFO_50 (0x03 << 14) | ||
260 | |||
261 | /* DMA4_OCP_SYSCONFIG bits */ | ||
262 | #define DMA_SYSCONFIG_MIDLEMODE_MASK (3 << 12) | ||
263 | #define DMA_SYSCONFIG_CLOCKACTIVITY_MASK (3 << 8) | ||
264 | #define DMA_SYSCONFIG_EMUFREE (1 << 5) | ||
265 | #define DMA_SYSCONFIG_SIDLEMODE_MASK (3 << 3) | ||
266 | #define DMA_SYSCONFIG_SOFTRESET (1 << 2) | ||
267 | #define DMA_SYSCONFIG_AUTOIDLE (1 << 0) | ||
268 | |||
269 | #define DMA_SYSCONFIG_MIDLEMODE(n) ((n) << 12) | ||
270 | #define DMA_SYSCONFIG_SIDLEMODE(n) ((n) << 3) | ||
271 | |||
272 | #define DMA_IDLEMODE_SMARTIDLE 0x2 | ||
273 | #define DMA_IDLEMODE_NO_IDLE 0x1 | ||
274 | #define DMA_IDLEMODE_FORCE_IDLE 0x0 | ||
275 | |||
276 | /* Chaining modes*/ | ||
277 | #ifndef CONFIG_ARCH_OMAP1 | ||
278 | #define OMAP_DMA_STATIC_CHAIN 0x1 | ||
279 | #define OMAP_DMA_DYNAMIC_CHAIN 0x2 | ||
280 | #define OMAP_DMA_CHAIN_ACTIVE 0x1 | ||
281 | #define OMAP_DMA_CHAIN_INACTIVE 0x0 | ||
282 | #endif | ||
283 | |||
284 | #define DMA_CH_PRIO_HIGH 0x1 | ||
285 | #define DMA_CH_PRIO_LOW 0x0 /* Def */ | ||
286 | |||
287 | /* Errata handling */ | ||
288 | #define IS_DMA_ERRATA(id) (errata & (id)) | ||
289 | #define SET_DMA_ERRATA(id) (errata |= (id)) | ||
290 | |||
291 | #define DMA_ERRATA_IFRAME_BUFFERING BIT(0x0) | ||
292 | #define DMA_ERRATA_PARALLEL_CHANNELS BIT(0x1) | ||
293 | #define DMA_ERRATA_i378 BIT(0x2) | ||
294 | #define DMA_ERRATA_i541 BIT(0x3) | ||
295 | #define DMA_ERRATA_i88 BIT(0x4) | ||
296 | #define DMA_ERRATA_3_3 BIT(0x5) | ||
297 | #define DMA_ROMCODE_BUG BIT(0x6) | ||
298 | |||
299 | /* Attributes for OMAP DMA Contrller */ | ||
300 | #define DMA_LINKED_LCH BIT(0x0) | ||
301 | #define GLOBAL_PRIORITY BIT(0x1) | ||
302 | #define RESERVE_CHANNEL BIT(0x2) | ||
303 | #define IS_CSSA_32 BIT(0x3) | ||
304 | #define IS_CDSA_32 BIT(0x4) | ||
305 | #define IS_RW_PRIORITY BIT(0x5) | ||
306 | #define ENABLE_1510_MODE BIT(0x6) | ||
307 | #define SRC_PORT BIT(0x7) | ||
308 | #define DST_PORT BIT(0x8) | ||
309 | #define SRC_INDEX BIT(0x9) | ||
310 | #define DST_INDEX BIT(0xA) | ||
311 | #define IS_BURST_ONLY4 BIT(0xB) | ||
312 | #define CLEAR_CSR_ON_READ BIT(0xC) | ||
313 | #define IS_WORD_16 BIT(0xD) | ||
314 | |||
315 | enum omap_reg_offsets { | ||
316 | |||
317 | GCR, GSCR, GRST1, HW_ID, | ||
318 | PCH2_ID, PCH0_ID, PCH1_ID, PCHG_ID, | ||
319 | PCHD_ID, CAPS_0, CAPS_1, CAPS_2, | ||
320 | CAPS_3, CAPS_4, PCH2_SR, PCH0_SR, | ||
321 | PCH1_SR, PCHD_SR, REVISION, IRQSTATUS_L0, | ||
322 | IRQSTATUS_L1, IRQSTATUS_L2, IRQSTATUS_L3, IRQENABLE_L0, | ||
323 | IRQENABLE_L1, IRQENABLE_L2, IRQENABLE_L3, SYSSTATUS, | ||
324 | OCP_SYSCONFIG, | ||
325 | |||
326 | /* omap1+ specific */ | ||
327 | CPC, CCR2, LCH_CTRL, | ||
328 | |||
329 | /* Common registers for all omap's */ | ||
330 | CSDP, CCR, CICR, CSR, | ||
331 | CEN, CFN, CSFI, CSEI, | ||
332 | CSAC, CDAC, CDEI, | ||
333 | CDFI, CLNK_CTRL, | ||
334 | |||
335 | /* Channel specific registers */ | ||
336 | CSSA, CDSA, COLOR, | ||
337 | CCEN, CCFN, | ||
338 | |||
339 | /* omap3630 and omap4 specific */ | ||
340 | CDP, CNDP, CCDN, | ||
341 | |||
342 | }; | ||
343 | |||
344 | enum omap_dma_burst_mode { | ||
345 | OMAP_DMA_DATA_BURST_DIS = 0, | ||
346 | OMAP_DMA_DATA_BURST_4, | ||
347 | OMAP_DMA_DATA_BURST_8, | ||
348 | OMAP_DMA_DATA_BURST_16, | ||
349 | }; | ||
350 | |||
351 | enum end_type { | ||
352 | OMAP_DMA_LITTLE_ENDIAN = 0, | ||
353 | OMAP_DMA_BIG_ENDIAN | ||
354 | }; | ||
355 | |||
356 | enum omap_dma_color_mode { | ||
357 | OMAP_DMA_COLOR_DIS = 0, | ||
358 | OMAP_DMA_CONSTANT_FILL, | ||
359 | OMAP_DMA_TRANSPARENT_COPY | ||
360 | }; | ||
361 | |||
362 | enum omap_dma_write_mode { | ||
363 | OMAP_DMA_WRITE_NON_POSTED = 0, | ||
364 | OMAP_DMA_WRITE_POSTED, | ||
365 | OMAP_DMA_WRITE_LAST_NON_POSTED | ||
366 | }; | ||
367 | |||
368 | enum omap_dma_channel_mode { | ||
369 | OMAP_DMA_LCH_2D = 0, | ||
370 | OMAP_DMA_LCH_G, | ||
371 | OMAP_DMA_LCH_P, | ||
372 | OMAP_DMA_LCH_PD | ||
373 | }; | ||
374 | |||
375 | struct omap_dma_channel_params { | ||
376 | int data_type; /* data type 8,16,32 */ | ||
377 | int elem_count; /* number of elements in a frame */ | ||
378 | int frame_count; /* number of frames in a element */ | ||
379 | |||
380 | int src_port; /* Only on OMAP1 REVISIT: Is this needed? */ | ||
381 | int src_amode; /* constant, post increment, indexed, | ||
382 | double indexed */ | ||
383 | unsigned long src_start; /* source address : physical */ | ||
384 | int src_ei; /* source element index */ | ||
385 | int src_fi; /* source frame index */ | ||
386 | |||
387 | int dst_port; /* Only on OMAP1 REVISIT: Is this needed? */ | ||
388 | int dst_amode; /* constant, post increment, indexed, | ||
389 | double indexed */ | ||
390 | unsigned long dst_start; /* source address : physical */ | ||
391 | int dst_ei; /* source element index */ | ||
392 | int dst_fi; /* source frame index */ | ||
393 | |||
394 | int trigger; /* trigger attached if the channel is | ||
395 | synchronized */ | ||
396 | int sync_mode; /* sycn on element, frame , block or packet */ | ||
397 | int src_or_dst_synch; /* source synch(1) or destination synch(0) */ | ||
398 | |||
399 | int ie; /* interrupt enabled */ | ||
400 | |||
401 | unsigned char read_prio;/* read priority */ | ||
402 | unsigned char write_prio;/* write priority */ | ||
403 | |||
404 | #ifndef CONFIG_ARCH_OMAP1 | ||
405 | enum omap_dma_burst_mode burst_mode; /* Burst mode 4/8/16 words */ | ||
406 | #endif | ||
407 | }; | ||
408 | |||
409 | struct omap_dma_lch { | ||
410 | int next_lch; | ||
411 | int dev_id; | ||
412 | u16 saved_csr; | ||
413 | u16 enabled_irqs; | ||
414 | const char *dev_name; | ||
415 | void (*callback)(int lch, u16 ch_status, void *data); | ||
416 | void *data; | ||
417 | long flags; | ||
418 | /* required for Dynamic chaining */ | ||
419 | int prev_linked_ch; | ||
420 | int next_linked_ch; | ||
421 | int state; | ||
422 | int chain_id; | ||
423 | int status; | ||
424 | }; | ||
425 | |||
426 | struct omap_dma_dev_attr { | ||
427 | u32 dev_caps; | ||
428 | u16 lch_count; | ||
429 | u16 chan_count; | ||
430 | struct omap_dma_lch *chan; | ||
431 | }; | ||
432 | |||
433 | /* System DMA platform data structure */ | ||
434 | struct omap_system_dma_plat_info { | ||
435 | struct omap_dma_dev_attr *dma_attr; | ||
436 | u32 errata; | ||
437 | void (*disable_irq_lch)(int lch); | ||
438 | void (*show_dma_caps)(void); | ||
439 | void (*clear_lch_regs)(int lch); | ||
440 | void (*clear_dma)(int lch); | ||
441 | void (*dma_write)(u32 val, int reg, int lch); | ||
442 | u32 (*dma_read)(int reg, int lch); | ||
443 | }; | ||
444 | |||
445 | extern void omap_set_dma_priority(int lch, int dst_port, int priority); | ||
446 | extern int omap_request_dma(int dev_id, const char *dev_name, | ||
447 | void (*callback)(int lch, u16 ch_status, void *data), | ||
448 | void *data, int *dma_ch); | ||
449 | extern void omap_enable_dma_irq(int ch, u16 irq_bits); | ||
450 | extern void omap_disable_dma_irq(int ch, u16 irq_bits); | ||
451 | extern void omap_free_dma(int ch); | ||
452 | extern void omap_start_dma(int lch); | ||
453 | extern void omap_stop_dma(int lch); | ||
454 | extern void omap_set_dma_transfer_params(int lch, int data_type, | ||
455 | int elem_count, int frame_count, | ||
456 | int sync_mode, | ||
457 | int dma_trigger, int src_or_dst_synch); | ||
458 | extern void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, | ||
459 | u32 color); | ||
460 | extern void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode); | ||
461 | extern void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode); | ||
462 | |||
463 | extern void omap_set_dma_src_params(int lch, int src_port, int src_amode, | ||
464 | unsigned long src_start, | ||
465 | int src_ei, int src_fi); | ||
466 | extern void omap_set_dma_src_index(int lch, int eidx, int fidx); | ||
467 | extern void omap_set_dma_src_data_pack(int lch, int enable); | ||
468 | extern void omap_set_dma_src_burst_mode(int lch, | ||
469 | enum omap_dma_burst_mode burst_mode); | ||
470 | |||
471 | extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, | ||
472 | unsigned long dest_start, | ||
473 | int dst_ei, int dst_fi); | ||
474 | extern void omap_set_dma_dest_index(int lch, int eidx, int fidx); | ||
475 | extern void omap_set_dma_dest_data_pack(int lch, int enable); | ||
476 | extern void omap_set_dma_dest_burst_mode(int lch, | ||
477 | enum omap_dma_burst_mode burst_mode); | ||
478 | |||
479 | extern void omap_set_dma_params(int lch, | ||
480 | struct omap_dma_channel_params *params); | ||
481 | |||
482 | extern void omap_dma_link_lch(int lch_head, int lch_queue); | ||
483 | extern void omap_dma_unlink_lch(int lch_head, int lch_queue); | ||
484 | |||
485 | extern int omap_set_dma_callback(int lch, | ||
486 | void (*callback)(int lch, u16 ch_status, void *data), | ||
487 | void *data); | ||
488 | extern dma_addr_t omap_get_dma_src_pos(int lch); | ||
489 | extern dma_addr_t omap_get_dma_dst_pos(int lch); | ||
490 | extern void omap_clear_dma(int lch); | ||
491 | extern int omap_get_dma_active_status(int lch); | ||
492 | extern int omap_dma_running(void); | ||
493 | extern void omap_dma_set_global_params(int arb_rate, int max_fifo_depth, | ||
494 | int tparams); | ||
495 | extern int omap_dma_set_prio_lch(int lch, unsigned char read_prio, | ||
496 | unsigned char write_prio); | ||
497 | extern void omap_set_dma_dst_endian_type(int lch, enum end_type etype); | ||
498 | extern void omap_set_dma_src_endian_type(int lch, enum end_type etype); | ||
499 | extern int omap_get_dma_index(int lch, int *ei, int *fi); | ||
500 | |||
501 | void omap_dma_global_context_save(void); | ||
502 | void omap_dma_global_context_restore(void); | ||
503 | |||
504 | extern void omap_dma_disable_irq(int lch); | ||
505 | |||
506 | /* Chaining APIs */ | ||
507 | #ifndef CONFIG_ARCH_OMAP1 | ||
508 | extern int omap_request_dma_chain(int dev_id, const char *dev_name, | ||
509 | void (*callback) (int lch, u16 ch_status, | ||
510 | void *data), | ||
511 | int *chain_id, int no_of_chans, | ||
512 | int chain_mode, | ||
513 | struct omap_dma_channel_params params); | ||
514 | extern int omap_free_dma_chain(int chain_id); | ||
515 | extern int omap_dma_chain_a_transfer(int chain_id, int src_start, | ||
516 | int dest_start, int elem_count, | ||
517 | int frame_count, void *callbk_data); | ||
518 | extern int omap_start_dma_chain_transfers(int chain_id); | ||
519 | extern int omap_stop_dma_chain_transfers(int chain_id); | ||
520 | extern int omap_get_dma_chain_index(int chain_id, int *ei, int *fi); | ||
521 | extern int omap_get_dma_chain_dst_pos(int chain_id); | ||
522 | extern int omap_get_dma_chain_src_pos(int chain_id); | ||
523 | |||
524 | extern int omap_modify_dma_chain_params(int chain_id, | ||
525 | struct omap_dma_channel_params params); | ||
526 | extern int omap_dma_chain_status(int chain_id); | ||
527 | #endif | ||
528 | |||
529 | #if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_FB_OMAP) | ||
530 | #include <mach/lcd_dma.h> | ||
531 | #else | ||
532 | static inline int omap_lcd_dma_running(void) | ||
533 | { | ||
534 | return 0; | ||
535 | } | ||
536 | #endif | ||
537 | |||
538 | #endif /* __ASM_ARCH_DMA_H */ | ||
diff --git a/arch/arm/plat-omap/include/plat/dsp.h b/arch/arm/plat-omap/include/plat/dsp.h new file mode 100644 index 00000000000..9c604b390f9 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/dsp.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef __OMAP_DSP_H__ | ||
2 | #define __OMAP_DSP_H__ | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct omap_dsp_platform_data { | ||
7 | void (*dsp_set_min_opp) (u8 opp_id); | ||
8 | u8 (*dsp_get_opp) (void); | ||
9 | void (*cpu_set_freq) (unsigned long f); | ||
10 | unsigned long (*cpu_get_freq) (void); | ||
11 | unsigned long mpu_speed[6]; | ||
12 | |||
13 | /* functions to write and read PRCM registers */ | ||
14 | void (*dsp_prm_write)(u32, s16 , u16); | ||
15 | u32 (*dsp_prm_read)(s16 , u16); | ||
16 | u32 (*dsp_prm_rmw_bits)(u32, u32, s16, s16); | ||
17 | void (*dsp_cm_write)(u32, s16 , u16); | ||
18 | u32 (*dsp_cm_read)(s16 , u16); | ||
19 | u32 (*dsp_cm_rmw_bits)(u32, u32, s16, s16); | ||
20 | |||
21 | phys_addr_t phys_mempool_base; | ||
22 | phys_addr_t phys_mempool_size; | ||
23 | }; | ||
24 | |||
25 | #if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE) | ||
26 | extern void omap_dsp_reserve_sdram_memblock(void); | ||
27 | #else | ||
28 | static inline void omap_dsp_reserve_sdram_memblock(void) { } | ||
29 | #endif | ||
30 | |||
31 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/flash.h b/arch/arm/plat-omap/include/plat/flash.h new file mode 100644 index 00000000000..0d88499b79e --- /dev/null +++ b/arch/arm/plat-omap/include/plat/flash.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * Flash support for OMAP1 | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #ifndef __OMAP_FLASH_H | ||
10 | #define __OMAP_FLASH_H | ||
11 | |||
12 | #include <linux/mtd/map.h> | ||
13 | |||
14 | struct platform_device; | ||
15 | extern void omap1_set_vpp(struct platform_device *pdev, int enable); | ||
16 | |||
17 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/fpga.h b/arch/arm/plat-omap/include/plat/fpga.h new file mode 100644 index 00000000000..bd3c6324ae1 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/fpga.h | |||
@@ -0,0 +1,193 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/fpga.h | ||
3 | * | ||
4 | * Interrupt handler for OMAP-1510 FPGA | ||
5 | * | ||
6 | * Copyright (C) 2001 RidgeRun, Inc. | ||
7 | * Author: Greg Lonnon <glonnon@ridgerun.com> | ||
8 | * | ||
9 | * Copyright (C) 2002 MontaVista Software, Inc. | ||
10 | * | ||
11 | * Separated FPGA interrupts from innovator1510.c and cleaned up for 2.6 | ||
12 | * Copyright (C) 2004 Nokia Corporation by Tony Lindrgen <tony@atomide.com> | ||
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 | #ifndef __ASM_ARCH_OMAP_FPGA_H | ||
20 | #define __ASM_ARCH_OMAP_FPGA_H | ||
21 | |||
22 | extern void omap1510_fpga_init_irq(void); | ||
23 | |||
24 | #define fpga_read(reg) __raw_readb(reg) | ||
25 | #define fpga_write(val, reg) __raw_writeb(val, reg) | ||
26 | |||
27 | /* | ||
28 | * --------------------------------------------------------------------------- | ||
29 | * H2/P2 Debug board FPGA | ||
30 | * --------------------------------------------------------------------------- | ||
31 | */ | ||
32 | /* maps in the FPGA registers and the ETHR registers */ | ||
33 | #define H2P2_DBG_FPGA_BASE 0xE8000000 /* VA */ | ||
34 | #define H2P2_DBG_FPGA_SIZE SZ_4K /* SIZE */ | ||
35 | #define H2P2_DBG_FPGA_START 0x04000000 /* PA */ | ||
36 | |||
37 | #define H2P2_DBG_FPGA_ETHR_START (H2P2_DBG_FPGA_START + 0x300) | ||
38 | #define H2P2_DBG_FPGA_FPGA_REV IOMEM(H2P2_DBG_FPGA_BASE + 0x10) /* FPGA Revision */ | ||
39 | #define H2P2_DBG_FPGA_BOARD_REV IOMEM(H2P2_DBG_FPGA_BASE + 0x12) /* Board Revision */ | ||
40 | #define H2P2_DBG_FPGA_GPIO IOMEM(H2P2_DBG_FPGA_BASE + 0x14) /* GPIO outputs */ | ||
41 | #define H2P2_DBG_FPGA_LEDS IOMEM(H2P2_DBG_FPGA_BASE + 0x16) /* LEDs outputs */ | ||
42 | #define H2P2_DBG_FPGA_MISC_INPUTS IOMEM(H2P2_DBG_FPGA_BASE + 0x18) /* Misc inputs */ | ||
43 | #define H2P2_DBG_FPGA_LAN_STATUS IOMEM(H2P2_DBG_FPGA_BASE + 0x1A) /* LAN Status line */ | ||
44 | #define H2P2_DBG_FPGA_LAN_RESET IOMEM(H2P2_DBG_FPGA_BASE + 0x1C) /* LAN Reset line */ | ||
45 | |||
46 | /* NOTE: most boards don't have a static mapping for the FPGA ... */ | ||
47 | struct h2p2_dbg_fpga { | ||
48 | /* offset 0x00 */ | ||
49 | u16 smc91x[8]; | ||
50 | /* offset 0x10 */ | ||
51 | u16 fpga_rev; | ||
52 | u16 board_rev; | ||
53 | u16 gpio_outputs; | ||
54 | u16 leds; | ||
55 | /* offset 0x18 */ | ||
56 | u16 misc_inputs; | ||
57 | u16 lan_status; | ||
58 | u16 lan_reset; | ||
59 | u16 reserved0; | ||
60 | /* offset 0x20 */ | ||
61 | u16 ps2_data; | ||
62 | u16 ps2_ctrl; | ||
63 | /* plus also 4 rs232 ports ... */ | ||
64 | }; | ||
65 | |||
66 | /* LEDs definition on debug board (16 LEDs, all physically green) */ | ||
67 | #define H2P2_DBG_FPGA_LED_GREEN (1 << 15) | ||
68 | #define H2P2_DBG_FPGA_LED_AMBER (1 << 14) | ||
69 | #define H2P2_DBG_FPGA_LED_RED (1 << 13) | ||
70 | #define H2P2_DBG_FPGA_LED_BLUE (1 << 12) | ||
71 | /* cpu0 load-meter LEDs */ | ||
72 | #define H2P2_DBG_FPGA_LOAD_METER (1 << 0) // A bit of fun on our board ... | ||
73 | #define H2P2_DBG_FPGA_LOAD_METER_SIZE 11 | ||
74 | #define H2P2_DBG_FPGA_LOAD_METER_MASK ((1 << H2P2_DBG_FPGA_LOAD_METER_SIZE) - 1) | ||
75 | |||
76 | #define H2P2_DBG_FPGA_P2_LED_TIMER (1 << 0) | ||
77 | #define H2P2_DBG_FPGA_P2_LED_IDLE (1 << 1) | ||
78 | |||
79 | /* | ||
80 | * --------------------------------------------------------------------------- | ||
81 | * OMAP-1510 FPGA | ||
82 | * --------------------------------------------------------------------------- | ||
83 | */ | ||
84 | #define OMAP1510_FPGA_BASE 0xE8000000 /* VA */ | ||
85 | #define OMAP1510_FPGA_SIZE SZ_4K | ||
86 | #define OMAP1510_FPGA_START 0x08000000 /* PA */ | ||
87 | |||
88 | /* Revision */ | ||
89 | #define OMAP1510_FPGA_REV_LOW IOMEM(OMAP1510_FPGA_BASE + 0x0) | ||
90 | #define OMAP1510_FPGA_REV_HIGH IOMEM(OMAP1510_FPGA_BASE + 0x1) | ||
91 | |||
92 | #define OMAP1510_FPGA_LCD_PANEL_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x2) | ||
93 | #define OMAP1510_FPGA_LED_DIGIT IOMEM(OMAP1510_FPGA_BASE + 0x3) | ||
94 | #define INNOVATOR_FPGA_HID_SPI IOMEM(OMAP1510_FPGA_BASE + 0x4) | ||
95 | #define OMAP1510_FPGA_POWER IOMEM(OMAP1510_FPGA_BASE + 0x5) | ||
96 | |||
97 | /* Interrupt status */ | ||
98 | #define OMAP1510_FPGA_ISR_LO IOMEM(OMAP1510_FPGA_BASE + 0x6) | ||
99 | #define OMAP1510_FPGA_ISR_HI IOMEM(OMAP1510_FPGA_BASE + 0x7) | ||
100 | |||
101 | /* Interrupt mask */ | ||
102 | #define OMAP1510_FPGA_IMR_LO IOMEM(OMAP1510_FPGA_BASE + 0x8) | ||
103 | #define OMAP1510_FPGA_IMR_HI IOMEM(OMAP1510_FPGA_BASE + 0x9) | ||
104 | |||
105 | /* Reset registers */ | ||
106 | #define OMAP1510_FPGA_HOST_RESET IOMEM(OMAP1510_FPGA_BASE + 0xa) | ||
107 | #define OMAP1510_FPGA_RST IOMEM(OMAP1510_FPGA_BASE + 0xb) | ||
108 | |||
109 | #define OMAP1510_FPGA_AUDIO IOMEM(OMAP1510_FPGA_BASE + 0xc) | ||
110 | #define OMAP1510_FPGA_DIP IOMEM(OMAP1510_FPGA_BASE + 0xe) | ||
111 | #define OMAP1510_FPGA_FPGA_IO IOMEM(OMAP1510_FPGA_BASE + 0xf) | ||
112 | #define OMAP1510_FPGA_UART1 IOMEM(OMAP1510_FPGA_BASE + 0x14) | ||
113 | #define OMAP1510_FPGA_UART2 IOMEM(OMAP1510_FPGA_BASE + 0x15) | ||
114 | #define OMAP1510_FPGA_OMAP1510_STATUS IOMEM(OMAP1510_FPGA_BASE + 0x16) | ||
115 | #define OMAP1510_FPGA_BOARD_REV IOMEM(OMAP1510_FPGA_BASE + 0x18) | ||
116 | #define OMAP1510P1_PPT_DATA IOMEM(OMAP1510_FPGA_BASE + 0x100) | ||
117 | #define OMAP1510P1_PPT_STATUS IOMEM(OMAP1510_FPGA_BASE + 0x101) | ||
118 | #define OMAP1510P1_PPT_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x102) | ||
119 | |||
120 | #define OMAP1510_FPGA_TOUCHSCREEN IOMEM(OMAP1510_FPGA_BASE + 0x204) | ||
121 | |||
122 | #define INNOVATOR_FPGA_INFO IOMEM(OMAP1510_FPGA_BASE + 0x205) | ||
123 | #define INNOVATOR_FPGA_LCD_BRIGHT_LO IOMEM(OMAP1510_FPGA_BASE + 0x206) | ||
124 | #define INNOVATOR_FPGA_LCD_BRIGHT_HI IOMEM(OMAP1510_FPGA_BASE + 0x207) | ||
125 | #define INNOVATOR_FPGA_LED_GRN_LO IOMEM(OMAP1510_FPGA_BASE + 0x208) | ||
126 | #define INNOVATOR_FPGA_LED_GRN_HI IOMEM(OMAP1510_FPGA_BASE + 0x209) | ||
127 | #define INNOVATOR_FPGA_LED_RED_LO IOMEM(OMAP1510_FPGA_BASE + 0x20a) | ||
128 | #define INNOVATOR_FPGA_LED_RED_HI IOMEM(OMAP1510_FPGA_BASE + 0x20b) | ||
129 | #define INNOVATOR_FPGA_CAM_USB_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x20c) | ||
130 | #define INNOVATOR_FPGA_EXP_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x20d) | ||
131 | #define INNOVATOR_FPGA_ISR2 IOMEM(OMAP1510_FPGA_BASE + 0x20e) | ||
132 | #define INNOVATOR_FPGA_IMR2 IOMEM(OMAP1510_FPGA_BASE + 0x210) | ||
133 | |||
134 | #define OMAP1510_FPGA_ETHR_START (OMAP1510_FPGA_START + 0x300) | ||
135 | |||
136 | /* | ||
137 | * Power up Giga UART driver, turn on HID clock. | ||
138 | * Turn off BT power, since we're not using it and it | ||
139 | * draws power. | ||
140 | */ | ||
141 | #define OMAP1510_FPGA_RESET_VALUE 0x42 | ||
142 | |||
143 | #define OMAP1510_FPGA_PCR_IF_PD0 (1 << 7) | ||
144 | #define OMAP1510_FPGA_PCR_COM2_EN (1 << 6) | ||
145 | #define OMAP1510_FPGA_PCR_COM1_EN (1 << 5) | ||
146 | #define OMAP1510_FPGA_PCR_EXP_PD0 (1 << 4) | ||
147 | #define OMAP1510_FPGA_PCR_EXP_PD1 (1 << 3) | ||
148 | #define OMAP1510_FPGA_PCR_48MHZ_CLK (1 << 2) | ||
149 | #define OMAP1510_FPGA_PCR_4MHZ_CLK (1 << 1) | ||
150 | #define OMAP1510_FPGA_PCR_RSRVD_BIT0 (1 << 0) | ||
151 | |||
152 | /* | ||
153 | * Innovator/OMAP1510 FPGA HID register bit definitions | ||
154 | */ | ||
155 | #define OMAP1510_FPGA_HID_SCLK (1<<0) /* output */ | ||
156 | #define OMAP1510_FPGA_HID_MOSI (1<<1) /* output */ | ||
157 | #define OMAP1510_FPGA_HID_nSS (1<<2) /* output 0/1 chip idle/select */ | ||
158 | #define OMAP1510_FPGA_HID_nHSUS (1<<3) /* output 0/1 host active/suspended */ | ||
159 | #define OMAP1510_FPGA_HID_MISO (1<<4) /* input */ | ||
160 | #define OMAP1510_FPGA_HID_ATN (1<<5) /* input 0/1 chip idle/ATN */ | ||
161 | #define OMAP1510_FPGA_HID_rsrvd (1<<6) | ||
162 | #define OMAP1510_FPGA_HID_RESETn (1<<7) /* output - 0/1 USAR reset/run */ | ||
163 | |||
164 | /* The FPGA IRQ is cascaded through GPIO_13 */ | ||
165 | #define OMAP1510_INT_FPGA (IH_GPIO_BASE + 13) | ||
166 | |||
167 | /* IRQ Numbers for interrupts muxed through the FPGA */ | ||
168 | #define OMAP1510_INT_FPGA_ATN (OMAP_FPGA_IRQ_BASE + 0) | ||
169 | #define OMAP1510_INT_FPGA_ACK (OMAP_FPGA_IRQ_BASE + 1) | ||
170 | #define OMAP1510_INT_FPGA2 (OMAP_FPGA_IRQ_BASE + 2) | ||
171 | #define OMAP1510_INT_FPGA3 (OMAP_FPGA_IRQ_BASE + 3) | ||
172 | #define OMAP1510_INT_FPGA4 (OMAP_FPGA_IRQ_BASE + 4) | ||
173 | #define OMAP1510_INT_FPGA5 (OMAP_FPGA_IRQ_BASE + 5) | ||
174 | #define OMAP1510_INT_FPGA6 (OMAP_FPGA_IRQ_BASE + 6) | ||
175 | #define OMAP1510_INT_FPGA7 (OMAP_FPGA_IRQ_BASE + 7) | ||
176 | #define OMAP1510_INT_FPGA8 (OMAP_FPGA_IRQ_BASE + 8) | ||
177 | #define OMAP1510_INT_FPGA9 (OMAP_FPGA_IRQ_BASE + 9) | ||
178 | #define OMAP1510_INT_FPGA10 (OMAP_FPGA_IRQ_BASE + 10) | ||
179 | #define OMAP1510_INT_FPGA11 (OMAP_FPGA_IRQ_BASE + 11) | ||
180 | #define OMAP1510_INT_FPGA12 (OMAP_FPGA_IRQ_BASE + 12) | ||
181 | #define OMAP1510_INT_ETHER (OMAP_FPGA_IRQ_BASE + 13) | ||
182 | #define OMAP1510_INT_FPGAUART1 (OMAP_FPGA_IRQ_BASE + 14) | ||
183 | #define OMAP1510_INT_FPGAUART2 (OMAP_FPGA_IRQ_BASE + 15) | ||
184 | #define OMAP1510_INT_FPGA_TS (OMAP_FPGA_IRQ_BASE + 16) | ||
185 | #define OMAP1510_INT_FPGA17 (OMAP_FPGA_IRQ_BASE + 17) | ||
186 | #define OMAP1510_INT_FPGA_CAM (OMAP_FPGA_IRQ_BASE + 18) | ||
187 | #define OMAP1510_INT_FPGA_RTC_A (OMAP_FPGA_IRQ_BASE + 19) | ||
188 | #define OMAP1510_INT_FPGA_RTC_B (OMAP_FPGA_IRQ_BASE + 20) | ||
189 | #define OMAP1510_INT_FPGA_CD (OMAP_FPGA_IRQ_BASE + 21) | ||
190 | #define OMAP1510_INT_FPGA22 (OMAP_FPGA_IRQ_BASE + 22) | ||
191 | #define OMAP1510_INT_FPGA23 (OMAP_FPGA_IRQ_BASE + 23) | ||
192 | |||
193 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/gpio-switch.h b/arch/arm/plat-omap/include/plat/gpio-switch.h new file mode 100644 index 00000000000..10da0e07c0c --- /dev/null +++ b/arch/arm/plat-omap/include/plat/gpio-switch.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * GPIO switch definitions | ||
3 | * | ||
4 | * Copyright (C) 2006 Nokia Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASM_ARCH_OMAP_GPIO_SWITCH_H | ||
12 | #define __ASM_ARCH_OMAP_GPIO_SWITCH_H | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | |||
16 | /* Cover: | ||
17 | * high -> closed | ||
18 | * low -> open | ||
19 | * Connection: | ||
20 | * high -> connected | ||
21 | * low -> disconnected | ||
22 | * Activity: | ||
23 | * high -> active | ||
24 | * low -> inactive | ||
25 | * | ||
26 | */ | ||
27 | #define OMAP_GPIO_SWITCH_TYPE_COVER 0x0000 | ||
28 | #define OMAP_GPIO_SWITCH_TYPE_CONNECTION 0x0001 | ||
29 | #define OMAP_GPIO_SWITCH_TYPE_ACTIVITY 0x0002 | ||
30 | #define OMAP_GPIO_SWITCH_FLAG_INVERTED 0x0001 | ||
31 | #define OMAP_GPIO_SWITCH_FLAG_OUTPUT 0x0002 | ||
32 | |||
33 | struct omap_gpio_switch { | ||
34 | const char *name; | ||
35 | s16 gpio; | ||
36 | unsigned flags:4; | ||
37 | unsigned type:4; | ||
38 | |||
39 | /* Time in ms to debounce when transitioning from | ||
40 | * inactive state to active state. */ | ||
41 | u16 debounce_rising; | ||
42 | /* Same for transition from active to inactive state. */ | ||
43 | u16 debounce_falling; | ||
44 | |||
45 | /* notify board-specific code about state changes */ | ||
46 | void (* notify)(void *data, int state); | ||
47 | void *notify_data; | ||
48 | }; | ||
49 | |||
50 | /* Call at init time only */ | ||
51 | extern void omap_register_gpio_switches(const struct omap_gpio_switch *tbl, | ||
52 | int count); | ||
53 | |||
54 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h new file mode 100644 index 00000000000..91e8de3db08 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/gpio.h | |||
@@ -0,0 +1,262 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/gpio.h | ||
3 | * | ||
4 | * OMAP GPIO handling defines and functions | ||
5 | * | ||
6 | * Copyright (C) 2003-2005 Nokia Corporation | ||
7 | * | ||
8 | * Written by Juha Yrjölä <juha.yrjola@nokia.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | * | ||
24 | */ | ||
25 | |||
26 | #ifndef __ASM_ARCH_OMAP_GPIO_H | ||
27 | #define __ASM_ARCH_OMAP_GPIO_H | ||
28 | |||
29 | #include <linux/io.h> | ||
30 | #include <linux/platform_device.h> | ||
31 | #include <mach/irqs.h> | ||
32 | |||
33 | #define OMAP1_MPUIO_BASE 0xfffb5000 | ||
34 | |||
35 | /* | ||
36 | * These are the omap15xx/16xx offsets. The omap7xx offset are | ||
37 | * OMAP_MPUIO_ / 2 offsets below. | ||
38 | */ | ||
39 | #define OMAP_MPUIO_INPUT_LATCH 0x00 | ||
40 | #define OMAP_MPUIO_OUTPUT 0x04 | ||
41 | #define OMAP_MPUIO_IO_CNTL 0x08 | ||
42 | #define OMAP_MPUIO_KBR_LATCH 0x10 | ||
43 | #define OMAP_MPUIO_KBC 0x14 | ||
44 | #define OMAP_MPUIO_GPIO_EVENT_MODE 0x18 | ||
45 | #define OMAP_MPUIO_GPIO_INT_EDGE 0x1c | ||
46 | #define OMAP_MPUIO_KBD_INT 0x20 | ||
47 | #define OMAP_MPUIO_GPIO_INT 0x24 | ||
48 | #define OMAP_MPUIO_KBD_MASKIT 0x28 | ||
49 | #define OMAP_MPUIO_GPIO_MASKIT 0x2c | ||
50 | #define OMAP_MPUIO_GPIO_DEBOUNCING 0x30 | ||
51 | #define OMAP_MPUIO_LATCH 0x34 | ||
52 | |||
53 | #define OMAP34XX_NR_GPIOS 6 | ||
54 | |||
55 | /* | ||
56 | * OMAP1510 GPIO registers | ||
57 | */ | ||
58 | #define OMAP1510_GPIO_DATA_INPUT 0x00 | ||
59 | #define OMAP1510_GPIO_DATA_OUTPUT 0x04 | ||
60 | #define OMAP1510_GPIO_DIR_CONTROL 0x08 | ||
61 | #define OMAP1510_GPIO_INT_CONTROL 0x0c | ||
62 | #define OMAP1510_GPIO_INT_MASK 0x10 | ||
63 | #define OMAP1510_GPIO_INT_STATUS 0x14 | ||
64 | #define OMAP1510_GPIO_PIN_CONTROL 0x18 | ||
65 | |||
66 | #define OMAP1510_IH_GPIO_BASE 64 | ||
67 | |||
68 | /* | ||
69 | * OMAP1610 specific GPIO registers | ||
70 | */ | ||
71 | #define OMAP1610_GPIO_REVISION 0x0000 | ||
72 | #define OMAP1610_GPIO_SYSCONFIG 0x0010 | ||
73 | #define OMAP1610_GPIO_SYSSTATUS 0x0014 | ||
74 | #define OMAP1610_GPIO_IRQSTATUS1 0x0018 | ||
75 | #define OMAP1610_GPIO_IRQENABLE1 0x001c | ||
76 | #define OMAP1610_GPIO_WAKEUPENABLE 0x0028 | ||
77 | #define OMAP1610_GPIO_DATAIN 0x002c | ||
78 | #define OMAP1610_GPIO_DATAOUT 0x0030 | ||
79 | #define OMAP1610_GPIO_DIRECTION 0x0034 | ||
80 | #define OMAP1610_GPIO_EDGE_CTRL1 0x0038 | ||
81 | #define OMAP1610_GPIO_EDGE_CTRL2 0x003c | ||
82 | #define OMAP1610_GPIO_CLEAR_IRQENABLE1 0x009c | ||
83 | #define OMAP1610_GPIO_CLEAR_WAKEUPENA 0x00a8 | ||
84 | #define OMAP1610_GPIO_CLEAR_DATAOUT 0x00b0 | ||
85 | #define OMAP1610_GPIO_SET_IRQENABLE1 0x00dc | ||
86 | #define OMAP1610_GPIO_SET_WAKEUPENA 0x00e8 | ||
87 | #define OMAP1610_GPIO_SET_DATAOUT 0x00f0 | ||
88 | |||
89 | /* | ||
90 | * OMAP7XX specific GPIO registers | ||
91 | */ | ||
92 | #define OMAP7XX_GPIO_DATA_INPUT 0x00 | ||
93 | #define OMAP7XX_GPIO_DATA_OUTPUT 0x04 | ||
94 | #define OMAP7XX_GPIO_DIR_CONTROL 0x08 | ||
95 | #define OMAP7XX_GPIO_INT_CONTROL 0x0c | ||
96 | #define OMAP7XX_GPIO_INT_MASK 0x10 | ||
97 | #define OMAP7XX_GPIO_INT_STATUS 0x14 | ||
98 | |||
99 | /* | ||
100 | * omap2+ specific GPIO registers | ||
101 | */ | ||
102 | #define OMAP24XX_GPIO_REVISION 0x0000 | ||
103 | #define OMAP24XX_GPIO_IRQSTATUS1 0x0018 | ||
104 | #define OMAP24XX_GPIO_IRQSTATUS2 0x0028 | ||
105 | #define OMAP24XX_GPIO_IRQENABLE2 0x002c | ||
106 | #define OMAP24XX_GPIO_IRQENABLE1 0x001c | ||
107 | #define OMAP24XX_GPIO_WAKE_EN 0x0020 | ||
108 | #define OMAP24XX_GPIO_CTRL 0x0030 | ||
109 | #define OMAP24XX_GPIO_OE 0x0034 | ||
110 | #define OMAP24XX_GPIO_DATAIN 0x0038 | ||
111 | #define OMAP24XX_GPIO_DATAOUT 0x003c | ||
112 | #define OMAP24XX_GPIO_LEVELDETECT0 0x0040 | ||
113 | #define OMAP24XX_GPIO_LEVELDETECT1 0x0044 | ||
114 | #define OMAP24XX_GPIO_RISINGDETECT 0x0048 | ||
115 | #define OMAP24XX_GPIO_FALLINGDETECT 0x004c | ||
116 | #define OMAP24XX_GPIO_DEBOUNCE_EN 0x0050 | ||
117 | #define OMAP24XX_GPIO_DEBOUNCE_VAL 0x0054 | ||
118 | #define OMAP24XX_GPIO_CLEARIRQENABLE1 0x0060 | ||
119 | #define OMAP24XX_GPIO_SETIRQENABLE1 0x0064 | ||
120 | #define OMAP24XX_GPIO_CLEARWKUENA 0x0080 | ||
121 | #define OMAP24XX_GPIO_SETWKUENA 0x0084 | ||
122 | #define OMAP24XX_GPIO_CLEARDATAOUT 0x0090 | ||
123 | #define OMAP24XX_GPIO_SETDATAOUT 0x0094 | ||
124 | |||
125 | #define OMAP4_GPIO_REVISION 0x0000 | ||
126 | #define OMAP4_GPIO_EOI 0x0020 | ||
127 | #define OMAP4_GPIO_IRQSTATUSRAW0 0x0024 | ||
128 | #define OMAP4_GPIO_IRQSTATUSRAW1 0x0028 | ||
129 | #define OMAP4_GPIO_IRQSTATUS0 0x002c | ||
130 | #define OMAP4_GPIO_IRQSTATUS1 0x0030 | ||
131 | #define OMAP4_GPIO_IRQSTATUSSET0 0x0034 | ||
132 | #define OMAP4_GPIO_IRQSTATUSSET1 0x0038 | ||
133 | #define OMAP4_GPIO_IRQSTATUSCLR0 0x003c | ||
134 | #define OMAP4_GPIO_IRQSTATUSCLR1 0x0040 | ||
135 | #define OMAP4_GPIO_IRQWAKEN0 0x0044 | ||
136 | #define OMAP4_GPIO_IRQWAKEN1 0x0048 | ||
137 | #define OMAP4_GPIO_IRQENABLE1 0x011c | ||
138 | #define OMAP4_GPIO_WAKE_EN 0x0120 | ||
139 | #define OMAP4_GPIO_IRQSTATUS2 0x0128 | ||
140 | #define OMAP4_GPIO_IRQENABLE2 0x012c | ||
141 | #define OMAP4_GPIO_CTRL 0x0130 | ||
142 | #define OMAP4_GPIO_OE 0x0134 | ||
143 | #define OMAP4_GPIO_DATAIN 0x0138 | ||
144 | #define OMAP4_GPIO_DATAOUT 0x013c | ||
145 | #define OMAP4_GPIO_LEVELDETECT0 0x0140 | ||
146 | #define OMAP4_GPIO_LEVELDETECT1 0x0144 | ||
147 | #define OMAP4_GPIO_RISINGDETECT 0x0148 | ||
148 | #define OMAP4_GPIO_FALLINGDETECT 0x014c | ||
149 | #define OMAP4_GPIO_DEBOUNCENABLE 0x0150 | ||
150 | #define OMAP4_GPIO_DEBOUNCINGTIME 0x0154 | ||
151 | #define OMAP4_GPIO_CLEARIRQENABLE1 0x0160 | ||
152 | #define OMAP4_GPIO_SETIRQENABLE1 0x0164 | ||
153 | #define OMAP4_GPIO_CLEARWKUENA 0x0180 | ||
154 | #define OMAP4_GPIO_SETWKUENA 0x0184 | ||
155 | #define OMAP4_GPIO_CLEARDATAOUT 0x0190 | ||
156 | #define OMAP4_GPIO_SETDATAOUT 0x0194 | ||
157 | |||
158 | #define OMAP_MPUIO(nr) (OMAP_MAX_GPIO_LINES + (nr)) | ||
159 | #define OMAP_GPIO_IS_MPUIO(nr) ((nr) >= OMAP_MAX_GPIO_LINES) | ||
160 | |||
161 | #define OMAP_GPIO_IRQ(nr) (OMAP_GPIO_IS_MPUIO(nr) ? \ | ||
162 | IH_MPUIO_BASE + ((nr) & 0x0f) : \ | ||
163 | IH_GPIO_BASE + (nr)) | ||
164 | |||
165 | #define METHOD_MPUIO 0 | ||
166 | #define METHOD_GPIO_1510 1 | ||
167 | #define METHOD_GPIO_1610 2 | ||
168 | #define METHOD_GPIO_7XX 3 | ||
169 | #define METHOD_GPIO_24XX 5 | ||
170 | #define METHOD_GPIO_44XX 6 | ||
171 | |||
172 | struct omap_gpio_dev_attr { | ||
173 | int bank_width; /* GPIO bank width */ | ||
174 | bool dbck_flag; /* dbck required or not - True for OMAP3&4 */ | ||
175 | }; | ||
176 | |||
177 | struct omap_gpio_reg_offs { | ||
178 | u16 revision; | ||
179 | u16 direction; | ||
180 | u16 datain; | ||
181 | u16 dataout; | ||
182 | u16 set_dataout; | ||
183 | u16 clr_dataout; | ||
184 | u16 irqstatus; | ||
185 | u16 irqstatus2; | ||
186 | u16 irqenable; | ||
187 | u16 set_irqenable; | ||
188 | u16 clr_irqenable; | ||
189 | u16 debounce; | ||
190 | u16 debounce_en; | ||
191 | |||
192 | bool irqenable_inv; | ||
193 | }; | ||
194 | |||
195 | struct omap_gpio_platform_data { | ||
196 | u16 virtual_irq_start; | ||
197 | int bank_type; | ||
198 | int bank_width; /* GPIO bank width */ | ||
199 | int bank_stride; /* Only needed for omap1 MPUIO */ | ||
200 | bool dbck_flag; /* dbck required or not - True for OMAP3&4 */ | ||
201 | |||
202 | struct omap_gpio_reg_offs *regs; | ||
203 | }; | ||
204 | |||
205 | /* TODO: Analyze removing gpio_bank_count usage from driver code */ | ||
206 | extern int gpio_bank_count; | ||
207 | |||
208 | extern void omap2_gpio_prepare_for_idle(int off_mode); | ||
209 | extern void omap2_gpio_resume_after_idle(void); | ||
210 | extern void omap_set_gpio_debounce(int gpio, int enable); | ||
211 | extern void omap_set_gpio_debounce_time(int gpio, int enable); | ||
212 | extern void omap_gpio_save_context(void); | ||
213 | extern void omap_gpio_restore_context(void); | ||
214 | /*-------------------------------------------------------------------------*/ | ||
215 | |||
216 | /* Wrappers for "new style" GPIO calls, using the new infrastructure | ||
217 | * which lets us plug in FPGA, I2C, and other implementations. | ||
218 | * * | ||
219 | * The original OMAP-specific calls should eventually be removed. | ||
220 | */ | ||
221 | |||
222 | #include <linux/errno.h> | ||
223 | #include <asm-generic/gpio.h> | ||
224 | |||
225 | static inline int gpio_get_value(unsigned gpio) | ||
226 | { | ||
227 | return __gpio_get_value(gpio); | ||
228 | } | ||
229 | |||
230 | static inline void gpio_set_value(unsigned gpio, int value) | ||
231 | { | ||
232 | __gpio_set_value(gpio, value); | ||
233 | } | ||
234 | |||
235 | static inline int gpio_cansleep(unsigned gpio) | ||
236 | { | ||
237 | return __gpio_cansleep(gpio); | ||
238 | } | ||
239 | |||
240 | static inline int gpio_to_irq(unsigned gpio) | ||
241 | { | ||
242 | return __gpio_to_irq(gpio); | ||
243 | } | ||
244 | |||
245 | static inline int irq_to_gpio(unsigned irq) | ||
246 | { | ||
247 | int tmp; | ||
248 | |||
249 | /* omap1 SOC mpuio */ | ||
250 | if (cpu_class_is_omap1() && (irq < (IH_MPUIO_BASE + 16))) | ||
251 | return (irq - IH_MPUIO_BASE) + OMAP_MAX_GPIO_LINES; | ||
252 | |||
253 | /* SOC gpio */ | ||
254 | tmp = irq - IH_GPIO_BASE; | ||
255 | if (tmp < OMAP_MAX_GPIO_LINES) | ||
256 | return tmp; | ||
257 | |||
258 | /* we don't supply reverse mappings for non-SOC gpios */ | ||
259 | return -EIO; | ||
260 | } | ||
261 | |||
262 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/gpmc-smc91x.h b/arch/arm/plat-omap/include/plat/gpmc-smc91x.h new file mode 100644 index 00000000000..b64fbee4d56 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/gpmc-smc91x.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/gpmc-smc91x.h | ||
3 | * | ||
4 | * Copyright (C) 2009 Nokia Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASM_ARCH_OMAP_GPMC_SMC91X_H__ | ||
12 | |||
13 | #define GPMC_TIMINGS_SMC91C96 (1 << 4) | ||
14 | #define GPMC_MUX_ADD_DATA (1 << 5) /* GPMC_CONFIG1_MUXADDDATA */ | ||
15 | #define GPMC_READ_MON (1 << 6) /* GPMC_CONFIG1_WAIT_READ_MON */ | ||
16 | #define GPMC_WRITE_MON (1 << 7) /* GPMC_CONFIG1_WAIT_WRITE_MON */ | ||
17 | |||
18 | struct omap_smc91x_platform_data { | ||
19 | int cs; | ||
20 | int gpio_irq; | ||
21 | int gpio_pwrdwn; | ||
22 | int gpio_reset; | ||
23 | int wait_pin; /* Optional GPMC_CONFIG1_WAITPINSELECT */ | ||
24 | u32 flags; | ||
25 | int (*retime)(void); | ||
26 | }; | ||
27 | |||
28 | #if defined(CONFIG_SMC91X) || \ | ||
29 | defined(CONFIG_SMC91X_MODULE) | ||
30 | |||
31 | extern void gpmc_smc91x_init(struct omap_smc91x_platform_data *d); | ||
32 | |||
33 | #else | ||
34 | |||
35 | #define board_smc91x_data NULL | ||
36 | |||
37 | static inline void gpmc_smc91x_init(struct omap_smc91x_platform_data *d) | ||
38 | { | ||
39 | } | ||
40 | |||
41 | #endif | ||
42 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h b/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h new file mode 100644 index 00000000000..ea6c9c88c72 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/plat/gpmc-smsc911x.h | ||
3 | * | ||
4 | * Copyright (C) 2009 Li-Pro.Net | ||
5 | * Stephan Linz <linz@li-pro.net> | ||
6 | * | ||
7 | * Modified from arch/arm/plat-omap/include/plat/gpmc-smc91x.h | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #ifndef __ASM_ARCH_OMAP_GPMC_SMSC911X_H__ | ||
15 | |||
16 | struct omap_smsc911x_platform_data { | ||
17 | int id; | ||
18 | int cs; | ||
19 | int gpio_irq; | ||
20 | int gpio_reset; | ||
21 | u32 flags; | ||
22 | }; | ||
23 | |||
24 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) | ||
25 | |||
26 | extern void gpmc_smsc911x_init(struct omap_smsc911x_platform_data *d); | ||
27 | |||
28 | #else | ||
29 | |||
30 | static inline void gpmc_smsc911x_init(struct omap_smsc911x_platform_data *d) | ||
31 | { | ||
32 | } | ||
33 | |||
34 | #endif | ||
35 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/gpmc.h b/arch/arm/plat-omap/include/plat/gpmc.h new file mode 100644 index 00000000000..1527929b445 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/gpmc.h | |||
@@ -0,0 +1,160 @@ | |||
1 | /* | ||
2 | * General-Purpose Memory Controller for OMAP2 | ||
3 | * | ||
4 | * Copyright (C) 2005-2006 Nokia Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __OMAP2_GPMC_H | ||
12 | #define __OMAP2_GPMC_H | ||
13 | |||
14 | /* Maximum Number of Chip Selects */ | ||
15 | #define GPMC_CS_NUM 8 | ||
16 | |||
17 | #define GPMC_CS_CONFIG1 0x00 | ||
18 | #define GPMC_CS_CONFIG2 0x04 | ||
19 | #define GPMC_CS_CONFIG3 0x08 | ||
20 | #define GPMC_CS_CONFIG4 0x0c | ||
21 | #define GPMC_CS_CONFIG5 0x10 | ||
22 | #define GPMC_CS_CONFIG6 0x14 | ||
23 | #define GPMC_CS_CONFIG7 0x18 | ||
24 | #define GPMC_CS_NAND_COMMAND 0x1c | ||
25 | #define GPMC_CS_NAND_ADDRESS 0x20 | ||
26 | #define GPMC_CS_NAND_DATA 0x24 | ||
27 | |||
28 | /* Control Commands */ | ||
29 | #define GPMC_CONFIG_RDY_BSY 0x00000001 | ||
30 | #define GPMC_CONFIG_DEV_SIZE 0x00000002 | ||
31 | #define GPMC_CONFIG_DEV_TYPE 0x00000003 | ||
32 | #define GPMC_SET_IRQ_STATUS 0x00000004 | ||
33 | #define GPMC_CONFIG_WP 0x00000005 | ||
34 | |||
35 | #define GPMC_GET_IRQ_STATUS 0x00000006 | ||
36 | #define GPMC_PREFETCH_FIFO_CNT 0x00000007 /* bytes available in FIFO for r/w */ | ||
37 | #define GPMC_PREFETCH_COUNT 0x00000008 /* remaining bytes to be read/write*/ | ||
38 | #define GPMC_STATUS_BUFFER 0x00000009 /* 1: buffer is available to write */ | ||
39 | |||
40 | #define GPMC_NAND_COMMAND 0x0000000a | ||
41 | #define GPMC_NAND_ADDRESS 0x0000000b | ||
42 | #define GPMC_NAND_DATA 0x0000000c | ||
43 | |||
44 | #define GPMC_ENABLE_IRQ 0x0000000d | ||
45 | |||
46 | /* ECC commands */ | ||
47 | #define GPMC_ECC_READ 0 /* Reset Hardware ECC for read */ | ||
48 | #define GPMC_ECC_WRITE 1 /* Reset Hardware ECC for write */ | ||
49 | #define GPMC_ECC_READSYN 2 /* Reset before syndrom is read back */ | ||
50 | |||
51 | #define GPMC_CONFIG1_WRAPBURST_SUPP (1 << 31) | ||
52 | #define GPMC_CONFIG1_READMULTIPLE_SUPP (1 << 30) | ||
53 | #define GPMC_CONFIG1_READTYPE_ASYNC (0 << 29) | ||
54 | #define GPMC_CONFIG1_READTYPE_SYNC (1 << 29) | ||
55 | #define GPMC_CONFIG1_WRITEMULTIPLE_SUPP (1 << 28) | ||
56 | #define GPMC_CONFIG1_WRITETYPE_ASYNC (0 << 27) | ||
57 | #define GPMC_CONFIG1_WRITETYPE_SYNC (1 << 27) | ||
58 | #define GPMC_CONFIG1_CLKACTIVATIONTIME(val) ((val & 3) << 25) | ||
59 | #define GPMC_CONFIG1_PAGE_LEN(val) ((val & 3) << 23) | ||
60 | #define GPMC_CONFIG1_WAIT_READ_MON (1 << 22) | ||
61 | #define GPMC_CONFIG1_WAIT_WRITE_MON (1 << 21) | ||
62 | #define GPMC_CONFIG1_WAIT_MON_IIME(val) ((val & 3) << 18) | ||
63 | #define GPMC_CONFIG1_WAIT_PIN_SEL(val) ((val & 3) << 16) | ||
64 | #define GPMC_CONFIG1_DEVICESIZE(val) ((val & 3) << 12) | ||
65 | #define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1) | ||
66 | #define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10) | ||
67 | #define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0) | ||
68 | #define GPMC_CONFIG1_MUXADDDATA (1 << 9) | ||
69 | #define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4) | ||
70 | #define GPMC_CONFIG1_FCLK_DIV(val) (val & 3) | ||
71 | #define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1)) | ||
72 | #define GPMC_CONFIG1_FCLK_DIV3 (GPMC_CONFIG1_FCLK_DIV(2)) | ||
73 | #define GPMC_CONFIG1_FCLK_DIV4 (GPMC_CONFIG1_FCLK_DIV(3)) | ||
74 | #define GPMC_CONFIG7_CSVALID (1 << 6) | ||
75 | |||
76 | #define GPMC_DEVICETYPE_NOR 0 | ||
77 | #define GPMC_DEVICETYPE_NAND 2 | ||
78 | #define GPMC_CONFIG_WRITEPROTECT 0x00000010 | ||
79 | #define GPMC_STATUS_BUFF_EMPTY 0x00000001 | ||
80 | #define WR_RD_PIN_MONITORING 0x00600000 | ||
81 | #define GPMC_PREFETCH_STATUS_FIFO_CNT(val) ((val >> 24) & 0x7F) | ||
82 | #define GPMC_PREFETCH_STATUS_COUNT(val) (val & 0x00003fff) | ||
83 | #define GPMC_IRQ_FIFOEVENTENABLE 0x01 | ||
84 | #define GPMC_IRQ_COUNT_EVENT 0x02 | ||
85 | |||
86 | #define PREFETCH_FIFOTHRESHOLD_MAX 0x40 | ||
87 | #define PREFETCH_FIFOTHRESHOLD(val) ((val) << 8) | ||
88 | |||
89 | enum omap_ecc { | ||
90 | /* 1-bit ecc: stored at end of spare area */ | ||
91 | OMAP_ECC_HAMMING_CODE_DEFAULT = 0, /* Default, s/w method */ | ||
92 | OMAP_ECC_HAMMING_CODE_HW, /* gpmc to detect the error */ | ||
93 | /* 1-bit ecc: stored at beginning of spare area as romcode */ | ||
94 | OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */ | ||
95 | }; | ||
96 | |||
97 | /* | ||
98 | * Note that all values in this struct are in nanoseconds except sync_clk | ||
99 | * (which is in picoseconds), while the register values are in gpmc_fck cycles. | ||
100 | */ | ||
101 | struct gpmc_timings { | ||
102 | /* Minimum clock period for synchronous mode (in picoseconds) */ | ||
103 | u32 sync_clk; | ||
104 | |||
105 | /* Chip-select signal timings corresponding to GPMC_CS_CONFIG2 */ | ||
106 | u16 cs_on; /* Assertion time */ | ||
107 | u16 cs_rd_off; /* Read deassertion time */ | ||
108 | u16 cs_wr_off; /* Write deassertion time */ | ||
109 | |||
110 | /* ADV signal timings corresponding to GPMC_CONFIG3 */ | ||
111 | u16 adv_on; /* Assertion time */ | ||
112 | u16 adv_rd_off; /* Read deassertion time */ | ||
113 | u16 adv_wr_off; /* Write deassertion time */ | ||
114 | |||
115 | /* WE signals timings corresponding to GPMC_CONFIG4 */ | ||
116 | u16 we_on; /* WE assertion time */ | ||
117 | u16 we_off; /* WE deassertion time */ | ||
118 | |||
119 | /* OE signals timings corresponding to GPMC_CONFIG4 */ | ||
120 | u16 oe_on; /* OE assertion time */ | ||
121 | u16 oe_off; /* OE deassertion time */ | ||
122 | |||
123 | /* Access time and cycle time timings corresponding to GPMC_CONFIG5 */ | ||
124 | u16 page_burst_access; /* Multiple access word delay */ | ||
125 | u16 access; /* Start-cycle to first data valid delay */ | ||
126 | u16 rd_cycle; /* Total read cycle time */ | ||
127 | u16 wr_cycle; /* Total write cycle time */ | ||
128 | |||
129 | /* The following are only on OMAP3430 */ | ||
130 | u16 wr_access; /* WRACCESSTIME */ | ||
131 | u16 wr_data_mux_bus; /* WRDATAONADMUXBUS */ | ||
132 | }; | ||
133 | |||
134 | extern unsigned int gpmc_ns_to_ticks(unsigned int time_ns); | ||
135 | extern unsigned int gpmc_ps_to_ticks(unsigned int time_ps); | ||
136 | extern unsigned int gpmc_ticks_to_ns(unsigned int ticks); | ||
137 | extern unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns); | ||
138 | extern unsigned long gpmc_get_fclk_period(void); | ||
139 | |||
140 | extern void gpmc_cs_write_reg(int cs, int idx, u32 val); | ||
141 | extern u32 gpmc_cs_read_reg(int cs, int idx); | ||
142 | extern int gpmc_cs_calc_divider(int cs, unsigned int sync_clk); | ||
143 | extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t); | ||
144 | extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base); | ||
145 | extern void gpmc_cs_free(int cs); | ||
146 | extern int gpmc_cs_set_reserved(int cs, int reserved); | ||
147 | extern int gpmc_cs_reserved(int cs); | ||
148 | extern int gpmc_prefetch_enable(int cs, int fifo_th, int dma_mode, | ||
149 | unsigned int u32_count, int is_write); | ||
150 | extern int gpmc_prefetch_reset(int cs); | ||
151 | extern void omap3_gpmc_save_context(void); | ||
152 | extern void omap3_gpmc_restore_context(void); | ||
153 | extern int gpmc_read_status(int cmd); | ||
154 | extern int gpmc_cs_configure(int cs, int cmd, int wval); | ||
155 | extern int gpmc_nand_read(int cs, int cmd); | ||
156 | extern int gpmc_nand_write(int cs, int cmd, int wval); | ||
157 | |||
158 | int gpmc_enable_hwecc(int cs, int mode, int dev_width, int ecc_size); | ||
159 | int gpmc_calculate_ecc(int cs, const u_char *dat, u_char *ecc_code); | ||
160 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/hardware.h b/arch/arm/plat-omap/include/plat/hardware.h new file mode 100644 index 00000000000..e87efe1499b --- /dev/null +++ b/arch/arm/plat-omap/include/plat/hardware.h | |||
@@ -0,0 +1,291 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/hardware.h | ||
3 | * | ||
4 | * Hardware definitions for TI OMAP processors and boards | ||
5 | * | ||
6 | * NOTE: Please put device driver specific defines into a separate header | ||
7 | * file for each driver. | ||
8 | * | ||
9 | * Copyright (C) 2001 RidgeRun, Inc. | ||
10 | * Author: RidgeRun, Inc. Greg Lonnon <glonnon@ridgerun.com> | ||
11 | * | ||
12 | * Reorganized for Linux-2.6 by Tony Lindgren <tony@atomide.com> | ||
13 | * and Dirk Behme <dirk.behme@de.bosch.com> | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify it | ||
16 | * under the terms of the GNU General Public License as published by the | ||
17 | * Free Software Foundation; either version 2 of the License, or (at your | ||
18 | * option) any later version. | ||
19 | * | ||
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
23 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
25 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
26 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
30 | * | ||
31 | * You should have received a copy of the GNU General Public License along | ||
32 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
33 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
34 | */ | ||
35 | |||
36 | #ifndef __ASM_ARCH_OMAP_HARDWARE_H | ||
37 | #define __ASM_ARCH_OMAP_HARDWARE_H | ||
38 | |||
39 | #include <asm/sizes.h> | ||
40 | #ifndef __ASSEMBLER__ | ||
41 | #include <asm/types.h> | ||
42 | #include <plat/cpu.h> | ||
43 | #endif | ||
44 | #include <plat/serial.h> | ||
45 | |||
46 | /* | ||
47 | * --------------------------------------------------------------------------- | ||
48 | * Common definitions for all OMAP processors | ||
49 | * NOTE: Put all processor or board specific parts to the special header | ||
50 | * files. | ||
51 | * --------------------------------------------------------------------------- | ||
52 | */ | ||
53 | |||
54 | /* | ||
55 | * ---------------------------------------------------------------------------- | ||
56 | * Timers | ||
57 | * ---------------------------------------------------------------------------- | ||
58 | */ | ||
59 | #define OMAP_MPU_TIMER1_BASE (0xfffec500) | ||
60 | #define OMAP_MPU_TIMER2_BASE (0xfffec600) | ||
61 | #define OMAP_MPU_TIMER3_BASE (0xfffec700) | ||
62 | #define MPU_TIMER_FREE (1 << 6) | ||
63 | #define MPU_TIMER_CLOCK_ENABLE (1 << 5) | ||
64 | #define MPU_TIMER_AR (1 << 1) | ||
65 | #define MPU_TIMER_ST (1 << 0) | ||
66 | |||
67 | /* | ||
68 | * ---------------------------------------------------------------------------- | ||
69 | * Clocks | ||
70 | * ---------------------------------------------------------------------------- | ||
71 | */ | ||
72 | #define CLKGEN_REG_BASE (0xfffece00) | ||
73 | #define ARM_CKCTL (CLKGEN_REG_BASE + 0x0) | ||
74 | #define ARM_IDLECT1 (CLKGEN_REG_BASE + 0x4) | ||
75 | #define ARM_IDLECT2 (CLKGEN_REG_BASE + 0x8) | ||
76 | #define ARM_EWUPCT (CLKGEN_REG_BASE + 0xC) | ||
77 | #define ARM_RSTCT1 (CLKGEN_REG_BASE + 0x10) | ||
78 | #define ARM_RSTCT2 (CLKGEN_REG_BASE + 0x14) | ||
79 | #define ARM_SYSST (CLKGEN_REG_BASE + 0x18) | ||
80 | #define ARM_IDLECT3 (CLKGEN_REG_BASE + 0x24) | ||
81 | |||
82 | #define CK_RATEF 1 | ||
83 | #define CK_IDLEF 2 | ||
84 | #define CK_ENABLEF 4 | ||
85 | #define CK_SELECTF 8 | ||
86 | #define SETARM_IDLE_SHIFT | ||
87 | |||
88 | /* DPLL control registers */ | ||
89 | #define DPLL_CTL (0xfffecf00) | ||
90 | |||
91 | /* DSP clock control. Must use __raw_readw() and __raw_writew() with these */ | ||
92 | #define DSP_CONFIG_REG_BASE IOMEM(0xe1008000) | ||
93 | #define DSP_CKCTL (DSP_CONFIG_REG_BASE + 0x0) | ||
94 | #define DSP_IDLECT1 (DSP_CONFIG_REG_BASE + 0x4) | ||
95 | #define DSP_IDLECT2 (DSP_CONFIG_REG_BASE + 0x8) | ||
96 | #define DSP_RSTCT2 (DSP_CONFIG_REG_BASE + 0x14) | ||
97 | |||
98 | /* | ||
99 | * --------------------------------------------------------------------------- | ||
100 | * UPLD | ||
101 | * --------------------------------------------------------------------------- | ||
102 | */ | ||
103 | #define ULPD_REG_BASE (0xfffe0800) | ||
104 | #define ULPD_IT_STATUS (ULPD_REG_BASE + 0x14) | ||
105 | #define ULPD_SETUP_ANALOG_CELL_3 (ULPD_REG_BASE + 0x24) | ||
106 | #define ULPD_CLOCK_CTRL (ULPD_REG_BASE + 0x30) | ||
107 | # define DIS_USB_PVCI_CLK (1 << 5) /* no USB/FAC synch */ | ||
108 | # define USB_MCLK_EN (1 << 4) /* enable W4_USB_CLKO */ | ||
109 | #define ULPD_SOFT_REQ (ULPD_REG_BASE + 0x34) | ||
110 | # define SOFT_UDC_REQ (1 << 4) | ||
111 | # define SOFT_USB_CLK_REQ (1 << 3) | ||
112 | # define SOFT_DPLL_REQ (1 << 0) | ||
113 | #define ULPD_DPLL_CTRL (ULPD_REG_BASE + 0x3c) | ||
114 | #define ULPD_STATUS_REQ (ULPD_REG_BASE + 0x40) | ||
115 | #define ULPD_APLL_CTRL (ULPD_REG_BASE + 0x4c) | ||
116 | #define ULPD_POWER_CTRL (ULPD_REG_BASE + 0x50) | ||
117 | #define ULPD_SOFT_DISABLE_REQ_REG (ULPD_REG_BASE + 0x68) | ||
118 | # define DIS_MMC2_DPLL_REQ (1 << 11) | ||
119 | # define DIS_MMC1_DPLL_REQ (1 << 10) | ||
120 | # define DIS_UART3_DPLL_REQ (1 << 9) | ||
121 | # define DIS_UART2_DPLL_REQ (1 << 8) | ||
122 | # define DIS_UART1_DPLL_REQ (1 << 7) | ||
123 | # define DIS_USB_HOST_DPLL_REQ (1 << 6) | ||
124 | #define ULPD_SDW_CLK_DIV_CTRL_SEL (ULPD_REG_BASE + 0x74) | ||
125 | #define ULPD_CAM_CLK_CTRL (ULPD_REG_BASE + 0x7c) | ||
126 | |||
127 | /* | ||
128 | * --------------------------------------------------------------------------- | ||
129 | * Watchdog timer | ||
130 | * --------------------------------------------------------------------------- | ||
131 | */ | ||
132 | |||
133 | /* Watchdog timer within the OMAP3.2 gigacell */ | ||
134 | #define OMAP_MPU_WATCHDOG_BASE (0xfffec800) | ||
135 | #define OMAP_WDT_TIMER (OMAP_MPU_WATCHDOG_BASE + 0x0) | ||
136 | #define OMAP_WDT_LOAD_TIM (OMAP_MPU_WATCHDOG_BASE + 0x4) | ||
137 | #define OMAP_WDT_READ_TIM (OMAP_MPU_WATCHDOG_BASE + 0x4) | ||
138 | #define OMAP_WDT_TIMER_MODE (OMAP_MPU_WATCHDOG_BASE + 0x8) | ||
139 | |||
140 | /* | ||
141 | * --------------------------------------------------------------------------- | ||
142 | * Interrupts | ||
143 | * --------------------------------------------------------------------------- | ||
144 | */ | ||
145 | #ifdef CONFIG_ARCH_OMAP1 | ||
146 | |||
147 | /* | ||
148 | * XXX: These probably want to be moved to arch/arm/mach-omap/omap1/irq.c | ||
149 | * or something similar.. -- PFM. | ||
150 | */ | ||
151 | |||
152 | #define OMAP_IH1_BASE 0xfffecb00 | ||
153 | #define OMAP_IH2_BASE 0xfffe0000 | ||
154 | |||
155 | #define OMAP_IH1_ITR (OMAP_IH1_BASE + 0x00) | ||
156 | #define OMAP_IH1_MIR (OMAP_IH1_BASE + 0x04) | ||
157 | #define OMAP_IH1_SIR_IRQ (OMAP_IH1_BASE + 0x10) | ||
158 | #define OMAP_IH1_SIR_FIQ (OMAP_IH1_BASE + 0x14) | ||
159 | #define OMAP_IH1_CONTROL (OMAP_IH1_BASE + 0x18) | ||
160 | #define OMAP_IH1_ILR0 (OMAP_IH1_BASE + 0x1c) | ||
161 | #define OMAP_IH1_ISR (OMAP_IH1_BASE + 0x9c) | ||
162 | |||
163 | #define OMAP_IH2_ITR (OMAP_IH2_BASE + 0x00) | ||
164 | #define OMAP_IH2_MIR (OMAP_IH2_BASE + 0x04) | ||
165 | #define OMAP_IH2_SIR_IRQ (OMAP_IH2_BASE + 0x10) | ||
166 | #define OMAP_IH2_SIR_FIQ (OMAP_IH2_BASE + 0x14) | ||
167 | #define OMAP_IH2_CONTROL (OMAP_IH2_BASE + 0x18) | ||
168 | #define OMAP_IH2_ILR0 (OMAP_IH2_BASE + 0x1c) | ||
169 | #define OMAP_IH2_ISR (OMAP_IH2_BASE + 0x9c) | ||
170 | |||
171 | #define IRQ_ITR_REG_OFFSET 0x00 | ||
172 | #define IRQ_MIR_REG_OFFSET 0x04 | ||
173 | #define IRQ_SIR_IRQ_REG_OFFSET 0x10 | ||
174 | #define IRQ_SIR_FIQ_REG_OFFSET 0x14 | ||
175 | #define IRQ_CONTROL_REG_OFFSET 0x18 | ||
176 | #define IRQ_ISR_REG_OFFSET 0x9c | ||
177 | #define IRQ_ILR0_REG_OFFSET 0x1c | ||
178 | #define IRQ_GMR_REG_OFFSET 0xa0 | ||
179 | |||
180 | #endif | ||
181 | |||
182 | /* | ||
183 | * ---------------------------------------------------------------------------- | ||
184 | * System control registers | ||
185 | * ---------------------------------------------------------------------------- | ||
186 | */ | ||
187 | #define MOD_CONF_CTRL_0 0xfffe1080 | ||
188 | #define MOD_CONF_CTRL_1 0xfffe1110 | ||
189 | |||
190 | /* | ||
191 | * ---------------------------------------------------------------------------- | ||
192 | * Pin multiplexing registers | ||
193 | * ---------------------------------------------------------------------------- | ||
194 | */ | ||
195 | #define FUNC_MUX_CTRL_0 0xfffe1000 | ||
196 | #define FUNC_MUX_CTRL_1 0xfffe1004 | ||
197 | #define FUNC_MUX_CTRL_2 0xfffe1008 | ||
198 | #define COMP_MODE_CTRL_0 0xfffe100c | ||
199 | #define FUNC_MUX_CTRL_3 0xfffe1010 | ||
200 | #define FUNC_MUX_CTRL_4 0xfffe1014 | ||
201 | #define FUNC_MUX_CTRL_5 0xfffe1018 | ||
202 | #define FUNC_MUX_CTRL_6 0xfffe101C | ||
203 | #define FUNC_MUX_CTRL_7 0xfffe1020 | ||
204 | #define FUNC_MUX_CTRL_8 0xfffe1024 | ||
205 | #define FUNC_MUX_CTRL_9 0xfffe1028 | ||
206 | #define FUNC_MUX_CTRL_A 0xfffe102C | ||
207 | #define FUNC_MUX_CTRL_B 0xfffe1030 | ||
208 | #define FUNC_MUX_CTRL_C 0xfffe1034 | ||
209 | #define FUNC_MUX_CTRL_D 0xfffe1038 | ||
210 | #define PULL_DWN_CTRL_0 0xfffe1040 | ||
211 | #define PULL_DWN_CTRL_1 0xfffe1044 | ||
212 | #define PULL_DWN_CTRL_2 0xfffe1048 | ||
213 | #define PULL_DWN_CTRL_3 0xfffe104c | ||
214 | #define PULL_DWN_CTRL_4 0xfffe10ac | ||
215 | |||
216 | /* OMAP-1610 specific multiplexing registers */ | ||
217 | #define FUNC_MUX_CTRL_E 0xfffe1090 | ||
218 | #define FUNC_MUX_CTRL_F 0xfffe1094 | ||
219 | #define FUNC_MUX_CTRL_10 0xfffe1098 | ||
220 | #define FUNC_MUX_CTRL_11 0xfffe109c | ||
221 | #define FUNC_MUX_CTRL_12 0xfffe10a0 | ||
222 | #define PU_PD_SEL_0 0xfffe10b4 | ||
223 | #define PU_PD_SEL_1 0xfffe10b8 | ||
224 | #define PU_PD_SEL_2 0xfffe10bc | ||
225 | #define PU_PD_SEL_3 0xfffe10c0 | ||
226 | #define PU_PD_SEL_4 0xfffe10c4 | ||
227 | |||
228 | /* Timer32K for 1610 and 1710*/ | ||
229 | #define OMAP_TIMER32K_BASE 0xFFFBC400 | ||
230 | |||
231 | /* | ||
232 | * --------------------------------------------------------------------------- | ||
233 | * TIPB bus interface | ||
234 | * --------------------------------------------------------------------------- | ||
235 | */ | ||
236 | #define TIPB_PUBLIC_CNTL_BASE 0xfffed300 | ||
237 | #define MPU_PUBLIC_TIPB_CNTL (TIPB_PUBLIC_CNTL_BASE + 0x8) | ||
238 | #define TIPB_PRIVATE_CNTL_BASE 0xfffeca00 | ||
239 | #define MPU_PRIVATE_TIPB_CNTL (TIPB_PRIVATE_CNTL_BASE + 0x8) | ||
240 | |||
241 | /* | ||
242 | * ---------------------------------------------------------------------------- | ||
243 | * MPUI interface | ||
244 | * ---------------------------------------------------------------------------- | ||
245 | */ | ||
246 | #define MPUI_BASE (0xfffec900) | ||
247 | #define MPUI_CTRL (MPUI_BASE + 0x0) | ||
248 | #define MPUI_DEBUG_ADDR (MPUI_BASE + 0x4) | ||
249 | #define MPUI_DEBUG_DATA (MPUI_BASE + 0x8) | ||
250 | #define MPUI_DEBUG_FLAG (MPUI_BASE + 0xc) | ||
251 | #define MPUI_STATUS_REG (MPUI_BASE + 0x10) | ||
252 | #define MPUI_DSP_STATUS (MPUI_BASE + 0x14) | ||
253 | #define MPUI_DSP_BOOT_CONFIG (MPUI_BASE + 0x18) | ||
254 | #define MPUI_DSP_API_CONFIG (MPUI_BASE + 0x1c) | ||
255 | |||
256 | /* | ||
257 | * ---------------------------------------------------------------------------- | ||
258 | * LED Pulse Generator | ||
259 | * ---------------------------------------------------------------------------- | ||
260 | */ | ||
261 | #define OMAP_LPG1_BASE 0xfffbd000 | ||
262 | #define OMAP_LPG2_BASE 0xfffbd800 | ||
263 | #define OMAP_LPG1_LCR (OMAP_LPG1_BASE + 0x00) | ||
264 | #define OMAP_LPG1_PMR (OMAP_LPG1_BASE + 0x04) | ||
265 | #define OMAP_LPG2_LCR (OMAP_LPG2_BASE + 0x00) | ||
266 | #define OMAP_LPG2_PMR (OMAP_LPG2_BASE + 0x04) | ||
267 | |||
268 | /* | ||
269 | * ---------------------------------------------------------------------------- | ||
270 | * Pulse-Width Light | ||
271 | * ---------------------------------------------------------------------------- | ||
272 | */ | ||
273 | #define OMAP_PWL_BASE 0xfffb5800 | ||
274 | #define OMAP_PWL_ENABLE (OMAP_PWL_BASE + 0x00) | ||
275 | #define OMAP_PWL_CLK_ENABLE (OMAP_PWL_BASE + 0x04) | ||
276 | |||
277 | /* | ||
278 | * --------------------------------------------------------------------------- | ||
279 | * Processor specific defines | ||
280 | * --------------------------------------------------------------------------- | ||
281 | */ | ||
282 | |||
283 | #include <plat/omap7xx.h> | ||
284 | #include <plat/omap1510.h> | ||
285 | #include <plat/omap16xx.h> | ||
286 | #include <plat/omap24xx.h> | ||
287 | #include <plat/omap34xx.h> | ||
288 | #include <plat/omap44xx.h> | ||
289 | #include <plat/ti816x.h> | ||
290 | |||
291 | #endif /* __ASM_ARCH_OMAP_HARDWARE_H */ | ||
diff --git a/arch/arm/plat-omap/include/plat/hwa742.h b/arch/arm/plat-omap/include/plat/hwa742.h new file mode 100644 index 00000000000..886248d32b4 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/hwa742.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _HWA742_H | ||
2 | #define _HWA742_H | ||
3 | |||
4 | struct hwa742_platform_data { | ||
5 | unsigned te_connected:1; | ||
6 | }; | ||
7 | |||
8 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/io.h b/arch/arm/plat-omap/include/plat/io.h new file mode 100644 index 00000000000..d72ec85c97e --- /dev/null +++ b/arch/arm/plat-omap/include/plat/io.h | |||
@@ -0,0 +1,314 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/io.h | ||
3 | * | ||
4 | * IO definitions for TI OMAP processors and boards | ||
5 | * | ||
6 | * Copied from arch/arm/mach-sa1100/include/mach/io.h | ||
7 | * Copyright (C) 1997-1999 Russell King | ||
8 | * | ||
9 | * Copyright (C) 2009 Texas Instruments | ||
10 | * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
20 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
23 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
24 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License along | ||
29 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
30 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
31 | * | ||
32 | * Modifications: | ||
33 | * 06-12-1997 RMK Created. | ||
34 | * 07-04-1999 RMK Major cleanup | ||
35 | */ | ||
36 | |||
37 | #ifndef __ASM_ARM_ARCH_IO_H | ||
38 | #define __ASM_ARM_ARCH_IO_H | ||
39 | |||
40 | #include <mach/hardware.h> | ||
41 | |||
42 | #define IO_SPACE_LIMIT 0xffffffff | ||
43 | |||
44 | /* | ||
45 | * We don't actually have real ISA nor PCI buses, but there is so many | ||
46 | * drivers out there that might just work if we fake them... | ||
47 | */ | ||
48 | #define __io(a) __typesafe_io(a) | ||
49 | #define __mem_pci(a) (a) | ||
50 | |||
51 | /* | ||
52 | * ---------------------------------------------------------------------------- | ||
53 | * I/O mapping | ||
54 | * ---------------------------------------------------------------------------- | ||
55 | */ | ||
56 | |||
57 | #ifdef __ASSEMBLER__ | ||
58 | #define IOMEM(x) (x) | ||
59 | #else | ||
60 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
61 | #endif | ||
62 | |||
63 | #define OMAP1_IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */ | ||
64 | #define OMAP1_IO_ADDRESS(pa) IOMEM((pa) - OMAP1_IO_OFFSET) | ||
65 | |||
66 | #define OMAP2_L3_IO_OFFSET 0x90000000 | ||
67 | #define OMAP2_L3_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L3_IO_OFFSET) /* L3 */ | ||
68 | |||
69 | |||
70 | #define OMAP2_L4_IO_OFFSET 0xb2000000 | ||
71 | #define OMAP2_L4_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L4_IO_OFFSET) /* L4 */ | ||
72 | |||
73 | #define OMAP4_L3_IO_OFFSET 0xb4000000 | ||
74 | #define OMAP4_L3_IO_ADDRESS(pa) IOMEM((pa) + OMAP4_L3_IO_OFFSET) /* L3 */ | ||
75 | |||
76 | #define OMAP4_L3_PER_IO_OFFSET 0xb1100000 | ||
77 | #define OMAP4_L3_PER_IO_ADDRESS(pa) IOMEM((pa) + OMAP4_L3_PER_IO_OFFSET) | ||
78 | |||
79 | #define OMAP4_GPMC_IO_OFFSET 0xa9000000 | ||
80 | #define OMAP4_GPMC_IO_ADDRESS(pa) IOMEM((pa) + OMAP4_GPMC_IO_OFFSET) | ||
81 | |||
82 | #define OMAP2_EMU_IO_OFFSET 0xaa800000 /* Emulation */ | ||
83 | #define OMAP2_EMU_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_EMU_IO_OFFSET) | ||
84 | |||
85 | /* | ||
86 | * ---------------------------------------------------------------------------- | ||
87 | * Omap1 specific IO mapping | ||
88 | * ---------------------------------------------------------------------------- | ||
89 | */ | ||
90 | |||
91 | #define OMAP1_IO_PHYS 0xFFFB0000 | ||
92 | #define OMAP1_IO_SIZE 0x40000 | ||
93 | #define OMAP1_IO_VIRT (OMAP1_IO_PHYS - OMAP1_IO_OFFSET) | ||
94 | |||
95 | /* | ||
96 | * ---------------------------------------------------------------------------- | ||
97 | * Omap2 specific IO mapping | ||
98 | * ---------------------------------------------------------------------------- | ||
99 | */ | ||
100 | |||
101 | /* We map both L3 and L4 on OMAP2 */ | ||
102 | #define L3_24XX_PHYS L3_24XX_BASE /* 0x68000000 --> 0xf8000000*/ | ||
103 | #define L3_24XX_VIRT (L3_24XX_PHYS + OMAP2_L3_IO_OFFSET) | ||
104 | #define L3_24XX_SIZE SZ_1M /* 44kB of 128MB used, want 1MB sect */ | ||
105 | #define L4_24XX_PHYS L4_24XX_BASE /* 0x48000000 --> 0xfa000000 */ | ||
106 | #define L4_24XX_VIRT (L4_24XX_PHYS + OMAP2_L4_IO_OFFSET) | ||
107 | #define L4_24XX_SIZE SZ_1M /* 1MB of 128MB used, want 1MB sect */ | ||
108 | |||
109 | #define L4_WK_243X_PHYS L4_WK_243X_BASE /* 0x49000000 --> 0xfb000000 */ | ||
110 | #define L4_WK_243X_VIRT (L4_WK_243X_PHYS + OMAP2_L4_IO_OFFSET) | ||
111 | #define L4_WK_243X_SIZE SZ_1M | ||
112 | #define OMAP243X_GPMC_PHYS OMAP243X_GPMC_BASE | ||
113 | #define OMAP243X_GPMC_VIRT (OMAP243X_GPMC_PHYS + OMAP2_L3_IO_OFFSET) | ||
114 | /* 0x6e000000 --> 0xfe000000 */ | ||
115 | #define OMAP243X_GPMC_SIZE SZ_1M | ||
116 | #define OMAP243X_SDRC_PHYS OMAP243X_SDRC_BASE | ||
117 | /* 0x6D000000 --> 0xfd000000 */ | ||
118 | #define OMAP243X_SDRC_VIRT (OMAP243X_SDRC_PHYS + OMAP2_L3_IO_OFFSET) | ||
119 | #define OMAP243X_SDRC_SIZE SZ_1M | ||
120 | #define OMAP243X_SMS_PHYS OMAP243X_SMS_BASE | ||
121 | /* 0x6c000000 --> 0xfc000000 */ | ||
122 | #define OMAP243X_SMS_VIRT (OMAP243X_SMS_PHYS + OMAP2_L3_IO_OFFSET) | ||
123 | #define OMAP243X_SMS_SIZE SZ_1M | ||
124 | |||
125 | /* 2420 IVA */ | ||
126 | #define DSP_MEM_2420_PHYS OMAP2420_DSP_MEM_BASE | ||
127 | /* 0x58000000 --> 0xfc100000 */ | ||
128 | #define DSP_MEM_2420_VIRT 0xfc100000 | ||
129 | #define DSP_MEM_2420_SIZE 0x28000 | ||
130 | #define DSP_IPI_2420_PHYS OMAP2420_DSP_IPI_BASE | ||
131 | /* 0x59000000 --> 0xfc128000 */ | ||
132 | #define DSP_IPI_2420_VIRT 0xfc128000 | ||
133 | #define DSP_IPI_2420_SIZE SZ_4K | ||
134 | #define DSP_MMU_2420_PHYS OMAP2420_DSP_MMU_BASE | ||
135 | /* 0x5a000000 --> 0xfc129000 */ | ||
136 | #define DSP_MMU_2420_VIRT 0xfc129000 | ||
137 | #define DSP_MMU_2420_SIZE SZ_4K | ||
138 | |||
139 | /* 2430 IVA2.1 - currently unmapped */ | ||
140 | |||
141 | /* | ||
142 | * ---------------------------------------------------------------------------- | ||
143 | * Omap3 specific IO mapping | ||
144 | * ---------------------------------------------------------------------------- | ||
145 | */ | ||
146 | |||
147 | /* We map both L3 and L4 on OMAP3 */ | ||
148 | #define L3_34XX_PHYS L3_34XX_BASE /* 0x68000000 --> 0xf8000000 */ | ||
149 | #define L3_34XX_VIRT (L3_34XX_PHYS + OMAP2_L3_IO_OFFSET) | ||
150 | #define L3_34XX_SIZE SZ_1M /* 44kB of 128MB used, want 1MB sect */ | ||
151 | |||
152 | #define L4_34XX_PHYS L4_34XX_BASE /* 0x48000000 --> 0xfa000000 */ | ||
153 | #define L4_34XX_VIRT (L4_34XX_PHYS + OMAP2_L4_IO_OFFSET) | ||
154 | #define L4_34XX_SIZE SZ_4M /* 1MB of 128MB used, want 1MB sect */ | ||
155 | |||
156 | /* | ||
157 | * Need to look at the Size 4M for L4. | ||
158 | * VPOM3430 was not working for Int controller | ||
159 | */ | ||
160 | |||
161 | #define L4_PER_34XX_PHYS L4_PER_34XX_BASE | ||
162 | /* 0x49000000 --> 0xfb000000 */ | ||
163 | #define L4_PER_34XX_VIRT (L4_PER_34XX_PHYS + OMAP2_L4_IO_OFFSET) | ||
164 | #define L4_PER_34XX_SIZE SZ_1M | ||
165 | |||
166 | #define L4_EMU_34XX_PHYS L4_EMU_34XX_BASE | ||
167 | /* 0x54000000 --> 0xfe800000 */ | ||
168 | #define L4_EMU_34XX_VIRT (L4_EMU_34XX_PHYS + OMAP2_EMU_IO_OFFSET) | ||
169 | #define L4_EMU_34XX_SIZE SZ_8M | ||
170 | |||
171 | #define OMAP34XX_GPMC_PHYS OMAP34XX_GPMC_BASE | ||
172 | /* 0x6e000000 --> 0xfe000000 */ | ||
173 | #define OMAP34XX_GPMC_VIRT (OMAP34XX_GPMC_PHYS + OMAP2_L3_IO_OFFSET) | ||
174 | #define OMAP34XX_GPMC_SIZE SZ_1M | ||
175 | |||
176 | #define OMAP343X_SMS_PHYS OMAP343X_SMS_BASE | ||
177 | /* 0x6c000000 --> 0xfc000000 */ | ||
178 | #define OMAP343X_SMS_VIRT (OMAP343X_SMS_PHYS + OMAP2_L3_IO_OFFSET) | ||
179 | #define OMAP343X_SMS_SIZE SZ_1M | ||
180 | |||
181 | #define OMAP343X_SDRC_PHYS OMAP343X_SDRC_BASE | ||
182 | /* 0x6D000000 --> 0xfd000000 */ | ||
183 | #define OMAP343X_SDRC_VIRT (OMAP343X_SDRC_PHYS + OMAP2_L3_IO_OFFSET) | ||
184 | #define OMAP343X_SDRC_SIZE SZ_1M | ||
185 | |||
186 | /* 3430 IVA - currently unmapped */ | ||
187 | |||
188 | /* | ||
189 | * ---------------------------------------------------------------------------- | ||
190 | * Omap4 specific IO mapping | ||
191 | * ---------------------------------------------------------------------------- | ||
192 | */ | ||
193 | |||
194 | /* We map both L3 and L4 on OMAP4 */ | ||
195 | #define L3_44XX_PHYS L3_44XX_BASE /* 0x44000000 --> 0xf8000000 */ | ||
196 | #define L3_44XX_VIRT (L3_44XX_PHYS + OMAP4_L3_IO_OFFSET) | ||
197 | #define L3_44XX_SIZE SZ_1M | ||
198 | |||
199 | #define L4_44XX_PHYS L4_44XX_BASE /* 0x4a000000 --> 0xfc000000 */ | ||
200 | #define L4_44XX_VIRT (L4_44XX_PHYS + OMAP2_L4_IO_OFFSET) | ||
201 | #define L4_44XX_SIZE SZ_4M | ||
202 | |||
203 | #define L4_PER_44XX_PHYS L4_PER_44XX_BASE | ||
204 | /* 0x48000000 --> 0xfa000000 */ | ||
205 | #define L4_PER_44XX_VIRT (L4_PER_44XX_PHYS + OMAP2_L4_IO_OFFSET) | ||
206 | #define L4_PER_44XX_SIZE SZ_4M | ||
207 | |||
208 | #define L4_ABE_44XX_PHYS L4_ABE_44XX_BASE | ||
209 | /* 0x49000000 --> 0xfb000000 */ | ||
210 | #define L4_ABE_44XX_VIRT (L4_ABE_44XX_PHYS + OMAP2_L4_IO_OFFSET) | ||
211 | #define L4_ABE_44XX_SIZE SZ_1M | ||
212 | |||
213 | #define L4_EMU_44XX_PHYS L4_EMU_44XX_BASE | ||
214 | /* 0x54000000 --> 0xfe800000 */ | ||
215 | #define L4_EMU_44XX_VIRT (L4_EMU_44XX_PHYS + OMAP2_EMU_IO_OFFSET) | ||
216 | #define L4_EMU_44XX_SIZE SZ_8M | ||
217 | |||
218 | #define OMAP44XX_GPMC_PHYS OMAP44XX_GPMC_BASE | ||
219 | /* 0x50000000 --> 0xf9000000 */ | ||
220 | #define OMAP44XX_GPMC_VIRT (OMAP44XX_GPMC_PHYS + OMAP4_GPMC_IO_OFFSET) | ||
221 | #define OMAP44XX_GPMC_SIZE SZ_1M | ||
222 | |||
223 | |||
224 | #define OMAP44XX_EMIF1_PHYS OMAP44XX_EMIF1_BASE | ||
225 | /* 0x4c000000 --> 0xfd100000 */ | ||
226 | #define OMAP44XX_EMIF1_VIRT (OMAP44XX_EMIF1_PHYS + OMAP4_L3_PER_IO_OFFSET) | ||
227 | #define OMAP44XX_EMIF1_SIZE SZ_1M | ||
228 | |||
229 | #define OMAP44XX_EMIF2_PHYS OMAP44XX_EMIF2_BASE | ||
230 | /* 0x4d000000 --> 0xfd200000 */ | ||
231 | #define OMAP44XX_EMIF2_VIRT (OMAP44XX_EMIF2_PHYS + OMAP4_L3_PER_IO_OFFSET) | ||
232 | #define OMAP44XX_EMIF2_SIZE SZ_1M | ||
233 | |||
234 | #define OMAP44XX_DMM_PHYS OMAP44XX_DMM_BASE | ||
235 | /* 0x4e000000 --> 0xfd300000 */ | ||
236 | #define OMAP44XX_DMM_VIRT (OMAP44XX_DMM_PHYS + OMAP4_L3_PER_IO_OFFSET) | ||
237 | #define OMAP44XX_DMM_SIZE SZ_1M | ||
238 | /* | ||
239 | * ---------------------------------------------------------------------------- | ||
240 | * Omap specific register access | ||
241 | * ---------------------------------------------------------------------------- | ||
242 | */ | ||
243 | |||
244 | #ifndef __ASSEMBLER__ | ||
245 | |||
246 | /* | ||
247 | * NOTE: Please use ioremap + __raw_read/write where possible instead of these | ||
248 | */ | ||
249 | |||
250 | extern u8 omap_readb(u32 pa); | ||
251 | extern u16 omap_readw(u32 pa); | ||
252 | extern u32 omap_readl(u32 pa); | ||
253 | extern void omap_writeb(u8 v, u32 pa); | ||
254 | extern void omap_writew(u16 v, u32 pa); | ||
255 | extern void omap_writel(u32 v, u32 pa); | ||
256 | |||
257 | struct omap_sdrc_params; | ||
258 | |||
259 | extern void omap1_map_common_io(void); | ||
260 | extern void omap1_init_common_hw(void); | ||
261 | |||
262 | #ifdef CONFIG_SOC_OMAP2420 | ||
263 | extern void omap242x_map_common_io(void); | ||
264 | #else | ||
265 | static inline void omap242x_map_common_io(void) | ||
266 | { | ||
267 | } | ||
268 | #endif | ||
269 | |||
270 | #ifdef CONFIG_SOC_OMAP2430 | ||
271 | extern void omap243x_map_common_io(void); | ||
272 | #else | ||
273 | static inline void omap243x_map_common_io(void) | ||
274 | { | ||
275 | } | ||
276 | #endif | ||
277 | |||
278 | #ifdef CONFIG_ARCH_OMAP3 | ||
279 | extern void omap34xx_map_common_io(void); | ||
280 | #else | ||
281 | static inline void omap34xx_map_common_io(void) | ||
282 | { | ||
283 | } | ||
284 | #endif | ||
285 | |||
286 | #ifdef CONFIG_SOC_OMAPTI816X | ||
287 | extern void omapti816x_map_common_io(void); | ||
288 | #else | ||
289 | static inline void omapti816x_map_common_io(void) | ||
290 | { | ||
291 | } | ||
292 | #endif | ||
293 | |||
294 | #ifdef CONFIG_ARCH_OMAP4 | ||
295 | extern void omap44xx_map_common_io(void); | ||
296 | #else | ||
297 | static inline void omap44xx_map_common_io(void) | ||
298 | { | ||
299 | } | ||
300 | #endif | ||
301 | |||
302 | extern void omap2_init_common_infrastructure(void); | ||
303 | extern void omap2_init_common_devices(struct omap_sdrc_params *sdrc_cs0, | ||
304 | struct omap_sdrc_params *sdrc_cs1); | ||
305 | |||
306 | #define __arch_ioremap omap_ioremap | ||
307 | #define __arch_iounmap omap_iounmap | ||
308 | |||
309 | void __iomem *omap_ioremap(unsigned long phys, size_t size, unsigned int type); | ||
310 | void omap_iounmap(volatile void __iomem *addr); | ||
311 | |||
312 | #endif | ||
313 | |||
314 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h new file mode 100644 index 00000000000..7a6ec98a08e --- /dev/null +++ b/arch/arm/plat-omap/include/plat/iommu.h | |||
@@ -0,0 +1,180 @@ | |||
1 | /* | ||
2 | * omap iommu: main structures | ||
3 | * | ||
4 | * Copyright (C) 2008-2009 Nokia Corporation | ||
5 | * | ||
6 | * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __MACH_IOMMU_H | ||
14 | #define __MACH_IOMMU_H | ||
15 | |||
16 | struct iotlb_entry { | ||
17 | u32 da; | ||
18 | u32 pa; | ||
19 | u32 pgsz, prsvd, valid; | ||
20 | union { | ||
21 | u16 ap; | ||
22 | struct { | ||
23 | u32 endian, elsz, mixed; | ||
24 | }; | ||
25 | }; | ||
26 | }; | ||
27 | |||
28 | struct omap_iommu { | ||
29 | const char *name; | ||
30 | struct module *owner; | ||
31 | struct clk *clk; | ||
32 | void __iomem *regbase; | ||
33 | struct device *dev; | ||
34 | void *isr_priv; | ||
35 | struct iommu_domain *domain; | ||
36 | |||
37 | unsigned int refcount; | ||
38 | spinlock_t iommu_lock; /* global for this whole object */ | ||
39 | |||
40 | /* | ||
41 | * We don't change iopgd for a situation like pgd for a task, | ||
42 | * but share it globally for each iommu. | ||
43 | */ | ||
44 | u32 *iopgd; | ||
45 | spinlock_t page_table_lock; /* protect iopgd */ | ||
46 | |||
47 | int nr_tlb_entries; | ||
48 | |||
49 | struct list_head mmap; | ||
50 | struct mutex mmap_lock; /* protect mmap */ | ||
51 | |||
52 | void *ctx; /* iommu context: registres saved area */ | ||
53 | u32 da_start; | ||
54 | u32 da_end; | ||
55 | }; | ||
56 | |||
57 | struct cr_regs { | ||
58 | union { | ||
59 | struct { | ||
60 | u16 cam_l; | ||
61 | u16 cam_h; | ||
62 | }; | ||
63 | u32 cam; | ||
64 | }; | ||
65 | union { | ||
66 | struct { | ||
67 | u16 ram_l; | ||
68 | u16 ram_h; | ||
69 | }; | ||
70 | u32 ram; | ||
71 | }; | ||
72 | }; | ||
73 | |||
74 | struct iotlb_lock { | ||
75 | short base; | ||
76 | short vict; | ||
77 | }; | ||
78 | |||
79 | /* architecture specific functions */ | ||
80 | struct iommu_functions { | ||
81 | unsigned long version; | ||
82 | |||
83 | int (*enable)(struct omap_iommu *obj); | ||
84 | void (*disable)(struct omap_iommu *obj); | ||
85 | void (*set_twl)(struct omap_iommu *obj, bool on); | ||
86 | u32 (*fault_isr)(struct omap_iommu *obj, u32 *ra); | ||
87 | |||
88 | void (*tlb_read_cr)(struct omap_iommu *obj, struct cr_regs *cr); | ||
89 | void (*tlb_load_cr)(struct omap_iommu *obj, struct cr_regs *cr); | ||
90 | |||
91 | struct cr_regs *(*alloc_cr)(struct omap_iommu *obj, | ||
92 | struct iotlb_entry *e); | ||
93 | int (*cr_valid)(struct cr_regs *cr); | ||
94 | u32 (*cr_to_virt)(struct cr_regs *cr); | ||
95 | void (*cr_to_e)(struct cr_regs *cr, struct iotlb_entry *e); | ||
96 | ssize_t (*dump_cr)(struct omap_iommu *obj, struct cr_regs *cr, | ||
97 | char *buf); | ||
98 | |||
99 | u32 (*get_pte_attr)(struct iotlb_entry *e); | ||
100 | |||
101 | void (*save_ctx)(struct omap_iommu *obj); | ||
102 | void (*restore_ctx)(struct omap_iommu *obj); | ||
103 | ssize_t (*dump_ctx)(struct omap_iommu *obj, char *buf, ssize_t len); | ||
104 | }; | ||
105 | |||
106 | struct iommu_platform_data { | ||
107 | const char *name; | ||
108 | const char *clk_name; | ||
109 | const int nr_tlb_entries; | ||
110 | u32 da_start; | ||
111 | u32 da_end; | ||
112 | }; | ||
113 | |||
114 | /* IOMMU errors */ | ||
115 | #define OMAP_IOMMU_ERR_TLB_MISS (1 << 0) | ||
116 | #define OMAP_IOMMU_ERR_TRANS_FAULT (1 << 1) | ||
117 | #define OMAP_IOMMU_ERR_EMU_MISS (1 << 2) | ||
118 | #define OMAP_IOMMU_ERR_TBLWALK_FAULT (1 << 3) | ||
119 | #define OMAP_IOMMU_ERR_MULTIHIT_FAULT (1 << 4) | ||
120 | |||
121 | #if defined(CONFIG_ARCH_OMAP1) | ||
122 | #error "iommu for this processor not implemented yet" | ||
123 | #else | ||
124 | #include <plat/iommu2.h> | ||
125 | #endif | ||
126 | |||
127 | /* | ||
128 | * utilities for super page(16MB, 1MB, 64KB and 4KB) | ||
129 | */ | ||
130 | |||
131 | #define iopgsz_max(bytes) \ | ||
132 | (((bytes) >= SZ_16M) ? SZ_16M : \ | ||
133 | ((bytes) >= SZ_1M) ? SZ_1M : \ | ||
134 | ((bytes) >= SZ_64K) ? SZ_64K : \ | ||
135 | ((bytes) >= SZ_4K) ? SZ_4K : 0) | ||
136 | |||
137 | #define bytes_to_iopgsz(bytes) \ | ||
138 | (((bytes) == SZ_16M) ? MMU_CAM_PGSZ_16M : \ | ||
139 | ((bytes) == SZ_1M) ? MMU_CAM_PGSZ_1M : \ | ||
140 | ((bytes) == SZ_64K) ? MMU_CAM_PGSZ_64K : \ | ||
141 | ((bytes) == SZ_4K) ? MMU_CAM_PGSZ_4K : -1) | ||
142 | |||
143 | #define iopgsz_to_bytes(iopgsz) \ | ||
144 | (((iopgsz) == MMU_CAM_PGSZ_16M) ? SZ_16M : \ | ||
145 | ((iopgsz) == MMU_CAM_PGSZ_1M) ? SZ_1M : \ | ||
146 | ((iopgsz) == MMU_CAM_PGSZ_64K) ? SZ_64K : \ | ||
147 | ((iopgsz) == MMU_CAM_PGSZ_4K) ? SZ_4K : 0) | ||
148 | |||
149 | #define iopgsz_ok(bytes) (bytes_to_iopgsz(bytes) >= 0) | ||
150 | |||
151 | /* | ||
152 | * global functions | ||
153 | */ | ||
154 | extern u32 omap_iommu_arch_version(void); | ||
155 | |||
156 | extern void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e); | ||
157 | |||
158 | extern int | ||
159 | omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e); | ||
160 | |||
161 | extern int omap_iommu_set_isr(const char *name, | ||
162 | int (*isr)(struct omap_iommu *obj, u32 da, u32 iommu_errs, | ||
163 | void *priv), | ||
164 | void *isr_priv); | ||
165 | |||
166 | extern void omap_iommu_save_ctx(struct device *dev); | ||
167 | extern void omap_iommu_restore_ctx(struct device *dev); | ||
168 | |||
169 | extern int omap_install_iommu_arch(const struct iommu_functions *ops); | ||
170 | extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops); | ||
171 | |||
172 | extern int omap_foreach_iommu_device(void *data, | ||
173 | int (*fn)(struct device *, void *)); | ||
174 | |||
175 | extern ssize_t | ||
176 | omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len); | ||
177 | extern size_t | ||
178 | omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t len); | ||
179 | |||
180 | #endif /* __MACH_IOMMU_H */ | ||
diff --git a/arch/arm/plat-omap/include/plat/iommu2.h b/arch/arm/plat-omap/include/plat/iommu2.h new file mode 100644 index 00000000000..d4116b595e4 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/iommu2.h | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * omap iommu: omap2 architecture specific definitions | ||
3 | * | ||
4 | * Copyright (C) 2008-2009 Nokia Corporation | ||
5 | * | ||
6 | * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __MACH_IOMMU2_H | ||
14 | #define __MACH_IOMMU2_H | ||
15 | |||
16 | #include <linux/io.h> | ||
17 | |||
18 | /* | ||
19 | * MMU Register offsets | ||
20 | */ | ||
21 | #define MMU_REVISION 0x00 | ||
22 | #define MMU_SYSCONFIG 0x10 | ||
23 | #define MMU_SYSSTATUS 0x14 | ||
24 | #define MMU_IRQSTATUS 0x18 | ||
25 | #define MMU_IRQENABLE 0x1c | ||
26 | #define MMU_WALKING_ST 0x40 | ||
27 | #define MMU_CNTL 0x44 | ||
28 | #define MMU_FAULT_AD 0x48 | ||
29 | #define MMU_TTB 0x4c | ||
30 | #define MMU_LOCK 0x50 | ||
31 | #define MMU_LD_TLB 0x54 | ||
32 | #define MMU_CAM 0x58 | ||
33 | #define MMU_RAM 0x5c | ||
34 | #define MMU_GFLUSH 0x60 | ||
35 | #define MMU_FLUSH_ENTRY 0x64 | ||
36 | #define MMU_READ_CAM 0x68 | ||
37 | #define MMU_READ_RAM 0x6c | ||
38 | #define MMU_EMU_FAULT_AD 0x70 | ||
39 | |||
40 | #define MMU_REG_SIZE 256 | ||
41 | |||
42 | /* | ||
43 | * MMU Register bit definitions | ||
44 | */ | ||
45 | #define MMU_LOCK_BASE_SHIFT 10 | ||
46 | #define MMU_LOCK_BASE_MASK (0x1f << MMU_LOCK_BASE_SHIFT) | ||
47 | #define MMU_LOCK_BASE(x) \ | ||
48 | ((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT) | ||
49 | |||
50 | #define MMU_LOCK_VICT_SHIFT 4 | ||
51 | #define MMU_LOCK_VICT_MASK (0x1f << MMU_LOCK_VICT_SHIFT) | ||
52 | #define MMU_LOCK_VICT(x) \ | ||
53 | ((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT) | ||
54 | |||
55 | #define MMU_CAM_VATAG_SHIFT 12 | ||
56 | #define MMU_CAM_VATAG_MASK \ | ||
57 | ((~0UL >> MMU_CAM_VATAG_SHIFT) << MMU_CAM_VATAG_SHIFT) | ||
58 | #define MMU_CAM_P (1 << 3) | ||
59 | #define MMU_CAM_V (1 << 2) | ||
60 | #define MMU_CAM_PGSZ_MASK 3 | ||
61 | #define MMU_CAM_PGSZ_1M (0 << 0) | ||
62 | #define MMU_CAM_PGSZ_64K (1 << 0) | ||
63 | #define MMU_CAM_PGSZ_4K (2 << 0) | ||
64 | #define MMU_CAM_PGSZ_16M (3 << 0) | ||
65 | |||
66 | #define MMU_RAM_PADDR_SHIFT 12 | ||
67 | #define MMU_RAM_PADDR_MASK \ | ||
68 | ((~0UL >> MMU_RAM_PADDR_SHIFT) << MMU_RAM_PADDR_SHIFT) | ||
69 | #define MMU_RAM_ENDIAN_SHIFT 9 | ||
70 | #define MMU_RAM_ENDIAN_MASK (1 << MMU_RAM_ENDIAN_SHIFT) | ||
71 | #define MMU_RAM_ENDIAN_BIG (1 << MMU_RAM_ENDIAN_SHIFT) | ||
72 | #define MMU_RAM_ENDIAN_LITTLE (0 << MMU_RAM_ENDIAN_SHIFT) | ||
73 | #define MMU_RAM_ELSZ_SHIFT 7 | ||
74 | #define MMU_RAM_ELSZ_MASK (3 << MMU_RAM_ELSZ_SHIFT) | ||
75 | #define MMU_RAM_ELSZ_8 (0 << MMU_RAM_ELSZ_SHIFT) | ||
76 | #define MMU_RAM_ELSZ_16 (1 << MMU_RAM_ELSZ_SHIFT) | ||
77 | #define MMU_RAM_ELSZ_32 (2 << MMU_RAM_ELSZ_SHIFT) | ||
78 | #define MMU_RAM_ELSZ_NONE (3 << MMU_RAM_ELSZ_SHIFT) | ||
79 | #define MMU_RAM_MIXED_SHIFT 6 | ||
80 | #define MMU_RAM_MIXED_MASK (1 << MMU_RAM_MIXED_SHIFT) | ||
81 | #define MMU_RAM_MIXED MMU_RAM_MIXED_MASK | ||
82 | |||
83 | /* | ||
84 | * register accessors | ||
85 | */ | ||
86 | static inline u32 iommu_read_reg(struct omap_iommu *obj, size_t offs) | ||
87 | { | ||
88 | return __raw_readl(obj->regbase + offs); | ||
89 | } | ||
90 | |||
91 | static inline void iommu_write_reg(struct omap_iommu *obj, u32 val, size_t offs) | ||
92 | { | ||
93 | __raw_writel(val, obj->regbase + offs); | ||
94 | } | ||
95 | |||
96 | #endif /* __MACH_IOMMU2_H */ | ||
diff --git a/arch/arm/plat-omap/include/plat/iopgtable.h b/arch/arm/plat-omap/include/plat/iopgtable.h new file mode 100644 index 00000000000..e0c56aafc2e --- /dev/null +++ b/arch/arm/plat-omap/include/plat/iopgtable.h | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | * omap iommu: pagetable definitions | ||
3 | * | ||
4 | * Copyright (C) 2008-2010 Nokia Corporation | ||
5 | * | ||
6 | * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __PLAT_OMAP_IOMMU_H | ||
14 | #define __PLAT_OMAP_IOMMU_H | ||
15 | |||
16 | /* | ||
17 | * "L2 table" address mask and size definitions. | ||
18 | */ | ||
19 | #define IOPGD_SHIFT 20 | ||
20 | #define IOPGD_SIZE (1UL << IOPGD_SHIFT) | ||
21 | #define IOPGD_MASK (~(IOPGD_SIZE - 1)) | ||
22 | |||
23 | /* | ||
24 | * "section" address mask and size definitions. | ||
25 | */ | ||
26 | #define IOSECTION_SHIFT 20 | ||
27 | #define IOSECTION_SIZE (1UL << IOSECTION_SHIFT) | ||
28 | #define IOSECTION_MASK (~(IOSECTION_SIZE - 1)) | ||
29 | |||
30 | /* | ||
31 | * "supersection" address mask and size definitions. | ||
32 | */ | ||
33 | #define IOSUPER_SHIFT 24 | ||
34 | #define IOSUPER_SIZE (1UL << IOSUPER_SHIFT) | ||
35 | #define IOSUPER_MASK (~(IOSUPER_SIZE - 1)) | ||
36 | |||
37 | #define PTRS_PER_IOPGD (1UL << (32 - IOPGD_SHIFT)) | ||
38 | #define IOPGD_TABLE_SIZE (PTRS_PER_IOPGD * sizeof(u32)) | ||
39 | |||
40 | /* | ||
41 | * "small page" address mask and size definitions. | ||
42 | */ | ||
43 | #define IOPTE_SHIFT 12 | ||
44 | #define IOPTE_SIZE (1UL << IOPTE_SHIFT) | ||
45 | #define IOPTE_MASK (~(IOPTE_SIZE - 1)) | ||
46 | |||
47 | /* | ||
48 | * "large page" address mask and size definitions. | ||
49 | */ | ||
50 | #define IOLARGE_SHIFT 16 | ||
51 | #define IOLARGE_SIZE (1UL << IOLARGE_SHIFT) | ||
52 | #define IOLARGE_MASK (~(IOLARGE_SIZE - 1)) | ||
53 | |||
54 | #define PTRS_PER_IOPTE (1UL << (IOPGD_SHIFT - IOPTE_SHIFT)) | ||
55 | #define IOPTE_TABLE_SIZE (PTRS_PER_IOPTE * sizeof(u32)) | ||
56 | |||
57 | #define IOPAGE_MASK IOPTE_MASK | ||
58 | |||
59 | /* | ||
60 | * some descriptor attributes. | ||
61 | */ | ||
62 | #define IOPGD_TABLE (1 << 0) | ||
63 | #define IOPGD_SECTION (2 << 0) | ||
64 | #define IOPGD_SUPER (1 << 18 | 2 << 0) | ||
65 | |||
66 | #define iopgd_is_table(x) (((x) & 3) == IOPGD_TABLE) | ||
67 | |||
68 | #define IOPTE_SMALL (2 << 0) | ||
69 | #define IOPTE_LARGE (1 << 0) | ||
70 | |||
71 | /* to find an entry in a page-table-directory */ | ||
72 | #define iopgd_index(da) (((da) >> IOPGD_SHIFT) & (PTRS_PER_IOPGD - 1)) | ||
73 | #define iopgd_offset(obj, da) ((obj)->iopgd + iopgd_index(da)) | ||
74 | |||
75 | #define iopgd_page_paddr(iopgd) (*iopgd & ~((1 << 10) - 1)) | ||
76 | #define iopgd_page_vaddr(iopgd) ((u32 *)phys_to_virt(iopgd_page_paddr(iopgd))) | ||
77 | |||
78 | /* to find an entry in the second-level page table. */ | ||
79 | #define iopte_index(da) (((da) >> IOPTE_SHIFT) & (PTRS_PER_IOPTE - 1)) | ||
80 | #define iopte_offset(iopgd, da) (iopgd_page_vaddr(iopgd) + iopte_index(da)) | ||
81 | |||
82 | static inline u32 iotlb_init_entry(struct iotlb_entry *e, u32 da, u32 pa, | ||
83 | u32 flags) | ||
84 | { | ||
85 | memset(e, 0, sizeof(*e)); | ||
86 | |||
87 | e->da = da; | ||
88 | e->pa = pa; | ||
89 | e->valid = 1; | ||
90 | /* FIXME: add OMAP1 support */ | ||
91 | e->pgsz = flags & MMU_CAM_PGSZ_MASK; | ||
92 | e->endian = flags & MMU_RAM_ENDIAN_MASK; | ||
93 | e->elsz = flags & MMU_RAM_ELSZ_MASK; | ||
94 | e->mixed = flags & MMU_RAM_MIXED_MASK; | ||
95 | |||
96 | return iopgsz_to_bytes(e->pgsz); | ||
97 | } | ||
98 | |||
99 | #define to_iommu(dev) \ | ||
100 | (struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)) | ||
101 | |||
102 | #endif /* __PLAT_OMAP_IOMMU_H */ | ||
diff --git a/arch/arm/plat-omap/include/plat/iovmm.h b/arch/arm/plat-omap/include/plat/iovmm.h new file mode 100644 index 00000000000..498e57cda6c --- /dev/null +++ b/arch/arm/plat-omap/include/plat/iovmm.h | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * omap iommu: simple virtual address space management | ||
3 | * | ||
4 | * Copyright (C) 2008-2009 Nokia Corporation | ||
5 | * | ||
6 | * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __IOMMU_MMAP_H | ||
14 | #define __IOMMU_MMAP_H | ||
15 | |||
16 | #include <linux/iommu.h> | ||
17 | |||
18 | struct iovm_struct { | ||
19 | struct omap_iommu *iommu; /* iommu object which this belongs to */ | ||
20 | u32 da_start; /* area definition */ | ||
21 | u32 da_end; | ||
22 | u32 flags; /* IOVMF_: see below */ | ||
23 | struct list_head list; /* linked in ascending order */ | ||
24 | const struct sg_table *sgt; /* keep 'page' <-> 'da' mapping */ | ||
25 | void *va; /* mpu side mapped address */ | ||
26 | }; | ||
27 | |||
28 | /* | ||
29 | * IOVMF_FLAGS: attribute for iommu virtual memory area(iovma) | ||
30 | * | ||
31 | * lower 16 bit is used for h/w and upper 16 bit is for s/w. | ||
32 | */ | ||
33 | #define IOVMF_SW_SHIFT 16 | ||
34 | |||
35 | /* | ||
36 | * iovma: h/w flags derived from cam and ram attribute | ||
37 | */ | ||
38 | #define IOVMF_CAM_MASK (~((1 << 10) - 1)) | ||
39 | #define IOVMF_RAM_MASK (~IOVMF_CAM_MASK) | ||
40 | |||
41 | #define IOVMF_PGSZ_MASK (3 << 0) | ||
42 | #define IOVMF_PGSZ_1M MMU_CAM_PGSZ_1M | ||
43 | #define IOVMF_PGSZ_64K MMU_CAM_PGSZ_64K | ||
44 | #define IOVMF_PGSZ_4K MMU_CAM_PGSZ_4K | ||
45 | #define IOVMF_PGSZ_16M MMU_CAM_PGSZ_16M | ||
46 | |||
47 | #define IOVMF_ENDIAN_MASK (1 << 9) | ||
48 | #define IOVMF_ENDIAN_BIG MMU_RAM_ENDIAN_BIG | ||
49 | #define IOVMF_ENDIAN_LITTLE MMU_RAM_ENDIAN_LITTLE | ||
50 | |||
51 | #define IOVMF_ELSZ_MASK (3 << 7) | ||
52 | #define IOVMF_ELSZ_8 MMU_RAM_ELSZ_8 | ||
53 | #define IOVMF_ELSZ_16 MMU_RAM_ELSZ_16 | ||
54 | #define IOVMF_ELSZ_32 MMU_RAM_ELSZ_32 | ||
55 | #define IOVMF_ELSZ_NONE MMU_RAM_ELSZ_NONE | ||
56 | |||
57 | #define IOVMF_MIXED_MASK (1 << 6) | ||
58 | #define IOVMF_MIXED MMU_RAM_MIXED | ||
59 | |||
60 | /* | ||
61 | * iovma: s/w flags, used for mapping and umapping internally. | ||
62 | */ | ||
63 | #define IOVMF_MMIO (1 << IOVMF_SW_SHIFT) | ||
64 | #define IOVMF_ALLOC (2 << IOVMF_SW_SHIFT) | ||
65 | #define IOVMF_ALLOC_MASK (3 << IOVMF_SW_SHIFT) | ||
66 | |||
67 | /* "superpages" is supported just with physically linear pages */ | ||
68 | #define IOVMF_DISCONT (1 << (2 + IOVMF_SW_SHIFT)) | ||
69 | #define IOVMF_LINEAR (2 << (2 + IOVMF_SW_SHIFT)) | ||
70 | #define IOVMF_LINEAR_MASK (3 << (2 + IOVMF_SW_SHIFT)) | ||
71 | |||
72 | #define IOVMF_DA_FIXED (1 << (4 + IOVMF_SW_SHIFT)) | ||
73 | |||
74 | |||
75 | extern struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da); | ||
76 | extern u32 | ||
77 | omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da, | ||
78 | const struct sg_table *sgt, u32 flags); | ||
79 | extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain, | ||
80 | struct device *dev, u32 da); | ||
81 | extern u32 | ||
82 | omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev, | ||
83 | u32 da, size_t bytes, u32 flags); | ||
84 | extern void | ||
85 | omap_iommu_vfree(struct iommu_domain *domain, struct device *dev, | ||
86 | const u32 da); | ||
87 | extern void *omap_da_to_va(struct device *dev, u32 da); | ||
88 | |||
89 | #endif /* __IOMMU_MMAP_H */ | ||
diff --git a/arch/arm/plat-omap/include/plat/irda.h b/arch/arm/plat-omap/include/plat/irda.h new file mode 100644 index 00000000000..40f60339d1c --- /dev/null +++ b/arch/arm/plat-omap/include/plat/irda.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/irda.h | ||
3 | * | ||
4 | * Copyright (C) 2005-2006 Komal Shah <komal_shah802003@yahoo.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef ASMARM_ARCH_IRDA_H | ||
11 | #define ASMARM_ARCH_IRDA_H | ||
12 | |||
13 | /* board specific transceiver capabilities */ | ||
14 | |||
15 | #define IR_SEL 1 /* Selects IrDA */ | ||
16 | #define IR_SIRMODE 2 | ||
17 | #define IR_FIRMODE 4 | ||
18 | #define IR_MIRMODE 8 | ||
19 | |||
20 | struct omap_irda_config { | ||
21 | int transceiver_cap; | ||
22 | int (*transceiver_mode)(struct device *dev, int mode); | ||
23 | int (*select_irda)(struct device *dev, int state); | ||
24 | int rx_channel; | ||
25 | int tx_channel; | ||
26 | unsigned long dest_start; | ||
27 | unsigned long src_start; | ||
28 | int tx_trigger; | ||
29 | int rx_trigger; | ||
30 | int mode; | ||
31 | }; | ||
32 | |||
33 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/irqs-44xx.h b/arch/arm/plat-omap/include/plat/irqs-44xx.h new file mode 100644 index 00000000000..518322c8011 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/irqs-44xx.h | |||
@@ -0,0 +1,144 @@ | |||
1 | /* | ||
2 | * OMAP4 Interrupt lines definitions | ||
3 | * | ||
4 | * Copyright (C) 2009-2010 Texas Instruments, Inc. | ||
5 | * | ||
6 | * Santosh Shilimkar (santosh.shilimkar@ti.com) | ||
7 | * Benoit Cousson (b-cousson@ti.com) | ||
8 | * | ||
9 | * This file is automatically generated from the OMAP hardware databases. | ||
10 | * We respectfully ask that any modifications to this file be coordinated | ||
11 | * with the public linux-omap@vger.kernel.org mailing list and the | ||
12 | * authors above to ensure that the autogeneration scripts are kept | ||
13 | * up-to-date with the file contents. | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of the GNU General Public License version 2 as | ||
17 | * published by the Free Software Foundation. | ||
18 | */ | ||
19 | |||
20 | #ifndef __ARCH_ARM_MACH_OMAP2_OMAP44XX_IRQS_H | ||
21 | #define __ARCH_ARM_MACH_OMAP2_OMAP44XX_IRQS_H | ||
22 | |||
23 | /* OMAP44XX IRQs numbers definitions */ | ||
24 | #define OMAP44XX_IRQ_LOCALTIMER 29 | ||
25 | #define OMAP44XX_IRQ_LOCALWDT 30 | ||
26 | |||
27 | #define OMAP44XX_IRQ_GIC_START 32 | ||
28 | |||
29 | #define OMAP44XX_IRQ_PL310 (0 + OMAP44XX_IRQ_GIC_START) | ||
30 | #define OMAP44XX_IRQ_CTI0 (1 + OMAP44XX_IRQ_GIC_START) | ||
31 | #define OMAP44XX_IRQ_CTI1 (2 + OMAP44XX_IRQ_GIC_START) | ||
32 | #define OMAP44XX_IRQ_ELM (4 + OMAP44XX_IRQ_GIC_START) | ||
33 | #define OMAP44XX_IRQ_SYS_1N (7 + OMAP44XX_IRQ_GIC_START) | ||
34 | #define OMAP44XX_IRQ_SECURITY_EVENTS (8 + OMAP44XX_IRQ_GIC_START) | ||
35 | #define OMAP44XX_IRQ_L3_DBG (9 + OMAP44XX_IRQ_GIC_START) | ||
36 | #define OMAP44XX_IRQ_L3_APP (10 + OMAP44XX_IRQ_GIC_START) | ||
37 | #define OMAP44XX_IRQ_PRCM (11 + OMAP44XX_IRQ_GIC_START) | ||
38 | #define OMAP44XX_IRQ_SDMA_0 (12 + OMAP44XX_IRQ_GIC_START) | ||
39 | #define OMAP44XX_IRQ_SDMA_1 (13 + OMAP44XX_IRQ_GIC_START) | ||
40 | #define OMAP44XX_IRQ_SDMA_2 (14 + OMAP44XX_IRQ_GIC_START) | ||
41 | #define OMAP44XX_IRQ_SDMA_3 (15 + OMAP44XX_IRQ_GIC_START) | ||
42 | #define OMAP44XX_IRQ_MCBSP4 (16 + OMAP44XX_IRQ_GIC_START) | ||
43 | #define OMAP44XX_IRQ_MCBSP1 (17 + OMAP44XX_IRQ_GIC_START) | ||
44 | #define OMAP44XX_IRQ_SR_MCU (18 + OMAP44XX_IRQ_GIC_START) | ||
45 | #define OMAP44XX_IRQ_SR_CORE (19 + OMAP44XX_IRQ_GIC_START) | ||
46 | #define OMAP44XX_IRQ_GPMC (20 + OMAP44XX_IRQ_GIC_START) | ||
47 | #define OMAP44XX_IRQ_GFX (21 + OMAP44XX_IRQ_GIC_START) | ||
48 | #define OMAP44XX_IRQ_MCBSP2 (22 + OMAP44XX_IRQ_GIC_START) | ||
49 | #define OMAP44XX_IRQ_MCBSP3 (23 + OMAP44XX_IRQ_GIC_START) | ||
50 | #define OMAP44XX_IRQ_ISS_5 (24 + OMAP44XX_IRQ_GIC_START) | ||
51 | #define OMAP44XX_IRQ_DSS_DISPC (25 + OMAP44XX_IRQ_GIC_START) | ||
52 | #define OMAP44XX_IRQ_MAIL_U0 (26 + OMAP44XX_IRQ_GIC_START) | ||
53 | #define OMAP44XX_IRQ_C2C_SSCM_0 (27 + OMAP44XX_IRQ_GIC_START) | ||
54 | #define OMAP44XX_IRQ_TESLA_MMU (28 + OMAP44XX_IRQ_GIC_START) | ||
55 | #define OMAP44XX_IRQ_GPIO1 (29 + OMAP44XX_IRQ_GIC_START) | ||
56 | #define OMAP44XX_IRQ_GPIO2 (30 + OMAP44XX_IRQ_GIC_START) | ||
57 | #define OMAP44XX_IRQ_GPIO3 (31 + OMAP44XX_IRQ_GIC_START) | ||
58 | #define OMAP44XX_IRQ_GPIO4 (32 + OMAP44XX_IRQ_GIC_START) | ||
59 | #define OMAP44XX_IRQ_GPIO5 (33 + OMAP44XX_IRQ_GIC_START) | ||
60 | #define OMAP44XX_IRQ_GPIO6 (34 + OMAP44XX_IRQ_GIC_START) | ||
61 | #define OMAP44XX_IRQ_USIM (35 + OMAP44XX_IRQ_GIC_START) | ||
62 | #define OMAP44XX_IRQ_WDT3 (36 + OMAP44XX_IRQ_GIC_START) | ||
63 | #define OMAP44XX_IRQ_GPT1 (37 + OMAP44XX_IRQ_GIC_START) | ||
64 | #define OMAP44XX_IRQ_GPT2 (38 + OMAP44XX_IRQ_GIC_START) | ||
65 | #define OMAP44XX_IRQ_GPT3 (39 + OMAP44XX_IRQ_GIC_START) | ||
66 | #define OMAP44XX_IRQ_GPT4 (40 + OMAP44XX_IRQ_GIC_START) | ||
67 | #define OMAP44XX_IRQ_GPT5 (41 + OMAP44XX_IRQ_GIC_START) | ||
68 | #define OMAP44XX_IRQ_GPT6 (42 + OMAP44XX_IRQ_GIC_START) | ||
69 | #define OMAP44XX_IRQ_GPT7 (43 + OMAP44XX_IRQ_GIC_START) | ||
70 | #define OMAP44XX_IRQ_GPT8 (44 + OMAP44XX_IRQ_GIC_START) | ||
71 | #define OMAP44XX_IRQ_GPT9 (45 + OMAP44XX_IRQ_GIC_START) | ||
72 | #define OMAP44XX_IRQ_GPT10 (46 + OMAP44XX_IRQ_GIC_START) | ||
73 | #define OMAP44XX_IRQ_GPT11 (47 + OMAP44XX_IRQ_GIC_START) | ||
74 | #define OMAP44XX_IRQ_SPI4 (48 + OMAP44XX_IRQ_GIC_START) | ||
75 | #define OMAP44XX_IRQ_SHA1_S (49 + OMAP44XX_IRQ_GIC_START) | ||
76 | #define OMAP44XX_IRQ_FPKA_SINTREQUEST_S (50 + OMAP44XX_IRQ_GIC_START) | ||
77 | #define OMAP44XX_IRQ_SHA1_P (51 + OMAP44XX_IRQ_GIC_START) | ||
78 | #define OMAP44XX_IRQ_RNG (52 + OMAP44XX_IRQ_GIC_START) | ||
79 | #define OMAP44XX_IRQ_DSS_DSI1 (53 + OMAP44XX_IRQ_GIC_START) | ||
80 | #define OMAP44XX_IRQ_I2C1 (56 + OMAP44XX_IRQ_GIC_START) | ||
81 | #define OMAP44XX_IRQ_I2C2 (57 + OMAP44XX_IRQ_GIC_START) | ||
82 | #define OMAP44XX_IRQ_HDQ (58 + OMAP44XX_IRQ_GIC_START) | ||
83 | #define OMAP44XX_IRQ_MMC5 (59 + OMAP44XX_IRQ_GIC_START) | ||
84 | #define OMAP44XX_IRQ_I2C3 (61 + OMAP44XX_IRQ_GIC_START) | ||
85 | #define OMAP44XX_IRQ_I2C4 (62 + OMAP44XX_IRQ_GIC_START) | ||
86 | #define OMAP44XX_IRQ_AES2_S (63 + OMAP44XX_IRQ_GIC_START) | ||
87 | #define OMAP44XX_IRQ_AES2_P (64 + OMAP44XX_IRQ_GIC_START) | ||
88 | #define OMAP44XX_IRQ_SPI1 (65 + OMAP44XX_IRQ_GIC_START) | ||
89 | #define OMAP44XX_IRQ_SPI2 (66 + OMAP44XX_IRQ_GIC_START) | ||
90 | #define OMAP44XX_IRQ_HSI_P1 (67 + OMAP44XX_IRQ_GIC_START) | ||
91 | #define OMAP44XX_IRQ_HSI_P2 (68 + OMAP44XX_IRQ_GIC_START) | ||
92 | #define OMAP44XX_IRQ_FDIF_3 (69 + OMAP44XX_IRQ_GIC_START) | ||
93 | #define OMAP44XX_IRQ_UART4 (70 + OMAP44XX_IRQ_GIC_START) | ||
94 | #define OMAP44XX_IRQ_HSI_DMA (71 + OMAP44XX_IRQ_GIC_START) | ||
95 | #define OMAP44XX_IRQ_UART1 (72 + OMAP44XX_IRQ_GIC_START) | ||
96 | #define OMAP44XX_IRQ_UART2 (73 + OMAP44XX_IRQ_GIC_START) | ||
97 | #define OMAP44XX_IRQ_UART3 (74 + OMAP44XX_IRQ_GIC_START) | ||
98 | #define OMAP44XX_IRQ_PBIAS (75 + OMAP44XX_IRQ_GIC_START) | ||
99 | #define OMAP44XX_IRQ_OHCI (76 + OMAP44XX_IRQ_GIC_START) | ||
100 | #define OMAP44XX_IRQ_EHCI (77 + OMAP44XX_IRQ_GIC_START) | ||
101 | #define OMAP44XX_IRQ_TLL (78 + OMAP44XX_IRQ_GIC_START) | ||
102 | #define OMAP44XX_IRQ_AES1_S (79 + OMAP44XX_IRQ_GIC_START) | ||
103 | #define OMAP44XX_IRQ_WDT2 (80 + OMAP44XX_IRQ_GIC_START) | ||
104 | #define OMAP44XX_IRQ_DES_S (81 + OMAP44XX_IRQ_GIC_START) | ||
105 | #define OMAP44XX_IRQ_DES_P (82 + OMAP44XX_IRQ_GIC_START) | ||
106 | #define OMAP44XX_IRQ_MMC1 (83 + OMAP44XX_IRQ_GIC_START) | ||
107 | #define OMAP44XX_IRQ_DSS_DSI2 (84 + OMAP44XX_IRQ_GIC_START) | ||
108 | #define OMAP44XX_IRQ_AES1_P (85 + OMAP44XX_IRQ_GIC_START) | ||
109 | #define OMAP44XX_IRQ_MMC2 (86 + OMAP44XX_IRQ_GIC_START) | ||
110 | #define OMAP44XX_IRQ_MPU_ICR (87 + OMAP44XX_IRQ_GIC_START) | ||
111 | #define OMAP44XX_IRQ_C2C_SSCM_1 (88 + OMAP44XX_IRQ_GIC_START) | ||
112 | #define OMAP44XX_IRQ_FSUSB (89 + OMAP44XX_IRQ_GIC_START) | ||
113 | #define OMAP44XX_IRQ_FSUSB_SMI (90 + OMAP44XX_IRQ_GIC_START) | ||
114 | #define OMAP44XX_IRQ_SPI3 (91 + OMAP44XX_IRQ_GIC_START) | ||
115 | #define OMAP44XX_IRQ_HS_USB_MC_N (92 + OMAP44XX_IRQ_GIC_START) | ||
116 | #define OMAP44XX_IRQ_HS_USB_DMA_N (93 + OMAP44XX_IRQ_GIC_START) | ||
117 | #define OMAP44XX_IRQ_MMC3 (94 + OMAP44XX_IRQ_GIC_START) | ||
118 | #define OMAP44XX_IRQ_GPT12 (95 + OMAP44XX_IRQ_GIC_START) | ||
119 | #define OMAP44XX_IRQ_MMC4 (96 + OMAP44XX_IRQ_GIC_START) | ||
120 | #define OMAP44XX_IRQ_SLIMBUS1 (97 + OMAP44XX_IRQ_GIC_START) | ||
121 | #define OMAP44XX_IRQ_SLIMBUS2 (98 + OMAP44XX_IRQ_GIC_START) | ||
122 | #define OMAP44XX_IRQ_ABE (99 + OMAP44XX_IRQ_GIC_START) | ||
123 | #define OMAP44XX_IRQ_DUCATI_MMU (100 + OMAP44XX_IRQ_GIC_START) | ||
124 | #define OMAP44XX_IRQ_DSS_HDMI (101 + OMAP44XX_IRQ_GIC_START) | ||
125 | #define OMAP44XX_IRQ_SR_IVA (102 + OMAP44XX_IRQ_GIC_START) | ||
126 | #define OMAP44XX_IRQ_IVA_HD_POSYNCITRPEND_1 (103 + OMAP44XX_IRQ_GIC_START) | ||
127 | #define OMAP44XX_IRQ_IVA_HD_POSYNCITRPEND_0 (104 + OMAP44XX_IRQ_GIC_START) | ||
128 | #define OMAP44XX_IRQ_IVA_HD_POMBINTRPEND_0 (107 + OMAP44XX_IRQ_GIC_START) | ||
129 | #define OMAP44XX_IRQ_MCASP1_AR (108 + OMAP44XX_IRQ_GIC_START) | ||
130 | #define OMAP44XX_IRQ_MCASP1_AX (109 + OMAP44XX_IRQ_GIC_START) | ||
131 | #define OMAP44XX_IRQ_EMIF4_1 (110 + OMAP44XX_IRQ_GIC_START) | ||
132 | #define OMAP44XX_IRQ_EMIF4_2 (111 + OMAP44XX_IRQ_GIC_START) | ||
133 | #define OMAP44XX_IRQ_MCPDM (112 + OMAP44XX_IRQ_GIC_START) | ||
134 | #define OMAP44XX_IRQ_DMM (113 + OMAP44XX_IRQ_GIC_START) | ||
135 | #define OMAP44XX_IRQ_DMIC (114 + OMAP44XX_IRQ_GIC_START) | ||
136 | #define OMAP44XX_IRQ_CDMA_0 (115 + OMAP44XX_IRQ_GIC_START) | ||
137 | #define OMAP44XX_IRQ_CDMA_1 (116 + OMAP44XX_IRQ_GIC_START) | ||
138 | #define OMAP44XX_IRQ_CDMA_2 (117 + OMAP44XX_IRQ_GIC_START) | ||
139 | #define OMAP44XX_IRQ_CDMA_3 (118 + OMAP44XX_IRQ_GIC_START) | ||
140 | #define OMAP44XX_IRQ_SYS_2N (119 + OMAP44XX_IRQ_GIC_START) | ||
141 | #define OMAP44XX_IRQ_KBD_CTL (120 + OMAP44XX_IRQ_GIC_START) | ||
142 | #define OMAP44XX_IRQ_UNIPRO1 (124 + OMAP44XX_IRQ_GIC_START) | ||
143 | |||
144 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/irqs.h b/arch/arm/plat-omap/include/plat/irqs.h new file mode 100644 index 00000000000..30e10719b77 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/irqs.h | |||
@@ -0,0 +1,459 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/irqs.h | ||
3 | * | ||
4 | * Copyright (C) Greg Lonnon 2001 | ||
5 | * Updated for OMAP-1610 by Tony Lindgren <tony@atomide.com> | ||
6 | * | ||
7 | * Copyright (C) 2009 Texas Instruments | ||
8 | * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | * | ||
24 | * NOTE: The interrupt vectors for the OMAP-1509, OMAP-1510, and OMAP-1610 | ||
25 | * are different. | ||
26 | */ | ||
27 | |||
28 | #ifndef __ASM_ARCH_OMAP15XX_IRQS_H | ||
29 | #define __ASM_ARCH_OMAP15XX_IRQS_H | ||
30 | |||
31 | /* All OMAP4 specific defines are moved to irqs-44xx.h */ | ||
32 | #include "irqs-44xx.h" | ||
33 | |||
34 | /* | ||
35 | * IRQ numbers for interrupt handler 1 | ||
36 | * | ||
37 | * NOTE: See also the OMAP-1510 and 1610 specific IRQ numbers below | ||
38 | * | ||
39 | */ | ||
40 | #define INT_CAMERA 1 | ||
41 | #define INT_FIQ 3 | ||
42 | #define INT_RTDX 6 | ||
43 | #define INT_DSP_MMU_ABORT 7 | ||
44 | #define INT_HOST 8 | ||
45 | #define INT_ABORT 9 | ||
46 | #define INT_BRIDGE_PRIV 13 | ||
47 | #define INT_GPIO_BANK1 14 | ||
48 | #define INT_UART3 15 | ||
49 | #define INT_TIMER3 16 | ||
50 | #define INT_DMA_CH0_6 19 | ||
51 | #define INT_DMA_CH1_7 20 | ||
52 | #define INT_DMA_CH2_8 21 | ||
53 | #define INT_DMA_CH3 22 | ||
54 | #define INT_DMA_CH4 23 | ||
55 | #define INT_DMA_CH5 24 | ||
56 | #define INT_DMA_LCD 25 | ||
57 | #define INT_TIMER1 26 | ||
58 | #define INT_WD_TIMER 27 | ||
59 | #define INT_BRIDGE_PUB 28 | ||
60 | #define INT_TIMER2 30 | ||
61 | #define INT_LCD_CTRL 31 | ||
62 | |||
63 | /* | ||
64 | * OMAP-1510 specific IRQ numbers for interrupt handler 1 | ||
65 | */ | ||
66 | #define INT_1510_IH2_IRQ 0 | ||
67 | #define INT_1510_RES2 2 | ||
68 | #define INT_1510_SPI_TX 4 | ||
69 | #define INT_1510_SPI_RX 5 | ||
70 | #define INT_1510_DSP_MAILBOX1 10 | ||
71 | #define INT_1510_DSP_MAILBOX2 11 | ||
72 | #define INT_1510_RES12 12 | ||
73 | #define INT_1510_LB_MMU 17 | ||
74 | #define INT_1510_RES18 18 | ||
75 | #define INT_1510_LOCAL_BUS 29 | ||
76 | |||
77 | /* | ||
78 | * OMAP-1610 specific IRQ numbers for interrupt handler 1 | ||
79 | */ | ||
80 | #define INT_1610_IH2_IRQ INT_1510_IH2_IRQ | ||
81 | #define INT_1610_IH2_FIQ 2 | ||
82 | #define INT_1610_McBSP2_TX 4 | ||
83 | #define INT_1610_McBSP2_RX 5 | ||
84 | #define INT_1610_DSP_MAILBOX1 10 | ||
85 | #define INT_1610_DSP_MAILBOX2 11 | ||
86 | #define INT_1610_LCD_LINE 12 | ||
87 | #define INT_1610_GPTIMER1 17 | ||
88 | #define INT_1610_GPTIMER2 18 | ||
89 | #define INT_1610_SSR_FIFO_0 29 | ||
90 | |||
91 | /* | ||
92 | * OMAP-7xx specific IRQ numbers for interrupt handler 1 | ||
93 | */ | ||
94 | #define INT_7XX_IH2_FIQ 0 | ||
95 | #define INT_7XX_IH2_IRQ 1 | ||
96 | #define INT_7XX_USB_NON_ISO 2 | ||
97 | #define INT_7XX_USB_ISO 3 | ||
98 | #define INT_7XX_ICR 4 | ||
99 | #define INT_7XX_EAC 5 | ||
100 | #define INT_7XX_GPIO_BANK1 6 | ||
101 | #define INT_7XX_GPIO_BANK2 7 | ||
102 | #define INT_7XX_GPIO_BANK3 8 | ||
103 | #define INT_7XX_McBSP2TX 10 | ||
104 | #define INT_7XX_McBSP2RX 11 | ||
105 | #define INT_7XX_McBSP2RX_OVF 12 | ||
106 | #define INT_7XX_LCD_LINE 14 | ||
107 | #define INT_7XX_GSM_PROTECT 15 | ||
108 | #define INT_7XX_TIMER3 16 | ||
109 | #define INT_7XX_GPIO_BANK5 17 | ||
110 | #define INT_7XX_GPIO_BANK6 18 | ||
111 | #define INT_7XX_SPGIO_WR 29 | ||
112 | |||
113 | /* | ||
114 | * IRQ numbers for interrupt handler 2 | ||
115 | * | ||
116 | * NOTE: See also the OMAP-1510 and 1610 specific IRQ numbers below | ||
117 | */ | ||
118 | #define IH2_BASE 32 | ||
119 | |||
120 | #define INT_KEYBOARD (1 + IH2_BASE) | ||
121 | #define INT_uWireTX (2 + IH2_BASE) | ||
122 | #define INT_uWireRX (3 + IH2_BASE) | ||
123 | #define INT_I2C (4 + IH2_BASE) | ||
124 | #define INT_MPUIO (5 + IH2_BASE) | ||
125 | #define INT_USB_HHC_1 (6 + IH2_BASE) | ||
126 | #define INT_McBSP3TX (10 + IH2_BASE) | ||
127 | #define INT_McBSP3RX (11 + IH2_BASE) | ||
128 | #define INT_McBSP1TX (12 + IH2_BASE) | ||
129 | #define INT_McBSP1RX (13 + IH2_BASE) | ||
130 | #define INT_UART1 (14 + IH2_BASE) | ||
131 | #define INT_UART2 (15 + IH2_BASE) | ||
132 | #define INT_BT_MCSI1TX (16 + IH2_BASE) | ||
133 | #define INT_BT_MCSI1RX (17 + IH2_BASE) | ||
134 | #define INT_SOSSI_MATCH (19 + IH2_BASE) | ||
135 | #define INT_USB_W2FC (20 + IH2_BASE) | ||
136 | #define INT_1WIRE (21 + IH2_BASE) | ||
137 | #define INT_OS_TIMER (22 + IH2_BASE) | ||
138 | #define INT_MMC (23 + IH2_BASE) | ||
139 | #define INT_GAUGE_32K (24 + IH2_BASE) | ||
140 | #define INT_RTC_TIMER (25 + IH2_BASE) | ||
141 | #define INT_RTC_ALARM (26 + IH2_BASE) | ||
142 | #define INT_MEM_STICK (27 + IH2_BASE) | ||
143 | |||
144 | /* | ||
145 | * OMAP-1510 specific IRQ numbers for interrupt handler 2 | ||
146 | */ | ||
147 | #define INT_1510_DSP_MMU (28 + IH2_BASE) | ||
148 | #define INT_1510_COM_SPI_RO (31 + IH2_BASE) | ||
149 | |||
150 | /* | ||
151 | * OMAP-1610 specific IRQ numbers for interrupt handler 2 | ||
152 | */ | ||
153 | #define INT_1610_FAC (0 + IH2_BASE) | ||
154 | #define INT_1610_USB_HHC_2 (7 + IH2_BASE) | ||
155 | #define INT_1610_USB_OTG (8 + IH2_BASE) | ||
156 | #define INT_1610_SoSSI (9 + IH2_BASE) | ||
157 | #define INT_1610_SoSSI_MATCH (19 + IH2_BASE) | ||
158 | #define INT_1610_DSP_MMU (28 + IH2_BASE) | ||
159 | #define INT_1610_McBSP2RX_OF (31 + IH2_BASE) | ||
160 | #define INT_1610_STI (32 + IH2_BASE) | ||
161 | #define INT_1610_STI_WAKEUP (33 + IH2_BASE) | ||
162 | #define INT_1610_GPTIMER3 (34 + IH2_BASE) | ||
163 | #define INT_1610_GPTIMER4 (35 + IH2_BASE) | ||
164 | #define INT_1610_GPTIMER5 (36 + IH2_BASE) | ||
165 | #define INT_1610_GPTIMER6 (37 + IH2_BASE) | ||
166 | #define INT_1610_GPTIMER7 (38 + IH2_BASE) | ||
167 | #define INT_1610_GPTIMER8 (39 + IH2_BASE) | ||
168 | #define INT_1610_GPIO_BANK2 (40 + IH2_BASE) | ||
169 | #define INT_1610_GPIO_BANK3 (41 + IH2_BASE) | ||
170 | #define INT_1610_MMC2 (42 + IH2_BASE) | ||
171 | #define INT_1610_CF (43 + IH2_BASE) | ||
172 | #define INT_1610_WAKE_UP_REQ (46 + IH2_BASE) | ||
173 | #define INT_1610_GPIO_BANK4 (48 + IH2_BASE) | ||
174 | #define INT_1610_SPI (49 + IH2_BASE) | ||
175 | #define INT_1610_DMA_CH6 (53 + IH2_BASE) | ||
176 | #define INT_1610_DMA_CH7 (54 + IH2_BASE) | ||
177 | #define INT_1610_DMA_CH8 (55 + IH2_BASE) | ||
178 | #define INT_1610_DMA_CH9 (56 + IH2_BASE) | ||
179 | #define INT_1610_DMA_CH10 (57 + IH2_BASE) | ||
180 | #define INT_1610_DMA_CH11 (58 + IH2_BASE) | ||
181 | #define INT_1610_DMA_CH12 (59 + IH2_BASE) | ||
182 | #define INT_1610_DMA_CH13 (60 + IH2_BASE) | ||
183 | #define INT_1610_DMA_CH14 (61 + IH2_BASE) | ||
184 | #define INT_1610_DMA_CH15 (62 + IH2_BASE) | ||
185 | #define INT_1610_NAND (63 + IH2_BASE) | ||
186 | #define INT_1610_SHA1MD5 (91 + IH2_BASE) | ||
187 | |||
188 | /* | ||
189 | * OMAP-7xx specific IRQ numbers for interrupt handler 2 | ||
190 | */ | ||
191 | #define INT_7XX_HW_ERRORS (0 + IH2_BASE) | ||
192 | #define INT_7XX_NFIQ_PWR_FAIL (1 + IH2_BASE) | ||
193 | #define INT_7XX_CFCD (2 + IH2_BASE) | ||
194 | #define INT_7XX_CFIREQ (3 + IH2_BASE) | ||
195 | #define INT_7XX_I2C (4 + IH2_BASE) | ||
196 | #define INT_7XX_PCC (5 + IH2_BASE) | ||
197 | #define INT_7XX_MPU_EXT_NIRQ (6 + IH2_BASE) | ||
198 | #define INT_7XX_SPI_100K_1 (7 + IH2_BASE) | ||
199 | #define INT_7XX_SYREN_SPI (8 + IH2_BASE) | ||
200 | #define INT_7XX_VLYNQ (9 + IH2_BASE) | ||
201 | #define INT_7XX_GPIO_BANK4 (10 + IH2_BASE) | ||
202 | #define INT_7XX_McBSP1TX (11 + IH2_BASE) | ||
203 | #define INT_7XX_McBSP1RX (12 + IH2_BASE) | ||
204 | #define INT_7XX_McBSP1RX_OF (13 + IH2_BASE) | ||
205 | #define INT_7XX_UART_MODEM_IRDA_2 (14 + IH2_BASE) | ||
206 | #define INT_7XX_UART_MODEM_1 (15 + IH2_BASE) | ||
207 | #define INT_7XX_MCSI (16 + IH2_BASE) | ||
208 | #define INT_7XX_uWireTX (17 + IH2_BASE) | ||
209 | #define INT_7XX_uWireRX (18 + IH2_BASE) | ||
210 | #define INT_7XX_SMC_CD (19 + IH2_BASE) | ||
211 | #define INT_7XX_SMC_IREQ (20 + IH2_BASE) | ||
212 | #define INT_7XX_HDQ_1WIRE (21 + IH2_BASE) | ||
213 | #define INT_7XX_TIMER32K (22 + IH2_BASE) | ||
214 | #define INT_7XX_MMC_SDIO (23 + IH2_BASE) | ||
215 | #define INT_7XX_UPLD (24 + IH2_BASE) | ||
216 | #define INT_7XX_USB_HHC_1 (27 + IH2_BASE) | ||
217 | #define INT_7XX_USB_HHC_2 (28 + IH2_BASE) | ||
218 | #define INT_7XX_USB_GENI (29 + IH2_BASE) | ||
219 | #define INT_7XX_USB_OTG (30 + IH2_BASE) | ||
220 | #define INT_7XX_CAMERA_IF (31 + IH2_BASE) | ||
221 | #define INT_7XX_RNG (32 + IH2_BASE) | ||
222 | #define INT_7XX_DUAL_MODE_TIMER (33 + IH2_BASE) | ||
223 | #define INT_7XX_DBB_RF_EN (34 + IH2_BASE) | ||
224 | #define INT_7XX_MPUIO_KEYPAD (35 + IH2_BASE) | ||
225 | #define INT_7XX_SHA1_MD5 (36 + IH2_BASE) | ||
226 | #define INT_7XX_SPI_100K_2 (37 + IH2_BASE) | ||
227 | #define INT_7XX_RNG_IDLE (38 + IH2_BASE) | ||
228 | #define INT_7XX_MPUIO (39 + IH2_BASE) | ||
229 | #define INT_7XX_LLPC_LCD_CTRL_CAN_BE_OFF (40 + IH2_BASE) | ||
230 | #define INT_7XX_LLPC_OE_FALLING (41 + IH2_BASE) | ||
231 | #define INT_7XX_LLPC_OE_RISING (42 + IH2_BASE) | ||
232 | #define INT_7XX_LLPC_VSYNC (43 + IH2_BASE) | ||
233 | #define INT_7XX_WAKE_UP_REQ (46 + IH2_BASE) | ||
234 | #define INT_7XX_DMA_CH6 (53 + IH2_BASE) | ||
235 | #define INT_7XX_DMA_CH7 (54 + IH2_BASE) | ||
236 | #define INT_7XX_DMA_CH8 (55 + IH2_BASE) | ||
237 | #define INT_7XX_DMA_CH9 (56 + IH2_BASE) | ||
238 | #define INT_7XX_DMA_CH10 (57 + IH2_BASE) | ||
239 | #define INT_7XX_DMA_CH11 (58 + IH2_BASE) | ||
240 | #define INT_7XX_DMA_CH12 (59 + IH2_BASE) | ||
241 | #define INT_7XX_DMA_CH13 (60 + IH2_BASE) | ||
242 | #define INT_7XX_DMA_CH14 (61 + IH2_BASE) | ||
243 | #define INT_7XX_DMA_CH15 (62 + IH2_BASE) | ||
244 | #define INT_7XX_NAND (63 + IH2_BASE) | ||
245 | |||
246 | #define INT_24XX_SYS_NIRQ 7 | ||
247 | #define INT_24XX_SDMA_IRQ0 12 | ||
248 | #define INT_24XX_SDMA_IRQ1 13 | ||
249 | #define INT_24XX_SDMA_IRQ2 14 | ||
250 | #define INT_24XX_SDMA_IRQ3 15 | ||
251 | #define INT_24XX_CAM_IRQ 24 | ||
252 | #define INT_24XX_DSS_IRQ 25 | ||
253 | #define INT_24XX_MAIL_U0_MPU 26 | ||
254 | #define INT_24XX_DSP_UMA 27 | ||
255 | #define INT_24XX_DSP_MMU 28 | ||
256 | #define INT_24XX_GPIO_BANK1 29 | ||
257 | #define INT_24XX_GPIO_BANK2 30 | ||
258 | #define INT_24XX_GPIO_BANK3 31 | ||
259 | #define INT_24XX_GPIO_BANK4 32 | ||
260 | #define INT_24XX_GPIO_BANK5 33 | ||
261 | #define INT_24XX_MAIL_U3_MPU 34 | ||
262 | #define INT_24XX_GPTIMER1 37 | ||
263 | #define INT_24XX_GPTIMER2 38 | ||
264 | #define INT_24XX_GPTIMER3 39 | ||
265 | #define INT_24XX_GPTIMER4 40 | ||
266 | #define INT_24XX_GPTIMER5 41 | ||
267 | #define INT_24XX_GPTIMER6 42 | ||
268 | #define INT_24XX_GPTIMER7 43 | ||
269 | #define INT_24XX_GPTIMER8 44 | ||
270 | #define INT_24XX_GPTIMER9 45 | ||
271 | #define INT_24XX_GPTIMER10 46 | ||
272 | #define INT_24XX_GPTIMER11 47 | ||
273 | #define INT_24XX_GPTIMER12 48 | ||
274 | #define INT_24XX_SHA1MD5 51 | ||
275 | #define INT_24XX_MCBSP4_IRQ_TX 54 | ||
276 | #define INT_24XX_MCBSP4_IRQ_RX 55 | ||
277 | #define INT_24XX_I2C1_IRQ 56 | ||
278 | #define INT_24XX_I2C2_IRQ 57 | ||
279 | #define INT_24XX_HDQ_IRQ 58 | ||
280 | #define INT_24XX_MCBSP1_IRQ_TX 59 | ||
281 | #define INT_24XX_MCBSP1_IRQ_RX 60 | ||
282 | #define INT_24XX_MCBSP2_IRQ_TX 62 | ||
283 | #define INT_24XX_MCBSP2_IRQ_RX 63 | ||
284 | #define INT_24XX_SPI1_IRQ 65 | ||
285 | #define INT_24XX_SPI2_IRQ 66 | ||
286 | #define INT_24XX_UART1_IRQ 72 | ||
287 | #define INT_24XX_UART2_IRQ 73 | ||
288 | #define INT_24XX_UART3_IRQ 74 | ||
289 | #define INT_24XX_USB_IRQ_GEN 75 | ||
290 | #define INT_24XX_USB_IRQ_NISO 76 | ||
291 | #define INT_24XX_USB_IRQ_ISO 77 | ||
292 | #define INT_24XX_USB_IRQ_HGEN 78 | ||
293 | #define INT_24XX_USB_IRQ_HSOF 79 | ||
294 | #define INT_24XX_USB_IRQ_OTG 80 | ||
295 | #define INT_24XX_MCBSP5_IRQ_TX 81 | ||
296 | #define INT_24XX_MCBSP5_IRQ_RX 82 | ||
297 | #define INT_24XX_MMC_IRQ 83 | ||
298 | #define INT_24XX_MMC2_IRQ 86 | ||
299 | #define INT_24XX_MCBSP3_IRQ_TX 89 | ||
300 | #define INT_24XX_MCBSP3_IRQ_RX 90 | ||
301 | #define INT_24XX_SPI3_IRQ 91 | ||
302 | |||
303 | #define INT_243X_MCBSP2_IRQ 16 | ||
304 | #define INT_243X_MCBSP3_IRQ 17 | ||
305 | #define INT_243X_MCBSP4_IRQ 18 | ||
306 | #define INT_243X_MCBSP5_IRQ 19 | ||
307 | #define INT_243X_MCBSP1_IRQ 64 | ||
308 | #define INT_243X_HS_USB_MC 92 | ||
309 | #define INT_243X_HS_USB_DMA 93 | ||
310 | #define INT_243X_CARKIT_IRQ 94 | ||
311 | |||
312 | #define INT_34XX_BENCH_MPU_EMUL 3 | ||
313 | #define INT_34XX_ST_MCBSP2_IRQ 4 | ||
314 | #define INT_34XX_ST_MCBSP3_IRQ 5 | ||
315 | #define INT_34XX_SSM_ABORT_IRQ 6 | ||
316 | #define INT_34XX_SYS_NIRQ 7 | ||
317 | #define INT_34XX_D2D_FW_IRQ 8 | ||
318 | #define INT_34XX_L3_DBG_IRQ 9 | ||
319 | #define INT_34XX_L3_APP_IRQ 10 | ||
320 | #define INT_34XX_PRCM_MPU_IRQ 11 | ||
321 | #define INT_34XX_MCBSP1_IRQ 16 | ||
322 | #define INT_34XX_MCBSP2_IRQ 17 | ||
323 | #define INT_34XX_GPMC_IRQ 20 | ||
324 | #define INT_34XX_MCBSP3_IRQ 22 | ||
325 | #define INT_34XX_MCBSP4_IRQ 23 | ||
326 | #define INT_34XX_CAM_IRQ 24 | ||
327 | #define INT_34XX_MCBSP5_IRQ 27 | ||
328 | #define INT_34XX_GPIO_BANK1 29 | ||
329 | #define INT_34XX_GPIO_BANK2 30 | ||
330 | #define INT_34XX_GPIO_BANK3 31 | ||
331 | #define INT_34XX_GPIO_BANK4 32 | ||
332 | #define INT_34XX_GPIO_BANK5 33 | ||
333 | #define INT_34XX_GPIO_BANK6 34 | ||
334 | #define INT_34XX_USIM_IRQ 35 | ||
335 | #define INT_34XX_WDT3_IRQ 36 | ||
336 | #define INT_34XX_SPI4_IRQ 48 | ||
337 | #define INT_34XX_SHA1MD52_IRQ 49 | ||
338 | #define INT_34XX_FPKA_READY_IRQ 50 | ||
339 | #define INT_34XX_SHA1MD51_IRQ 51 | ||
340 | #define INT_34XX_RNG_IRQ 52 | ||
341 | #define INT_34XX_I2C3_IRQ 61 | ||
342 | #define INT_34XX_FPKA_ERROR_IRQ 64 | ||
343 | #define INT_34XX_PBIAS_IRQ 75 | ||
344 | #define INT_34XX_OHCI_IRQ 76 | ||
345 | #define INT_34XX_EHCI_IRQ 77 | ||
346 | #define INT_34XX_TLL_IRQ 78 | ||
347 | #define INT_34XX_PARTHASH_IRQ 79 | ||
348 | #define INT_34XX_MMC3_IRQ 94 | ||
349 | #define INT_34XX_GPT12_IRQ 95 | ||
350 | |||
351 | #define INT_36XX_UART4_IRQ 80 | ||
352 | |||
353 | #define INT_35XX_HECC0_IRQ 24 | ||
354 | #define INT_35XX_HECC1_IRQ 28 | ||
355 | #define INT_35XX_EMAC_C0_RXTHRESH_IRQ 67 | ||
356 | #define INT_35XX_EMAC_C0_RX_PULSE_IRQ 68 | ||
357 | #define INT_35XX_EMAC_C0_TX_PULSE_IRQ 69 | ||
358 | #define INT_35XX_EMAC_C0_MISC_PULSE_IRQ 70 | ||
359 | #define INT_35XX_USBOTG_IRQ 71 | ||
360 | #define INT_35XX_UART4 84 | ||
361 | #define INT_35XX_CCDC_VD0_IRQ 88 | ||
362 | #define INT_35XX_CCDC_VD1_IRQ 92 | ||
363 | #define INT_35XX_CCDC_VD2_IRQ 93 | ||
364 | |||
365 | /* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730/850) and | ||
366 | * 16 MPUIO lines */ | ||
367 | #define OMAP_MAX_GPIO_LINES 192 | ||
368 | #define IH_GPIO_BASE (128 + IH2_BASE) | ||
369 | #define IH_MPUIO_BASE (OMAP_MAX_GPIO_LINES + IH_GPIO_BASE) | ||
370 | #define OMAP_IRQ_END (IH_MPUIO_BASE + 16) | ||
371 | |||
372 | /* External FPGA handles interrupts on Innovator boards */ | ||
373 | #define OMAP_FPGA_IRQ_BASE (OMAP_IRQ_END) | ||
374 | #ifdef CONFIG_MACH_OMAP_INNOVATOR | ||
375 | #define OMAP_FPGA_NR_IRQS 24 | ||
376 | #else | ||
377 | #define OMAP_FPGA_NR_IRQS 0 | ||
378 | #endif | ||
379 | #define OMAP_FPGA_IRQ_END (OMAP_FPGA_IRQ_BASE + OMAP_FPGA_NR_IRQS) | ||
380 | |||
381 | /* External TWL4030 can handle interrupts on 2430 and 34xx boards */ | ||
382 | #define TWL4030_IRQ_BASE (OMAP_FPGA_IRQ_END) | ||
383 | #ifdef CONFIG_TWL4030_CORE | ||
384 | #define TWL4030_BASE_NR_IRQS 8 | ||
385 | #define TWL4030_PWR_NR_IRQS 8 | ||
386 | #else | ||
387 | #define TWL4030_BASE_NR_IRQS 0 | ||
388 | #define TWL4030_PWR_NR_IRQS 0 | ||
389 | #endif | ||
390 | #define TWL4030_IRQ_END (TWL4030_IRQ_BASE + TWL4030_BASE_NR_IRQS) | ||
391 | #define TWL4030_PWR_IRQ_BASE TWL4030_IRQ_END | ||
392 | #define TWL4030_PWR_IRQ_END (TWL4030_PWR_IRQ_BASE + TWL4030_PWR_NR_IRQS) | ||
393 | |||
394 | /* External TWL4030 gpio interrupts are optional */ | ||
395 | #define TWL4030_GPIO_IRQ_BASE TWL4030_PWR_IRQ_END | ||
396 | #ifdef CONFIG_GPIO_TWL4030 | ||
397 | #define TWL4030_GPIO_NR_IRQS 18 | ||
398 | #else | ||
399 | #define TWL4030_GPIO_NR_IRQS 0 | ||
400 | #endif | ||
401 | #define TWL4030_GPIO_IRQ_END (TWL4030_GPIO_IRQ_BASE + TWL4030_GPIO_NR_IRQS) | ||
402 | |||
403 | #define TWL6030_IRQ_BASE (OMAP_FPGA_IRQ_END) | ||
404 | #ifdef CONFIG_TWL4030_CORE | ||
405 | #define TWL6030_BASE_NR_IRQS 20 | ||
406 | #else | ||
407 | #define TWL6030_BASE_NR_IRQS 0 | ||
408 | #endif | ||
409 | #define TWL6030_IRQ_END (TWL6030_IRQ_BASE + TWL6030_BASE_NR_IRQS) | ||
410 | |||
411 | #define TWL6040_CODEC_IRQ_BASE TWL6030_IRQ_END | ||
412 | #ifdef CONFIG_TWL6040_CODEC | ||
413 | #define TWL6040_CODEC_NR_IRQS 6 | ||
414 | #else | ||
415 | #define TWL6040_CODEC_NR_IRQS 0 | ||
416 | #endif | ||
417 | #define TWL6040_CODEC_IRQ_END (TWL6040_CODEC_IRQ_BASE + TWL6040_CODEC_NR_IRQS) | ||
418 | |||
419 | /* Total number of interrupts depends on the enabled blocks above */ | ||
420 | #if (TWL4030_GPIO_IRQ_END > TWL6040_CODEC_IRQ_END) | ||
421 | #define TWL_IRQ_END TWL4030_GPIO_IRQ_END | ||
422 | #else | ||
423 | #define TWL_IRQ_END TWL6040_CODEC_IRQ_END | ||
424 | #endif | ||
425 | |||
426 | /* GPMC related */ | ||
427 | #define OMAP_GPMC_IRQ_BASE (TWL_IRQ_END) | ||
428 | #define OMAP_GPMC_NR_IRQS 8 | ||
429 | #define OMAP_GPMC_IRQ_END (OMAP_GPMC_IRQ_BASE + OMAP_GPMC_NR_IRQS) | ||
430 | |||
431 | |||
432 | #define NR_IRQS OMAP_GPMC_IRQ_END | ||
433 | |||
434 | #define OMAP_IRQ_BIT(irq) (1 << ((irq) % 32)) | ||
435 | |||
436 | #define INTCPS_NR_MIR_REGS 3 | ||
437 | #define INTCPS_NR_IRQS 96 | ||
438 | |||
439 | #ifndef __ASSEMBLY__ | ||
440 | extern void __iomem *omap_irq_base; | ||
441 | void omap1_init_irq(void); | ||
442 | void omap2_init_irq(void); | ||
443 | void omap3_init_irq(void); | ||
444 | void ti816x_init_irq(void); | ||
445 | extern int omap_irq_pending(void); | ||
446 | void omap_intc_save_context(void); | ||
447 | void omap_intc_restore_context(void); | ||
448 | void omap3_intc_suspend(void); | ||
449 | void omap3_intc_prepare_idle(void); | ||
450 | void omap3_intc_resume_idle(void); | ||
451 | #endif | ||
452 | |||
453 | #include <mach/hardware.h> | ||
454 | |||
455 | #ifdef CONFIG_FIQ | ||
456 | #define FIQ_START 1024 | ||
457 | #endif | ||
458 | |||
459 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/keypad.h b/arch/arm/plat-omap/include/plat/keypad.h new file mode 100644 index 00000000000..793ce9d5329 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/keypad.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/keypad.h | ||
3 | * | ||
4 | * Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef ASMARM_ARCH_KEYPAD_H | ||
11 | #define ASMARM_ARCH_KEYPAD_H | ||
12 | |||
13 | #ifndef CONFIG_ARCH_OMAP1 | ||
14 | #warning Please update the board to use matrix-keypad driver | ||
15 | #endif | ||
16 | #include <linux/input/matrix_keypad.h> | ||
17 | |||
18 | struct omap_kp_platform_data { | ||
19 | int rows; | ||
20 | int cols; | ||
21 | const struct matrix_keymap_data *keymap_data; | ||
22 | bool rep; | ||
23 | unsigned long delay; | ||
24 | bool dbounce; | ||
25 | /* specific to OMAP242x*/ | ||
26 | unsigned int *row_gpios; | ||
27 | unsigned int *col_gpios; | ||
28 | }; | ||
29 | |||
30 | /* Group (0..3) -- when multiple keys are pressed, only the | ||
31 | * keys pressed in the same group are considered as pressed. This is | ||
32 | * in order to workaround certain crappy HW designs that produce ghost | ||
33 | * keypresses. Two free bits, not used by neither row/col nor keynum, | ||
34 | * must be available for use as group bits. The below GROUP_SHIFT | ||
35 | * macro definition is based on some prior knowledge of the | ||
36 | * matrix_keypad defined KEY() macro internals. | ||
37 | */ | ||
38 | #define GROUP_SHIFT 14 | ||
39 | #define GROUP_0 (0 << GROUP_SHIFT) | ||
40 | #define GROUP_1 (1 << GROUP_SHIFT) | ||
41 | #define GROUP_2 (2 << GROUP_SHIFT) | ||
42 | #define GROUP_3 (3 << GROUP_SHIFT) | ||
43 | #define GROUP_MASK GROUP_3 | ||
44 | #if KEY_MAX & GROUP_MASK | ||
45 | #error Group bits in conflict with keynum bits | ||
46 | #endif | ||
47 | |||
48 | |||
49 | #endif | ||
50 | |||
diff --git a/arch/arm/plat-omap/include/plat/l3_2xxx.h b/arch/arm/plat-omap/include/plat/l3_2xxx.h new file mode 100644 index 00000000000..b8b5641379b --- /dev/null +++ b/arch/arm/plat-omap/include/plat/l3_2xxx.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/plat/l3_2xxx.h - L3 firewall definitions | ||
3 | * | ||
4 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ | ||
5 | * Sumit Semwal | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | */ | ||
13 | #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_L3_2XXX_H | ||
14 | #define __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_L3_2XXX_H | ||
15 | |||
16 | /* L3 CONNIDs */ | ||
17 | /* Display Sub system (DSS) */ | ||
18 | #define OMAP2_L3_CORE_FW_CONNID_DSS 8 | ||
19 | |||
20 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/l3_3xxx.h b/arch/arm/plat-omap/include/plat/l3_3xxx.h new file mode 100644 index 00000000000..cde1938c5f8 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/l3_3xxx.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/plat/l3_3xxx.h - L3 firewall definitions | ||
3 | * | ||
4 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ | ||
5 | * Sumit Semwal | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | */ | ||
13 | #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_L3_3XXX_H | ||
14 | #define __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_L3_3XXX_H | ||
15 | |||
16 | /* L3 Initiator IDs */ | ||
17 | /* Display Sub system (DSS) */ | ||
18 | #define OMAP3_L3_CORE_FW_INIT_ID_DSS 29 | ||
19 | |||
20 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/l4_2xxx.h b/arch/arm/plat-omap/include/plat/l4_2xxx.h new file mode 100644 index 00000000000..3f39cf8a35c --- /dev/null +++ b/arch/arm/plat-omap/include/plat/l4_2xxx.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/plat/l4_2xxx.h - L4 firewall definitions | ||
3 | * | ||
4 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ | ||
5 | * Sumit Semwal | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | */ | ||
13 | #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_L4_2XXX_H | ||
14 | #define __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_L4_2XXX_H | ||
15 | |||
16 | /* L4 CORE */ | ||
17 | /* Display Sub system (DSS) */ | ||
18 | #define OMAP2420_L4_CORE_FW_DSS_CORE_REGION 28 | ||
19 | #define OMAP2420_L4_CORE_FW_DSS_DISPC_REGION 29 | ||
20 | #define OMAP2420_L4_CORE_FW_DSS_RFBI_REGION 30 | ||
21 | #define OMAP2420_L4_CORE_FW_DSS_VENC_REGION 31 | ||
22 | #define OMAP2420_L4_CORE_FW_DSS_TA_REGION 32 | ||
23 | |||
24 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/l4_3xxx.h b/arch/arm/plat-omap/include/plat/l4_3xxx.h new file mode 100644 index 00000000000..881a858b1ff --- /dev/null +++ b/arch/arm/plat-omap/include/plat/l4_3xxx.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/l4_3xxx.h - L4 firewall definitions | ||
3 | * | ||
4 | * Copyright (C) 2009 Nokia Corporation | ||
5 | * Paul Walmsley | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | */ | ||
13 | #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_L4_3XXX_H | ||
14 | #define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_L4_3XXX_H | ||
15 | |||
16 | /* L4 CORE */ | ||
17 | #define OMAP3_L4_CORE_FW_I2C1_REGION 21 | ||
18 | #define OMAP3_L4_CORE_FW_I2C1_TA_REGION 22 | ||
19 | #define OMAP3_L4_CORE_FW_I2C2_REGION 23 | ||
20 | #define OMAP3_L4_CORE_FW_I2C2_TA_REGION 24 | ||
21 | #define OMAP3_L4_CORE_FW_I2C3_REGION 73 | ||
22 | #define OMAP3_L4_CORE_FW_I2C3_TA_REGION 74 | ||
23 | |||
24 | /* Display Sub system (DSS) */ | ||
25 | #define OMAP3_L4_CORE_FW_DSS_PROT_GROUP 2 | ||
26 | |||
27 | #define OMAP3_L4_CORE_FW_DSS_DSI_REGION 104 | ||
28 | #define OMAP3ES1_L4_CORE_FW_DSS_CORE_REGION 3 | ||
29 | #define OMAP3_L4_CORE_FW_DSS_CORE_REGION 4 | ||
30 | #define OMAP3_L4_CORE_FW_DSS_DISPC_REGION 4 | ||
31 | #define OMAP3_L4_CORE_FW_DSS_RFBI_REGION 5 | ||
32 | #define OMAP3_L4_CORE_FW_DSS_VENC_REGION 6 | ||
33 | #define OMAP3_L4_CORE_FW_DSS_TA_REGION 7 | ||
34 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/lcd_mipid.h b/arch/arm/plat-omap/include/plat/lcd_mipid.h new file mode 100644 index 00000000000..8e52c657228 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/lcd_mipid.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef __LCD_MIPID_H | ||
2 | #define __LCD_MIPID_H | ||
3 | |||
4 | enum mipid_test_num { | ||
5 | MIPID_TEST_RGB_LINES, | ||
6 | }; | ||
7 | |||
8 | enum mipid_test_result { | ||
9 | MIPID_TEST_SUCCESS, | ||
10 | MIPID_TEST_INVALID, | ||
11 | MIPID_TEST_FAILED, | ||
12 | }; | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | struct mipid_platform_data { | ||
17 | int nreset_gpio; | ||
18 | int data_lines; | ||
19 | |||
20 | void (*shutdown)(struct mipid_platform_data *pdata); | ||
21 | void (*set_bklight_level)(struct mipid_platform_data *pdata, | ||
22 | int level); | ||
23 | int (*get_bklight_level)(struct mipid_platform_data *pdata); | ||
24 | int (*get_bklight_max)(struct mipid_platform_data *pdata); | ||
25 | }; | ||
26 | |||
27 | #endif | ||
28 | |||
29 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/led.h b/arch/arm/plat-omap/include/plat/led.h new file mode 100644 index 00000000000..25e451e7e2f --- /dev/null +++ b/arch/arm/plat-omap/include/plat/led.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/led.h | ||
3 | * | ||
4 | * Copyright (C) 2006 Samsung Electronics | ||
5 | * Kyungmin Park <kyungmin.park@samsung.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #ifndef ASMARM_ARCH_LED_H | ||
12 | #define ASMARM_ARCH_LED_H | ||
13 | |||
14 | struct omap_led_config { | ||
15 | struct led_classdev cdev; | ||
16 | s16 gpio; | ||
17 | }; | ||
18 | |||
19 | struct omap_led_platform_data { | ||
20 | s16 nr_leds; | ||
21 | struct omap_led_config *leds; | ||
22 | }; | ||
23 | |||
24 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h new file mode 100644 index 00000000000..9882c657b2d --- /dev/null +++ b/arch/arm/plat-omap/include/plat/mcbsp.h | |||
@@ -0,0 +1,473 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/mcbsp.h | ||
3 | * | ||
4 | * Defines for Multi-Channel Buffered Serial Port | ||
5 | * | ||
6 | * Copyright (C) 2002 RidgeRun, Inc. | ||
7 | * Author: Steve Johnson | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | * | ||
23 | */ | ||
24 | #ifndef __ASM_ARCH_OMAP_MCBSP_H | ||
25 | #define __ASM_ARCH_OMAP_MCBSP_H | ||
26 | |||
27 | #include <linux/spinlock.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <plat/clock.h> | ||
31 | |||
32 | /* macro for building platform_device for McBSP ports */ | ||
33 | #define OMAP_MCBSP_PLATFORM_DEVICE(port_nr) \ | ||
34 | static struct platform_device omap_mcbsp##port_nr = { \ | ||
35 | .name = "omap-mcbsp-dai", \ | ||
36 | .id = port_nr - 1, \ | ||
37 | } | ||
38 | |||
39 | #define MCBSP_CONFIG_TYPE2 0x2 | ||
40 | #define MCBSP_CONFIG_TYPE3 0x3 | ||
41 | #define MCBSP_CONFIG_TYPE4 0x4 | ||
42 | |||
43 | #define OMAP7XX_MCBSP1_BASE 0xfffb1000 | ||
44 | #define OMAP7XX_MCBSP2_BASE 0xfffb1800 | ||
45 | |||
46 | #define OMAP1510_MCBSP1_BASE 0xe1011800 | ||
47 | #define OMAP1510_MCBSP2_BASE 0xfffb1000 | ||
48 | #define OMAP1510_MCBSP3_BASE 0xe1017000 | ||
49 | |||
50 | #define OMAP1610_MCBSP1_BASE 0xe1011800 | ||
51 | #define OMAP1610_MCBSP2_BASE 0xfffb1000 | ||
52 | #define OMAP1610_MCBSP3_BASE 0xe1017000 | ||
53 | |||
54 | #ifdef CONFIG_ARCH_OMAP1 | ||
55 | |||
56 | #define OMAP_MCBSP_REG_DRR2 0x00 | ||
57 | #define OMAP_MCBSP_REG_DRR1 0x02 | ||
58 | #define OMAP_MCBSP_REG_DXR2 0x04 | ||
59 | #define OMAP_MCBSP_REG_DXR1 0x06 | ||
60 | #define OMAP_MCBSP_REG_DRR 0x02 | ||
61 | #define OMAP_MCBSP_REG_DXR 0x06 | ||
62 | #define OMAP_MCBSP_REG_SPCR2 0x08 | ||
63 | #define OMAP_MCBSP_REG_SPCR1 0x0a | ||
64 | #define OMAP_MCBSP_REG_RCR2 0x0c | ||
65 | #define OMAP_MCBSP_REG_RCR1 0x0e | ||
66 | #define OMAP_MCBSP_REG_XCR2 0x10 | ||
67 | #define OMAP_MCBSP_REG_XCR1 0x12 | ||
68 | #define OMAP_MCBSP_REG_SRGR2 0x14 | ||
69 | #define OMAP_MCBSP_REG_SRGR1 0x16 | ||
70 | #define OMAP_MCBSP_REG_MCR2 0x18 | ||
71 | #define OMAP_MCBSP_REG_MCR1 0x1a | ||
72 | #define OMAP_MCBSP_REG_RCERA 0x1c | ||
73 | #define OMAP_MCBSP_REG_RCERB 0x1e | ||
74 | #define OMAP_MCBSP_REG_XCERA 0x20 | ||
75 | #define OMAP_MCBSP_REG_XCERB 0x22 | ||
76 | #define OMAP_MCBSP_REG_PCR0 0x24 | ||
77 | #define OMAP_MCBSP_REG_RCERC 0x26 | ||
78 | #define OMAP_MCBSP_REG_RCERD 0x28 | ||
79 | #define OMAP_MCBSP_REG_XCERC 0x2A | ||
80 | #define OMAP_MCBSP_REG_XCERD 0x2C | ||
81 | #define OMAP_MCBSP_REG_RCERE 0x2E | ||
82 | #define OMAP_MCBSP_REG_RCERF 0x30 | ||
83 | #define OMAP_MCBSP_REG_XCERE 0x32 | ||
84 | #define OMAP_MCBSP_REG_XCERF 0x34 | ||
85 | #define OMAP_MCBSP_REG_RCERG 0x36 | ||
86 | #define OMAP_MCBSP_REG_RCERH 0x38 | ||
87 | #define OMAP_MCBSP_REG_XCERG 0x3A | ||
88 | #define OMAP_MCBSP_REG_XCERH 0x3C | ||
89 | |||
90 | /* Dummy defines, these are not available on omap1 */ | ||
91 | #define OMAP_MCBSP_REG_XCCR 0x00 | ||
92 | #define OMAP_MCBSP_REG_RCCR 0x00 | ||
93 | |||
94 | #else | ||
95 | |||
96 | #define OMAP_MCBSP_REG_DRR2 0x00 | ||
97 | #define OMAP_MCBSP_REG_DRR1 0x04 | ||
98 | #define OMAP_MCBSP_REG_DXR2 0x08 | ||
99 | #define OMAP_MCBSP_REG_DXR1 0x0C | ||
100 | #define OMAP_MCBSP_REG_DRR 0x00 | ||
101 | #define OMAP_MCBSP_REG_DXR 0x08 | ||
102 | #define OMAP_MCBSP_REG_SPCR2 0x10 | ||
103 | #define OMAP_MCBSP_REG_SPCR1 0x14 | ||
104 | #define OMAP_MCBSP_REG_RCR2 0x18 | ||
105 | #define OMAP_MCBSP_REG_RCR1 0x1C | ||
106 | #define OMAP_MCBSP_REG_XCR2 0x20 | ||
107 | #define OMAP_MCBSP_REG_XCR1 0x24 | ||
108 | #define OMAP_MCBSP_REG_SRGR2 0x28 | ||
109 | #define OMAP_MCBSP_REG_SRGR1 0x2C | ||
110 | #define OMAP_MCBSP_REG_MCR2 0x30 | ||
111 | #define OMAP_MCBSP_REG_MCR1 0x34 | ||
112 | #define OMAP_MCBSP_REG_RCERA 0x38 | ||
113 | #define OMAP_MCBSP_REG_RCERB 0x3C | ||
114 | #define OMAP_MCBSP_REG_XCERA 0x40 | ||
115 | #define OMAP_MCBSP_REG_XCERB 0x44 | ||
116 | #define OMAP_MCBSP_REG_PCR0 0x48 | ||
117 | #define OMAP_MCBSP_REG_RCERC 0x4C | ||
118 | #define OMAP_MCBSP_REG_RCERD 0x50 | ||
119 | #define OMAP_MCBSP_REG_XCERC 0x54 | ||
120 | #define OMAP_MCBSP_REG_XCERD 0x58 | ||
121 | #define OMAP_MCBSP_REG_RCERE 0x5C | ||
122 | #define OMAP_MCBSP_REG_RCERF 0x60 | ||
123 | #define OMAP_MCBSP_REG_XCERE 0x64 | ||
124 | #define OMAP_MCBSP_REG_XCERF 0x68 | ||
125 | #define OMAP_MCBSP_REG_RCERG 0x6C | ||
126 | #define OMAP_MCBSP_REG_RCERH 0x70 | ||
127 | #define OMAP_MCBSP_REG_XCERG 0x74 | ||
128 | #define OMAP_MCBSP_REG_XCERH 0x78 | ||
129 | #define OMAP_MCBSP_REG_SYSCON 0x8C | ||
130 | #define OMAP_MCBSP_REG_THRSH2 0x90 | ||
131 | #define OMAP_MCBSP_REG_THRSH1 0x94 | ||
132 | #define OMAP_MCBSP_REG_IRQST 0xA0 | ||
133 | #define OMAP_MCBSP_REG_IRQEN 0xA4 | ||
134 | #define OMAP_MCBSP_REG_WAKEUPEN 0xA8 | ||
135 | #define OMAP_MCBSP_REG_XCCR 0xAC | ||
136 | #define OMAP_MCBSP_REG_RCCR 0xB0 | ||
137 | #define OMAP_MCBSP_REG_XBUFFSTAT 0xB4 | ||
138 | #define OMAP_MCBSP_REG_RBUFFSTAT 0xB8 | ||
139 | #define OMAP_MCBSP_REG_SSELCR 0xBC | ||
140 | |||
141 | #define OMAP_ST_REG_REV 0x00 | ||
142 | #define OMAP_ST_REG_SYSCONFIG 0x10 | ||
143 | #define OMAP_ST_REG_IRQSTATUS 0x18 | ||
144 | #define OMAP_ST_REG_IRQENABLE 0x1C | ||
145 | #define OMAP_ST_REG_SGAINCR 0x24 | ||
146 | #define OMAP_ST_REG_SFIRCR 0x28 | ||
147 | #define OMAP_ST_REG_SSELCR 0x2C | ||
148 | |||
149 | #endif | ||
150 | |||
151 | /************************** McBSP SPCR1 bit definitions ***********************/ | ||
152 | #define RRST 0x0001 | ||
153 | #define RRDY 0x0002 | ||
154 | #define RFULL 0x0004 | ||
155 | #define RSYNC_ERR 0x0008 | ||
156 | #define RINTM(value) ((value)<<4) /* bits 4:5 */ | ||
157 | #define ABIS 0x0040 | ||
158 | #define DXENA 0x0080 | ||
159 | #define CLKSTP(value) ((value)<<11) /* bits 11:12 */ | ||
160 | #define RJUST(value) ((value)<<13) /* bits 13:14 */ | ||
161 | #define ALB 0x8000 | ||
162 | #define DLB 0x8000 | ||
163 | |||
164 | /************************** McBSP SPCR2 bit definitions ***********************/ | ||
165 | #define XRST 0x0001 | ||
166 | #define XRDY 0x0002 | ||
167 | #define XEMPTY 0x0004 | ||
168 | #define XSYNC_ERR 0x0008 | ||
169 | #define XINTM(value) ((value)<<4) /* bits 4:5 */ | ||
170 | #define GRST 0x0040 | ||
171 | #define FRST 0x0080 | ||
172 | #define SOFT 0x0100 | ||
173 | #define FREE 0x0200 | ||
174 | |||
175 | /************************** McBSP PCR bit definitions *************************/ | ||
176 | #define CLKRP 0x0001 | ||
177 | #define CLKXP 0x0002 | ||
178 | #define FSRP 0x0004 | ||
179 | #define FSXP 0x0008 | ||
180 | #define DR_STAT 0x0010 | ||
181 | #define DX_STAT 0x0020 | ||
182 | #define CLKS_STAT 0x0040 | ||
183 | #define SCLKME 0x0080 | ||
184 | #define CLKRM 0x0100 | ||
185 | #define CLKXM 0x0200 | ||
186 | #define FSRM 0x0400 | ||
187 | #define FSXM 0x0800 | ||
188 | #define RIOEN 0x1000 | ||
189 | #define XIOEN 0x2000 | ||
190 | #define IDLE_EN 0x4000 | ||
191 | |||
192 | /************************** McBSP RCR1 bit definitions ************************/ | ||
193 | #define RWDLEN1(value) ((value)<<5) /* Bits 5:7 */ | ||
194 | #define RFRLEN1(value) ((value)<<8) /* Bits 8:14 */ | ||
195 | |||
196 | /************************** McBSP XCR1 bit definitions ************************/ | ||
197 | #define XWDLEN1(value) ((value)<<5) /* Bits 5:7 */ | ||
198 | #define XFRLEN1(value) ((value)<<8) /* Bits 8:14 */ | ||
199 | |||
200 | /*************************** McBSP RCR2 bit definitions ***********************/ | ||
201 | #define RDATDLY(value) (value) /* Bits 0:1 */ | ||
202 | #define RFIG 0x0004 | ||
203 | #define RCOMPAND(value) ((value)<<3) /* Bits 3:4 */ | ||
204 | #define RWDLEN2(value) ((value)<<5) /* Bits 5:7 */ | ||
205 | #define RFRLEN2(value) ((value)<<8) /* Bits 8:14 */ | ||
206 | #define RPHASE 0x8000 | ||
207 | |||
208 | /*************************** McBSP XCR2 bit definitions ***********************/ | ||
209 | #define XDATDLY(value) (value) /* Bits 0:1 */ | ||
210 | #define XFIG 0x0004 | ||
211 | #define XCOMPAND(value) ((value)<<3) /* Bits 3:4 */ | ||
212 | #define XWDLEN2(value) ((value)<<5) /* Bits 5:7 */ | ||
213 | #define XFRLEN2(value) ((value)<<8) /* Bits 8:14 */ | ||
214 | #define XPHASE 0x8000 | ||
215 | |||
216 | /************************* McBSP SRGR1 bit definitions ************************/ | ||
217 | #define CLKGDV(value) (value) /* Bits 0:7 */ | ||
218 | #define FWID(value) ((value)<<8) /* Bits 8:15 */ | ||
219 | |||
220 | /************************* McBSP SRGR2 bit definitions ************************/ | ||
221 | #define FPER(value) (value) /* Bits 0:11 */ | ||
222 | #define FSGM 0x1000 | ||
223 | #define CLKSM 0x2000 | ||
224 | #define CLKSP 0x4000 | ||
225 | #define GSYNC 0x8000 | ||
226 | |||
227 | /************************* McBSP MCR1 bit definitions *************************/ | ||
228 | #define RMCM 0x0001 | ||
229 | #define RCBLK(value) ((value)<<2) /* Bits 2:4 */ | ||
230 | #define RPABLK(value) ((value)<<5) /* Bits 5:6 */ | ||
231 | #define RPBBLK(value) ((value)<<7) /* Bits 7:8 */ | ||
232 | |||
233 | /************************* McBSP MCR2 bit definitions *************************/ | ||
234 | #define XMCM(value) (value) /* Bits 0:1 */ | ||
235 | #define XCBLK(value) ((value)<<2) /* Bits 2:4 */ | ||
236 | #define XPABLK(value) ((value)<<5) /* Bits 5:6 */ | ||
237 | #define XPBBLK(value) ((value)<<7) /* Bits 7:8 */ | ||
238 | |||
239 | /*********************** McBSP XCCR bit definitions *************************/ | ||
240 | #define EXTCLKGATE 0x8000 | ||
241 | #define PPCONNECT 0x4000 | ||
242 | #define DXENDLY(value) ((value)<<12) /* Bits 12:13 */ | ||
243 | #define XFULL_CYCLE 0x0800 | ||
244 | #define DILB 0x0020 | ||
245 | #define XDMAEN 0x0008 | ||
246 | #define XDISABLE 0x0001 | ||
247 | |||
248 | /********************** McBSP RCCR bit definitions *************************/ | ||
249 | #define RFULL_CYCLE 0x0800 | ||
250 | #define RDMAEN 0x0008 | ||
251 | #define RDISABLE 0x0001 | ||
252 | |||
253 | /********************** McBSP SYSCONFIG bit definitions ********************/ | ||
254 | #define CLOCKACTIVITY(value) ((value)<<8) | ||
255 | #define SIDLEMODE(value) ((value)<<3) | ||
256 | #define ENAWAKEUP 0x0004 | ||
257 | #define SOFTRST 0x0002 | ||
258 | |||
259 | /********************** McBSP SSELCR bit definitions ***********************/ | ||
260 | #define SIDETONEEN 0x0400 | ||
261 | |||
262 | /********************** McBSP Sidetone SYSCONFIG bit definitions ***********/ | ||
263 | #define ST_AUTOIDLE 0x0001 | ||
264 | |||
265 | /********************** McBSP Sidetone SGAINCR bit definitions *************/ | ||
266 | #define ST_CH1GAIN(value) ((value<<16)) /* Bits 16:31 */ | ||
267 | #define ST_CH0GAIN(value) (value) /* Bits 0:15 */ | ||
268 | |||
269 | /********************** McBSP Sidetone SFIRCR bit definitions **************/ | ||
270 | #define ST_FIRCOEFF(value) (value) /* Bits 0:15 */ | ||
271 | |||
272 | /********************** McBSP Sidetone SSELCR bit definitions **************/ | ||
273 | #define ST_COEFFWRDONE 0x0004 | ||
274 | #define ST_COEFFWREN 0x0002 | ||
275 | #define ST_SIDETONEEN 0x0001 | ||
276 | |||
277 | /********************** McBSP DMA operating modes **************************/ | ||
278 | #define MCBSP_DMA_MODE_ELEMENT 0 | ||
279 | #define MCBSP_DMA_MODE_THRESHOLD 1 | ||
280 | #define MCBSP_DMA_MODE_FRAME 2 | ||
281 | |||
282 | /********************** McBSP WAKEUPEN bit definitions *********************/ | ||
283 | #define XEMPTYEOFEN 0x4000 | ||
284 | #define XRDYEN 0x0400 | ||
285 | #define XEOFEN 0x0200 | ||
286 | #define XFSXEN 0x0100 | ||
287 | #define XSYNCERREN 0x0080 | ||
288 | #define RRDYEN 0x0008 | ||
289 | #define REOFEN 0x0004 | ||
290 | #define RFSREN 0x0002 | ||
291 | #define RSYNCERREN 0x0001 | ||
292 | |||
293 | /* CLKR signal muxing options */ | ||
294 | #define CLKR_SRC_CLKR 0 | ||
295 | #define CLKR_SRC_CLKX 1 | ||
296 | |||
297 | /* FSR signal muxing options */ | ||
298 | #define FSR_SRC_FSR 0 | ||
299 | #define FSR_SRC_FSX 1 | ||
300 | |||
301 | /* McBSP functional clock sources */ | ||
302 | #define MCBSP_CLKS_PRCM_SRC 0 | ||
303 | #define MCBSP_CLKS_PAD_SRC 1 | ||
304 | |||
305 | /* we don't do multichannel for now */ | ||
306 | struct omap_mcbsp_reg_cfg { | ||
307 | u16 spcr2; | ||
308 | u16 spcr1; | ||
309 | u16 rcr2; | ||
310 | u16 rcr1; | ||
311 | u16 xcr2; | ||
312 | u16 xcr1; | ||
313 | u16 srgr2; | ||
314 | u16 srgr1; | ||
315 | u16 mcr2; | ||
316 | u16 mcr1; | ||
317 | u16 pcr0; | ||
318 | u16 rcerc; | ||
319 | u16 rcerd; | ||
320 | u16 xcerc; | ||
321 | u16 xcerd; | ||
322 | u16 rcere; | ||
323 | u16 rcerf; | ||
324 | u16 xcere; | ||
325 | u16 xcerf; | ||
326 | u16 rcerg; | ||
327 | u16 rcerh; | ||
328 | u16 xcerg; | ||
329 | u16 xcerh; | ||
330 | u16 xccr; | ||
331 | u16 rccr; | ||
332 | }; | ||
333 | |||
334 | typedef enum { | ||
335 | OMAP_MCBSP_WORD_8 = 0, | ||
336 | OMAP_MCBSP_WORD_12, | ||
337 | OMAP_MCBSP_WORD_16, | ||
338 | OMAP_MCBSP_WORD_20, | ||
339 | OMAP_MCBSP_WORD_24, | ||
340 | OMAP_MCBSP_WORD_32, | ||
341 | } omap_mcbsp_word_length; | ||
342 | |||
343 | /* Platform specific configuration */ | ||
344 | struct omap_mcbsp_ops { | ||
345 | void (*request)(unsigned int); | ||
346 | void (*free)(unsigned int); | ||
347 | int (*set_clks_src)(u8, u8); | ||
348 | }; | ||
349 | |||
350 | struct omap_mcbsp_platform_data { | ||
351 | unsigned long phys_base; | ||
352 | u8 dma_rx_sync, dma_tx_sync; | ||
353 | u16 rx_irq, tx_irq; | ||
354 | struct omap_mcbsp_ops *ops; | ||
355 | #ifdef CONFIG_ARCH_OMAP3 | ||
356 | /* Sidetone block for McBSP 2 and 3 */ | ||
357 | unsigned long phys_base_st; | ||
358 | #endif | ||
359 | u16 buffer_size; | ||
360 | unsigned int mcbsp_config_type; | ||
361 | }; | ||
362 | |||
363 | struct omap_mcbsp_st_data { | ||
364 | void __iomem *io_base_st; | ||
365 | bool running; | ||
366 | bool enabled; | ||
367 | s16 taps[128]; /* Sidetone filter coefficients */ | ||
368 | int nr_taps; /* Number of filter coefficients in use */ | ||
369 | s16 ch0gain; | ||
370 | s16 ch1gain; | ||
371 | }; | ||
372 | |||
373 | struct omap_mcbsp { | ||
374 | struct device *dev; | ||
375 | unsigned long phys_base; | ||
376 | unsigned long phys_dma_base; | ||
377 | void __iomem *io_base; | ||
378 | u8 id; | ||
379 | u8 free; | ||
380 | |||
381 | int rx_irq; | ||
382 | int tx_irq; | ||
383 | |||
384 | /* DMA stuff */ | ||
385 | u8 dma_rx_sync; | ||
386 | u8 dma_tx_sync; | ||
387 | |||
388 | /* Protect the field .free, while checking if the mcbsp is in use */ | ||
389 | spinlock_t lock; | ||
390 | struct omap_mcbsp_platform_data *pdata; | ||
391 | struct clk *fclk; | ||
392 | #ifdef CONFIG_ARCH_OMAP3 | ||
393 | struct omap_mcbsp_st_data *st_data; | ||
394 | int dma_op_mode; | ||
395 | u16 max_tx_thres; | ||
396 | u16 max_rx_thres; | ||
397 | #endif | ||
398 | void *reg_cache; | ||
399 | unsigned int mcbsp_config_type; | ||
400 | }; | ||
401 | |||
402 | /** | ||
403 | * omap_mcbsp_dev_attr - OMAP McBSP device attributes for omap_hwmod | ||
404 | * @sidetone: name of the sidetone device | ||
405 | */ | ||
406 | struct omap_mcbsp_dev_attr { | ||
407 | const char *sidetone; | ||
408 | }; | ||
409 | |||
410 | extern struct omap_mcbsp **mcbsp_ptr; | ||
411 | extern int omap_mcbsp_count, omap_mcbsp_cache_size; | ||
412 | |||
413 | #define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count) | ||
414 | #define id_to_mcbsp_ptr(id) mcbsp_ptr[id]; | ||
415 | |||
416 | int omap_mcbsp_init(void); | ||
417 | void omap_mcbsp_register_board_cfg(struct resource *res, int res_count, | ||
418 | struct omap_mcbsp_platform_data *config, int size); | ||
419 | void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config); | ||
420 | #ifdef CONFIG_ARCH_OMAP3 | ||
421 | void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold); | ||
422 | void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold); | ||
423 | u16 omap_mcbsp_get_max_tx_threshold(unsigned int id); | ||
424 | u16 omap_mcbsp_get_max_rx_threshold(unsigned int id); | ||
425 | u16 omap_mcbsp_get_fifo_size(unsigned int id); | ||
426 | u16 omap_mcbsp_get_tx_delay(unsigned int id); | ||
427 | u16 omap_mcbsp_get_rx_delay(unsigned int id); | ||
428 | int omap_mcbsp_get_dma_op_mode(unsigned int id); | ||
429 | #else | ||
430 | static inline void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold) | ||
431 | { } | ||
432 | static inline void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold) | ||
433 | { } | ||
434 | static inline u16 omap_mcbsp_get_max_tx_threshold(unsigned int id) { return 0; } | ||
435 | static inline u16 omap_mcbsp_get_max_rx_threshold(unsigned int id) { return 0; } | ||
436 | static inline u16 omap_mcbsp_get_fifo_size(unsigned int id) { return 0; } | ||
437 | static inline u16 omap_mcbsp_get_tx_delay(unsigned int id) { return 0; } | ||
438 | static inline u16 omap_mcbsp_get_rx_delay(unsigned int id) { return 0; } | ||
439 | static inline int omap_mcbsp_get_dma_op_mode(unsigned int id) { return 0; } | ||
440 | #endif | ||
441 | int omap_mcbsp_request(unsigned int id); | ||
442 | void omap_mcbsp_free(unsigned int id); | ||
443 | void omap_mcbsp_start(unsigned int id, int tx, int rx); | ||
444 | void omap_mcbsp_stop(unsigned int id, int tx, int rx); | ||
445 | |||
446 | /* McBSP functional clock source changing function */ | ||
447 | extern int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id); | ||
448 | |||
449 | /* McBSP signal muxing API */ | ||
450 | void omap2_mcbsp1_mux_clkr_src(u8 mux); | ||
451 | void omap2_mcbsp1_mux_fsr_src(u8 mux); | ||
452 | |||
453 | int omap_mcbsp_dma_ch_params(unsigned int id, unsigned int stream); | ||
454 | int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream); | ||
455 | |||
456 | #ifdef CONFIG_ARCH_OMAP3 | ||
457 | /* Sidetone specific API */ | ||
458 | int omap_st_set_chgain(unsigned int id, int channel, s16 chgain); | ||
459 | int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain); | ||
460 | int omap_st_enable(unsigned int id); | ||
461 | int omap_st_disable(unsigned int id); | ||
462 | int omap_st_is_enabled(unsigned int id); | ||
463 | #else | ||
464 | static inline int omap_st_set_chgain(unsigned int id, int channel, | ||
465 | s16 chgain) { return 0; } | ||
466 | static inline int omap_st_get_chgain(unsigned int id, int channel, | ||
467 | s16 *chgain) { return 0; } | ||
468 | static inline int omap_st_enable(unsigned int id) { return 0; } | ||
469 | static inline int omap_st_disable(unsigned int id) { return 0; } | ||
470 | static inline int omap_st_is_enabled(unsigned int id) { return 0; } | ||
471 | #endif | ||
472 | |||
473 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/mcspi.h b/arch/arm/plat-omap/include/plat/mcspi.h new file mode 100644 index 00000000000..3d51b18131c --- /dev/null +++ b/arch/arm/plat-omap/include/plat/mcspi.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef _OMAP2_MCSPI_H | ||
2 | #define _OMAP2_MCSPI_H | ||
3 | |||
4 | #define OMAP2_MCSPI_REV 0 | ||
5 | #define OMAP3_MCSPI_REV 1 | ||
6 | #define OMAP4_MCSPI_REV 2 | ||
7 | |||
8 | #define OMAP4_MCSPI_REG_OFFSET 0x100 | ||
9 | |||
10 | struct omap2_mcspi_platform_config { | ||
11 | unsigned short num_cs; | ||
12 | unsigned int regs_offset; | ||
13 | }; | ||
14 | |||
15 | struct omap2_mcspi_dev_attr { | ||
16 | unsigned short num_chipselect; | ||
17 | }; | ||
18 | |||
19 | struct omap2_mcspi_device_config { | ||
20 | unsigned turbo_mode:1; | ||
21 | |||
22 | /* Do we want one channel enabled at the same time? */ | ||
23 | unsigned single_channel:1; | ||
24 | }; | ||
25 | |||
26 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/memory.h b/arch/arm/plat-omap/include/plat/memory.h new file mode 100644 index 00000000000..e6720aa2d55 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/memory.h | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/memory.h | ||
3 | * | ||
4 | * Memory map for OMAP-1510 and 1610 | ||
5 | * | ||
6 | * Copyright (C) 2000 RidgeRun, Inc. | ||
7 | * Author: Greg Lonnon <glonnon@ridgerun.com> | ||
8 | * | ||
9 | * This file was derived from arch/arm/mach-intergrator/include/mach/memory.h | ||
10 | * Copyright (C) 1999 ARM Limited | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
20 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
23 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
24 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License along | ||
29 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
30 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
31 | */ | ||
32 | |||
33 | #ifndef __ASM_ARCH_MEMORY_H | ||
34 | #define __ASM_ARCH_MEMORY_H | ||
35 | |||
36 | /* | ||
37 | * Physical DRAM offset. | ||
38 | */ | ||
39 | #if defined(CONFIG_ARCH_OMAP1) | ||
40 | #define PLAT_PHYS_OFFSET UL(0x10000000) | ||
41 | #else | ||
42 | #define PLAT_PHYS_OFFSET UL(0x80000000) | ||
43 | #endif | ||
44 | |||
45 | /* | ||
46 | * Bus address is physical address, except for OMAP-1510 Local Bus. | ||
47 | * OMAP-1510 bus address is translated into a Local Bus address if the | ||
48 | * OMAP bus type is lbus. We do the address translation based on the | ||
49 | * device overriding the defaults used in the dma-mapping API. | ||
50 | * Note that the is_lbus_device() test is not very efficient on 1510 | ||
51 | * because of the strncmp(). | ||
52 | */ | ||
53 | #ifdef CONFIG_ARCH_OMAP15XX | ||
54 | |||
55 | /* | ||
56 | * OMAP-1510 Local Bus address offset | ||
57 | */ | ||
58 | #define OMAP1510_LB_OFFSET UL(0x30000000) | ||
59 | |||
60 | #define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET) | ||
61 | #define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET) | ||
62 | #define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev_name(dev), "ohci", 4) == 0)) | ||
63 | |||
64 | #define __arch_pfn_to_dma(dev, pfn) \ | ||
65 | ({ dma_addr_t __dma = __pfn_to_phys(pfn); \ | ||
66 | if (is_lbus_device(dev)) \ | ||
67 | __dma = __dma - PHYS_OFFSET + OMAP1510_LB_OFFSET; \ | ||
68 | __dma; }) | ||
69 | |||
70 | #define __arch_dma_to_pfn(dev, addr) \ | ||
71 | ({ dma_addr_t __dma = addr; \ | ||
72 | if (is_lbus_device(dev)) \ | ||
73 | __dma += PHYS_OFFSET - OMAP1510_LB_OFFSET; \ | ||
74 | __phys_to_pfn(__dma); \ | ||
75 | }) | ||
76 | |||
77 | #define __arch_dma_to_virt(dev, addr) ({ (void *) (is_lbus_device(dev) ? \ | ||
78 | lbus_to_virt(addr) : \ | ||
79 | __phys_to_virt(addr)); }) | ||
80 | |||
81 | #define __arch_virt_to_dma(dev, addr) ({ unsigned long __addr = (unsigned long)(addr); \ | ||
82 | (dma_addr_t) (is_lbus_device(dev) ? \ | ||
83 | virt_to_lbus(__addr) : \ | ||
84 | __virt_to_phys(__addr)); }) | ||
85 | |||
86 | #endif /* CONFIG_ARCH_OMAP15XX */ | ||
87 | |||
88 | /* Override the ARM default */ | ||
89 | #ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE | ||
90 | |||
91 | #if (CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE == 0) | ||
92 | #undef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE | ||
93 | #define CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE 2 | ||
94 | #endif | ||
95 | |||
96 | #define CONSISTENT_DMA_SIZE \ | ||
97 | (((CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE + 1) & ~1) * 1024 * 1024) | ||
98 | |||
99 | #endif | ||
100 | |||
101 | #endif | ||
102 | |||
diff --git a/arch/arm/plat-omap/include/plat/menelaus.h b/arch/arm/plat-omap/include/plat/menelaus.h new file mode 100644 index 00000000000..4a970ec62dd --- /dev/null +++ b/arch/arm/plat-omap/include/plat/menelaus.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/menelaus.h | ||
3 | * | ||
4 | * Functions to access Menelaus power management chip | ||
5 | */ | ||
6 | |||
7 | #ifndef __ASM_ARCH_MENELAUS_H | ||
8 | #define __ASM_ARCH_MENELAUS_H | ||
9 | |||
10 | struct device; | ||
11 | |||
12 | struct menelaus_platform_data { | ||
13 | int (* late_init)(struct device *dev); | ||
14 | }; | ||
15 | |||
16 | extern int menelaus_register_mmc_callback(void (*callback)(void *data, u8 card_mask), | ||
17 | void *data); | ||
18 | extern void menelaus_unregister_mmc_callback(void); | ||
19 | extern int menelaus_set_mmc_opendrain(int slot, int enable); | ||
20 | extern int menelaus_set_mmc_slot(int slot, int enable, int power, int cd_on); | ||
21 | |||
22 | extern int menelaus_set_vmem(unsigned int mV); | ||
23 | extern int menelaus_set_vio(unsigned int mV); | ||
24 | extern int menelaus_set_vmmc(unsigned int mV); | ||
25 | extern int menelaus_set_vaux(unsigned int mV); | ||
26 | extern int menelaus_set_vdcdc(int dcdc, unsigned int mV); | ||
27 | extern int menelaus_set_slot_sel(int enable); | ||
28 | extern int menelaus_get_slot_pin_states(void); | ||
29 | extern int menelaus_set_vcore_sw(unsigned int mV); | ||
30 | extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV); | ||
31 | |||
32 | #define EN_VPLL_SLEEP (1 << 7) | ||
33 | #define EN_VMMC_SLEEP (1 << 6) | ||
34 | #define EN_VAUX_SLEEP (1 << 5) | ||
35 | #define EN_VIO_SLEEP (1 << 4) | ||
36 | #define EN_VMEM_SLEEP (1 << 3) | ||
37 | #define EN_DC3_SLEEP (1 << 2) | ||
38 | #define EN_DC2_SLEEP (1 << 1) | ||
39 | #define EN_VC_SLEEP (1 << 0) | ||
40 | |||
41 | extern int menelaus_set_regulator_sleep(int enable, u32 val); | ||
42 | |||
43 | #if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_MENELAUS) | ||
44 | #define omap_has_menelaus() 1 | ||
45 | #else | ||
46 | #define omap_has_menelaus() 0 | ||
47 | #endif | ||
48 | |||
49 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h new file mode 100644 index 00000000000..c7b874186c2 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/mmc.h | |||
@@ -0,0 +1,182 @@ | |||
1 | /* | ||
2 | * MMC definitions for OMAP2 | ||
3 | * | ||
4 | * Copyright (C) 2006 Nokia Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __OMAP2_MMC_H | ||
12 | #define __OMAP2_MMC_H | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | #include <linux/device.h> | ||
16 | #include <linux/mmc/host.h> | ||
17 | |||
18 | #include <plat/board.h> | ||
19 | |||
20 | #define OMAP15XX_NR_MMC 1 | ||
21 | #define OMAP16XX_NR_MMC 2 | ||
22 | #define OMAP1_MMC_SIZE 0x080 | ||
23 | #define OMAP1_MMC1_BASE 0xfffb7800 | ||
24 | #define OMAP1_MMC2_BASE 0xfffb7c00 /* omap16xx only */ | ||
25 | |||
26 | #define OMAP24XX_NR_MMC 2 | ||
27 | #define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE | ||
28 | #define OMAP2_MMC1_BASE 0x4809c000 | ||
29 | |||
30 | #define OMAP4_MMC_REG_OFFSET 0x100 | ||
31 | |||
32 | #define OMAP_MMC_MAX_SLOTS 2 | ||
33 | |||
34 | #define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(1) | ||
35 | |||
36 | struct omap_mmc_dev_attr { | ||
37 | u8 flags; | ||
38 | }; | ||
39 | |||
40 | struct omap_mmc_platform_data { | ||
41 | /* back-link to device */ | ||
42 | struct device *dev; | ||
43 | |||
44 | /* number of slots per controller */ | ||
45 | unsigned nr_slots:2; | ||
46 | |||
47 | /* set if your board has components or wiring that limits the | ||
48 | * maximum frequency on the MMC bus */ | ||
49 | unsigned int max_freq; | ||
50 | |||
51 | /* switch the bus to a new slot */ | ||
52 | int (*switch_slot)(struct device *dev, int slot); | ||
53 | /* initialize board-specific MMC functionality, can be NULL if | ||
54 | * not supported */ | ||
55 | int (*init)(struct device *dev); | ||
56 | void (*cleanup)(struct device *dev); | ||
57 | void (*shutdown)(struct device *dev); | ||
58 | |||
59 | /* To handle board related suspend/resume functionality for MMC */ | ||
60 | int (*suspend)(struct device *dev, int slot); | ||
61 | int (*resume)(struct device *dev, int slot); | ||
62 | |||
63 | /* Return context loss count due to PM states changing */ | ||
64 | int (*get_context_loss_count)(struct device *dev); | ||
65 | |||
66 | u64 dma_mask; | ||
67 | |||
68 | /* Integrating attributes from the omap_hwmod layer */ | ||
69 | u8 controller_flags; | ||
70 | |||
71 | /* Register offset deviation */ | ||
72 | u16 reg_offset; | ||
73 | |||
74 | struct omap_mmc_slot_data { | ||
75 | |||
76 | /* | ||
77 | * 4/8 wires and any additional host capabilities | ||
78 | * need to OR'd all capabilities (ref. linux/mmc/host.h) | ||
79 | */ | ||
80 | u8 wires; /* Used for the MMC driver on omap1 and 2420 */ | ||
81 | u32 caps; /* Used for the MMC driver on 2430 and later */ | ||
82 | |||
83 | /* | ||
84 | * nomux means "standard" muxing is wrong on this board, and | ||
85 | * that board-specific code handled it before common init logic. | ||
86 | */ | ||
87 | unsigned nomux:1; | ||
88 | |||
89 | /* switch pin can be for card detect (default) or card cover */ | ||
90 | unsigned cover:1; | ||
91 | |||
92 | /* use the internal clock */ | ||
93 | unsigned internal_clock:1; | ||
94 | |||
95 | /* nonremovable e.g. eMMC */ | ||
96 | unsigned nonremovable:1; | ||
97 | |||
98 | /* Try to sleep or power off when possible */ | ||
99 | unsigned power_saving:1; | ||
100 | |||
101 | /* If using power_saving and the MMC power is not to go off */ | ||
102 | unsigned no_off:1; | ||
103 | |||
104 | /* eMMC does not handle power off when not in sleep state */ | ||
105 | unsigned no_regulator_off_init:1; | ||
106 | |||
107 | /* Regulator off remapped to sleep */ | ||
108 | unsigned vcc_aux_disable_is_sleep:1; | ||
109 | |||
110 | /* we can put the features above into this variable */ | ||
111 | #define HSMMC_HAS_PBIAS (1 << 0) | ||
112 | #define HSMMC_HAS_UPDATED_RESET (1 << 1) | ||
113 | unsigned features; | ||
114 | |||
115 | int switch_pin; /* gpio (card detect) */ | ||
116 | int gpio_wp; /* gpio (write protect) */ | ||
117 | |||
118 | int (*set_bus_mode)(struct device *dev, int slot, int bus_mode); | ||
119 | int (*set_power)(struct device *dev, int slot, | ||
120 | int power_on, int vdd); | ||
121 | int (*get_ro)(struct device *dev, int slot); | ||
122 | int (*set_sleep)(struct device *dev, int slot, int sleep, | ||
123 | int vdd, int cardsleep); | ||
124 | void (*remux)(struct device *dev, int slot, int power_on); | ||
125 | /* Call back before enabling / disabling regulators */ | ||
126 | void (*before_set_reg)(struct device *dev, int slot, | ||
127 | int power_on, int vdd); | ||
128 | /* Call back after enabling / disabling regulators */ | ||
129 | void (*after_set_reg)(struct device *dev, int slot, | ||
130 | int power_on, int vdd); | ||
131 | /* if we have special card, init it using this callback */ | ||
132 | void (*init_card)(struct mmc_card *card); | ||
133 | |||
134 | /* return MMC cover switch state, can be NULL if not supported. | ||
135 | * | ||
136 | * possible return values: | ||
137 | * 0 - closed | ||
138 | * 1 - open | ||
139 | */ | ||
140 | int (*get_cover_state)(struct device *dev, int slot); | ||
141 | |||
142 | const char *name; | ||
143 | u32 ocr_mask; | ||
144 | |||
145 | /* Card detection IRQs */ | ||
146 | int card_detect_irq; | ||
147 | int (*card_detect)(struct device *dev, int slot); | ||
148 | |||
149 | unsigned int ban_openended:1; | ||
150 | |||
151 | } slots[OMAP_MMC_MAX_SLOTS]; | ||
152 | }; | ||
153 | |||
154 | /* called from board-specific card detection service routine */ | ||
155 | extern void omap_mmc_notify_cover_event(struct device *dev, int slot, | ||
156 | int is_closed); | ||
157 | |||
158 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ | ||
159 | defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) | ||
160 | void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, | ||
161 | int nr_controllers); | ||
162 | void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data); | ||
163 | int omap_mmc_add(const char *name, int id, unsigned long base, | ||
164 | unsigned long size, unsigned int irq, | ||
165 | struct omap_mmc_platform_data *data); | ||
166 | #else | ||
167 | static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, | ||
168 | int nr_controllers) | ||
169 | { | ||
170 | } | ||
171 | static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) | ||
172 | { | ||
173 | } | ||
174 | static inline int omap_mmc_add(const char *name, int id, unsigned long base, | ||
175 | unsigned long size, unsigned int irq, | ||
176 | struct omap_mmc_platform_data *data) | ||
177 | { | ||
178 | return 0; | ||
179 | } | ||
180 | |||
181 | #endif | ||
182 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/multi.h b/arch/arm/plat-omap/include/plat/multi.h new file mode 100644 index 00000000000..999ffba2690 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/multi.h | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | * Support for compiling in multiple OMAP processors | ||
3 | * | ||
4 | * Copyright (C) 2010 Nokia Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #ifndef __PLAT_OMAP_MULTI_H | ||
23 | #define __PLAT_OMAP_MULTI_H | ||
24 | |||
25 | /* | ||
26 | * Test if multicore OMAP support is needed | ||
27 | */ | ||
28 | #undef MULTI_OMAP1 | ||
29 | #undef MULTI_OMAP2 | ||
30 | #undef OMAP_NAME | ||
31 | |||
32 | #ifdef CONFIG_ARCH_OMAP730 | ||
33 | # ifdef OMAP_NAME | ||
34 | # undef MULTI_OMAP1 | ||
35 | # define MULTI_OMAP1 | ||
36 | # else | ||
37 | # define OMAP_NAME omap730 | ||
38 | # endif | ||
39 | #endif | ||
40 | #ifdef CONFIG_ARCH_OMAP850 | ||
41 | # ifdef OMAP_NAME | ||
42 | # undef MULTI_OMAP1 | ||
43 | # define MULTI_OMAP1 | ||
44 | # else | ||
45 | # define OMAP_NAME omap850 | ||
46 | # endif | ||
47 | #endif | ||
48 | #ifdef CONFIG_ARCH_OMAP15XX | ||
49 | # ifdef OMAP_NAME | ||
50 | # undef MULTI_OMAP1 | ||
51 | # define MULTI_OMAP1 | ||
52 | # else | ||
53 | # define OMAP_NAME omap1510 | ||
54 | # endif | ||
55 | #endif | ||
56 | #ifdef CONFIG_ARCH_OMAP16XX | ||
57 | # ifdef OMAP_NAME | ||
58 | # undef MULTI_OMAP1 | ||
59 | # define MULTI_OMAP1 | ||
60 | # else | ||
61 | # define OMAP_NAME omap16xx | ||
62 | # endif | ||
63 | #endif | ||
64 | #ifdef CONFIG_ARCH_OMAP2PLUS | ||
65 | # if (defined(OMAP_NAME) || defined(MULTI_OMAP1)) | ||
66 | # error "OMAP1 and OMAP2PLUS can't be selected at the same time" | ||
67 | # endif | ||
68 | #endif | ||
69 | #ifdef CONFIG_SOC_OMAP2420 | ||
70 | # ifdef OMAP_NAME | ||
71 | # undef MULTI_OMAP2 | ||
72 | # define MULTI_OMAP2 | ||
73 | # else | ||
74 | # define OMAP_NAME omap2420 | ||
75 | # endif | ||
76 | #endif | ||
77 | #ifdef CONFIG_SOC_OMAP2430 | ||
78 | # ifdef OMAP_NAME | ||
79 | # undef MULTI_OMAP2 | ||
80 | # define MULTI_OMAP2 | ||
81 | # else | ||
82 | # define OMAP_NAME omap2430 | ||
83 | # endif | ||
84 | #endif | ||
85 | #ifdef CONFIG_ARCH_OMAP3 | ||
86 | # ifdef OMAP_NAME | ||
87 | # undef MULTI_OMAP2 | ||
88 | # define MULTI_OMAP2 | ||
89 | # else | ||
90 | # define OMAP_NAME omap3 | ||
91 | # endif | ||
92 | #endif | ||
93 | #ifdef CONFIG_ARCH_OMAP4 | ||
94 | # ifdef OMAP_NAME | ||
95 | # undef MULTI_OMAP2 | ||
96 | # define MULTI_OMAP2 | ||
97 | # else | ||
98 | # define OMAP_NAME omap4 | ||
99 | # endif | ||
100 | #endif | ||
101 | |||
102 | #endif /* __PLAT_OMAP_MULTI_H */ | ||
diff --git a/arch/arm/plat-omap/include/plat/mux.h b/arch/arm/plat-omap/include/plat/mux.h new file mode 100644 index 00000000000..aeba71796ad --- /dev/null +++ b/arch/arm/plat-omap/include/plat/mux.h | |||
@@ -0,0 +1,454 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/mux.h | ||
3 | * | ||
4 | * Table of the Omap register configurations for the FUNC_MUX and | ||
5 | * PULL_DWN combinations. | ||
6 | * | ||
7 | * Copyright (C) 2004 - 2008 Texas Instruments Inc. | ||
8 | * Copyright (C) 2003 - 2008 Nokia Corporation | ||
9 | * | ||
10 | * Written by Tony Lindgren | ||
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 as published by | ||
14 | * the Free Software Foundation; either version 2 of the License, or | ||
15 | * (at your option) any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
25 | * | ||
26 | * NOTE: Please use the following naming style for new pin entries. | ||
27 | * For example, W8_1610_MMC2_DAT0, where: | ||
28 | * - W8 = ball | ||
29 | * - 1610 = 1510 or 1610, none if common for both 1510 and 1610 | ||
30 | * - MMC2_DAT0 = function | ||
31 | */ | ||
32 | |||
33 | #ifndef __ASM_ARCH_MUX_H | ||
34 | #define __ASM_ARCH_MUX_H | ||
35 | |||
36 | #define PU_PD_SEL_NA 0 /* No pu_pd reg available */ | ||
37 | #define PULL_DWN_CTRL_NA 0 /* No pull-down control needed */ | ||
38 | |||
39 | #ifdef CONFIG_OMAP_MUX_DEBUG | ||
40 | #define MUX_REG(reg, mode_offset, mode) .mux_reg_name = "FUNC_MUX_CTRL_"#reg, \ | ||
41 | .mux_reg = FUNC_MUX_CTRL_##reg, \ | ||
42 | .mask_offset = mode_offset, \ | ||
43 | .mask = mode, | ||
44 | |||
45 | #define PULL_REG(reg, bit, status) .pull_name = "PULL_DWN_CTRL_"#reg, \ | ||
46 | .pull_reg = PULL_DWN_CTRL_##reg, \ | ||
47 | .pull_bit = bit, \ | ||
48 | .pull_val = status, | ||
49 | |||
50 | #define PU_PD_REG(reg, status) .pu_pd_name = "PU_PD_SEL_"#reg, \ | ||
51 | .pu_pd_reg = PU_PD_SEL_##reg, \ | ||
52 | .pu_pd_val = status, | ||
53 | |||
54 | #define MUX_REG_7XX(reg, mode_offset, mode) .mux_reg_name = "OMAP7XX_IO_CONF_"#reg, \ | ||
55 | .mux_reg = OMAP7XX_IO_CONF_##reg, \ | ||
56 | .mask_offset = mode_offset, \ | ||
57 | .mask = mode, | ||
58 | |||
59 | #define PULL_REG_7XX(reg, bit, status) .pull_name = "OMAP7XX_IO_CONF_"#reg, \ | ||
60 | .pull_reg = OMAP7XX_IO_CONF_##reg, \ | ||
61 | .pull_bit = bit, \ | ||
62 | .pull_val = status, | ||
63 | |||
64 | #else | ||
65 | |||
66 | #define MUX_REG(reg, mode_offset, mode) .mux_reg = FUNC_MUX_CTRL_##reg, \ | ||
67 | .mask_offset = mode_offset, \ | ||
68 | .mask = mode, | ||
69 | |||
70 | #define PULL_REG(reg, bit, status) .pull_reg = PULL_DWN_CTRL_##reg, \ | ||
71 | .pull_bit = bit, \ | ||
72 | .pull_val = status, | ||
73 | |||
74 | #define PU_PD_REG(reg, status) .pu_pd_reg = PU_PD_SEL_##reg, \ | ||
75 | .pu_pd_val = status, | ||
76 | |||
77 | #define MUX_REG_7XX(reg, mode_offset, mode) \ | ||
78 | .mux_reg = OMAP7XX_IO_CONF_##reg, \ | ||
79 | .mask_offset = mode_offset, \ | ||
80 | .mask = mode, | ||
81 | |||
82 | #define PULL_REG_7XX(reg, bit, status) .pull_reg = OMAP7XX_IO_CONF_##reg, \ | ||
83 | .pull_bit = bit, \ | ||
84 | .pull_val = status, | ||
85 | |||
86 | #endif /* CONFIG_OMAP_MUX_DEBUG */ | ||
87 | |||
88 | #define MUX_CFG(desc, mux_reg, mode_offset, mode, \ | ||
89 | pull_reg, pull_bit, pull_status, \ | ||
90 | pu_pd_reg, pu_pd_status, debug_status) \ | ||
91 | { \ | ||
92 | .name = desc, \ | ||
93 | .debug = debug_status, \ | ||
94 | MUX_REG(mux_reg, mode_offset, mode) \ | ||
95 | PULL_REG(pull_reg, pull_bit, pull_status) \ | ||
96 | PU_PD_REG(pu_pd_reg, pu_pd_status) \ | ||
97 | }, | ||
98 | |||
99 | |||
100 | /* | ||
101 | * OMAP730/850 has a slightly different config for the pin mux. | ||
102 | * - config regs are the OMAP7XX_IO_CONF_x regs (see omap730.h) regs and | ||
103 | * not the FUNC_MUX_CTRL_x regs from hardware.h | ||
104 | * - for pull-up/down, only has one enable bit which is is in the same register | ||
105 | * as mux config | ||
106 | */ | ||
107 | #define MUX_CFG_7XX(desc, mux_reg, mode_offset, mode, \ | ||
108 | pull_bit, pull_status, debug_status)\ | ||
109 | { \ | ||
110 | .name = desc, \ | ||
111 | .debug = debug_status, \ | ||
112 | MUX_REG_7XX(mux_reg, mode_offset, mode) \ | ||
113 | PULL_REG_7XX(mux_reg, pull_bit, pull_status) \ | ||
114 | PU_PD_REG(NA, 0) \ | ||
115 | }, | ||
116 | |||
117 | struct pin_config { | ||
118 | char *name; | ||
119 | const unsigned int mux_reg; | ||
120 | unsigned char debug; | ||
121 | |||
122 | const unsigned char mask_offset; | ||
123 | const unsigned char mask; | ||
124 | |||
125 | const char *pull_name; | ||
126 | const unsigned int pull_reg; | ||
127 | const unsigned char pull_val; | ||
128 | const unsigned char pull_bit; | ||
129 | |||
130 | const char *pu_pd_name; | ||
131 | const unsigned int pu_pd_reg; | ||
132 | const unsigned char pu_pd_val; | ||
133 | |||
134 | #if defined(CONFIG_OMAP_MUX_DEBUG) || defined(CONFIG_OMAP_MUX_WARNINGS) | ||
135 | const char *mux_reg_name; | ||
136 | #endif | ||
137 | |||
138 | }; | ||
139 | |||
140 | enum omap7xx_index { | ||
141 | /* OMAP 730 keyboard */ | ||
142 | E2_7XX_KBR0, | ||
143 | J7_7XX_KBR1, | ||
144 | E1_7XX_KBR2, | ||
145 | F3_7XX_KBR3, | ||
146 | D2_7XX_KBR4, | ||
147 | C2_7XX_KBC0, | ||
148 | D3_7XX_KBC1, | ||
149 | E4_7XX_KBC2, | ||
150 | F4_7XX_KBC3, | ||
151 | E3_7XX_KBC4, | ||
152 | |||
153 | /* USB */ | ||
154 | AA17_7XX_USB_DM, | ||
155 | W16_7XX_USB_PU_EN, | ||
156 | W17_7XX_USB_VBUSI, | ||
157 | W18_7XX_USB_DMCK_OUT, | ||
158 | W19_7XX_USB_DCRST, | ||
159 | |||
160 | /* MMC */ | ||
161 | MMC_7XX_CMD, | ||
162 | MMC_7XX_CLK, | ||
163 | MMC_7XX_DAT0, | ||
164 | |||
165 | /* I2C */ | ||
166 | I2C_7XX_SCL, | ||
167 | I2C_7XX_SDA, | ||
168 | |||
169 | /* SPI */ | ||
170 | SPI_7XX_1, | ||
171 | SPI_7XX_2, | ||
172 | SPI_7XX_3, | ||
173 | SPI_7XX_4, | ||
174 | SPI_7XX_5, | ||
175 | SPI_7XX_6, | ||
176 | |||
177 | /* UART */ | ||
178 | UART_7XX_1, | ||
179 | UART_7XX_2, | ||
180 | }; | ||
181 | |||
182 | enum omap1xxx_index { | ||
183 | /* UART1 (BT_UART_GATING)*/ | ||
184 | UART1_TX = 0, | ||
185 | UART1_RTS, | ||
186 | |||
187 | /* UART2 (COM_UART_GATING)*/ | ||
188 | UART2_TX, | ||
189 | UART2_RX, | ||
190 | UART2_CTS, | ||
191 | UART2_RTS, | ||
192 | |||
193 | /* UART3 (GIGA_UART_GATING) */ | ||
194 | UART3_TX, | ||
195 | UART3_RX, | ||
196 | UART3_CTS, | ||
197 | UART3_RTS, | ||
198 | UART3_CLKREQ, | ||
199 | UART3_BCLK, /* 12MHz clock out */ | ||
200 | Y15_1610_UART3_RTS, | ||
201 | |||
202 | /* PWT & PWL */ | ||
203 | PWT, | ||
204 | PWL, | ||
205 | |||
206 | /* USB master generic */ | ||
207 | R18_USB_VBUS, | ||
208 | R18_1510_USB_GPIO0, | ||
209 | W4_USB_PUEN, | ||
210 | W4_USB_CLKO, | ||
211 | W4_USB_HIGHZ, | ||
212 | W4_GPIO58, | ||
213 | |||
214 | /* USB1 master */ | ||
215 | USB1_SUSP, | ||
216 | USB1_SEO, | ||
217 | W13_1610_USB1_SE0, | ||
218 | USB1_TXEN, | ||
219 | USB1_TXD, | ||
220 | USB1_VP, | ||
221 | USB1_VM, | ||
222 | USB1_RCV, | ||
223 | USB1_SPEED, | ||
224 | R13_1610_USB1_SPEED, | ||
225 | R13_1710_USB1_SE0, | ||
226 | |||
227 | /* USB2 master */ | ||
228 | USB2_SUSP, | ||
229 | USB2_VP, | ||
230 | USB2_TXEN, | ||
231 | USB2_VM, | ||
232 | USB2_RCV, | ||
233 | USB2_SEO, | ||
234 | USB2_TXD, | ||
235 | |||
236 | /* OMAP-1510 GPIO */ | ||
237 | R18_1510_GPIO0, | ||
238 | R19_1510_GPIO1, | ||
239 | M14_1510_GPIO2, | ||
240 | |||
241 | /* OMAP1610 GPIO */ | ||
242 | P18_1610_GPIO3, | ||
243 | Y15_1610_GPIO17, | ||
244 | |||
245 | /* OMAP-1710 GPIO */ | ||
246 | R18_1710_GPIO0, | ||
247 | V2_1710_GPIO10, | ||
248 | N21_1710_GPIO14, | ||
249 | W15_1710_GPIO40, | ||
250 | |||
251 | /* MPUIO */ | ||
252 | MPUIO2, | ||
253 | N15_1610_MPUIO2, | ||
254 | MPUIO4, | ||
255 | MPUIO5, | ||
256 | T20_1610_MPUIO5, | ||
257 | W11_1610_MPUIO6, | ||
258 | V10_1610_MPUIO7, | ||
259 | W11_1610_MPUIO9, | ||
260 | V10_1610_MPUIO10, | ||
261 | W10_1610_MPUIO11, | ||
262 | E20_1610_MPUIO13, | ||
263 | U20_1610_MPUIO14, | ||
264 | E19_1610_MPUIO15, | ||
265 | |||
266 | /* MCBSP2 */ | ||
267 | MCBSP2_CLKR, | ||
268 | MCBSP2_CLKX, | ||
269 | MCBSP2_DR, | ||
270 | MCBSP2_DX, | ||
271 | MCBSP2_FSR, | ||
272 | MCBSP2_FSX, | ||
273 | |||
274 | /* MCBSP3 */ | ||
275 | MCBSP3_CLKX, | ||
276 | |||
277 | /* Misc ballouts */ | ||
278 | BALLOUT_V8_ARMIO3, | ||
279 | N20_HDQ, | ||
280 | |||
281 | /* OMAP-1610 MMC2 */ | ||
282 | W8_1610_MMC2_DAT0, | ||
283 | V8_1610_MMC2_DAT1, | ||
284 | W15_1610_MMC2_DAT2, | ||
285 | R10_1610_MMC2_DAT3, | ||
286 | Y10_1610_MMC2_CLK, | ||
287 | Y8_1610_MMC2_CMD, | ||
288 | V9_1610_MMC2_CMDDIR, | ||
289 | V5_1610_MMC2_DATDIR0, | ||
290 | W19_1610_MMC2_DATDIR1, | ||
291 | R18_1610_MMC2_CLKIN, | ||
292 | |||
293 | /* OMAP-1610 External Trace Interface */ | ||
294 | M19_1610_ETM_PSTAT0, | ||
295 | L15_1610_ETM_PSTAT1, | ||
296 | L18_1610_ETM_PSTAT2, | ||
297 | L19_1610_ETM_D0, | ||
298 | J19_1610_ETM_D6, | ||
299 | J18_1610_ETM_D7, | ||
300 | |||
301 | /* OMAP16XX GPIO */ | ||
302 | P20_1610_GPIO4, | ||
303 | V9_1610_GPIO7, | ||
304 | W8_1610_GPIO9, | ||
305 | N20_1610_GPIO11, | ||
306 | N19_1610_GPIO13, | ||
307 | P10_1610_GPIO22, | ||
308 | V5_1610_GPIO24, | ||
309 | AA20_1610_GPIO_41, | ||
310 | W19_1610_GPIO48, | ||
311 | M7_1610_GPIO62, | ||
312 | V14_16XX_GPIO37, | ||
313 | R9_16XX_GPIO18, | ||
314 | L14_16XX_GPIO49, | ||
315 | |||
316 | /* OMAP-1610 uWire */ | ||
317 | V19_1610_UWIRE_SCLK, | ||
318 | U18_1610_UWIRE_SDI, | ||
319 | W21_1610_UWIRE_SDO, | ||
320 | N14_1610_UWIRE_CS0, | ||
321 | P15_1610_UWIRE_CS3, | ||
322 | N15_1610_UWIRE_CS1, | ||
323 | |||
324 | /* OMAP-1610 SPI */ | ||
325 | U19_1610_SPIF_SCK, | ||
326 | U18_1610_SPIF_DIN, | ||
327 | P20_1610_SPIF_DIN, | ||
328 | W21_1610_SPIF_DOUT, | ||
329 | R18_1610_SPIF_DOUT, | ||
330 | N14_1610_SPIF_CS0, | ||
331 | N15_1610_SPIF_CS1, | ||
332 | T19_1610_SPIF_CS2, | ||
333 | P15_1610_SPIF_CS3, | ||
334 | |||
335 | /* OMAP-1610 Flash */ | ||
336 | L3_1610_FLASH_CS2B_OE, | ||
337 | M8_1610_FLASH_CS2B_WE, | ||
338 | |||
339 | /* First MMC */ | ||
340 | MMC_CMD, | ||
341 | MMC_DAT1, | ||
342 | MMC_DAT2, | ||
343 | MMC_DAT0, | ||
344 | MMC_CLK, | ||
345 | MMC_DAT3, | ||
346 | |||
347 | /* OMAP-1710 MMC CMDDIR and DATDIR0 */ | ||
348 | M15_1710_MMC_CLKI, | ||
349 | P19_1710_MMC_CMDDIR, | ||
350 | P20_1710_MMC_DATDIR0, | ||
351 | |||
352 | /* OMAP-1610 USB0 alternate pin configuration */ | ||
353 | W9_USB0_TXEN, | ||
354 | AA9_USB0_VP, | ||
355 | Y5_USB0_RCV, | ||
356 | R9_USB0_VM, | ||
357 | V6_USB0_TXD, | ||
358 | W5_USB0_SE0, | ||
359 | V9_USB0_SPEED, | ||
360 | V9_USB0_SUSP, | ||
361 | |||
362 | /* USB2 */ | ||
363 | W9_USB2_TXEN, | ||
364 | AA9_USB2_VP, | ||
365 | Y5_USB2_RCV, | ||
366 | R9_USB2_VM, | ||
367 | V6_USB2_TXD, | ||
368 | W5_USB2_SE0, | ||
369 | |||
370 | /* 16XX UART */ | ||
371 | R13_1610_UART1_TX, | ||
372 | V14_16XX_UART1_RX, | ||
373 | R14_1610_UART1_CTS, | ||
374 | AA15_1610_UART1_RTS, | ||
375 | R9_16XX_UART2_RX, | ||
376 | L14_16XX_UART3_RX, | ||
377 | |||
378 | /* I2C OMAP-1610 */ | ||
379 | I2C_SCL, | ||
380 | I2C_SDA, | ||
381 | |||
382 | /* Keypad */ | ||
383 | F18_1610_KBC0, | ||
384 | D20_1610_KBC1, | ||
385 | D19_1610_KBC2, | ||
386 | E18_1610_KBC3, | ||
387 | C21_1610_KBC4, | ||
388 | G18_1610_KBR0, | ||
389 | F19_1610_KBR1, | ||
390 | H14_1610_KBR2, | ||
391 | E20_1610_KBR3, | ||
392 | E19_1610_KBR4, | ||
393 | N19_1610_KBR5, | ||
394 | |||
395 | /* Power management */ | ||
396 | T20_1610_LOW_PWR, | ||
397 | |||
398 | /* MCLK Settings */ | ||
399 | V5_1710_MCLK_ON, | ||
400 | V5_1710_MCLK_OFF, | ||
401 | R10_1610_MCLK_ON, | ||
402 | R10_1610_MCLK_OFF, | ||
403 | |||
404 | /* CompactFlash controller */ | ||
405 | P11_1610_CF_CD2, | ||
406 | R11_1610_CF_IOIS16, | ||
407 | V10_1610_CF_IREQ, | ||
408 | W10_1610_CF_RESET, | ||
409 | W11_1610_CF_CD1, | ||
410 | |||
411 | /* parallel camera */ | ||
412 | J15_1610_CAM_LCLK, | ||
413 | J18_1610_CAM_D7, | ||
414 | J19_1610_CAM_D6, | ||
415 | J14_1610_CAM_D5, | ||
416 | K18_1610_CAM_D4, | ||
417 | K19_1610_CAM_D3, | ||
418 | K15_1610_CAM_D2, | ||
419 | K14_1610_CAM_D1, | ||
420 | L19_1610_CAM_D0, | ||
421 | L18_1610_CAM_VS, | ||
422 | L15_1610_CAM_HS, | ||
423 | M19_1610_CAM_RSTZ, | ||
424 | Y15_1610_CAM_OUTCLK, | ||
425 | |||
426 | /* serial camera */ | ||
427 | H19_1610_CAM_EXCLK, | ||
428 | Y12_1610_CCP_CLKP, | ||
429 | W13_1610_CCP_CLKM, | ||
430 | W14_1610_CCP_DATAP, | ||
431 | Y14_1610_CCP_DATAM, | ||
432 | |||
433 | }; | ||
434 | |||
435 | struct omap_mux_cfg { | ||
436 | struct pin_config *pins; | ||
437 | unsigned long size; | ||
438 | int (*cfg_reg)(const struct pin_config *cfg); | ||
439 | }; | ||
440 | |||
441 | #ifdef CONFIG_OMAP_MUX | ||
442 | /* setup pin muxing in Linux */ | ||
443 | extern int omap1_mux_init(void); | ||
444 | extern int omap_mux_register(struct omap_mux_cfg *); | ||
445 | extern int omap_cfg_reg(unsigned long reg_cfg); | ||
446 | #else | ||
447 | /* boot loader does it all (no warnings from CONFIG_OMAP_MUX_WARNINGS) */ | ||
448 | static inline int omap1_mux_init(void) { return 0; } | ||
449 | static inline int omap_cfg_reg(unsigned long reg_cfg) { return 0; } | ||
450 | #endif | ||
451 | |||
452 | extern int omap2_mux_init(void); | ||
453 | |||
454 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/nand.h b/arch/arm/plat-omap/include/plat/nand.h new file mode 100644 index 00000000000..67fc5060183 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/nand.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/nand.h | ||
3 | * | ||
4 | * Copyright (C) 2006 Micron Technology Inc. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <plat/gpmc.h> | ||
12 | #include <linux/mtd/partitions.h> | ||
13 | |||
14 | enum nand_io { | ||
15 | NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */ | ||
16 | NAND_OMAP_POLLED, /* polled mode, without prefetch */ | ||
17 | NAND_OMAP_PREFETCH_DMA, /* prefetch enabled sDMA mode */ | ||
18 | NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */ | ||
19 | }; | ||
20 | |||
21 | struct omap_nand_platform_data { | ||
22 | int cs; | ||
23 | struct mtd_partition *parts; | ||
24 | struct gpmc_timings *gpmc_t; | ||
25 | int nr_parts; | ||
26 | bool dev_ready; | ||
27 | int gpmc_irq; | ||
28 | enum nand_io xfer_type; | ||
29 | unsigned long phys_base; | ||
30 | int devsize; | ||
31 | enum omap_ecc ecc_opt; | ||
32 | }; | ||
33 | |||
34 | /* minimum size for IO mapping */ | ||
35 | #define NAND_IO_SIZE 4 | ||
36 | |||
37 | #if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE) | ||
38 | extern int gpmc_nand_init(struct omap_nand_platform_data *d); | ||
39 | #else | ||
40 | static inline int gpmc_nand_init(struct omap_nand_platform_data *d) | ||
41 | { | ||
42 | return 0; | ||
43 | } | ||
44 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/omap-alsa.h b/arch/arm/plat-omap/include/plat/omap-alsa.h new file mode 100644 index 00000000000..b53055b390d --- /dev/null +++ b/arch/arm/plat-omap/include/plat/omap-alsa.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/omap-alsa.h | ||
3 | * | ||
4 | * Alsa Driver for AIC23 and TSC2101 codecs on OMAP platform boards. | ||
5 | * | ||
6 | * Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi> | ||
7 | * | ||
8 | * Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil | ||
9 | * Written by Daniel Petrini, David Cohen, Anderson Briglia | ||
10 | * {daniel.petrini, david.cohen, anderson.briglia}@indt.org.br | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
20 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
23 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
24 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License along | ||
29 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
30 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
31 | * | ||
32 | * History | ||
33 | * ------- | ||
34 | * | ||
35 | * 2005/07/25 INdT-10LE Kernel Team - Alsa driver for omap osk, | ||
36 | * original version based in sa1100 driver | ||
37 | * and omap oss driver. | ||
38 | */ | ||
39 | |||
40 | #ifndef __OMAP_ALSA_H | ||
41 | #define __OMAP_ALSA_H | ||
42 | |||
43 | #include <plat/dma.h> | ||
44 | #include <sound/core.h> | ||
45 | #include <sound/pcm.h> | ||
46 | #include <plat/mcbsp.h> | ||
47 | #include <linux/platform_device.h> | ||
48 | |||
49 | #define DMA_BUF_SIZE (1024 * 8) | ||
50 | |||
51 | /* | ||
52 | * Buffer management for alsa and dma | ||
53 | */ | ||
54 | struct audio_stream { | ||
55 | char *id; /* identification string */ | ||
56 | int stream_id; /* numeric identification */ | ||
57 | int dma_dev; /* dma number of that device */ | ||
58 | int *lch; /* Chain of channels this stream is linked to */ | ||
59 | char started; /* to store if the chain was started or not */ | ||
60 | int dma_q_head; /* DMA Channel Q Head */ | ||
61 | int dma_q_tail; /* DMA Channel Q Tail */ | ||
62 | char dma_q_count; /* DMA Channel Q Count */ | ||
63 | int active:1; /* we are using this stream for transfer now */ | ||
64 | int period; /* current transfer period */ | ||
65 | int periods; /* current count of periods registerd in the DMA engine */ | ||
66 | spinlock_t dma_lock; /* for locking in DMA operations */ | ||
67 | struct snd_pcm_substream *stream; /* the pcm stream */ | ||
68 | unsigned linked:1; /* dma channels linked */ | ||
69 | int offset; /* store start position of the last period in the alsa buffer */ | ||
70 | int (*hw_start)(void); /* interface to start HW interface, e.g. McBSP */ | ||
71 | int (*hw_stop)(void); /* interface to stop HW interface, e.g. McBSP */ | ||
72 | }; | ||
73 | |||
74 | /* | ||
75 | * Alsa card structure for aic23 | ||
76 | */ | ||
77 | struct snd_card_omap_codec { | ||
78 | struct snd_card *card; | ||
79 | struct snd_pcm *pcm; | ||
80 | long samplerate; | ||
81 | struct audio_stream s[2]; /* playback & capture */ | ||
82 | }; | ||
83 | |||
84 | /* Codec specific information and function pointers. | ||
85 | * Codec (omap-alsa-aic23.c and omap-alsa-tsc2101.c) | ||
86 | * are responsible for defining the function pointers. | ||
87 | */ | ||
88 | struct omap_alsa_codec_config { | ||
89 | char *name; | ||
90 | struct omap_mcbsp_reg_cfg *mcbsp_regs_alsa; | ||
91 | struct snd_pcm_hw_constraint_list *hw_constraints_rates; | ||
92 | struct snd_pcm_hardware *snd_omap_alsa_playback; | ||
93 | struct snd_pcm_hardware *snd_omap_alsa_capture; | ||
94 | void (*codec_configure_dev)(void); | ||
95 | void (*codec_set_samplerate)(long); | ||
96 | void (*codec_clock_setup)(void); | ||
97 | int (*codec_clock_on)(void); | ||
98 | int (*codec_clock_off)(void); | ||
99 | int (*get_default_samplerate)(void); | ||
100 | }; | ||
101 | |||
102 | /*********** Mixer function prototypes *************************/ | ||
103 | int snd_omap_mixer(struct snd_card_omap_codec *); | ||
104 | void snd_omap_init_mixer(void); | ||
105 | |||
106 | #ifdef CONFIG_PM | ||
107 | void snd_omap_suspend_mixer(void); | ||
108 | void snd_omap_resume_mixer(void); | ||
109 | #endif | ||
110 | |||
111 | int snd_omap_alsa_post_probe(struct platform_device *pdev, struct omap_alsa_codec_config *config); | ||
112 | int snd_omap_alsa_remove(struct platform_device *pdev); | ||
113 | #ifdef CONFIG_PM | ||
114 | int snd_omap_alsa_suspend(struct platform_device *pdev, pm_message_t state); | ||
115 | int snd_omap_alsa_resume(struct platform_device *pdev); | ||
116 | #else | ||
117 | #define snd_omap_alsa_suspend NULL | ||
118 | #define snd_omap_alsa_resume NULL | ||
119 | #endif | ||
120 | |||
121 | void callback_omap_alsa_sound_dma(void *); | ||
122 | |||
123 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/omap-pm.h b/arch/arm/plat-omap/include/plat/omap-pm.h new file mode 100644 index 00000000000..0840df813f4 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/omap-pm.h | |||
@@ -0,0 +1,352 @@ | |||
1 | /* | ||
2 | * omap-pm.h - OMAP power management interface | ||
3 | * | ||
4 | * Copyright (C) 2008-2010 Texas Instruments, Inc. | ||
5 | * Copyright (C) 2008-2010 Nokia Corporation | ||
6 | * Paul Walmsley | ||
7 | * | ||
8 | * Interface developed by (in alphabetical order): Karthik Dasu, Jouni | ||
9 | * Högander, Tony Lindgren, Rajendra Nayak, Sakari Poussa, | ||
10 | * Veeramanikandan Raju, Anand Sawant, Igor Stoppa, Paul Walmsley, | ||
11 | * Richard Woodruff | ||
12 | */ | ||
13 | |||
14 | #ifndef ASM_ARM_ARCH_OMAP_OMAP_PM_H | ||
15 | #define ASM_ARM_ARCH_OMAP_OMAP_PM_H | ||
16 | |||
17 | #include <linux/device.h> | ||
18 | #include <linux/cpufreq.h> | ||
19 | #include <linux/clk.h> | ||
20 | #include <linux/opp.h> | ||
21 | |||
22 | /* | ||
23 | * agent_id values for use with omap_pm_set_min_bus_tput(): | ||
24 | * | ||
25 | * OCP_INITIATOR_AGENT is only valid for devices that can act as | ||
26 | * initiators -- it represents the device's L3 interconnect | ||
27 | * connection. OCP_TARGET_AGENT represents the device's L4 | ||
28 | * interconnect connection. | ||
29 | */ | ||
30 | #define OCP_TARGET_AGENT 1 | ||
31 | #define OCP_INITIATOR_AGENT 2 | ||
32 | |||
33 | /** | ||
34 | * omap_pm_if_early_init - OMAP PM init code called before clock fw init | ||
35 | * @mpu_opp_table: array ptr to struct omap_opp for MPU | ||
36 | * @dsp_opp_table: array ptr to struct omap_opp for DSP | ||
37 | * @l3_opp_table : array ptr to struct omap_opp for CORE | ||
38 | * | ||
39 | * Initialize anything that must be configured before the clock | ||
40 | * framework starts. The "_if_" is to avoid name collisions with the | ||
41 | * PM idle-loop code. | ||
42 | */ | ||
43 | int __init omap_pm_if_early_init(void); | ||
44 | |||
45 | /** | ||
46 | * omap_pm_if_init - OMAP PM init code called after clock fw init | ||
47 | * | ||
48 | * The main initialization code. OPP tables are passed in here. The | ||
49 | * "_if_" is to avoid name collisions with the PM idle-loop code. | ||
50 | */ | ||
51 | int __init omap_pm_if_init(void); | ||
52 | |||
53 | /** | ||
54 | * omap_pm_if_exit - OMAP PM exit code | ||
55 | * | ||
56 | * Exit code; currently unused. The "_if_" is to avoid name | ||
57 | * collisions with the PM idle-loop code. | ||
58 | */ | ||
59 | void omap_pm_if_exit(void); | ||
60 | |||
61 | /* | ||
62 | * Device-driver-originated constraints (via board-*.c files, platform_data) | ||
63 | */ | ||
64 | |||
65 | |||
66 | /** | ||
67 | * omap_pm_set_max_mpu_wakeup_lat - set the maximum MPU wakeup latency | ||
68 | * @dev: struct device * requesting the constraint | ||
69 | * @t: maximum MPU wakeup latency in microseconds | ||
70 | * | ||
71 | * Request that the maximum interrupt latency for the MPU to be no | ||
72 | * greater than @t microseconds. "Interrupt latency" in this case is | ||
73 | * defined as the elapsed time from the occurrence of a hardware or | ||
74 | * timer interrupt to the time when the device driver's interrupt | ||
75 | * service routine has been entered by the MPU. | ||
76 | * | ||
77 | * It is intended that underlying PM code will use this information to | ||
78 | * determine what power state to put the MPU powerdomain into, and | ||
79 | * possibly the CORE powerdomain as well, since interrupt handling | ||
80 | * code currently runs from SDRAM. Advanced PM or board*.c code may | ||
81 | * also configure interrupt controller priorities, OCP bus priorities, | ||
82 | * CPU speed(s), etc. | ||
83 | * | ||
84 | * This function will not affect device wakeup latency, e.g., time | ||
85 | * elapsed from when a device driver enables a hardware device with | ||
86 | * clk_enable(), to when the device is ready for register access or | ||
87 | * other use. To control this device wakeup latency, use | ||
88 | * omap_pm_set_max_dev_wakeup_lat() | ||
89 | * | ||
90 | * Multiple calls to omap_pm_set_max_mpu_wakeup_lat() will replace the | ||
91 | * previous t value. To remove the latency target for the MPU, call | ||
92 | * with t = -1. | ||
93 | * | ||
94 | * XXX This constraint will be deprecated soon in favor of the more | ||
95 | * general omap_pm_set_max_dev_wakeup_lat() | ||
96 | * | ||
97 | * Returns -EINVAL for an invalid argument, -ERANGE if the constraint | ||
98 | * is not satisfiable, or 0 upon success. | ||
99 | */ | ||
100 | int omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t); | ||
101 | |||
102 | |||
103 | /** | ||
104 | * omap_pm_set_min_bus_tput - set minimum bus throughput needed by device | ||
105 | * @dev: struct device * requesting the constraint | ||
106 | * @tbus_id: interconnect to operate on (OCP_{INITIATOR,TARGET}_AGENT) | ||
107 | * @r: minimum throughput (in KiB/s) | ||
108 | * | ||
109 | * Request that the minimum data throughput on the OCP interconnect | ||
110 | * attached to device @dev interconnect agent @tbus_id be no less | ||
111 | * than @r KiB/s. | ||
112 | * | ||
113 | * It is expected that the OMAP PM or bus code will use this | ||
114 | * information to set the interconnect clock to run at the lowest | ||
115 | * possible speed that satisfies all current system users. The PM or | ||
116 | * bus code will adjust the estimate based on its model of the bus, so | ||
117 | * device driver authors should attempt to specify an accurate | ||
118 | * quantity for their device use case, and let the PM or bus code | ||
119 | * overestimate the numbers as necessary to handle request/response | ||
120 | * latency, other competing users on the system, etc. On OMAP2/3, if | ||
121 | * a driver requests a minimum L4 interconnect speed constraint, the | ||
122 | * code will also need to add an minimum L3 interconnect speed | ||
123 | * constraint, | ||
124 | * | ||
125 | * Multiple calls to omap_pm_set_min_bus_tput() will replace the | ||
126 | * previous rate value for this device. To remove the interconnect | ||
127 | * throughput restriction for this device, call with r = 0. | ||
128 | * | ||
129 | * Returns -EINVAL for an invalid argument, -ERANGE if the constraint | ||
130 | * is not satisfiable, or 0 upon success. | ||
131 | */ | ||
132 | int omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned long r); | ||
133 | |||
134 | |||
135 | /** | ||
136 | * omap_pm_set_max_dev_wakeup_lat - set the maximum device enable latency | ||
137 | * @req_dev: struct device * requesting the constraint, or NULL if none | ||
138 | * @dev: struct device * to set the constraint one | ||
139 | * @t: maximum device wakeup latency in microseconds | ||
140 | * | ||
141 | * Request that the maximum amount of time necessary for a device @dev | ||
142 | * to become accessible after its clocks are enabled should be no | ||
143 | * greater than @t microseconds. Specifically, this represents the | ||
144 | * time from when a device driver enables device clocks with | ||
145 | * clk_enable(), to when the register reads and writes on the device | ||
146 | * will succeed. This function should be called before clk_disable() | ||
147 | * is called, since the power state transition decision may be made | ||
148 | * during clk_disable(). | ||
149 | * | ||
150 | * It is intended that underlying PM code will use this information to | ||
151 | * determine what power state to put the powerdomain enclosing this | ||
152 | * device into. | ||
153 | * | ||
154 | * Multiple calls to omap_pm_set_max_dev_wakeup_lat() will replace the | ||
155 | * previous wakeup latency values for this device. To remove the | ||
156 | * wakeup latency restriction for this device, call with t = -1. | ||
157 | * | ||
158 | * Returns -EINVAL for an invalid argument, -ERANGE if the constraint | ||
159 | * is not satisfiable, or 0 upon success. | ||
160 | */ | ||
161 | int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev, | ||
162 | long t); | ||
163 | |||
164 | |||
165 | /** | ||
166 | * omap_pm_set_max_sdma_lat - set the maximum system DMA transfer start latency | ||
167 | * @dev: struct device * | ||
168 | * @t: maximum DMA transfer start latency in microseconds | ||
169 | * | ||
170 | * Request that the maximum system DMA transfer start latency for this | ||
171 | * device 'dev' should be no greater than 't' microseconds. "DMA | ||
172 | * transfer start latency" here is defined as the elapsed time from | ||
173 | * when a device (e.g., McBSP) requests that a system DMA transfer | ||
174 | * start or continue, to the time at which data starts to flow into | ||
175 | * that device from the system DMA controller. | ||
176 | * | ||
177 | * It is intended that underlying PM code will use this information to | ||
178 | * determine what power state to put the CORE powerdomain into. | ||
179 | * | ||
180 | * Since system DMA transfers may not involve the MPU, this function | ||
181 | * will not affect MPU wakeup latency. Use set_max_cpu_lat() to do | ||
182 | * so. Similarly, this function will not affect device wakeup latency | ||
183 | * -- use set_max_dev_wakeup_lat() to affect that. | ||
184 | * | ||
185 | * Multiple calls to set_max_sdma_lat() will replace the previous t | ||
186 | * value for this device. To remove the maximum DMA latency for this | ||
187 | * device, call with t = -1. | ||
188 | * | ||
189 | * Returns -EINVAL for an invalid argument, -ERANGE if the constraint | ||
190 | * is not satisfiable, or 0 upon success. | ||
191 | */ | ||
192 | int omap_pm_set_max_sdma_lat(struct device *dev, long t); | ||
193 | |||
194 | |||
195 | /** | ||
196 | * omap_pm_set_min_clk_rate - set minimum clock rate requested by @dev | ||
197 | * @dev: struct device * requesting the constraint | ||
198 | * @clk: struct clk * to set the minimum rate constraint on | ||
199 | * @r: minimum rate in Hz | ||
200 | * | ||
201 | * Request that the minimum clock rate on the device @dev's clk @clk | ||
202 | * be no less than @r Hz. | ||
203 | * | ||
204 | * It is expected that the OMAP PM code will use this information to | ||
205 | * find an OPP or clock setting that will satisfy this clock rate | ||
206 | * constraint, along with any other applicable system constraints on | ||
207 | * the clock rate or corresponding voltage, etc. | ||
208 | * | ||
209 | * omap_pm_set_min_clk_rate() differs from the clock code's | ||
210 | * clk_set_rate() in that it considers other constraints before taking | ||
211 | * any hardware action, and may change a system OPP rather than just a | ||
212 | * clock rate. clk_set_rate() is intended to be a low-level | ||
213 | * interface. | ||
214 | * | ||
215 | * omap_pm_set_min_clk_rate() is easily open to abuse. A better API | ||
216 | * would be something like "omap_pm_set_min_dev_performance()"; | ||
217 | * however, there is no easily-generalizable concept of performance | ||
218 | * that applies to all devices. Only a device (and possibly the | ||
219 | * device subsystem) has both the subsystem-specific knowledge, and | ||
220 | * the hardware IP block-specific knowledge, to translate a constraint | ||
221 | * on "touchscreen sampling accuracy" or "number of pixels or polygons | ||
222 | * rendered per second" to a clock rate. This translation can be | ||
223 | * dependent on the hardware IP block's revision, or firmware version, | ||
224 | * and the driver is the only code on the system that has this | ||
225 | * information and can know how to translate that into a clock rate. | ||
226 | * | ||
227 | * The intended use-case for this function is for userspace or other | ||
228 | * kernel code to communicate a particular performance requirement to | ||
229 | * a subsystem; then for the subsystem to communicate that requirement | ||
230 | * to something that is meaningful to the device driver; then for the | ||
231 | * device driver to convert that requirement to a clock rate, and to | ||
232 | * then call omap_pm_set_min_clk_rate(). | ||
233 | * | ||
234 | * Users of this function (such as device drivers) should not simply | ||
235 | * call this function with some high clock rate to ensure "high | ||
236 | * performance." Rather, the device driver should take a performance | ||
237 | * constraint from its subsystem, such as "render at least X polygons | ||
238 | * per second," and use some formula or table to convert that into a | ||
239 | * clock rate constraint given the hardware type and hardware | ||
240 | * revision. Device drivers or subsystems should not assume that they | ||
241 | * know how to make a power/performance tradeoff - some device use | ||
242 | * cases may tolerate a lower-fidelity device function for lower power | ||
243 | * consumption; others may demand a higher-fidelity device function, | ||
244 | * no matter what the power consumption. | ||
245 | * | ||
246 | * Multiple calls to omap_pm_set_min_clk_rate() will replace the | ||
247 | * previous rate value for the device @dev. To remove the minimum clock | ||
248 | * rate constraint for the device, call with r = 0. | ||
249 | * | ||
250 | * Returns -EINVAL for an invalid argument, -ERANGE if the constraint | ||
251 | * is not satisfiable, or 0 upon success. | ||
252 | */ | ||
253 | int omap_pm_set_min_clk_rate(struct device *dev, struct clk *c, long r); | ||
254 | |||
255 | /* | ||
256 | * DSP Bridge-specific constraints | ||
257 | */ | ||
258 | |||
259 | /** | ||
260 | * omap_pm_dsp_get_opp_table - get OPP->DSP clock frequency table | ||
261 | * | ||
262 | * Intended for use by DSPBridge. Returns an array of OPP->DSP clock | ||
263 | * frequency entries. The final item in the array should have .rate = | ||
264 | * .opp_id = 0. | ||
265 | */ | ||
266 | const struct omap_opp *omap_pm_dsp_get_opp_table(void); | ||
267 | |||
268 | /** | ||
269 | * omap_pm_dsp_set_min_opp - receive desired OPP target ID from DSP Bridge | ||
270 | * @opp_id: target DSP OPP ID | ||
271 | * | ||
272 | * Set a minimum OPP ID for the DSP. This is intended to be called | ||
273 | * only from the DSP Bridge MPU-side driver. Unfortunately, the only | ||
274 | * information that code receives from the DSP/BIOS load estimator is the | ||
275 | * target OPP ID; hence, this interface. No return value. | ||
276 | */ | ||
277 | void omap_pm_dsp_set_min_opp(u8 opp_id); | ||
278 | |||
279 | /** | ||
280 | * omap_pm_dsp_get_opp - report the current DSP OPP ID | ||
281 | * | ||
282 | * Report the current OPP for the DSP. Since on OMAP3, the DSP and | ||
283 | * MPU share a single voltage domain, the OPP ID returned back may | ||
284 | * represent a higher DSP speed than the OPP requested via | ||
285 | * omap_pm_dsp_set_min_opp(). | ||
286 | * | ||
287 | * Returns the current VDD1 OPP ID, or 0 upon error. | ||
288 | */ | ||
289 | u8 omap_pm_dsp_get_opp(void); | ||
290 | |||
291 | |||
292 | /* | ||
293 | * CPUFreq-originated constraint | ||
294 | * | ||
295 | * In the future, this should be handled by custom OPP clocktype | ||
296 | * functions. | ||
297 | */ | ||
298 | |||
299 | /** | ||
300 | * omap_pm_cpu_get_freq_table - return a cpufreq_frequency_table array ptr | ||
301 | * | ||
302 | * Provide a frequency table usable by CPUFreq for the current chip/board. | ||
303 | * Returns a pointer to a struct cpufreq_frequency_table array or NULL | ||
304 | * upon error. | ||
305 | */ | ||
306 | struct cpufreq_frequency_table **omap_pm_cpu_get_freq_table(void); | ||
307 | |||
308 | /** | ||
309 | * omap_pm_cpu_set_freq - set the current minimum MPU frequency | ||
310 | * @f: MPU frequency in Hz | ||
311 | * | ||
312 | * Set the current minimum CPU frequency. The actual CPU frequency | ||
313 | * used could end up higher if the DSP requested a higher OPP. | ||
314 | * Intended to be called by plat-omap/cpu_omap.c:omap_target(). No | ||
315 | * return value. | ||
316 | */ | ||
317 | void omap_pm_cpu_set_freq(unsigned long f); | ||
318 | |||
319 | /** | ||
320 | * omap_pm_cpu_get_freq - report the current CPU frequency | ||
321 | * | ||
322 | * Returns the current MPU frequency, or 0 upon error. | ||
323 | */ | ||
324 | unsigned long omap_pm_cpu_get_freq(void); | ||
325 | |||
326 | |||
327 | /* | ||
328 | * Device context loss tracking | ||
329 | */ | ||
330 | |||
331 | /** | ||
332 | * omap_pm_get_dev_context_loss_count - return count of times dev has lost ctx | ||
333 | * @dev: struct device * | ||
334 | * | ||
335 | * This function returns the number of times that the device @dev has | ||
336 | * lost its internal context. This generally occurs on a powerdomain | ||
337 | * transition to OFF. Drivers use this as an optimization to avoid restoring | ||
338 | * context if the device hasn't lost it. To use, drivers should initially | ||
339 | * call this in their context save functions and store the result. Early in | ||
340 | * the driver's context restore function, the driver should call this function | ||
341 | * again, and compare the result to the stored counter. If they differ, the | ||
342 | * driver must restore device context. If the number of context losses | ||
343 | * exceeds the maximum positive integer, the function will wrap to 0 and | ||
344 | * continue counting. Returns the number of context losses for this device, | ||
345 | * or zero upon error. | ||
346 | */ | ||
347 | u32 omap_pm_get_dev_context_loss_count(struct device *dev); | ||
348 | |||
349 | void omap_pm_enable_off_mode(void); | ||
350 | void omap_pm_disable_off_mode(void); | ||
351 | |||
352 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h new file mode 100644 index 00000000000..2682043f5a5 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/omap-serial.h | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * Driver for OMAP-UART controller. | ||
3 | * Based on drivers/serial/8250.c | ||
4 | * | ||
5 | * Copyright (C) 2010 Texas Instruments. | ||
6 | * | ||
7 | * Authors: | ||
8 | * Govindraj R <govindraj.raja@ti.com> | ||
9 | * Thara Gopinath <thara@ti.com> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | */ | ||
16 | |||
17 | #ifndef __OMAP_SERIAL_H__ | ||
18 | #define __OMAP_SERIAL_H__ | ||
19 | |||
20 | #include <linux/serial_core.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | |||
23 | #include <plat/mux.h> | ||
24 | |||
25 | #define DRIVER_NAME "omap_uart" | ||
26 | |||
27 | /* | ||
28 | * Use tty device name as ttyO, [O -> OMAP] | ||
29 | * in bootargs we specify as console=ttyO0 if uart1 | ||
30 | * is used as console uart. | ||
31 | */ | ||
32 | #define OMAP_SERIAL_NAME "ttyO" | ||
33 | |||
34 | #define OMAP_MODE13X_SPEED 230400 | ||
35 | |||
36 | /* WER = 0x7F | ||
37 | * Enable module level wakeup in WER reg | ||
38 | */ | ||
39 | #define OMAP_UART_WER_MOD_WKUP 0X7F | ||
40 | |||
41 | /* Enable XON/XOFF flow control on output */ | ||
42 | #define OMAP_UART_SW_TX 0x04 | ||
43 | |||
44 | /* Enable XON/XOFF flow control on input */ | ||
45 | #define OMAP_UART_SW_RX 0x04 | ||
46 | |||
47 | #define OMAP_UART_SYSC_RESET 0X07 | ||
48 | #define OMAP_UART_TCR_TRIG 0X0F | ||
49 | #define OMAP_UART_SW_CLR 0XF0 | ||
50 | #define OMAP_UART_FIFO_CLR 0X06 | ||
51 | |||
52 | #define OMAP_UART_DMA_CH_FREE -1 | ||
53 | |||
54 | #define RX_TIMEOUT (3 * HZ) | ||
55 | #define OMAP_MAX_HSUART_PORTS 4 | ||
56 | |||
57 | #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA | ||
58 | |||
59 | struct omap_uart_port_info { | ||
60 | bool dma_enabled; /* To specify DMA Mode */ | ||
61 | unsigned int uartclk; /* UART clock rate */ | ||
62 | void __iomem *membase; /* ioremap cookie or NULL */ | ||
63 | resource_size_t mapbase; /* resource base */ | ||
64 | unsigned long irqflags; /* request_irq flags */ | ||
65 | upf_t flags; /* UPF_* flags */ | ||
66 | }; | ||
67 | |||
68 | struct uart_omap_dma { | ||
69 | u8 uart_dma_tx; | ||
70 | u8 uart_dma_rx; | ||
71 | int rx_dma_channel; | ||
72 | int tx_dma_channel; | ||
73 | dma_addr_t rx_buf_dma_phys; | ||
74 | dma_addr_t tx_buf_dma_phys; | ||
75 | unsigned int uart_base; | ||
76 | /* | ||
77 | * Buffer for rx dma.It is not required for tx because the buffer | ||
78 | * comes from port structure. | ||
79 | */ | ||
80 | unsigned char *rx_buf; | ||
81 | unsigned int prev_rx_dma_pos; | ||
82 | int tx_buf_size; | ||
83 | int tx_dma_used; | ||
84 | int rx_dma_used; | ||
85 | spinlock_t tx_lock; | ||
86 | spinlock_t rx_lock; | ||
87 | /* timer to poll activity on rx dma */ | ||
88 | struct timer_list rx_timer; | ||
89 | int rx_buf_size; | ||
90 | int rx_timeout; | ||
91 | }; | ||
92 | |||
93 | struct uart_omap_port { | ||
94 | struct uart_port port; | ||
95 | struct uart_omap_dma uart_dma; | ||
96 | struct platform_device *pdev; | ||
97 | |||
98 | unsigned char ier; | ||
99 | unsigned char lcr; | ||
100 | unsigned char mcr; | ||
101 | unsigned char fcr; | ||
102 | unsigned char efr; | ||
103 | |||
104 | int use_dma; | ||
105 | /* | ||
106 | * Some bits in registers are cleared on a read, so they must | ||
107 | * be saved whenever the register is read but the bits will not | ||
108 | * be immediately processed. | ||
109 | */ | ||
110 | unsigned int lsr_break_flag; | ||
111 | unsigned char msr_saved_flags; | ||
112 | char name[20]; | ||
113 | unsigned long port_activity; | ||
114 | }; | ||
115 | |||
116 | #endif /* __OMAP_SERIAL_H__ */ | ||
diff --git a/arch/arm/plat-omap/include/plat/omap1510.h b/arch/arm/plat-omap/include/plat/omap1510.h new file mode 100644 index 00000000000..d2400466813 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/omap1510.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* arch/arm/plat-omap/include/mach/omap1510.h | ||
2 | * | ||
3 | * Hardware definitions for TI OMAP1510 processor. | ||
4 | * | ||
5 | * Cleanup for Linux-2.6 by Dirk Behme <dirk.behme@de.bosch.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | * | ||
12 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
13 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
14 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
15 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
16 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
17 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
18 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
19 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
20 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
21 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License along | ||
24 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
25 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | */ | ||
27 | |||
28 | #ifndef __ASM_ARCH_OMAP15XX_H | ||
29 | #define __ASM_ARCH_OMAP15XX_H | ||
30 | |||
31 | /* | ||
32 | * ---------------------------------------------------------------------------- | ||
33 | * Base addresses | ||
34 | * ---------------------------------------------------------------------------- | ||
35 | */ | ||
36 | |||
37 | /* Syntax: XX_BASE = Virtual base address, XX_START = Physical base address */ | ||
38 | |||
39 | #define OMAP1510_DSP_BASE 0xE0000000 | ||
40 | #define OMAP1510_DSP_SIZE 0x28000 | ||
41 | #define OMAP1510_DSP_START 0xE0000000 | ||
42 | |||
43 | #define OMAP1510_DSPREG_BASE 0xE1000000 | ||
44 | #define OMAP1510_DSPREG_SIZE SZ_128K | ||
45 | #define OMAP1510_DSPREG_START 0xE1000000 | ||
46 | |||
47 | #define OMAP1510_DSP_MMU_BASE (0xfffed200) | ||
48 | |||
49 | #endif /* __ASM_ARCH_OMAP15XX_H */ | ||
50 | |||
diff --git a/arch/arm/plat-omap/include/plat/omap16xx.h b/arch/arm/plat-omap/include/plat/omap16xx.h new file mode 100644 index 00000000000..e69e1d857b4 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/omap16xx.h | |||
@@ -0,0 +1,202 @@ | |||
1 | /* arch/arm/plat-omap/include/mach/omap16xx.h | ||
2 | * | ||
3 | * Hardware definitions for TI OMAP1610/5912/1710 processors. | ||
4 | * | ||
5 | * Cleanup for Linux-2.6 by Dirk Behme <dirk.behme@de.bosch.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | * | ||
12 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
13 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
14 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
15 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
16 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
17 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
18 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
19 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
20 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
21 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License along | ||
24 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
25 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | */ | ||
27 | |||
28 | #ifndef __ASM_ARCH_OMAP16XX_H | ||
29 | #define __ASM_ARCH_OMAP16XX_H | ||
30 | |||
31 | /* | ||
32 | * ---------------------------------------------------------------------------- | ||
33 | * Base addresses | ||
34 | * ---------------------------------------------------------------------------- | ||
35 | */ | ||
36 | |||
37 | /* Syntax: XX_BASE = Virtual base address, XX_START = Physical base address */ | ||
38 | |||
39 | #define OMAP16XX_DSP_BASE 0xE0000000 | ||
40 | #define OMAP16XX_DSP_SIZE 0x28000 | ||
41 | #define OMAP16XX_DSP_START 0xE0000000 | ||
42 | |||
43 | #define OMAP16XX_DSPREG_BASE 0xE1000000 | ||
44 | #define OMAP16XX_DSPREG_SIZE SZ_128K | ||
45 | #define OMAP16XX_DSPREG_START 0xE1000000 | ||
46 | |||
47 | #define OMAP16XX_SEC_BASE 0xFFFE4000 | ||
48 | #define OMAP16XX_SEC_DES (OMAP16XX_SEC_BASE + 0x0000) | ||
49 | #define OMAP16XX_SEC_SHA1MD5 (OMAP16XX_SEC_BASE + 0x0800) | ||
50 | #define OMAP16XX_SEC_RNG (OMAP16XX_SEC_BASE + 0x1000) | ||
51 | |||
52 | /* | ||
53 | * --------------------------------------------------------------------------- | ||
54 | * Interrupts | ||
55 | * --------------------------------------------------------------------------- | ||
56 | */ | ||
57 | #define OMAP_IH2_0_BASE (0xfffe0000) | ||
58 | #define OMAP_IH2_1_BASE (0xfffe0100) | ||
59 | #define OMAP_IH2_2_BASE (0xfffe0200) | ||
60 | #define OMAP_IH2_3_BASE (0xfffe0300) | ||
61 | |||
62 | #define OMAP_IH2_0_ITR (OMAP_IH2_0_BASE + 0x00) | ||
63 | #define OMAP_IH2_0_MIR (OMAP_IH2_0_BASE + 0x04) | ||
64 | #define OMAP_IH2_0_SIR_IRQ (OMAP_IH2_0_BASE + 0x10) | ||
65 | #define OMAP_IH2_0_SIR_FIQ (OMAP_IH2_0_BASE + 0x14) | ||
66 | #define OMAP_IH2_0_CONTROL (OMAP_IH2_0_BASE + 0x18) | ||
67 | #define OMAP_IH2_0_ILR0 (OMAP_IH2_0_BASE + 0x1c) | ||
68 | #define OMAP_IH2_0_ISR (OMAP_IH2_0_BASE + 0x9c) | ||
69 | |||
70 | #define OMAP_IH2_1_ITR (OMAP_IH2_1_BASE + 0x00) | ||
71 | #define OMAP_IH2_1_MIR (OMAP_IH2_1_BASE + 0x04) | ||
72 | #define OMAP_IH2_1_SIR_IRQ (OMAP_IH2_1_BASE + 0x10) | ||
73 | #define OMAP_IH2_1_SIR_FIQ (OMAP_IH2_1_BASE + 0x14) | ||
74 | #define OMAP_IH2_1_CONTROL (OMAP_IH2_1_BASE + 0x18) | ||
75 | #define OMAP_IH2_1_ILR1 (OMAP_IH2_1_BASE + 0x1c) | ||
76 | #define OMAP_IH2_1_ISR (OMAP_IH2_1_BASE + 0x9c) | ||
77 | |||
78 | #define OMAP_IH2_2_ITR (OMAP_IH2_2_BASE + 0x00) | ||
79 | #define OMAP_IH2_2_MIR (OMAP_IH2_2_BASE + 0x04) | ||
80 | #define OMAP_IH2_2_SIR_IRQ (OMAP_IH2_2_BASE + 0x10) | ||
81 | #define OMAP_IH2_2_SIR_FIQ (OMAP_IH2_2_BASE + 0x14) | ||
82 | #define OMAP_IH2_2_CONTROL (OMAP_IH2_2_BASE + 0x18) | ||
83 | #define OMAP_IH2_2_ILR2 (OMAP_IH2_2_BASE + 0x1c) | ||
84 | #define OMAP_IH2_2_ISR (OMAP_IH2_2_BASE + 0x9c) | ||
85 | |||
86 | #define OMAP_IH2_3_ITR (OMAP_IH2_3_BASE + 0x00) | ||
87 | #define OMAP_IH2_3_MIR (OMAP_IH2_3_BASE + 0x04) | ||
88 | #define OMAP_IH2_3_SIR_IRQ (OMAP_IH2_3_BASE + 0x10) | ||
89 | #define OMAP_IH2_3_SIR_FIQ (OMAP_IH2_3_BASE + 0x14) | ||
90 | #define OMAP_IH2_3_CONTROL (OMAP_IH2_3_BASE + 0x18) | ||
91 | #define OMAP_IH2_3_ILR3 (OMAP_IH2_3_BASE + 0x1c) | ||
92 | #define OMAP_IH2_3_ISR (OMAP_IH2_3_BASE + 0x9c) | ||
93 | |||
94 | /* | ||
95 | * ---------------------------------------------------------------------------- | ||
96 | * Clocks | ||
97 | * ---------------------------------------------------------------------------- | ||
98 | */ | ||
99 | #define OMAP16XX_ARM_IDLECT3 (CLKGEN_REG_BASE + 0x24) | ||
100 | |||
101 | /* | ||
102 | * ---------------------------------------------------------------------------- | ||
103 | * Pin configuration registers | ||
104 | * ---------------------------------------------------------------------------- | ||
105 | */ | ||
106 | #define OMAP16XX_CONF_VOLTAGE_VDDSHV6 (1 << 8) | ||
107 | #define OMAP16XX_CONF_VOLTAGE_VDDSHV7 (1 << 9) | ||
108 | #define OMAP16XX_CONF_VOLTAGE_VDDSHV8 (1 << 10) | ||
109 | #define OMAP16XX_CONF_VOLTAGE_VDDSHV9 (1 << 11) | ||
110 | #define OMAP16XX_SUBLVDS_CONF_VALID (1 << 13) | ||
111 | |||
112 | /* | ||
113 | * ---------------------------------------------------------------------------- | ||
114 | * System control registers | ||
115 | * ---------------------------------------------------------------------------- | ||
116 | */ | ||
117 | #define OMAP1610_RESET_CONTROL 0xfffe1140 | ||
118 | |||
119 | /* | ||
120 | * --------------------------------------------------------------------------- | ||
121 | * TIPB bus interface | ||
122 | * --------------------------------------------------------------------------- | ||
123 | */ | ||
124 | #define TIPB_SWITCH_BASE (0xfffbc800) | ||
125 | #define OMAP16XX_MMCSD2_SSW_MPU_CONF (TIPB_SWITCH_BASE + 0x160) | ||
126 | |||
127 | /* UART3 Registers Mapping through MPU bus */ | ||
128 | #define UART3_RHR (OMAP1_UART3_BASE + 0) | ||
129 | #define UART3_THR (OMAP1_UART3_BASE + 0) | ||
130 | #define UART3_DLL (OMAP1_UART3_BASE + 0) | ||
131 | #define UART3_IER (OMAP1_UART3_BASE + 4) | ||
132 | #define UART3_DLH (OMAP1_UART3_BASE + 4) | ||
133 | #define UART3_IIR (OMAP1_UART3_BASE + 8) | ||
134 | #define UART3_FCR (OMAP1_UART3_BASE + 8) | ||
135 | #define UART3_EFR (OMAP1_UART3_BASE + 8) | ||
136 | #define UART3_LCR (OMAP1_UART3_BASE + 0x0C) | ||
137 | #define UART3_MCR (OMAP1_UART3_BASE + 0x10) | ||
138 | #define UART3_XON1_ADDR1 (OMAP1_UART3_BASE + 0x10) | ||
139 | #define UART3_XON2_ADDR2 (OMAP1_UART3_BASE + 0x14) | ||
140 | #define UART3_LSR (OMAP1_UART3_BASE + 0x14) | ||
141 | #define UART3_TCR (OMAP1_UART3_BASE + 0x18) | ||
142 | #define UART3_MSR (OMAP1_UART3_BASE + 0x18) | ||
143 | #define UART3_XOFF1 (OMAP1_UART3_BASE + 0x18) | ||
144 | #define UART3_XOFF2 (OMAP1_UART3_BASE + 0x1C) | ||
145 | #define UART3_SPR (OMAP1_UART3_BASE + 0x1C) | ||
146 | #define UART3_TLR (OMAP1_UART3_BASE + 0x1C) | ||
147 | #define UART3_MDR1 (OMAP1_UART3_BASE + 0x20) | ||
148 | #define UART3_MDR2 (OMAP1_UART3_BASE + 0x24) | ||
149 | #define UART3_SFLSR (OMAP1_UART3_BASE + 0x28) | ||
150 | #define UART3_TXFLL (OMAP1_UART3_BASE + 0x28) | ||
151 | #define UART3_RESUME (OMAP1_UART3_BASE + 0x2C) | ||
152 | #define UART3_TXFLH (OMAP1_UART3_BASE + 0x2C) | ||
153 | #define UART3_SFREGL (OMAP1_UART3_BASE + 0x30) | ||
154 | #define UART3_RXFLL (OMAP1_UART3_BASE + 0x30) | ||
155 | #define UART3_SFREGH (OMAP1_UART3_BASE + 0x34) | ||
156 | #define UART3_RXFLH (OMAP1_UART3_BASE + 0x34) | ||
157 | #define UART3_BLR (OMAP1_UART3_BASE + 0x38) | ||
158 | #define UART3_ACREG (OMAP1_UART3_BASE + 0x3C) | ||
159 | #define UART3_DIV16 (OMAP1_UART3_BASE + 0x3C) | ||
160 | #define UART3_SCR (OMAP1_UART3_BASE + 0x40) | ||
161 | #define UART3_SSR (OMAP1_UART3_BASE + 0x44) | ||
162 | #define UART3_EBLR (OMAP1_UART3_BASE + 0x48) | ||
163 | #define UART3_OSC_12M_SEL (OMAP1_UART3_BASE + 0x4C) | ||
164 | #define UART3_MVR (OMAP1_UART3_BASE + 0x50) | ||
165 | |||
166 | /* | ||
167 | * --------------------------------------------------------------------------- | ||
168 | * Watchdog timer | ||
169 | * --------------------------------------------------------------------------- | ||
170 | */ | ||
171 | |||
172 | /* 32-bit Watchdog timer in OMAP 16XX */ | ||
173 | #define OMAP_16XX_WATCHDOG_BASE (0xfffeb000) | ||
174 | #define OMAP_16XX_WIDR (OMAP_16XX_WATCHDOG_BASE + 0x00) | ||
175 | #define OMAP_16XX_WD_SYSCONFIG (OMAP_16XX_WATCHDOG_BASE + 0x10) | ||
176 | #define OMAP_16XX_WD_SYSSTATUS (OMAP_16XX_WATCHDOG_BASE + 0x14) | ||
177 | #define OMAP_16XX_WCLR (OMAP_16XX_WATCHDOG_BASE + 0x24) | ||
178 | #define OMAP_16XX_WCRR (OMAP_16XX_WATCHDOG_BASE + 0x28) | ||
179 | #define OMAP_16XX_WLDR (OMAP_16XX_WATCHDOG_BASE + 0x2c) | ||
180 | #define OMAP_16XX_WTGR (OMAP_16XX_WATCHDOG_BASE + 0x30) | ||
181 | #define OMAP_16XX_WWPS (OMAP_16XX_WATCHDOG_BASE + 0x34) | ||
182 | #define OMAP_16XX_WSPR (OMAP_16XX_WATCHDOG_BASE + 0x48) | ||
183 | |||
184 | #define WCLR_PRE_SHIFT 5 | ||
185 | #define WCLR_PTV_SHIFT 2 | ||
186 | |||
187 | #define WWPS_W_PEND_WSPR (1 << 4) | ||
188 | #define WWPS_W_PEND_WTGR (1 << 3) | ||
189 | #define WWPS_W_PEND_WLDR (1 << 2) | ||
190 | #define WWPS_W_PEND_WCRR (1 << 1) | ||
191 | #define WWPS_W_PEND_WCLR (1 << 0) | ||
192 | |||
193 | #define WSPR_ENABLE_0 (0x0000bbbb) | ||
194 | #define WSPR_ENABLE_1 (0x00004444) | ||
195 | #define WSPR_DISABLE_0 (0x0000aaaa) | ||
196 | #define WSPR_DISABLE_1 (0x00005555) | ||
197 | |||
198 | #define OMAP16XX_DSP_MMU_BASE (0xfffed200) | ||
199 | #define OMAP16XX_MAILBOX_BASE (0xfffcf000) | ||
200 | |||
201 | #endif /* __ASM_ARCH_OMAP16XX_H */ | ||
202 | |||
diff --git a/arch/arm/plat-omap/include/plat/omap24xx.h b/arch/arm/plat-omap/include/plat/omap24xx.h new file mode 100644 index 00000000000..92df9e27cc5 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/omap24xx.h | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/omap24xx.h | ||
3 | * | ||
4 | * This file contains the processor specific definitions | ||
5 | * of the TI OMAP24XX. | ||
6 | * | ||
7 | * Copyright (C) 2007 Texas Instruments. | ||
8 | * Copyright (C) 2007 Nokia Corporation. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | * | ||
24 | */ | ||
25 | |||
26 | #ifndef __ASM_ARCH_OMAP2_H | ||
27 | #define __ASM_ARCH_OMAP2_H | ||
28 | |||
29 | /* | ||
30 | * Please place only base defines here and put the rest in device | ||
31 | * specific headers. Note also that some of these defines are needed | ||
32 | * for omap1 to compile without adding ifdefs. | ||
33 | */ | ||
34 | |||
35 | #define L4_24XX_BASE 0x48000000 | ||
36 | #define L4_WK_243X_BASE 0x49000000 | ||
37 | #define L3_24XX_BASE 0x68000000 | ||
38 | |||
39 | /* interrupt controller */ | ||
40 | #define OMAP24XX_IC_BASE (L4_24XX_BASE + 0xfe000) | ||
41 | #define OMAP24XX_IVA_INTC_BASE 0x40000000 | ||
42 | |||
43 | #define OMAP242X_CTRL_BASE L4_24XX_BASE | ||
44 | #define OMAP2420_32KSYNCT_BASE (L4_24XX_BASE + 0x4000) | ||
45 | #define OMAP2420_PRCM_BASE (L4_24XX_BASE + 0x8000) | ||
46 | #define OMAP2420_CM_BASE (L4_24XX_BASE + 0x8000) | ||
47 | #define OMAP2420_PRM_BASE OMAP2420_CM_BASE | ||
48 | #define OMAP2420_SDRC_BASE (L3_24XX_BASE + 0x9000) | ||
49 | #define OMAP2420_SMS_BASE 0x68008000 | ||
50 | #define OMAP2420_GPMC_BASE 0x6800a000 | ||
51 | |||
52 | #define OMAP2430_32KSYNCT_BASE (L4_WK_243X_BASE + 0x20000) | ||
53 | #define OMAP2430_PRCM_BASE (L4_WK_243X_BASE + 0x6000) | ||
54 | #define OMAP2430_CM_BASE (L4_WK_243X_BASE + 0x6000) | ||
55 | #define OMAP2430_PRM_BASE OMAP2430_CM_BASE | ||
56 | |||
57 | #define OMAP243X_SMS_BASE 0x6C000000 | ||
58 | #define OMAP243X_SDRC_BASE 0x6D000000 | ||
59 | #define OMAP243X_GPMC_BASE 0x6E000000 | ||
60 | #define OMAP243X_SCM_BASE (L4_WK_243X_BASE + 0x2000) | ||
61 | #define OMAP243X_CTRL_BASE OMAP243X_SCM_BASE | ||
62 | #define OMAP243X_HS_BASE (L4_24XX_BASE + 0x000ac000) | ||
63 | |||
64 | /* DSP SS */ | ||
65 | #define OMAP2420_DSP_BASE 0x58000000 | ||
66 | #define OMAP2420_DSP_MEM_BASE (OMAP2420_DSP_BASE + 0x0) | ||
67 | #define OMAP2420_DSP_IPI_BASE (OMAP2420_DSP_BASE + 0x1000000) | ||
68 | #define OMAP2420_DSP_MMU_BASE (OMAP2420_DSP_BASE + 0x2000000) | ||
69 | |||
70 | #define OMAP243X_DSP_BASE 0x5C000000 | ||
71 | #define OMAP243X_DSP_MEM_BASE (OMAP243X_DSP_BASE + 0x0) | ||
72 | #define OMAP243X_DSP_MMU_BASE (OMAP243X_DSP_BASE + 0x1000000) | ||
73 | |||
74 | /* Mailbox */ | ||
75 | #define OMAP24XX_MAILBOX_BASE (L4_24XX_BASE + 0x94000) | ||
76 | |||
77 | /* Camera */ | ||
78 | #define OMAP24XX_CAMERA_BASE (L4_24XX_BASE + 0x52000) | ||
79 | |||
80 | /* Security */ | ||
81 | #define OMAP24XX_SEC_BASE (L4_24XX_BASE + 0xA0000) | ||
82 | #define OMAP24XX_SEC_RNG_BASE (OMAP24XX_SEC_BASE + 0x0000) | ||
83 | #define OMAP24XX_SEC_DES_BASE (OMAP24XX_SEC_BASE + 0x2000) | ||
84 | #define OMAP24XX_SEC_SHA1MD5_BASE (OMAP24XX_SEC_BASE + 0x4000) | ||
85 | #define OMAP24XX_SEC_AES_BASE (OMAP24XX_SEC_BASE + 0x6000) | ||
86 | #define OMAP24XX_SEC_PKA_BASE (OMAP24XX_SEC_BASE + 0x8000) | ||
87 | |||
88 | #endif /* __ASM_ARCH_OMAP2_H */ | ||
89 | |||
diff --git a/arch/arm/plat-omap/include/plat/omap34xx.h b/arch/arm/plat-omap/include/plat/omap34xx.h new file mode 100644 index 00000000000..b9e85886b9d --- /dev/null +++ b/arch/arm/plat-omap/include/plat/omap34xx.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/omap34xx.h | ||
3 | * | ||
4 | * This file contains the processor specific definitions of the TI OMAP34XX. | ||
5 | * | ||
6 | * Copyright (C) 2007 Texas Instruments. | ||
7 | * Copyright (C) 2007 Nokia Corporation. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | |||
24 | #ifndef __ASM_ARCH_OMAP3_H | ||
25 | #define __ASM_ARCH_OMAP3_H | ||
26 | |||
27 | /* | ||
28 | * Please place only base defines here and put the rest in device | ||
29 | * specific headers. | ||
30 | */ | ||
31 | |||
32 | #define L4_34XX_BASE 0x48000000 | ||
33 | #define L4_WK_34XX_BASE 0x48300000 | ||
34 | #define L4_PER_34XX_BASE 0x49000000 | ||
35 | #define L4_EMU_34XX_BASE 0x54000000 | ||
36 | #define L3_34XX_BASE 0x68000000 | ||
37 | |||
38 | #define OMAP3430_32KSYNCT_BASE 0x48320000 | ||
39 | #define OMAP3430_CM_BASE 0x48004800 | ||
40 | #define OMAP3430_PRM_BASE 0x48306800 | ||
41 | #define OMAP343X_SMS_BASE 0x6C000000 | ||
42 | #define OMAP343X_SDRC_BASE 0x6D000000 | ||
43 | #define OMAP34XX_GPMC_BASE 0x6E000000 | ||
44 | #define OMAP343X_SCM_BASE 0x48002000 | ||
45 | #define OMAP343X_CTRL_BASE OMAP343X_SCM_BASE | ||
46 | |||
47 | #define OMAP34XX_IC_BASE 0x48200000 | ||
48 | |||
49 | #define OMAP3430_ISP_BASE (L4_34XX_BASE + 0xBC000) | ||
50 | #define OMAP3430_ISP_CBUFF_BASE (OMAP3430_ISP_BASE + 0x0100) | ||
51 | #define OMAP3430_ISP_CCP2_BASE (OMAP3430_ISP_BASE + 0x0400) | ||
52 | #define OMAP3430_ISP_CCDC_BASE (OMAP3430_ISP_BASE + 0x0600) | ||
53 | #define OMAP3430_ISP_HIST_BASE (OMAP3430_ISP_BASE + 0x0A00) | ||
54 | #define OMAP3430_ISP_H3A_BASE (OMAP3430_ISP_BASE + 0x0C00) | ||
55 | #define OMAP3430_ISP_PREV_BASE (OMAP3430_ISP_BASE + 0x0E00) | ||
56 | #define OMAP3430_ISP_RESZ_BASE (OMAP3430_ISP_BASE + 0x1000) | ||
57 | #define OMAP3430_ISP_SBL_BASE (OMAP3430_ISP_BASE + 0x1200) | ||
58 | #define OMAP3430_ISP_MMU_BASE (OMAP3430_ISP_BASE + 0x1400) | ||
59 | #define OMAP3430_ISP_CSI2A_REGS1_BASE (OMAP3430_ISP_BASE + 0x1800) | ||
60 | #define OMAP3430_ISP_CSIPHY2_BASE (OMAP3430_ISP_BASE + 0x1970) | ||
61 | #define OMAP3630_ISP_CSI2A_REGS2_BASE (OMAP3430_ISP_BASE + 0x19C0) | ||
62 | #define OMAP3630_ISP_CSI2C_REGS1_BASE (OMAP3430_ISP_BASE + 0x1C00) | ||
63 | #define OMAP3630_ISP_CSIPHY1_BASE (OMAP3430_ISP_BASE + 0x1D70) | ||
64 | #define OMAP3630_ISP_CSI2C_REGS2_BASE (OMAP3430_ISP_BASE + 0x1DC0) | ||
65 | |||
66 | #define OMAP3430_ISP_END (OMAP3430_ISP_BASE + 0x06F) | ||
67 | #define OMAP3430_ISP_CBUFF_END (OMAP3430_ISP_CBUFF_BASE + 0x077) | ||
68 | #define OMAP3430_ISP_CCP2_END (OMAP3430_ISP_CCP2_BASE + 0x1EF) | ||
69 | #define OMAP3430_ISP_CCDC_END (OMAP3430_ISP_CCDC_BASE + 0x0A7) | ||
70 | #define OMAP3430_ISP_HIST_END (OMAP3430_ISP_HIST_BASE + 0x047) | ||
71 | #define OMAP3430_ISP_H3A_END (OMAP3430_ISP_H3A_BASE + 0x05F) | ||
72 | #define OMAP3430_ISP_PREV_END (OMAP3430_ISP_PREV_BASE + 0x09F) | ||
73 | #define OMAP3430_ISP_RESZ_END (OMAP3430_ISP_RESZ_BASE + 0x0AB) | ||
74 | #define OMAP3430_ISP_SBL_END (OMAP3430_ISP_SBL_BASE + 0x0FB) | ||
75 | #define OMAP3430_ISP_MMU_END (OMAP3430_ISP_MMU_BASE + 0x06F) | ||
76 | #define OMAP3430_ISP_CSI2A_REGS1_END (OMAP3430_ISP_CSI2A_REGS1_BASE + 0x16F) | ||
77 | #define OMAP3430_ISP_CSIPHY2_END (OMAP3430_ISP_CSIPHY2_BASE + 0x00B) | ||
78 | #define OMAP3630_ISP_CSI2A_REGS2_END (OMAP3630_ISP_CSI2A_REGS2_BASE + 0x3F) | ||
79 | #define OMAP3630_ISP_CSI2C_REGS1_END (OMAP3630_ISP_CSI2C_REGS1_BASE + 0x16F) | ||
80 | #define OMAP3630_ISP_CSIPHY1_END (OMAP3630_ISP_CSIPHY1_BASE + 0x00B) | ||
81 | #define OMAP3630_ISP_CSI2C_REGS2_END (OMAP3630_ISP_CSI2C_REGS2_BASE + 0x3F) | ||
82 | |||
83 | #define OMAP34XX_HSUSB_OTG_BASE (L4_34XX_BASE + 0xAB000) | ||
84 | #define OMAP34XX_USBTLL_BASE (L4_34XX_BASE + 0x62000) | ||
85 | #define OMAP34XX_UHH_CONFIG_BASE (L4_34XX_BASE + 0x64000) | ||
86 | #define OMAP34XX_OHCI_BASE (L4_34XX_BASE + 0x64400) | ||
87 | #define OMAP34XX_EHCI_BASE (L4_34XX_BASE + 0x64800) | ||
88 | #define OMAP34XX_SR1_BASE 0x480C9000 | ||
89 | #define OMAP34XX_SR2_BASE 0x480CB000 | ||
90 | |||
91 | #define OMAP34XX_MAILBOX_BASE (L4_34XX_BASE + 0x94000) | ||
92 | |||
93 | /* Security */ | ||
94 | #define OMAP34XX_SEC_BASE (L4_34XX_BASE + 0xA0000) | ||
95 | #define OMAP34XX_SEC_SHA1MD5_BASE (OMAP34XX_SEC_BASE + 0x23000) | ||
96 | #define OMAP34XX_SEC_AES_BASE (OMAP34XX_SEC_BASE + 0x25000) | ||
97 | |||
98 | #endif /* __ASM_ARCH_OMAP3_H */ | ||
99 | |||
diff --git a/arch/arm/plat-omap/include/plat/omap4-keypad.h b/arch/arm/plat-omap/include/plat/omap4-keypad.h new file mode 100644 index 00000000000..9fe6c878323 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/omap4-keypad.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef ARCH_ARM_PLAT_OMAP4_KEYPAD_H | ||
2 | #define ARCH_ARM_PLAT_OMAP4_KEYPAD_H | ||
3 | |||
4 | #include <linux/input/matrix_keypad.h> | ||
5 | |||
6 | struct omap4_keypad_platform_data { | ||
7 | const struct matrix_keymap_data *keymap_data; | ||
8 | |||
9 | u8 rows; | ||
10 | u8 cols; | ||
11 | }; | ||
12 | |||
13 | extern int omap4_keyboard_init(struct omap4_keypad_platform_data *, | ||
14 | struct omap_board_data *); | ||
15 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/omap44xx.h b/arch/arm/plat-omap/include/plat/omap44xx.h new file mode 100644 index 00000000000..ea2b8a6306e --- /dev/null +++ b/arch/arm/plat-omap/include/plat/omap44xx.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /*: | ||
2 | * Address mappings and base address for OMAP4 interconnects | ||
3 | * and peripherals. | ||
4 | * | ||
5 | * Copyright (C) 2009 Texas Instruments | ||
6 | * | ||
7 | * Author: Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | #ifndef __ASM_ARCH_OMAP44XX_H | ||
14 | #define __ASM_ARCH_OMAP44XX_H | ||
15 | |||
16 | /* | ||
17 | * Please place only base defines here and put the rest in device | ||
18 | * specific headers. | ||
19 | */ | ||
20 | #define L4_44XX_BASE 0x4a000000 | ||
21 | #define L4_WK_44XX_BASE 0x4a300000 | ||
22 | #define L4_PER_44XX_BASE 0x48000000 | ||
23 | #define L4_EMU_44XX_BASE 0x54000000 | ||
24 | #define L3_44XX_BASE 0x44000000 | ||
25 | #define OMAP44XX_EMIF1_BASE 0x4c000000 | ||
26 | #define OMAP44XX_EMIF2_BASE 0x4d000000 | ||
27 | #define OMAP44XX_DMM_BASE 0x4e000000 | ||
28 | #define OMAP4430_32KSYNCT_BASE 0x4a304000 | ||
29 | #define OMAP4430_CM1_BASE 0x4a004000 | ||
30 | #define OMAP4430_CM_BASE OMAP4430_CM1_BASE | ||
31 | #define OMAP4430_CM2_BASE 0x4a008000 | ||
32 | #define OMAP4430_PRM_BASE 0x4a306000 | ||
33 | #define OMAP4430_PRCM_MPU_BASE 0x48243000 | ||
34 | #define OMAP44XX_GPMC_BASE 0x50000000 | ||
35 | #define OMAP443X_SCM_BASE 0x4a002000 | ||
36 | #define OMAP443X_CTRL_BASE 0x4a100000 | ||
37 | #define OMAP44XX_IC_BASE 0x48200000 | ||
38 | #define OMAP44XX_IVA_INTC_BASE 0x40000000 | ||
39 | #define IRQ_SIR_IRQ 0x0040 | ||
40 | #define OMAP44XX_GIC_DIST_BASE 0x48241000 | ||
41 | #define OMAP44XX_GIC_CPU_BASE 0x48240100 | ||
42 | #define OMAP44XX_SCU_BASE 0x48240000 | ||
43 | #define OMAP44XX_LOCAL_TWD_BASE 0x48240600 | ||
44 | #define OMAP44XX_L2CACHE_BASE 0x48242000 | ||
45 | #define OMAP44XX_WKUPGEN_BASE 0x48281000 | ||
46 | #define OMAP44XX_MCPDM_BASE 0x40132000 | ||
47 | #define OMAP44XX_MCPDM_L3_BASE 0x49032000 | ||
48 | |||
49 | #define OMAP44XX_MAILBOX_BASE (L4_44XX_BASE + 0xF4000) | ||
50 | #define OMAP44XX_HSUSB_OTG_BASE (L4_44XX_BASE + 0xAB000) | ||
51 | |||
52 | #define OMAP4_MMU1_BASE 0x55082000 | ||
53 | #define OMAP4_MMU2_BASE 0x4A066000 | ||
54 | |||
55 | #define OMAP44XX_USBTLL_BASE (L4_44XX_BASE + 0x62000) | ||
56 | #define OMAP44XX_UHH_CONFIG_BASE (L4_44XX_BASE + 0x64000) | ||
57 | #define OMAP44XX_HSUSB_OHCI_BASE (L4_44XX_BASE + 0x64800) | ||
58 | #define OMAP44XX_HSUSB_EHCI_BASE (L4_44XX_BASE + 0x64C00) | ||
59 | |||
60 | #endif /* __ASM_ARCH_OMAP44XX_H */ | ||
61 | |||
diff --git a/arch/arm/plat-omap/include/plat/omap730.h b/arch/arm/plat-omap/include/plat/omap730.h new file mode 100644 index 00000000000..14272bc1a6f --- /dev/null +++ b/arch/arm/plat-omap/include/plat/omap730.h | |||
@@ -0,0 +1,102 @@ | |||
1 | /* arch/arm/plat-omap/include/mach/omap730.h | ||
2 | * | ||
3 | * Hardware definitions for TI OMAP730 processor. | ||
4 | * | ||
5 | * Cleanup for Linux-2.6 by Dirk Behme <dirk.behme@de.bosch.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | * | ||
12 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
13 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
14 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
15 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
16 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
17 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
18 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
19 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
20 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
21 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License along | ||
24 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
25 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | */ | ||
27 | |||
28 | #ifndef __ASM_ARCH_OMAP730_H | ||
29 | #define __ASM_ARCH_OMAP730_H | ||
30 | |||
31 | /* | ||
32 | * ---------------------------------------------------------------------------- | ||
33 | * Base addresses | ||
34 | * ---------------------------------------------------------------------------- | ||
35 | */ | ||
36 | |||
37 | /* Syntax: XX_BASE = Virtual base address, XX_START = Physical base address */ | ||
38 | |||
39 | #define OMAP730_DSP_BASE 0xE0000000 | ||
40 | #define OMAP730_DSP_SIZE 0x50000 | ||
41 | #define OMAP730_DSP_START 0xE0000000 | ||
42 | |||
43 | #define OMAP730_DSPREG_BASE 0xE1000000 | ||
44 | #define OMAP730_DSPREG_SIZE SZ_128K | ||
45 | #define OMAP730_DSPREG_START 0xE1000000 | ||
46 | |||
47 | /* | ||
48 | * ---------------------------------------------------------------------------- | ||
49 | * OMAP730 specific configuration registers | ||
50 | * ---------------------------------------------------------------------------- | ||
51 | */ | ||
52 | #define OMAP730_CONFIG_BASE 0xfffe1000 | ||
53 | #define OMAP730_IO_CONF_0 0xfffe1070 | ||
54 | #define OMAP730_IO_CONF_1 0xfffe1074 | ||
55 | #define OMAP730_IO_CONF_2 0xfffe1078 | ||
56 | #define OMAP730_IO_CONF_3 0xfffe107c | ||
57 | #define OMAP730_IO_CONF_4 0xfffe1080 | ||
58 | #define OMAP730_IO_CONF_5 0xfffe1084 | ||
59 | #define OMAP730_IO_CONF_6 0xfffe1088 | ||
60 | #define OMAP730_IO_CONF_7 0xfffe108c | ||
61 | #define OMAP730_IO_CONF_8 0xfffe1090 | ||
62 | #define OMAP730_IO_CONF_9 0xfffe1094 | ||
63 | #define OMAP730_IO_CONF_10 0xfffe1098 | ||
64 | #define OMAP730_IO_CONF_11 0xfffe109c | ||
65 | #define OMAP730_IO_CONF_12 0xfffe10a0 | ||
66 | #define OMAP730_IO_CONF_13 0xfffe10a4 | ||
67 | |||
68 | #define OMAP730_MODE_1 0xfffe1010 | ||
69 | #define OMAP730_MODE_2 0xfffe1014 | ||
70 | |||
71 | /* CSMI specials: in terms of base + offset */ | ||
72 | #define OMAP730_MODE2_OFFSET 0x14 | ||
73 | |||
74 | /* | ||
75 | * ---------------------------------------------------------------------------- | ||
76 | * OMAP730 traffic controller configuration registers | ||
77 | * ---------------------------------------------------------------------------- | ||
78 | */ | ||
79 | #define OMAP730_FLASH_CFG_0 0xfffecc10 | ||
80 | #define OMAP730_FLASH_ACFG_0 0xfffecc50 | ||
81 | #define OMAP730_FLASH_CFG_1 0xfffecc14 | ||
82 | #define OMAP730_FLASH_ACFG_1 0xfffecc54 | ||
83 | |||
84 | /* | ||
85 | * ---------------------------------------------------------------------------- | ||
86 | * OMAP730 DSP control registers | ||
87 | * ---------------------------------------------------------------------------- | ||
88 | */ | ||
89 | #define OMAP730_ICR_BASE 0xfffbb800 | ||
90 | #define OMAP730_DSP_M_CTL 0xfffbb804 | ||
91 | #define OMAP730_DSP_MMU_BASE 0xfffed200 | ||
92 | |||
93 | /* | ||
94 | * ---------------------------------------------------------------------------- | ||
95 | * OMAP730 PCC_UPLD configuration registers | ||
96 | * ---------------------------------------------------------------------------- | ||
97 | */ | ||
98 | #define OMAP730_PCC_UPLD_CTRL_BASE (0xfffe0900) | ||
99 | #define OMAP730_PCC_UPLD_CTRL (OMAP730_PCC_UPLD_CTRL_BASE + 0x00) | ||
100 | |||
101 | #endif /* __ASM_ARCH_OMAP730_H */ | ||
102 | |||
diff --git a/arch/arm/plat-omap/include/plat/omap7xx.h b/arch/arm/plat-omap/include/plat/omap7xx.h new file mode 100644 index 00000000000..48e4757e1e3 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/omap7xx.h | |||
@@ -0,0 +1,107 @@ | |||
1 | /* arch/arm/plat-omap/include/mach/omap7xx.h | ||
2 | * | ||
3 | * Hardware definitions for TI OMAP7XX processor. | ||
4 | * | ||
5 | * Cleanup for Linux-2.6 by Dirk Behme <dirk.behme@de.bosch.com> | ||
6 | * Adapted for omap850 by Zebediah C. McClure <zmc@lurian.net> | ||
7 | * Adapted for omap7xx by Alistair Buxton <a.j.buxton@gmail.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
17 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
20 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License along | ||
26 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
27 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | */ | ||
29 | |||
30 | #ifndef __ASM_ARCH_OMAP7XX_H | ||
31 | #define __ASM_ARCH_OMAP7XX_H | ||
32 | |||
33 | /* | ||
34 | * ---------------------------------------------------------------------------- | ||
35 | * Base addresses | ||
36 | * ---------------------------------------------------------------------------- | ||
37 | */ | ||
38 | |||
39 | /* Syntax: XX_BASE = Virtual base address, XX_START = Physical base address */ | ||
40 | |||
41 | #define OMAP7XX_DSP_BASE 0xE0000000 | ||
42 | #define OMAP7XX_DSP_SIZE 0x50000 | ||
43 | #define OMAP7XX_DSP_START 0xE0000000 | ||
44 | |||
45 | #define OMAP7XX_DSPREG_BASE 0xE1000000 | ||
46 | #define OMAP7XX_DSPREG_SIZE SZ_128K | ||
47 | #define OMAP7XX_DSPREG_START 0xE1000000 | ||
48 | |||
49 | #define OMAP7XX_SPI1_BASE 0xfffc0800 | ||
50 | #define OMAP7XX_SPI2_BASE 0xfffc1000 | ||
51 | |||
52 | /* | ||
53 | * ---------------------------------------------------------------------------- | ||
54 | * OMAP7XX specific configuration registers | ||
55 | * ---------------------------------------------------------------------------- | ||
56 | */ | ||
57 | #define OMAP7XX_CONFIG_BASE 0xfffe1000 | ||
58 | #define OMAP7XX_IO_CONF_0 0xfffe1070 | ||
59 | #define OMAP7XX_IO_CONF_1 0xfffe1074 | ||
60 | #define OMAP7XX_IO_CONF_2 0xfffe1078 | ||
61 | #define OMAP7XX_IO_CONF_3 0xfffe107c | ||
62 | #define OMAP7XX_IO_CONF_4 0xfffe1080 | ||
63 | #define OMAP7XX_IO_CONF_5 0xfffe1084 | ||
64 | #define OMAP7XX_IO_CONF_6 0xfffe1088 | ||
65 | #define OMAP7XX_IO_CONF_7 0xfffe108c | ||
66 | #define OMAP7XX_IO_CONF_8 0xfffe1090 | ||
67 | #define OMAP7XX_IO_CONF_9 0xfffe1094 | ||
68 | #define OMAP7XX_IO_CONF_10 0xfffe1098 | ||
69 | #define OMAP7XX_IO_CONF_11 0xfffe109c | ||
70 | #define OMAP7XX_IO_CONF_12 0xfffe10a0 | ||
71 | #define OMAP7XX_IO_CONF_13 0xfffe10a4 | ||
72 | |||
73 | #define OMAP7XX_MODE_1 0xfffe1010 | ||
74 | #define OMAP7XX_MODE_2 0xfffe1014 | ||
75 | |||
76 | /* CSMI specials: in terms of base + offset */ | ||
77 | #define OMAP7XX_MODE2_OFFSET 0x14 | ||
78 | |||
79 | /* | ||
80 | * ---------------------------------------------------------------------------- | ||
81 | * OMAP7XX traffic controller configuration registers | ||
82 | * ---------------------------------------------------------------------------- | ||
83 | */ | ||
84 | #define OMAP7XX_FLASH_CFG_0 0xfffecc10 | ||
85 | #define OMAP7XX_FLASH_ACFG_0 0xfffecc50 | ||
86 | #define OMAP7XX_FLASH_CFG_1 0xfffecc14 | ||
87 | #define OMAP7XX_FLASH_ACFG_1 0xfffecc54 | ||
88 | |||
89 | /* | ||
90 | * ---------------------------------------------------------------------------- | ||
91 | * OMAP7XX DSP control registers | ||
92 | * ---------------------------------------------------------------------------- | ||
93 | */ | ||
94 | #define OMAP7XX_ICR_BASE 0xfffbb800 | ||
95 | #define OMAP7XX_DSP_M_CTL 0xfffbb804 | ||
96 | #define OMAP7XX_DSP_MMU_BASE 0xfffed200 | ||
97 | |||
98 | /* | ||
99 | * ---------------------------------------------------------------------------- | ||
100 | * OMAP7XX PCC_UPLD configuration registers | ||
101 | * ---------------------------------------------------------------------------- | ||
102 | */ | ||
103 | #define OMAP7XX_PCC_UPLD_CTRL_BASE (0xfffe0900) | ||
104 | #define OMAP7XX_PCC_UPLD_CTRL (OMAP7XX_PCC_UPLD_CTRL_BASE + 0x00) | ||
105 | |||
106 | #endif /* __ASM_ARCH_OMAP7XX_H */ | ||
107 | |||
diff --git a/arch/arm/plat-omap/include/plat/omap850.h b/arch/arm/plat-omap/include/plat/omap850.h new file mode 100644 index 00000000000..c33f6798171 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/omap850.h | |||
@@ -0,0 +1,102 @@ | |||
1 | /* arch/arm/plat-omap/include/mach/omap850.h | ||
2 | * | ||
3 | * Hardware definitions for TI OMAP850 processor. | ||
4 | * | ||
5 | * Derived from omap730.h by Zebediah C. McClure <zmc@lurian.net> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | * | ||
12 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
13 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
14 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
15 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
16 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
17 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
18 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
19 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
20 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
21 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License along | ||
24 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
25 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | */ | ||
27 | |||
28 | #ifndef __ASM_ARCH_OMAP850_H | ||
29 | #define __ASM_ARCH_OMAP850_H | ||
30 | |||
31 | /* | ||
32 | * ---------------------------------------------------------------------------- | ||
33 | * Base addresses | ||
34 | * ---------------------------------------------------------------------------- | ||
35 | */ | ||
36 | |||
37 | /* Syntax: XX_BASE = Virtual base address, XX_START = Physical base address */ | ||
38 | |||
39 | #define OMAP850_DSP_BASE 0xE0000000 | ||
40 | #define OMAP850_DSP_SIZE 0x50000 | ||
41 | #define OMAP850_DSP_START 0xE0000000 | ||
42 | |||
43 | #define OMAP850_DSPREG_BASE 0xE1000000 | ||
44 | #define OMAP850_DSPREG_SIZE SZ_128K | ||
45 | #define OMAP850_DSPREG_START 0xE1000000 | ||
46 | |||
47 | /* | ||
48 | * ---------------------------------------------------------------------------- | ||
49 | * OMAP850 specific configuration registers | ||
50 | * ---------------------------------------------------------------------------- | ||
51 | */ | ||
52 | #define OMAP850_CONFIG_BASE 0xfffe1000 | ||
53 | #define OMAP850_IO_CONF_0 0xfffe1070 | ||
54 | #define OMAP850_IO_CONF_1 0xfffe1074 | ||
55 | #define OMAP850_IO_CONF_2 0xfffe1078 | ||
56 | #define OMAP850_IO_CONF_3 0xfffe107c | ||
57 | #define OMAP850_IO_CONF_4 0xfffe1080 | ||
58 | #define OMAP850_IO_CONF_5 0xfffe1084 | ||
59 | #define OMAP850_IO_CONF_6 0xfffe1088 | ||
60 | #define OMAP850_IO_CONF_7 0xfffe108c | ||
61 | #define OMAP850_IO_CONF_8 0xfffe1090 | ||
62 | #define OMAP850_IO_CONF_9 0xfffe1094 | ||
63 | #define OMAP850_IO_CONF_10 0xfffe1098 | ||
64 | #define OMAP850_IO_CONF_11 0xfffe109c | ||
65 | #define OMAP850_IO_CONF_12 0xfffe10a0 | ||
66 | #define OMAP850_IO_CONF_13 0xfffe10a4 | ||
67 | |||
68 | #define OMAP850_MODE_1 0xfffe1010 | ||
69 | #define OMAP850_MODE_2 0xfffe1014 | ||
70 | |||
71 | /* CSMI specials: in terms of base + offset */ | ||
72 | #define OMAP850_MODE2_OFFSET 0x14 | ||
73 | |||
74 | /* | ||
75 | * ---------------------------------------------------------------------------- | ||
76 | * OMAP850 traffic controller configuration registers | ||
77 | * ---------------------------------------------------------------------------- | ||
78 | */ | ||
79 | #define OMAP850_FLASH_CFG_0 0xfffecc10 | ||
80 | #define OMAP850_FLASH_ACFG_0 0xfffecc50 | ||
81 | #define OMAP850_FLASH_CFG_1 0xfffecc14 | ||
82 | #define OMAP850_FLASH_ACFG_1 0xfffecc54 | ||
83 | |||
84 | /* | ||
85 | * ---------------------------------------------------------------------------- | ||
86 | * OMAP850 DSP control registers | ||
87 | * ---------------------------------------------------------------------------- | ||
88 | */ | ||
89 | #define OMAP850_ICR_BASE 0xfffbb800 | ||
90 | #define OMAP850_DSP_M_CTL 0xfffbb804 | ||
91 | #define OMAP850_DSP_MMU_BASE 0xfffed200 | ||
92 | |||
93 | /* | ||
94 | * ---------------------------------------------------------------------------- | ||
95 | * OMAP850 PCC_UPLD configuration registers | ||
96 | * ---------------------------------------------------------------------------- | ||
97 | */ | ||
98 | #define OMAP850_PCC_UPLD_CTRL_BASE (0xfffe0900) | ||
99 | #define OMAP850_PCC_UPLD_CTRL (OMAP850_PCC_UPLD_CTRL_BASE + 0x00) | ||
100 | |||
101 | #endif /* __ASM_ARCH_OMAP850_H */ | ||
102 | |||
diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h new file mode 100644 index 00000000000..ee405b36df4 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/omap_device.h | |||
@@ -0,0 +1,162 @@ | |||
1 | /* | ||
2 | * omap_device headers | ||
3 | * | ||
4 | * Copyright (C) 2009 Nokia Corporation | ||
5 | * Paul Walmsley | ||
6 | * | ||
7 | * Developed in collaboration with (alphabetical order): Benoit | ||
8 | * Cousson, Kevin Hilman, Tony Lindgren, Rajendra Nayak, Vikram | ||
9 | * Pandita, Sakari Poussa, Anand Sawant, Santosh Shilimkar, Richard | ||
10 | * Woodruff | ||
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 | * Eventually this type of functionality should either be | ||
17 | * a) implemented via arch-specific pointers in platform_device | ||
18 | * or | ||
19 | * b) implemented as a proper omap_bus/omap_device in Linux, no more | ||
20 | * platform_device | ||
21 | * | ||
22 | * omap_device differs from omap_hwmod in that it includes external | ||
23 | * (e.g., board- and system-level) integration details. omap_hwmod | ||
24 | * stores hardware data that is invariant for a given OMAP chip. | ||
25 | * | ||
26 | * To do: | ||
27 | * - GPIO integration | ||
28 | * - regulator integration | ||
29 | * | ||
30 | */ | ||
31 | #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_DEVICE_H | ||
32 | #define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_DEVICE_H | ||
33 | |||
34 | #include <linux/kernel.h> | ||
35 | #include <linux/platform_device.h> | ||
36 | |||
37 | #include <plat/omap_hwmod.h> | ||
38 | |||
39 | extern struct device omap_device_parent; | ||
40 | |||
41 | /* omap_device._state values */ | ||
42 | #define OMAP_DEVICE_STATE_UNKNOWN 0 | ||
43 | #define OMAP_DEVICE_STATE_ENABLED 1 | ||
44 | #define OMAP_DEVICE_STATE_IDLE 2 | ||
45 | #define OMAP_DEVICE_STATE_SHUTDOWN 3 | ||
46 | |||
47 | /* omap_device.flags values */ | ||
48 | #define OMAP_DEVICE_SUSPENDED BIT(0) | ||
49 | #define OMAP_DEVICE_NO_IDLE_ON_SUSPEND BIT(1) | ||
50 | |||
51 | /** | ||
52 | * struct omap_device - omap_device wrapper for platform_devices | ||
53 | * @pdev: platform_device | ||
54 | * @hwmods: (one .. many per omap_device) | ||
55 | * @hwmods_cnt: ARRAY_SIZE() of @hwmods | ||
56 | * @pm_lats: ptr to an omap_device_pm_latency table | ||
57 | * @pm_lats_cnt: ARRAY_SIZE() of what is passed to @pm_lats | ||
58 | * @pm_lat_level: array index of the last odpl entry executed - -1 if never | ||
59 | * @dev_wakeup_lat: dev wakeup latency in nanoseconds | ||
60 | * @_dev_wakeup_lat_limit: dev wakeup latency limit in nsec - set by OMAP PM | ||
61 | * @_state: one of OMAP_DEVICE_STATE_* (see above) | ||
62 | * @flags: device flags | ||
63 | * | ||
64 | * Integrates omap_hwmod data into Linux platform_device. | ||
65 | * | ||
66 | * Field names beginning with underscores are for the internal use of | ||
67 | * the omap_device code. | ||
68 | * | ||
69 | */ | ||
70 | struct omap_device { | ||
71 | struct platform_device pdev; | ||
72 | struct omap_hwmod **hwmods; | ||
73 | struct omap_device_pm_latency *pm_lats; | ||
74 | u32 dev_wakeup_lat; | ||
75 | u32 _dev_wakeup_lat_limit; | ||
76 | u8 pm_lats_cnt; | ||
77 | s8 pm_lat_level; | ||
78 | u8 hwmods_cnt; | ||
79 | u8 _state; | ||
80 | u8 flags; | ||
81 | }; | ||
82 | |||
83 | /* Device driver interface (call via platform_data fn ptrs) */ | ||
84 | |||
85 | int omap_device_enable(struct platform_device *pdev); | ||
86 | int omap_device_idle(struct platform_device *pdev); | ||
87 | int omap_device_shutdown(struct platform_device *pdev); | ||
88 | |||
89 | /* Core code interface */ | ||
90 | |||
91 | int omap_device_count_resources(struct omap_device *od); | ||
92 | int omap_device_fill_resources(struct omap_device *od, struct resource *res); | ||
93 | |||
94 | struct omap_device *omap_device_build(const char *pdev_name, int pdev_id, | ||
95 | struct omap_hwmod *oh, void *pdata, | ||
96 | int pdata_len, | ||
97 | struct omap_device_pm_latency *pm_lats, | ||
98 | int pm_lats_cnt, int is_early_device); | ||
99 | |||
100 | struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, | ||
101 | struct omap_hwmod **oh, int oh_cnt, | ||
102 | void *pdata, int pdata_len, | ||
103 | struct omap_device_pm_latency *pm_lats, | ||
104 | int pm_lats_cnt, int is_early_device); | ||
105 | |||
106 | int omap_device_register(struct omap_device *od); | ||
107 | int omap_early_device_register(struct omap_device *od); | ||
108 | |||
109 | void __iomem *omap_device_get_rt_va(struct omap_device *od); | ||
110 | |||
111 | /* OMAP PM interface */ | ||
112 | int omap_device_align_pm_lat(struct platform_device *pdev, | ||
113 | u32 new_wakeup_lat_limit); | ||
114 | struct powerdomain *omap_device_get_pwrdm(struct omap_device *od); | ||
115 | u32 omap_device_get_context_loss_count(struct platform_device *pdev); | ||
116 | |||
117 | /* Other */ | ||
118 | |||
119 | int omap_device_idle_hwmods(struct omap_device *od); | ||
120 | int omap_device_enable_hwmods(struct omap_device *od); | ||
121 | |||
122 | int omap_device_disable_clocks(struct omap_device *od); | ||
123 | int omap_device_enable_clocks(struct omap_device *od); | ||
124 | |||
125 | static inline void omap_device_disable_idle_on_suspend(struct omap_device *od) | ||
126 | { | ||
127 | od->flags |= OMAP_DEVICE_NO_IDLE_ON_SUSPEND; | ||
128 | } | ||
129 | |||
130 | /* | ||
131 | * Entries should be kept in latency order ascending | ||
132 | * | ||
133 | * deact_lat is the maximum number of microseconds required to complete | ||
134 | * deactivate_func() at the device's slowest OPP. | ||
135 | * | ||
136 | * act_lat is the maximum number of microseconds required to complete | ||
137 | * activate_func() at the device's slowest OPP. | ||
138 | * | ||
139 | * This will result in some suboptimal power management decisions at fast | ||
140 | * OPPs, but avoids having to recompute all device power management decisions | ||
141 | * if the system shifts from a fast OPP to a slow OPP (in order to meet | ||
142 | * latency requirements). | ||
143 | * | ||
144 | * XXX should deactivate_func/activate_func() take platform_device pointers | ||
145 | * rather than omap_device pointers? | ||
146 | */ | ||
147 | struct omap_device_pm_latency { | ||
148 | u32 deactivate_lat; | ||
149 | u32 deactivate_lat_worst; | ||
150 | int (*deactivate_func)(struct omap_device *od); | ||
151 | u32 activate_lat; | ||
152 | u32 activate_lat_worst; | ||
153 | int (*activate_func)(struct omap_device *od); | ||
154 | u32 flags; | ||
155 | }; | ||
156 | |||
157 | #define OMAP_DEVICE_LATENCY_AUTO_ADJUST BIT(1) | ||
158 | |||
159 | /* Get omap_device pointer from platform_device pointer */ | ||
160 | #define to_omap_device(x) container_of((x), struct omap_device, pdev) | ||
161 | |||
162 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h new file mode 100644 index 00000000000..0e329ca88a7 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h | |||
@@ -0,0 +1,619 @@ | |||
1 | /* | ||
2 | * omap_hwmod macros, structures | ||
3 | * | ||
4 | * Copyright (C) 2009-2011 Nokia Corporation | ||
5 | * Copyright (C) 2011 Texas Instruments, Inc. | ||
6 | * Paul Walmsley | ||
7 | * | ||
8 | * Created in collaboration with (alphabetical order): Benoît Cousson, | ||
9 | * Kevin Hilman, Tony Lindgren, Rajendra Nayak, Vikram Pandita, Sakari | ||
10 | * Poussa, Anand Sawant, Santosh Shilimkar, Richard Woodruff | ||
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 | * These headers and macros are used to define OMAP on-chip module | ||
17 | * data and their integration with other OMAP modules and Linux. | ||
18 | * Copious documentation and references can also be found in the | ||
19 | * omap_hwmod code, in arch/arm/mach-omap2/omap_hwmod.c (as of this | ||
20 | * writing). | ||
21 | * | ||
22 | * To do: | ||
23 | * - add interconnect error log structures | ||
24 | * - add pinmuxing | ||
25 | * - init_conn_id_bit (CONNID_BIT_VECTOR) | ||
26 | * - implement default hwmod SMS/SDRC flags? | ||
27 | * - move Linux-specific data ("non-ROM data") out | ||
28 | * | ||
29 | */ | ||
30 | #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_HWMOD_H | ||
31 | #define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_HWMOD_H | ||
32 | |||
33 | #include <linux/kernel.h> | ||
34 | #include <linux/init.h> | ||
35 | #include <linux/list.h> | ||
36 | #include <linux/ioport.h> | ||
37 | #include <linux/spinlock.h> | ||
38 | #include <plat/cpu.h> | ||
39 | |||
40 | struct omap_device; | ||
41 | |||
42 | extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type1; | ||
43 | extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type2; | ||
44 | |||
45 | /* | ||
46 | * OCP SYSCONFIG bit shifts/masks TYPE1. These are for IPs compliant | ||
47 | * with the original PRCM protocol defined for OMAP2420 | ||
48 | */ | ||
49 | #define SYSC_TYPE1_MIDLEMODE_SHIFT 12 | ||
50 | #define SYSC_TYPE1_MIDLEMODE_MASK (0x3 << SYSC_MIDLEMODE_SHIFT) | ||
51 | #define SYSC_TYPE1_CLOCKACTIVITY_SHIFT 8 | ||
52 | #define SYSC_TYPE1_CLOCKACTIVITY_MASK (0x3 << SYSC_CLOCKACTIVITY_SHIFT) | ||
53 | #define SYSC_TYPE1_SIDLEMODE_SHIFT 3 | ||
54 | #define SYSC_TYPE1_SIDLEMODE_MASK (0x3 << SYSC_SIDLEMODE_SHIFT) | ||
55 | #define SYSC_TYPE1_ENAWAKEUP_SHIFT 2 | ||
56 | #define SYSC_TYPE1_ENAWAKEUP_MASK (1 << SYSC_ENAWAKEUP_SHIFT) | ||
57 | #define SYSC_TYPE1_SOFTRESET_SHIFT 1 | ||
58 | #define SYSC_TYPE1_SOFTRESET_MASK (1 << SYSC_SOFTRESET_SHIFT) | ||
59 | #define SYSC_TYPE1_AUTOIDLE_SHIFT 0 | ||
60 | #define SYSC_TYPE1_AUTOIDLE_MASK (1 << SYSC_AUTOIDLE_SHIFT) | ||
61 | |||
62 | /* | ||
63 | * OCP SYSCONFIG bit shifts/masks TYPE2. These are for IPs compliant | ||
64 | * with the new PRCM protocol defined for new OMAP4 IPs. | ||
65 | */ | ||
66 | #define SYSC_TYPE2_SOFTRESET_SHIFT 0 | ||
67 | #define SYSC_TYPE2_SOFTRESET_MASK (1 << SYSC_TYPE2_SOFTRESET_SHIFT) | ||
68 | #define SYSC_TYPE2_SIDLEMODE_SHIFT 2 | ||
69 | #define SYSC_TYPE2_SIDLEMODE_MASK (0x3 << SYSC_TYPE2_SIDLEMODE_SHIFT) | ||
70 | #define SYSC_TYPE2_MIDLEMODE_SHIFT 4 | ||
71 | #define SYSC_TYPE2_MIDLEMODE_MASK (0x3 << SYSC_TYPE2_MIDLEMODE_SHIFT) | ||
72 | |||
73 | /* OCP SYSSTATUS bit shifts/masks */ | ||
74 | #define SYSS_RESETDONE_SHIFT 0 | ||
75 | #define SYSS_RESETDONE_MASK (1 << SYSS_RESETDONE_SHIFT) | ||
76 | |||
77 | /* Master standby/slave idle mode flags */ | ||
78 | #define HWMOD_IDLEMODE_FORCE (1 << 0) | ||
79 | #define HWMOD_IDLEMODE_NO (1 << 1) | ||
80 | #define HWMOD_IDLEMODE_SMART (1 << 2) | ||
81 | #define HWMOD_IDLEMODE_SMART_WKUP (1 << 3) | ||
82 | |||
83 | /* modulemode control type (SW or HW) */ | ||
84 | #define MODULEMODE_HWCTRL 1 | ||
85 | #define MODULEMODE_SWCTRL 2 | ||
86 | |||
87 | |||
88 | /** | ||
89 | * struct omap_hwmod_mux_info - hwmod specific mux configuration | ||
90 | * @pads: array of omap_device_pad entries | ||
91 | * @nr_pads: number of omap_device_pad entries | ||
92 | * | ||
93 | * Note that this is currently built during init as needed. | ||
94 | */ | ||
95 | struct omap_hwmod_mux_info { | ||
96 | int nr_pads; | ||
97 | struct omap_device_pad *pads; | ||
98 | int nr_pads_dynamic; | ||
99 | struct omap_device_pad **pads_dynamic; | ||
100 | bool enabled; | ||
101 | }; | ||
102 | |||
103 | /** | ||
104 | * struct omap_hwmod_irq_info - MPU IRQs used by the hwmod | ||
105 | * @name: name of the IRQ channel (module local name) | ||
106 | * @irq: IRQ channel ID (should be non-negative except -1 = terminator) | ||
107 | * | ||
108 | * @name should be something short, e.g., "tx" or "rx". It is for use | ||
109 | * by platform_get_resource_byname(). It is defined locally to the | ||
110 | * hwmod. | ||
111 | */ | ||
112 | struct omap_hwmod_irq_info { | ||
113 | const char *name; | ||
114 | s16 irq; | ||
115 | }; | ||
116 | |||
117 | /** | ||
118 | * struct omap_hwmod_dma_info - DMA channels used by the hwmod | ||
119 | * @name: name of the DMA channel (module local name) | ||
120 | * @dma_req: DMA request ID (should be non-negative except -1 = terminator) | ||
121 | * | ||
122 | * @name should be something short, e.g., "tx" or "rx". It is for use | ||
123 | * by platform_get_resource_byname(). It is defined locally to the | ||
124 | * hwmod. | ||
125 | */ | ||
126 | struct omap_hwmod_dma_info { | ||
127 | const char *name; | ||
128 | s16 dma_req; | ||
129 | }; | ||
130 | |||
131 | /** | ||
132 | * struct omap_hwmod_rst_info - IPs reset lines use by hwmod | ||
133 | * @name: name of the reset line (module local name) | ||
134 | * @rst_shift: Offset of the reset bit | ||
135 | * @st_shift: Offset of the reset status bit (OMAP2/3 only) | ||
136 | * | ||
137 | * @name should be something short, e.g., "cpu0" or "rst". It is defined | ||
138 | * locally to the hwmod. | ||
139 | */ | ||
140 | struct omap_hwmod_rst_info { | ||
141 | const char *name; | ||
142 | u8 rst_shift; | ||
143 | u8 st_shift; | ||
144 | }; | ||
145 | |||
146 | /** | ||
147 | * struct omap_hwmod_opt_clk - optional clocks used by this hwmod | ||
148 | * @role: "sys", "32k", "tv", etc -- for use in clk_get() | ||
149 | * @clk: opt clock: OMAP clock name | ||
150 | * @_clk: pointer to the struct clk (filled in at runtime) | ||
151 | * | ||
152 | * The module's interface clock and main functional clock should not | ||
153 | * be added as optional clocks. | ||
154 | */ | ||
155 | struct omap_hwmod_opt_clk { | ||
156 | const char *role; | ||
157 | const char *clk; | ||
158 | struct clk *_clk; | ||
159 | }; | ||
160 | |||
161 | |||
162 | /* omap_hwmod_omap2_firewall.flags bits */ | ||
163 | #define OMAP_FIREWALL_L3 (1 << 0) | ||
164 | #define OMAP_FIREWALL_L4 (1 << 1) | ||
165 | |||
166 | /** | ||
167 | * struct omap_hwmod_omap2_firewall - OMAP2/3 device firewall data | ||
168 | * @l3_perm_bit: bit shift for L3_PM_*_PERMISSION_* | ||
169 | * @l4_fw_region: L4 firewall region ID | ||
170 | * @l4_prot_group: L4 protection group ID | ||
171 | * @flags: (see omap_hwmod_omap2_firewall.flags macros above) | ||
172 | */ | ||
173 | struct omap_hwmod_omap2_firewall { | ||
174 | u8 l3_perm_bit; | ||
175 | u8 l4_fw_region; | ||
176 | u8 l4_prot_group; | ||
177 | u8 flags; | ||
178 | }; | ||
179 | |||
180 | |||
181 | /* | ||
182 | * omap_hwmod_addr_space.flags bits | ||
183 | * | ||
184 | * ADDR_MAP_ON_INIT: Map this address space during omap_hwmod init. | ||
185 | * ADDR_TYPE_RT: Address space contains module register target data. | ||
186 | */ | ||
187 | #define ADDR_MAP_ON_INIT (1 << 0) /* XXX does not belong */ | ||
188 | #define ADDR_TYPE_RT (1 << 1) | ||
189 | |||
190 | /** | ||
191 | * struct omap_hwmod_addr_space - address space handled by the hwmod | ||
192 | * @name: name of the address space | ||
193 | * @pa_start: starting physical address | ||
194 | * @pa_end: ending physical address | ||
195 | * @flags: (see omap_hwmod_addr_space.flags macros above) | ||
196 | * | ||
197 | * Address space doesn't necessarily follow physical interconnect | ||
198 | * structure. GPMC is one example. | ||
199 | */ | ||
200 | struct omap_hwmod_addr_space { | ||
201 | const char *name; | ||
202 | u32 pa_start; | ||
203 | u32 pa_end; | ||
204 | u8 flags; | ||
205 | }; | ||
206 | |||
207 | |||
208 | /* | ||
209 | * omap_hwmod_ocp_if.user bits: these indicate the initiators that use this | ||
210 | * interface to interact with the hwmod. Used to add sleep dependencies | ||
211 | * when the module is enabled or disabled. | ||
212 | */ | ||
213 | #define OCP_USER_MPU (1 << 0) | ||
214 | #define OCP_USER_SDMA (1 << 1) | ||
215 | |||
216 | /* omap_hwmod_ocp_if.flags bits */ | ||
217 | #define OCPIF_SWSUP_IDLE (1 << 0) | ||
218 | #define OCPIF_CAN_BURST (1 << 1) | ||
219 | |||
220 | /** | ||
221 | * struct omap_hwmod_ocp_if - OCP interface data | ||
222 | * @master: struct omap_hwmod that initiates OCP transactions on this link | ||
223 | * @slave: struct omap_hwmod that responds to OCP transactions on this link | ||
224 | * @addr: address space associated with this link | ||
225 | * @clk: interface clock: OMAP clock name | ||
226 | * @_clk: pointer to the interface struct clk (filled in at runtime) | ||
227 | * @fw: interface firewall data | ||
228 | * @width: OCP data width | ||
229 | * @user: initiators using this interface (see OCP_USER_* macros above) | ||
230 | * @flags: OCP interface flags (see OCPIF_* macros above) | ||
231 | * | ||
232 | * It may also be useful to add a tag_cnt field for OCP2.x devices. | ||
233 | * | ||
234 | * Parameter names beginning with an underscore are managed internally by | ||
235 | * the omap_hwmod code and should not be set during initialization. | ||
236 | */ | ||
237 | struct omap_hwmod_ocp_if { | ||
238 | struct omap_hwmod *master; | ||
239 | struct omap_hwmod *slave; | ||
240 | struct omap_hwmod_addr_space *addr; | ||
241 | const char *clk; | ||
242 | struct clk *_clk; | ||
243 | union { | ||
244 | struct omap_hwmod_omap2_firewall omap2; | ||
245 | } fw; | ||
246 | u8 width; | ||
247 | u8 user; | ||
248 | u8 flags; | ||
249 | }; | ||
250 | |||
251 | |||
252 | /* Macros for use in struct omap_hwmod_sysconfig */ | ||
253 | |||
254 | /* Flags for use in omap_hwmod_sysconfig.idlemodes */ | ||
255 | #define MASTER_STANDBY_SHIFT 4 | ||
256 | #define SLAVE_IDLE_SHIFT 0 | ||
257 | #define SIDLE_FORCE (HWMOD_IDLEMODE_FORCE << SLAVE_IDLE_SHIFT) | ||
258 | #define SIDLE_NO (HWMOD_IDLEMODE_NO << SLAVE_IDLE_SHIFT) | ||
259 | #define SIDLE_SMART (HWMOD_IDLEMODE_SMART << SLAVE_IDLE_SHIFT) | ||
260 | #define SIDLE_SMART_WKUP (HWMOD_IDLEMODE_SMART_WKUP << SLAVE_IDLE_SHIFT) | ||
261 | #define MSTANDBY_FORCE (HWMOD_IDLEMODE_FORCE << MASTER_STANDBY_SHIFT) | ||
262 | #define MSTANDBY_NO (HWMOD_IDLEMODE_NO << MASTER_STANDBY_SHIFT) | ||
263 | #define MSTANDBY_SMART (HWMOD_IDLEMODE_SMART << MASTER_STANDBY_SHIFT) | ||
264 | #define MSTANDBY_SMART_WKUP (HWMOD_IDLEMODE_SMART_WKUP << MASTER_STANDBY_SHIFT) | ||
265 | |||
266 | /* omap_hwmod_sysconfig.sysc_flags capability flags */ | ||
267 | #define SYSC_HAS_AUTOIDLE (1 << 0) | ||
268 | #define SYSC_HAS_SOFTRESET (1 << 1) | ||
269 | #define SYSC_HAS_ENAWAKEUP (1 << 2) | ||
270 | #define SYSC_HAS_EMUFREE (1 << 3) | ||
271 | #define SYSC_HAS_CLOCKACTIVITY (1 << 4) | ||
272 | #define SYSC_HAS_SIDLEMODE (1 << 5) | ||
273 | #define SYSC_HAS_MIDLEMODE (1 << 6) | ||
274 | #define SYSS_HAS_RESET_STATUS (1 << 7) | ||
275 | #define SYSC_NO_CACHE (1 << 8) /* XXX SW flag, belongs elsewhere */ | ||
276 | #define SYSC_HAS_RESET_STATUS (1 << 9) | ||
277 | |||
278 | /* omap_hwmod_sysconfig.clockact flags */ | ||
279 | #define CLOCKACT_TEST_BOTH 0x0 | ||
280 | #define CLOCKACT_TEST_MAIN 0x1 | ||
281 | #define CLOCKACT_TEST_ICLK 0x2 | ||
282 | #define CLOCKACT_TEST_NONE 0x3 | ||
283 | |||
284 | /** | ||
285 | * struct omap_hwmod_sysc_fields - hwmod OCP_SYSCONFIG register field offsets. | ||
286 | * @midle_shift: Offset of the midle bit | ||
287 | * @clkact_shift: Offset of the clockactivity bit | ||
288 | * @sidle_shift: Offset of the sidle bit | ||
289 | * @enwkup_shift: Offset of the enawakeup bit | ||
290 | * @srst_shift: Offset of the softreset bit | ||
291 | * @autoidle_shift: Offset of the autoidle bit | ||
292 | */ | ||
293 | struct omap_hwmod_sysc_fields { | ||
294 | u8 midle_shift; | ||
295 | u8 clkact_shift; | ||
296 | u8 sidle_shift; | ||
297 | u8 enwkup_shift; | ||
298 | u8 srst_shift; | ||
299 | u8 autoidle_shift; | ||
300 | }; | ||
301 | |||
302 | /** | ||
303 | * struct omap_hwmod_class_sysconfig - hwmod class OCP_SYS* data | ||
304 | * @rev_offs: IP block revision register offset (from module base addr) | ||
305 | * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr) | ||
306 | * @syss_offs: OCP_SYSSTATUS register offset (from module base addr) | ||
307 | * @idlemodes: One or more of {SIDLE,MSTANDBY}_{OFF,FORCE,SMART} | ||
308 | * @sysc_flags: SYS{C,S}_HAS* flags indicating SYSCONFIG bits supported | ||
309 | * @clockact: the default value of the module CLOCKACTIVITY bits | ||
310 | * | ||
311 | * @clockact describes to the module which clocks are likely to be | ||
312 | * disabled when the PRCM issues its idle request to the module. Some | ||
313 | * modules have separate clockdomains for the interface clock and main | ||
314 | * functional clock, and can check whether they should acknowledge the | ||
315 | * idle request based on the internal module functionality that has | ||
316 | * been associated with the clocks marked in @clockact. This field is | ||
317 | * only used if HWMOD_SET_DEFAULT_CLOCKACT is set (see below) | ||
318 | * | ||
319 | * @sysc_fields: structure containing the offset positions of various bits in | ||
320 | * SYSCONFIG register. This can be populated using omap_hwmod_sysc_type1 or | ||
321 | * omap_hwmod_sysc_type2 defined in omap_hwmod_common_data.c depending on | ||
322 | * whether the device ip is compliant with the original PRCM protocol | ||
323 | * defined for OMAP2420 or the new PRCM protocol for new OMAP4 IPs. | ||
324 | * If the device follows a different scheme for the sysconfig register , | ||
325 | * then this field has to be populated with the correct offset structure. | ||
326 | */ | ||
327 | struct omap_hwmod_class_sysconfig { | ||
328 | u16 rev_offs; | ||
329 | u16 sysc_offs; | ||
330 | u16 syss_offs; | ||
331 | u16 sysc_flags; | ||
332 | u8 idlemodes; | ||
333 | u8 clockact; | ||
334 | struct omap_hwmod_sysc_fields *sysc_fields; | ||
335 | }; | ||
336 | |||
337 | /** | ||
338 | * struct omap_hwmod_omap2_prcm - OMAP2/3-specific PRCM data | ||
339 | * @module_offs: PRCM submodule offset from the start of the PRM/CM | ||
340 | * @prcm_reg_id: PRCM register ID (e.g., 3 for CM_AUTOIDLE3) | ||
341 | * @module_bit: register bit shift for AUTOIDLE, WKST, WKEN, GRPSEL regs | ||
342 | * @idlest_reg_id: IDLEST register ID (e.g., 3 for CM_IDLEST3) | ||
343 | * @idlest_idle_bit: register bit shift for CM_IDLEST slave idle bit | ||
344 | * @idlest_stdby_bit: register bit shift for CM_IDLEST master standby bit | ||
345 | * | ||
346 | * @prcm_reg_id and @module_bit are specific to the AUTOIDLE, WKST, | ||
347 | * WKEN, GRPSEL registers. In an ideal world, no extra information | ||
348 | * would be needed for IDLEST information, but alas, there are some | ||
349 | * exceptions, so @idlest_reg_id, @idlest_idle_bit, @idlest_stdby_bit | ||
350 | * are needed for the IDLEST registers (c.f. 2430 I2CHS, 3430 USBHOST) | ||
351 | */ | ||
352 | struct omap_hwmod_omap2_prcm { | ||
353 | s16 module_offs; | ||
354 | u8 prcm_reg_id; | ||
355 | u8 module_bit; | ||
356 | u8 idlest_reg_id; | ||
357 | u8 idlest_idle_bit; | ||
358 | u8 idlest_stdby_bit; | ||
359 | }; | ||
360 | |||
361 | |||
362 | /** | ||
363 | * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data | ||
364 | * @clkctrl_reg: PRCM address of the clock control register | ||
365 | * @rstctrl_reg: address of the XXX_RSTCTRL register located in the PRM | ||
366 | * @submodule_wkdep_bit: bit shift of the WKDEP range | ||
367 | */ | ||
368 | struct omap_hwmod_omap4_prcm { | ||
369 | u16 clkctrl_offs; | ||
370 | u16 rstctrl_offs; | ||
371 | u16 context_offs; | ||
372 | u8 submodule_wkdep_bit; | ||
373 | u8 modulemode; | ||
374 | }; | ||
375 | |||
376 | |||
377 | /* | ||
378 | * omap_hwmod.flags definitions | ||
379 | * | ||
380 | * HWMOD_SWSUP_SIDLE: omap_hwmod code should manually bring module in and out | ||
381 | * of idle, rather than relying on module smart-idle | ||
382 | * HWMOD_SWSUP_MSTDBY: omap_hwmod code should manually bring module in and out | ||
383 | * of standby, rather than relying on module smart-standby | ||
384 | * HWMOD_INIT_NO_RESET: don't reset this module at boot - important for | ||
385 | * SDRAM controller, etc. XXX probably belongs outside the main hwmod file | ||
386 | * XXX Should be HWMOD_SETUP_NO_RESET | ||
387 | * HWMOD_INIT_NO_IDLE: don't idle this module at boot - important for SDRAM | ||
388 | * controller, etc. XXX probably belongs outside the main hwmod file | ||
389 | * XXX Should be HWMOD_SETUP_NO_IDLE | ||
390 | * HWMOD_NO_OCP_AUTOIDLE: disable module autoidle (OCP_SYSCONFIG.AUTOIDLE) | ||
391 | * when module is enabled, rather than the default, which is to | ||
392 | * enable autoidle | ||
393 | * HWMOD_SET_DEFAULT_CLOCKACT: program CLOCKACTIVITY bits at startup | ||
394 | * HWMOD_NO_IDLEST: this module does not have idle status - this is the case | ||
395 | * only for few initiator modules on OMAP2 & 3. | ||
396 | * HWMOD_CONTROL_OPT_CLKS_IN_RESET: Enable all optional clocks during reset. | ||
397 | * This is needed for devices like DSS that require optional clocks enabled | ||
398 | * in order to complete the reset. Optional clocks will be disabled | ||
399 | * again after the reset. | ||
400 | * HWMOD_16BIT_REG: Module has 16bit registers | ||
401 | */ | ||
402 | #define HWMOD_SWSUP_SIDLE (1 << 0) | ||
403 | #define HWMOD_SWSUP_MSTANDBY (1 << 1) | ||
404 | #define HWMOD_INIT_NO_RESET (1 << 2) | ||
405 | #define HWMOD_INIT_NO_IDLE (1 << 3) | ||
406 | #define HWMOD_NO_OCP_AUTOIDLE (1 << 4) | ||
407 | #define HWMOD_SET_DEFAULT_CLOCKACT (1 << 5) | ||
408 | #define HWMOD_NO_IDLEST (1 << 6) | ||
409 | #define HWMOD_CONTROL_OPT_CLKS_IN_RESET (1 << 7) | ||
410 | #define HWMOD_16BIT_REG (1 << 8) | ||
411 | |||
412 | /* | ||
413 | * omap_hwmod._int_flags definitions | ||
414 | * These are for internal use only and are managed by the omap_hwmod code. | ||
415 | * | ||
416 | * _HWMOD_NO_MPU_PORT: no path exists for the MPU to write to this module | ||
417 | * _HWMOD_WAKEUP_ENABLED: set when the omap_hwmod code has enabled ENAWAKEUP | ||
418 | * _HWMOD_SYSCONFIG_LOADED: set when the OCP_SYSCONFIG value has been cached | ||
419 | */ | ||
420 | #define _HWMOD_NO_MPU_PORT (1 << 0) | ||
421 | #define _HWMOD_WAKEUP_ENABLED (1 << 1) | ||
422 | #define _HWMOD_SYSCONFIG_LOADED (1 << 2) | ||
423 | |||
424 | /* | ||
425 | * omap_hwmod._state definitions | ||
426 | * | ||
427 | * INITIALIZED: reset (optionally), initialized, enabled, disabled | ||
428 | * (optionally) | ||
429 | * | ||
430 | * | ||
431 | */ | ||
432 | #define _HWMOD_STATE_UNKNOWN 0 | ||
433 | #define _HWMOD_STATE_REGISTERED 1 | ||
434 | #define _HWMOD_STATE_CLKS_INITED 2 | ||
435 | #define _HWMOD_STATE_INITIALIZED 3 | ||
436 | #define _HWMOD_STATE_ENABLED 4 | ||
437 | #define _HWMOD_STATE_IDLE 5 | ||
438 | #define _HWMOD_STATE_DISABLED 6 | ||
439 | |||
440 | /** | ||
441 | * struct omap_hwmod_class - the type of an IP block | ||
442 | * @name: name of the hwmod_class | ||
443 | * @sysc: device SYSCONFIG/SYSSTATUS register data | ||
444 | * @rev: revision of the IP class | ||
445 | * @pre_shutdown: ptr to fn to be executed immediately prior to device shutdown | ||
446 | * @reset: ptr to fn to be executed in place of the standard hwmod reset fn | ||
447 | * | ||
448 | * Represent the class of a OMAP hardware "modules" (e.g. timer, | ||
449 | * smartreflex, gpio, uart...) | ||
450 | * | ||
451 | * @pre_shutdown is a function that will be run immediately before | ||
452 | * hwmod clocks are disabled, etc. It is intended for use for hwmods | ||
453 | * like the MPU watchdog, which cannot be disabled with the standard | ||
454 | * omap_hwmod_shutdown(). The function should return 0 upon success, | ||
455 | * or some negative error upon failure. Returning an error will cause | ||
456 | * omap_hwmod_shutdown() to abort the device shutdown and return an | ||
457 | * error. | ||
458 | * | ||
459 | * If @reset is defined, then the function it points to will be | ||
460 | * executed in place of the standard hwmod _reset() code in | ||
461 | * mach-omap2/omap_hwmod.c. This is needed for IP blocks which have | ||
462 | * unusual reset sequences - usually processor IP blocks like the IVA. | ||
463 | */ | ||
464 | struct omap_hwmod_class { | ||
465 | const char *name; | ||
466 | struct omap_hwmod_class_sysconfig *sysc; | ||
467 | u32 rev; | ||
468 | int (*pre_shutdown)(struct omap_hwmod *oh); | ||
469 | int (*reset)(struct omap_hwmod *oh); | ||
470 | }; | ||
471 | |||
472 | /** | ||
473 | * struct omap_hwmod - integration data for OMAP hardware "modules" (IP blocks) | ||
474 | * @name: name of the hwmod | ||
475 | * @class: struct omap_hwmod_class * to the class of this hwmod | ||
476 | * @od: struct omap_device currently associated with this hwmod (internal use) | ||
477 | * @mpu_irqs: ptr to an array of MPU IRQs | ||
478 | * @sdma_reqs: ptr to an array of System DMA request IDs | ||
479 | * @prcm: PRCM data pertaining to this hwmod | ||
480 | * @main_clk: main clock: OMAP clock name | ||
481 | * @_clk: pointer to the main struct clk (filled in at runtime) | ||
482 | * @opt_clks: other device clocks that drivers can request (0..*) | ||
483 | * @vdd_name: voltage domain name | ||
484 | * @voltdm: pointer to voltage domain (filled in at runtime) | ||
485 | * @masters: ptr to array of OCP ifs that this hwmod can initiate on | ||
486 | * @slaves: ptr to array of OCP ifs that this hwmod can respond on | ||
487 | * @dev_attr: arbitrary device attributes that can be passed to the driver | ||
488 | * @_sysc_cache: internal-use hwmod flags | ||
489 | * @_mpu_rt_va: cached register target start address (internal use) | ||
490 | * @_mpu_port_index: cached MPU register target slave ID (internal use) | ||
491 | * @opt_clks_cnt: number of @opt_clks | ||
492 | * @master_cnt: number of @master entries | ||
493 | * @slaves_cnt: number of @slave entries | ||
494 | * @response_lat: device OCP response latency (in interface clock cycles) | ||
495 | * @_int_flags: internal-use hwmod flags | ||
496 | * @_state: internal-use hwmod state | ||
497 | * @_postsetup_state: internal-use state to leave the hwmod in after _setup() | ||
498 | * @flags: hwmod flags (documented below) | ||
499 | * @omap_chip: OMAP chips this hwmod is present on | ||
500 | * @_lock: spinlock serializing operations on this hwmod | ||
501 | * @node: list node for hwmod list (internal use) | ||
502 | * | ||
503 | * @main_clk refers to this module's "main clock," which for our | ||
504 | * purposes is defined as "the functional clock needed for register | ||
505 | * accesses to complete." Modules may not have a main clock if the | ||
506 | * interface clock also serves as a main clock. | ||
507 | * | ||
508 | * Parameter names beginning with an underscore are managed internally by | ||
509 | * the omap_hwmod code and should not be set during initialization. | ||
510 | */ | ||
511 | struct omap_hwmod { | ||
512 | const char *name; | ||
513 | struct omap_hwmod_class *class; | ||
514 | struct omap_device *od; | ||
515 | struct omap_hwmod_mux_info *mux; | ||
516 | struct omap_hwmod_irq_info *mpu_irqs; | ||
517 | struct omap_hwmod_dma_info *sdma_reqs; | ||
518 | struct omap_hwmod_rst_info *rst_lines; | ||
519 | union { | ||
520 | struct omap_hwmod_omap2_prcm omap2; | ||
521 | struct omap_hwmod_omap4_prcm omap4; | ||
522 | } prcm; | ||
523 | const char *main_clk; | ||
524 | struct clk *_clk; | ||
525 | struct omap_hwmod_opt_clk *opt_clks; | ||
526 | char *clkdm_name; | ||
527 | struct clockdomain *clkdm; | ||
528 | char *vdd_name; | ||
529 | struct voltagedomain *voltdm; | ||
530 | struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ | ||
531 | struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */ | ||
532 | void *dev_attr; | ||
533 | u32 _sysc_cache; | ||
534 | void __iomem *_mpu_rt_va; | ||
535 | spinlock_t _lock; | ||
536 | struct list_head node; | ||
537 | u16 flags; | ||
538 | u8 _mpu_port_index; | ||
539 | u8 response_lat; | ||
540 | u8 rst_lines_cnt; | ||
541 | u8 opt_clks_cnt; | ||
542 | u8 masters_cnt; | ||
543 | u8 slaves_cnt; | ||
544 | u8 hwmods_cnt; | ||
545 | u8 _int_flags; | ||
546 | u8 _state; | ||
547 | u8 _postsetup_state; | ||
548 | const struct omap_chip_id omap_chip; | ||
549 | }; | ||
550 | |||
551 | int omap_hwmod_register(struct omap_hwmod **ohs); | ||
552 | struct omap_hwmod *omap_hwmod_lookup(const char *name); | ||
553 | int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data), | ||
554 | void *data); | ||
555 | |||
556 | int __init omap_hwmod_setup_one(const char *name); | ||
557 | |||
558 | int omap_hwmod_enable(struct omap_hwmod *oh); | ||
559 | int _omap_hwmod_enable(struct omap_hwmod *oh); | ||
560 | int omap_hwmod_idle(struct omap_hwmod *oh); | ||
561 | int _omap_hwmod_idle(struct omap_hwmod *oh); | ||
562 | int omap_hwmod_shutdown(struct omap_hwmod *oh); | ||
563 | |||
564 | int omap_hwmod_assert_hardreset(struct omap_hwmod *oh, const char *name); | ||
565 | int omap_hwmod_deassert_hardreset(struct omap_hwmod *oh, const char *name); | ||
566 | int omap_hwmod_read_hardreset(struct omap_hwmod *oh, const char *name); | ||
567 | |||
568 | int omap_hwmod_enable_clocks(struct omap_hwmod *oh); | ||
569 | int omap_hwmod_disable_clocks(struct omap_hwmod *oh); | ||
570 | |||
571 | int omap_hwmod_set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode); | ||
572 | int omap_hwmod_set_ocp_autoidle(struct omap_hwmod *oh, u8 autoidle); | ||
573 | |||
574 | int omap_hwmod_reset(struct omap_hwmod *oh); | ||
575 | void omap_hwmod_ocp_barrier(struct omap_hwmod *oh); | ||
576 | |||
577 | void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs); | ||
578 | u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs); | ||
579 | int omap_hwmod_softreset(struct omap_hwmod *oh); | ||
580 | |||
581 | int omap_hwmod_count_resources(struct omap_hwmod *oh); | ||
582 | int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res); | ||
583 | |||
584 | struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh); | ||
585 | void __iomem *omap_hwmod_get_mpu_rt_va(struct omap_hwmod *oh); | ||
586 | |||
587 | int omap_hwmod_add_initiator_dep(struct omap_hwmod *oh, | ||
588 | struct omap_hwmod *init_oh); | ||
589 | int omap_hwmod_del_initiator_dep(struct omap_hwmod *oh, | ||
590 | struct omap_hwmod *init_oh); | ||
591 | |||
592 | int omap_hwmod_set_clockact_both(struct omap_hwmod *oh); | ||
593 | int omap_hwmod_set_clockact_main(struct omap_hwmod *oh); | ||
594 | int omap_hwmod_set_clockact_iclk(struct omap_hwmod *oh); | ||
595 | int omap_hwmod_set_clockact_none(struct omap_hwmod *oh); | ||
596 | |||
597 | int omap_hwmod_enable_wakeup(struct omap_hwmod *oh); | ||
598 | int omap_hwmod_disable_wakeup(struct omap_hwmod *oh); | ||
599 | |||
600 | int omap_hwmod_for_each_by_class(const char *classname, | ||
601 | int (*fn)(struct omap_hwmod *oh, | ||
602 | void *user), | ||
603 | void *user); | ||
604 | |||
605 | int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state); | ||
606 | u32 omap_hwmod_get_context_loss_count(struct omap_hwmod *oh); | ||
607 | |||
608 | int omap_hwmod_no_setup_reset(struct omap_hwmod *oh); | ||
609 | |||
610 | /* | ||
611 | * Chip variant-specific hwmod init routines - XXX should be converted | ||
612 | * to use initcalls once the initial boot ordering is straightened out | ||
613 | */ | ||
614 | extern int omap2420_hwmod_init(void); | ||
615 | extern int omap2430_hwmod_init(void); | ||
616 | extern int omap3xxx_hwmod_init(void); | ||
617 | extern int omap44xx_hwmod_init(void); | ||
618 | |||
619 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/onenand.h b/arch/arm/plat-omap/include/plat/onenand.h new file mode 100644 index 00000000000..2858667d2e4 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/onenand.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/onenand.h | ||
3 | * | ||
4 | * Copyright (C) 2006 Nokia Corporation | ||
5 | * Author: Juha Yrjola | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/mtd/mtd.h> | ||
13 | #include <linux/mtd/partitions.h> | ||
14 | |||
15 | #define ONENAND_SYNC_READ (1 << 0) | ||
16 | #define ONENAND_SYNC_READWRITE (1 << 1) | ||
17 | |||
18 | struct onenand_freq_info { | ||
19 | u16 maf_id; | ||
20 | u16 dev_id; | ||
21 | u16 ver_id; | ||
22 | }; | ||
23 | |||
24 | struct omap_onenand_platform_data { | ||
25 | int cs; | ||
26 | int gpio_irq; | ||
27 | struct mtd_partition *parts; | ||
28 | int nr_parts; | ||
29 | int (*onenand_setup)(void __iomem *, int *freq_ptr); | ||
30 | int (*get_freq)(const struct onenand_freq_info *freq_info, | ||
31 | bool *clk_dep); | ||
32 | int dma_channel; | ||
33 | u8 flags; | ||
34 | u8 regulator_can_sleep; | ||
35 | u8 skip_initial_unlocking; | ||
36 | }; | ||
37 | |||
38 | #define ONENAND_MAX_PARTITIONS 8 | ||
39 | |||
40 | #if defined(CONFIG_MTD_ONENAND_OMAP2) || \ | ||
41 | defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) | ||
42 | |||
43 | extern void gpmc_onenand_init(struct omap_onenand_platform_data *d); | ||
44 | |||
45 | #else | ||
46 | |||
47 | #define board_onenand_data NULL | ||
48 | |||
49 | static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d) | ||
50 | { | ||
51 | } | ||
52 | |||
53 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/param.h b/arch/arm/plat-omap/include/plat/param.h new file mode 100644 index 00000000000..1eb4dc32697 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/param.h | |||
@@ -0,0 +1,8 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/param.h | ||
3 | * | ||
4 | */ | ||
5 | |||
6 | #ifdef CONFIG_OMAP_32K_TIMER_HZ | ||
7 | #define HZ CONFIG_OMAP_32K_TIMER_HZ | ||
8 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/prcm.h b/arch/arm/plat-omap/include/plat/prcm.h new file mode 100644 index 00000000000..267f43bb2a4 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/prcm.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/prcm.h | ||
3 | * | ||
4 | * Access definations for use in OMAP24XX clock and power management | ||
5 | * | ||
6 | * Copyright (C) 2005 Texas Instruments, Inc. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | * | ||
22 | * XXX This file is deprecated. The PRCM is an OMAP2+-only subsystem, | ||
23 | * so this file doesn't belong in plat-omap/include/plat. Please | ||
24 | * do not add anything new to this file. | ||
25 | */ | ||
26 | |||
27 | #ifndef __ASM_ARM_ARCH_OMAP_PRCM_H | ||
28 | #define __ASM_ARM_ARCH_OMAP_PRCM_H | ||
29 | |||
30 | u32 omap_prcm_get_reset_sources(void); | ||
31 | int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest, | ||
32 | const char *name); | ||
33 | |||
34 | #endif | ||
35 | |||
36 | |||
37 | |||
diff --git a/arch/arm/plat-omap/include/plat/sdrc.h b/arch/arm/plat-omap/include/plat/sdrc.h new file mode 100644 index 00000000000..925b12b500d --- /dev/null +++ b/arch/arm/plat-omap/include/plat/sdrc.h | |||
@@ -0,0 +1,165 @@ | |||
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 | #include <mach/io.h> | ||
20 | |||
21 | /* SDRC register offsets - read/write with sdrc_{read,write}_reg() */ | ||
22 | |||
23 | #define SDRC_SYSCONFIG 0x010 | ||
24 | #define SDRC_CS_CFG 0x040 | ||
25 | #define SDRC_SHARING 0x044 | ||
26 | #define SDRC_ERR_TYPE 0x04C | ||
27 | #define SDRC_DLLA_CTRL 0x060 | ||
28 | #define SDRC_DLLA_STATUS 0x064 | ||
29 | #define SDRC_DLLB_CTRL 0x068 | ||
30 | #define SDRC_DLLB_STATUS 0x06C | ||
31 | #define SDRC_POWER 0x070 | ||
32 | #define SDRC_MCFG_0 0x080 | ||
33 | #define SDRC_MR_0 0x084 | ||
34 | #define SDRC_EMR2_0 0x08c | ||
35 | #define SDRC_ACTIM_CTRL_A_0 0x09c | ||
36 | #define SDRC_ACTIM_CTRL_B_0 0x0a0 | ||
37 | #define SDRC_RFR_CTRL_0 0x0a4 | ||
38 | #define SDRC_MANUAL_0 0x0a8 | ||
39 | #define SDRC_MCFG_1 0x0B0 | ||
40 | #define SDRC_MR_1 0x0B4 | ||
41 | #define SDRC_EMR2_1 0x0BC | ||
42 | #define SDRC_ACTIM_CTRL_A_1 0x0C4 | ||
43 | #define SDRC_ACTIM_CTRL_B_1 0x0C8 | ||
44 | #define SDRC_RFR_CTRL_1 0x0D4 | ||
45 | #define SDRC_MANUAL_1 0x0D8 | ||
46 | |||
47 | #define SDRC_POWER_AUTOCOUNT_SHIFT 8 | ||
48 | #define SDRC_POWER_AUTOCOUNT_MASK (0xffff << SDRC_POWER_AUTOCOUNT_SHIFT) | ||
49 | #define SDRC_POWER_CLKCTRL_SHIFT 4 | ||
50 | #define SDRC_POWER_CLKCTRL_MASK (0x3 << SDRC_POWER_CLKCTRL_SHIFT) | ||
51 | #define SDRC_SELF_REFRESH_ON_AUTOCOUNT (0x2 << SDRC_POWER_CLKCTRL_SHIFT) | ||
52 | |||
53 | /* | ||
54 | * These values represent the number of memory clock cycles between | ||
55 | * autorefresh initiation. They assume 1 refresh per 64 ms (JEDEC), 8192 | ||
56 | * rows per device, and include a subtraction of a 50 cycle window in the | ||
57 | * event that the autorefresh command is delayed due to other SDRC activity. | ||
58 | * The '| 1' sets the ARE field to send one autorefresh when the autorefresh | ||
59 | * counter reaches 0. | ||
60 | * | ||
61 | * These represent optimal values for common parts, it won't work for all. | ||
62 | * As long as you scale down, most parameters are still work, they just | ||
63 | * become sub-optimal. The RFR value goes in the opposite direction. If you | ||
64 | * don't adjust it down as your clock period increases the refresh interval | ||
65 | * will not be met. Setting all parameters for complete worst case may work, | ||
66 | * but may cut memory performance by 2x. Due to errata the DLLs need to be | ||
67 | * unlocked and their value needs run time calibration. A dynamic call is | ||
68 | * need for that as no single right value exists acorss production samples. | ||
69 | * | ||
70 | * Only the FULL speed values are given. Current code is such that rate | ||
71 | * changes must be made at DPLLoutx2. The actual value adjustment for low | ||
72 | * frequency operation will be handled by omap_set_performance() | ||
73 | * | ||
74 | * By having the boot loader boot up in the fastest L4 speed available likely | ||
75 | * will result in something which you can switch between. | ||
76 | */ | ||
77 | #define SDRC_RFR_CTRL_165MHz (0x00044c00 | 1) | ||
78 | #define SDRC_RFR_CTRL_133MHz (0x0003de00 | 1) | ||
79 | #define SDRC_RFR_CTRL_100MHz (0x0002da01 | 1) | ||
80 | #define SDRC_RFR_CTRL_110MHz (0x0002da01 | 1) /* Need to calc */ | ||
81 | #define SDRC_RFR_CTRL_BYPASS (0x00005000 | 1) /* Need to calc */ | ||
82 | |||
83 | |||
84 | /* | ||
85 | * SMS register access | ||
86 | */ | ||
87 | |||
88 | #define OMAP242X_SMS_REGADDR(reg) \ | ||
89 | (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE + reg) | ||
90 | #define OMAP243X_SMS_REGADDR(reg) \ | ||
91 | (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE + reg) | ||
92 | #define OMAP343X_SMS_REGADDR(reg) \ | ||
93 | (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE + reg) | ||
94 | |||
95 | /* SMS register offsets - read/write with sms_{read,write}_reg() */ | ||
96 | |||
97 | #define SMS_SYSCONFIG 0x010 | ||
98 | #define SMS_ROT_CONTROL(context) (0x180 + 0x10 * context) | ||
99 | #define SMS_ROT_SIZE(context) (0x184 + 0x10 * context) | ||
100 | #define SMS_ROT_PHYSICAL_BA(context) (0x188 + 0x10 * context) | ||
101 | /* REVISIT: fill in other SMS registers here */ | ||
102 | |||
103 | |||
104 | #ifndef __ASSEMBLER__ | ||
105 | |||
106 | /** | ||
107 | * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate | ||
108 | * @rate: SDRC clock rate (in Hz) | ||
109 | * @actim_ctrla: Value to program to SDRC_ACTIM_CTRLA for this rate | ||
110 | * @actim_ctrlb: Value to program to SDRC_ACTIM_CTRLB for this rate | ||
111 | * @rfr_ctrl: Value to program to SDRC_RFR_CTRL for this rate | ||
112 | * @mr: Value to program to SDRC_MR for this rate | ||
113 | * | ||
114 | * This structure holds a pre-computed set of register values for the | ||
115 | * SDRC for a given SDRC clock rate and SDRAM chip. These are | ||
116 | * intended to be pre-computed and specified in an array in the board-*.c | ||
117 | * files. The structure is keyed off the 'rate' field. | ||
118 | */ | ||
119 | struct omap_sdrc_params { | ||
120 | unsigned long rate; | ||
121 | u32 actim_ctrla; | ||
122 | u32 actim_ctrlb; | ||
123 | u32 rfr_ctrl; | ||
124 | u32 mr; | ||
125 | }; | ||
126 | |||
127 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | ||
128 | void omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0, | ||
129 | struct omap_sdrc_params *sdrc_cs1); | ||
130 | #else | ||
131 | static inline void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0, | ||
132 | struct omap_sdrc_params *sdrc_cs1) {}; | ||
133 | #endif | ||
134 | |||
135 | int omap2_sdrc_get_params(unsigned long r, | ||
136 | struct omap_sdrc_params **sdrc_cs0, | ||
137 | struct omap_sdrc_params **sdrc_cs1); | ||
138 | void omap2_sms_save_context(void); | ||
139 | void omap2_sms_restore_context(void); | ||
140 | |||
141 | void omap2_sms_write_rot_control(u32 val, unsigned ctx); | ||
142 | void omap2_sms_write_rot_size(u32 val, unsigned ctx); | ||
143 | void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx); | ||
144 | |||
145 | #ifdef CONFIG_ARCH_OMAP2 | ||
146 | |||
147 | struct memory_timings { | ||
148 | u32 m_type; /* ddr = 1, sdr = 0 */ | ||
149 | u32 dll_mode; /* use lock mode = 1, unlock mode = 0 */ | ||
150 | u32 slow_dll_ctrl; /* unlock mode, dll value for slow speed */ | ||
151 | u32 fast_dll_ctrl; /* unlock mode, dll value for fast speed */ | ||
152 | u32 base_cs; /* base chip select to use for calculations */ | ||
153 | }; | ||
154 | |||
155 | extern void omap2xxx_sdrc_init_params(u32 force_lock_to_unlock_mode); | ||
156 | struct omap_sdrc_params *rx51_get_sdram_timings(void); | ||
157 | |||
158 | u32 omap2xxx_sdrc_dll_is_unlocked(void); | ||
159 | u32 omap2xxx_sdrc_reprogram(u32 level, u32 force); | ||
160 | |||
161 | #endif /* CONFIG_ARCH_OMAP2 */ | ||
162 | |||
163 | #endif /* __ASSEMBLER__ */ | ||
164 | |||
165 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h new file mode 100644 index 00000000000..de3b10c1812 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/serial.h | |||
@@ -0,0 +1,120 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/serial.h | ||
3 | * | ||
4 | * Copyright (C) 2009 Texas Instruments | ||
5 | * Addded OMAP4 support- Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, | ||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | * GNU General Public License for more details. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_SERIAL_H | ||
14 | #define __ASM_ARCH_SERIAL_H | ||
15 | |||
16 | #include <linux/init.h> | ||
17 | |||
18 | /* | ||
19 | * Memory entry used for the DEBUG_LL UART configuration. See also | ||
20 | * uncompress.h and debug-macro.S. | ||
21 | * | ||
22 | * Note that using a memory location for storing the UART configuration | ||
23 | * has at least two limitations: | ||
24 | * | ||
25 | * 1. Kernel uncompress code cannot overlap OMAP_UART_INFO as the | ||
26 | * uncompress code could then partially overwrite itself | ||
27 | * 2. We assume printascii is called at least once before paging_init, | ||
28 | * and addruart has a chance to read OMAP_UART_INFO | ||
29 | */ | ||
30 | #define OMAP_UART_INFO (PLAT_PHYS_OFFSET + 0x3ffc) | ||
31 | |||
32 | /* OMAP1 serial ports */ | ||
33 | #define OMAP1_UART1_BASE 0xfffb0000 | ||
34 | #define OMAP1_UART2_BASE 0xfffb0800 | ||
35 | #define OMAP1_UART3_BASE 0xfffb9800 | ||
36 | |||
37 | /* OMAP2 serial ports */ | ||
38 | #define OMAP2_UART1_BASE 0x4806a000 | ||
39 | #define OMAP2_UART2_BASE 0x4806c000 | ||
40 | #define OMAP2_UART3_BASE 0x4806e000 | ||
41 | |||
42 | /* OMAP3 serial ports */ | ||
43 | #define OMAP3_UART1_BASE OMAP2_UART1_BASE | ||
44 | #define OMAP3_UART2_BASE OMAP2_UART2_BASE | ||
45 | #define OMAP3_UART3_BASE 0x49020000 | ||
46 | #define OMAP3_UART4_BASE 0x49042000 /* Only on 36xx */ | ||
47 | |||
48 | /* OMAP4 serial ports */ | ||
49 | #define OMAP4_UART1_BASE OMAP2_UART1_BASE | ||
50 | #define OMAP4_UART2_BASE OMAP2_UART2_BASE | ||
51 | #define OMAP4_UART3_BASE 0x48020000 | ||
52 | #define OMAP4_UART4_BASE 0x4806e000 | ||
53 | |||
54 | /* TI816X serial ports */ | ||
55 | #define TI816X_UART1_BASE 0x48020000 | ||
56 | #define TI816X_UART2_BASE 0x48022000 | ||
57 | #define TI816X_UART3_BASE 0x48024000 | ||
58 | |||
59 | /* AM3505/3517 UART4 */ | ||
60 | #define AM35XX_UART4_BASE 0x4809E000 /* Only on AM3505/3517 */ | ||
61 | |||
62 | /* External port on Zoom2/3 */ | ||
63 | #define ZOOM_UART_BASE 0x10000000 | ||
64 | #define ZOOM_UART_VIRT 0xfa400000 | ||
65 | |||
66 | #define OMAP_PORT_SHIFT 2 | ||
67 | #define OMAP7XX_PORT_SHIFT 0 | ||
68 | #define ZOOM_PORT_SHIFT 1 | ||
69 | |||
70 | #define OMAP1510_BASE_BAUD (12000000/16) | ||
71 | #define OMAP16XX_BASE_BAUD (48000000/16) | ||
72 | #define OMAP24XX_BASE_BAUD (48000000/16) | ||
73 | |||
74 | /* | ||
75 | * DEBUG_LL port encoding stored into the UART1 scratchpad register by | ||
76 | * decomp_setup in uncompress.h | ||
77 | */ | ||
78 | #define OMAP1UART1 11 | ||
79 | #define OMAP1UART2 12 | ||
80 | #define OMAP1UART3 13 | ||
81 | #define OMAP2UART1 21 | ||
82 | #define OMAP2UART2 22 | ||
83 | #define OMAP2UART3 23 | ||
84 | #define OMAP3UART1 OMAP2UART1 | ||
85 | #define OMAP3UART2 OMAP2UART2 | ||
86 | #define OMAP3UART3 33 | ||
87 | #define OMAP3UART4 34 /* Only on 36xx */ | ||
88 | #define OMAP4UART1 OMAP2UART1 | ||
89 | #define OMAP4UART2 OMAP2UART2 | ||
90 | #define OMAP4UART3 43 | ||
91 | #define OMAP4UART4 44 | ||
92 | #define TI816XUART1 81 | ||
93 | #define TI816XUART2 82 | ||
94 | #define TI816XUART3 83 | ||
95 | #define ZOOM_UART 95 /* Only on zoom2/3 */ | ||
96 | |||
97 | /* This is only used by 8250.c for omap1510 */ | ||
98 | #define is_omap_port(pt) ({int __ret = 0; \ | ||
99 | if ((pt)->port.mapbase == OMAP1_UART1_BASE || \ | ||
100 | (pt)->port.mapbase == OMAP1_UART2_BASE || \ | ||
101 | (pt)->port.mapbase == OMAP1_UART3_BASE) \ | ||
102 | __ret = 1; \ | ||
103 | __ret; \ | ||
104 | }) | ||
105 | |||
106 | #ifndef __ASSEMBLER__ | ||
107 | |||
108 | struct omap_board_data; | ||
109 | |||
110 | extern void omap_serial_init(void); | ||
111 | extern void omap_serial_init_port(struct omap_board_data *bdata); | ||
112 | extern int omap_uart_can_sleep(void); | ||
113 | extern void omap_uart_check_wakeup(void); | ||
114 | extern void omap_uart_prepare_suspend(void); | ||
115 | extern void omap_uart_prepare_idle(int num); | ||
116 | extern void omap_uart_resume_idle(int num); | ||
117 | extern void omap_uart_enable_irqs(int enable); | ||
118 | #endif | ||
119 | |||
120 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/system.h b/arch/arm/plat-omap/include/plat/system.h new file mode 100644 index 00000000000..c5fa9e92900 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/system.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * Copied from arch/arm/mach-sa1100/include/mach/system.h | ||
3 | * Copyright (c) 1999 Nicolas Pitre <nico@fluxnic.net> | ||
4 | */ | ||
5 | #ifndef __ASM_ARCH_SYSTEM_H | ||
6 | #define __ASM_ARCH_SYSTEM_H | ||
7 | |||
8 | #include <asm/proc-fns.h> | ||
9 | |||
10 | static inline void arch_idle(void) | ||
11 | { | ||
12 | cpu_do_idle(); | ||
13 | } | ||
14 | |||
15 | extern void (*arch_reset)(char, const char *); | ||
16 | |||
17 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/tc.h b/arch/arm/plat-omap/include/plat/tc.h new file mode 100644 index 00000000000..d2fcd789bb9 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/tc.h | |||
@@ -0,0 +1,106 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/tc.h | ||
3 | * | ||
4 | * OMAP Traffic Controller | ||
5 | * | ||
6 | * Copyright (C) 2004 Nokia Corporation | ||
7 | * Author: Imre Deak <imre.deak@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License along | ||
20 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
22 | */ | ||
23 | |||
24 | #ifndef __ASM_ARCH_TC_H | ||
25 | #define __ASM_ARCH_TC_H | ||
26 | |||
27 | #define TCMIF_BASE 0xfffecc00 | ||
28 | #define OMAP_TC_OCPT1_PRIOR (TCMIF_BASE + 0x00) | ||
29 | #define OMAP_TC_EMIFS_PRIOR (TCMIF_BASE + 0x04) | ||
30 | #define OMAP_TC_EMIFF_PRIOR (TCMIF_BASE + 0x08) | ||
31 | #define EMIFS_CONFIG (TCMIF_BASE + 0x0c) | ||
32 | #define EMIFS_CS0_CONFIG (TCMIF_BASE + 0x10) | ||
33 | #define EMIFS_CS1_CONFIG (TCMIF_BASE + 0x14) | ||
34 | #define EMIFS_CS2_CONFIG (TCMIF_BASE + 0x18) | ||
35 | #define EMIFS_CS3_CONFIG (TCMIF_BASE + 0x1c) | ||
36 | #define EMIFF_SDRAM_CONFIG (TCMIF_BASE + 0x20) | ||
37 | #define EMIFF_MRS (TCMIF_BASE + 0x24) | ||
38 | #define TC_TIMEOUT1 (TCMIF_BASE + 0x28) | ||
39 | #define TC_TIMEOUT2 (TCMIF_BASE + 0x2c) | ||
40 | #define TC_TIMEOUT3 (TCMIF_BASE + 0x30) | ||
41 | #define TC_ENDIANISM (TCMIF_BASE + 0x34) | ||
42 | #define EMIFF_SDRAM_CONFIG_2 (TCMIF_BASE + 0x3c) | ||
43 | #define EMIF_CFG_DYNAMIC_WS (TCMIF_BASE + 0x40) | ||
44 | #define EMIFS_ACS0 (TCMIF_BASE + 0x50) | ||
45 | #define EMIFS_ACS1 (TCMIF_BASE + 0x54) | ||
46 | #define EMIFS_ACS2 (TCMIF_BASE + 0x58) | ||
47 | #define EMIFS_ACS3 (TCMIF_BASE + 0x5c) | ||
48 | #define OMAP_TC_OCPT2_PRIOR (TCMIF_BASE + 0xd0) | ||
49 | |||
50 | /* external EMIFS chipselect regions */ | ||
51 | #define OMAP_CS0_PHYS 0x00000000 | ||
52 | #define OMAP_CS0_SIZE SZ_64M | ||
53 | |||
54 | #define OMAP_CS1_PHYS 0x04000000 | ||
55 | #define OMAP_CS1_SIZE SZ_64M | ||
56 | |||
57 | #define OMAP_CS1A_PHYS OMAP_CS1_PHYS | ||
58 | #define OMAP_CS1A_SIZE SZ_32M | ||
59 | |||
60 | #define OMAP_CS1B_PHYS (OMAP_CS1A_PHYS + OMAP_CS1A_SIZE) | ||
61 | #define OMAP_CS1B_SIZE SZ_32M | ||
62 | |||
63 | #define OMAP_CS2_PHYS 0x08000000 | ||
64 | #define OMAP_CS2_SIZE SZ_64M | ||
65 | |||
66 | #define OMAP_CS2A_PHYS OMAP_CS2_PHYS | ||
67 | #define OMAP_CS2A_SIZE SZ_32M | ||
68 | |||
69 | #define OMAP_CS2B_PHYS (OMAP_CS2A_PHYS + OMAP_CS2A_SIZE) | ||
70 | #define OMAP_CS2B_SIZE SZ_32M | ||
71 | |||
72 | #define OMAP_CS3_PHYS 0x0c000000 | ||
73 | #define OMAP_CS3_SIZE SZ_64M | ||
74 | |||
75 | #ifndef __ASSEMBLER__ | ||
76 | |||
77 | /* EMIF Slow Interface Configuration Register */ | ||
78 | #define OMAP_EMIFS_CONFIG_FR (1 << 4) | ||
79 | #define OMAP_EMIFS_CONFIG_PDE (1 << 3) | ||
80 | #define OMAP_EMIFS_CONFIG_PWD_EN (1 << 2) | ||
81 | #define OMAP_EMIFS_CONFIG_BM (1 << 1) | ||
82 | #define OMAP_EMIFS_CONFIG_WP (1 << 0) | ||
83 | |||
84 | #define EMIFS_CCS(n) (EMIFS_CS0_CONFIG + (4 * (n))) | ||
85 | #define EMIFS_ACS(n) (EMIFS_ACS0 + (4 * (n))) | ||
86 | |||
87 | /* Almost all documentation for chip and board memory maps assumes | ||
88 | * BM is clear. Most devel boards have a switch to control booting | ||
89 | * from NOR flash (using external chipselect 3) rather than mask ROM, | ||
90 | * which uses BM to interchange the physical CS0 and CS3 addresses. | ||
91 | */ | ||
92 | static inline u32 omap_cs0_phys(void) | ||
93 | { | ||
94 | return (omap_readl(EMIFS_CONFIG) & OMAP_EMIFS_CONFIG_BM) | ||
95 | ? OMAP_CS3_PHYS : 0; | ||
96 | } | ||
97 | |||
98 | static inline u32 omap_cs3_phys(void) | ||
99 | { | ||
100 | return (omap_readl(EMIFS_CONFIG) & OMAP_EMIFS_CONFIG_BM) | ||
101 | ? 0 : OMAP_CS3_PHYS; | ||
102 | } | ||
103 | |||
104 | #endif /* __ASSEMBLER__ */ | ||
105 | |||
106 | #endif /* __ASM_ARCH_TC_H */ | ||
diff --git a/arch/arm/plat-omap/include/plat/ti816x.h b/arch/arm/plat-omap/include/plat/ti816x.h new file mode 100644 index 00000000000..50510f5dda1 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/ti816x.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * This file contains the address data for various TI816X modules. | ||
3 | * | ||
4 | * Copyright (C) 2010 Texas Instruments, Inc. - http://www.ti.com/ | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License as | ||
8 | * published by the Free Software Foundation version 2. | ||
9 | * | ||
10 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
11 | * kind, whether express or implied; without even the implied warranty | ||
12 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef __ASM_ARCH_TI816X_H | ||
17 | #define __ASM_ARCH_TI816X_H | ||
18 | |||
19 | #define L4_SLOW_TI816X_BASE 0x48000000 | ||
20 | |||
21 | #define TI816X_SCM_BASE 0x48140000 | ||
22 | #define TI816X_CTRL_BASE TI816X_SCM_BASE | ||
23 | #define TI816X_PRCM_BASE 0x48180000 | ||
24 | |||
25 | #define TI816X_ARM_INTC_BASE 0x48200000 | ||
26 | |||
27 | #endif /* __ASM_ARCH_TI816X_H */ | ||
diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h new file mode 100644 index 00000000000..a067484cc4a --- /dev/null +++ b/arch/arm/plat-omap/include/plat/uncompress.h | |||
@@ -0,0 +1,184 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/include/mach/uncompress.h | ||
3 | * | ||
4 | * Serial port stubs for kernel decompress status messages | ||
5 | * | ||
6 | * Initially based on: | ||
7 | * linux-2.4.15-rmk1-dsplinux1.6/arch/arm/plat-omap/include/mach1510/uncompress.h | ||
8 | * Copyright (C) 2000 RidgeRun, Inc. | ||
9 | * Author: Greg Lonnon <glonnon@ridgerun.com> | ||
10 | * | ||
11 | * Rewritten by: | ||
12 | * Author: <source@mvista.com> | ||
13 | * 2004 (c) MontaVista Software, Inc. | ||
14 | * | ||
15 | * This file is licensed under the terms of the GNU General Public License | ||
16 | * version 2. This program is licensed "as is" without any warranty of any | ||
17 | * kind, whether express or implied. | ||
18 | */ | ||
19 | |||
20 | #include <linux/types.h> | ||
21 | #include <linux/serial_reg.h> | ||
22 | |||
23 | #include <asm/memory.h> | ||
24 | #include <asm/mach-types.h> | ||
25 | |||
26 | #include <plat/serial.h> | ||
27 | |||
28 | #define MDR1_MODE_MASK 0x07 | ||
29 | |||
30 | volatile u8 *uart_base; | ||
31 | int uart_shift; | ||
32 | |||
33 | /* | ||
34 | * Store the DEBUG_LL uart number into memory. | ||
35 | * See also debug-macro.S, and serial.c for related code. | ||
36 | */ | ||
37 | static void set_omap_uart_info(unsigned char port) | ||
38 | { | ||
39 | *(volatile u32 *)OMAP_UART_INFO = port; | ||
40 | } | ||
41 | |||
42 | static void putc(int c) | ||
43 | { | ||
44 | if (!uart_base) | ||
45 | return; | ||
46 | |||
47 | /* Check for UART 16x mode */ | ||
48 | if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0) | ||
49 | return; | ||
50 | |||
51 | while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE)) | ||
52 | barrier(); | ||
53 | uart_base[UART_TX << uart_shift] = c; | ||
54 | } | ||
55 | |||
56 | static inline void flush(void) | ||
57 | { | ||
58 | } | ||
59 | |||
60 | /* | ||
61 | * Macros to configure UART1 and debug UART | ||
62 | */ | ||
63 | #define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id) \ | ||
64 | if (machine_is_##mach()) { \ | ||
65 | uart_base = (volatile u8 *)(dbg_uart); \ | ||
66 | uart_shift = (dbg_shft); \ | ||
67 | port = (dbg_id); \ | ||
68 | set_omap_uart_info(port); \ | ||
69 | break; \ | ||
70 | } | ||
71 | |||
72 | #define DEBUG_LL_OMAP7XX(p, mach) \ | ||
73 | _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, \ | ||
74 | OMAP1UART##p) | ||
75 | |||
76 | #define DEBUG_LL_OMAP1(p, mach) \ | ||
77 | _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT, \ | ||
78 | OMAP1UART##p) | ||
79 | |||
80 | #define DEBUG_LL_OMAP2(p, mach) \ | ||
81 | _DEBUG_LL_ENTRY(mach, OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT, \ | ||
82 | OMAP2UART##p) | ||
83 | |||
84 | #define DEBUG_LL_OMAP3(p, mach) \ | ||
85 | _DEBUG_LL_ENTRY(mach, OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT, \ | ||
86 | OMAP3UART##p) | ||
87 | |||
88 | #define DEBUG_LL_OMAP4(p, mach) \ | ||
89 | _DEBUG_LL_ENTRY(mach, OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT, \ | ||
90 | OMAP4UART##p) | ||
91 | |||
92 | /* Zoom2/3 shift is different for UART1 and external port */ | ||
93 | #define DEBUG_LL_ZOOM(mach) \ | ||
94 | _DEBUG_LL_ENTRY(mach, ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART) | ||
95 | |||
96 | #define DEBUG_LL_TI816X(p, mach) \ | ||
97 | _DEBUG_LL_ENTRY(mach, TI816X_UART##p##_BASE, OMAP_PORT_SHIFT, \ | ||
98 | TI816XUART##p) | ||
99 | |||
100 | static inline void __arch_decomp_setup(unsigned long arch_id) | ||
101 | { | ||
102 | int port = 0; | ||
103 | |||
104 | /* | ||
105 | * Initialize the port based on the machine ID from the bootloader. | ||
106 | * Note that we're using macros here instead of switch statement | ||
107 | * as machine_is functions are optimized out for the boards that | ||
108 | * are not selected. | ||
109 | */ | ||
110 | do { | ||
111 | /* omap7xx/8xx based boards using UART1 with shift 0 */ | ||
112 | DEBUG_LL_OMAP7XX(1, herald); | ||
113 | DEBUG_LL_OMAP7XX(1, omap_perseus2); | ||
114 | |||
115 | /* omap15xx/16xx based boards using UART1 */ | ||
116 | DEBUG_LL_OMAP1(1, ams_delta); | ||
117 | DEBUG_LL_OMAP1(1, nokia770); | ||
118 | DEBUG_LL_OMAP1(1, omap_h2); | ||
119 | DEBUG_LL_OMAP1(1, omap_h3); | ||
120 | DEBUG_LL_OMAP1(1, omap_innovator); | ||
121 | DEBUG_LL_OMAP1(1, omap_osk); | ||
122 | DEBUG_LL_OMAP1(1, omap_palmte); | ||
123 | DEBUG_LL_OMAP1(1, omap_palmz71); | ||
124 | |||
125 | /* omap15xx/16xx based boards using UART2 */ | ||
126 | DEBUG_LL_OMAP1(2, omap_palmtt); | ||
127 | |||
128 | /* omap15xx/16xx based boards using UART3 */ | ||
129 | DEBUG_LL_OMAP1(3, sx1); | ||
130 | |||
131 | /* omap2 based boards using UART1 */ | ||
132 | DEBUG_LL_OMAP2(1, omap_2430sdp); | ||
133 | DEBUG_LL_OMAP2(1, omap_apollon); | ||
134 | DEBUG_LL_OMAP2(1, omap_h4); | ||
135 | |||
136 | /* omap2 based boards using UART3 */ | ||
137 | DEBUG_LL_OMAP2(3, nokia_n800); | ||
138 | DEBUG_LL_OMAP2(3, nokia_n810); | ||
139 | DEBUG_LL_OMAP2(3, nokia_n810_wimax); | ||
140 | |||
141 | /* omap3 based boards using UART1 */ | ||
142 | DEBUG_LL_OMAP2(1, omap3evm); | ||
143 | DEBUG_LL_OMAP3(1, omap_3430sdp); | ||
144 | DEBUG_LL_OMAP3(1, omap_3630sdp); | ||
145 | DEBUG_LL_OMAP3(1, omap3530_lv_som); | ||
146 | DEBUG_LL_OMAP3(1, omap3_torpedo); | ||
147 | |||
148 | /* omap3 based boards using UART3 */ | ||
149 | DEBUG_LL_OMAP3(3, cm_t35); | ||
150 | DEBUG_LL_OMAP3(3, cm_t3517); | ||
151 | DEBUG_LL_OMAP3(3, cm_t3730); | ||
152 | DEBUG_LL_OMAP3(3, craneboard); | ||
153 | DEBUG_LL_OMAP3(3, devkit8000); | ||
154 | DEBUG_LL_OMAP3(3, igep0020); | ||
155 | DEBUG_LL_OMAP3(3, igep0030); | ||
156 | DEBUG_LL_OMAP3(3, nokia_rm680); | ||
157 | DEBUG_LL_OMAP3(3, nokia_rx51); | ||
158 | DEBUG_LL_OMAP3(3, omap3517evm); | ||
159 | DEBUG_LL_OMAP3(3, omap3_beagle); | ||
160 | DEBUG_LL_OMAP3(3, omap3_pandora); | ||
161 | DEBUG_LL_OMAP3(3, omap_ldp); | ||
162 | DEBUG_LL_OMAP3(3, overo); | ||
163 | DEBUG_LL_OMAP3(3, touchbook); | ||
164 | |||
165 | /* omap4 based boards using UART3 */ | ||
166 | DEBUG_LL_OMAP4(3, omap_4430sdp); | ||
167 | DEBUG_LL_OMAP4(3, omap4_panda); | ||
168 | |||
169 | /* zoom2/3 external uart */ | ||
170 | DEBUG_LL_ZOOM(omap_zoom2); | ||
171 | DEBUG_LL_ZOOM(omap_zoom3); | ||
172 | |||
173 | /* TI8168 base boards using UART3 */ | ||
174 | DEBUG_LL_TI816X(3, ti8168evm); | ||
175 | |||
176 | } while (0); | ||
177 | } | ||
178 | |||
179 | #define arch_decomp_setup() __arch_decomp_setup(arch_id) | ||
180 | |||
181 | /* | ||
182 | * nothing to do | ||
183 | */ | ||
184 | #define arch_decomp_wdog() | ||
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h new file mode 100644 index 00000000000..17d3c939775 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/usb.h | |||
@@ -0,0 +1,296 @@ | |||
1 | // include/asm-arm/mach-omap/usb.h | ||
2 | |||
3 | #ifndef __ASM_ARCH_OMAP_USB_H | ||
4 | #define __ASM_ARCH_OMAP_USB_H | ||
5 | |||
6 | #include <linux/usb/musb.h> | ||
7 | #include <plat/board.h> | ||
8 | |||
9 | #define OMAP3_HS_USB_PORTS 3 | ||
10 | |||
11 | enum usbhs_omap_port_mode { | ||
12 | OMAP_USBHS_PORT_MODE_UNUSED, | ||
13 | OMAP_EHCI_PORT_MODE_PHY, | ||
14 | OMAP_EHCI_PORT_MODE_TLL, | ||
15 | OMAP_EHCI_PORT_MODE_HSIC, | ||
16 | OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0, | ||
17 | OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM, | ||
18 | OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0, | ||
19 | OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM, | ||
20 | OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0, | ||
21 | OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM, | ||
22 | OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0, | ||
23 | OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM, | ||
24 | OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0, | ||
25 | OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM | ||
26 | }; | ||
27 | |||
28 | struct usbhs_omap_board_data { | ||
29 | enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS]; | ||
30 | |||
31 | /* have to be valid if phy_reset is true and portx is in phy mode */ | ||
32 | int reset_gpio_port[OMAP3_HS_USB_PORTS]; | ||
33 | |||
34 | /* Set this to true for ES2.x silicon */ | ||
35 | unsigned es2_compatibility:1; | ||
36 | |||
37 | unsigned phy_reset:1; | ||
38 | |||
39 | /* | ||
40 | * Regulators for USB PHYs. | ||
41 | * Each PHY can have a separate regulator. | ||
42 | */ | ||
43 | struct regulator *regulator[OMAP3_HS_USB_PORTS]; | ||
44 | }; | ||
45 | |||
46 | struct ehci_hcd_omap_platform_data { | ||
47 | enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS]; | ||
48 | int reset_gpio_port[OMAP3_HS_USB_PORTS]; | ||
49 | struct regulator *regulator[OMAP3_HS_USB_PORTS]; | ||
50 | unsigned phy_reset:1; | ||
51 | }; | ||
52 | |||
53 | struct ohci_hcd_omap_platform_data { | ||
54 | enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS]; | ||
55 | unsigned es2_compatibility:1; | ||
56 | }; | ||
57 | |||
58 | struct usbhs_omap_platform_data { | ||
59 | enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS]; | ||
60 | |||
61 | struct ehci_hcd_omap_platform_data *ehci_data; | ||
62 | struct ohci_hcd_omap_platform_data *ohci_data; | ||
63 | }; | ||
64 | /*-------------------------------------------------------------------------*/ | ||
65 | |||
66 | #define OMAP1_OTG_BASE 0xfffb0400 | ||
67 | #define OMAP1_UDC_BASE 0xfffb4000 | ||
68 | #define OMAP1_OHCI_BASE 0xfffba000 | ||
69 | |||
70 | #define OMAP2_OHCI_BASE 0x4805e000 | ||
71 | #define OMAP2_UDC_BASE 0x4805e200 | ||
72 | #define OMAP2_OTG_BASE 0x4805e300 | ||
73 | |||
74 | #ifdef CONFIG_ARCH_OMAP1 | ||
75 | |||
76 | #define OTG_BASE OMAP1_OTG_BASE | ||
77 | #define UDC_BASE OMAP1_UDC_BASE | ||
78 | #define OMAP_OHCI_BASE OMAP1_OHCI_BASE | ||
79 | |||
80 | #else | ||
81 | |||
82 | #define OTG_BASE OMAP2_OTG_BASE | ||
83 | #define UDC_BASE OMAP2_UDC_BASE | ||
84 | #define OMAP_OHCI_BASE OMAP2_OHCI_BASE | ||
85 | |||
86 | struct omap_musb_board_data { | ||
87 | u8 interface_type; | ||
88 | u8 mode; | ||
89 | u16 power; | ||
90 | unsigned extvbus:1; | ||
91 | void (*set_phy_power)(u8 on); | ||
92 | void (*clear_irq)(void); | ||
93 | void (*set_mode)(u8 mode); | ||
94 | void (*reset)(void); | ||
95 | }; | ||
96 | |||
97 | enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI}; | ||
98 | |||
99 | extern void usb_musb_init(struct omap_musb_board_data *board_data); | ||
100 | |||
101 | extern void usbhs_init(const struct usbhs_omap_board_data *pdata); | ||
102 | |||
103 | extern int omap_usbhs_enable(struct device *dev); | ||
104 | extern void omap_usbhs_disable(struct device *dev); | ||
105 | |||
106 | extern int omap4430_phy_power(struct device *dev, int ID, int on); | ||
107 | extern int omap4430_phy_set_clk(struct device *dev, int on); | ||
108 | extern int omap4430_phy_init(struct device *dev); | ||
109 | extern int omap4430_phy_exit(struct device *dev); | ||
110 | extern int omap4430_phy_suspend(struct device *dev, int suspend); | ||
111 | #endif | ||
112 | |||
113 | extern void am35x_musb_reset(void); | ||
114 | extern void am35x_musb_phy_power(u8 on); | ||
115 | extern void am35x_musb_clear_irq(void); | ||
116 | extern void am35x_set_mode(u8 musb_mode); | ||
117 | |||
118 | /* | ||
119 | * FIXME correct answer depends on hmc_mode, | ||
120 | * as does (on omap1) any nonzero value for config->otg port number | ||
121 | */ | ||
122 | #ifdef CONFIG_USB_GADGET_OMAP | ||
123 | #define is_usb0_device(config) 1 | ||
124 | #else | ||
125 | #define is_usb0_device(config) 0 | ||
126 | #endif | ||
127 | |||
128 | void omap_otg_init(struct omap_usb_config *config); | ||
129 | |||
130 | #if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE) | ||
131 | void omap1_usb_init(struct omap_usb_config *pdata); | ||
132 | #else | ||
133 | static inline void omap1_usb_init(struct omap_usb_config *pdata) | ||
134 | { | ||
135 | } | ||
136 | #endif | ||
137 | |||
138 | #if defined(CONFIG_ARCH_OMAP_OTG) || defined(CONFIG_ARCH_OMAP_OTG_MODULE) | ||
139 | void omap2_usbfs_init(struct omap_usb_config *pdata); | ||
140 | #else | ||
141 | static inline void omap2_usbfs_init(struct omap_usb_config *pdata) | ||
142 | { | ||
143 | } | ||
144 | #endif | ||
145 | |||
146 | /*-------------------------------------------------------------------------*/ | ||
147 | |||
148 | /* | ||
149 | * OTG and transceiver registers, for OMAPs starting with ARM926 | ||
150 | */ | ||
151 | #define OTG_REV (OTG_BASE + 0x00) | ||
152 | #define OTG_SYSCON_1 (OTG_BASE + 0x04) | ||
153 | # define USB2_TRX_MODE(w) (((w)>>24)&0x07) | ||
154 | # define USB1_TRX_MODE(w) (((w)>>20)&0x07) | ||
155 | # define USB0_TRX_MODE(w) (((w)>>16)&0x07) | ||
156 | # define OTG_IDLE_EN (1 << 15) | ||
157 | # define HST_IDLE_EN (1 << 14) | ||
158 | # define DEV_IDLE_EN (1 << 13) | ||
159 | # define OTG_RESET_DONE (1 << 2) | ||
160 | # define OTG_SOFT_RESET (1 << 1) | ||
161 | #define OTG_SYSCON_2 (OTG_BASE + 0x08) | ||
162 | # define OTG_EN (1 << 31) | ||
163 | # define USBX_SYNCHRO (1 << 30) | ||
164 | # define OTG_MST16 (1 << 29) | ||
165 | # define SRP_GPDATA (1 << 28) | ||
166 | # define SRP_GPDVBUS (1 << 27) | ||
167 | # define SRP_GPUVBUS(w) (((w)>>24)&0x07) | ||
168 | # define A_WAIT_VRISE(w) (((w)>>20)&0x07) | ||
169 | # define B_ASE_BRST(w) (((w)>>16)&0x07) | ||
170 | # define SRP_DPW (1 << 14) | ||
171 | # define SRP_DATA (1 << 13) | ||
172 | # define SRP_VBUS (1 << 12) | ||
173 | # define OTG_PADEN (1 << 10) | ||
174 | # define HMC_PADEN (1 << 9) | ||
175 | # define UHOST_EN (1 << 8) | ||
176 | # define HMC_TLLSPEED (1 << 7) | ||
177 | # define HMC_TLLATTACH (1 << 6) | ||
178 | # define OTG_HMC(w) (((w)>>0)&0x3f) | ||
179 | #define OTG_CTRL (OTG_BASE + 0x0c) | ||
180 | # define OTG_USB2_EN (1 << 29) | ||
181 | # define OTG_USB2_DP (1 << 28) | ||
182 | # define OTG_USB2_DM (1 << 27) | ||
183 | # define OTG_USB1_EN (1 << 26) | ||
184 | # define OTG_USB1_DP (1 << 25) | ||
185 | # define OTG_USB1_DM (1 << 24) | ||
186 | # define OTG_USB0_EN (1 << 23) | ||
187 | # define OTG_USB0_DP (1 << 22) | ||
188 | # define OTG_USB0_DM (1 << 21) | ||
189 | # define OTG_ASESSVLD (1 << 20) | ||
190 | # define OTG_BSESSEND (1 << 19) | ||
191 | # define OTG_BSESSVLD (1 << 18) | ||
192 | # define OTG_VBUSVLD (1 << 17) | ||
193 | # define OTG_ID (1 << 16) | ||
194 | # define OTG_DRIVER_SEL (1 << 15) | ||
195 | # define OTG_A_SETB_HNPEN (1 << 12) | ||
196 | # define OTG_A_BUSREQ (1 << 11) | ||
197 | # define OTG_B_HNPEN (1 << 9) | ||
198 | # define OTG_B_BUSREQ (1 << 8) | ||
199 | # define OTG_BUSDROP (1 << 7) | ||
200 | # define OTG_PULLDOWN (1 << 5) | ||
201 | # define OTG_PULLUP (1 << 4) | ||
202 | # define OTG_DRV_VBUS (1 << 3) | ||
203 | # define OTG_PD_VBUS (1 << 2) | ||
204 | # define OTG_PU_VBUS (1 << 1) | ||
205 | # define OTG_PU_ID (1 << 0) | ||
206 | #define OTG_IRQ_EN (OTG_BASE + 0x10) /* 16-bit */ | ||
207 | # define DRIVER_SWITCH (1 << 15) | ||
208 | # define A_VBUS_ERR (1 << 13) | ||
209 | # define A_REQ_TMROUT (1 << 12) | ||
210 | # define A_SRP_DETECT (1 << 11) | ||
211 | # define B_HNP_FAIL (1 << 10) | ||
212 | # define B_SRP_TMROUT (1 << 9) | ||
213 | # define B_SRP_DONE (1 << 8) | ||
214 | # define B_SRP_STARTED (1 << 7) | ||
215 | # define OPRT_CHG (1 << 0) | ||
216 | #define OTG_IRQ_SRC (OTG_BASE + 0x14) /* 16-bit */ | ||
217 | // same bits as in IRQ_EN | ||
218 | #define OTG_OUTCTRL (OTG_BASE + 0x18) /* 16-bit */ | ||
219 | # define OTGVPD (1 << 14) | ||
220 | # define OTGVPU (1 << 13) | ||
221 | # define OTGPUID (1 << 12) | ||
222 | # define USB2VDR (1 << 10) | ||
223 | # define USB2PDEN (1 << 9) | ||
224 | # define USB2PUEN (1 << 8) | ||
225 | # define USB1VDR (1 << 6) | ||
226 | # define USB1PDEN (1 << 5) | ||
227 | # define USB1PUEN (1 << 4) | ||
228 | # define USB0VDR (1 << 2) | ||
229 | # define USB0PDEN (1 << 1) | ||
230 | # define USB0PUEN (1 << 0) | ||
231 | #define OTG_TEST (OTG_BASE + 0x20) /* 16-bit */ | ||
232 | #define OTG_VENDOR_CODE (OTG_BASE + 0xfc) /* 16-bit */ | ||
233 | |||
234 | /*-------------------------------------------------------------------------*/ | ||
235 | |||
236 | /* OMAP1 */ | ||
237 | #define USB_TRANSCEIVER_CTRL (0xfffe1000 + 0x0064) | ||
238 | # define CONF_USB2_UNI_R (1 << 8) | ||
239 | # define CONF_USB1_UNI_R (1 << 7) | ||
240 | # define CONF_USB_PORT0_R(x) (((x)>>4)&0x7) | ||
241 | # define CONF_USB0_ISOLATE_R (1 << 3) | ||
242 | # define CONF_USB_PWRDN_DM_R (1 << 2) | ||
243 | # define CONF_USB_PWRDN_DP_R (1 << 1) | ||
244 | |||
245 | /* OMAP2 */ | ||
246 | # define USB_UNIDIR 0x0 | ||
247 | # define USB_UNIDIR_TLL 0x1 | ||
248 | # define USB_BIDIR 0x2 | ||
249 | # define USB_BIDIR_TLL 0x3 | ||
250 | # define USBTXWRMODEI(port, x) ((x) << (22 - (port * 2))) | ||
251 | # define USBT2TLL5PI (1 << 17) | ||
252 | # define USB0PUENACTLOI (1 << 16) | ||
253 | # define USBSTANDBYCTRL (1 << 15) | ||
254 | /* AM35x */ | ||
255 | /* USB 2.0 PHY Control */ | ||
256 | #define CONF2_PHY_GPIOMODE (1 << 23) | ||
257 | #define CONF2_OTGMODE (3 << 14) | ||
258 | #define CONF2_NO_OVERRIDE (0 << 14) | ||
259 | #define CONF2_FORCE_HOST (1 << 14) | ||
260 | #define CONF2_FORCE_DEVICE (2 << 14) | ||
261 | #define CONF2_FORCE_HOST_VBUS_LOW (3 << 14) | ||
262 | #define CONF2_SESENDEN (1 << 13) | ||
263 | #define CONF2_VBDTCTEN (1 << 12) | ||
264 | #define CONF2_REFFREQ_24MHZ (2 << 8) | ||
265 | #define CONF2_REFFREQ_26MHZ (7 << 8) | ||
266 | #define CONF2_REFFREQ_13MHZ (6 << 8) | ||
267 | #define CONF2_REFFREQ (0xf << 8) | ||
268 | #define CONF2_PHYCLKGD (1 << 7) | ||
269 | #define CONF2_VBUSSENSE (1 << 6) | ||
270 | #define CONF2_PHY_PLLON (1 << 5) | ||
271 | #define CONF2_RESET (1 << 4) | ||
272 | #define CONF2_PHYPWRDN (1 << 3) | ||
273 | #define CONF2_OTGPWRDN (1 << 2) | ||
274 | #define CONF2_DATPOL (1 << 1) | ||
275 | |||
276 | #if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_USB) | ||
277 | u32 omap1_usb0_init(unsigned nwires, unsigned is_device); | ||
278 | u32 omap1_usb1_init(unsigned nwires); | ||
279 | u32 omap1_usb2_init(unsigned nwires, unsigned alt_pingroup); | ||
280 | #else | ||
281 | static inline u32 omap1_usb0_init(unsigned nwires, unsigned is_device) | ||
282 | { | ||
283 | return 0; | ||
284 | } | ||
285 | static inline u32 omap1_usb1_init(unsigned nwires) | ||
286 | { | ||
287 | return 0; | ||
288 | |||
289 | } | ||
290 | static inline u32 omap1_usb2_init(unsigned nwires, unsigned alt_pingroup) | ||
291 | { | ||
292 | return 0; | ||
293 | } | ||
294 | #endif | ||
295 | |||
296 | #endif /* __ASM_ARCH_OMAP_USB_H */ | ||
diff --git a/arch/arm/plat-omap/include/plat/vram.h b/arch/arm/plat-omap/include/plat/vram.h new file mode 100644 index 00000000000..0aa4ecd12c7 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/vram.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * VRAM manager for OMAP | ||
3 | * | ||
4 | * Copyright (C) 2009 Nokia Corporation | ||
5 | * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef __OMAP_VRAM_H__ | ||
22 | #define __OMAP_VRAM_H__ | ||
23 | |||
24 | #include <linux/types.h> | ||
25 | |||
26 | #define OMAP_VRAM_MEMTYPE_SDRAM 0 | ||
27 | #define OMAP_VRAM_MEMTYPE_SRAM 1 | ||
28 | #define OMAP_VRAM_MEMTYPE_MAX 1 | ||
29 | |||
30 | extern int omap_vram_add_region(unsigned long paddr, size_t size); | ||
31 | extern int omap_vram_free(unsigned long paddr, size_t size); | ||
32 | extern int omap_vram_alloc(int mtype, size_t size, unsigned long *paddr); | ||
33 | extern int omap_vram_reserve(unsigned long paddr, size_t size); | ||
34 | extern void omap_vram_get_info(unsigned long *vram, unsigned long *free_vram, | ||
35 | unsigned long *largest_free_block); | ||
36 | |||
37 | #ifdef CONFIG_OMAP2_VRAM | ||
38 | extern void omap_vram_set_sdram_vram(u32 size, u32 start); | ||
39 | extern void omap_vram_set_sram_vram(u32 size, u32 start); | ||
40 | |||
41 | extern void omap_vram_reserve_sdram_memblock(void); | ||
42 | extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, | ||
43 | unsigned long sram_vstart, | ||
44 | unsigned long sram_size, | ||
45 | unsigned long pstart_avail, | ||
46 | unsigned long size_avail); | ||
47 | #else | ||
48 | static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { } | ||
49 | static inline void omap_vram_set_sram_vram(u32 size, u32 start) { } | ||
50 | |||
51 | static inline void omap_vram_reserve_sdram_memblock(void) { } | ||
52 | static inline unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, | ||
53 | unsigned long sram_vstart, | ||
54 | unsigned long sram_size, | ||
55 | unsigned long pstart_avail, | ||
56 | unsigned long size_avail) | ||
57 | { | ||
58 | return 0; | ||
59 | } | ||
60 | #endif | ||
61 | |||
62 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/vrfb.h b/arch/arm/plat-omap/include/plat/vrfb.h new file mode 100644 index 00000000000..3792bdea2f6 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/vrfb.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /* | ||
2 | * VRFB Rotation Engine | ||
3 | * | ||
4 | * Copyright (C) 2009 Nokia Corporation | ||
5 | * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef __OMAP_VRFB_H__ | ||
22 | #define __OMAP_VRFB_H__ | ||
23 | |||
24 | #define OMAP_VRFB_LINE_LEN 2048 | ||
25 | |||
26 | struct vrfb { | ||
27 | u8 context; | ||
28 | void __iomem *vaddr[4]; | ||
29 | unsigned long paddr[4]; | ||
30 | u16 xres; | ||
31 | u16 yres; | ||
32 | u16 xoffset; | ||
33 | u16 yoffset; | ||
34 | u8 bytespp; | ||
35 | bool yuv_mode; | ||
36 | }; | ||
37 | |||
38 | #ifdef CONFIG_OMAP2_VRFB | ||
39 | extern int omap_vrfb_request_ctx(struct vrfb *vrfb); | ||
40 | extern void omap_vrfb_release_ctx(struct vrfb *vrfb); | ||
41 | extern void omap_vrfb_adjust_size(u16 *width, u16 *height, | ||
42 | u8 bytespp); | ||
43 | extern u32 omap_vrfb_min_phys_size(u16 width, u16 height, u8 bytespp); | ||
44 | extern u16 omap_vrfb_max_height(u32 phys_size, u16 width, u8 bytespp); | ||
45 | extern void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr, | ||
46 | u16 width, u16 height, | ||
47 | unsigned bytespp, bool yuv_mode); | ||
48 | extern int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot); | ||
49 | extern void omap_vrfb_restore_context(void); | ||
50 | |||
51 | #else | ||
52 | static inline int omap_vrfb_request_ctx(struct vrfb *vrfb) { return 0; } | ||
53 | static inline void omap_vrfb_release_ctx(struct vrfb *vrfb) {} | ||
54 | static inline void omap_vrfb_adjust_size(u16 *width, u16 *height, | ||
55 | u8 bytespp) {} | ||
56 | static inline u32 omap_vrfb_min_phys_size(u16 width, u16 height, u8 bytespp) | ||
57 | { return 0; } | ||
58 | static inline u16 omap_vrfb_max_height(u32 phys_size, u16 width, u8 bytespp) | ||
59 | { return 0; } | ||
60 | static inline void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr, | ||
61 | u16 width, u16 height, unsigned bytespp, bool yuv_mode) {} | ||
62 | static inline int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot) | ||
63 | { return 0; } | ||
64 | static inline void omap_vrfb_restore_context(void) {} | ||
65 | #endif | ||
66 | #endif /* __VRFB_H */ | ||
diff --git a/arch/arm/plat-omap/io.c b/arch/arm/plat-omap/io.c new file mode 100644 index 00000000000..f1ecfa9fc61 --- /dev/null +++ b/arch/arm/plat-omap/io.c | |||
@@ -0,0 +1,141 @@ | |||
1 | /* | ||
2 | * Common io.c file | ||
3 | * This file is created by Russell King <rmk+kernel@arm.linux.org.uk> | ||
4 | * | ||
5 | * Copyright (C) 2009 Texas Instruments | ||
6 | * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/io.h> | ||
14 | #include <linux/mm.h> | ||
15 | |||
16 | #include <plat/omap7xx.h> | ||
17 | #include <plat/omap1510.h> | ||
18 | #include <plat/omap16xx.h> | ||
19 | #include <plat/omap24xx.h> | ||
20 | #include <plat/omap34xx.h> | ||
21 | #include <plat/omap44xx.h> | ||
22 | |||
23 | #define BETWEEN(p,st,sz) ((p) >= (st) && (p) < ((st) + (sz))) | ||
24 | #define XLATE(p,pst,vst) ((void __iomem *)((p) - (pst) + (vst))) | ||
25 | |||
26 | /* | ||
27 | * Intercept ioremap() requests for addresses in our fixed mapping regions. | ||
28 | */ | ||
29 | void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type) | ||
30 | { | ||
31 | #ifdef CONFIG_ARCH_OMAP1 | ||
32 | if (cpu_class_is_omap1()) { | ||
33 | if (BETWEEN(p, OMAP1_IO_PHYS, OMAP1_IO_SIZE)) | ||
34 | return XLATE(p, OMAP1_IO_PHYS, OMAP1_IO_VIRT); | ||
35 | } | ||
36 | if (cpu_is_omap7xx()) { | ||
37 | if (BETWEEN(p, OMAP7XX_DSP_BASE, OMAP7XX_DSP_SIZE)) | ||
38 | return XLATE(p, OMAP7XX_DSP_BASE, OMAP7XX_DSP_START); | ||
39 | |||
40 | if (BETWEEN(p, OMAP7XX_DSPREG_BASE, OMAP7XX_DSPREG_SIZE)) | ||
41 | return XLATE(p, OMAP7XX_DSPREG_BASE, | ||
42 | OMAP7XX_DSPREG_START); | ||
43 | } | ||
44 | if (cpu_is_omap15xx()) { | ||
45 | if (BETWEEN(p, OMAP1510_DSP_BASE, OMAP1510_DSP_SIZE)) | ||
46 | return XLATE(p, OMAP1510_DSP_BASE, OMAP1510_DSP_START); | ||
47 | |||
48 | if (BETWEEN(p, OMAP1510_DSPREG_BASE, OMAP1510_DSPREG_SIZE)) | ||
49 | return XLATE(p, OMAP1510_DSPREG_BASE, | ||
50 | OMAP1510_DSPREG_START); | ||
51 | } | ||
52 | if (cpu_is_omap16xx()) { | ||
53 | if (BETWEEN(p, OMAP16XX_DSP_BASE, OMAP16XX_DSP_SIZE)) | ||
54 | return XLATE(p, OMAP16XX_DSP_BASE, OMAP16XX_DSP_START); | ||
55 | |||
56 | if (BETWEEN(p, OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_SIZE)) | ||
57 | return XLATE(p, OMAP16XX_DSPREG_BASE, | ||
58 | OMAP16XX_DSPREG_START); | ||
59 | } | ||
60 | #endif | ||
61 | #ifdef CONFIG_ARCH_OMAP2 | ||
62 | if (cpu_is_omap24xx()) { | ||
63 | if (BETWEEN(p, L3_24XX_PHYS, L3_24XX_SIZE)) | ||
64 | return XLATE(p, L3_24XX_PHYS, L3_24XX_VIRT); | ||
65 | if (BETWEEN(p, L4_24XX_PHYS, L4_24XX_SIZE)) | ||
66 | return XLATE(p, L4_24XX_PHYS, L4_24XX_VIRT); | ||
67 | } | ||
68 | if (cpu_is_omap2420()) { | ||
69 | if (BETWEEN(p, DSP_MEM_2420_PHYS, DSP_MEM_2420_SIZE)) | ||
70 | return XLATE(p, DSP_MEM_2420_PHYS, DSP_MEM_2420_VIRT); | ||
71 | if (BETWEEN(p, DSP_IPI_2420_PHYS, DSP_IPI_2420_SIZE)) | ||
72 | return XLATE(p, DSP_IPI_2420_PHYS, DSP_IPI_2420_SIZE); | ||
73 | if (BETWEEN(p, DSP_MMU_2420_PHYS, DSP_MMU_2420_SIZE)) | ||
74 | return XLATE(p, DSP_MMU_2420_PHYS, DSP_MMU_2420_VIRT); | ||
75 | } | ||
76 | if (cpu_is_omap2430()) { | ||
77 | if (BETWEEN(p, L4_WK_243X_PHYS, L4_WK_243X_SIZE)) | ||
78 | return XLATE(p, L4_WK_243X_PHYS, L4_WK_243X_VIRT); | ||
79 | if (BETWEEN(p, OMAP243X_GPMC_PHYS, OMAP243X_GPMC_SIZE)) | ||
80 | return XLATE(p, OMAP243X_GPMC_PHYS, OMAP243X_GPMC_VIRT); | ||
81 | if (BETWEEN(p, OMAP243X_SDRC_PHYS, OMAP243X_SDRC_SIZE)) | ||
82 | return XLATE(p, OMAP243X_SDRC_PHYS, OMAP243X_SDRC_VIRT); | ||
83 | if (BETWEEN(p, OMAP243X_SMS_PHYS, OMAP243X_SMS_SIZE)) | ||
84 | return XLATE(p, OMAP243X_SMS_PHYS, OMAP243X_SMS_VIRT); | ||
85 | } | ||
86 | #endif | ||
87 | #ifdef CONFIG_ARCH_OMAP3 | ||
88 | if (cpu_is_ti816x()) { | ||
89 | if (BETWEEN(p, L4_34XX_PHYS, L4_34XX_SIZE)) | ||
90 | return XLATE(p, L4_34XX_PHYS, L4_34XX_VIRT); | ||
91 | } else if (cpu_is_omap34xx()) { | ||
92 | if (BETWEEN(p, L3_34XX_PHYS, L3_34XX_SIZE)) | ||
93 | return XLATE(p, L3_34XX_PHYS, L3_34XX_VIRT); | ||
94 | if (BETWEEN(p, L4_34XX_PHYS, L4_34XX_SIZE)) | ||
95 | return XLATE(p, L4_34XX_PHYS, L4_34XX_VIRT); | ||
96 | if (BETWEEN(p, OMAP34XX_GPMC_PHYS, OMAP34XX_GPMC_SIZE)) | ||
97 | return XLATE(p, OMAP34XX_GPMC_PHYS, OMAP34XX_GPMC_VIRT); | ||
98 | if (BETWEEN(p, OMAP343X_SMS_PHYS, OMAP343X_SMS_SIZE)) | ||
99 | return XLATE(p, OMAP343X_SMS_PHYS, OMAP343X_SMS_VIRT); | ||
100 | if (BETWEEN(p, OMAP343X_SDRC_PHYS, OMAP343X_SDRC_SIZE)) | ||
101 | return XLATE(p, OMAP343X_SDRC_PHYS, OMAP343X_SDRC_VIRT); | ||
102 | if (BETWEEN(p, L4_PER_34XX_PHYS, L4_PER_34XX_SIZE)) | ||
103 | return XLATE(p, L4_PER_34XX_PHYS, L4_PER_34XX_VIRT); | ||
104 | if (BETWEEN(p, L4_EMU_34XX_PHYS, L4_EMU_34XX_SIZE)) | ||
105 | return XLATE(p, L4_EMU_34XX_PHYS, L4_EMU_34XX_VIRT); | ||
106 | } | ||
107 | #endif | ||
108 | #ifdef CONFIG_ARCH_OMAP4 | ||
109 | if (cpu_is_omap44xx()) { | ||
110 | if (BETWEEN(p, L3_44XX_PHYS, L3_44XX_SIZE)) | ||
111 | return XLATE(p, L3_44XX_PHYS, L3_44XX_VIRT); | ||
112 | if (BETWEEN(p, L4_44XX_PHYS, L4_44XX_SIZE)) | ||
113 | return XLATE(p, L4_44XX_PHYS, L4_44XX_VIRT); | ||
114 | if (BETWEEN(p, OMAP44XX_GPMC_PHYS, OMAP44XX_GPMC_SIZE)) | ||
115 | return XLATE(p, OMAP44XX_GPMC_PHYS, OMAP44XX_GPMC_VIRT); | ||
116 | if (BETWEEN(p, OMAP44XX_EMIF1_PHYS, OMAP44XX_EMIF1_SIZE)) | ||
117 | return XLATE(p, OMAP44XX_EMIF1_PHYS, \ | ||
118 | OMAP44XX_EMIF1_VIRT); | ||
119 | if (BETWEEN(p, OMAP44XX_EMIF2_PHYS, OMAP44XX_EMIF2_SIZE)) | ||
120 | return XLATE(p, OMAP44XX_EMIF2_PHYS, \ | ||
121 | OMAP44XX_EMIF2_VIRT); | ||
122 | if (BETWEEN(p, OMAP44XX_DMM_PHYS, OMAP44XX_DMM_SIZE)) | ||
123 | return XLATE(p, OMAP44XX_DMM_PHYS, OMAP44XX_DMM_VIRT); | ||
124 | if (BETWEEN(p, L4_PER_44XX_PHYS, L4_PER_44XX_SIZE)) | ||
125 | return XLATE(p, L4_PER_44XX_PHYS, L4_PER_44XX_VIRT); | ||
126 | if (BETWEEN(p, L4_EMU_44XX_PHYS, L4_EMU_44XX_SIZE)) | ||
127 | return XLATE(p, L4_EMU_44XX_PHYS, L4_EMU_44XX_VIRT); | ||
128 | } | ||
129 | #endif | ||
130 | return __arm_ioremap_caller(p, size, type, __builtin_return_address(0)); | ||
131 | } | ||
132 | EXPORT_SYMBOL(omap_ioremap); | ||
133 | |||
134 | void omap_iounmap(volatile void __iomem *addr) | ||
135 | { | ||
136 | unsigned long virt = (unsigned long)addr; | ||
137 | |||
138 | if (virt >= VMALLOC_START && virt < VMALLOC_END) | ||
139 | __iounmap(addr); | ||
140 | } | ||
141 | EXPORT_SYMBOL(omap_iounmap); | ||
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c new file mode 100644 index 00000000000..6c62af10871 --- /dev/null +++ b/arch/arm/plat-omap/mcbsp.c | |||
@@ -0,0 +1,1418 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/plat-omap/mcbsp.c | ||
3 | * | ||
4 | * Copyright (C) 2004 Nokia Corporation | ||
5 | * Author: Samuel Ortiz <samuel.ortiz@nokia.com> | ||
6 | * | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * Multichannel mode not supported. | ||
13 | */ | ||
14 | |||
15 | #include <linux/module.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/err.h> | ||
21 | #include <linux/clk.h> | ||
22 | #include <linux/delay.h> | ||
23 | #include <linux/io.h> | ||
24 | #include <linux/slab.h> | ||
25 | |||
26 | #include <plat/mcbsp.h> | ||
27 | #include <plat/omap_device.h> | ||
28 | #include <linux/pm_runtime.h> | ||
29 | |||
30 | /* XXX These "sideways" includes are a sign that something is wrong */ | ||
31 | #include "../mach-omap2/cm2xxx_3xxx.h" | ||
32 | #include "../mach-omap2/cm-regbits-34xx.h" | ||
33 | |||
34 | struct omap_mcbsp **mcbsp_ptr; | ||
35 | int omap_mcbsp_count, omap_mcbsp_cache_size; | ||
36 | |||
37 | static void omap_mcbsp_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val) | ||
38 | { | ||
39 | if (cpu_class_is_omap1()) { | ||
40 | ((u16 *)mcbsp->reg_cache)[reg / sizeof(u16)] = (u16)val; | ||
41 | __raw_writew((u16)val, mcbsp->io_base + reg); | ||
42 | } else if (cpu_is_omap2420()) { | ||
43 | ((u16 *)mcbsp->reg_cache)[reg / sizeof(u32)] = (u16)val; | ||
44 | __raw_writew((u16)val, mcbsp->io_base + reg); | ||
45 | } else { | ||
46 | ((u32 *)mcbsp->reg_cache)[reg / sizeof(u32)] = val; | ||
47 | __raw_writel(val, mcbsp->io_base + reg); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | static int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg, bool from_cache) | ||
52 | { | ||
53 | if (cpu_class_is_omap1()) { | ||
54 | return !from_cache ? __raw_readw(mcbsp->io_base + reg) : | ||
55 | ((u16 *)mcbsp->reg_cache)[reg / sizeof(u16)]; | ||
56 | } else if (cpu_is_omap2420()) { | ||
57 | return !from_cache ? __raw_readw(mcbsp->io_base + reg) : | ||
58 | ((u16 *)mcbsp->reg_cache)[reg / sizeof(u32)]; | ||
59 | } else { | ||
60 | return !from_cache ? __raw_readl(mcbsp->io_base + reg) : | ||
61 | ((u32 *)mcbsp->reg_cache)[reg / sizeof(u32)]; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | #ifdef CONFIG_ARCH_OMAP3 | ||
66 | static void omap_mcbsp_st_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val) | ||
67 | { | ||
68 | __raw_writel(val, mcbsp->st_data->io_base_st + reg); | ||
69 | } | ||
70 | |||
71 | static int omap_mcbsp_st_read(struct omap_mcbsp *mcbsp, u16 reg) | ||
72 | { | ||
73 | return __raw_readl(mcbsp->st_data->io_base_st + reg); | ||
74 | } | ||
75 | #endif | ||
76 | |||
77 | #define MCBSP_READ(mcbsp, reg) \ | ||
78 | omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 0) | ||
79 | #define MCBSP_WRITE(mcbsp, reg, val) \ | ||
80 | omap_mcbsp_write(mcbsp, OMAP_MCBSP_REG_##reg, val) | ||
81 | #define MCBSP_READ_CACHE(mcbsp, reg) \ | ||
82 | omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 1) | ||
83 | |||
84 | #define MCBSP_ST_READ(mcbsp, reg) \ | ||
85 | omap_mcbsp_st_read(mcbsp, OMAP_ST_REG_##reg) | ||
86 | #define MCBSP_ST_WRITE(mcbsp, reg, val) \ | ||
87 | omap_mcbsp_st_write(mcbsp, OMAP_ST_REG_##reg, val) | ||
88 | |||
89 | static void omap_mcbsp_dump_reg(u8 id) | ||
90 | { | ||
91 | struct omap_mcbsp *mcbsp = id_to_mcbsp_ptr(id); | ||
92 | |||
93 | dev_dbg(mcbsp->dev, "**** McBSP%d regs ****\n", mcbsp->id); | ||
94 | dev_dbg(mcbsp->dev, "DRR2: 0x%04x\n", | ||
95 | MCBSP_READ(mcbsp, DRR2)); | ||
96 | dev_dbg(mcbsp->dev, "DRR1: 0x%04x\n", | ||
97 | MCBSP_READ(mcbsp, DRR1)); | ||
98 | dev_dbg(mcbsp->dev, "DXR2: 0x%04x\n", | ||
99 | MCBSP_READ(mcbsp, DXR2)); | ||
100 | dev_dbg(mcbsp->dev, "DXR1: 0x%04x\n", | ||
101 | MCBSP_READ(mcbsp, DXR1)); | ||
102 | dev_dbg(mcbsp->dev, "SPCR2: 0x%04x\n", | ||
103 | MCBSP_READ(mcbsp, SPCR2)); | ||
104 | dev_dbg(mcbsp->dev, "SPCR1: 0x%04x\n", | ||
105 | MCBSP_READ(mcbsp, SPCR1)); | ||
106 | dev_dbg(mcbsp->dev, "RCR2: 0x%04x\n", | ||
107 | MCBSP_READ(mcbsp, RCR2)); | ||
108 | dev_dbg(mcbsp->dev, "RCR1: 0x%04x\n", | ||
109 | MCBSP_READ(mcbsp, RCR1)); | ||
110 | dev_dbg(mcbsp->dev, "XCR2: 0x%04x\n", | ||
111 | MCBSP_READ(mcbsp, XCR2)); | ||
112 | dev_dbg(mcbsp->dev, "XCR1: 0x%04x\n", | ||
113 | MCBSP_READ(mcbsp, XCR1)); | ||
114 | dev_dbg(mcbsp->dev, "SRGR2: 0x%04x\n", | ||
115 | MCBSP_READ(mcbsp, SRGR2)); | ||
116 | dev_dbg(mcbsp->dev, "SRGR1: 0x%04x\n", | ||
117 | MCBSP_READ(mcbsp, SRGR1)); | ||
118 | dev_dbg(mcbsp->dev, "PCR0: 0x%04x\n", | ||
119 | MCBSP_READ(mcbsp, PCR0)); | ||
120 | dev_dbg(mcbsp->dev, "***********************\n"); | ||
121 | } | ||
122 | |||
123 | static irqreturn_t omap_mcbsp_tx_irq_handler(int irq, void *dev_id) | ||
124 | { | ||
125 | struct omap_mcbsp *mcbsp_tx = dev_id; | ||
126 | u16 irqst_spcr2; | ||
127 | |||
128 | irqst_spcr2 = MCBSP_READ(mcbsp_tx, SPCR2); | ||
129 | dev_dbg(mcbsp_tx->dev, "TX IRQ callback : 0x%x\n", irqst_spcr2); | ||
130 | |||
131 | if (irqst_spcr2 & XSYNC_ERR) { | ||
132 | dev_err(mcbsp_tx->dev, "TX Frame Sync Error! : 0x%x\n", | ||
133 | irqst_spcr2); | ||
134 | /* Writing zero to XSYNC_ERR clears the IRQ */ | ||
135 | MCBSP_WRITE(mcbsp_tx, SPCR2, MCBSP_READ_CACHE(mcbsp_tx, SPCR2)); | ||
136 | } | ||
137 | |||
138 | return IRQ_HANDLED; | ||
139 | } | ||
140 | |||
141 | static irqreturn_t omap_mcbsp_rx_irq_handler(int irq, void *dev_id) | ||
142 | { | ||
143 | struct omap_mcbsp *mcbsp_rx = dev_id; | ||
144 | u16 irqst_spcr1; | ||
145 | |||
146 | irqst_spcr1 = MCBSP_READ(mcbsp_rx, SPCR1); | ||
147 | dev_dbg(mcbsp_rx->dev, "RX IRQ callback : 0x%x\n", irqst_spcr1); | ||
148 | |||
149 | if (irqst_spcr1 & RSYNC_ERR) { | ||
150 | dev_err(mcbsp_rx->dev, "RX Frame Sync Error! : 0x%x\n", | ||
151 | irqst_spcr1); | ||
152 | /* Writing zero to RSYNC_ERR clears the IRQ */ | ||
153 | MCBSP_WRITE(mcbsp_rx, SPCR1, MCBSP_READ_CACHE(mcbsp_rx, SPCR1)); | ||
154 | } | ||
155 | |||
156 | return IRQ_HANDLED; | ||
157 | } | ||
158 | |||
159 | /* | ||
160 | * omap_mcbsp_config simply write a config to the | ||
161 | * appropriate McBSP. | ||
162 | * You either call this function or set the McBSP registers | ||
163 | * by yourself before calling omap_mcbsp_start(). | ||
164 | */ | ||
165 | void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config) | ||
166 | { | ||
167 | struct omap_mcbsp *mcbsp; | ||
168 | |||
169 | if (!omap_mcbsp_check_valid_id(id)) { | ||
170 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
171 | return; | ||
172 | } | ||
173 | mcbsp = id_to_mcbsp_ptr(id); | ||
174 | |||
175 | dev_dbg(mcbsp->dev, "Configuring McBSP%d phys_base: 0x%08lx\n", | ||
176 | mcbsp->id, mcbsp->phys_base); | ||
177 | |||
178 | /* We write the given config */ | ||
179 | MCBSP_WRITE(mcbsp, SPCR2, config->spcr2); | ||
180 | MCBSP_WRITE(mcbsp, SPCR1, config->spcr1); | ||
181 | MCBSP_WRITE(mcbsp, RCR2, config->rcr2); | ||
182 | MCBSP_WRITE(mcbsp, RCR1, config->rcr1); | ||
183 | MCBSP_WRITE(mcbsp, XCR2, config->xcr2); | ||
184 | MCBSP_WRITE(mcbsp, XCR1, config->xcr1); | ||
185 | MCBSP_WRITE(mcbsp, SRGR2, config->srgr2); | ||
186 | MCBSP_WRITE(mcbsp, SRGR1, config->srgr1); | ||
187 | MCBSP_WRITE(mcbsp, MCR2, config->mcr2); | ||
188 | MCBSP_WRITE(mcbsp, MCR1, config->mcr1); | ||
189 | MCBSP_WRITE(mcbsp, PCR0, config->pcr0); | ||
190 | if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) { | ||
191 | MCBSP_WRITE(mcbsp, XCCR, config->xccr); | ||
192 | MCBSP_WRITE(mcbsp, RCCR, config->rccr); | ||
193 | } | ||
194 | } | ||
195 | EXPORT_SYMBOL(omap_mcbsp_config); | ||
196 | |||
197 | /** | ||
198 | * omap_mcbsp_dma_params - returns the dma channel number | ||
199 | * @id - mcbsp id | ||
200 | * @stream - indicates the direction of data flow (rx or tx) | ||
201 | * | ||
202 | * Returns the dma channel number for the rx channel or tx channel | ||
203 | * based on the value of @stream for the requested mcbsp given by @id | ||
204 | */ | ||
205 | int omap_mcbsp_dma_ch_params(unsigned int id, unsigned int stream) | ||
206 | { | ||
207 | struct omap_mcbsp *mcbsp; | ||
208 | |||
209 | if (!omap_mcbsp_check_valid_id(id)) { | ||
210 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
211 | return -ENODEV; | ||
212 | } | ||
213 | mcbsp = id_to_mcbsp_ptr(id); | ||
214 | |||
215 | if (stream) | ||
216 | return mcbsp->dma_rx_sync; | ||
217 | else | ||
218 | return mcbsp->dma_tx_sync; | ||
219 | } | ||
220 | EXPORT_SYMBOL(omap_mcbsp_dma_ch_params); | ||
221 | |||
222 | /** | ||
223 | * omap_mcbsp_dma_reg_params - returns the address of mcbsp data register | ||
224 | * @id - mcbsp id | ||
225 | * @stream - indicates the direction of data flow (rx or tx) | ||
226 | * | ||
227 | * Returns the address of mcbsp data transmit register or data receive register | ||
228 | * to be used by DMA for transferring/receiving data based on the value of | ||
229 | * @stream for the requested mcbsp given by @id | ||
230 | */ | ||
231 | int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream) | ||
232 | { | ||
233 | struct omap_mcbsp *mcbsp; | ||
234 | int data_reg; | ||
235 | |||
236 | if (!omap_mcbsp_check_valid_id(id)) { | ||
237 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
238 | return -ENODEV; | ||
239 | } | ||
240 | mcbsp = id_to_mcbsp_ptr(id); | ||
241 | |||
242 | data_reg = mcbsp->phys_dma_base; | ||
243 | |||
244 | if (mcbsp->mcbsp_config_type < MCBSP_CONFIG_TYPE2) { | ||
245 | if (stream) | ||
246 | data_reg += OMAP_MCBSP_REG_DRR1; | ||
247 | else | ||
248 | data_reg += OMAP_MCBSP_REG_DXR1; | ||
249 | } else { | ||
250 | if (stream) | ||
251 | data_reg += OMAP_MCBSP_REG_DRR; | ||
252 | else | ||
253 | data_reg += OMAP_MCBSP_REG_DXR; | ||
254 | } | ||
255 | |||
256 | return data_reg; | ||
257 | } | ||
258 | EXPORT_SYMBOL(omap_mcbsp_dma_reg_params); | ||
259 | |||
260 | #ifdef CONFIG_ARCH_OMAP3 | ||
261 | static struct omap_device *find_omap_device_by_dev(struct device *dev) | ||
262 | { | ||
263 | struct platform_device *pdev = container_of(dev, | ||
264 | struct platform_device, dev); | ||
265 | return container_of(pdev, struct omap_device, pdev); | ||
266 | } | ||
267 | |||
268 | static void omap_st_on(struct omap_mcbsp *mcbsp) | ||
269 | { | ||
270 | unsigned int w; | ||
271 | struct omap_device *od; | ||
272 | |||
273 | od = find_omap_device_by_dev(mcbsp->dev); | ||
274 | |||
275 | /* | ||
276 | * Sidetone uses McBSP ICLK - which must not idle when sidetones | ||
277 | * are enabled or sidetones start sounding ugly. | ||
278 | */ | ||
279 | w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE); | ||
280 | w &= ~(1 << (mcbsp->id - 2)); | ||
281 | omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE); | ||
282 | |||
283 | /* Enable McBSP Sidetone */ | ||
284 | w = MCBSP_READ(mcbsp, SSELCR); | ||
285 | MCBSP_WRITE(mcbsp, SSELCR, w | SIDETONEEN); | ||
286 | |||
287 | /* Enable Sidetone from Sidetone Core */ | ||
288 | w = MCBSP_ST_READ(mcbsp, SSELCR); | ||
289 | MCBSP_ST_WRITE(mcbsp, SSELCR, w | ST_SIDETONEEN); | ||
290 | } | ||
291 | |||
292 | static void omap_st_off(struct omap_mcbsp *mcbsp) | ||
293 | { | ||
294 | unsigned int w; | ||
295 | struct omap_device *od; | ||
296 | |||
297 | od = find_omap_device_by_dev(mcbsp->dev); | ||
298 | |||
299 | w = MCBSP_ST_READ(mcbsp, SSELCR); | ||
300 | MCBSP_ST_WRITE(mcbsp, SSELCR, w & ~(ST_SIDETONEEN)); | ||
301 | |||
302 | w = MCBSP_READ(mcbsp, SSELCR); | ||
303 | MCBSP_WRITE(mcbsp, SSELCR, w & ~(SIDETONEEN)); | ||
304 | |||
305 | w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE); | ||
306 | w |= 1 << (mcbsp->id - 2); | ||
307 | omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE); | ||
308 | } | ||
309 | |||
310 | static void omap_st_fir_write(struct omap_mcbsp *mcbsp, s16 *fir) | ||
311 | { | ||
312 | u16 val, i; | ||
313 | struct omap_device *od; | ||
314 | |||
315 | od = find_omap_device_by_dev(mcbsp->dev); | ||
316 | |||
317 | val = MCBSP_ST_READ(mcbsp, SSELCR); | ||
318 | |||
319 | if (val & ST_COEFFWREN) | ||
320 | MCBSP_ST_WRITE(mcbsp, SSELCR, val & ~(ST_COEFFWREN)); | ||
321 | |||
322 | MCBSP_ST_WRITE(mcbsp, SSELCR, val | ST_COEFFWREN); | ||
323 | |||
324 | for (i = 0; i < 128; i++) | ||
325 | MCBSP_ST_WRITE(mcbsp, SFIRCR, fir[i]); | ||
326 | |||
327 | i = 0; | ||
328 | |||
329 | val = MCBSP_ST_READ(mcbsp, SSELCR); | ||
330 | while (!(val & ST_COEFFWRDONE) && (++i < 1000)) | ||
331 | val = MCBSP_ST_READ(mcbsp, SSELCR); | ||
332 | |||
333 | MCBSP_ST_WRITE(mcbsp, SSELCR, val & ~(ST_COEFFWREN)); | ||
334 | |||
335 | if (i == 1000) | ||
336 | dev_err(mcbsp->dev, "McBSP FIR load error!\n"); | ||
337 | } | ||
338 | |||
339 | static void omap_st_chgain(struct omap_mcbsp *mcbsp) | ||
340 | { | ||
341 | u16 w; | ||
342 | struct omap_mcbsp_st_data *st_data = mcbsp->st_data; | ||
343 | struct omap_device *od; | ||
344 | |||
345 | od = find_omap_device_by_dev(mcbsp->dev); | ||
346 | |||
347 | w = MCBSP_ST_READ(mcbsp, SSELCR); | ||
348 | |||
349 | MCBSP_ST_WRITE(mcbsp, SGAINCR, ST_CH0GAIN(st_data->ch0gain) | \ | ||
350 | ST_CH1GAIN(st_data->ch1gain)); | ||
351 | } | ||
352 | |||
353 | int omap_st_set_chgain(unsigned int id, int channel, s16 chgain) | ||
354 | { | ||
355 | struct omap_mcbsp *mcbsp; | ||
356 | struct omap_mcbsp_st_data *st_data; | ||
357 | int ret = 0; | ||
358 | |||
359 | if (!omap_mcbsp_check_valid_id(id)) { | ||
360 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
361 | return -ENODEV; | ||
362 | } | ||
363 | |||
364 | mcbsp = id_to_mcbsp_ptr(id); | ||
365 | st_data = mcbsp->st_data; | ||
366 | |||
367 | if (!st_data) | ||
368 | return -ENOENT; | ||
369 | |||
370 | spin_lock_irq(&mcbsp->lock); | ||
371 | if (channel == 0) | ||
372 | st_data->ch0gain = chgain; | ||
373 | else if (channel == 1) | ||
374 | st_data->ch1gain = chgain; | ||
375 | else | ||
376 | ret = -EINVAL; | ||
377 | |||
378 | if (st_data->enabled) | ||
379 | omap_st_chgain(mcbsp); | ||
380 | spin_unlock_irq(&mcbsp->lock); | ||
381 | |||
382 | return ret; | ||
383 | } | ||
384 | EXPORT_SYMBOL(omap_st_set_chgain); | ||
385 | |||
386 | int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain) | ||
387 | { | ||
388 | struct omap_mcbsp *mcbsp; | ||
389 | struct omap_mcbsp_st_data *st_data; | ||
390 | int ret = 0; | ||
391 | |||
392 | if (!omap_mcbsp_check_valid_id(id)) { | ||
393 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
394 | return -ENODEV; | ||
395 | } | ||
396 | |||
397 | mcbsp = id_to_mcbsp_ptr(id); | ||
398 | st_data = mcbsp->st_data; | ||
399 | |||
400 | if (!st_data) | ||
401 | return -ENOENT; | ||
402 | |||
403 | spin_lock_irq(&mcbsp->lock); | ||
404 | if (channel == 0) | ||
405 | *chgain = st_data->ch0gain; | ||
406 | else if (channel == 1) | ||
407 | *chgain = st_data->ch1gain; | ||
408 | else | ||
409 | ret = -EINVAL; | ||
410 | spin_unlock_irq(&mcbsp->lock); | ||
411 | |||
412 | return ret; | ||
413 | } | ||
414 | EXPORT_SYMBOL(omap_st_get_chgain); | ||
415 | |||
416 | static int omap_st_start(struct omap_mcbsp *mcbsp) | ||
417 | { | ||
418 | struct omap_mcbsp_st_data *st_data = mcbsp->st_data; | ||
419 | |||
420 | if (st_data && st_data->enabled && !st_data->running) { | ||
421 | omap_st_fir_write(mcbsp, st_data->taps); | ||
422 | omap_st_chgain(mcbsp); | ||
423 | |||
424 | if (!mcbsp->free) { | ||
425 | omap_st_on(mcbsp); | ||
426 | st_data->running = 1; | ||
427 | } | ||
428 | } | ||
429 | |||
430 | return 0; | ||
431 | } | ||
432 | |||
433 | int omap_st_enable(unsigned int id) | ||
434 | { | ||
435 | struct omap_mcbsp *mcbsp; | ||
436 | struct omap_mcbsp_st_data *st_data; | ||
437 | |||
438 | if (!omap_mcbsp_check_valid_id(id)) { | ||
439 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
440 | return -ENODEV; | ||
441 | } | ||
442 | |||
443 | mcbsp = id_to_mcbsp_ptr(id); | ||
444 | st_data = mcbsp->st_data; | ||
445 | |||
446 | if (!st_data) | ||
447 | return -ENODEV; | ||
448 | |||
449 | spin_lock_irq(&mcbsp->lock); | ||
450 | st_data->enabled = 1; | ||
451 | omap_st_start(mcbsp); | ||
452 | spin_unlock_irq(&mcbsp->lock); | ||
453 | |||
454 | return 0; | ||
455 | } | ||
456 | EXPORT_SYMBOL(omap_st_enable); | ||
457 | |||
458 | static int omap_st_stop(struct omap_mcbsp *mcbsp) | ||
459 | { | ||
460 | struct omap_mcbsp_st_data *st_data = mcbsp->st_data; | ||
461 | |||
462 | if (st_data && st_data->running) { | ||
463 | if (!mcbsp->free) { | ||
464 | omap_st_off(mcbsp); | ||
465 | st_data->running = 0; | ||
466 | } | ||
467 | } | ||
468 | |||
469 | return 0; | ||
470 | } | ||
471 | |||
472 | int omap_st_disable(unsigned int id) | ||
473 | { | ||
474 | struct omap_mcbsp *mcbsp; | ||
475 | struct omap_mcbsp_st_data *st_data; | ||
476 | int ret = 0; | ||
477 | |||
478 | if (!omap_mcbsp_check_valid_id(id)) { | ||
479 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
480 | return -ENODEV; | ||
481 | } | ||
482 | |||
483 | mcbsp = id_to_mcbsp_ptr(id); | ||
484 | st_data = mcbsp->st_data; | ||
485 | |||
486 | if (!st_data) | ||
487 | return -ENODEV; | ||
488 | |||
489 | spin_lock_irq(&mcbsp->lock); | ||
490 | omap_st_stop(mcbsp); | ||
491 | st_data->enabled = 0; | ||
492 | spin_unlock_irq(&mcbsp->lock); | ||
493 | |||
494 | return ret; | ||
495 | } | ||
496 | EXPORT_SYMBOL(omap_st_disable); | ||
497 | |||
498 | int omap_st_is_enabled(unsigned int id) | ||
499 | { | ||
500 | struct omap_mcbsp *mcbsp; | ||
501 | struct omap_mcbsp_st_data *st_data; | ||
502 | |||
503 | if (!omap_mcbsp_check_valid_id(id)) { | ||
504 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
505 | return -ENODEV; | ||
506 | } | ||
507 | |||
508 | mcbsp = id_to_mcbsp_ptr(id); | ||
509 | st_data = mcbsp->st_data; | ||
510 | |||
511 | if (!st_data) | ||
512 | return -ENODEV; | ||
513 | |||
514 | |||
515 | return st_data->enabled; | ||
516 | } | ||
517 | EXPORT_SYMBOL(omap_st_is_enabled); | ||
518 | |||
519 | /* | ||
520 | * omap_mcbsp_set_rx_threshold configures the transmit threshold in words. | ||
521 | * The threshold parameter is 1 based, and it is converted (threshold - 1) | ||
522 | * for the THRSH2 register. | ||
523 | */ | ||
524 | void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold) | ||
525 | { | ||
526 | struct omap_mcbsp *mcbsp; | ||
527 | |||
528 | if (!cpu_is_omap34xx() && !cpu_is_omap44xx()) | ||
529 | return; | ||
530 | |||
531 | if (!omap_mcbsp_check_valid_id(id)) { | ||
532 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
533 | return; | ||
534 | } | ||
535 | mcbsp = id_to_mcbsp_ptr(id); | ||
536 | |||
537 | if (threshold && threshold <= mcbsp->max_tx_thres) | ||
538 | MCBSP_WRITE(mcbsp, THRSH2, threshold - 1); | ||
539 | } | ||
540 | EXPORT_SYMBOL(omap_mcbsp_set_tx_threshold); | ||
541 | |||
542 | /* | ||
543 | * omap_mcbsp_set_rx_threshold configures the receive threshold in words. | ||
544 | * The threshold parameter is 1 based, and it is converted (threshold - 1) | ||
545 | * for the THRSH1 register. | ||
546 | */ | ||
547 | void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold) | ||
548 | { | ||
549 | struct omap_mcbsp *mcbsp; | ||
550 | |||
551 | if (!cpu_is_omap34xx() && !cpu_is_omap44xx()) | ||
552 | return; | ||
553 | |||
554 | if (!omap_mcbsp_check_valid_id(id)) { | ||
555 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
556 | return; | ||
557 | } | ||
558 | mcbsp = id_to_mcbsp_ptr(id); | ||
559 | |||
560 | if (threshold && threshold <= mcbsp->max_rx_thres) | ||
561 | MCBSP_WRITE(mcbsp, THRSH1, threshold - 1); | ||
562 | } | ||
563 | EXPORT_SYMBOL(omap_mcbsp_set_rx_threshold); | ||
564 | |||
565 | /* | ||
566 | * omap_mcbsp_get_max_tx_thres just return the current configured | ||
567 | * maximum threshold for transmission | ||
568 | */ | ||
569 | u16 omap_mcbsp_get_max_tx_threshold(unsigned int id) | ||
570 | { | ||
571 | struct omap_mcbsp *mcbsp; | ||
572 | |||
573 | if (!omap_mcbsp_check_valid_id(id)) { | ||
574 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
575 | return -ENODEV; | ||
576 | } | ||
577 | mcbsp = id_to_mcbsp_ptr(id); | ||
578 | |||
579 | return mcbsp->max_tx_thres; | ||
580 | } | ||
581 | EXPORT_SYMBOL(omap_mcbsp_get_max_tx_threshold); | ||
582 | |||
583 | /* | ||
584 | * omap_mcbsp_get_max_rx_thres just return the current configured | ||
585 | * maximum threshold for reception | ||
586 | */ | ||
587 | u16 omap_mcbsp_get_max_rx_threshold(unsigned int id) | ||
588 | { | ||
589 | struct omap_mcbsp *mcbsp; | ||
590 | |||
591 | if (!omap_mcbsp_check_valid_id(id)) { | ||
592 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
593 | return -ENODEV; | ||
594 | } | ||
595 | mcbsp = id_to_mcbsp_ptr(id); | ||
596 | |||
597 | return mcbsp->max_rx_thres; | ||
598 | } | ||
599 | EXPORT_SYMBOL(omap_mcbsp_get_max_rx_threshold); | ||
600 | |||
601 | u16 omap_mcbsp_get_fifo_size(unsigned int id) | ||
602 | { | ||
603 | struct omap_mcbsp *mcbsp; | ||
604 | |||
605 | if (!omap_mcbsp_check_valid_id(id)) { | ||
606 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
607 | return -ENODEV; | ||
608 | } | ||
609 | mcbsp = id_to_mcbsp_ptr(id); | ||
610 | |||
611 | return mcbsp->pdata->buffer_size; | ||
612 | } | ||
613 | EXPORT_SYMBOL(omap_mcbsp_get_fifo_size); | ||
614 | |||
615 | /* | ||
616 | * omap_mcbsp_get_tx_delay returns the number of used slots in the McBSP FIFO | ||
617 | */ | ||
618 | u16 omap_mcbsp_get_tx_delay(unsigned int id) | ||
619 | { | ||
620 | struct omap_mcbsp *mcbsp; | ||
621 | u16 buffstat; | ||
622 | |||
623 | if (!omap_mcbsp_check_valid_id(id)) { | ||
624 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
625 | return -ENODEV; | ||
626 | } | ||
627 | mcbsp = id_to_mcbsp_ptr(id); | ||
628 | |||
629 | /* Returns the number of free locations in the buffer */ | ||
630 | buffstat = MCBSP_READ(mcbsp, XBUFFSTAT); | ||
631 | |||
632 | /* Number of slots are different in McBSP ports */ | ||
633 | return mcbsp->pdata->buffer_size - buffstat; | ||
634 | } | ||
635 | EXPORT_SYMBOL(omap_mcbsp_get_tx_delay); | ||
636 | |||
637 | /* | ||
638 | * omap_mcbsp_get_rx_delay returns the number of free slots in the McBSP FIFO | ||
639 | * to reach the threshold value (when the DMA will be triggered to read it) | ||
640 | */ | ||
641 | u16 omap_mcbsp_get_rx_delay(unsigned int id) | ||
642 | { | ||
643 | struct omap_mcbsp *mcbsp; | ||
644 | u16 buffstat, threshold; | ||
645 | |||
646 | if (!omap_mcbsp_check_valid_id(id)) { | ||
647 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
648 | return -ENODEV; | ||
649 | } | ||
650 | mcbsp = id_to_mcbsp_ptr(id); | ||
651 | |||
652 | /* Returns the number of used locations in the buffer */ | ||
653 | buffstat = MCBSP_READ(mcbsp, RBUFFSTAT); | ||
654 | /* RX threshold */ | ||
655 | threshold = MCBSP_READ(mcbsp, THRSH1); | ||
656 | |||
657 | /* Return the number of location till we reach the threshold limit */ | ||
658 | if (threshold <= buffstat) | ||
659 | return 0; | ||
660 | else | ||
661 | return threshold - buffstat; | ||
662 | } | ||
663 | EXPORT_SYMBOL(omap_mcbsp_get_rx_delay); | ||
664 | |||
665 | /* | ||
666 | * omap_mcbsp_get_dma_op_mode just return the current configured | ||
667 | * operating mode for the mcbsp channel | ||
668 | */ | ||
669 | int omap_mcbsp_get_dma_op_mode(unsigned int id) | ||
670 | { | ||
671 | struct omap_mcbsp *mcbsp; | ||
672 | int dma_op_mode; | ||
673 | |||
674 | if (!omap_mcbsp_check_valid_id(id)) { | ||
675 | printk(KERN_ERR "%s: Invalid id (%u)\n", __func__, id + 1); | ||
676 | return -ENODEV; | ||
677 | } | ||
678 | mcbsp = id_to_mcbsp_ptr(id); | ||
679 | |||
680 | dma_op_mode = mcbsp->dma_op_mode; | ||
681 | |||
682 | return dma_op_mode; | ||
683 | } | ||
684 | EXPORT_SYMBOL(omap_mcbsp_get_dma_op_mode); | ||
685 | |||
686 | static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp) | ||
687 | { | ||
688 | struct omap_device *od; | ||
689 | |||
690 | od = find_omap_device_by_dev(mcbsp->dev); | ||
691 | /* | ||
692 | * Enable wakup behavior, smart idle and all wakeups | ||
693 | * REVISIT: some wakeups may be unnecessary | ||
694 | */ | ||
695 | if (cpu_is_omap34xx() || cpu_is_omap44xx()) { | ||
696 | MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN); | ||
697 | } | ||
698 | } | ||
699 | |||
700 | static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp) | ||
701 | { | ||
702 | struct omap_device *od; | ||
703 | |||
704 | od = find_omap_device_by_dev(mcbsp->dev); | ||
705 | |||
706 | /* | ||
707 | * Disable wakup behavior, smart idle and all wakeups | ||
708 | */ | ||
709 | if (cpu_is_omap34xx() || cpu_is_omap44xx()) { | ||
710 | /* | ||
711 | * HW bug workaround - If no_idle mode is taken, we need to | ||
712 | * go to smart_idle before going to always_idle, or the | ||
713 | * device will not hit retention anymore. | ||
714 | */ | ||
715 | |||
716 | MCBSP_WRITE(mcbsp, WAKEUPEN, 0); | ||
717 | } | ||
718 | } | ||
719 | #else | ||
720 | static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp) {} | ||
721 | static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp) {} | ||
722 | static inline void omap_st_start(struct omap_mcbsp *mcbsp) {} | ||
723 | static inline void omap_st_stop(struct omap_mcbsp *mcbsp) {} | ||
724 | #endif | ||
725 | |||
726 | int omap_mcbsp_request(unsigned int id) | ||
727 | { | ||
728 | struct omap_mcbsp *mcbsp; | ||
729 | void *reg_cache; | ||
730 | int err; | ||
731 | |||
732 | if (!omap_mcbsp_check_valid_id(id)) { | ||
733 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
734 | return -ENODEV; | ||
735 | } | ||
736 | mcbsp = id_to_mcbsp_ptr(id); | ||
737 | |||
738 | reg_cache = kzalloc(omap_mcbsp_cache_size, GFP_KERNEL); | ||
739 | if (!reg_cache) { | ||
740 | return -ENOMEM; | ||
741 | } | ||
742 | |||
743 | spin_lock(&mcbsp->lock); | ||
744 | if (!mcbsp->free) { | ||
745 | dev_err(mcbsp->dev, "McBSP%d is currently in use\n", | ||
746 | mcbsp->id); | ||
747 | err = -EBUSY; | ||
748 | goto err_kfree; | ||
749 | } | ||
750 | |||
751 | mcbsp->free = false; | ||
752 | mcbsp->reg_cache = reg_cache; | ||
753 | spin_unlock(&mcbsp->lock); | ||
754 | |||
755 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request) | ||
756 | mcbsp->pdata->ops->request(id); | ||
757 | |||
758 | pm_runtime_get_sync(mcbsp->dev); | ||
759 | |||
760 | /* Do procedure specific to omap34xx arch, if applicable */ | ||
761 | omap34xx_mcbsp_request(mcbsp); | ||
762 | |||
763 | /* | ||
764 | * Make sure that transmitter, receiver and sample-rate generator are | ||
765 | * not running before activating IRQs. | ||
766 | */ | ||
767 | MCBSP_WRITE(mcbsp, SPCR1, 0); | ||
768 | MCBSP_WRITE(mcbsp, SPCR2, 0); | ||
769 | |||
770 | err = request_irq(mcbsp->tx_irq, omap_mcbsp_tx_irq_handler, | ||
771 | 0, "McBSP", (void *)mcbsp); | ||
772 | if (err != 0) { | ||
773 | dev_err(mcbsp->dev, "Unable to request TX IRQ %d " | ||
774 | "for McBSP%d\n", mcbsp->tx_irq, | ||
775 | mcbsp->id); | ||
776 | goto err_clk_disable; | ||
777 | } | ||
778 | |||
779 | if (mcbsp->rx_irq) { | ||
780 | err = request_irq(mcbsp->rx_irq, | ||
781 | omap_mcbsp_rx_irq_handler, | ||
782 | 0, "McBSP", (void *)mcbsp); | ||
783 | if (err != 0) { | ||
784 | dev_err(mcbsp->dev, "Unable to request RX IRQ %d " | ||
785 | "for McBSP%d\n", mcbsp->rx_irq, | ||
786 | mcbsp->id); | ||
787 | goto err_free_irq; | ||
788 | } | ||
789 | } | ||
790 | |||
791 | return 0; | ||
792 | err_free_irq: | ||
793 | free_irq(mcbsp->tx_irq, (void *)mcbsp); | ||
794 | err_clk_disable: | ||
795 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) | ||
796 | mcbsp->pdata->ops->free(id); | ||
797 | |||
798 | /* Do procedure specific to omap34xx arch, if applicable */ | ||
799 | omap34xx_mcbsp_free(mcbsp); | ||
800 | |||
801 | pm_runtime_put_sync(mcbsp->dev); | ||
802 | |||
803 | spin_lock(&mcbsp->lock); | ||
804 | mcbsp->free = true; | ||
805 | mcbsp->reg_cache = NULL; | ||
806 | err_kfree: | ||
807 | spin_unlock(&mcbsp->lock); | ||
808 | kfree(reg_cache); | ||
809 | |||
810 | return err; | ||
811 | } | ||
812 | EXPORT_SYMBOL(omap_mcbsp_request); | ||
813 | |||
814 | void omap_mcbsp_free(unsigned int id) | ||
815 | { | ||
816 | struct omap_mcbsp *mcbsp; | ||
817 | void *reg_cache; | ||
818 | |||
819 | if (!omap_mcbsp_check_valid_id(id)) { | ||
820 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
821 | return; | ||
822 | } | ||
823 | mcbsp = id_to_mcbsp_ptr(id); | ||
824 | |||
825 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) | ||
826 | mcbsp->pdata->ops->free(id); | ||
827 | |||
828 | /* Do procedure specific to omap34xx arch, if applicable */ | ||
829 | omap34xx_mcbsp_free(mcbsp); | ||
830 | |||
831 | pm_runtime_put_sync(mcbsp->dev); | ||
832 | |||
833 | if (mcbsp->rx_irq) | ||
834 | free_irq(mcbsp->rx_irq, (void *)mcbsp); | ||
835 | free_irq(mcbsp->tx_irq, (void *)mcbsp); | ||
836 | |||
837 | reg_cache = mcbsp->reg_cache; | ||
838 | |||
839 | spin_lock(&mcbsp->lock); | ||
840 | if (mcbsp->free) | ||
841 | dev_err(mcbsp->dev, "McBSP%d was not reserved\n", mcbsp->id); | ||
842 | else | ||
843 | mcbsp->free = true; | ||
844 | mcbsp->reg_cache = NULL; | ||
845 | spin_unlock(&mcbsp->lock); | ||
846 | |||
847 | if (reg_cache) | ||
848 | kfree(reg_cache); | ||
849 | } | ||
850 | EXPORT_SYMBOL(omap_mcbsp_free); | ||
851 | |||
852 | /* | ||
853 | * Here we start the McBSP, by enabling transmitter, receiver or both. | ||
854 | * If no transmitter or receiver is active prior calling, then sample-rate | ||
855 | * generator and frame sync are started. | ||
856 | */ | ||
857 | void omap_mcbsp_start(unsigned int id, int tx, int rx) | ||
858 | { | ||
859 | struct omap_mcbsp *mcbsp; | ||
860 | int enable_srg = 0; | ||
861 | u16 w; | ||
862 | |||
863 | if (!omap_mcbsp_check_valid_id(id)) { | ||
864 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
865 | return; | ||
866 | } | ||
867 | mcbsp = id_to_mcbsp_ptr(id); | ||
868 | |||
869 | if (cpu_is_omap34xx()) | ||
870 | omap_st_start(mcbsp); | ||
871 | |||
872 | /* Only enable SRG, if McBSP is master */ | ||
873 | w = MCBSP_READ_CACHE(mcbsp, PCR0); | ||
874 | if (w & (FSXM | FSRM | CLKXM | CLKRM)) | ||
875 | enable_srg = !((MCBSP_READ_CACHE(mcbsp, SPCR2) | | ||
876 | MCBSP_READ_CACHE(mcbsp, SPCR1)) & 1); | ||
877 | |||
878 | if (enable_srg) { | ||
879 | /* Start the sample generator */ | ||
880 | w = MCBSP_READ_CACHE(mcbsp, SPCR2); | ||
881 | MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 6)); | ||
882 | } | ||
883 | |||
884 | /* Enable transmitter and receiver */ | ||
885 | tx &= 1; | ||
886 | w = MCBSP_READ_CACHE(mcbsp, SPCR2); | ||
887 | MCBSP_WRITE(mcbsp, SPCR2, w | tx); | ||
888 | |||
889 | rx &= 1; | ||
890 | w = MCBSP_READ_CACHE(mcbsp, SPCR1); | ||
891 | MCBSP_WRITE(mcbsp, SPCR1, w | rx); | ||
892 | |||
893 | /* | ||
894 | * Worst case: CLKSRG*2 = 8000khz: (1/8000) * 2 * 2 usec | ||
895 | * REVISIT: 100us may give enough time for two CLKSRG, however | ||
896 | * due to some unknown PM related, clock gating etc. reason it | ||
897 | * is now at 500us. | ||
898 | */ | ||
899 | udelay(500); | ||
900 | |||
901 | if (enable_srg) { | ||
902 | /* Start frame sync */ | ||
903 | w = MCBSP_READ_CACHE(mcbsp, SPCR2); | ||
904 | MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7)); | ||
905 | } | ||
906 | |||
907 | if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) { | ||
908 | /* Release the transmitter and receiver */ | ||
909 | w = MCBSP_READ_CACHE(mcbsp, XCCR); | ||
910 | w &= ~(tx ? XDISABLE : 0); | ||
911 | MCBSP_WRITE(mcbsp, XCCR, w); | ||
912 | w = MCBSP_READ_CACHE(mcbsp, RCCR); | ||
913 | w &= ~(rx ? RDISABLE : 0); | ||
914 | MCBSP_WRITE(mcbsp, RCCR, w); | ||
915 | } | ||
916 | |||
917 | /* Dump McBSP Regs */ | ||
918 | omap_mcbsp_dump_reg(id); | ||
919 | } | ||
920 | EXPORT_SYMBOL(omap_mcbsp_start); | ||
921 | |||
922 | void omap_mcbsp_stop(unsigned int id, int tx, int rx) | ||
923 | { | ||
924 | struct omap_mcbsp *mcbsp; | ||
925 | int idle; | ||
926 | u16 w; | ||
927 | |||
928 | if (!omap_mcbsp_check_valid_id(id)) { | ||
929 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
930 | return; | ||
931 | } | ||
932 | |||
933 | mcbsp = id_to_mcbsp_ptr(id); | ||
934 | |||
935 | /* Reset transmitter */ | ||
936 | tx &= 1; | ||
937 | if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) { | ||
938 | w = MCBSP_READ_CACHE(mcbsp, XCCR); | ||
939 | w |= (tx ? XDISABLE : 0); | ||
940 | MCBSP_WRITE(mcbsp, XCCR, w); | ||
941 | } | ||
942 | w = MCBSP_READ_CACHE(mcbsp, SPCR2); | ||
943 | MCBSP_WRITE(mcbsp, SPCR2, w & ~tx); | ||
944 | |||
945 | /* Reset receiver */ | ||
946 | rx &= 1; | ||
947 | if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) { | ||
948 | w = MCBSP_READ_CACHE(mcbsp, RCCR); | ||
949 | w |= (rx ? RDISABLE : 0); | ||
950 | MCBSP_WRITE(mcbsp, RCCR, w); | ||
951 | } | ||
952 | w = MCBSP_READ_CACHE(mcbsp, SPCR1); | ||
953 | MCBSP_WRITE(mcbsp, SPCR1, w & ~rx); | ||
954 | |||
955 | idle = !((MCBSP_READ_CACHE(mcbsp, SPCR2) | | ||
956 | MCBSP_READ_CACHE(mcbsp, SPCR1)) & 1); | ||
957 | |||
958 | if (idle) { | ||
959 | /* Reset the sample rate generator */ | ||
960 | w = MCBSP_READ_CACHE(mcbsp, SPCR2); | ||
961 | MCBSP_WRITE(mcbsp, SPCR2, w & ~(1 << 6)); | ||
962 | } | ||
963 | |||
964 | if (cpu_is_omap34xx()) | ||
965 | omap_st_stop(mcbsp); | ||
966 | } | ||
967 | EXPORT_SYMBOL(omap_mcbsp_stop); | ||
968 | |||
969 | /* | ||
970 | * The following functions are only required on an OMAP1-only build. | ||
971 | * mach-omap2/mcbsp.c contains the real functions | ||
972 | */ | ||
973 | #ifndef CONFIG_ARCH_OMAP2PLUS | ||
974 | int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id) | ||
975 | { | ||
976 | WARN(1, "%s: should never be called on an OMAP1-only kernel\n", | ||
977 | __func__); | ||
978 | return -EINVAL; | ||
979 | } | ||
980 | |||
981 | void omap2_mcbsp1_mux_clkr_src(u8 mux) | ||
982 | { | ||
983 | WARN(1, "%s: should never be called on an OMAP1-only kernel\n", | ||
984 | __func__); | ||
985 | return; | ||
986 | } | ||
987 | |||
988 | void omap2_mcbsp1_mux_fsr_src(u8 mux) | ||
989 | { | ||
990 | WARN(1, "%s: should never be called on an OMAP1-only kernel\n", | ||
991 | __func__); | ||
992 | return; | ||
993 | } | ||
994 | #endif | ||
995 | |||
996 | #ifdef CONFIG_ARCH_OMAP3 | ||
997 | #define max_thres(m) (mcbsp->pdata->buffer_size) | ||
998 | #define valid_threshold(m, val) ((val) <= max_thres(m)) | ||
999 | #define THRESHOLD_PROP_BUILDER(prop) \ | ||
1000 | static ssize_t prop##_show(struct device *dev, \ | ||
1001 | struct device_attribute *attr, char *buf) \ | ||
1002 | { \ | ||
1003 | struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); \ | ||
1004 | \ | ||
1005 | return sprintf(buf, "%u\n", mcbsp->prop); \ | ||
1006 | } \ | ||
1007 | \ | ||
1008 | static ssize_t prop##_store(struct device *dev, \ | ||
1009 | struct device_attribute *attr, \ | ||
1010 | const char *buf, size_t size) \ | ||
1011 | { \ | ||
1012 | struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); \ | ||
1013 | unsigned long val; \ | ||
1014 | int status; \ | ||
1015 | \ | ||
1016 | status = strict_strtoul(buf, 0, &val); \ | ||
1017 | if (status) \ | ||
1018 | return status; \ | ||
1019 | \ | ||
1020 | if (!valid_threshold(mcbsp, val)) \ | ||
1021 | return -EDOM; \ | ||
1022 | \ | ||
1023 | mcbsp->prop = val; \ | ||
1024 | return size; \ | ||
1025 | } \ | ||
1026 | \ | ||
1027 | static DEVICE_ATTR(prop, 0644, prop##_show, prop##_store); | ||
1028 | |||
1029 | THRESHOLD_PROP_BUILDER(max_tx_thres); | ||
1030 | THRESHOLD_PROP_BUILDER(max_rx_thres); | ||
1031 | |||
1032 | static const char *dma_op_modes[] = { | ||
1033 | "element", "threshold", "frame", | ||
1034 | }; | ||
1035 | |||
1036 | static ssize_t dma_op_mode_show(struct device *dev, | ||
1037 | struct device_attribute *attr, char *buf) | ||
1038 | { | ||
1039 | struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); | ||
1040 | int dma_op_mode, i = 0; | ||
1041 | ssize_t len = 0; | ||
1042 | const char * const *s; | ||
1043 | |||
1044 | dma_op_mode = mcbsp->dma_op_mode; | ||
1045 | |||
1046 | for (s = &dma_op_modes[i]; i < ARRAY_SIZE(dma_op_modes); s++, i++) { | ||
1047 | if (dma_op_mode == i) | ||
1048 | len += sprintf(buf + len, "[%s] ", *s); | ||
1049 | else | ||
1050 | len += sprintf(buf + len, "%s ", *s); | ||
1051 | } | ||
1052 | len += sprintf(buf + len, "\n"); | ||
1053 | |||
1054 | return len; | ||
1055 | } | ||
1056 | |||
1057 | static ssize_t dma_op_mode_store(struct device *dev, | ||
1058 | struct device_attribute *attr, | ||
1059 | const char *buf, size_t size) | ||
1060 | { | ||
1061 | struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); | ||
1062 | const char * const *s; | ||
1063 | int i = 0; | ||
1064 | |||
1065 | for (s = &dma_op_modes[i]; i < ARRAY_SIZE(dma_op_modes); s++, i++) | ||
1066 | if (sysfs_streq(buf, *s)) | ||
1067 | break; | ||
1068 | |||
1069 | if (i == ARRAY_SIZE(dma_op_modes)) | ||
1070 | return -EINVAL; | ||
1071 | |||
1072 | spin_lock_irq(&mcbsp->lock); | ||
1073 | if (!mcbsp->free) { | ||
1074 | size = -EBUSY; | ||
1075 | goto unlock; | ||
1076 | } | ||
1077 | mcbsp->dma_op_mode = i; | ||
1078 | |||
1079 | unlock: | ||
1080 | spin_unlock_irq(&mcbsp->lock); | ||
1081 | |||
1082 | return size; | ||
1083 | } | ||
1084 | |||
1085 | static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store); | ||
1086 | |||
1087 | static ssize_t st_taps_show(struct device *dev, | ||
1088 | struct device_attribute *attr, char *buf) | ||
1089 | { | ||
1090 | struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); | ||
1091 | struct omap_mcbsp_st_data *st_data = mcbsp->st_data; | ||
1092 | ssize_t status = 0; | ||
1093 | int i; | ||
1094 | |||
1095 | spin_lock_irq(&mcbsp->lock); | ||
1096 | for (i = 0; i < st_data->nr_taps; i++) | ||
1097 | status += sprintf(&buf[status], (i ? ", %d" : "%d"), | ||
1098 | st_data->taps[i]); | ||
1099 | if (i) | ||
1100 | status += sprintf(&buf[status], "\n"); | ||
1101 | spin_unlock_irq(&mcbsp->lock); | ||
1102 | |||
1103 | return status; | ||
1104 | } | ||
1105 | |||
1106 | static ssize_t st_taps_store(struct device *dev, | ||
1107 | struct device_attribute *attr, | ||
1108 | const char *buf, size_t size) | ||
1109 | { | ||
1110 | struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); | ||
1111 | struct omap_mcbsp_st_data *st_data = mcbsp->st_data; | ||
1112 | int val, tmp, status, i = 0; | ||
1113 | |||
1114 | spin_lock_irq(&mcbsp->lock); | ||
1115 | memset(st_data->taps, 0, sizeof(st_data->taps)); | ||
1116 | st_data->nr_taps = 0; | ||
1117 | |||
1118 | do { | ||
1119 | status = sscanf(buf, "%d%n", &val, &tmp); | ||
1120 | if (status < 0 || status == 0) { | ||
1121 | size = -EINVAL; | ||
1122 | goto out; | ||
1123 | } | ||
1124 | if (val < -32768 || val > 32767) { | ||
1125 | size = -EINVAL; | ||
1126 | goto out; | ||
1127 | } | ||
1128 | st_data->taps[i++] = val; | ||
1129 | buf += tmp; | ||
1130 | if (*buf != ',') | ||
1131 | break; | ||
1132 | buf++; | ||
1133 | } while (1); | ||
1134 | |||
1135 | st_data->nr_taps = i; | ||
1136 | |||
1137 | out: | ||
1138 | spin_unlock_irq(&mcbsp->lock); | ||
1139 | |||
1140 | return size; | ||
1141 | } | ||
1142 | |||
1143 | static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store); | ||
1144 | |||
1145 | static const struct attribute *additional_attrs[] = { | ||
1146 | &dev_attr_max_tx_thres.attr, | ||
1147 | &dev_attr_max_rx_thres.attr, | ||
1148 | &dev_attr_dma_op_mode.attr, | ||
1149 | NULL, | ||
1150 | }; | ||
1151 | |||
1152 | static const struct attribute_group additional_attr_group = { | ||
1153 | .attrs = (struct attribute **)additional_attrs, | ||
1154 | }; | ||
1155 | |||
1156 | static inline int __devinit omap_additional_add(struct device *dev) | ||
1157 | { | ||
1158 | return sysfs_create_group(&dev->kobj, &additional_attr_group); | ||
1159 | } | ||
1160 | |||
1161 | static inline void __devexit omap_additional_remove(struct device *dev) | ||
1162 | { | ||
1163 | sysfs_remove_group(&dev->kobj, &additional_attr_group); | ||
1164 | } | ||
1165 | |||
1166 | static const struct attribute *sidetone_attrs[] = { | ||
1167 | &dev_attr_st_taps.attr, | ||
1168 | NULL, | ||
1169 | }; | ||
1170 | |||
1171 | static const struct attribute_group sidetone_attr_group = { | ||
1172 | .attrs = (struct attribute **)sidetone_attrs, | ||
1173 | }; | ||
1174 | |||
1175 | static int __devinit omap_st_add(struct omap_mcbsp *mcbsp) | ||
1176 | { | ||
1177 | struct platform_device *pdev; | ||
1178 | struct resource *res; | ||
1179 | struct omap_mcbsp_st_data *st_data; | ||
1180 | int err; | ||
1181 | |||
1182 | st_data = kzalloc(sizeof(*mcbsp->st_data), GFP_KERNEL); | ||
1183 | if (!st_data) { | ||
1184 | err = -ENOMEM; | ||
1185 | goto err1; | ||
1186 | } | ||
1187 | |||
1188 | pdev = container_of(mcbsp->dev, struct platform_device, dev); | ||
1189 | |||
1190 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sidetone"); | ||
1191 | st_data->io_base_st = ioremap(res->start, resource_size(res)); | ||
1192 | if (!st_data->io_base_st) { | ||
1193 | err = -ENOMEM; | ||
1194 | goto err2; | ||
1195 | } | ||
1196 | |||
1197 | err = sysfs_create_group(&mcbsp->dev->kobj, &sidetone_attr_group); | ||
1198 | if (err) | ||
1199 | goto err3; | ||
1200 | |||
1201 | mcbsp->st_data = st_data; | ||
1202 | return 0; | ||
1203 | |||
1204 | err3: | ||
1205 | iounmap(st_data->io_base_st); | ||
1206 | err2: | ||
1207 | kfree(st_data); | ||
1208 | err1: | ||
1209 | return err; | ||
1210 | |||
1211 | } | ||
1212 | |||
1213 | static void __devexit omap_st_remove(struct omap_mcbsp *mcbsp) | ||
1214 | { | ||
1215 | struct omap_mcbsp_st_data *st_data = mcbsp->st_data; | ||
1216 | |||
1217 | if (st_data) { | ||
1218 | sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group); | ||
1219 | iounmap(st_data->io_base_st); | ||
1220 | kfree(st_data); | ||
1221 | } | ||
1222 | } | ||
1223 | |||
1224 | static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp) | ||
1225 | { | ||
1226 | mcbsp->dma_op_mode = MCBSP_DMA_MODE_ELEMENT; | ||
1227 | if (cpu_is_omap34xx()) { | ||
1228 | /* | ||
1229 | * Initially configure the maximum thresholds to a safe value. | ||
1230 | * The McBSP FIFO usage with these values should not go under | ||
1231 | * 16 locations. | ||
1232 | * If the whole FIFO without safety buffer is used, than there | ||
1233 | * is a possibility that the DMA will be not able to push the | ||
1234 | * new data on time, causing channel shifts in runtime. | ||
1235 | */ | ||
1236 | mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10; | ||
1237 | mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10; | ||
1238 | /* | ||
1239 | * REVISIT: Set dmap_op_mode to THRESHOLD as default | ||
1240 | * for mcbsp2 instances. | ||
1241 | */ | ||
1242 | if (omap_additional_add(mcbsp->dev)) | ||
1243 | dev_warn(mcbsp->dev, | ||
1244 | "Unable to create additional controls\n"); | ||
1245 | |||
1246 | if (mcbsp->id == 2 || mcbsp->id == 3) | ||
1247 | if (omap_st_add(mcbsp)) | ||
1248 | dev_warn(mcbsp->dev, | ||
1249 | "Unable to create sidetone controls\n"); | ||
1250 | |||
1251 | } else { | ||
1252 | mcbsp->max_tx_thres = -EINVAL; | ||
1253 | mcbsp->max_rx_thres = -EINVAL; | ||
1254 | } | ||
1255 | } | ||
1256 | |||
1257 | static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp) | ||
1258 | { | ||
1259 | if (cpu_is_omap34xx()) { | ||
1260 | omap_additional_remove(mcbsp->dev); | ||
1261 | |||
1262 | if (mcbsp->id == 2 || mcbsp->id == 3) | ||
1263 | omap_st_remove(mcbsp); | ||
1264 | } | ||
1265 | } | ||
1266 | #else | ||
1267 | static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp) {} | ||
1268 | static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp) {} | ||
1269 | #endif /* CONFIG_ARCH_OMAP3 */ | ||
1270 | |||
1271 | /* | ||
1272 | * McBSP1 and McBSP3 are directly mapped on 1610 and 1510. | ||
1273 | * 730 has only 2 McBSP, and both of them are MPU peripherals. | ||
1274 | */ | ||
1275 | static int __devinit omap_mcbsp_probe(struct platform_device *pdev) | ||
1276 | { | ||
1277 | struct omap_mcbsp_platform_data *pdata = pdev->dev.platform_data; | ||
1278 | struct omap_mcbsp *mcbsp; | ||
1279 | int id = pdev->id - 1; | ||
1280 | struct resource *res; | ||
1281 | int ret = 0; | ||
1282 | |||
1283 | if (!pdata) { | ||
1284 | dev_err(&pdev->dev, "McBSP device initialized without" | ||
1285 | "platform data\n"); | ||
1286 | ret = -EINVAL; | ||
1287 | goto exit; | ||
1288 | } | ||
1289 | |||
1290 | dev_dbg(&pdev->dev, "Initializing OMAP McBSP (%d).\n", pdev->id); | ||
1291 | |||
1292 | if (id >= omap_mcbsp_count) { | ||
1293 | dev_err(&pdev->dev, "Invalid McBSP device id (%d)\n", id); | ||
1294 | ret = -EINVAL; | ||
1295 | goto exit; | ||
1296 | } | ||
1297 | |||
1298 | mcbsp = kzalloc(sizeof(struct omap_mcbsp), GFP_KERNEL); | ||
1299 | if (!mcbsp) { | ||
1300 | ret = -ENOMEM; | ||
1301 | goto exit; | ||
1302 | } | ||
1303 | |||
1304 | spin_lock_init(&mcbsp->lock); | ||
1305 | mcbsp->id = id + 1; | ||
1306 | mcbsp->free = true; | ||
1307 | |||
1308 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu"); | ||
1309 | if (!res) { | ||
1310 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1311 | if (!res) { | ||
1312 | dev_err(&pdev->dev, "%s:mcbsp%d has invalid memory" | ||
1313 | "resource\n", __func__, pdev->id); | ||
1314 | ret = -ENOMEM; | ||
1315 | goto exit; | ||
1316 | } | ||
1317 | } | ||
1318 | mcbsp->phys_base = res->start; | ||
1319 | omap_mcbsp_cache_size = resource_size(res); | ||
1320 | mcbsp->io_base = ioremap(res->start, resource_size(res)); | ||
1321 | if (!mcbsp->io_base) { | ||
1322 | ret = -ENOMEM; | ||
1323 | goto err_ioremap; | ||
1324 | } | ||
1325 | |||
1326 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma"); | ||
1327 | if (!res) | ||
1328 | mcbsp->phys_dma_base = mcbsp->phys_base; | ||
1329 | else | ||
1330 | mcbsp->phys_dma_base = res->start; | ||
1331 | |||
1332 | mcbsp->tx_irq = platform_get_irq_byname(pdev, "tx"); | ||
1333 | mcbsp->rx_irq = platform_get_irq_byname(pdev, "rx"); | ||
1334 | |||
1335 | /* From OMAP4 there will be a single irq line */ | ||
1336 | if (mcbsp->tx_irq == -ENXIO) | ||
1337 | mcbsp->tx_irq = platform_get_irq(pdev, 0); | ||
1338 | |||
1339 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); | ||
1340 | if (!res) { | ||
1341 | dev_err(&pdev->dev, "%s:mcbsp%d has invalid rx DMA channel\n", | ||
1342 | __func__, pdev->id); | ||
1343 | ret = -ENODEV; | ||
1344 | goto err_res; | ||
1345 | } | ||
1346 | mcbsp->dma_rx_sync = res->start; | ||
1347 | |||
1348 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); | ||
1349 | if (!res) { | ||
1350 | dev_err(&pdev->dev, "%s:mcbsp%d has invalid tx DMA channel\n", | ||
1351 | __func__, pdev->id); | ||
1352 | ret = -ENODEV; | ||
1353 | goto err_res; | ||
1354 | } | ||
1355 | mcbsp->dma_tx_sync = res->start; | ||
1356 | |||
1357 | mcbsp->fclk = clk_get(&pdev->dev, "fck"); | ||
1358 | if (IS_ERR(mcbsp->fclk)) { | ||
1359 | ret = PTR_ERR(mcbsp->fclk); | ||
1360 | dev_err(&pdev->dev, "unable to get fck: %d\n", ret); | ||
1361 | goto err_res; | ||
1362 | } | ||
1363 | |||
1364 | mcbsp->pdata = pdata; | ||
1365 | mcbsp->dev = &pdev->dev; | ||
1366 | mcbsp_ptr[id] = mcbsp; | ||
1367 | mcbsp->mcbsp_config_type = pdata->mcbsp_config_type; | ||
1368 | platform_set_drvdata(pdev, mcbsp); | ||
1369 | pm_runtime_enable(mcbsp->dev); | ||
1370 | |||
1371 | /* Initialize mcbsp properties for OMAP34XX if needed / applicable */ | ||
1372 | omap34xx_device_init(mcbsp); | ||
1373 | |||
1374 | return 0; | ||
1375 | |||
1376 | err_res: | ||
1377 | iounmap(mcbsp->io_base); | ||
1378 | err_ioremap: | ||
1379 | kfree(mcbsp); | ||
1380 | exit: | ||
1381 | return ret; | ||
1382 | } | ||
1383 | |||
1384 | static int __devexit omap_mcbsp_remove(struct platform_device *pdev) | ||
1385 | { | ||
1386 | struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); | ||
1387 | |||
1388 | platform_set_drvdata(pdev, NULL); | ||
1389 | if (mcbsp) { | ||
1390 | |||
1391 | if (mcbsp->pdata && mcbsp->pdata->ops && | ||
1392 | mcbsp->pdata->ops->free) | ||
1393 | mcbsp->pdata->ops->free(mcbsp->id); | ||
1394 | |||
1395 | omap34xx_device_exit(mcbsp); | ||
1396 | |||
1397 | clk_put(mcbsp->fclk); | ||
1398 | |||
1399 | iounmap(mcbsp->io_base); | ||
1400 | kfree(mcbsp); | ||
1401 | } | ||
1402 | |||
1403 | return 0; | ||
1404 | } | ||
1405 | |||
1406 | static struct platform_driver omap_mcbsp_driver = { | ||
1407 | .probe = omap_mcbsp_probe, | ||
1408 | .remove = __devexit_p(omap_mcbsp_remove), | ||
1409 | .driver = { | ||
1410 | .name = "omap-mcbsp", | ||
1411 | }, | ||
1412 | }; | ||
1413 | |||
1414 | int __init omap_mcbsp_init(void) | ||
1415 | { | ||
1416 | /* Register the McBSP driver */ | ||
1417 | return platform_driver_register(&omap_mcbsp_driver); | ||
1418 | } | ||
diff --git a/arch/arm/plat-omap/mux.c b/arch/arm/plat-omap/mux.c new file mode 100644 index 00000000000..0d4aa0d5876 --- /dev/null +++ b/arch/arm/plat-omap/mux.c | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/plat-omap/mux.c | ||
3 | * | ||
4 | * Utility to set the Omap MUX and PULL_DWN registers from a table in mux.h | ||
5 | * | ||
6 | * Copyright (C) 2003 - 2008 Nokia Corporation | ||
7 | * | ||
8 | * Written by Tony Lindgren | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | * | ||
24 | */ | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/io.h> | ||
29 | #include <asm/system.h> | ||
30 | #include <linux/spinlock.h> | ||
31 | #include <plat/mux.h> | ||
32 | |||
33 | #ifdef CONFIG_OMAP_MUX | ||
34 | |||
35 | static struct omap_mux_cfg *mux_cfg; | ||
36 | |||
37 | int __init omap_mux_register(struct omap_mux_cfg *arch_mux_cfg) | ||
38 | { | ||
39 | if (!arch_mux_cfg || !arch_mux_cfg->pins || arch_mux_cfg->size == 0 | ||
40 | || !arch_mux_cfg->cfg_reg) { | ||
41 | printk(KERN_ERR "Invalid pin table\n"); | ||
42 | return -EINVAL; | ||
43 | } | ||
44 | |||
45 | mux_cfg = arch_mux_cfg; | ||
46 | |||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | /* | ||
51 | * Sets the Omap MUX and PULL_DWN registers based on the table | ||
52 | */ | ||
53 | int __init_or_module omap_cfg_reg(const unsigned long index) | ||
54 | { | ||
55 | struct pin_config *reg; | ||
56 | |||
57 | if (!cpu_class_is_omap1()) { | ||
58 | printk(KERN_ERR "mux: Broken omap_cfg_reg(%lu) entry\n", | ||
59 | index); | ||
60 | WARN_ON(1); | ||
61 | return -EINVAL; | ||
62 | } | ||
63 | |||
64 | if (mux_cfg == NULL) { | ||
65 | printk(KERN_ERR "Pin mux table not initialized\n"); | ||
66 | return -ENODEV; | ||
67 | } | ||
68 | |||
69 | if (index >= mux_cfg->size) { | ||
70 | printk(KERN_ERR "Invalid pin mux index: %lu (%lu)\n", | ||
71 | index, mux_cfg->size); | ||
72 | dump_stack(); | ||
73 | return -ENODEV; | ||
74 | } | ||
75 | |||
76 | reg = (struct pin_config *)&mux_cfg->pins[index]; | ||
77 | |||
78 | if (!mux_cfg->cfg_reg) | ||
79 | return -ENODEV; | ||
80 | |||
81 | return mux_cfg->cfg_reg(reg); | ||
82 | } | ||
83 | EXPORT_SYMBOL(omap_cfg_reg); | ||
84 | #else | ||
85 | #define omap_mux_init() do {} while(0) | ||
86 | #define omap_cfg_reg(x) do {} while(0) | ||
87 | #endif /* CONFIG_OMAP_MUX */ | ||
diff --git a/arch/arm/plat-omap/ocpi.c b/arch/arm/plat-omap/ocpi.c new file mode 100644 index 00000000000..ebe0c73c890 --- /dev/null +++ b/arch/arm/plat-omap/ocpi.c | |||
@@ -0,0 +1,109 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/plat-omap/ocpi.c | ||
3 | * | ||
4 | * Minimal OCP bus support for omap16xx | ||
5 | * | ||
6 | * Copyright (C) 2003 - 2005 Nokia Corporation | ||
7 | * Written by Tony Lindgren <tony@atomide.com> | ||
8 | * | ||
9 | * Modified for clock framework by Paul Mundt <paul.mundt@nokia.com>. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
24 | */ | ||
25 | |||
26 | #include <linux/module.h> | ||
27 | #include <linux/types.h> | ||
28 | #include <linux/errno.h> | ||
29 | #include <linux/kernel.h> | ||
30 | #include <linux/init.h> | ||
31 | #include <linux/spinlock.h> | ||
32 | #include <linux/err.h> | ||
33 | #include <linux/clk.h> | ||
34 | #include <linux/io.h> | ||
35 | |||
36 | #include <mach/hardware.h> | ||
37 | |||
38 | #define OCPI_BASE 0xfffec320 | ||
39 | #define OCPI_FAULT (OCPI_BASE + 0x00) | ||
40 | #define OCPI_CMD_FAULT (OCPI_BASE + 0x04) | ||
41 | #define OCPI_SINT0 (OCPI_BASE + 0x08) | ||
42 | #define OCPI_TABORT (OCPI_BASE + 0x0c) | ||
43 | #define OCPI_SINT1 (OCPI_BASE + 0x10) | ||
44 | #define OCPI_PROT (OCPI_BASE + 0x14) | ||
45 | #define OCPI_SEC (OCPI_BASE + 0x18) | ||
46 | |||
47 | /* USB OHCI OCPI access error registers */ | ||
48 | #define HOSTUEADDR 0xfffba0e0 | ||
49 | #define HOSTUESTATUS 0xfffba0e4 | ||
50 | |||
51 | static struct clk *ocpi_ck; | ||
52 | |||
53 | /* | ||
54 | * Enables device access to OMAP buses via the OCPI bridge | ||
55 | * FIXME: Add locking | ||
56 | */ | ||
57 | int ocpi_enable(void) | ||
58 | { | ||
59 | unsigned int val; | ||
60 | |||
61 | if (!cpu_is_omap16xx()) | ||
62 | return -ENODEV; | ||
63 | |||
64 | /* Enable access for OHCI in OCPI */ | ||
65 | val = omap_readl(OCPI_PROT); | ||
66 | val &= ~0xff; | ||
67 | //val &= (1 << 0); /* Allow access only to EMIFS */ | ||
68 | omap_writel(val, OCPI_PROT); | ||
69 | |||
70 | val = omap_readl(OCPI_SEC); | ||
71 | val &= ~0xff; | ||
72 | omap_writel(val, OCPI_SEC); | ||
73 | |||
74 | return 0; | ||
75 | } | ||
76 | EXPORT_SYMBOL(ocpi_enable); | ||
77 | |||
78 | static int __init omap_ocpi_init(void) | ||
79 | { | ||
80 | if (!cpu_is_omap16xx()) | ||
81 | return -ENODEV; | ||
82 | |||
83 | ocpi_ck = clk_get(NULL, "l3_ocpi_ck"); | ||
84 | if (IS_ERR(ocpi_ck)) | ||
85 | return PTR_ERR(ocpi_ck); | ||
86 | |||
87 | clk_enable(ocpi_ck); | ||
88 | ocpi_enable(); | ||
89 | printk("OMAP OCPI interconnect driver loaded\n"); | ||
90 | |||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | static void __exit omap_ocpi_exit(void) | ||
95 | { | ||
96 | /* REVISIT: Disable OCPI */ | ||
97 | |||
98 | if (!cpu_is_omap16xx()) | ||
99 | return; | ||
100 | |||
101 | clk_disable(ocpi_ck); | ||
102 | clk_put(ocpi_ck); | ||
103 | } | ||
104 | |||
105 | MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>"); | ||
106 | MODULE_DESCRIPTION("OMAP OCPI bus controller module"); | ||
107 | MODULE_LICENSE("GPL"); | ||
108 | module_init(omap_ocpi_init); | ||
109 | module_exit(omap_ocpi_exit); | ||
diff --git a/arch/arm/plat-omap/omap-pm-noop.c b/arch/arm/plat-omap/omap-pm-noop.c new file mode 100644 index 00000000000..b0471bb2d47 --- /dev/null +++ b/arch/arm/plat-omap/omap-pm-noop.c | |||
@@ -0,0 +1,363 @@ | |||
1 | /* | ||
2 | * omap-pm-noop.c - OMAP power management interface - dummy version | ||
3 | * | ||
4 | * This code implements the OMAP power management interface to | ||
5 | * drivers, CPUIdle, CPUFreq, and DSP Bridge. It is strictly for | ||
6 | * debug/demonstration use, as it does nothing but printk() whenever a | ||
7 | * function is called (when DEBUG is defined, below) | ||
8 | * | ||
9 | * Copyright (C) 2008-2009 Texas Instruments, Inc. | ||
10 | * Copyright (C) 2008-2009 Nokia Corporation | ||
11 | * Paul Walmsley | ||
12 | * | ||
13 | * Interface developed by (in alphabetical order): | ||
14 | * Karthik Dasu, Tony Lindgren, Rajendra Nayak, Sakari Poussa, Veeramanikandan | ||
15 | * Raju, Anand Sawant, Igor Stoppa, Paul Walmsley, Richard Woodruff | ||
16 | */ | ||
17 | |||
18 | #undef DEBUG | ||
19 | |||
20 | #include <linux/init.h> | ||
21 | #include <linux/cpufreq.h> | ||
22 | #include <linux/device.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | |||
25 | /* Interface documentation is in mach/omap-pm.h */ | ||
26 | #include <plat/omap-pm.h> | ||
27 | #include <plat/omap_device.h> | ||
28 | |||
29 | static bool off_mode_enabled; | ||
30 | static u32 dummy_context_loss_counter; | ||
31 | |||
32 | /* | ||
33 | * Device-driver-originated constraints (via board-*.c files) | ||
34 | */ | ||
35 | |||
36 | int omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t) | ||
37 | { | ||
38 | if (!dev || t < -1) { | ||
39 | WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__); | ||
40 | return -EINVAL; | ||
41 | }; | ||
42 | |||
43 | if (t == -1) | ||
44 | pr_debug("OMAP PM: remove max MPU wakeup latency constraint: " | ||
45 | "dev %s\n", dev_name(dev)); | ||
46 | else | ||
47 | pr_debug("OMAP PM: add max MPU wakeup latency constraint: " | ||
48 | "dev %s, t = %ld usec\n", dev_name(dev), t); | ||
49 | |||
50 | /* | ||
51 | * For current Linux, this needs to map the MPU to a | ||
52 | * powerdomain, then go through the list of current max lat | ||
53 | * constraints on the MPU and find the smallest. If | ||
54 | * the latency constraint has changed, the code should | ||
55 | * recompute the state to enter for the next powerdomain | ||
56 | * state. | ||
57 | * | ||
58 | * TI CDP code can call constraint_set here. | ||
59 | */ | ||
60 | |||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | int omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned long r) | ||
65 | { | ||
66 | if (!dev || (agent_id != OCP_INITIATOR_AGENT && | ||
67 | agent_id != OCP_TARGET_AGENT)) { | ||
68 | WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__); | ||
69 | return -EINVAL; | ||
70 | }; | ||
71 | |||
72 | if (r == 0) | ||
73 | pr_debug("OMAP PM: remove min bus tput constraint: " | ||
74 | "dev %s for agent_id %d\n", dev_name(dev), agent_id); | ||
75 | else | ||
76 | pr_debug("OMAP PM: add min bus tput constraint: " | ||
77 | "dev %s for agent_id %d: rate %ld KiB\n", | ||
78 | dev_name(dev), agent_id, r); | ||
79 | |||
80 | /* | ||
81 | * This code should model the interconnect and compute the | ||
82 | * required clock frequency, convert that to a VDD2 OPP ID, then | ||
83 | * set the VDD2 OPP appropriately. | ||
84 | * | ||
85 | * TI CDP code can call constraint_set here on the VDD2 OPP. | ||
86 | */ | ||
87 | |||
88 | return 0; | ||
89 | } | ||
90 | |||
91 | int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev, | ||
92 | long t) | ||
93 | { | ||
94 | if (!req_dev || !dev || t < -1) { | ||
95 | WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__); | ||
96 | return -EINVAL; | ||
97 | }; | ||
98 | |||
99 | if (t == -1) | ||
100 | pr_debug("OMAP PM: remove max device latency constraint: " | ||
101 | "dev %s\n", dev_name(dev)); | ||
102 | else | ||
103 | pr_debug("OMAP PM: add max device latency constraint: " | ||
104 | "dev %s, t = %ld usec\n", dev_name(dev), t); | ||
105 | |||
106 | /* | ||
107 | * For current Linux, this needs to map the device to a | ||
108 | * powerdomain, then go through the list of current max lat | ||
109 | * constraints on that powerdomain and find the smallest. If | ||
110 | * the latency constraint has changed, the code should | ||
111 | * recompute the state to enter for the next powerdomain | ||
112 | * state. Conceivably, this code should also determine | ||
113 | * whether to actually disable the device clocks or not, | ||
114 | * depending on how long it takes to re-enable the clocks. | ||
115 | * | ||
116 | * TI CDP code can call constraint_set here. | ||
117 | */ | ||
118 | |||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | int omap_pm_set_max_sdma_lat(struct device *dev, long t) | ||
123 | { | ||
124 | if (!dev || t < -1) { | ||
125 | WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__); | ||
126 | return -EINVAL; | ||
127 | }; | ||
128 | |||
129 | if (t == -1) | ||
130 | pr_debug("OMAP PM: remove max DMA latency constraint: " | ||
131 | "dev %s\n", dev_name(dev)); | ||
132 | else | ||
133 | pr_debug("OMAP PM: add max DMA latency constraint: " | ||
134 | "dev %s, t = %ld usec\n", dev_name(dev), t); | ||
135 | |||
136 | /* | ||
137 | * For current Linux PM QOS params, this code should scan the | ||
138 | * list of maximum CPU and DMA latencies and select the | ||
139 | * smallest, then set cpu_dma_latency pm_qos_param | ||
140 | * accordingly. | ||
141 | * | ||
142 | * For future Linux PM QOS params, with separate CPU and DMA | ||
143 | * latency params, this code should just set the dma_latency param. | ||
144 | * | ||
145 | * TI CDP code can call constraint_set here. | ||
146 | */ | ||
147 | |||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | int omap_pm_set_min_clk_rate(struct device *dev, struct clk *c, long r) | ||
152 | { | ||
153 | if (!dev || !c || r < 0) { | ||
154 | WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__); | ||
155 | return -EINVAL; | ||
156 | } | ||
157 | |||
158 | if (r == 0) | ||
159 | pr_debug("OMAP PM: remove min clk rate constraint: " | ||
160 | "dev %s\n", dev_name(dev)); | ||
161 | else | ||
162 | pr_debug("OMAP PM: add min clk rate constraint: " | ||
163 | "dev %s, rate = %ld Hz\n", dev_name(dev), r); | ||
164 | |||
165 | /* | ||
166 | * Code in a real implementation should keep track of these | ||
167 | * constraints on the clock, and determine the highest minimum | ||
168 | * clock rate. It should iterate over each OPP and determine | ||
169 | * whether the OPP will result in a clock rate that would | ||
170 | * satisfy this constraint (and any other PM constraint in effect | ||
171 | * at that time). Once it finds the lowest-voltage OPP that | ||
172 | * meets those conditions, it should switch to it, or return | ||
173 | * an error if the code is not capable of doing so. | ||
174 | */ | ||
175 | |||
176 | return 0; | ||
177 | } | ||
178 | |||
179 | /* | ||
180 | * DSP Bridge-specific constraints | ||
181 | */ | ||
182 | |||
183 | const struct omap_opp *omap_pm_dsp_get_opp_table(void) | ||
184 | { | ||
185 | pr_debug("OMAP PM: DSP request for OPP table\n"); | ||
186 | |||
187 | /* | ||
188 | * Return DSP frequency table here: The final item in the | ||
189 | * array should have .rate = .opp_id = 0. | ||
190 | */ | ||
191 | |||
192 | return NULL; | ||
193 | } | ||
194 | |||
195 | void omap_pm_dsp_set_min_opp(u8 opp_id) | ||
196 | { | ||
197 | if (opp_id == 0) { | ||
198 | WARN_ON(1); | ||
199 | return; | ||
200 | } | ||
201 | |||
202 | pr_debug("OMAP PM: DSP requests minimum VDD1 OPP to be %d\n", opp_id); | ||
203 | |||
204 | /* | ||
205 | * | ||
206 | * For l-o dev tree, our VDD1 clk is keyed on OPP ID, so we | ||
207 | * can just test to see which is higher, the CPU's desired OPP | ||
208 | * ID or the DSP's desired OPP ID, and use whichever is | ||
209 | * highest. | ||
210 | * | ||
211 | * In CDP12.14+, the VDD1 OPP custom clock that controls the DSP | ||
212 | * rate is keyed on MPU speed, not the OPP ID. So we need to | ||
213 | * map the OPP ID to the MPU speed for use with clk_set_rate() | ||
214 | * if it is higher than the current OPP clock rate. | ||
215 | * | ||
216 | */ | ||
217 | } | ||
218 | |||
219 | |||
220 | u8 omap_pm_dsp_get_opp(void) | ||
221 | { | ||
222 | pr_debug("OMAP PM: DSP requests current DSP OPP ID\n"); | ||
223 | |||
224 | /* | ||
225 | * For l-o dev tree, call clk_get_rate() on VDD1 OPP clock | ||
226 | * | ||
227 | * CDP12.14+: | ||
228 | * Call clk_get_rate() on the OPP custom clock, map that to an | ||
229 | * OPP ID using the tables defined in board-*.c/chip-*.c files. | ||
230 | */ | ||
231 | |||
232 | return 0; | ||
233 | } | ||
234 | |||
235 | /* | ||
236 | * CPUFreq-originated constraint | ||
237 | * | ||
238 | * In the future, this should be handled by custom OPP clocktype | ||
239 | * functions. | ||
240 | */ | ||
241 | |||
242 | struct cpufreq_frequency_table **omap_pm_cpu_get_freq_table(void) | ||
243 | { | ||
244 | pr_debug("OMAP PM: CPUFreq request for frequency table\n"); | ||
245 | |||
246 | /* | ||
247 | * Return CPUFreq frequency table here: loop over | ||
248 | * all VDD1 clkrates, pull out the mpu_ck frequencies, build | ||
249 | * table | ||
250 | */ | ||
251 | |||
252 | return NULL; | ||
253 | } | ||
254 | |||
255 | void omap_pm_cpu_set_freq(unsigned long f) | ||
256 | { | ||
257 | if (f == 0) { | ||
258 | WARN_ON(1); | ||
259 | return; | ||
260 | } | ||
261 | |||
262 | pr_debug("OMAP PM: CPUFreq requests CPU frequency to be set to %lu\n", | ||
263 | f); | ||
264 | |||
265 | /* | ||
266 | * For l-o dev tree, determine whether MPU freq or DSP OPP id | ||
267 | * freq is higher. Find the OPP ID corresponding to the | ||
268 | * higher frequency. Call clk_round_rate() and clk_set_rate() | ||
269 | * on the OPP custom clock. | ||
270 | * | ||
271 | * CDP should just be able to set the VDD1 OPP clock rate here. | ||
272 | */ | ||
273 | } | ||
274 | |||
275 | unsigned long omap_pm_cpu_get_freq(void) | ||
276 | { | ||
277 | pr_debug("OMAP PM: CPUFreq requests current CPU frequency\n"); | ||
278 | |||
279 | /* | ||
280 | * Call clk_get_rate() on the mpu_ck. | ||
281 | */ | ||
282 | |||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | /** | ||
287 | * omap_pm_enable_off_mode - notify OMAP PM that off-mode is enabled | ||
288 | * | ||
289 | * Intended for use only by OMAP PM core code to notify this layer | ||
290 | * that off mode has been enabled. | ||
291 | */ | ||
292 | void omap_pm_enable_off_mode(void) | ||
293 | { | ||
294 | off_mode_enabled = true; | ||
295 | } | ||
296 | |||
297 | /** | ||
298 | * omap_pm_disable_off_mode - notify OMAP PM that off-mode is disabled | ||
299 | * | ||
300 | * Intended for use only by OMAP PM core code to notify this layer | ||
301 | * that off mode has been disabled. | ||
302 | */ | ||
303 | void omap_pm_disable_off_mode(void) | ||
304 | { | ||
305 | off_mode_enabled = false; | ||
306 | } | ||
307 | |||
308 | /* | ||
309 | * Device context loss tracking | ||
310 | */ | ||
311 | |||
312 | #ifdef CONFIG_ARCH_OMAP2PLUS | ||
313 | |||
314 | u32 omap_pm_get_dev_context_loss_count(struct device *dev) | ||
315 | { | ||
316 | struct platform_device *pdev = to_platform_device(dev); | ||
317 | u32 count; | ||
318 | |||
319 | if (WARN_ON(!dev)) | ||
320 | return 0; | ||
321 | |||
322 | if (dev->parent == &omap_device_parent) { | ||
323 | count = omap_device_get_context_loss_count(pdev); | ||
324 | } else { | ||
325 | WARN_ONCE(off_mode_enabled, "omap_pm: using dummy context loss counter; device %s should be converted to omap_device", | ||
326 | dev_name(dev)); | ||
327 | if (off_mode_enabled) | ||
328 | dummy_context_loss_counter++; | ||
329 | count = dummy_context_loss_counter; | ||
330 | } | ||
331 | |||
332 | pr_debug("OMAP PM: context loss count for dev %s = %d\n", | ||
333 | dev_name(dev), count); | ||
334 | |||
335 | return count; | ||
336 | } | ||
337 | |||
338 | #else | ||
339 | |||
340 | u32 omap_pm_get_dev_context_loss_count(struct device *dev) | ||
341 | { | ||
342 | return dummy_context_loss_counter; | ||
343 | } | ||
344 | |||
345 | #endif | ||
346 | |||
347 | /* Should be called before clk framework init */ | ||
348 | int __init omap_pm_if_early_init(void) | ||
349 | { | ||
350 | return 0; | ||
351 | } | ||
352 | |||
353 | /* Must be called after clock framework is initialized */ | ||
354 | int __init omap_pm_if_init(void) | ||
355 | { | ||
356 | return 0; | ||
357 | } | ||
358 | |||
359 | void omap_pm_if_exit(void) | ||
360 | { | ||
361 | /* Deallocate CPUFreq frequency table here */ | ||
362 | } | ||
363 | |||
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c new file mode 100644 index 00000000000..02609eee056 --- /dev/null +++ b/arch/arm/plat-omap/omap_device.c | |||
@@ -0,0 +1,924 @@ | |||
1 | /* | ||
2 | * omap_device implementation | ||
3 | * | ||
4 | * Copyright (C) 2009-2010 Nokia Corporation | ||
5 | * Paul Walmsley, Kevin Hilman | ||
6 | * | ||
7 | * Developed in collaboration with (alphabetical order): Benoit | ||
8 | * Cousson, Thara Gopinath, Tony Lindgren, Rajendra Nayak, Vikram | ||
9 | * Pandita, Sakari Poussa, Anand Sawant, Santosh Shilimkar, Richard | ||
10 | * Woodruff | ||
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 | * This code provides a consistent interface for OMAP device drivers | ||
17 | * to control power management and interconnect properties of their | ||
18 | * devices. | ||
19 | * | ||
20 | * In the medium- to long-term, this code should either be | ||
21 | * a) implemented via arch-specific pointers in platform_data | ||
22 | * or | ||
23 | * b) implemented as a proper omap_bus/omap_device in Linux, no more | ||
24 | * platform_data func pointers | ||
25 | * | ||
26 | * | ||
27 | * Guidelines for usage by driver authors: | ||
28 | * | ||
29 | * 1. These functions are intended to be used by device drivers via | ||
30 | * function pointers in struct platform_data. As an example, | ||
31 | * omap_device_enable() should be passed to the driver as | ||
32 | * | ||
33 | * struct foo_driver_platform_data { | ||
34 | * ... | ||
35 | * int (*device_enable)(struct platform_device *pdev); | ||
36 | * ... | ||
37 | * } | ||
38 | * | ||
39 | * Note that the generic "device_enable" name is used, rather than | ||
40 | * "omap_device_enable". This is so other architectures can pass in their | ||
41 | * own enable/disable functions here. | ||
42 | * | ||
43 | * This should be populated during device setup: | ||
44 | * | ||
45 | * ... | ||
46 | * pdata->device_enable = omap_device_enable; | ||
47 | * ... | ||
48 | * | ||
49 | * 2. Drivers should first check to ensure the function pointer is not null | ||
50 | * before calling it, as in: | ||
51 | * | ||
52 | * if (pdata->device_enable) | ||
53 | * pdata->device_enable(pdev); | ||
54 | * | ||
55 | * This allows other architectures that don't use similar device_enable()/ | ||
56 | * device_shutdown() functions to execute normally. | ||
57 | * | ||
58 | * ... | ||
59 | * | ||
60 | * Suggested usage by device drivers: | ||
61 | * | ||
62 | * During device initialization: | ||
63 | * device_enable() | ||
64 | * | ||
65 | * During device idle: | ||
66 | * (save remaining device context if necessary) | ||
67 | * device_idle(); | ||
68 | * | ||
69 | * During device resume: | ||
70 | * device_enable(); | ||
71 | * (restore context if necessary) | ||
72 | * | ||
73 | * During device shutdown: | ||
74 | * device_shutdown() | ||
75 | * (device must be reinitialized at this point to use it again) | ||
76 | * | ||
77 | */ | ||
78 | #undef DEBUG | ||
79 | |||
80 | #include <linux/kernel.h> | ||
81 | #include <linux/platform_device.h> | ||
82 | #include <linux/slab.h> | ||
83 | #include <linux/err.h> | ||
84 | #include <linux/io.h> | ||
85 | #include <linux/clk.h> | ||
86 | #include <linux/clkdev.h> | ||
87 | #include <linux/pm_runtime.h> | ||
88 | |||
89 | #include <plat/omap_device.h> | ||
90 | #include <plat/omap_hwmod.h> | ||
91 | #include <plat/clock.h> | ||
92 | |||
93 | /* These parameters are passed to _omap_device_{de,}activate() */ | ||
94 | #define USE_WAKEUP_LAT 0 | ||
95 | #define IGNORE_WAKEUP_LAT 1 | ||
96 | |||
97 | /* Private functions */ | ||
98 | |||
99 | /** | ||
100 | * _omap_device_activate - increase device readiness | ||
101 | * @od: struct omap_device * | ||
102 | * @ignore_lat: increase to latency target (0) or full readiness (1)? | ||
103 | * | ||
104 | * Increase readiness of omap_device @od (thus decreasing device | ||
105 | * wakeup latency, but consuming more power). If @ignore_lat is | ||
106 | * IGNORE_WAKEUP_LAT, make the omap_device fully active. Otherwise, | ||
107 | * if @ignore_lat is USE_WAKEUP_LAT, and the device's maximum wakeup | ||
108 | * latency is greater than the requested maximum wakeup latency, step | ||
109 | * backwards in the omap_device_pm_latency table to ensure the | ||
110 | * device's maximum wakeup latency is less than or equal to the | ||
111 | * requested maximum wakeup latency. Returns 0. | ||
112 | */ | ||
113 | static int _omap_device_activate(struct omap_device *od, u8 ignore_lat) | ||
114 | { | ||
115 | struct timespec a, b, c; | ||
116 | |||
117 | pr_debug("omap_device: %s: activating\n", od->pdev.name); | ||
118 | |||
119 | while (od->pm_lat_level > 0) { | ||
120 | struct omap_device_pm_latency *odpl; | ||
121 | unsigned long long act_lat = 0; | ||
122 | |||
123 | od->pm_lat_level--; | ||
124 | |||
125 | odpl = od->pm_lats + od->pm_lat_level; | ||
126 | |||
127 | if (!ignore_lat && | ||
128 | (od->dev_wakeup_lat <= od->_dev_wakeup_lat_limit)) | ||
129 | break; | ||
130 | |||
131 | read_persistent_clock(&a); | ||
132 | |||
133 | /* XXX check return code */ | ||
134 | odpl->activate_func(od); | ||
135 | |||
136 | read_persistent_clock(&b); | ||
137 | |||
138 | c = timespec_sub(b, a); | ||
139 | act_lat = timespec_to_ns(&c); | ||
140 | |||
141 | pr_debug("omap_device: %s: pm_lat %d: activate: elapsed time " | ||
142 | "%llu nsec\n", od->pdev.name, od->pm_lat_level, | ||
143 | act_lat); | ||
144 | |||
145 | if (act_lat > odpl->activate_lat) { | ||
146 | odpl->activate_lat_worst = act_lat; | ||
147 | if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) { | ||
148 | odpl->activate_lat = act_lat; | ||
149 | pr_warning("omap_device: %s.%d: new worst case " | ||
150 | "activate latency %d: %llu\n", | ||
151 | od->pdev.name, od->pdev.id, | ||
152 | od->pm_lat_level, act_lat); | ||
153 | } else | ||
154 | pr_warning("omap_device: %s.%d: activate " | ||
155 | "latency %d higher than exptected. " | ||
156 | "(%llu > %d)\n", | ||
157 | od->pdev.name, od->pdev.id, | ||
158 | od->pm_lat_level, act_lat, | ||
159 | odpl->activate_lat); | ||
160 | } | ||
161 | |||
162 | od->dev_wakeup_lat -= odpl->activate_lat; | ||
163 | } | ||
164 | |||
165 | return 0; | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * _omap_device_deactivate - decrease device readiness | ||
170 | * @od: struct omap_device * | ||
171 | * @ignore_lat: decrease to latency target (0) or full inactivity (1)? | ||
172 | * | ||
173 | * Decrease readiness of omap_device @od (thus increasing device | ||
174 | * wakeup latency, but conserving power). If @ignore_lat is | ||
175 | * IGNORE_WAKEUP_LAT, make the omap_device fully inactive. Otherwise, | ||
176 | * if @ignore_lat is USE_WAKEUP_LAT, and the device's maximum wakeup | ||
177 | * latency is less than the requested maximum wakeup latency, step | ||
178 | * forwards in the omap_device_pm_latency table to ensure the device's | ||
179 | * maximum wakeup latency is less than or equal to the requested | ||
180 | * maximum wakeup latency. Returns 0. | ||
181 | */ | ||
182 | static int _omap_device_deactivate(struct omap_device *od, u8 ignore_lat) | ||
183 | { | ||
184 | struct timespec a, b, c; | ||
185 | |||
186 | pr_debug("omap_device: %s: deactivating\n", od->pdev.name); | ||
187 | |||
188 | while (od->pm_lat_level < od->pm_lats_cnt) { | ||
189 | struct omap_device_pm_latency *odpl; | ||
190 | unsigned long long deact_lat = 0; | ||
191 | |||
192 | odpl = od->pm_lats + od->pm_lat_level; | ||
193 | |||
194 | if (!ignore_lat && | ||
195 | ((od->dev_wakeup_lat + odpl->activate_lat) > | ||
196 | od->_dev_wakeup_lat_limit)) | ||
197 | break; | ||
198 | |||
199 | read_persistent_clock(&a); | ||
200 | |||
201 | /* XXX check return code */ | ||
202 | odpl->deactivate_func(od); | ||
203 | |||
204 | read_persistent_clock(&b); | ||
205 | |||
206 | c = timespec_sub(b, a); | ||
207 | deact_lat = timespec_to_ns(&c); | ||
208 | |||
209 | pr_debug("omap_device: %s: pm_lat %d: deactivate: elapsed time " | ||
210 | "%llu nsec\n", od->pdev.name, od->pm_lat_level, | ||
211 | deact_lat); | ||
212 | |||
213 | if (deact_lat > odpl->deactivate_lat) { | ||
214 | odpl->deactivate_lat_worst = deact_lat; | ||
215 | if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) { | ||
216 | odpl->deactivate_lat = deact_lat; | ||
217 | pr_warning("omap_device: %s.%d: new worst case " | ||
218 | "deactivate latency %d: %llu\n", | ||
219 | od->pdev.name, od->pdev.id, | ||
220 | od->pm_lat_level, deact_lat); | ||
221 | } else | ||
222 | pr_warning("omap_device: %s.%d: deactivate " | ||
223 | "latency %d higher than exptected. " | ||
224 | "(%llu > %d)\n", | ||
225 | od->pdev.name, od->pdev.id, | ||
226 | od->pm_lat_level, deact_lat, | ||
227 | odpl->deactivate_lat); | ||
228 | } | ||
229 | |||
230 | |||
231 | od->dev_wakeup_lat += odpl->activate_lat; | ||
232 | |||
233 | od->pm_lat_level++; | ||
234 | } | ||
235 | |||
236 | return 0; | ||
237 | } | ||
238 | |||
239 | static void _add_clkdev(struct omap_device *od, const char *clk_alias, | ||
240 | const char *clk_name) | ||
241 | { | ||
242 | struct clk *r; | ||
243 | struct clk_lookup *l; | ||
244 | |||
245 | if (!clk_alias || !clk_name) | ||
246 | return; | ||
247 | |||
248 | pr_debug("omap_device: %s: Creating %s -> %s\n", | ||
249 | dev_name(&od->pdev.dev), clk_alias, clk_name); | ||
250 | |||
251 | r = clk_get_sys(dev_name(&od->pdev.dev), clk_alias); | ||
252 | if (!IS_ERR(r)) { | ||
253 | pr_warning("omap_device: %s: alias %s already exists\n", | ||
254 | dev_name(&od->pdev.dev), clk_alias); | ||
255 | clk_put(r); | ||
256 | return; | ||
257 | } | ||
258 | |||
259 | r = omap_clk_get_by_name(clk_name); | ||
260 | if (IS_ERR(r)) { | ||
261 | pr_err("omap_device: %s: omap_clk_get_by_name for %s failed\n", | ||
262 | dev_name(&od->pdev.dev), clk_name); | ||
263 | return; | ||
264 | } | ||
265 | |||
266 | l = clkdev_alloc(r, clk_alias, dev_name(&od->pdev.dev)); | ||
267 | if (!l) { | ||
268 | pr_err("omap_device: %s: clkdev_alloc for %s failed\n", | ||
269 | dev_name(&od->pdev.dev), clk_alias); | ||
270 | return; | ||
271 | } | ||
272 | |||
273 | clkdev_add(l); | ||
274 | } | ||
275 | |||
276 | /** | ||
277 | * _add_hwmod_clocks_clkdev - Add clkdev entry for hwmod optional clocks | ||
278 | * and main clock | ||
279 | * @od: struct omap_device *od | ||
280 | * @oh: struct omap_hwmod *oh | ||
281 | * | ||
282 | * For the main clock and every optional clock present per hwmod per | ||
283 | * omap_device, this function adds an entry in the clkdev table of the | ||
284 | * form <dev-id=dev_name, con-id=role> if it does not exist already. | ||
285 | * | ||
286 | * The function is called from inside omap_device_build_ss(), after | ||
287 | * omap_device_register. | ||
288 | * | ||
289 | * This allows drivers to get a pointer to its optional clocks based on its role | ||
290 | * by calling clk_get(<dev*>, <role>). | ||
291 | * In the case of the main clock, a "fck" alias is used. | ||
292 | * | ||
293 | * No return value. | ||
294 | */ | ||
295 | static void _add_hwmod_clocks_clkdev(struct omap_device *od, | ||
296 | struct omap_hwmod *oh) | ||
297 | { | ||
298 | int i; | ||
299 | |||
300 | _add_clkdev(od, "fck", oh->main_clk); | ||
301 | |||
302 | for (i = 0; i < oh->opt_clks_cnt; i++) | ||
303 | _add_clkdev(od, oh->opt_clks[i].role, oh->opt_clks[i].clk); | ||
304 | } | ||
305 | |||
306 | |||
307 | /* Public functions for use by core code */ | ||
308 | |||
309 | /** | ||
310 | * omap_device_get_context_loss_count - get lost context count | ||
311 | * @od: struct omap_device * | ||
312 | * | ||
313 | * Using the primary hwmod, query the context loss count for this | ||
314 | * device. | ||
315 | * | ||
316 | * Callers should consider context for this device lost any time this | ||
317 | * function returns a value different than the value the caller got | ||
318 | * the last time it called this function. | ||
319 | * | ||
320 | * If any hwmods exist for the omap_device assoiated with @pdev, | ||
321 | * return the context loss counter for that hwmod, otherwise return | ||
322 | * zero. | ||
323 | */ | ||
324 | u32 omap_device_get_context_loss_count(struct platform_device *pdev) | ||
325 | { | ||
326 | struct omap_device *od; | ||
327 | u32 ret = 0; | ||
328 | |||
329 | od = to_omap_device(pdev); | ||
330 | |||
331 | if (od->hwmods_cnt) | ||
332 | ret = omap_hwmod_get_context_loss_count(od->hwmods[0]); | ||
333 | |||
334 | return ret; | ||
335 | } | ||
336 | |||
337 | /** | ||
338 | * omap_device_count_resources - count number of struct resource entries needed | ||
339 | * @od: struct omap_device * | ||
340 | * | ||
341 | * Count the number of struct resource entries needed for this | ||
342 | * omap_device @od. Used by omap_device_build_ss() to determine how | ||
343 | * much memory to allocate before calling | ||
344 | * omap_device_fill_resources(). Returns the count. | ||
345 | */ | ||
346 | int omap_device_count_resources(struct omap_device *od) | ||
347 | { | ||
348 | int c = 0; | ||
349 | int i; | ||
350 | |||
351 | for (i = 0; i < od->hwmods_cnt; i++) | ||
352 | c += omap_hwmod_count_resources(od->hwmods[i]); | ||
353 | |||
354 | pr_debug("omap_device: %s: counted %d total resources across %d " | ||
355 | "hwmods\n", od->pdev.name, c, od->hwmods_cnt); | ||
356 | |||
357 | return c; | ||
358 | } | ||
359 | |||
360 | /** | ||
361 | * omap_device_fill_resources - fill in array of struct resource | ||
362 | * @od: struct omap_device * | ||
363 | * @res: pointer to an array of struct resource to be filled in | ||
364 | * | ||
365 | * Populate one or more empty struct resource pointed to by @res with | ||
366 | * the resource data for this omap_device @od. Used by | ||
367 | * omap_device_build_ss() after calling omap_device_count_resources(). | ||
368 | * Ideally this function would not be needed at all. If omap_device | ||
369 | * replaces platform_device, then we can specify our own | ||
370 | * get_resource()/ get_irq()/etc functions that use the underlying | ||
371 | * omap_hwmod information. Or if platform_device is extended to use | ||
372 | * subarchitecture-specific function pointers, the various | ||
373 | * platform_device functions can simply call omap_device internal | ||
374 | * functions to get device resources. Hacking around the existing | ||
375 | * platform_device code wastes memory. Returns 0. | ||
376 | */ | ||
377 | int omap_device_fill_resources(struct omap_device *od, struct resource *res) | ||
378 | { | ||
379 | int c = 0; | ||
380 | int i, r; | ||
381 | |||
382 | for (i = 0; i < od->hwmods_cnt; i++) { | ||
383 | r = omap_hwmod_fill_resources(od->hwmods[i], res); | ||
384 | res += r; | ||
385 | c += r; | ||
386 | } | ||
387 | |||
388 | return 0; | ||
389 | } | ||
390 | |||
391 | /** | ||
392 | * omap_device_build - build and register an omap_device with one omap_hwmod | ||
393 | * @pdev_name: name of the platform_device driver to use | ||
394 | * @pdev_id: this platform_device's connection ID | ||
395 | * @oh: ptr to the single omap_hwmod that backs this omap_device | ||
396 | * @pdata: platform_data ptr to associate with the platform_device | ||
397 | * @pdata_len: amount of memory pointed to by @pdata | ||
398 | * @pm_lats: pointer to a omap_device_pm_latency array for this device | ||
399 | * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats | ||
400 | * @is_early_device: should the device be registered as an early device or not | ||
401 | * | ||
402 | * Convenience function for building and registering a single | ||
403 | * omap_device record, which in turn builds and registers a | ||
404 | * platform_device record. See omap_device_build_ss() for more | ||
405 | * information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise, | ||
406 | * passes along the return value of omap_device_build_ss(). | ||
407 | */ | ||
408 | struct omap_device *omap_device_build(const char *pdev_name, int pdev_id, | ||
409 | struct omap_hwmod *oh, void *pdata, | ||
410 | int pdata_len, | ||
411 | struct omap_device_pm_latency *pm_lats, | ||
412 | int pm_lats_cnt, int is_early_device) | ||
413 | { | ||
414 | struct omap_hwmod *ohs[] = { oh }; | ||
415 | |||
416 | if (!oh) | ||
417 | return ERR_PTR(-EINVAL); | ||
418 | |||
419 | return omap_device_build_ss(pdev_name, pdev_id, ohs, 1, pdata, | ||
420 | pdata_len, pm_lats, pm_lats_cnt, | ||
421 | is_early_device); | ||
422 | } | ||
423 | |||
424 | /** | ||
425 | * omap_device_build_ss - build and register an omap_device with multiple hwmods | ||
426 | * @pdev_name: name of the platform_device driver to use | ||
427 | * @pdev_id: this platform_device's connection ID | ||
428 | * @oh: ptr to the single omap_hwmod that backs this omap_device | ||
429 | * @pdata: platform_data ptr to associate with the platform_device | ||
430 | * @pdata_len: amount of memory pointed to by @pdata | ||
431 | * @pm_lats: pointer to a omap_device_pm_latency array for this device | ||
432 | * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats | ||
433 | * @is_early_device: should the device be registered as an early device or not | ||
434 | * | ||
435 | * Convenience function for building and registering an omap_device | ||
436 | * subsystem record. Subsystem records consist of multiple | ||
437 | * omap_hwmods. This function in turn builds and registers a | ||
438 | * platform_device record. Returns an ERR_PTR() on error, or passes | ||
439 | * along the return value of omap_device_register(). | ||
440 | */ | ||
441 | struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, | ||
442 | struct omap_hwmod **ohs, int oh_cnt, | ||
443 | void *pdata, int pdata_len, | ||
444 | struct omap_device_pm_latency *pm_lats, | ||
445 | int pm_lats_cnt, int is_early_device) | ||
446 | { | ||
447 | int ret = -ENOMEM; | ||
448 | struct omap_device *od; | ||
449 | char *pdev_name2; | ||
450 | struct resource *res = NULL; | ||
451 | int i, res_count; | ||
452 | struct omap_hwmod **hwmods; | ||
453 | |||
454 | if (!ohs || oh_cnt == 0 || !pdev_name) | ||
455 | return ERR_PTR(-EINVAL); | ||
456 | |||
457 | if (!pdata && pdata_len > 0) | ||
458 | return ERR_PTR(-EINVAL); | ||
459 | |||
460 | pr_debug("omap_device: %s: building with %d hwmods\n", pdev_name, | ||
461 | oh_cnt); | ||
462 | |||
463 | od = kzalloc(sizeof(struct omap_device), GFP_KERNEL); | ||
464 | if (!od) | ||
465 | return ERR_PTR(-ENOMEM); | ||
466 | |||
467 | od->hwmods_cnt = oh_cnt; | ||
468 | |||
469 | hwmods = kzalloc(sizeof(struct omap_hwmod *) * oh_cnt, | ||
470 | GFP_KERNEL); | ||
471 | if (!hwmods) | ||
472 | goto odbs_exit1; | ||
473 | |||
474 | memcpy(hwmods, ohs, sizeof(struct omap_hwmod *) * oh_cnt); | ||
475 | od->hwmods = hwmods; | ||
476 | |||
477 | pdev_name2 = kzalloc(strlen(pdev_name) + 1, GFP_KERNEL); | ||
478 | if (!pdev_name2) | ||
479 | goto odbs_exit2; | ||
480 | strcpy(pdev_name2, pdev_name); | ||
481 | |||
482 | od->pdev.name = pdev_name2; | ||
483 | od->pdev.id = pdev_id; | ||
484 | |||
485 | res_count = omap_device_count_resources(od); | ||
486 | if (res_count > 0) { | ||
487 | res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL); | ||
488 | if (!res) | ||
489 | goto odbs_exit3; | ||
490 | } | ||
491 | omap_device_fill_resources(od, res); | ||
492 | |||
493 | od->pdev.num_resources = res_count; | ||
494 | od->pdev.resource = res; | ||
495 | |||
496 | ret = platform_device_add_data(&od->pdev, pdata, pdata_len); | ||
497 | if (ret) | ||
498 | goto odbs_exit4; | ||
499 | |||
500 | od->pm_lats = pm_lats; | ||
501 | od->pm_lats_cnt = pm_lats_cnt; | ||
502 | |||
503 | if (is_early_device) | ||
504 | ret = omap_early_device_register(od); | ||
505 | else | ||
506 | ret = omap_device_register(od); | ||
507 | |||
508 | for (i = 0; i < oh_cnt; i++) { | ||
509 | hwmods[i]->od = od; | ||
510 | _add_hwmod_clocks_clkdev(od, hwmods[i]); | ||
511 | } | ||
512 | |||
513 | if (ret) | ||
514 | goto odbs_exit4; | ||
515 | |||
516 | return od; | ||
517 | |||
518 | odbs_exit4: | ||
519 | kfree(res); | ||
520 | odbs_exit3: | ||
521 | kfree(pdev_name2); | ||
522 | odbs_exit2: | ||
523 | kfree(hwmods); | ||
524 | odbs_exit1: | ||
525 | kfree(od); | ||
526 | |||
527 | pr_err("omap_device: %s: build failed (%d)\n", pdev_name, ret); | ||
528 | |||
529 | return ERR_PTR(ret); | ||
530 | } | ||
531 | |||
532 | /** | ||
533 | * omap_early_device_register - register an omap_device as an early platform | ||
534 | * device. | ||
535 | * @od: struct omap_device * to register | ||
536 | * | ||
537 | * Register the omap_device structure. This currently just calls | ||
538 | * platform_early_add_device() on the underlying platform_device. | ||
539 | * Returns 0 by default. | ||
540 | */ | ||
541 | int omap_early_device_register(struct omap_device *od) | ||
542 | { | ||
543 | struct platform_device *devices[1]; | ||
544 | |||
545 | devices[0] = &(od->pdev); | ||
546 | early_platform_add_devices(devices, 1); | ||
547 | return 0; | ||
548 | } | ||
549 | |||
550 | #ifdef CONFIG_PM_RUNTIME | ||
551 | static int _od_runtime_suspend(struct device *dev) | ||
552 | { | ||
553 | struct platform_device *pdev = to_platform_device(dev); | ||
554 | int ret; | ||
555 | |||
556 | ret = pm_generic_runtime_suspend(dev); | ||
557 | |||
558 | if (!ret) | ||
559 | omap_device_idle(pdev); | ||
560 | |||
561 | return ret; | ||
562 | } | ||
563 | |||
564 | static int _od_runtime_idle(struct device *dev) | ||
565 | { | ||
566 | return pm_generic_runtime_idle(dev); | ||
567 | } | ||
568 | |||
569 | static int _od_runtime_resume(struct device *dev) | ||
570 | { | ||
571 | struct platform_device *pdev = to_platform_device(dev); | ||
572 | |||
573 | omap_device_enable(pdev); | ||
574 | |||
575 | return pm_generic_runtime_resume(dev); | ||
576 | } | ||
577 | #endif | ||
578 | |||
579 | #ifdef CONFIG_SUSPEND | ||
580 | static int _od_suspend_noirq(struct device *dev) | ||
581 | { | ||
582 | struct platform_device *pdev = to_platform_device(dev); | ||
583 | struct omap_device *od = to_omap_device(pdev); | ||
584 | int ret; | ||
585 | |||
586 | if (od->flags & OMAP_DEVICE_NO_IDLE_ON_SUSPEND) | ||
587 | return pm_generic_suspend_noirq(dev); | ||
588 | |||
589 | ret = pm_generic_suspend_noirq(dev); | ||
590 | |||
591 | if (!ret && !pm_runtime_status_suspended(dev)) { | ||
592 | if (pm_generic_runtime_suspend(dev) == 0) { | ||
593 | omap_device_idle(pdev); | ||
594 | od->flags |= OMAP_DEVICE_SUSPENDED; | ||
595 | } | ||
596 | } | ||
597 | |||
598 | return ret; | ||
599 | } | ||
600 | |||
601 | static int _od_resume_noirq(struct device *dev) | ||
602 | { | ||
603 | struct platform_device *pdev = to_platform_device(dev); | ||
604 | struct omap_device *od = to_omap_device(pdev); | ||
605 | |||
606 | if (od->flags & OMAP_DEVICE_NO_IDLE_ON_SUSPEND) | ||
607 | return pm_generic_resume_noirq(dev); | ||
608 | |||
609 | if ((od->flags & OMAP_DEVICE_SUSPENDED) && | ||
610 | !pm_runtime_status_suspended(dev)) { | ||
611 | od->flags &= ~OMAP_DEVICE_SUSPENDED; | ||
612 | omap_device_enable(pdev); | ||
613 | pm_generic_runtime_resume(dev); | ||
614 | } | ||
615 | |||
616 | return pm_generic_resume_noirq(dev); | ||
617 | } | ||
618 | #else | ||
619 | #define _od_suspend_noirq NULL | ||
620 | #define _od_resume_noirq NULL | ||
621 | #endif | ||
622 | |||
623 | static struct dev_pm_domain omap_device_pm_domain = { | ||
624 | .ops = { | ||
625 | SET_RUNTIME_PM_OPS(_od_runtime_suspend, _od_runtime_resume, | ||
626 | _od_runtime_idle) | ||
627 | USE_PLATFORM_PM_SLEEP_OPS | ||
628 | .suspend_noirq = _od_suspend_noirq, | ||
629 | .resume_noirq = _od_resume_noirq, | ||
630 | } | ||
631 | }; | ||
632 | |||
633 | /** | ||
634 | * omap_device_register - register an omap_device with one omap_hwmod | ||
635 | * @od: struct omap_device * to register | ||
636 | * | ||
637 | * Register the omap_device structure. This currently just calls | ||
638 | * platform_device_register() on the underlying platform_device. | ||
639 | * Returns the return value of platform_device_register(). | ||
640 | */ | ||
641 | int omap_device_register(struct omap_device *od) | ||
642 | { | ||
643 | pr_debug("omap_device: %s: registering\n", od->pdev.name); | ||
644 | |||
645 | od->pdev.dev.parent = &omap_device_parent; | ||
646 | od->pdev.dev.pm_domain = &omap_device_pm_domain; | ||
647 | return platform_device_register(&od->pdev); | ||
648 | } | ||
649 | |||
650 | |||
651 | /* Public functions for use by device drivers through struct platform_data */ | ||
652 | |||
653 | /** | ||
654 | * omap_device_enable - fully activate an omap_device | ||
655 | * @od: struct omap_device * to activate | ||
656 | * | ||
657 | * Do whatever is necessary for the hwmods underlying omap_device @od | ||
658 | * to be accessible and ready to operate. This generally involves | ||
659 | * enabling clocks, setting SYSCONFIG registers; and in the future may | ||
660 | * involve remuxing pins. Device drivers should call this function | ||
661 | * (through platform_data function pointers) where they would normally | ||
662 | * enable clocks, etc. Returns -EINVAL if called when the omap_device | ||
663 | * is already enabled, or passes along the return value of | ||
664 | * _omap_device_activate(). | ||
665 | */ | ||
666 | int omap_device_enable(struct platform_device *pdev) | ||
667 | { | ||
668 | int ret; | ||
669 | struct omap_device *od; | ||
670 | |||
671 | od = to_omap_device(pdev); | ||
672 | |||
673 | if (od->_state == OMAP_DEVICE_STATE_ENABLED) { | ||
674 | WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n", | ||
675 | od->pdev.name, od->pdev.id, __func__, od->_state); | ||
676 | return -EINVAL; | ||
677 | } | ||
678 | |||
679 | /* Enable everything if we're enabling this device from scratch */ | ||
680 | if (od->_state == OMAP_DEVICE_STATE_UNKNOWN) | ||
681 | od->pm_lat_level = od->pm_lats_cnt; | ||
682 | |||
683 | ret = _omap_device_activate(od, IGNORE_WAKEUP_LAT); | ||
684 | |||
685 | od->dev_wakeup_lat = 0; | ||
686 | od->_dev_wakeup_lat_limit = UINT_MAX; | ||
687 | od->_state = OMAP_DEVICE_STATE_ENABLED; | ||
688 | |||
689 | return ret; | ||
690 | } | ||
691 | |||
692 | /** | ||
693 | * omap_device_idle - idle an omap_device | ||
694 | * @od: struct omap_device * to idle | ||
695 | * | ||
696 | * Idle omap_device @od by calling as many .deactivate_func() entries | ||
697 | * in the omap_device's pm_lats table as is possible without exceeding | ||
698 | * the device's maximum wakeup latency limit, pm_lat_limit. Device | ||
699 | * drivers should call this function (through platform_data function | ||
700 | * pointers) where they would normally disable clocks after operations | ||
701 | * complete, etc.. Returns -EINVAL if the omap_device is not | ||
702 | * currently enabled, or passes along the return value of | ||
703 | * _omap_device_deactivate(). | ||
704 | */ | ||
705 | int omap_device_idle(struct platform_device *pdev) | ||
706 | { | ||
707 | int ret; | ||
708 | struct omap_device *od; | ||
709 | |||
710 | od = to_omap_device(pdev); | ||
711 | |||
712 | if (od->_state != OMAP_DEVICE_STATE_ENABLED) { | ||
713 | WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n", | ||
714 | od->pdev.name, od->pdev.id, __func__, od->_state); | ||
715 | return -EINVAL; | ||
716 | } | ||
717 | |||
718 | ret = _omap_device_deactivate(od, USE_WAKEUP_LAT); | ||
719 | |||
720 | od->_state = OMAP_DEVICE_STATE_IDLE; | ||
721 | |||
722 | return ret; | ||
723 | } | ||
724 | |||
725 | /** | ||
726 | * omap_device_shutdown - shut down an omap_device | ||
727 | * @od: struct omap_device * to shut down | ||
728 | * | ||
729 | * Shut down omap_device @od by calling all .deactivate_func() entries | ||
730 | * in the omap_device's pm_lats table and then shutting down all of | ||
731 | * the underlying omap_hwmods. Used when a device is being "removed" | ||
732 | * or a device driver is being unloaded. Returns -EINVAL if the | ||
733 | * omap_device is not currently enabled or idle, or passes along the | ||
734 | * return value of _omap_device_deactivate(). | ||
735 | */ | ||
736 | int omap_device_shutdown(struct platform_device *pdev) | ||
737 | { | ||
738 | int ret, i; | ||
739 | struct omap_device *od; | ||
740 | |||
741 | od = to_omap_device(pdev); | ||
742 | |||
743 | if (od->_state != OMAP_DEVICE_STATE_ENABLED && | ||
744 | od->_state != OMAP_DEVICE_STATE_IDLE) { | ||
745 | WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n", | ||
746 | od->pdev.name, od->pdev.id, __func__, od->_state); | ||
747 | return -EINVAL; | ||
748 | } | ||
749 | |||
750 | ret = _omap_device_deactivate(od, IGNORE_WAKEUP_LAT); | ||
751 | |||
752 | for (i = 0; i < od->hwmods_cnt; i++) | ||
753 | omap_hwmod_shutdown(od->hwmods[i]); | ||
754 | |||
755 | od->_state = OMAP_DEVICE_STATE_SHUTDOWN; | ||
756 | |||
757 | return ret; | ||
758 | } | ||
759 | |||
760 | /** | ||
761 | * omap_device_align_pm_lat - activate/deactivate device to match wakeup lat lim | ||
762 | * @od: struct omap_device * | ||
763 | * | ||
764 | * When a device's maximum wakeup latency limit changes, call some of | ||
765 | * the .activate_func or .deactivate_func function pointers in the | ||
766 | * omap_device's pm_lats array to ensure that the device's maximum | ||
767 | * wakeup latency is less than or equal to the new latency limit. | ||
768 | * Intended to be called by OMAP PM code whenever a device's maximum | ||
769 | * wakeup latency limit changes (e.g., via | ||
770 | * omap_pm_set_dev_wakeup_lat()). Returns 0 if nothing needs to be | ||
771 | * done (e.g., if the omap_device is not currently idle, or if the | ||
772 | * wakeup latency is already current with the new limit) or passes | ||
773 | * along the return value of _omap_device_deactivate() or | ||
774 | * _omap_device_activate(). | ||
775 | */ | ||
776 | int omap_device_align_pm_lat(struct platform_device *pdev, | ||
777 | u32 new_wakeup_lat_limit) | ||
778 | { | ||
779 | int ret = -EINVAL; | ||
780 | struct omap_device *od; | ||
781 | |||
782 | od = to_omap_device(pdev); | ||
783 | |||
784 | if (new_wakeup_lat_limit == od->dev_wakeup_lat) | ||
785 | return 0; | ||
786 | |||
787 | od->_dev_wakeup_lat_limit = new_wakeup_lat_limit; | ||
788 | |||
789 | if (od->_state != OMAP_DEVICE_STATE_IDLE) | ||
790 | return 0; | ||
791 | else if (new_wakeup_lat_limit > od->dev_wakeup_lat) | ||
792 | ret = _omap_device_deactivate(od, USE_WAKEUP_LAT); | ||
793 | else if (new_wakeup_lat_limit < od->dev_wakeup_lat) | ||
794 | ret = _omap_device_activate(od, USE_WAKEUP_LAT); | ||
795 | |||
796 | return ret; | ||
797 | } | ||
798 | |||
799 | /** | ||
800 | * omap_device_get_pwrdm - return the powerdomain * associated with @od | ||
801 | * @od: struct omap_device * | ||
802 | * | ||
803 | * Return the powerdomain associated with the first underlying | ||
804 | * omap_hwmod for this omap_device. Intended for use by core OMAP PM | ||
805 | * code. Returns NULL on error or a struct powerdomain * upon | ||
806 | * success. | ||
807 | */ | ||
808 | struct powerdomain *omap_device_get_pwrdm(struct omap_device *od) | ||
809 | { | ||
810 | /* | ||
811 | * XXX Assumes that all omap_hwmod powerdomains are identical. | ||
812 | * This may not necessarily be true. There should be a sanity | ||
813 | * check in here to WARN() if any difference appears. | ||
814 | */ | ||
815 | if (!od->hwmods_cnt) | ||
816 | return NULL; | ||
817 | |||
818 | return omap_hwmod_get_pwrdm(od->hwmods[0]); | ||
819 | } | ||
820 | |||
821 | /** | ||
822 | * omap_device_get_mpu_rt_va - return the MPU's virtual addr for the hwmod base | ||
823 | * @od: struct omap_device * | ||
824 | * | ||
825 | * Return the MPU's virtual address for the base of the hwmod, from | ||
826 | * the ioremap() that the hwmod code does. Only valid if there is one | ||
827 | * hwmod associated with this device. Returns NULL if there are zero | ||
828 | * or more than one hwmods associated with this omap_device; | ||
829 | * otherwise, passes along the return value from | ||
830 | * omap_hwmod_get_mpu_rt_va(). | ||
831 | */ | ||
832 | void __iomem *omap_device_get_rt_va(struct omap_device *od) | ||
833 | { | ||
834 | if (od->hwmods_cnt != 1) | ||
835 | return NULL; | ||
836 | |||
837 | return omap_hwmod_get_mpu_rt_va(od->hwmods[0]); | ||
838 | } | ||
839 | |||
840 | /* | ||
841 | * Public functions intended for use in omap_device_pm_latency | ||
842 | * .activate_func and .deactivate_func function pointers | ||
843 | */ | ||
844 | |||
845 | /** | ||
846 | * omap_device_enable_hwmods - call omap_hwmod_enable() on all hwmods | ||
847 | * @od: struct omap_device *od | ||
848 | * | ||
849 | * Enable all underlying hwmods. Returns 0. | ||
850 | */ | ||
851 | int omap_device_enable_hwmods(struct omap_device *od) | ||
852 | { | ||
853 | int i; | ||
854 | |||
855 | for (i = 0; i < od->hwmods_cnt; i++) | ||
856 | omap_hwmod_enable(od->hwmods[i]); | ||
857 | |||
858 | /* XXX pass along return value here? */ | ||
859 | return 0; | ||
860 | } | ||
861 | |||
862 | /** | ||
863 | * omap_device_idle_hwmods - call omap_hwmod_idle() on all hwmods | ||
864 | * @od: struct omap_device *od | ||
865 | * | ||
866 | * Idle all underlying hwmods. Returns 0. | ||
867 | */ | ||
868 | int omap_device_idle_hwmods(struct omap_device *od) | ||
869 | { | ||
870 | int i; | ||
871 | |||
872 | for (i = 0; i < od->hwmods_cnt; i++) | ||
873 | omap_hwmod_idle(od->hwmods[i]); | ||
874 | |||
875 | /* XXX pass along return value here? */ | ||
876 | return 0; | ||
877 | } | ||
878 | |||
879 | /** | ||
880 | * omap_device_disable_clocks - disable all main and interface clocks | ||
881 | * @od: struct omap_device *od | ||
882 | * | ||
883 | * Disable the main functional clock and interface clock for all of the | ||
884 | * omap_hwmods associated with the omap_device. Returns 0. | ||
885 | */ | ||
886 | int omap_device_disable_clocks(struct omap_device *od) | ||
887 | { | ||
888 | int i; | ||
889 | |||
890 | for (i = 0; i < od->hwmods_cnt; i++) | ||
891 | omap_hwmod_disable_clocks(od->hwmods[i]); | ||
892 | |||
893 | /* XXX pass along return value here? */ | ||
894 | return 0; | ||
895 | } | ||
896 | |||
897 | /** | ||
898 | * omap_device_enable_clocks - enable all main and interface clocks | ||
899 | * @od: struct omap_device *od | ||
900 | * | ||
901 | * Enable the main functional clock and interface clock for all of the | ||
902 | * omap_hwmods associated with the omap_device. Returns 0. | ||
903 | */ | ||
904 | int omap_device_enable_clocks(struct omap_device *od) | ||
905 | { | ||
906 | int i; | ||
907 | |||
908 | for (i = 0; i < od->hwmods_cnt; i++) | ||
909 | omap_hwmod_enable_clocks(od->hwmods[i]); | ||
910 | |||
911 | /* XXX pass along return value here? */ | ||
912 | return 0; | ||
913 | } | ||
914 | |||
915 | struct device omap_device_parent = { | ||
916 | .init_name = "omap", | ||
917 | .parent = &platform_bus, | ||
918 | }; | ||
919 | |||
920 | static int __init omap_device_init(void) | ||
921 | { | ||
922 | return device_register(&omap_device_parent); | ||
923 | } | ||
924 | core_initcall(omap_device_init); | ||
diff --git a/arch/arm/plat-omap/sram.h b/arch/arm/plat-omap/sram.h new file mode 100644 index 00000000000..29b43ef97f2 --- /dev/null +++ b/arch/arm/plat-omap/sram.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __PLAT_OMAP_SRAM_H__ | ||
2 | #define __PLAT_OMAP_SRAM_H__ | ||
3 | |||
4 | extern int __init omap_sram_init(void); | ||
5 | |||
6 | #endif /* __PLAT_OMAP_SRAM_H__ */ | ||
diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c new file mode 100644 index 00000000000..f3570884883 --- /dev/null +++ b/arch/arm/plat-omap/usb.c | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-omap/usb.c -- platform level USB initialization | ||
3 | * | ||
4 | * Copyright (C) 2004 Texas Instruments, Inc. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #undef DEBUG | ||
22 | |||
23 | #include <linux/module.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/io.h> | ||
28 | |||
29 | #include <plat/usb.h> | ||
30 | #include <plat/board.h> | ||
31 | |||
32 | #ifdef CONFIG_ARCH_OMAP_OTG | ||
33 | |||
34 | void __init | ||
35 | omap_otg_init(struct omap_usb_config *config) | ||
36 | { | ||
37 | u32 syscon; | ||
38 | int status; | ||
39 | int alt_pingroup = 0; | ||
40 | |||
41 | /* NOTE: no bus or clock setup (yet?) */ | ||
42 | |||
43 | syscon = omap_readl(OTG_SYSCON_1) & 0xffff; | ||
44 | if (!(syscon & OTG_RESET_DONE)) | ||
45 | pr_debug("USB resets not complete?\n"); | ||
46 | |||
47 | //omap_writew(0, OTG_IRQ_EN); | ||
48 | |||
49 | /* pin muxing and transceiver pinouts */ | ||
50 | if (config->pins[0] > 2) /* alt pingroup 2 */ | ||
51 | alt_pingroup = 1; | ||
52 | syscon |= config->usb0_init(config->pins[0], is_usb0_device(config)); | ||
53 | syscon |= config->usb1_init(config->pins[1]); | ||
54 | syscon |= config->usb2_init(config->pins[2], alt_pingroup); | ||
55 | pr_debug("OTG_SYSCON_1 = %08x\n", omap_readl(OTG_SYSCON_1)); | ||
56 | omap_writel(syscon, OTG_SYSCON_1); | ||
57 | |||
58 | syscon = config->hmc_mode; | ||
59 | syscon |= USBX_SYNCHRO | (4 << 16) /* B_ASE0_BRST */; | ||
60 | #ifdef CONFIG_USB_OTG | ||
61 | if (config->otg) | ||
62 | syscon |= OTG_EN; | ||
63 | #endif | ||
64 | if (cpu_class_is_omap1()) | ||
65 | pr_debug("USB_TRANSCEIVER_CTRL = %03x\n", | ||
66 | omap_readl(USB_TRANSCEIVER_CTRL)); | ||
67 | pr_debug("OTG_SYSCON_2 = %08x\n", omap_readl(OTG_SYSCON_2)); | ||
68 | omap_writel(syscon, OTG_SYSCON_2); | ||
69 | |||
70 | printk("USB: hmc %d", config->hmc_mode); | ||
71 | if (!alt_pingroup) | ||
72 | printk(", usb2 alt %d wires", config->pins[2]); | ||
73 | else if (config->pins[0]) | ||
74 | printk(", usb0 %d wires%s", config->pins[0], | ||
75 | is_usb0_device(config) ? " (dev)" : ""); | ||
76 | if (config->pins[1]) | ||
77 | printk(", usb1 %d wires", config->pins[1]); | ||
78 | if (!alt_pingroup && config->pins[2]) | ||
79 | printk(", usb2 %d wires", config->pins[2]); | ||
80 | if (config->otg) | ||
81 | printk(", Mini-AB on usb%d", config->otg - 1); | ||
82 | printk("\n"); | ||
83 | |||
84 | if (cpu_class_is_omap1()) { | ||
85 | u16 w; | ||
86 | |||
87 | /* leave USB clocks/controllers off until needed */ | ||
88 | w = omap_readw(ULPD_SOFT_REQ); | ||
89 | w &= ~SOFT_USB_CLK_REQ; | ||
90 | omap_writew(w, ULPD_SOFT_REQ); | ||
91 | |||
92 | w = omap_readw(ULPD_CLOCK_CTRL); | ||
93 | w &= ~USB_MCLK_EN; | ||
94 | w |= DIS_USB_PVCI_CLK; | ||
95 | omap_writew(w, ULPD_CLOCK_CTRL); | ||
96 | } | ||
97 | syscon = omap_readl(OTG_SYSCON_1); | ||
98 | syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN; | ||
99 | |||
100 | #ifdef CONFIG_USB_GADGET_OMAP | ||
101 | if (config->otg || config->register_dev) { | ||
102 | struct platform_device *udc_device = config->udc_device; | ||
103 | |||
104 | syscon &= ~DEV_IDLE_EN; | ||
105 | udc_device->dev.platform_data = config; | ||
106 | status = platform_device_register(udc_device); | ||
107 | if (status) | ||
108 | pr_debug("can't register UDC device, %d\n", status); | ||
109 | } | ||
110 | #endif | ||
111 | |||
112 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
113 | if (config->otg || config->register_host) { | ||
114 | struct platform_device *ohci_device = config->ohci_device; | ||
115 | |||
116 | syscon &= ~HST_IDLE_EN; | ||
117 | ohci_device->dev.platform_data = config; | ||
118 | status = platform_device_register(ohci_device); | ||
119 | if (status) | ||
120 | pr_debug("can't register OHCI device, %d\n", status); | ||
121 | } | ||
122 | #endif | ||
123 | |||
124 | #ifdef CONFIG_USB_OTG | ||
125 | if (config->otg) { | ||
126 | struct platform_device *otg_device = config->otg_device; | ||
127 | |||
128 | syscon &= ~OTG_IDLE_EN; | ||
129 | otg_device->dev.platform_data = config; | ||
130 | status = platform_device_register(otg_device); | ||
131 | if (status) | ||
132 | pr_debug("can't register OTG device, %d\n", status); | ||
133 | } | ||
134 | #endif | ||
135 | pr_debug("OTG_SYSCON_1 = %08x\n", omap_readl(OTG_SYSCON_1)); | ||
136 | omap_writel(syscon, OTG_SYSCON_1); | ||
137 | |||
138 | status = 0; | ||
139 | } | ||
140 | |||
141 | #else | ||
142 | void omap_otg_init(struct omap_usb_config *config) {} | ||
143 | #endif | ||