blob: 88708a0c52a25b0915b60e0828a3f6327e838840 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Tony Lindgrendbdf9ced2005-07-10 19:58:11 +01002 * linux/arch/arm/mach-omap1/board-perseus2.c
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * Modified from board-generic.c
5 *
6 * Original OMAP730 support by Jean Pihet <j-pihet@ti.com>
7 * Updated for 2.6 by Kevin Hilman <kjh@hilman.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010016#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <linux/delay.h>
18#include <linux/mtd/mtd.h>
19#include <linux/mtd/partitions.h>
20
21#include <asm/hardware.h>
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24#include <asm/mach/flash.h>
25#include <asm/mach/map.h>
26
Tony Lindgren7c38cf02005-09-08 23:07:38 +010027#include <asm/arch/tc.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#include <asm/arch/gpio.h>
29#include <asm/arch/mux.h>
30#include <asm/arch/fpga.h>
Tony Lindgrend48af152005-07-10 19:58:17 +010031#include <asm/arch/common.h>
Tony Lindgren3179a012005-11-10 14:26:48 +000032#include <asm/arch/board.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
34static struct resource smc91x_resources[] = {
35 [0] = {
36 .start = H2P2_DBG_FPGA_ETHR_START, /* Physical */
37 .end = H2P2_DBG_FPGA_ETHR_START + 0xf,
38 .flags = IORESOURCE_MEM,
39 },
40 [1] = {
41 .start = INT_730_MPU_EXT_NIRQ,
42 .end = 0,
43 .flags = IORESOURCE_IRQ,
44 },
45};
46
Linus Torvalds1da177e2005-04-16 15:20:36 -070047static struct mtd_partition p2_partitions[] = {
48 /* bootloader (U-Boot, etc) in first sector */
49 {
50 .name = "bootloader",
51 .offset = 0,
52 .size = SZ_128K,
53 .mask_flags = MTD_WRITEABLE, /* force read-only */
54 },
55 /* bootloader params in the next sector */
56 {
57 .name = "params",
58 .offset = MTDPART_OFS_APPEND,
59 .size = SZ_128K,
60 .mask_flags = 0,
61 },
62 /* kernel */
63 {
64 .name = "kernel",
65 .offset = MTDPART_OFS_APPEND,
66 .size = SZ_2M,
67 .mask_flags = 0
68 },
69 /* rest of flash is a file system */
70 {
71 .name = "rootfs",
72 .offset = MTDPART_OFS_APPEND,
73 .size = MTDPART_SIZ_FULL,
74 .mask_flags = 0
75 },
76};
77
78static struct flash_platform_data p2_flash_data = {
79 .map_name = "cfi_probe",
80 .width = 2,
81 .parts = p2_partitions,
82 .nr_parts = ARRAY_SIZE(p2_partitions),
83};
84
85static struct resource p2_flash_resource = {
Tony Lindgren7c38cf02005-09-08 23:07:38 +010086 .start = OMAP_CS0_PHYS,
87 .end = OMAP_CS0_PHYS + SZ_32M - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 .flags = IORESOURCE_MEM,
89};
90
91static struct platform_device p2_flash_device = {
92 .name = "omapflash",
93 .id = 0,
94 .dev = {
95 .platform_data = &p2_flash_data,
96 },
97 .num_resources = 1,
98 .resource = &p2_flash_resource,
99};
100
101static struct platform_device smc91x_device = {
102 .name = "smc91x",
103 .id = 0,
104 .num_resources = ARRAY_SIZE(smc91x_resources),
105 .resource = smc91x_resources,
106};
107
108static struct platform_device *devices[] __initdata = {
109 &p2_flash_device,
110 &smc91x_device,
111};
112
Tony Lindgren3179a012005-11-10 14:26:48 +0000113static struct omap_uart_config perseus2_uart_config __initdata = {
114 .enabled_uarts = ((1 << 0) | (1 << 1)),
115};
116
117static struct omap_lcd_config perseus2_lcd_config __initdata = {
118 .panel_name = "p2",
119 .ctrl_name = "internal",
120};
121
122static struct omap_board_config_kernel perseus2_config[] = {
123 { OMAP_TAG_UART, &perseus2_uart_config },
124 { OMAP_TAG_LCD, &perseus2_lcd_config },
125};
126
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127static void __init omap_perseus2_init(void)
128{
129 (void) platform_add_devices(devices, ARRAY_SIZE(devices));
Tony Lindgren3179a012005-11-10 14:26:48 +0000130
131 omap_board_config = perseus2_config;
132 omap_board_config_size = ARRAY_SIZE(perseus2_config);
133 omap_serial_init();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134}
135
136static void __init perseus2_init_smc91x(void)
137{
138 fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
139 mdelay(50);
140 fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
141 H2P2_DBG_FPGA_LAN_RESET);
142 mdelay(50);
143}
144
145void omap_perseus2_init_irq(void)
146{
147 omap_init_irq();
148 omap_gpio_init();
149 perseus2_init_smc91x();
150}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151/* Only FPGA needs to be mapped here. All others are done with ioremap */
152static struct map_desc omap_perseus2_io_desc[] __initdata = {
Deepak Saxena9fe133b2005-10-28 15:19:00 +0100153 {
154 .virtual = H2P2_DBG_FPGA_BASE,
155 .pfn = __phys_to_pfn(H2P2_DBG_FPGA_START),
156 .length = H2P2_DBG_FPGA_SIZE,
157 .type = MT_DEVICE
158 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159};
160
161static void __init omap_perseus2_map_io(void)
162{
Tony Lindgrend48af152005-07-10 19:58:17 +0100163 omap_map_common_io();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164 iotable_init(omap_perseus2_io_desc,
165 ARRAY_SIZE(omap_perseus2_io_desc));
166
167 /* Early, board-dependent init */
168
169 /*
170 * Hold GSM Reset until needed
171 */
172 omap_writew(omap_readw(OMAP730_DSP_M_CTL) & ~1, OMAP730_DSP_M_CTL);
173
174 /*
175 * UARTs -> done automagically by 8250 driver
176 */
177
178 /*
179 * CSx timings, GPIO Mux ... setup
180 */
181
182 /* Flash: CS0 timings setup */
183 omap_writel(0x0000fff3, OMAP730_FLASH_CFG_0);
184 omap_writel(0x00000088, OMAP730_FLASH_ACFG_0);
185
186 /*
Adrian Bunk93b1fae2006-01-10 00:13:33 +0100187 * Ethernet support through the debug board
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188 * CS1 timings setup
189 */
190 omap_writel(0x0000fff3, OMAP730_FLASH_CFG_1);
191 omap_writel(0x00000000, OMAP730_FLASH_ACFG_1);
192
193 /*
194 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
195 * It is used as the Ethernet controller interrupt
196 */
197 omap_writel(omap_readl(OMAP730_IO_CONF_9) & 0x1FFFFFFF, OMAP730_IO_CONF_9);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198}
199
200MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100201 /* Maintainer: Kevin Hilman <kjh@hilman.org> */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100202 .phys_io = 0xfff00000,
203 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
204 .boot_params = 0x10000100,
205 .map_io = omap_perseus2_map_io,
206 .init_irq = omap_perseus2_init_irq,
207 .init_machine = omap_perseus2_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208 .timer = &omap_timer,
209MACHINE_END