blob: 371e5409fef061d97cc05436640aca84b937fc20 [file] [log] [blame]
Tony Lindgren1dbae812005-11-10 14:26:51 +00001/*
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>
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -08008 * Updated map desc to add 2430 support : <x0khasim@ti.com>
Tony Lindgren1dbae812005-11-10 14:26:51 +00009 *
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
Tony Lindgren1dbae812005-11-10 14:26:51 +000015#include <linux/module.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18
Tony Lindgren120db2c2006-04-02 17:46:27 +010019#include <asm/tlb.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000020#include <asm/io.h>
Tony Lindgren120db2c2006-04-02 17:46:27 +010021
22#include <asm/mach/map.h>
23
Russell Kinga09e64f2008-08-05 16:14:15 +010024#include <mach/mux.h>
25#include <mach/omapfb.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000026
Paul Walmsley97171002008-08-19 11:08:40 +030027#include <mach/powerdomain.h>
28
29#include "powerdomains.h"
30
Paul Walmsley801954d2008-08-19 11:08:44 +030031#include <mach/clockdomain.h>
32#include "clockdomains.h"
33
Tony Lindgren1dbae812005-11-10 14:26:51 +000034extern void omap_sram_init(void);
35extern int omap2_clk_init(void);
36extern void omap2_check_revision(void);
Juha Yrjola33c99072006-12-06 17:13:46 -080037extern void omap2_init_memory(void);
Juha Yrjola4bbbc1a2006-06-26 16:16:16 -070038extern void gpmc_init(void);
Imre Deakb7cc6d42007-03-06 03:16:36 -080039extern void omapfb_reserve_sdram(void);
Tony Lindgren1dbae812005-11-10 14:26:51 +000040
41/*
42 * The machine specific code may provide the extra mapping besides the
43 * default mapping provided here.
44 */
45static struct map_desc omap2_io_desc[] __initdata = {
46 {
47 .virtual = L3_24XX_VIRT,
48 .pfn = __phys_to_pfn(L3_24XX_PHYS),
49 .length = L3_24XX_SIZE,
50 .type = MT_DEVICE
51 },
Kyungmin Park09f21ed2008-02-20 15:30:06 -080052 {
53 .virtual = L4_24XX_VIRT,
54 .pfn = __phys_to_pfn(L4_24XX_PHYS),
55 .length = L4_24XX_SIZE,
56 .type = MT_DEVICE
57 },
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -080058#ifdef CONFIG_ARCH_OMAP2430
59 {
60 .virtual = L4_WK_243X_VIRT,
61 .pfn = __phys_to_pfn(L4_WK_243X_PHYS),
62 .length = L4_WK_243X_SIZE,
63 .type = MT_DEVICE
64 },
65 {
66 .virtual = OMAP243X_GPMC_VIRT,
67 .pfn = __phys_to_pfn(OMAP243X_GPMC_PHYS),
68 .length = OMAP243X_GPMC_SIZE,
69 .type = MT_DEVICE
70 },
71#endif
Tony Lindgren1dbae812005-11-10 14:26:51 +000072 {
Tony Lindgrenc40fae952006-12-07 13:58:10 -080073 .virtual = DSP_MEM_24XX_VIRT,
74 .pfn = __phys_to_pfn(DSP_MEM_24XX_PHYS),
75 .length = DSP_MEM_24XX_SIZE,
76 .type = MT_DEVICE
77 },
78 {
79 .virtual = DSP_IPI_24XX_VIRT,
80 .pfn = __phys_to_pfn(DSP_IPI_24XX_PHYS),
81 .length = DSP_IPI_24XX_SIZE,
82 .type = MT_DEVICE
83 },
84 {
85 .virtual = DSP_MMU_24XX_VIRT,
86 .pfn = __phys_to_pfn(DSP_MMU_24XX_PHYS),
87 .length = DSP_MMU_24XX_SIZE,
Tony Lindgren1dbae812005-11-10 14:26:51 +000088 .type = MT_DEVICE
89 }
90};
91
Tony Lindgren120db2c2006-04-02 17:46:27 +010092void __init omap2_map_common_io(void)
Tony Lindgren1dbae812005-11-10 14:26:51 +000093{
94 iotable_init(omap2_io_desc, ARRAY_SIZE(omap2_io_desc));
Tony Lindgren120db2c2006-04-02 17:46:27 +010095
96 /* Normally devicemaps_init() would flush caches and tlb after
97 * mdesc->map_io(), but we must also do it here because of the CPU
98 * revision check below.
99 */
100 local_flush_tlb_all();
101 flush_cache_all();
102
Tony Lindgren1dbae812005-11-10 14:26:51 +0000103 omap2_check_revision();
104 omap_sram_init();
Imre Deakb7cc6d42007-03-06 03:16:36 -0800105 omapfb_reserve_sdram();
Tony Lindgren120db2c2006-04-02 17:46:27 +0100106}
107
108void __init omap2_init_common_hw(void)
109{
Tony Lindgren1dbae812005-11-10 14:26:51 +0000110 omap2_mux_init();
Paul Walmsley97171002008-08-19 11:08:40 +0300111 pwrdm_init(powerdomains_omap);
Paul Walmsley801954d2008-08-19 11:08:44 +0300112 clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
Tony Lindgren1dbae812005-11-10 14:26:51 +0000113 omap2_clk_init();
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -0800114/*
115 * Need to Fix this for 2430
116 */
117#ifndef CONFIG_ARCH_OMAP2430
Juha Yrjola33c99072006-12-06 17:13:46 -0800118 omap2_init_memory();
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -0800119#endif
Juha Yrjola4bbbc1a2006-06-26 16:16:16 -0700120 gpmc_init();
Tony Lindgren1dbae812005-11-10 14:26:51 +0000121}