Merge master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild
[linux-2.6] / arch / arm / mach-omap1 / io.c
1 /*
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>
18 #include <asm/arch/mux.h>
19 #include <asm/arch/tc.h>
20
21 extern int omap1_clk_init(void);
22 extern void omap_check_revision(void);
23 extern void omap_sram_init(void);
24
25 /*
26  * The machine specific code may provide the extra mapping besides the
27  * default mapping provided here.
28  */
29 static struct map_desc omap_io_desc[] __initdata = {
30         {
31                 .virtual        = IO_VIRT,
32                 .pfn            = __phys_to_pfn(IO_PHYS),
33                 .length         = IO_SIZE,
34                 .type           = MT_DEVICE
35         }
36 };
37
38 #ifdef CONFIG_ARCH_OMAP730
39 static struct map_desc omap730_io_desc[] __initdata = {
40         {
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         }
51 };
52 #endif
53
54 #ifdef CONFIG_ARCH_OMAP15XX
55 static struct map_desc omap1510_io_desc[] __initdata = {
56         {
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         }
67 };
68 #endif
69
70 #if defined(CONFIG_ARCH_OMAP16XX)
71 static struct map_desc omap16xx_io_desc[] __initdata = {
72         {
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         }
83 };
84 #endif
85
86 static int initialized = 0;
87
88 static 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
102 #ifdef CONFIG_ARCH_OMAP15XX
103         if (cpu_is_omap1510()) {
104                 iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
105         }
106 #endif
107 #if defined(CONFIG_ARCH_OMAP16XX)
108         if (cpu_is_omap16xx()) {
109                 iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
110         }
111 #endif
112
113         omap_sram_init();
114
115         /* 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          */
123         omap1_clk_init();
124 }
125
126 /*
127  * This should only get called from board specific init
128  */
129 void __init omap_map_common_io(void)
130 {
131         if (!initialized) {
132                 _omap_map_io();
133                 omap1_mux_init();
134         }
135 }
136