blob: 180ac112e527b240099ba5daf9ce0d43d2a4ff48 [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>
Maulik Mankadbce06682010-02-17 14:09:32 -080020#include <linux/usb/otg.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070021
22#include <mach/hardware.h>
23#include <asm/mach-types.h>
24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26
Tony Lindgrence491cf2009-10-20 09:40:47 -070027#include <plat/board.h>
28#include <plat/common.h>
29#include <plat/control.h>
30#include <plat/timer-gp.h>
Maulik Mankadbce06682010-02-17 14:09:32 -080031#include <plat/usb.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070032#include <asm/hardware/gic.h>
Santosh Shilimkard3094272010-02-04 19:37:09 +010033#include <asm/hardware/cache-l2x0.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070034
35static struct platform_device sdp4430_lcd_device = {
36 .name = "sdp4430_lcd",
37 .id = -1,
38};
39
40static struct platform_device *sdp4430_devices[] __initdata = {
41 &sdp4430_lcd_device,
42};
43
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070044static struct omap_lcd_config sdp4430_lcd_config __initdata = {
45 .ctrl_name = "internal",
46};
47
48static struct omap_board_config_kernel sdp4430_config[] __initdata = {
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070049 { OMAP_TAG_LCD, &sdp4430_lcd_config },
50};
51
Santosh Shilimkard3094272010-02-04 19:37:09 +010052#ifdef CONFIG_CACHE_L2X0
53noinline void omap_smc1(u32 fn, u32 arg)
54{
55 register u32 r12 asm("r12") = fn;
56 register u32 r0 asm("r0") = arg;
57
58 /* This is common routine cache secure monitor API used to
59 * modify the PL310 secure registers.
60 * r0 contains the value to be modified and "r12" contains
61 * the monitor API number. It uses few CPU registers
62 * internally and hence they need be backed up including
63 * link register "lr".
64 * Explicitly save r11 and r12 the compiler generated code
65 * won't save it.
66 */
67 asm volatile(
68 "stmfd r13!, {r11,r12}\n"
69 "dsb\n"
70 "smc\n"
71 "ldmfd r13!, {r11,r12}\n"
72 : "+r" (r0), "+r" (r12)
73 :
74 : "r4", "r5", "r10", "lr", "cc");
75}
76EXPORT_SYMBOL(omap_smc1);
77
78static int __init omap_l2_cache_init(void)
79{
80 void __iomem *l2cache_base;
81
82 /* To avoid code running on other OMAPs in
83 * multi-omap builds
84 */
85 if (!cpu_is_omap44xx())
86 return -ENODEV;
87
88 /* Static mapping, never released */
89 l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K);
90 BUG_ON(!l2cache_base);
91
92 /* Enable PL310 L2 Cache controller */
93 omap_smc1(0x102, 0x1);
94
95 /* 32KB way size, 16-way associativity,
96 * parity disabled
97 */
98 l2x0_init(l2cache_base, 0x0e050000, 0xc0000fff);
99
100 return 0;
101}
102early_initcall(omap_l2_cache_init);
103#endif
104
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700105static void __init gic_init_irq(void)
106{
Tony Lindgrene4e7a132009-10-19 15:25:26 -0700107 void __iomem *base;
108
109 /* Static mapping, never released */
110 base = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K);
111 BUG_ON(!base);
112 gic_dist_init(0, base, 29);
113
114 /* Static mapping, never released */
115 gic_cpu_base_addr = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
116 BUG_ON(!gic_cpu_base_addr);
117 gic_cpu_init(0, gic_cpu_base_addr);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700118}
119
120static void __init omap_4430sdp_init_irq(void)
121{
Santosh Shilimkar5b7815b2009-10-22 14:48:14 -0700122 omap_board_config = sdp4430_config;
123 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
Jean Pihet58cda882009-07-24 19:43:25 -0600124 omap2_init_common_hw(NULL, NULL);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700125#ifdef CONFIG_OMAP_32K_TIMER
126 omap2_gp_clockevent_set_gptimer(1);
127#endif
128 gic_init_irq();
129 omap_gpio_init();
130}
131
Maulik Mankadbce06682010-02-17 14:09:32 -0800132static struct omap_musb_board_data musb_board_data = {
133 .interface_type = MUSB_INTERFACE_UTMI,
134 .mode = MUSB_PERIPHERAL,
135 .power = 100,
136};
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700137
138static void __init omap_4430sdp_init(void)
139{
140 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700141 omap_serial_init();
Maulik Mankadbce06682010-02-17 14:09:32 -0800142 /* OMAP4 SDP uses internal transceiver so register nop transceiver */
143 usb_nop_xceiv_register();
Santosh Shilimkarae46ec72010-02-16 19:29:20 +0530144 /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
145 if (!cpu_is_omap44xx())
146 usb_musb_init(&musb_board_data);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700147}
148
149static void __init omap_4430sdp_map_io(void)
150{
151 omap2_set_globals_443x();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800152 omap44xx_map_common_io();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700153}
154
155MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
156 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
157 .phys_io = 0x48000000,
Santosh Shilimkarb4224b22009-10-19 17:25:55 -0700158 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700159 .boot_params = 0x80000100,
160 .map_io = omap_4430sdp_map_io,
161 .init_irq = omap_4430sdp_init_irq,
162 .init_machine = omap_4430sdp_init,
163 .timer = &omap_timer,
164MACHINE_END