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>
28 #include <linux/mtd/physmap.h>
30 #include <mach/hardware.h>
31 #include <asm/mach-types.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/map.h>
35 #include <mach/gpio.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();
68 static int palmz71_keymap
[] = {
79 KEY(2, 0, KEY_CAMERA
),
83 static struct omap_kp_platform_data palmz71_kp_data
= {
86 .keymap
= palmz71_keymap
,
91 static struct resource palmz71_kp_resources
[] = {
93 .start
= INT_KEYBOARD
,
95 .flags
= IORESOURCE_IRQ
,
99 static struct platform_device palmz71_kp_device
= {
100 .name
= "omap-keypad",
103 .platform_data
= &palmz71_kp_data
,
105 .num_resources
= ARRAY_SIZE(palmz71_kp_resources
),
106 .resource
= palmz71_kp_resources
,
109 static struct mtd_partition palmz71_rom_partitions
[] = {
110 /* PalmOS "Small ROM", contains the bootloader and the debugger */
115 .mask_flags
= MTD_WRITEABLE
,
117 /* PalmOS "Big ROM", a filesystem with all the OS code and data */
122 * 0x5f0000 bytes big in the multi-language ("EFIGS") version,
123 * 0x7b0000 bytes in the English-only ("enUS") version.
126 .mask_flags
= MTD_WRITEABLE
,
130 static struct physmap_flash_data palmz71_rom_data
= {
132 .set_vpp
= omap1_set_vpp
,
133 .parts
= palmz71_rom_partitions
,
134 .nr_parts
= ARRAY_SIZE(palmz71_rom_partitions
),
137 static struct resource palmz71_rom_resource
= {
138 .start
= OMAP_CS0_PHYS
,
139 .end
= OMAP_CS0_PHYS
+ SZ_8M
- 1,
140 .flags
= IORESOURCE_MEM
,
143 static struct platform_device palmz71_rom_device
= {
144 .name
= "physmap-flash",
147 .platform_data
= &palmz71_rom_data
,
150 .resource
= &palmz71_rom_resource
,
153 static struct platform_device palmz71_lcd_device
= {
154 .name
= "lcd_palmz71",
158 static struct omap_irda_config palmz71_irda_config
= {
159 .transceiver_cap
= IR_SIRMODE
,
160 .rx_channel
= OMAP_DMA_UART3_RX
,
161 .tx_channel
= OMAP_DMA_UART3_TX
,
162 .dest_start
= UART3_THR
,
163 .src_start
= UART3_RHR
,
168 static struct resource palmz71_irda_resources
[] = {
172 .flags
= IORESOURCE_IRQ
,
176 static struct platform_device palmz71_irda_device
= {
180 .platform_data
= &palmz71_irda_config
,
182 .num_resources
= ARRAY_SIZE(palmz71_irda_resources
),
183 .resource
= palmz71_irda_resources
,
186 static struct platform_device palmz71_spi_device
= {
187 .name
= "spi_palmz71",
191 static struct omap_backlight_config palmz71_backlight_config
= {
192 .default_intensity
= 0xa0,
195 static struct platform_device palmz71_backlight_device
= {
199 .platform_data
= &palmz71_backlight_config
,
203 static struct platform_device
*devices
[] __initdata
= {
207 &palmz71_irda_device
,
209 &palmz71_backlight_device
,
213 palmz71_get_pendown_state(void)
215 return !gpio_get_value(PALMZ71_PENIRQ_GPIO
);
218 static const struct ads7846_platform_data palmz71_ts_info
= {
220 .vref_delay_usecs
= 100, /* internal, no capacitor */
223 .get_pendown_state
= palmz71_get_pendown_state
,
226 static struct spi_board_info __initdata palmz71_boardinfo
[] = { {
227 /* MicroWire (bus 2) CS0 has an ads7846e */
228 .modalias
= "ads7846",
229 .platform_data
= &palmz71_ts_info
,
230 .irq
= OMAP_GPIO_IRQ(PALMZ71_PENIRQ_GPIO
),
231 .max_speed_hz
= 120000 /* max sample rate at 3V */
232 * 26 /* command + data + overhead */,
237 static struct omap_usb_config palmz71_usb_config __initdata
= {
238 .register_dev
= 1, /* Mini-B only receptacle */
243 static struct omap_lcd_config palmz71_lcd_config __initdata
= {
244 .ctrl_name
= "internal",
247 static struct omap_board_config_kernel palmz71_config
[] __initdata
= {
248 {OMAP_TAG_LCD
, &palmz71_lcd_config
},
252 palmz71_powercable(int irq
, void *dev_id
)
254 if (gpio_get_value(PALMZ71_USBDETECT_GPIO
)) {
255 printk(KERN_INFO
"PM: Power cable connected\n");
256 set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO
),
257 IRQ_TYPE_EDGE_FALLING
);
259 printk(KERN_INFO
"PM: Power cable disconnected\n");
260 set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO
),
261 IRQ_TYPE_EDGE_RISING
);
267 omap_mpu_wdt_mode(int mode
)
270 omap_writew(0x8000, OMAP_WDT_TIMER_MODE
);
272 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE
);
273 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE
);
278 palmz71_gpio_setup(int early
)
281 /* Only set GPIO1 so we have a working serial */
282 gpio_direction_output(1, 1);
284 /* Set MMC/SD host WP pin as input */
285 if (gpio_request(PALMZ71_MMC_WP_GPIO
, "MMC WP") < 0) {
286 printk(KERN_ERR
"Could not reserve WP GPIO!\n");
289 gpio_direction_input(PALMZ71_MMC_WP_GPIO
);
291 /* Monitor the Power-cable-connected signal */
292 if (gpio_request(PALMZ71_USBDETECT_GPIO
, "USB detect") < 0) {
294 "Could not reserve cable signal GPIO!\n");
297 gpio_direction_input(PALMZ71_USBDETECT_GPIO
);
298 if (request_irq(gpio_to_irq(PALMZ71_USBDETECT_GPIO
),
299 palmz71_powercable
, IRQF_SAMPLE_RANDOM
,
302 "IRQ request for power cable failed!\n");
303 palmz71_powercable(gpio_to_irq(PALMZ71_USBDETECT_GPIO
), 0);
308 omap_palmz71_init(void)
310 /* mux pins for uarts */
311 omap_cfg_reg(UART1_TX
);
312 omap_cfg_reg(UART1_RTS
);
313 omap_cfg_reg(UART2_TX
);
314 omap_cfg_reg(UART2_RTS
);
315 omap_cfg_reg(UART3_TX
);
316 omap_cfg_reg(UART3_RX
);
318 palmz71_gpio_setup(1);
319 omap_mpu_wdt_mode(0);
321 omap_board_config
= palmz71_config
;
322 omap_board_config_size
= ARRAY_SIZE(palmz71_config
);
324 platform_add_devices(devices
, ARRAY_SIZE(devices
));
326 spi_register_board_info(palmz71_boardinfo
,
327 ARRAY_SIZE(palmz71_boardinfo
));
328 omap1_usb_init(&palmz71_usb_config
);
330 omap_register_i2c_bus(1, 100, NULL
, 0);
331 palmz71_gpio_setup(0);
335 omap_palmz71_map_io(void)
337 omap1_map_common_io();
340 MACHINE_START(OMAP_PALMZ71
, "OMAP310 based Palm Zire71")
341 .phys_io
= 0xfff00000,
342 .io_pg_offst
= ((0xfef00000) >> 18) & 0xfffc,
343 .boot_params
= 0x10000100,
344 .map_io
= omap_palmz71_map_io
,
345 .reserve
= omap_reserve
,
346 .init_irq
= omap_palmz71_init_irq
,
347 .init_machine
= omap_palmz71_init
,
348 .timer
= &omap_timer
,