blob: 79fb86535ebcb122baca48d47ee14a867c1706ae [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>
18#include <asm/arch/tc.h>
19
Tony Lindgrenbb13b5f2005-07-10 19:58:18 +010020extern int clk_init(void);
Tony Lindgrenf577ffd2005-07-10 19:58:12 +010021extern void omap_check_revision(void);
Tony Lindgren7c38cf02005-09-08 23:07:38 +010022extern void omap_sram_init(void);
Tony Lindgrenf577ffd2005-07-10 19:58:12 +010023
24/*
25 * The machine specific code may provide the extra mapping besides the
26 * default mapping provided here.
27 */
28static struct map_desc omap_io_desc[] __initdata = {
Deepak Saxena9fe133b2005-10-28 15:19:00 +010029 {
30 .virtual = IO_VIRT,
31 .pfn = __phys_to_pfn(IO_PHYS),
32 .length = IO_SIZE,
33 .type = MT_DEVICE
34 }
Tony Lindgrenf577ffd2005-07-10 19:58:12 +010035};
36
37#ifdef CONFIG_ARCH_OMAP730
38static struct map_desc omap730_io_desc[] __initdata = {
Deepak Saxena9fe133b2005-10-28 15:19:00 +010039 {
40 .virtual = OMAP730_DSP_BASE,
41 .pfn = __phys_to_pfn(OMAP730_DSP_START),
42 .length = OMAP730_DSP_SIZE,
43 .type = MT_DEVICE
44 }, {
45 .virtual = OMAP730_DSPREG_BASE,
46 .pfn = __phys_to_pfn(OMAP730_DSPREG_START),
47 .length = OMAP730_DSPREG_SIZE,
48 .type = MT_DEVICE
49 }
Tony Lindgrenf577ffd2005-07-10 19:58:12 +010050};
51#endif
52
53#ifdef CONFIG_ARCH_OMAP1510
54static struct map_desc omap1510_io_desc[] __initdata = {
Deepak Saxena9fe133b2005-10-28 15:19:00 +010055 {
56 .virtual = OMAP1510_DSP_BASE,
57 .pfn = __phys_to_pfn(OMAP1510_DSP_START),
58 .length = OMAP1510_DSP_SIZE,
59 .type = MT_DEVICE
60 }, {
61 .virtual = OMAP1510_DSPREG_BASE,
62 .pfn = __phys_to_pfn(OMAP1510_DSPREG_START),
63 .length = OMAP1510_DSPREG_SIZE,
64 .type = MT_DEVICE
65 }
Tony Lindgrenf577ffd2005-07-10 19:58:12 +010066};
67#endif
68
69#if defined(CONFIG_ARCH_OMAP16XX)
Tony Lindgren7c38cf02005-09-08 23:07:38 +010070static struct map_desc omap16xx_io_desc[] __initdata = {
Deepak Saxena9fe133b2005-10-28 15:19:00 +010071 {
72 .virtual = OMAP16XX_DSP_BASE,
73 .pfn = __phys_to_pfn(OMAP16XX_DSP_START),
74 .length = OMAP16XX_DSP_SIZE,
75 .type = MT_DEVICE
76 }, {
77 .virtual = OMAP16XX_DSPREG_BASE,
78 .pfn = __phys_to_pfn(OMAP16XX_DSPREG_START),
79 .length = OMAP16XX_DSPREG_SIZE,
80 .type = MT_DEVICE
81 }
Tony Lindgrenf577ffd2005-07-10 19:58:12 +010082};
83#endif
84
85static int initialized = 0;
86
87static void __init _omap_map_io(void)
88{
89 initialized = 1;
90
91 /* We have to initialize the IO space mapping before we can run
92 * cpu_is_omapxxx() macros. */
93 iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
94 omap_check_revision();
95
96#ifdef CONFIG_ARCH_OMAP730
97 if (cpu_is_omap730()) {
98 iotable_init(omap730_io_desc, ARRAY_SIZE(omap730_io_desc));
99 }
100#endif
101#ifdef CONFIG_ARCH_OMAP1510
102 if (cpu_is_omap1510()) {
103 iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
104 }
105#endif
106#if defined(CONFIG_ARCH_OMAP16XX)
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100107 if (cpu_is_omap16xx()) {
108 iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
Tony Lindgrenf577ffd2005-07-10 19:58:12 +0100109 }
110#endif
111
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100112 omap_sram_init();
113
Tony Lindgrenf577ffd2005-07-10 19:58:12 +0100114 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
115 * on a Posted Write in the TIPB Bridge".
116 */
117 omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL);
118 omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL);
119
120 /* Must init clocks early to assure that timer interrupt works
121 */
122 clk_init();
123}
124
125/*
126 * This should only get called from board specific init
127 */
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100128void __init omap_map_common_io(void)
Tony Lindgrenf577ffd2005-07-10 19:58:12 +0100129{
130 if (!initialized)
131 _omap_map_io();
132}
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100133