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 <asm/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 <asm/arch/mcbsp.h>
36 #include <asm/arch/gpio.h>
37 #include <asm/arch/mux.h>
38 #include <asm/arch/usb.h>
39 #include <asm/arch/dma.h>
40 #include <asm/arch/tc.h>
41 #include <asm/arch/board.h>
42 #include <asm/arch/irda.h>
43 #include <asm/arch/keypad.h>
44 #include <asm/arch/common.h>
45 #include <asm/arch/omap-alsa.h>
47 #include <linux/input.h>
48 #include <linux/spi/spi.h>
49 #include <linux/spi/ads7846.h>
52 omap_palmz71_init_irq(void)
54 omap1_init_common_hw();
59 static int palmz71_keymap
[] = {
69 KEY(1, 4, KEY_CENTER
),
70 KEY(2, 0, KEY_CAMERA
),
74 static struct omap_kp_platform_data palmz71_kp_data
= {
77 .keymap
= palmz71_keymap
,
82 static struct resource palmz71_kp_resources
[] = {
84 .start
= INT_KEYBOARD
,
86 .flags
= IORESOURCE_IRQ
,
90 static struct platform_device palmz71_kp_device
= {
91 .name
= "omap-keypad",
94 .platform_data
= &palmz71_kp_data
,
96 .num_resources
= ARRAY_SIZE(palmz71_kp_resources
),
97 .resource
= palmz71_kp_resources
,
100 static struct mtd_partition palmz71_rom_partitions
[] = {
101 /* PalmOS "Small ROM", contains the bootloader and the debugger */
106 .mask_flags
= MTD_WRITEABLE
,
108 /* PalmOS "Big ROM", a filesystem with all the OS code and data */
113 * 0x5f0000 bytes big in the multi-language ("EFIGS") version,
114 * 0x7b0000 bytes in the English-only ("enUS") version.
117 .mask_flags
= MTD_WRITEABLE
,
121 static struct flash_platform_data palmz71_rom_data
= {
122 .map_name
= "map_rom",
123 .name
= "onboardrom",
125 .parts
= palmz71_rom_partitions
,
126 .nr_parts
= ARRAY_SIZE(palmz71_rom_partitions
),
129 static struct resource palmz71_rom_resource
= {
130 .start
= OMAP_CS0_PHYS
,
131 .end
= OMAP_CS0_PHYS
+ SZ_8M
- 1,
132 .flags
= IORESOURCE_MEM
,
135 static struct platform_device palmz71_rom_device
= {
139 .platform_data
= &palmz71_rom_data
,
142 .resource
= &palmz71_rom_resource
,
145 static struct platform_device palmz71_lcd_device
= {
146 .name
= "lcd_palmz71",
150 static struct omap_irda_config palmz71_irda_config
= {
151 .transceiver_cap
= IR_SIRMODE
,
152 .rx_channel
= OMAP_DMA_UART3_RX
,
153 .tx_channel
= OMAP_DMA_UART3_TX
,
154 .dest_start
= UART3_THR
,
155 .src_start
= UART3_RHR
,
160 static struct resource palmz71_irda_resources
[] = {
164 .flags
= IORESOURCE_IRQ
,
168 static struct platform_device palmz71_irda_device
= {
172 .platform_data
= &palmz71_irda_config
,
174 .num_resources
= ARRAY_SIZE(palmz71_irda_resources
),
175 .resource
= palmz71_irda_resources
,
178 static struct platform_device palmz71_spi_device
= {
179 .name
= "spi_palmz71",
183 #define DEFAULT_BITPERSAMPLE 16
185 static struct omap_mcbsp_reg_cfg mcbsp_regs
= {
186 .spcr2
= FREE
| FRST
| GRST
| XRST
| XINTM(3),
187 .spcr1
= RINTM(3) | RRST
,
188 .rcr2
= RPHASE
| RFRLEN2(OMAP_MCBSP_WORD_8
) |
189 RWDLEN2(OMAP_MCBSP_WORD_16
) | RDATDLY(0),
190 .rcr1
= RFRLEN1(OMAP_MCBSP_WORD_8
) | RWDLEN1(OMAP_MCBSP_WORD_16
),
191 .xcr2
= XPHASE
| XFRLEN2(OMAP_MCBSP_WORD_8
) |
192 XWDLEN2(OMAP_MCBSP_WORD_16
) | XDATDLY(0) | XFIG
,
193 .xcr1
= XFRLEN1(OMAP_MCBSP_WORD_8
) | XWDLEN1(OMAP_MCBSP_WORD_16
),
194 .srgr1
= FWID(DEFAULT_BITPERSAMPLE
- 1),
195 .srgr2
= GSYNC
| CLKSP
| FSGM
| FPER(DEFAULT_BITPERSAMPLE
* 2 - 1),
196 .pcr0
= CLKXP
| CLKRP
, /* mcbsp: slave */
199 static struct omap_alsa_codec_config alsa_config
= {
200 .name
= "PalmZ71 AIC23",
201 .mcbsp_regs_alsa
= &mcbsp_regs
,
202 .codec_configure_dev
= NULL
, /* aic23_configure */
203 .codec_set_samplerate
= NULL
, /* aic23_set_samplerate */
204 .codec_clock_setup
= NULL
, /* aic23_clock_setup */
205 .codec_clock_on
= NULL
, /* aic23_clock_on */
206 .codec_clock_off
= NULL
, /* aic23_clock_off */
207 .get_default_samplerate
= NULL
, /* aic23_get_default_samplerate */
210 static struct platform_device palmz71_mcbsp1_device
= {
211 .name
= "omap_alsa_mcbsp",
214 .platform_data
= &alsa_config
,
218 static struct omap_backlight_config palmz71_backlight_config
= {
219 .default_intensity
= 0xa0,
222 static struct platform_device palmz71_backlight_device
= {
226 .platform_data
= &palmz71_backlight_config
,
230 static struct platform_device
*devices
[] __initdata
= {
233 &palmz71_mcbsp1_device
,
235 &palmz71_irda_device
,
237 &palmz71_backlight_device
,
241 palmz71_get_pendown_state(void)
243 return !omap_get_gpio_datain(PALMZ71_PENIRQ_GPIO
);
246 static const struct ads7846_platform_data palmz71_ts_info
= {
248 .vref_delay_usecs
= 100, /* internal, no capacitor */
251 .get_pendown_state
= palmz71_get_pendown_state
,
254 static struct spi_board_info __initdata palmz71_boardinfo
[] = { {
255 /* MicroWire (bus 2) CS0 has an ads7846e */
256 .modalias
= "ads7846",
257 .platform_data
= &palmz71_ts_info
,
258 .irq
= OMAP_GPIO_IRQ(PALMZ71_PENIRQ_GPIO
),
259 .max_speed_hz
= 120000 /* max sample rate at 3V */
260 * 26 /* command + data + overhead */,
265 static struct omap_usb_config palmz71_usb_config __initdata
= {
266 .register_dev
= 1, /* Mini-B only receptacle */
271 static struct omap_mmc_config palmz71_mmc_config __initdata
= {
275 .wp_pin
= PALMZ71_MMC_WP_GPIO
,
277 .switch_pin
= PALMZ71_MMC_IN_GPIO
,
281 static struct omap_lcd_config palmz71_lcd_config __initdata
= {
282 .ctrl_name
= "internal",
285 static struct omap_uart_config palmz71_uart_config __initdata
= {
286 .enabled_uarts
= (1 << 0) | (1 << 1) | (0 << 2),
289 static struct omap_board_config_kernel palmz71_config
[] = {
290 {OMAP_TAG_USB
, &palmz71_usb_config
},
291 {OMAP_TAG_MMC
, &palmz71_mmc_config
},
292 {OMAP_TAG_LCD
, &palmz71_lcd_config
},
293 {OMAP_TAG_UART
, &palmz71_uart_config
},
297 palmz71_powercable(int irq
, void *dev_id
)
299 if (omap_get_gpio_datain(PALMZ71_USBDETECT_GPIO
)) {
300 printk(KERN_INFO
"PM: Power cable connected\n");
301 set_irq_type(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO
),
304 printk(KERN_INFO
"PM: Power cable disconnected\n");
305 set_irq_type(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO
),
312 omap_mpu_wdt_mode(int mode
)
315 omap_writew(0x8000, OMAP_WDT_TIMER_MODE
);
317 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE
);
318 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE
);
323 palmz71_gpio_setup(int early
)
326 /* Only set GPIO1 so we have a working serial */
327 omap_set_gpio_dataout(1, 1);
328 omap_set_gpio_direction(1, 0);
330 /* Set MMC/SD host WP pin as input */
331 if (omap_request_gpio(PALMZ71_MMC_WP_GPIO
)) {
332 printk(KERN_ERR
"Could not reserve WP GPIO!\n");
335 omap_set_gpio_direction(PALMZ71_MMC_WP_GPIO
, 1);
337 /* Monitor the Power-cable-connected signal */
338 if (omap_request_gpio(PALMZ71_USBDETECT_GPIO
)) {
340 "Could not reserve cable signal GPIO!\n");
343 omap_set_gpio_direction(PALMZ71_USBDETECT_GPIO
, 1);
344 if (request_irq(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO
),
345 palmz71_powercable
, IRQF_SAMPLE_RANDOM
,
348 "IRQ request for power cable failed!\n");
349 palmz71_powercable(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO
), 0);
354 omap_palmz71_init(void)
356 palmz71_gpio_setup(1);
357 omap_mpu_wdt_mode(0);
359 omap_board_config
= palmz71_config
;
360 omap_board_config_size
= ARRAY_SIZE(palmz71_config
);
362 platform_add_devices(devices
, ARRAY_SIZE(devices
));
364 spi_register_board_info(palmz71_boardinfo
,
365 ARRAY_SIZE(palmz71_boardinfo
));
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
,