ARM: OMAP2: Powerdomain: Add OMAP2/3 common powerdomains
[safe/jmp/linux-2.6] / arch / arm / mach-omap2 / io.c
1 /*
2  * linux/arch/arm/mach-omap2/io.c
3  *
4  * OMAP2 I/O mapping code
5  *
6  * Copyright (C) 2005 Nokia Corporation
7  * Author: Juha Yrjölä <juha.yrjola@nokia.com>
8  * Updated map desc to add 2430 support : <x0khasim@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
15 #include <linux/module.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18
19 #include <asm/tlb.h>
20 #include <asm/io.h>
21
22 #include <asm/mach/map.h>
23
24 #include <mach/mux.h>
25 #include <mach/omapfb.h>
26
27 #include <mach/powerdomain.h>
28
29 #include "powerdomains.h"
30
31 extern void omap_sram_init(void);
32 extern int omap2_clk_init(void);
33 extern void omap2_check_revision(void);
34 extern void omap2_init_memory(void);
35 extern void gpmc_init(void);
36 extern void omapfb_reserve_sdram(void);
37
38 /*
39  * The machine specific code may provide the extra mapping besides the
40  * default mapping provided here.
41  */
42 static struct map_desc omap2_io_desc[] __initdata = {
43         {
44                 .virtual        = L3_24XX_VIRT,
45                 .pfn            = __phys_to_pfn(L3_24XX_PHYS),
46                 .length         = L3_24XX_SIZE,
47                 .type           = MT_DEVICE
48         },
49         {
50                 .virtual        = L4_24XX_VIRT,
51                 .pfn            = __phys_to_pfn(L4_24XX_PHYS),
52                 .length         = L4_24XX_SIZE,
53                 .type           = MT_DEVICE
54         },
55 #ifdef CONFIG_ARCH_OMAP2430
56         {
57                 .virtual        = L4_WK_243X_VIRT,
58                 .pfn            = __phys_to_pfn(L4_WK_243X_PHYS),
59                 .length         = L4_WK_243X_SIZE,
60                 .type           = MT_DEVICE
61         },
62         {
63                 .virtual        = OMAP243X_GPMC_VIRT,
64                 .pfn            = __phys_to_pfn(OMAP243X_GPMC_PHYS),
65                 .length         = OMAP243X_GPMC_SIZE,
66                 .type           = MT_DEVICE
67         },
68 #endif
69         {
70                 .virtual        = DSP_MEM_24XX_VIRT,
71                 .pfn            = __phys_to_pfn(DSP_MEM_24XX_PHYS),
72                 .length         = DSP_MEM_24XX_SIZE,
73                 .type           = MT_DEVICE
74         },
75         {
76                 .virtual        = DSP_IPI_24XX_VIRT,
77                 .pfn            = __phys_to_pfn(DSP_IPI_24XX_PHYS),
78                 .length         = DSP_IPI_24XX_SIZE,
79                 .type           = MT_DEVICE
80         },
81         {
82                 .virtual        = DSP_MMU_24XX_VIRT,
83                 .pfn            = __phys_to_pfn(DSP_MMU_24XX_PHYS),
84                 .length         = DSP_MMU_24XX_SIZE,
85                 .type           = MT_DEVICE
86         }
87 };
88
89 void __init omap2_map_common_io(void)
90 {
91         iotable_init(omap2_io_desc, ARRAY_SIZE(omap2_io_desc));
92
93         /* Normally devicemaps_init() would flush caches and tlb after
94          * mdesc->map_io(), but we must also do it here because of the CPU
95          * revision check below.
96          */
97         local_flush_tlb_all();
98         flush_cache_all();
99
100         omap2_check_revision();
101         omap_sram_init();
102         omapfb_reserve_sdram();
103 }
104
105 void __init omap2_init_common_hw(void)
106 {
107         omap2_mux_init();
108         pwrdm_init(powerdomains_omap);
109         omap2_clk_init();
110 /*
111  * Need to Fix this for 2430
112  */
113 #ifndef CONFIG_ARCH_OMAP2430
114         omap2_init_memory();
115 #endif
116         gpmc_init();
117 }