aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/board-palmtt.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap1/board-palmtt.c')
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c357
1 files changed, 357 insertions, 0 deletions
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
new file mode 100644
index 000000000000..e47010fec275
--- /dev/null
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -0,0 +1,357 @@
1/*
2 * linux/arch/arm/mach-omap1/board-palmtt.c
3 *
4 * Modified from board-palmtt2.c
5 *
6 * Modified and amended for Palm Tungsten|T
7 * by Marek Vasut <marek.vasut@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/delay.h>
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/notifier.h>
19#include <linux/clk.h>
20#include <linux/input.h>
21#include <linux/interrupt.h>
22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h>
24#include <linux/leds.h>
25
26#include <asm/hardware.h>
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30#include <asm/mach/flash.h>
31
32#include <asm/arch/led.h>
33#include <asm/arch/mcbsp.h>
34#include <asm/arch/gpio.h>
35#include <asm/arch/mux.h>
36#include <asm/arch/usb.h>
37#include <asm/arch/dma.h>
38#include <asm/arch/tc.h>
39#include <asm/arch/board.h>
40#include <asm/arch/irda.h>
41#include <asm/arch/keypad.h>
42#include <asm/arch/common.h>
43#include <asm/arch/omap-alsa.h>
44
45#include <linux/input.h>
46#include <linux/spi/spi.h>
47#include <linux/spi/ads7846.h>
48
49static int palmtt_keymap[] = {
50 KEY(0, 0, KEY_ESC),
51 KEY(0, 1, KEY_SPACE),
52 KEY(0, 2, KEY_LEFTCTRL),
53 KEY(0, 3, KEY_TAB),
54 KEY(0, 4, KEY_ENTER),
55 KEY(1, 0, KEY_LEFT),
56 KEY(1, 1, KEY_DOWN),
57 KEY(1, 2, KEY_UP),
58 KEY(1, 3, KEY_RIGHT),
59 KEY(2, 0, KEY_SLEEP),
60 KEY(2, 4, KEY_Y),
61 0
62};
63
64static struct mtd_partition palmtt_partitions[] = {
65 {
66 .name = "write8k",
67 .offset = 0,
68 .size = SZ_8K,
69 .mask_flags = 0,
70 },
71 {
72 .name = "PalmOS-BootLoader(ro)",
73 .offset = SZ_8K,
74 .size = 7 * SZ_8K,
75 .mask_flags = MTD_WRITEABLE,
76 },
77 {
78 .name = "u-boot",
79 .offset = MTDPART_OFS_APPEND,
80 .size = 8 * SZ_8K,
81 .mask_flags = 0,
82 },
83 {
84 .name = "PalmOS-FS(ro)",
85 .offset = MTDPART_OFS_APPEND,
86 .size = 7 * SZ_1M + 4 * SZ_64K - 16 * SZ_8K,
87 .mask_flags = MTD_WRITEABLE,
88 },
89 {
90 .name = "u-boot(rez)",
91 .offset = MTDPART_OFS_APPEND,
92 .size = SZ_128K,
93 .mask_flags = 0
94 },
95 {
96 .name = "empty",
97 .offset = MTDPART_OFS_APPEND,
98 .size = MTDPART_SIZ_FULL,
99 .mask_flags = 0
100 }
101};
102
103static struct flash_platform_data palmtt_flash_data = {
104 .map_name = "cfi_probe",
105 .width = 2,
106 .parts = palmtt_partitions,
107 .nr_parts = ARRAY_SIZE(palmtt_partitions),
108};
109
110static struct resource palmtt_flash_resource = {
111 .start = OMAP_CS0_PHYS,
112 .end = OMAP_CS0_PHYS + SZ_8M - 1,
113 .flags = IORESOURCE_MEM,
114};
115
116static struct platform_device palmtt_flash_device = {
117 .name = "omapflash",
118 .id = 0,
119 .dev = {
120 .platform_data = &palmtt_flash_data,
121 },
122 .num_resources = 1,
123 .resource = &palmtt_flash_resource,
124};
125
126#define DEFAULT_BITPERSAMPLE 16
127
128static struct omap_mcbsp_reg_cfg mcbsp_regs = {
129 .spcr2 = FREE | FRST | GRST | XRST | XINTM(3),
130 .spcr1 = RINTM(3) | RRST,
131 .rcr2 = RPHASE | RFRLEN2(OMAP_MCBSP_WORD_8) |
132 RWDLEN2(OMAP_MCBSP_WORD_16) | RDATDLY(0),
133 .rcr1 = RFRLEN1(OMAP_MCBSP_WORD_8) |
134 RWDLEN1(OMAP_MCBSP_WORD_16),
135 .xcr2 = XPHASE | XFRLEN2(OMAP_MCBSP_WORD_8) |
136 XWDLEN2(OMAP_MCBSP_WORD_16) | XDATDLY(0) | XFIG,
137 .xcr1 = XFRLEN1(OMAP_MCBSP_WORD_8) |
138 XWDLEN1(OMAP_MCBSP_WORD_16),
139 .srgr1 = FWID(DEFAULT_BITPERSAMPLE - 1),
140 .srgr2 = GSYNC | CLKSP | FSGM |
141 FPER(DEFAULT_BITPERSAMPLE * 2 - 1),
142 .pcr0 = CLKXP | CLKRP, /* mcbsp: slave */
143};
144
145static struct omap_alsa_codec_config alsa_config = {
146 .name = "PalmTT AIC23",
147 .mcbsp_regs_alsa = &mcbsp_regs,
148 .codec_configure_dev = NULL, // aic23_configure,
149 .codec_set_samplerate = NULL, // aic23_set_samplerate,
150 .codec_clock_setup = NULL, // aic23_clock_setup,
151 .codec_clock_on = NULL, // aic23_clock_on,
152 .codec_clock_off = NULL, // aic23_clock_off,
153 .get_default_samplerate = NULL, // aic23_get_default_samplerate,
154};
155
156static struct platform_device palmtt_mcbsp1_device = {
157 .name = "omap_alsa_mcbsp",
158 .id = 1,
159 .dev = {
160 .platform_data = &alsa_config,
161 },
162};
163
164static struct resource palmtt_kp_resources[] = {
165 [0] = {
166 .start = INT_KEYBOARD,
167 .end = INT_KEYBOARD,
168 .flags = IORESOURCE_IRQ,
169 },
170};
171
172static struct omap_kp_platform_data palmtt_kp_data = {
173 .rows = 6,
174 .cols = 3,
175 .keymap = palmtt_keymap,
176};
177
178static struct platform_device palmtt_kp_device = {
179 .name = "omap-keypad",
180 .id = -1,
181 .dev = {
182 .platform_data = &palmtt_kp_data,
183 },
184 .num_resources = ARRAY_SIZE(palmtt_kp_resources),
185 .resource = palmtt_kp_resources,
186};
187
188static struct platform_device palmtt_lcd_device = {
189 .name = "lcd_palmtt",
190 .id = -1,
191};
192static struct omap_irda_config palmtt_irda_config = {
193 .transceiver_cap = IR_SIRMODE,
194 .rx_channel = OMAP_DMA_UART3_RX,
195 .tx_channel = OMAP_DMA_UART3_TX,
196 .dest_start = UART3_THR,
197 .src_start = UART3_RHR,
198 .tx_trigger = 0,
199 .rx_trigger = 0,
200};
201
202static struct resource palmtt_irda_resources[] = {
203 [0] = {
204 .start = INT_UART3,
205 .end = INT_UART3,
206 .flags = IORESOURCE_IRQ,
207 },
208};
209
210static struct platform_device palmtt_irda_device = {
211 .name = "omapirda",
212 .id = -1,
213 .dev = {
214 .platform_data = &palmtt_irda_config,
215 },
216 .num_resources = ARRAY_SIZE(palmtt_irda_resources),
217 .resource = palmtt_irda_resources,
218};
219
220static struct platform_device palmtt_spi_device = {
221 .name = "spi_palmtt",
222 .id = -1,
223};
224
225static struct omap_backlight_config palmtt_backlight_config = {
226 .default_intensity = 0xa0,
227};
228
229static struct platform_device palmtt_backlight_device = {
230 .name = "omap-bl",
231 .id = -1,
232 .dev = {
233 .platform_data= &palmtt_backlight_config,
234 },
235};
236
237static struct omap_led_config palmtt_led_config[] = {
238 {
239 .cdev = {
240 .name = "palmtt:led0",
241 },
242 .gpio = PALMTT_LED_GPIO,
243 },
244};
245
246static struct omap_led_platform_data palmtt_led_data = {
247 .nr_leds = ARRAY_SIZE(palmtt_led_config),
248 .leds = palmtt_led_config,
249};
250
251static struct platform_device palmtt_led_device = {
252 .name = "omap-led",
253 .id = -1,
254 .dev = {
255 .platform_data = &palmtt_led_data,
256 },
257};
258
259static struct platform_device *palmtt_devices[] __initdata = {
260 &palmtt_flash_device,
261 &palmtt_mcbsp1_device,
262 &palmtt_kp_device,
263 &palmtt_lcd_device,
264 &palmtt_irda_device,
265 &palmtt_spi_device,
266 &palmtt_backlight_device,
267 &palmtt_led_device,
268};
269
270static int palmtt_get_pendown_state(void)
271{
272 return !omap_get_gpio_datain(6);
273}
274
275static const struct ads7846_platform_data palmtt_ts_info = {
276 .model = 7846,
277 .vref_delay_usecs = 100, /* internal, no capacitor */
278 .x_plate_ohms = 419,
279 .y_plate_ohms = 486,
280 .get_pendown_state = palmtt_get_pendown_state,
281};
282
283static struct spi_board_info __initdata palmtt_boardinfo[] = {
284 {
285 /* MicroWire (bus 2) CS0 has an ads7846e */
286 .modalias = "ads7846",
287 .platform_data = &palmtt_ts_info,
288 .irq = OMAP_GPIO_IRQ(6),
289 .max_speed_hz = 120000 /* max sample rate at 3V */
290 * 26 /* command + data + overhead */,
291 .bus_num = 2,
292 .chip_select = 0,
293 }
294};
295
296static void __init omap_palmtt_init_irq(void)
297{
298 omap1_init_common_hw();
299 omap_init_irq();
300}
301
302static struct omap_usb_config palmtt_usb_config __initdata = {
303 .register_dev = 1,
304 .hmc_mode = 0,
305 .pins[0] = 2,
306};
307
308static struct omap_lcd_config palmtt_lcd_config __initdata = {
309 .ctrl_name = "internal",
310};
311
312static struct omap_uart_config palmtt_uart_config __initdata = {
313 .enabled_uarts = (1 << 0) | (1 << 1) | (0 << 2),
314};
315
316static struct omap_board_config_kernel palmtt_config[] = {
317 { OMAP_TAG_USB, &palmtt_usb_config },
318 { OMAP_TAG_LCD, &palmtt_lcd_config },
319 { OMAP_TAG_UART, &palmtt_uart_config },
320};
321
322static void __init omap_mpu_wdt_mode(int mode) {
323 if (mode)
324 omap_writew(0x8000, OMAP_WDT_TIMER_MODE);
325 else {
326 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE);
327 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE);
328 }
329}
330
331static void __init omap_palmtt_init(void)
332{
333 omap_mpu_wdt_mode(0);
334
335 omap_board_config = palmtt_config;
336 omap_board_config_size = ARRAY_SIZE(palmtt_config);
337
338 platform_add_devices(palmtt_devices, ARRAY_SIZE(palmtt_devices));
339
340 spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo));
341 omap_serial_init();
342}
343
344static void __init omap_palmtt_map_io(void)
345{
346 omap1_map_common_io();
347}
348
349MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
350 .phys_io = 0xfff00000,
351 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
352 .boot_params = 0x10000100,
353 .map_io = omap_palmtt_map_io,
354 .init_irq = omap_palmtt_init_irq,
355 .init_machine = omap_palmtt_init,
356 .timer = &omap_timer,
357MACHINE_END