blob: 8ba8fb5b2514cdb09343f98ea45676aff0b8fab8 [file] [log] [blame]
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -07001/*
2 * Board support file for OMAP4430 SDP.
3 *
4 * Copyright (C) 2009 Texas Instruments
5 *
6 * Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
7 *
8 * Based on mach-omap2/board-3430sdp.c
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/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/io.h>
19#include <linux/gpio.h>
20
21#include <mach/hardware.h>
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25
Tony Lindgrence491cf2009-10-20 09:40:47 -070026#include <plat/board.h>
27#include <plat/common.h>
28#include <plat/control.h>
29#include <plat/timer-gp.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070030#include <asm/hardware/gic.h>
Santosh Shilimkard3094272010-02-04 19:37:09 +010031#include <asm/hardware/cache-l2x0.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070032
33static struct platform_device sdp4430_lcd_device = {
34 .name = "sdp4430_lcd",
35 .id = -1,
36};
37
38static struct platform_device *sdp4430_devices[] __initdata = {
39 &sdp4430_lcd_device,
40};
41
42static struct omap_uart_config sdp4430_uart_config __initdata = {
Syed Rafiuddin085b54d2009-07-28 18:57:22 +053043 .enabled_uarts = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3),
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070044};
45
46static struct omap_lcd_config sdp4430_lcd_config __initdata = {
47 .ctrl_name = "internal",
48};
49
50static struct omap_board_config_kernel sdp4430_config[] __initdata = {
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070051 { OMAP_TAG_LCD, &sdp4430_lcd_config },
52};
53
Santosh Shilimkard3094272010-02-04 19:37:09 +010054#ifdef CONFIG_CACHE_L2X0
55noinline void omap_smc1(u32 fn, u32 arg)
56{
57 register u32 r12 asm("r12") = fn;
58 register u32 r0 asm("r0") = arg;
59
60 /* This is common routine cache secure monitor API used to
61 * modify the PL310 secure registers.
62 * r0 contains the value to be modified and "r12" contains
63 * the monitor API number. It uses few CPU registers
64 * internally and hence they need be backed up including
65 * link register "lr".
66 * Explicitly save r11 and r12 the compiler generated code
67 * won't save it.
68 */
69 asm volatile(
70 "stmfd r13!, {r11,r12}\n"
71 "dsb\n"
72 "smc\n"
73 "ldmfd r13!, {r11,r12}\n"
74 : "+r" (r0), "+r" (r12)
75 :
76 : "r4", "r5", "r10", "lr", "cc");
77}
78EXPORT_SYMBOL(omap_smc1);
79
80static int __init omap_l2_cache_init(void)
81{
82 void __iomem *l2cache_base;
83
84 /* To avoid code running on other OMAPs in
85 * multi-omap builds
86 */
87 if (!cpu_is_omap44xx())
88 return -ENODEV;
89
90 /* Static mapping, never released */
91 l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K);
92 BUG_ON(!l2cache_base);
93
94 /* Enable PL310 L2 Cache controller */
95 omap_smc1(0x102, 0x1);
96
97 /* 32KB way size, 16-way associativity,
98 * parity disabled
99 */
100 l2x0_init(l2cache_base, 0x0e050000, 0xc0000fff);
101
102 return 0;
103}
104early_initcall(omap_l2_cache_init);
105#endif
106
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700107static void __init gic_init_irq(void)
108{
Tony Lindgrene4e7a132009-10-19 15:25:26 -0700109 void __iomem *base;
110
111 /* Static mapping, never released */
112 base = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K);
113 BUG_ON(!base);
114 gic_dist_init(0, base, 29);
115
116 /* Static mapping, never released */
117 gic_cpu_base_addr = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
118 BUG_ON(!gic_cpu_base_addr);
119 gic_cpu_init(0, gic_cpu_base_addr);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700120}
121
122static void __init omap_4430sdp_init_irq(void)
123{
Santosh Shilimkar5b7815b2009-10-22 14:48:14 -0700124 omap_board_config = sdp4430_config;
125 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
Jean Pihet58cda882009-07-24 19:43:25 -0600126 omap2_init_common_hw(NULL, NULL);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700127#ifdef CONFIG_OMAP_32K_TIMER
128 omap2_gp_clockevent_set_gptimer(1);
129#endif
130 gic_init_irq();
131 omap_gpio_init();
132}
133
134
135static void __init omap_4430sdp_init(void)
136{
137 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700138 omap_serial_init();
139}
140
141static void __init omap_4430sdp_map_io(void)
142{
143 omap2_set_globals_443x();
144 omap2_map_common_io();
145}
146
147MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
148 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
149 .phys_io = 0x48000000,
Santosh Shilimkarb4224b22009-10-19 17:25:55 -0700150 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700151 .boot_params = 0x80000100,
152 .map_io = omap_4430sdp_map_io,
153 .init_irq = omap_4430sdp_init_irq,
154 .init_machine = omap_4430sdp_init,
155 .timer = &omap_timer,
156MACHINE_END