blob: 03c6ab1a3b1f5d39f757546230f73e421763bc9f [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
Tony Lindgren646e3ed2008-10-06 15:49:36 +03007 * Copyright (C) 2007 Texas Instruments
8 *
9 * Author:
10 * Juha Yrjola <juha.yrjola@nokia.com>
11 * Syed Khasim <x0khasim@ti.com>
Tony Lindgren1dbae812005-11-10 14:26:51 +000012 *
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
Tony Lindgren1dbae812005-11-10 14:26:51 +000018#include <linux/module.h>
19#include <linux/kernel.h>
20#include <linux/init.h>
21
Tony Lindgren120db2c2006-04-02 17:46:27 +010022#include <asm/tlb.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000023#include <asm/io.h>
Tony Lindgren120db2c2006-04-02 17:46:27 +010024
25#include <asm/mach/map.h>
26
Russell Kinga09e64f2008-08-05 16:14:15 +010027#include <mach/mux.h>
28#include <mach/omapfb.h>
Tony Lindgren646e3ed2008-10-06 15:49:36 +030029#include <mach/sram.h>
30
31#include "memory.h"
32
33#include "clock.h"
Tony Lindgren1dbae812005-11-10 14:26:51 +000034
Paul Walmsley97171002008-08-19 11:08:40 +030035#include <mach/powerdomain.h>
36
37#include "powerdomains.h"
38
Paul Walmsley801954d2008-08-19 11:08:44 +030039#include <mach/clockdomain.h>
40#include "clockdomains.h"
41
Tony Lindgren1dbae812005-11-10 14:26:51 +000042/*
43 * The machine specific code may provide the extra mapping besides the
44 * default mapping provided here.
45 */
46static 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 },
Kyungmin Park09f21ed2008-02-20 15:30:06 -080053 {
54 .virtual = L4_24XX_VIRT,
55 .pfn = __phys_to_pfn(L4_24XX_PHYS),
56 .length = L4_24XX_SIZE,
57 .type = MT_DEVICE
58 },
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -080059#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
Tony Lindgren1dbae812005-11-10 14:26:51 +000073 {
Tony Lindgrenc40fae952006-12-07 13:58:10 -080074 .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,
Tony Lindgren1dbae812005-11-10 14:26:51 +000089 .type = MT_DEVICE
90 }
91};
92
Tony Lindgren120db2c2006-04-02 17:46:27 +010093void __init omap2_map_common_io(void)
Tony Lindgren1dbae812005-11-10 14:26:51 +000094{
95 iotable_init(omap2_io_desc, ARRAY_SIZE(omap2_io_desc));
Tony Lindgren120db2c2006-04-02 17:46:27 +010096
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
Tony Lindgren1dbae812005-11-10 14:26:51 +0000104 omap2_check_revision();
105 omap_sram_init();
Imre Deakb7cc6d42007-03-06 03:16:36 -0800106 omapfb_reserve_sdram();
Tony Lindgren120db2c2006-04-02 17:46:27 +0100107}
108
109void __init omap2_init_common_hw(void)
110{
Tony Lindgren1dbae812005-11-10 14:26:51 +0000111 omap2_mux_init();
Paul Walmsley97171002008-08-19 11:08:40 +0300112 pwrdm_init(powerdomains_omap);
Paul Walmsley801954d2008-08-19 11:08:44 +0300113 clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
Tony Lindgren1dbae812005-11-10 14:26:51 +0000114 omap2_clk_init();
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -0800115/*
116 * Need to Fix this for 2430
117 */
118#ifndef CONFIG_ARCH_OMAP2430
Juha Yrjola33c99072006-12-06 17:13:46 -0800119 omap2_init_memory();
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -0800120#endif
Juha Yrjola4bbbc1a2006-06-26 16:16:16 -0700121 gpmc_init();
Tony Lindgren1dbae812005-11-10 14:26:51 +0000122}