2 * linux/arch/arm/mach-omap1/board-palmtt.c
4 * Modified from board-palmtt2.c
6 * Modified and amended for Palm Tungsten|T
7 * by Marek Vasut <marek.vasut@gmail.com>
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.
14 #include <linux/delay.h>
15 #include <linux/gpio.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/platform_device.h>
19 #include <linux/notifier.h>
20 #include <linux/clk.h>
21 #include <linux/input.h>
22 #include <linux/interrupt.h>
23 #include <linux/mtd/mtd.h>
24 #include <linux/mtd/partitions.h>
25 #include <linux/mtd/physmap.h>
26 #include <linux/leds.h>
27 #include <linux/spi/spi.h>
28 #include <linux/spi/ads7846.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/map.h>
35 #include <plat/flash.h>
40 #include <plat/board.h>
41 #include <plat/irda.h>
42 #include <plat/keypad.h>
44 #include <mach/hardware.h>
48 #define PALMTT_USBDETECT_GPIO 0
49 #define PALMTT_CABLE_GPIO 1
50 #define PALMTT_LED_GPIO 3
51 #define PALMTT_PENIRQ_GPIO 6
52 #define PALMTT_MMC_WP_GPIO 8
53 #define PALMTT_HDQ_GPIO 11
55 static const unsigned int palmtt_keymap[] = {
58 KEY(2, 0, KEY_LEFTCTRL),
69 static struct mtd_partition palmtt_partitions[] = {
77 .name = "PalmOS-BootLoader(ro)",
80 .mask_flags = MTD_WRITEABLE,
84 .offset = MTDPART_OFS_APPEND,
89 .name = "PalmOS-FS(ro)",
90 .offset = MTDPART_OFS_APPEND,
91 .size = 7 * SZ_1M + 4 * SZ_64K - 16 * SZ_8K,
92 .mask_flags = MTD_WRITEABLE,
95 .name = "u-boot(rez)",
96 .offset = MTDPART_OFS_APPEND,
102 .offset = MTDPART_OFS_APPEND,
103 .size = MTDPART_SIZ_FULL,
108 static struct physmap_flash_data palmtt_flash_data = {
110 .set_vpp = omap1_set_vpp,
111 .parts = palmtt_partitions,
112 .nr_parts = ARRAY_SIZE(palmtt_partitions),
115 static struct resource palmtt_flash_resource = {
116 .start = OMAP_CS0_PHYS,
117 .end = OMAP_CS0_PHYS + SZ_8M - 1,
118 .flags = IORESOURCE_MEM,
121 static struct platform_device palmtt_flash_device = {
122 .name = "physmap-flash",
125 .platform_data = &palmtt_flash_data,
128 .resource = &palmtt_flash_resource,
131 static struct resource palmtt_kp_resources[] = {
133 .start = INT_KEYBOARD,
135 .flags = IORESOURCE_IRQ,
139 static const struct matrix_keymap_data palmtt_keymap_data = {
140 .keymap = palmtt_keymap,
141 .keymap_size = ARRAY_SIZE(palmtt_keymap),
144 static struct omap_kp_platform_data palmtt_kp_data = {
147 .keymap_data = &palmtt_keymap_data,
150 static struct platform_device palmtt_kp_device = {
151 .name = "omap-keypad",
154 .platform_data = &palmtt_kp_data,
156 .num_resources = ARRAY_SIZE(palmtt_kp_resources),
157 .resource = palmtt_kp_resources,
160 static struct platform_device palmtt_lcd_device = {
161 .name = "lcd_palmtt",
164 static struct omap_irda_config palmtt_irda_config = {
165 .transceiver_cap = IR_SIRMODE,
166 .rx_channel = OMAP_DMA_UART3_RX,
167 .tx_channel = OMAP_DMA_UART3_TX,
168 .dest_start = UART3_THR,
169 .src_start = UART3_RHR,
174 static struct resource palmtt_irda_resources[] = {
178 .flags = IORESOURCE_IRQ,
182 static struct platform_device palmtt_irda_device = {
186 .platform_data = &palmtt_irda_config,
188 .num_resources = ARRAY_SIZE(palmtt_irda_resources),
189 .resource = palmtt_irda_resources,
192 static struct platform_device palmtt_spi_device = {
193 .name = "spi_palmtt",
197 static struct omap_backlight_config palmtt_backlight_config = {
198 .default_intensity = 0xa0,
201 static struct platform_device palmtt_backlight_device = {
205 .platform_data= &palmtt_backlight_config,
209 static struct omap_led_config palmtt_led_config[] = {
212 .name = "palmtt:led0",
214 .gpio = PALMTT_LED_GPIO,
218 static struct omap_led_platform_data palmtt_led_data = {
219 .nr_leds = ARRAY_SIZE(palmtt_led_config),
220 .leds = palmtt_led_config,
223 static struct platform_device palmtt_led_device = {
227 .platform_data = &palmtt_led_data,
231 static struct platform_device *palmtt_devices[] __initdata = {
232 &palmtt_flash_device,
237 &palmtt_backlight_device,
241 static int palmtt_get_pendown_state(void)
243 return !gpio_get_value(6);
246 static const struct ads7846_platform_data palmtt_ts_info = {
248 .vref_delay_usecs = 100, /* internal, no capacitor */
251 .get_pendown_state = palmtt_get_pendown_state,
254 static struct spi_board_info __initdata palmtt_boardinfo[] = {
256 /* MicroWire (bus 2) CS0 has an ads7846e */
257 .modalias = "ads7846",
258 .platform_data = &palmtt_ts_info,
259 .irq = OMAP_GPIO_IRQ(6),
260 .max_speed_hz = 120000 /* max sample rate at 3V */
261 * 26 /* command + data + overhead */,
267 static struct omap_usb_config palmtt_usb_config __initdata = {
273 static struct omap_lcd_config palmtt_lcd_config __initdata = {
274 .ctrl_name = "internal",
277 static struct omap_board_config_kernel palmtt_config[] __initdata = {
278 { OMAP_TAG_LCD, &palmtt_lcd_config },
281 static void __init omap_mpu_wdt_mode(int mode) {
283 omap_writew(0x8000, OMAP_WDT_TIMER_MODE);
285 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE);
286 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE);
290 static void __init omap_palmtt_init(void)
292 /* mux pins for uarts */
293 omap_cfg_reg(UART1_TX);
294 omap_cfg_reg(UART1_RTS);
295 omap_cfg_reg(UART2_TX);
296 omap_cfg_reg(UART2_RTS);
297 omap_cfg_reg(UART3_TX);
298 omap_cfg_reg(UART3_RX);
300 omap_mpu_wdt_mode(0);
302 omap_board_config = palmtt_config;
303 omap_board_config_size = ARRAY_SIZE(palmtt_config);
305 platform_add_devices(palmtt_devices, ARRAY_SIZE(palmtt_devices));
307 spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo));
309 omap1_usb_init(&palmtt_usb_config);
310 omap_register_i2c_bus(1, 100, NULL, 0);
313 MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
314 .atag_offset = 0x100,
315 .map_io = omap15xx_map_io,
316 .init_early = omap1_init_early,
317 .reserve = omap_reserve,
318 .init_irq = omap1_init_irq,
319 .init_machine = omap_palmtt_init,
320 .timer = &omap1_timer,
321 .restart = omap1_restart,