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/kernel.h>
19 #include <linux/init.h>
20 #include <linux/platform_device.h>
21 #include <linux/notifier.h>
22 #include <linux/clk.h>
23 #include <linux/irq.h>
24 #include <linux/input.h>
25 #include <linux/interrupt.h>
26 #include <linux/mtd/mtd.h>
27 #include <linux/mtd/partitions.h>
29 #include <mach/hardware.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/map.h>
33 #include <asm/mach/flash.h>
35 #include <mach/gpio.h>
40 #include <mach/board.h>
41 #include <mach/irda.h>
42 #include <mach/keypad.h>
43 #include <mach/common.h>
44 #include <mach/omap-alsa.h>
46 #include <linux/spi/spi.h>
47 #include <linux/spi/ads7846.h>
50 omap_palmz71_init_irq(void)
52 omap1_init_common_hw();
57 static int palmz71_keymap[] = {
68 KEY(2, 0, KEY_CAMERA),
72 static struct omap_kp_platform_data palmz71_kp_data = {
75 .keymap = palmz71_keymap,
80 static struct resource palmz71_kp_resources[] = {
82 .start = INT_KEYBOARD,
84 .flags = IORESOURCE_IRQ,
88 static struct platform_device palmz71_kp_device = {
89 .name = "omap-keypad",
92 .platform_data = &palmz71_kp_data,
94 .num_resources = ARRAY_SIZE(palmz71_kp_resources),
95 .resource = palmz71_kp_resources,
98 static struct mtd_partition palmz71_rom_partitions[] = {
99 /* PalmOS "Small ROM", contains the bootloader and the debugger */
104 .mask_flags = MTD_WRITEABLE,
106 /* PalmOS "Big ROM", a filesystem with all the OS code and data */
111 * 0x5f0000 bytes big in the multi-language ("EFIGS") version,
112 * 0x7b0000 bytes in the English-only ("enUS") version.
115 .mask_flags = MTD_WRITEABLE,
119 static struct flash_platform_data palmz71_rom_data = {
120 .map_name = "map_rom",
121 .name = "onboardrom",
123 .parts = palmz71_rom_partitions,
124 .nr_parts = ARRAY_SIZE(palmz71_rom_partitions),
127 static struct resource palmz71_rom_resource = {
128 .start = OMAP_CS0_PHYS,
129 .end = OMAP_CS0_PHYS + SZ_8M - 1,
130 .flags = IORESOURCE_MEM,
133 static struct platform_device palmz71_rom_device = {
137 .platform_data = &palmz71_rom_data,
140 .resource = &palmz71_rom_resource,
143 static struct platform_device palmz71_lcd_device = {
144 .name = "lcd_palmz71",
148 static struct omap_irda_config palmz71_irda_config = {
149 .transceiver_cap = IR_SIRMODE,
150 .rx_channel = OMAP_DMA_UART3_RX,
151 .tx_channel = OMAP_DMA_UART3_TX,
152 .dest_start = UART3_THR,
153 .src_start = UART3_RHR,
158 static struct resource palmz71_irda_resources[] = {
162 .flags = IORESOURCE_IRQ,
166 static struct platform_device palmz71_irda_device = {
170 .platform_data = &palmz71_irda_config,
172 .num_resources = ARRAY_SIZE(palmz71_irda_resources),
173 .resource = palmz71_irda_resources,
176 static struct platform_device palmz71_spi_device = {
177 .name = "spi_palmz71",
181 static struct omap_backlight_config palmz71_backlight_config = {
182 .default_intensity = 0xa0,
185 static struct platform_device palmz71_backlight_device = {
189 .platform_data = &palmz71_backlight_config,
193 static struct platform_device *devices[] __initdata = {
197 &palmz71_irda_device,
199 &palmz71_backlight_device,
203 palmz71_get_pendown_state(void)
205 return !gpio_get_value(PALMZ71_PENIRQ_GPIO);
208 static const struct ads7846_platform_data palmz71_ts_info = {
210 .vref_delay_usecs = 100, /* internal, no capacitor */
213 .get_pendown_state = palmz71_get_pendown_state,
216 static struct spi_board_info __initdata palmz71_boardinfo[] = { {
217 /* MicroWire (bus 2) CS0 has an ads7846e */
218 .modalias = "ads7846",
219 .platform_data = &palmz71_ts_info,
220 .irq = OMAP_GPIO_IRQ(PALMZ71_PENIRQ_GPIO),
221 .max_speed_hz = 120000 /* max sample rate at 3V */
222 * 26 /* command + data + overhead */,
227 static struct omap_usb_config palmz71_usb_config __initdata = {
228 .register_dev = 1, /* Mini-B only receptacle */
233 static struct omap_lcd_config palmz71_lcd_config __initdata = {
234 .ctrl_name = "internal",
237 static struct omap_uart_config palmz71_uart_config __initdata = {
238 .enabled_uarts = (1 << 0) | (1 << 1) | (0 << 2),
241 static struct omap_board_config_kernel palmz71_config[] __initdata = {
242 {OMAP_TAG_USB, &palmz71_usb_config},
243 {OMAP_TAG_LCD, &palmz71_lcd_config},
244 {OMAP_TAG_UART, &palmz71_uart_config},
248 palmz71_powercable(int irq, void *dev_id)
250 if (gpio_get_value(PALMZ71_USBDETECT_GPIO)) {
251 printk(KERN_INFO "PM: Power cable connected\n");
252 set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
253 IRQ_TYPE_EDGE_FALLING);
255 printk(KERN_INFO "PM: Power cable disconnected\n");
256 set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
257 IRQ_TYPE_EDGE_RISING);
263 omap_mpu_wdt_mode(int mode)
266 omap_writew(0x8000, OMAP_WDT_TIMER_MODE);
268 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE);
269 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE);
274 palmz71_gpio_setup(int early)
277 /* Only set GPIO1 so we have a working serial */
278 gpio_direction_output(1, 1);
280 /* Set MMC/SD host WP pin as input */
281 if (gpio_request(PALMZ71_MMC_WP_GPIO, "MMC WP") < 0) {
282 printk(KERN_ERR "Could not reserve WP GPIO!\n");
285 gpio_direction_input(PALMZ71_MMC_WP_GPIO);
287 /* Monitor the Power-cable-connected signal */
288 if (gpio_request(PALMZ71_USBDETECT_GPIO, "USB detect") < 0) {
290 "Could not reserve cable signal GPIO!\n");
293 gpio_direction_input(PALMZ71_USBDETECT_GPIO);
294 if (request_irq(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
295 palmz71_powercable, IRQF_SAMPLE_RANDOM,
298 "IRQ request for power cable failed!\n");
299 palmz71_powercable(gpio_to_irq(PALMZ71_USBDETECT_GPIO), 0);
304 omap_palmz71_init(void)
306 palmz71_gpio_setup(1);
307 omap_mpu_wdt_mode(0);
309 omap_board_config = palmz71_config;
310 omap_board_config_size = ARRAY_SIZE(palmz71_config);
312 platform_add_devices(devices, ARRAY_SIZE(devices));
314 spi_register_board_info(palmz71_boardinfo,
315 ARRAY_SIZE(palmz71_boardinfo));
317 omap_register_i2c_bus(1, 100, NULL, 0);
318 palmz71_gpio_setup(0);
322 omap_palmz71_map_io(void)
324 omap1_map_common_io();
327 MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
328 .phys_io = 0xfff00000,
329 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
330 .boot_params = 0x10000100,.map_io = omap_palmz71_map_io,
331 .init_irq = omap_palmz71_init_irq,
332 .init_machine = omap_palmz71_init,
333 .timer = &omap_timer,