xref: /linux/arch/arm/mach-omap2/io.c (revision 646e3ed1a349fbccce651fed2d3987f0e7b0f0f4)
1 /*
2  * linux/arch/arm/mach-omap2/io.c
3  *
4  * OMAP2 I/O mapping code
5  *
6  * Copyright (C) 2005 Nokia Corporation
7  * Copyright (C) 2007 Texas Instruments
8  *
9  * Author:
10  *	Juha Yrjola <juha.yrjola@nokia.com>
11  *	Syed Khasim <x0khasim@ti.com>
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License version 2 as
15  * published by the Free Software Foundation.
16  */
17 
18 #include <linux/module.h>
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21 
22 #include <asm/tlb.h>
23 #include <asm/io.h>
24 
25 #include <asm/mach/map.h>
26 
27 #include <mach/mux.h>
28 #include <mach/omapfb.h>
29 #include <mach/sram.h>
30 
31 #include "memory.h"
32 
33 #include "clock.h"
34 
35 #include <mach/powerdomain.h>
36 
37 #include "powerdomains.h"
38 
39 #include <mach/clockdomain.h>
40 #include "clockdomains.h"
41 
42 /*
43  * The machine specific code may provide the extra mapping besides the
44  * default mapping provided here.
45  */
46 static struct map_desc omap2_io_desc[] __initdata = {
47 	{
48 		.virtual	= L3_24XX_VIRT,
49 		.pfn		= __phys_to_pfn(L3_24XX_PHYS),
50 		.length		= L3_24XX_SIZE,
51 		.type		= MT_DEVICE
52 	},
53 	{
54 		.virtual        = L4_24XX_VIRT,
55 		.pfn            = __phys_to_pfn(L4_24XX_PHYS),
56 		.length         = L4_24XX_SIZE,
57 		.type           = MT_DEVICE
58 	},
59 #ifdef CONFIG_ARCH_OMAP2430
60 	{
61 		.virtual	= L4_WK_243X_VIRT,
62 		.pfn		= __phys_to_pfn(L4_WK_243X_PHYS),
63 		.length		= L4_WK_243X_SIZE,
64 		.type		= MT_DEVICE
65 	},
66 	{
67 		.virtual	= OMAP243X_GPMC_VIRT,
68 		.pfn		= __phys_to_pfn(OMAP243X_GPMC_PHYS),
69 		.length		= OMAP243X_GPMC_SIZE,
70 		.type		= MT_DEVICE
71 	},
72 #endif
73 	{
74 		.virtual	= DSP_MEM_24XX_VIRT,
75 		.pfn		= __phys_to_pfn(DSP_MEM_24XX_PHYS),
76 		.length		= DSP_MEM_24XX_SIZE,
77 		.type		= MT_DEVICE
78 	},
79 	{
80 		.virtual	= DSP_IPI_24XX_VIRT,
81 		.pfn		= __phys_to_pfn(DSP_IPI_24XX_PHYS),
82 		.length		= DSP_IPI_24XX_SIZE,
83 		.type		= MT_DEVICE
84 	},
85 	{
86 		.virtual	= DSP_MMU_24XX_VIRT,
87 		.pfn		= __phys_to_pfn(DSP_MMU_24XX_PHYS),
88 		.length		= DSP_MMU_24XX_SIZE,
89 		.type		= MT_DEVICE
90 	}
91 };
92 
93 void __init omap2_map_common_io(void)
94 {
95 	iotable_init(omap2_io_desc, ARRAY_SIZE(omap2_io_desc));
96 
97 	/* Normally devicemaps_init() would flush caches and tlb after
98 	 * mdesc->map_io(), but we must also do it here because of the CPU
99 	 * revision check below.
100 	 */
101 	local_flush_tlb_all();
102 	flush_cache_all();
103 
104 	omap2_check_revision();
105 	omap_sram_init();
106 	omapfb_reserve_sdram();
107 }
108 
109 void __init omap2_init_common_hw(void)
110 {
111 	omap2_mux_init();
112 	pwrdm_init(powerdomains_omap);
113 	clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
114 	omap2_clk_init();
115 /*
116  * Need to Fix this for 2430
117  */
118 #ifndef CONFIG_ARCH_OMAP2430
119 	omap2_init_memory();
120 #endif
121 	gpmc_init();
122 }
123