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/omapfb.h>
28 #include <linux/spi/spi.h>
29 #include <linux/spi/ads7846.h>
30 #include <linux/platform_data/omap1_bl.h>
31 #include <linux/platform_data/leds-omap.h>
33 #include <asm/mach-types.h>
34 #include <asm/mach/arch.h>
35 #include <asm/mach/map.h>
37 #include <mach/flash.h>
39 #include <linux/omap-dma.h>
41 #include <mach/irda.h>
42 #include <linux/platform_data/keypad-omap.h>
44 #include <mach/hardware.h>
50 #define PALMTT_USBDETECT_GPIO 0
51 #define PALMTT_CABLE_GPIO 1
52 #define PALMTT_LED_GPIO 3
53 #define PALMTT_PENIRQ_GPIO 6
54 #define PALMTT_MMC_WP_GPIO 8
55 #define PALMTT_HDQ_GPIO 11
57 static const unsigned int palmtt_keymap
[] = {
60 KEY(2, 0, KEY_LEFTCTRL
),
71 static struct mtd_partition palmtt_partitions
[] = {
79 .name
= "PalmOS-BootLoader(ro)",
82 .mask_flags
= MTD_WRITEABLE
,
86 .offset
= MTDPART_OFS_APPEND
,
91 .name
= "PalmOS-FS(ro)",
92 .offset
= MTDPART_OFS_APPEND
,
93 .size
= 7 * SZ_1M
+ 4 * SZ_64K
- 16 * SZ_8K
,
94 .mask_flags
= MTD_WRITEABLE
,
97 .name
= "u-boot(rez)",
98 .offset
= MTDPART_OFS_APPEND
,
104 .offset
= MTDPART_OFS_APPEND
,
105 .size
= MTDPART_SIZ_FULL
,
110 static struct physmap_flash_data palmtt_flash_data
= {
112 .set_vpp
= omap1_set_vpp
,
113 .parts
= palmtt_partitions
,
114 .nr_parts
= ARRAY_SIZE(palmtt_partitions
),
117 static struct resource palmtt_flash_resource
= {
118 .start
= OMAP_CS0_PHYS
,
119 .end
= OMAP_CS0_PHYS
+ SZ_8M
- 1,
120 .flags
= IORESOURCE_MEM
,
123 static struct platform_device palmtt_flash_device
= {
124 .name
= "physmap-flash",
127 .platform_data
= &palmtt_flash_data
,
130 .resource
= &palmtt_flash_resource
,
133 static struct resource palmtt_kp_resources
[] = {
135 .start
= INT_KEYBOARD
,
137 .flags
= IORESOURCE_IRQ
,
141 static const struct matrix_keymap_data palmtt_keymap_data
= {
142 .keymap
= palmtt_keymap
,
143 .keymap_size
= ARRAY_SIZE(palmtt_keymap
),
146 static struct omap_kp_platform_data palmtt_kp_data
= {
149 .keymap_data
= &palmtt_keymap_data
,
152 static struct platform_device palmtt_kp_device
= {
153 .name
= "omap-keypad",
156 .platform_data
= &palmtt_kp_data
,
158 .num_resources
= ARRAY_SIZE(palmtt_kp_resources
),
159 .resource
= palmtt_kp_resources
,
162 static struct platform_device palmtt_lcd_device
= {
163 .name
= "lcd_palmtt",
166 static struct omap_irda_config palmtt_irda_config
= {
167 .transceiver_cap
= IR_SIRMODE
,
168 .rx_channel
= OMAP_DMA_UART3_RX
,
169 .tx_channel
= OMAP_DMA_UART3_TX
,
170 .dest_start
= UART3_THR
,
171 .src_start
= UART3_RHR
,
176 static struct resource palmtt_irda_resources
[] = {
180 .flags
= IORESOURCE_IRQ
,
184 static struct platform_device palmtt_irda_device
= {
188 .platform_data
= &palmtt_irda_config
,
190 .num_resources
= ARRAY_SIZE(palmtt_irda_resources
),
191 .resource
= palmtt_irda_resources
,
194 static struct platform_device palmtt_spi_device
= {
195 .name
= "spi_palmtt",
199 static struct omap_backlight_config palmtt_backlight_config
= {
200 .default_intensity
= 0xa0,
203 static struct platform_device palmtt_backlight_device
= {
207 .platform_data
= &palmtt_backlight_config
,
211 static struct omap_led_config palmtt_led_config
[] = {
214 .name
= "palmtt:led0",
216 .gpio
= PALMTT_LED_GPIO
,
220 static struct omap_led_platform_data palmtt_led_data
= {
221 .nr_leds
= ARRAY_SIZE(palmtt_led_config
),
222 .leds
= palmtt_led_config
,
225 static struct platform_device palmtt_led_device
= {
229 .platform_data
= &palmtt_led_data
,
233 static struct platform_device
*palmtt_devices
[] __initdata
= {
234 &palmtt_flash_device
,
239 &palmtt_backlight_device
,
243 static int palmtt_get_pendown_state(void)
245 return !gpio_get_value(6);
248 static const struct ads7846_platform_data palmtt_ts_info
= {
250 .vref_delay_usecs
= 100, /* internal, no capacitor */
253 .get_pendown_state
= palmtt_get_pendown_state
,
256 static struct spi_board_info __initdata palmtt_boardinfo
[] = {
258 /* MicroWire (bus 2) CS0 has an ads7846e */
259 .modalias
= "ads7846",
260 .platform_data
= &palmtt_ts_info
,
261 .max_speed_hz
= 120000 /* max sample rate at 3V */
262 * 26 /* command + data + overhead */,
268 static struct omap_usb_config palmtt_usb_config __initdata
= {
274 static struct omap_lcd_config palmtt_lcd_config __initdata
= {
275 .ctrl_name
= "internal",
278 static void __init
omap_mpu_wdt_mode(int mode
) {
280 omap_writew(0x8000, OMAP_WDT_TIMER_MODE
);
282 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE
);
283 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE
);
287 static void __init
omap_palmtt_init(void)
289 /* mux pins for uarts */
290 omap_cfg_reg(UART1_TX
);
291 omap_cfg_reg(UART1_RTS
);
292 omap_cfg_reg(UART2_TX
);
293 omap_cfg_reg(UART2_RTS
);
294 omap_cfg_reg(UART3_TX
);
295 omap_cfg_reg(UART3_RX
);
297 omap_mpu_wdt_mode(0);
299 platform_add_devices(palmtt_devices
, ARRAY_SIZE(palmtt_devices
));
301 palmtt_boardinfo
[0].irq
= gpio_to_irq(6);
302 spi_register_board_info(palmtt_boardinfo
,ARRAY_SIZE(palmtt_boardinfo
));
304 omap1_usb_init(&palmtt_usb_config
);
305 omap_register_i2c_bus(1, 100, NULL
, 0);
307 omapfb_set_lcd_config(&palmtt_lcd_config
);
310 MACHINE_START(OMAP_PALMTT
, "OMAP1510 based Palm Tungsten|T")
311 .atag_offset
= 0x100,
312 .map_io
= omap15xx_map_io
,
313 .init_early
= omap1_init_early
,
314 .init_irq
= omap1_init_irq
,
315 .init_machine
= omap_palmtt_init
,
316 .init_late
= omap1_init_late
,
317 .timer
= &omap1_timer
,
318 .restart
= omap1_restart
,