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/kernel.h>
16 #include <linux/init.h>
17 #include <linux/platform_device.h>
18 #include <linux/notifier.h>
19 #include <linux/clk.h>
20 #include <linux/input.h>
21 #include <linux/interrupt.h>
22 #include <linux/mtd/mtd.h>
23 #include <linux/mtd/partitions.h>
24 #include <linux/mtd/physmap.h>
25 #include <linux/leds.h>
27 #include <mach/hardware.h>
28 #include <asm/mach-types.h>
29 #include <asm/mach/arch.h>
30 #include <asm/mach/map.h>
33 #include <mach/gpio.h>
34 #include <plat/flash.h>
39 #include <plat/board.h>
40 #include <plat/irda.h>
41 #include <plat/keypad.h>
42 #include <plat/common.h>
44 #include <linux/spi/spi.h>
45 #include <linux/spi/ads7846.h>
47 #define PALMTT_USBDETECT_GPIO 0
48 #define PALMTT_CABLE_GPIO 1
49 #define PALMTT_LED_GPIO 3
50 #define PALMTT_PENIRQ_GPIO 6
51 #define PALMTT_MMC_WP_GPIO 8
52 #define PALMTT_HDQ_GPIO 11
54 static const unsigned int palmtt_keymap
[] = {
57 KEY(2, 0, KEY_LEFTCTRL
),
68 static struct mtd_partition palmtt_partitions
[] = {
76 .name
= "PalmOS-BootLoader(ro)",
79 .mask_flags
= MTD_WRITEABLE
,
83 .offset
= MTDPART_OFS_APPEND
,
88 .name
= "PalmOS-FS(ro)",
89 .offset
= MTDPART_OFS_APPEND
,
90 .size
= 7 * SZ_1M
+ 4 * SZ_64K
- 16 * SZ_8K
,
91 .mask_flags
= MTD_WRITEABLE
,
94 .name
= "u-boot(rez)",
95 .offset
= MTDPART_OFS_APPEND
,
101 .offset
= MTDPART_OFS_APPEND
,
102 .size
= MTDPART_SIZ_FULL
,
107 static struct physmap_flash_data palmtt_flash_data
= {
109 .set_vpp
= omap1_set_vpp
,
110 .parts
= palmtt_partitions
,
111 .nr_parts
= ARRAY_SIZE(palmtt_partitions
),
114 static struct resource palmtt_flash_resource
= {
115 .start
= OMAP_CS0_PHYS
,
116 .end
= OMAP_CS0_PHYS
+ SZ_8M
- 1,
117 .flags
= IORESOURCE_MEM
,
120 static struct platform_device palmtt_flash_device
= {
121 .name
= "physmap-flash",
124 .platform_data
= &palmtt_flash_data
,
127 .resource
= &palmtt_flash_resource
,
130 static struct resource palmtt_kp_resources
[] = {
132 .start
= INT_KEYBOARD
,
134 .flags
= IORESOURCE_IRQ
,
138 static const struct matrix_keymap_data palmtt_keymap_data
= {
139 .keymap
= palmtt_keymap
,
140 .keymap_size
= ARRAY_SIZE(palmtt_keymap
),
143 static struct omap_kp_platform_data palmtt_kp_data
= {
146 .keymap_data
= &palmtt_keymap_data
,
149 static struct platform_device palmtt_kp_device
= {
150 .name
= "omap-keypad",
153 .platform_data
= &palmtt_kp_data
,
155 .num_resources
= ARRAY_SIZE(palmtt_kp_resources
),
156 .resource
= palmtt_kp_resources
,
159 static struct platform_device palmtt_lcd_device
= {
160 .name
= "lcd_palmtt",
163 static struct omap_irda_config palmtt_irda_config
= {
164 .transceiver_cap
= IR_SIRMODE
,
165 .rx_channel
= OMAP_DMA_UART3_RX
,
166 .tx_channel
= OMAP_DMA_UART3_TX
,
167 .dest_start
= UART3_THR
,
168 .src_start
= UART3_RHR
,
173 static struct resource palmtt_irda_resources
[] = {
177 .flags
= IORESOURCE_IRQ
,
181 static struct platform_device palmtt_irda_device
= {
185 .platform_data
= &palmtt_irda_config
,
187 .num_resources
= ARRAY_SIZE(palmtt_irda_resources
),
188 .resource
= palmtt_irda_resources
,
191 static struct platform_device palmtt_spi_device
= {
192 .name
= "spi_palmtt",
196 static struct omap_backlight_config palmtt_backlight_config
= {
197 .default_intensity
= 0xa0,
200 static struct platform_device palmtt_backlight_device
= {
204 .platform_data
= &palmtt_backlight_config
,
208 static struct omap_led_config palmtt_led_config
[] = {
211 .name
= "palmtt:led0",
213 .gpio
= PALMTT_LED_GPIO
,
217 static struct omap_led_platform_data palmtt_led_data
= {
218 .nr_leds
= ARRAY_SIZE(palmtt_led_config
),
219 .leds
= palmtt_led_config
,
222 static struct platform_device palmtt_led_device
= {
226 .platform_data
= &palmtt_led_data
,
230 static struct platform_device
*palmtt_devices
[] __initdata
= {
231 &palmtt_flash_device
,
236 &palmtt_backlight_device
,
240 static int palmtt_get_pendown_state(void)
242 return !gpio_get_value(6);
245 static const struct ads7846_platform_data palmtt_ts_info
= {
247 .vref_delay_usecs
= 100, /* internal, no capacitor */
250 .get_pendown_state
= palmtt_get_pendown_state
,
253 static struct spi_board_info __initdata palmtt_boardinfo
[] = {
255 /* MicroWire (bus 2) CS0 has an ads7846e */
256 .modalias
= "ads7846",
257 .platform_data
= &palmtt_ts_info
,
258 .irq
= OMAP_GPIO_IRQ(6),
259 .max_speed_hz
= 120000 /* max sample rate at 3V */
260 * 26 /* command + data + overhead */,
266 static void __init
omap_palmtt_init_irq(void)
268 omap1_init_common_hw();
272 static struct omap_usb_config palmtt_usb_config __initdata
= {
278 static struct omap_lcd_config palmtt_lcd_config __initdata
= {
279 .ctrl_name
= "internal",
282 static struct omap_board_config_kernel palmtt_config
[] __initdata
= {
283 { OMAP_TAG_LCD
, &palmtt_lcd_config
},
286 static void __init
omap_mpu_wdt_mode(int mode
) {
288 omap_writew(0x8000, OMAP_WDT_TIMER_MODE
);
290 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE
);
291 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE
);
295 static void __init
omap_palmtt_init(void)
297 /* mux pins for uarts */
298 omap_cfg_reg(UART1_TX
);
299 omap_cfg_reg(UART1_RTS
);
300 omap_cfg_reg(UART2_TX
);
301 omap_cfg_reg(UART2_RTS
);
302 omap_cfg_reg(UART3_TX
);
303 omap_cfg_reg(UART3_RX
);
305 omap_mpu_wdt_mode(0);
307 omap_board_config
= palmtt_config
;
308 omap_board_config_size
= ARRAY_SIZE(palmtt_config
);
310 platform_add_devices(palmtt_devices
, ARRAY_SIZE(palmtt_devices
));
312 spi_register_board_info(palmtt_boardinfo
,ARRAY_SIZE(palmtt_boardinfo
));
314 omap1_usb_init(&palmtt_usb_config
);
315 omap_register_i2c_bus(1, 100, NULL
, 0);
318 static void __init
omap_palmtt_map_io(void)
320 omap1_map_common_io();
323 MACHINE_START(OMAP_PALMTT
, "OMAP1510 based Palm Tungsten|T")
324 .boot_params
= 0x10000100,
325 .map_io
= omap_palmtt_map_io
,
326 .reserve
= omap_reserve
,
327 .init_irq
= omap_palmtt_init_irq
,
328 .init_machine
= omap_palmtt_init
,
329 .timer
= &omap1_timer
,