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/mcbsp.h>
36 #include <mach/gpio.h>
41 #include <mach/board.h>
42 #include <mach/irda.h>
43 #include <mach/keypad.h>
44 #include <mach/common.h>
45 #include <mach/omap-alsa.h>
47 #include <linux/spi/spi.h>
48 #include <linux/spi/ads7846.h>
51 omap_palmz71_init_irq(void)
53 omap1_init_common_hw();
58 static int palmz71_keymap[] = {
69 KEY(2, 0, KEY_CAMERA),
73 static struct omap_kp_platform_data palmz71_kp_data = {
76 .keymap = palmz71_keymap,
81 static struct resource palmz71_kp_resources[] = {
83 .start = INT_KEYBOARD,
85 .flags = IORESOURCE_IRQ,
89 static struct platform_device palmz71_kp_device = {
90 .name = "omap-keypad",
93 .platform_data = &palmz71_kp_data,
95 .num_resources = ARRAY_SIZE(palmz71_kp_resources),
96 .resource = palmz71_kp_resources,
99 static struct mtd_partition palmz71_rom_partitions[] = {
100 /* PalmOS "Small ROM", contains the bootloader and the debugger */
105 .mask_flags = MTD_WRITEABLE,
107 /* PalmOS "Big ROM", a filesystem with all the OS code and data */
112 * 0x5f0000 bytes big in the multi-language ("EFIGS") version,
113 * 0x7b0000 bytes in the English-only ("enUS") version.
116 .mask_flags = MTD_WRITEABLE,
120 static struct flash_platform_data palmz71_rom_data = {
121 .map_name = "map_rom",
122 .name = "onboardrom",
124 .parts = palmz71_rom_partitions,
125 .nr_parts = ARRAY_SIZE(palmz71_rom_partitions),
128 static struct resource palmz71_rom_resource = {
129 .start = OMAP_CS0_PHYS,
130 .end = OMAP_CS0_PHYS + SZ_8M - 1,
131 .flags = IORESOURCE_MEM,
134 static struct platform_device palmz71_rom_device = {
138 .platform_data = &palmz71_rom_data,
141 .resource = &palmz71_rom_resource,
144 static struct platform_device palmz71_lcd_device = {
145 .name = "lcd_palmz71",
149 static struct omap_irda_config palmz71_irda_config = {
150 .transceiver_cap = IR_SIRMODE,
151 .rx_channel = OMAP_DMA_UART3_RX,
152 .tx_channel = OMAP_DMA_UART3_TX,
153 .dest_start = UART3_THR,
154 .src_start = UART3_RHR,
159 static struct resource palmz71_irda_resources[] = {
163 .flags = IORESOURCE_IRQ,
167 static struct platform_device palmz71_irda_device = {
171 .platform_data = &palmz71_irda_config,
173 .num_resources = ARRAY_SIZE(palmz71_irda_resources),
174 .resource = palmz71_irda_resources,
177 static struct platform_device palmz71_spi_device = {
178 .name = "spi_palmz71",
182 #define DEFAULT_BITPERSAMPLE 16
184 static struct omap_mcbsp_reg_cfg mcbsp_regs = {
185 .spcr2 = FREE | FRST | GRST | XRST | XINTM(3),
186 .spcr1 = RINTM(3) | RRST,
187 .rcr2 = RPHASE | RFRLEN2(OMAP_MCBSP_WORD_8) |
188 RWDLEN2(OMAP_MCBSP_WORD_16) | RDATDLY(0),
189 .rcr1 = RFRLEN1(OMAP_MCBSP_WORD_8) | RWDLEN1(OMAP_MCBSP_WORD_16),
190 .xcr2 = XPHASE | XFRLEN2(OMAP_MCBSP_WORD_8) |
191 XWDLEN2(OMAP_MCBSP_WORD_16) | XDATDLY(0) | XFIG,
192 .xcr1 = XFRLEN1(OMAP_MCBSP_WORD_8) | XWDLEN1(OMAP_MCBSP_WORD_16),
193 .srgr1 = FWID(DEFAULT_BITPERSAMPLE - 1),
194 .srgr2 = GSYNC | CLKSP | FSGM | FPER(DEFAULT_BITPERSAMPLE * 2 - 1),
195 .pcr0 = CLKXP | CLKRP, /* mcbsp: slave */
198 static struct omap_alsa_codec_config alsa_config = {
199 .name = "PalmZ71 AIC23",
200 .mcbsp_regs_alsa = &mcbsp_regs,
201 .codec_configure_dev = NULL, /* aic23_configure */
202 .codec_set_samplerate = NULL, /* aic23_set_samplerate */
203 .codec_clock_setup = NULL, /* aic23_clock_setup */
204 .codec_clock_on = NULL, /* aic23_clock_on */
205 .codec_clock_off = NULL, /* aic23_clock_off */
206 .get_default_samplerate = NULL, /* aic23_get_default_samplerate */
209 static struct platform_device palmz71_mcbsp1_device = {
210 .name = "omap_alsa_mcbsp",
213 .platform_data = &alsa_config,
217 static struct omap_backlight_config palmz71_backlight_config = {
218 .default_intensity = 0xa0,
221 static struct platform_device palmz71_backlight_device = {
225 .platform_data = &palmz71_backlight_config,
229 static struct platform_device *devices[] __initdata = {
232 &palmz71_mcbsp1_device,
234 &palmz71_irda_device,
236 &palmz71_backlight_device,
240 palmz71_get_pendown_state(void)
242 return !omap_get_gpio_datain(PALMZ71_PENIRQ_GPIO);
245 static const struct ads7846_platform_data palmz71_ts_info = {
247 .vref_delay_usecs = 100, /* internal, no capacitor */
250 .get_pendown_state = palmz71_get_pendown_state,
253 static struct spi_board_info __initdata palmz71_boardinfo[] = { {
254 /* MicroWire (bus 2) CS0 has an ads7846e */
255 .modalias = "ads7846",
256 .platform_data = &palmz71_ts_info,
257 .irq = OMAP_GPIO_IRQ(PALMZ71_PENIRQ_GPIO),
258 .max_speed_hz = 120000 /* max sample rate at 3V */
259 * 26 /* command + data + overhead */,
264 static struct omap_usb_config palmz71_usb_config __initdata = {
265 .register_dev = 1, /* Mini-B only receptacle */
270 static struct omap_mmc_config palmz71_mmc_config __initdata = {
274 .wp_pin = PALMZ71_MMC_WP_GPIO,
276 .switch_pin = PALMZ71_MMC_IN_GPIO,
280 static struct omap_lcd_config palmz71_lcd_config __initdata = {
281 .ctrl_name = "internal",
284 static struct omap_uart_config palmz71_uart_config __initdata = {
285 .enabled_uarts = (1 << 0) | (1 << 1) | (0 << 2),
288 static struct omap_board_config_kernel palmz71_config[] __initdata = {
289 {OMAP_TAG_USB, &palmz71_usb_config},
290 {OMAP_TAG_MMC, &palmz71_mmc_config},
291 {OMAP_TAG_LCD, &palmz71_lcd_config},
292 {OMAP_TAG_UART, &palmz71_uart_config},
296 palmz71_powercable(int irq, void *dev_id)
298 if (omap_get_gpio_datain(PALMZ71_USBDETECT_GPIO)) {
299 printk(KERN_INFO "PM: Power cable connected\n");
300 set_irq_type(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO),
301 IRQ_TYPE_EDGE_FALLING);
303 printk(KERN_INFO "PM: Power cable disconnected\n");
304 set_irq_type(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO),
305 IRQ_TYPE_EDGE_RISING);
311 omap_mpu_wdt_mode(int mode)
314 omap_writew(0x8000, OMAP_WDT_TIMER_MODE);
316 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE);
317 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE);
322 palmz71_gpio_setup(int early)
325 /* Only set GPIO1 so we have a working serial */
326 omap_set_gpio_dataout(1, 1);
327 omap_set_gpio_direction(1, 0);
329 /* Set MMC/SD host WP pin as input */
330 if (omap_request_gpio(PALMZ71_MMC_WP_GPIO)) {
331 printk(KERN_ERR "Could not reserve WP GPIO!\n");
334 omap_set_gpio_direction(PALMZ71_MMC_WP_GPIO, 1);
336 /* Monitor the Power-cable-connected signal */
337 if (omap_request_gpio(PALMZ71_USBDETECT_GPIO)) {
339 "Could not reserve cable signal GPIO!\n");
342 omap_set_gpio_direction(PALMZ71_USBDETECT_GPIO, 1);
343 if (request_irq(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO),
344 palmz71_powercable, IRQF_SAMPLE_RANDOM,
347 "IRQ request for power cable failed!\n");
348 palmz71_powercable(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO), 0);
353 omap_palmz71_init(void)
355 palmz71_gpio_setup(1);
356 omap_mpu_wdt_mode(0);
358 omap_board_config = palmz71_config;
359 omap_board_config_size = ARRAY_SIZE(palmz71_config);
361 platform_add_devices(devices, ARRAY_SIZE(devices));
363 spi_register_board_info(palmz71_boardinfo,
364 ARRAY_SIZE(palmz71_boardinfo));
366 omap_register_i2c_bus(1, 100, NULL, 0);
367 palmz71_gpio_setup(0);
371 omap_palmz71_map_io(void)
373 omap1_map_common_io();
376 MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
377 .phys_io = 0xfff00000,
378 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
379 .boot_params = 0x10000100,.map_io = omap_palmz71_map_io,
380 .init_irq = omap_palmz71_init_irq,
381 .init_machine = omap_palmz71_init,
382 .timer = &omap_timer,