2 * linux/arch/arm/mach-omap1/board-palmz71.c
4 * Modified from board-generic.c
6 * Support for the Palm Zire71 PDA.
8 * Original version : Laurent Gonzalez
10 * Modified for zire71 : Marek Vasut
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
17 #include <linux/delay.h>
18 #include <linux/gpio.h>
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21 #include <linux/platform_device.h>
22 #include <linux/notifier.h>
23 #include <linux/clk.h>
24 #include <linux/irq.h>
25 #include <linux/input.h>
26 #include <linux/interrupt.h>
27 #include <linux/mtd/mtd.h>
28 #include <linux/mtd/partitions.h>
29 #include <linux/mtd/physmap.h>
31 #include <mach/hardware.h>
32 #include <asm/mach-types.h>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/map.h>
36 #include <plat/flash.h>
41 #include <plat/board.h>
42 #include <plat/irda.h>
43 #include <plat/keypad.h>
44 #include <plat/common.h>
45 #include <plat/omap-alsa.h>
47 #include <linux/spi/spi.h>
48 #include <linux/spi/ads7846.h>
50 #define PALMZ71_USBDETECT_GPIO 0
51 #define PALMZ71_PENIRQ_GPIO 6
52 #define PALMZ71_MMC_WP_GPIO 8
53 #define PALMZ71_HDQ_GPIO 11
55 #define PALMZ71_HOTSYNC_GPIO OMAP_MPUIO(1)
56 #define PALMZ71_CABLE_GPIO OMAP_MPUIO(2)
57 #define PALMZ71_SLIDER_GPIO OMAP_MPUIO(3)
58 #define PALMZ71_MMC_IN_GPIO OMAP_MPUIO(4)
61 omap_palmz71_init_irq(void)
63 omap1_init_common_hw();
67 static const unsigned int palmz71_keymap
[] = {
78 KEY(0, 2, KEY_CAMERA
),
81 static const struct matrix_keymap_data palmz71_keymap_data
= {
82 .keymap
= palmz71_keymap
,
83 .keymap_size
= ARRAY_SIZE(palmz71_keymap
),
86 static struct omap_kp_platform_data palmz71_kp_data
= {
89 .keymap_data
= &palmz71_keymap_data
,
94 static struct resource palmz71_kp_resources
[] = {
96 .start
= INT_KEYBOARD
,
98 .flags
= IORESOURCE_IRQ
,
102 static struct platform_device palmz71_kp_device
= {
103 .name
= "omap-keypad",
106 .platform_data
= &palmz71_kp_data
,
108 .num_resources
= ARRAY_SIZE(palmz71_kp_resources
),
109 .resource
= palmz71_kp_resources
,
112 static struct mtd_partition palmz71_rom_partitions
[] = {
113 /* PalmOS "Small ROM", contains the bootloader and the debugger */
118 .mask_flags
= MTD_WRITEABLE
,
120 /* PalmOS "Big ROM", a filesystem with all the OS code and data */
125 * 0x5f0000 bytes big in the multi-language ("EFIGS") version,
126 * 0x7b0000 bytes in the English-only ("enUS") version.
129 .mask_flags
= MTD_WRITEABLE
,
133 static struct physmap_flash_data palmz71_rom_data
= {
135 .set_vpp
= omap1_set_vpp
,
136 .parts
= palmz71_rom_partitions
,
137 .nr_parts
= ARRAY_SIZE(palmz71_rom_partitions
),
140 static struct resource palmz71_rom_resource
= {
141 .start
= OMAP_CS0_PHYS
,
142 .end
= OMAP_CS0_PHYS
+ SZ_8M
- 1,
143 .flags
= IORESOURCE_MEM
,
146 static struct platform_device palmz71_rom_device
= {
147 .name
= "physmap-flash",
150 .platform_data
= &palmz71_rom_data
,
153 .resource
= &palmz71_rom_resource
,
156 static struct platform_device palmz71_lcd_device
= {
157 .name
= "lcd_palmz71",
161 static struct omap_irda_config palmz71_irda_config
= {
162 .transceiver_cap
= IR_SIRMODE
,
163 .rx_channel
= OMAP_DMA_UART3_RX
,
164 .tx_channel
= OMAP_DMA_UART3_TX
,
165 .dest_start
= UART3_THR
,
166 .src_start
= UART3_RHR
,
171 static struct resource palmz71_irda_resources
[] = {
175 .flags
= IORESOURCE_IRQ
,
179 static struct platform_device palmz71_irda_device
= {
183 .platform_data
= &palmz71_irda_config
,
185 .num_resources
= ARRAY_SIZE(palmz71_irda_resources
),
186 .resource
= palmz71_irda_resources
,
189 static struct platform_device palmz71_spi_device
= {
190 .name
= "spi_palmz71",
194 static struct omap_backlight_config palmz71_backlight_config
= {
195 .default_intensity
= 0xa0,
198 static struct platform_device palmz71_backlight_device
= {
202 .platform_data
= &palmz71_backlight_config
,
206 static struct platform_device
*devices
[] __initdata
= {
210 &palmz71_irda_device
,
212 &palmz71_backlight_device
,
216 palmz71_get_pendown_state(void)
218 return !gpio_get_value(PALMZ71_PENIRQ_GPIO
);
221 static const struct ads7846_platform_data palmz71_ts_info
= {
223 .vref_delay_usecs
= 100, /* internal, no capacitor */
226 .get_pendown_state
= palmz71_get_pendown_state
,
229 static struct spi_board_info __initdata palmz71_boardinfo
[] = { {
230 /* MicroWire (bus 2) CS0 has an ads7846e */
231 .modalias
= "ads7846",
232 .platform_data
= &palmz71_ts_info
,
233 .irq
= OMAP_GPIO_IRQ(PALMZ71_PENIRQ_GPIO
),
234 .max_speed_hz
= 120000 /* max sample rate at 3V */
235 * 26 /* command + data + overhead */,
240 static struct omap_usb_config palmz71_usb_config __initdata
= {
241 .register_dev
= 1, /* Mini-B only receptacle */
246 static struct omap_lcd_config palmz71_lcd_config __initdata
= {
247 .ctrl_name
= "internal",
250 static struct omap_board_config_kernel palmz71_config
[] __initdata
= {
251 {OMAP_TAG_LCD
, &palmz71_lcd_config
},
255 palmz71_powercable(int irq
, void *dev_id
)
257 if (gpio_get_value(PALMZ71_USBDETECT_GPIO
)) {
258 printk(KERN_INFO
"PM: Power cable connected\n");
259 irq_set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO
),
260 IRQ_TYPE_EDGE_FALLING
);
262 printk(KERN_INFO
"PM: Power cable disconnected\n");
263 irq_set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO
),
264 IRQ_TYPE_EDGE_RISING
);
270 omap_mpu_wdt_mode(int mode
)
273 omap_writew(0x8000, OMAP_WDT_TIMER_MODE
);
275 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE
);
276 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE
);
281 palmz71_gpio_setup(int early
)
284 /* Only set GPIO1 so we have a working serial */
285 gpio_direction_output(1, 1);
287 /* Set MMC/SD host WP pin as input */
288 if (gpio_request(PALMZ71_MMC_WP_GPIO
, "MMC WP") < 0) {
289 printk(KERN_ERR
"Could not reserve WP GPIO!\n");
292 gpio_direction_input(PALMZ71_MMC_WP_GPIO
);
294 /* Monitor the Power-cable-connected signal */
295 if (gpio_request(PALMZ71_USBDETECT_GPIO
, "USB detect") < 0) {
297 "Could not reserve cable signal GPIO!\n");
300 gpio_direction_input(PALMZ71_USBDETECT_GPIO
);
301 if (request_irq(gpio_to_irq(PALMZ71_USBDETECT_GPIO
),
302 palmz71_powercable
, IRQF_SAMPLE_RANDOM
,
305 "IRQ request for power cable failed!\n");
306 palmz71_powercable(gpio_to_irq(PALMZ71_USBDETECT_GPIO
), 0);
311 omap_palmz71_init(void)
313 /* mux pins for uarts */
314 omap_cfg_reg(UART1_TX
);
315 omap_cfg_reg(UART1_RTS
);
316 omap_cfg_reg(UART2_TX
);
317 omap_cfg_reg(UART2_RTS
);
318 omap_cfg_reg(UART3_TX
);
319 omap_cfg_reg(UART3_RX
);
321 palmz71_gpio_setup(1);
322 omap_mpu_wdt_mode(0);
324 omap_board_config
= palmz71_config
;
325 omap_board_config_size
= ARRAY_SIZE(palmz71_config
);
327 platform_add_devices(devices
, ARRAY_SIZE(devices
));
329 spi_register_board_info(palmz71_boardinfo
,
330 ARRAY_SIZE(palmz71_boardinfo
));
331 omap1_usb_init(&palmz71_usb_config
);
333 omap_register_i2c_bus(1, 100, NULL
, 0);
334 palmz71_gpio_setup(0);
338 omap_palmz71_map_io(void)
340 omap1_map_common_io();
343 MACHINE_START(OMAP_PALMZ71
, "OMAP310 based Palm Zire71")
344 .atag_offset
= 0x100,
345 .map_io
= omap_palmz71_map_io
,
346 .reserve
= omap_reserve
,
347 .init_irq
= omap_palmz71_init_irq
,
348 .init_machine
= omap_palmz71_init
,
349 .timer
= &omap1_timer
,