blob: a7a19f75b9e1ad119434cb001c96d5c4a79b28f2 [file] [log] [blame]
Tony Lindgrenf577ffd2005-07-10 19:58:12 +01001/*
2 * linux/arch/arm/mach-omap1/io.c
3 *
4 * OMAP1 I/O mapping code
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 <linux/config.h>
12#include <linux/module.h>
13#include <linux/kernel.h>
14#include <linux/init.h>
15
16#include <asm/mach/map.h>
17#include <asm/io.h>
Tony Lindgren3179a012005-11-10 14:26:48 +000018#include <asm/arch/mux.h>
Tony Lindgrenf577ffd2005-07-10 19:58:12 +010019#include <asm/arch/tc.h>
20
Tony Lindgren3179a012005-11-10 14:26:48 +000021extern int omap1_clk_init(void);
Tony Lindgrenf577ffd2005-07-10 19:58:12 +010022extern void omap_check_revision(void);
Tony Lindgren7c38cf02005-09-08 23:07:38 +010023extern void omap_sram_init(void);
Tony Lindgrenf577ffd2005-07-10 19:58:12 +010024
25/*
26 * The machine specific code may provide the extra mapping besides the
27 * default mapping provided here.
28 */
29static struct map_desc omap_io_desc[] __initdata = {
Deepak Saxena9fe133b2005-10-28 15:19:00 +010030 {
31 .virtual = IO_VIRT,
32 .pfn = __phys_to_pfn(IO_PHYS),
33 .length = IO_SIZE,
34 .type = MT_DEVICE
35 }
Tony Lindgrenf577ffd2005-07-10 19:58:12 +010036};
37
38#ifdef CONFIG_ARCH_OMAP730
39static struct map_desc omap730_io_desc[] __initdata = {
Deepak Saxena9fe133b2005-10-28 15:19:00 +010040 {
41 .virtual = OMAP730_DSP_BASE,
42 .pfn = __phys_to_pfn(OMAP730_DSP_START),
43 .length = OMAP730_DSP_SIZE,
44 .type = MT_DEVICE
45 }, {
46 .virtual = OMAP730_DSPREG_BASE,
47 .pfn = __phys_to_pfn(OMAP730_DSPREG_START),
48 .length = OMAP730_DSPREG_SIZE,
49 .type = MT_DEVICE
50 }
Tony Lindgrenf577ffd2005-07-10 19:58:12 +010051};
52#endif
53
Tony Lindgren3179a012005-11-10 14:26:48 +000054#ifdef CONFIG_ARCH_OMAP15XX
Tony Lindgrenf577ffd2005-07-10 19:58:12 +010055static struct map_desc omap1510_io_desc[] __initdata = {
Deepak Saxena9fe133b2005-10-28 15:19:00 +010056 {
57 .virtual = OMAP1510_DSP_BASE,
58 .pfn = __phys_to_pfn(OMAP1510_DSP_START),
59 .length = OMAP1510_DSP_SIZE,
60 .type = MT_DEVICE
61 }, {
62 .virtual = OMAP1510_DSPREG_BASE,
63 .pfn = __phys_to_pfn(OMAP1510_DSPREG_START),
64 .length = OMAP1510_DSPREG_SIZE,
65 .type = MT_DEVICE
66 }
Tony Lindgrenf577ffd2005-07-10 19:58:12 +010067};
68#endif
69
70#if defined(CONFIG_ARCH_OMAP16XX)
Tony Lindgren7c38cf02005-09-08 23:07:38 +010071static struct map_desc omap16xx_io_desc[] __initdata = {
Deepak Saxena9fe133b2005-10-28 15:19:00 +010072 {
73 .virtual = OMAP16XX_DSP_BASE,
74 .pfn = __phys_to_pfn(OMAP16XX_DSP_START),
75 .length = OMAP16XX_DSP_SIZE,
76 .type = MT_DEVICE
77 }, {
78 .virtual = OMAP16XX_DSPREG_BASE,
79 .pfn = __phys_to_pfn(OMAP16XX_DSPREG_START),
80 .length = OMAP16XX_DSPREG_SIZE,
81 .type = MT_DEVICE
82 }
Tony Lindgrenf577ffd2005-07-10 19:58:12 +010083};
84#endif
85
86static int initialized = 0;
87
88static void __init _omap_map_io(void)
89{
90 initialized = 1;
91
92 /* We have to initialize the IO space mapping before we can run
93 * cpu_is_omapxxx() macros. */
94 iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
95 omap_check_revision();
96
97#ifdef CONFIG_ARCH_OMAP730
98 if (cpu_is_omap730()) {
99 iotable_init(omap730_io_desc, ARRAY_SIZE(omap730_io_desc));
100 }
101#endif
Tony Lindgren3179a012005-11-10 14:26:48 +0000102#ifdef CONFIG_ARCH_OMAP15XX
Tony Lindgrenf577ffd2005-07-10 19:58:12 +0100103 if (cpu_is_omap1510()) {
104 iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
105 }
106#endif
107#if defined(CONFIG_ARCH_OMAP16XX)
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100108 if (cpu_is_omap16xx()) {
109 iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
Tony Lindgrenf577ffd2005-07-10 19:58:12 +0100110 }
111#endif
112
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100113 omap_sram_init();
114
Tony Lindgrenf577ffd2005-07-10 19:58:12 +0100115 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
116 * on a Posted Write in the TIPB Bridge".
117 */
118 omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL);
119 omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL);
120
121 /* Must init clocks early to assure that timer interrupt works
122 */
Tony Lindgren3179a012005-11-10 14:26:48 +0000123 omap1_clk_init();
Tony Lindgrenf577ffd2005-07-10 19:58:12 +0100124}
125
126/*
127 * This should only get called from board specific init
128 */
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100129void __init omap_map_common_io(void)
Tony Lindgrenf577ffd2005-07-10 19:58:12 +0100130{
Tony Lindgren3179a012005-11-10 14:26:48 +0000131 if (!initialized) {
Tony Lindgrenf577ffd2005-07-10 19:58:12 +0100132 _omap_map_io();
Tony Lindgren3179a012005-11-10 14:26:48 +0000133 omap1_mux_init();
134 }
Tony Lindgrenf577ffd2005-07-10 19:58:12 +0100135}
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100136