diff options
author | Marek Vasut <marek.vasut@gmail.com> | 2008-11-19 18:58:38 -0500 |
---|---|---|
committer | Eric Miao <eric.miao@marvell.com> | 2009-01-21 02:06:34 -0500 |
commit | 0f6ff0f06cc126e8dfaa20c8c6da53537e352378 (patch) | |
tree | 86372ce2dd30a778ff4e9da4e44babf893ebbbee | |
parent | 1de9e8e70f5acc441550ca75433563d91b269bbe (diff) |
[ARM] pxa: PalmT5 initial support
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
-rw-r--r-- | MAINTAINERS | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/Kconfig | 10 | ||||
-rw-r--r-- | arch/arm/mach-pxa/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-pxa/include/mach/palmt5.h | 84 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmt5.c | 497 |
5 files changed, 593 insertions, 1 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 3fe4dc2c2564..a267659552ca 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -622,7 +622,7 @@ P: Dirk Opfer | |||
622 | M: dirk@opfer-online.de | 622 | M: dirk@opfer-online.de |
623 | S: Maintained | 623 | S: Maintained |
624 | 624 | ||
625 | ARM/PALMTX SUPPORT | 625 | ARM/PALMTX,PALMT5 SUPPORT |
626 | P: Marek Vasut | 626 | P: Marek Vasut |
627 | M: marek.vasut@gmail.com | 627 | M: marek.vasut@gmail.com |
628 | W: http://hackndev.com | 628 | W: http://hackndev.com |
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index 8eea7306f29b..9223ba607a71 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig | |||
@@ -319,6 +319,16 @@ config ARCH_PXA_PALM | |||
319 | bool "PXA based Palm PDAs" | 319 | bool "PXA based Palm PDAs" |
320 | select HAVE_PWM | 320 | select HAVE_PWM |
321 | 321 | ||
322 | config MACH_PALMT5 | ||
323 | bool "Palm Tungsten|T5" | ||
324 | default y | ||
325 | depends on ARCH_PXA_PALM | ||
326 | select PXA27x | ||
327 | select IWMMXT | ||
328 | help | ||
329 | Say Y here if you intend to run this kernel on a Palm Tungsten|T5 | ||
330 | handheld computer. | ||
331 | |||
322 | config MACH_PALMTX | 332 | config MACH_PALMTX |
323 | bool "Palm T|X" | 333 | bool "Palm T|X" |
324 | default y | 334 | default y |
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index 7b28bb561d63..0d0afe84ec54 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
@@ -53,6 +53,7 @@ obj-$(CONFIG_MACH_E740) += e740.o | |||
53 | obj-$(CONFIG_MACH_E750) += e750.o | 53 | obj-$(CONFIG_MACH_E750) += e750.o |
54 | obj-$(CONFIG_MACH_E400) += e400.o | 54 | obj-$(CONFIG_MACH_E400) += e400.o |
55 | obj-$(CONFIG_MACH_E800) += e800.o | 55 | obj-$(CONFIG_MACH_E800) += e800.o |
56 | obj-$(CONFIG_MACH_PALMT5) += palmt5.o | ||
56 | obj-$(CONFIG_MACH_PALMTX) += palmtx.o | 57 | obj-$(CONFIG_MACH_PALMTX) += palmtx.o |
57 | obj-$(CONFIG_MACH_PALMZ72) += palmz72.o | 58 | obj-$(CONFIG_MACH_PALMZ72) += palmz72.o |
58 | obj-$(CONFIG_ARCH_VIPER) += viper.o | 59 | obj-$(CONFIG_ARCH_VIPER) += viper.o |
diff --git a/arch/arm/mach-pxa/include/mach/palmt5.h b/arch/arm/mach-pxa/include/mach/palmt5.h new file mode 100644 index 000000000000..94db2881f048 --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/palmt5.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | * GPIOs and interrupts for Palm Tungsten|T5 Handheld Computer | ||
3 | * | ||
4 | * Authors: Ales Snuparek <snuparek@atlas.cz> | ||
5 | * Marek Vasut <marek.vasut@gmail.com> | ||
6 | * Justin Kendrick <twilightsentry@gmail.com> | ||
7 | * RichardT5 <richard_t5@users.sourceforge.net> | ||
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 | |||
15 | #ifndef _INCLUDE_PALMT5_H_ | ||
16 | #define _INCLUDE_PALMT5_H_ | ||
17 | |||
18 | /** HERE ARE GPIOs **/ | ||
19 | |||
20 | /* GPIOs */ | ||
21 | #define GPIO_NR_PALMT5_GPIO_RESET 1 | ||
22 | |||
23 | #define GPIO_NR_PALMT5_POWER_DETECT 90 | ||
24 | #define GPIO_NR_PALMT5_HOTSYNC_BUTTON_N 10 | ||
25 | #define GPIO_NR_PALMT5_EARPHONE_DETECT 107 | ||
26 | |||
27 | /* SD/MMC */ | ||
28 | #define GPIO_NR_PALMT5_SD_DETECT_N 14 | ||
29 | #define GPIO_NR_PALMT5_SD_POWER 114 | ||
30 | #define GPIO_NR_PALMT5_SD_READONLY 115 | ||
31 | |||
32 | /* TOUCHSCREEN */ | ||
33 | #define GPIO_NR_PALMT5_WM9712_IRQ 27 | ||
34 | |||
35 | /* IRDA - disable GPIO connected to SD pin of tranceiver (TFBS4710?) ? */ | ||
36 | #define GPIO_NR_PALMT5_IR_DISABLE 40 | ||
37 | |||
38 | /* USB */ | ||
39 | #define GPIO_NR_PALMT5_USB_DETECT_N 15 | ||
40 | #define GPIO_NR_PALMT5_USB_POWER 95 | ||
41 | #define GPIO_NR_PALMT5_USB_PULLUP 93 | ||
42 | |||
43 | /* LCD/BACKLIGHT */ | ||
44 | #define GPIO_NR_PALMT5_BL_POWER 84 | ||
45 | #define GPIO_NR_PALMT5_LCD_POWER 96 | ||
46 | |||
47 | /* BLUETOOTH */ | ||
48 | #define GPIO_NR_PALMT5_BT_POWER 17 | ||
49 | #define GPIO_NR_PALMT5_BT_RESET 83 | ||
50 | |||
51 | /* INTERRUPTS */ | ||
52 | #define IRQ_GPIO_PALMT5_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMT5_SD_DETECT_N) | ||
53 | #define IRQ_GPIO_PALMT5_WM9712_IRQ IRQ_GPIO(GPIO_NR_PALMT5_WM9712_IRQ) | ||
54 | #define IRQ_GPIO_PALMT5_USB_DETECT IRQ_GPIO(GPIO_NR_PALMT5_USB_DETECT) | ||
55 | #define IRQ_GPIO_PALMT5_GPIO_RESET IRQ_GPIO(GPIO_NR_PALMT5_GPIO_RESET) | ||
56 | |||
57 | /** HERE ARE INIT VALUES **/ | ||
58 | |||
59 | /* Various addresses */ | ||
60 | #define PALMT5_PHYS_RAM_START 0xa0000000 | ||
61 | #define PALMT5_PHYS_IO_START 0x40000000 | ||
62 | |||
63 | /* TOUCHSCREEN */ | ||
64 | #define AC97_LINK_FRAME 21 | ||
65 | |||
66 | /* BATTERY */ | ||
67 | #define PALMT5_BAT_MAX_VOLTAGE 4000 /* 4.00v current voltage */ | ||
68 | #define PALMT5_BAT_MIN_VOLTAGE 3550 /* 3.55v critical voltage */ | ||
69 | #define PALMT5_BAT_MAX_CURRENT 0 /* unknokn */ | ||
70 | #define PALMT5_BAT_MIN_CURRENT 0 /* unknown */ | ||
71 | #define PALMT5_BAT_MAX_CHARGE 1 /* unknown */ | ||
72 | #define PALMT5_BAT_MIN_CHARGE 1 /* unknown */ | ||
73 | #define PALMT5_MAX_LIFE_MINS 360 /* on-life in minutes */ | ||
74 | |||
75 | #define PALMT5_BAT_MEASURE_DELAY (HZ * 1) | ||
76 | |||
77 | /* BACKLIGHT */ | ||
78 | #define PALMT5_MAX_INTENSITY 0xFE | ||
79 | #define PALMT5_DEFAULT_INTENSITY 0x7E | ||
80 | #define PALMT5_LIMIT_MASK 0x7F | ||
81 | #define PALMT5_PRESCALER 0x3F | ||
82 | #define PALMT5_PERIOD_NS 3500 | ||
83 | |||
84 | #endif | ||
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c new file mode 100644 index 000000000000..51b4a6025516 --- /dev/null +++ b/arch/arm/mach-pxa/palmt5.c | |||
@@ -0,0 +1,497 @@ | |||
1 | /* | ||
2 | * Hardware definitions for Palm Tungsten|T5 | ||
3 | * | ||
4 | * Author: Marek Vasut <marek.vasut@gmail.com> | ||
5 | * | ||
6 | * Based on work of: | ||
7 | * Ales Snuparek <snuparek@atlas.cz> | ||
8 | * Justin Kendrick <twilightsentry@gmail.com> | ||
9 | * RichardT5 <richard_t5@users.sourceforge.net> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | * | ||
15 | * (find more info at www.hackndev.com) | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/irq.h> | ||
22 | #include <linux/gpio_keys.h> | ||
23 | #include <linux/input.h> | ||
24 | #include <linux/pda_power.h> | ||
25 | #include <linux/pwm_backlight.h> | ||
26 | #include <linux/gpio.h> | ||
27 | #include <linux/wm97xx_batt.h> | ||
28 | #include <linux/power_supply.h> | ||
29 | |||
30 | #include <asm/mach-types.h> | ||
31 | #include <asm/mach/arch.h> | ||
32 | #include <asm/mach/map.h> | ||
33 | |||
34 | #include <mach/audio.h> | ||
35 | #include <mach/palmt5.h> | ||
36 | #include <mach/mmc.h> | ||
37 | #include <mach/pxafb.h> | ||
38 | #include <mach/pxa-regs.h> | ||
39 | #include <mach/mfp-pxa27x.h> | ||
40 | #include <mach/irda.h> | ||
41 | #include <mach/pxa27x_keypad.h> | ||
42 | #include <mach/udc.h> | ||
43 | #include <mach/palmasoc.h> | ||
44 | |||
45 | #include "generic.h" | ||
46 | #include "devices.h" | ||
47 | |||
48 | /****************************************************************************** | ||
49 | * Pin configuration | ||
50 | ******************************************************************************/ | ||
51 | static unsigned long palmt5_pin_config[] __initdata = { | ||
52 | /* MMC */ | ||
53 | GPIO32_MMC_CLK, | ||
54 | GPIO92_MMC_DAT_0, | ||
55 | GPIO109_MMC_DAT_1, | ||
56 | GPIO110_MMC_DAT_2, | ||
57 | GPIO111_MMC_DAT_3, | ||
58 | GPIO112_MMC_CMD, | ||
59 | GPIO14_GPIO, /* SD detect */ | ||
60 | GPIO114_GPIO, /* SD power */ | ||
61 | GPIO115_GPIO, /* SD r/o switch */ | ||
62 | |||
63 | /* AC97 */ | ||
64 | GPIO28_AC97_BITCLK, | ||
65 | GPIO29_AC97_SDATA_IN_0, | ||
66 | GPIO30_AC97_SDATA_OUT, | ||
67 | GPIO31_AC97_SYNC, | ||
68 | |||
69 | /* IrDA */ | ||
70 | GPIO40_GPIO, /* ir disable */ | ||
71 | GPIO46_FICP_RXD, | ||
72 | GPIO47_FICP_TXD, | ||
73 | |||
74 | /* USB */ | ||
75 | GPIO15_GPIO, /* usb detect */ | ||
76 | GPIO95_GPIO, /* usb power */ | ||
77 | |||
78 | /* MATRIX KEYPAD */ | ||
79 | GPIO100_KP_MKIN_0, | ||
80 | GPIO101_KP_MKIN_1, | ||
81 | GPIO102_KP_MKIN_2, | ||
82 | GPIO97_KP_MKIN_3, | ||
83 | GPIO103_KP_MKOUT_0, | ||
84 | GPIO104_KP_MKOUT_1, | ||
85 | GPIO105_KP_MKOUT_2, | ||
86 | |||
87 | /* LCD */ | ||
88 | GPIO58_LCD_LDD_0, | ||
89 | GPIO59_LCD_LDD_1, | ||
90 | GPIO60_LCD_LDD_2, | ||
91 | GPIO61_LCD_LDD_3, | ||
92 | GPIO62_LCD_LDD_4, | ||
93 | GPIO63_LCD_LDD_5, | ||
94 | GPIO64_LCD_LDD_6, | ||
95 | GPIO65_LCD_LDD_7, | ||
96 | GPIO66_LCD_LDD_8, | ||
97 | GPIO67_LCD_LDD_9, | ||
98 | GPIO68_LCD_LDD_10, | ||
99 | GPIO69_LCD_LDD_11, | ||
100 | GPIO70_LCD_LDD_12, | ||
101 | GPIO71_LCD_LDD_13, | ||
102 | GPIO72_LCD_LDD_14, | ||
103 | GPIO73_LCD_LDD_15, | ||
104 | GPIO74_LCD_FCLK, | ||
105 | GPIO75_LCD_LCLK, | ||
106 | GPIO76_LCD_PCLK, | ||
107 | GPIO77_LCD_BIAS, | ||
108 | |||
109 | /* PWM */ | ||
110 | GPIO16_PWM0_OUT, | ||
111 | |||
112 | /* MISC */ | ||
113 | GPIO10_GPIO, /* hotsync button */ | ||
114 | GPIO90_GPIO, /* power detect */ | ||
115 | GPIO107_GPIO, /* earphone detect */ | ||
116 | }; | ||
117 | |||
118 | /****************************************************************************** | ||
119 | * SD/MMC card controller | ||
120 | ******************************************************************************/ | ||
121 | static int palmt5_mci_init(struct device *dev, irq_handler_t palmt5_detect_int, | ||
122 | void *data) | ||
123 | { | ||
124 | int err = 0; | ||
125 | |||
126 | /* Setup an interrupt for detecting card insert/remove events */ | ||
127 | err = gpio_request(GPIO_NR_PALMT5_SD_DETECT_N, "SD IRQ"); | ||
128 | if (err) | ||
129 | goto err; | ||
130 | err = gpio_direction_input(GPIO_NR_PALMT5_SD_DETECT_N); | ||
131 | if (err) | ||
132 | goto err2; | ||
133 | err = request_irq(gpio_to_irq(GPIO_NR_PALMT5_SD_DETECT_N), | ||
134 | palmt5_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM | | ||
135 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, | ||
136 | "SD/MMC card detect", data); | ||
137 | if (err) { | ||
138 | printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n", | ||
139 | __func__); | ||
140 | goto err2; | ||
141 | } | ||
142 | |||
143 | err = gpio_request(GPIO_NR_PALMT5_SD_POWER, "SD_POWER"); | ||
144 | if (err) | ||
145 | goto err3; | ||
146 | err = gpio_direction_output(GPIO_NR_PALMT5_SD_POWER, 0); | ||
147 | if (err) | ||
148 | goto err4; | ||
149 | |||
150 | err = gpio_request(GPIO_NR_PALMT5_SD_READONLY, "SD_READONLY"); | ||
151 | if (err) | ||
152 | goto err4; | ||
153 | err = gpio_direction_input(GPIO_NR_PALMT5_SD_READONLY); | ||
154 | if (err) | ||
155 | goto err5; | ||
156 | |||
157 | printk(KERN_DEBUG "%s: irq registered\n", __func__); | ||
158 | |||
159 | return 0; | ||
160 | |||
161 | err5: | ||
162 | gpio_free(GPIO_NR_PALMT5_SD_READONLY); | ||
163 | err4: | ||
164 | gpio_free(GPIO_NR_PALMT5_SD_POWER); | ||
165 | err3: | ||
166 | free_irq(gpio_to_irq(GPIO_NR_PALMT5_SD_DETECT_N), data); | ||
167 | err2: | ||
168 | gpio_free(GPIO_NR_PALMT5_SD_DETECT_N); | ||
169 | err: | ||
170 | return err; | ||
171 | } | ||
172 | |||
173 | static void palmt5_mci_exit(struct device *dev, void *data) | ||
174 | { | ||
175 | gpio_free(GPIO_NR_PALMT5_SD_READONLY); | ||
176 | gpio_free(GPIO_NR_PALMT5_SD_POWER); | ||
177 | free_irq(IRQ_GPIO_PALMT5_SD_DETECT_N, data); | ||
178 | gpio_free(GPIO_NR_PALMT5_SD_DETECT_N); | ||
179 | } | ||
180 | |||
181 | static void palmt5_mci_power(struct device *dev, unsigned int vdd) | ||
182 | { | ||
183 | struct pxamci_platform_data *p_d = dev->platform_data; | ||
184 | gpio_set_value(GPIO_NR_PALMT5_SD_POWER, p_d->ocr_mask & (1 << vdd)); | ||
185 | } | ||
186 | |||
187 | static int palmt5_mci_get_ro(struct device *dev) | ||
188 | { | ||
189 | return gpio_get_value(GPIO_NR_PALMT5_SD_READONLY); | ||
190 | } | ||
191 | |||
192 | static struct pxamci_platform_data palmt5_mci_platform_data = { | ||
193 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
194 | .setpower = palmt5_mci_power, | ||
195 | .get_ro = palmt5_mci_get_ro, | ||
196 | .init = palmt5_mci_init, | ||
197 | .exit = palmt5_mci_exit, | ||
198 | }; | ||
199 | |||
200 | /****************************************************************************** | ||
201 | * GPIO keyboard | ||
202 | ******************************************************************************/ | ||
203 | static unsigned int palmt5_matrix_keys[] = { | ||
204 | KEY(0, 0, KEY_POWER), | ||
205 | KEY(0, 1, KEY_F1), | ||
206 | KEY(0, 2, KEY_ENTER), | ||
207 | |||
208 | KEY(1, 0, KEY_F2), | ||
209 | KEY(1, 1, KEY_F3), | ||
210 | KEY(1, 2, KEY_F4), | ||
211 | |||
212 | KEY(2, 0, KEY_UP), | ||
213 | KEY(2, 2, KEY_DOWN), | ||
214 | |||
215 | KEY(3, 0, KEY_RIGHT), | ||
216 | KEY(3, 2, KEY_LEFT), | ||
217 | }; | ||
218 | |||
219 | static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = { | ||
220 | .matrix_key_rows = 4, | ||
221 | .matrix_key_cols = 3, | ||
222 | .matrix_key_map = palmt5_matrix_keys, | ||
223 | .matrix_key_map_size = ARRAY_SIZE(palmt5_matrix_keys), | ||
224 | |||
225 | .debounce_interval = 30, | ||
226 | }; | ||
227 | |||
228 | /****************************************************************************** | ||
229 | * GPIO keys | ||
230 | ******************************************************************************/ | ||
231 | static struct gpio_keys_button palmt5_pxa_buttons[] = { | ||
232 | {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, | ||
233 | }; | ||
234 | |||
235 | static struct gpio_keys_platform_data palmt5_pxa_keys_data = { | ||
236 | .buttons = palmt5_pxa_buttons, | ||
237 | .nbuttons = ARRAY_SIZE(palmt5_pxa_buttons), | ||
238 | }; | ||
239 | |||
240 | static struct platform_device palmt5_pxa_keys = { | ||
241 | .name = "gpio-keys", | ||
242 | .id = -1, | ||
243 | .dev = { | ||
244 | .platform_data = &palmt5_pxa_keys_data, | ||
245 | }, | ||
246 | }; | ||
247 | |||
248 | /****************************************************************************** | ||
249 | * Backlight | ||
250 | ******************************************************************************/ | ||
251 | static int palmt5_backlight_init(struct device *dev) | ||
252 | { | ||
253 | int ret; | ||
254 | |||
255 | ret = gpio_request(GPIO_NR_PALMT5_BL_POWER, "BL POWER"); | ||
256 | if (ret) | ||
257 | goto err; | ||
258 | ret = gpio_direction_output(GPIO_NR_PALMT5_BL_POWER, 0); | ||
259 | if (ret) | ||
260 | goto err2; | ||
261 | ret = gpio_request(GPIO_NR_PALMT5_LCD_POWER, "LCD POWER"); | ||
262 | if (ret) | ||
263 | goto err2; | ||
264 | ret = gpio_direction_output(GPIO_NR_PALMT5_LCD_POWER, 0); | ||
265 | if (ret) | ||
266 | goto err3; | ||
267 | |||
268 | return 0; | ||
269 | err3: | ||
270 | gpio_free(GPIO_NR_PALMT5_LCD_POWER); | ||
271 | err2: | ||
272 | gpio_free(GPIO_NR_PALMT5_BL_POWER); | ||
273 | err: | ||
274 | return ret; | ||
275 | } | ||
276 | |||
277 | static int palmt5_backlight_notify(int brightness) | ||
278 | { | ||
279 | gpio_set_value(GPIO_NR_PALMT5_BL_POWER, brightness); | ||
280 | gpio_set_value(GPIO_NR_PALMT5_LCD_POWER, brightness); | ||
281 | return brightness; | ||
282 | } | ||
283 | |||
284 | static void palmt5_backlight_exit(struct device *dev) | ||
285 | { | ||
286 | gpio_free(GPIO_NR_PALMT5_BL_POWER); | ||
287 | gpio_free(GPIO_NR_PALMT5_LCD_POWER); | ||
288 | } | ||
289 | |||
290 | static struct platform_pwm_backlight_data palmt5_backlight_data = { | ||
291 | .pwm_id = 0, | ||
292 | .max_brightness = PALMT5_MAX_INTENSITY, | ||
293 | .dft_brightness = PALMT5_MAX_INTENSITY, | ||
294 | .pwm_period_ns = PALMT5_PERIOD_NS, | ||
295 | .init = palmt5_backlight_init, | ||
296 | .notify = palmt5_backlight_notify, | ||
297 | .exit = palmt5_backlight_exit, | ||
298 | }; | ||
299 | |||
300 | static struct platform_device palmt5_backlight = { | ||
301 | .name = "pwm-backlight", | ||
302 | .dev = { | ||
303 | .parent = &pxa27x_device_pwm0.dev, | ||
304 | .platform_data = &palmt5_backlight_data, | ||
305 | }, | ||
306 | }; | ||
307 | |||
308 | /****************************************************************************** | ||
309 | * IrDA | ||
310 | ******************************************************************************/ | ||
311 | static int palmt5_irda_startup(struct device *dev) | ||
312 | { | ||
313 | int err; | ||
314 | err = gpio_request(GPIO_NR_PALMT5_IR_DISABLE, "IR DISABLE"); | ||
315 | if (err) | ||
316 | goto err; | ||
317 | err = gpio_direction_output(GPIO_NR_PALMT5_IR_DISABLE, 1); | ||
318 | if (err) | ||
319 | gpio_free(GPIO_NR_PALMT5_IR_DISABLE); | ||
320 | err: | ||
321 | return err; | ||
322 | } | ||
323 | |||
324 | static void palmt5_irda_shutdown(struct device *dev) | ||
325 | { | ||
326 | gpio_free(GPIO_NR_PALMT5_IR_DISABLE); | ||
327 | } | ||
328 | |||
329 | static void palmt5_irda_transceiver_mode(struct device *dev, int mode) | ||
330 | { | ||
331 | gpio_set_value(GPIO_NR_PALMT5_IR_DISABLE, mode & IR_OFF); | ||
332 | pxa2xx_transceiver_mode(dev, mode); | ||
333 | } | ||
334 | |||
335 | static struct pxaficp_platform_data palmt5_ficp_platform_data = { | ||
336 | .startup = palmt5_irda_startup, | ||
337 | .shutdown = palmt5_irda_shutdown, | ||
338 | .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, | ||
339 | .transceiver_mode = palmt5_irda_transceiver_mode, | ||
340 | }; | ||
341 | |||
342 | /****************************************************************************** | ||
343 | * UDC | ||
344 | ******************************************************************************/ | ||
345 | static struct pxa2xx_udc_mach_info palmt5_udc_info __initdata = { | ||
346 | .gpio_vbus = GPIO_NR_PALMT5_USB_DETECT_N, | ||
347 | .gpio_vbus_inverted = 1, | ||
348 | .gpio_pullup = GPIO_NR_PALMT5_USB_POWER, | ||
349 | .gpio_pullup_inverted = 0, | ||
350 | }; | ||
351 | |||
352 | /****************************************************************************** | ||
353 | * Power supply | ||
354 | ******************************************************************************/ | ||
355 | static int power_supply_init(struct device *dev) | ||
356 | { | ||
357 | int ret; | ||
358 | |||
359 | ret = gpio_request(GPIO_NR_PALMT5_POWER_DETECT, "CABLE_STATE_AC"); | ||
360 | if (ret) | ||
361 | goto err1; | ||
362 | ret = gpio_direction_input(GPIO_NR_PALMT5_POWER_DETECT); | ||
363 | if (ret) | ||
364 | goto err2; | ||
365 | |||
366 | return 0; | ||
367 | err2: | ||
368 | gpio_free(GPIO_NR_PALMT5_POWER_DETECT); | ||
369 | err1: | ||
370 | return ret; | ||
371 | } | ||
372 | |||
373 | static int palmt5_is_ac_online(void) | ||
374 | { | ||
375 | return gpio_get_value(GPIO_NR_PALMT5_POWER_DETECT); | ||
376 | } | ||
377 | |||
378 | static void power_supply_exit(struct device *dev) | ||
379 | { | ||
380 | gpio_free(GPIO_NR_PALMT5_POWER_DETECT); | ||
381 | } | ||
382 | |||
383 | static char *palmt5_supplicants[] = { | ||
384 | "main-battery", | ||
385 | }; | ||
386 | |||
387 | static struct pda_power_pdata power_supply_info = { | ||
388 | .init = power_supply_init, | ||
389 | .is_ac_online = palmt5_is_ac_online, | ||
390 | .exit = power_supply_exit, | ||
391 | .supplied_to = palmt5_supplicants, | ||
392 | .num_supplicants = ARRAY_SIZE(palmt5_supplicants), | ||
393 | }; | ||
394 | |||
395 | static struct platform_device power_supply = { | ||
396 | .name = "pda-power", | ||
397 | .id = -1, | ||
398 | .dev = { | ||
399 | .platform_data = &power_supply_info, | ||
400 | }, | ||
401 | }; | ||
402 | |||
403 | /****************************************************************************** | ||
404 | * WM97xx battery | ||
405 | ******************************************************************************/ | ||
406 | static struct wm97xx_batt_info wm97xx_batt_pdata = { | ||
407 | .batt_aux = WM97XX_AUX_ID3, | ||
408 | .temp_aux = WM97XX_AUX_ID2, | ||
409 | .charge_gpio = -1, | ||
410 | .max_voltage = PALMT5_BAT_MAX_VOLTAGE, | ||
411 | .min_voltage = PALMT5_BAT_MIN_VOLTAGE, | ||
412 | .batt_mult = 1000, | ||
413 | .batt_div = 414, | ||
414 | .temp_mult = 1, | ||
415 | .temp_div = 1, | ||
416 | .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO, | ||
417 | .batt_name = "main-batt", | ||
418 | }; | ||
419 | |||
420 | /****************************************************************************** | ||
421 | * aSoC audio | ||
422 | ******************************************************************************/ | ||
423 | static struct palm27x_asoc_info palm27x_asoc_pdata = { | ||
424 | .jack_gpio = GPIO_NR_PALMT5_EARPHONE_DETECT, | ||
425 | }; | ||
426 | |||
427 | /****************************************************************************** | ||
428 | * Framebuffer | ||
429 | ******************************************************************************/ | ||
430 | static struct pxafb_mode_info palmt5_lcd_modes[] = { | ||
431 | { | ||
432 | .pixclock = 57692, | ||
433 | .xres = 320, | ||
434 | .yres = 480, | ||
435 | .bpp = 16, | ||
436 | |||
437 | .left_margin = 32, | ||
438 | .right_margin = 1, | ||
439 | .upper_margin = 7, | ||
440 | .lower_margin = 1, | ||
441 | |||
442 | .hsync_len = 4, | ||
443 | .vsync_len = 1, | ||
444 | }, | ||
445 | }; | ||
446 | |||
447 | static struct pxafb_mach_info palmt5_lcd_screen = { | ||
448 | .modes = palmt5_lcd_modes, | ||
449 | .num_modes = ARRAY_SIZE(palmt5_lcd_modes), | ||
450 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, | ||
451 | }; | ||
452 | |||
453 | /****************************************************************************** | ||
454 | * Machine init | ||
455 | ******************************************************************************/ | ||
456 | static struct platform_device *devices[] __initdata = { | ||
457 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
458 | &palmt5_pxa_keys, | ||
459 | #endif | ||
460 | &palmt5_backlight, | ||
461 | &power_supply, | ||
462 | }; | ||
463 | |||
464 | /* setup udc GPIOs initial state */ | ||
465 | static void __init palmt5_udc_init(void) | ||
466 | { | ||
467 | if (!gpio_request(GPIO_NR_PALMT5_USB_POWER, "UDC Vbus")) { | ||
468 | gpio_direction_output(GPIO_NR_PALMT5_USB_POWER, 1); | ||
469 | gpio_free(GPIO_NR_PALMT5_USB_POWER); | ||
470 | } | ||
471 | } | ||
472 | |||
473 | static void __init palmt5_init(void) | ||
474 | { | ||
475 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); | ||
476 | |||
477 | set_pxa_fb_info(&palmt5_lcd_screen); | ||
478 | pxa_set_mci_info(&palmt5_mci_platform_data); | ||
479 | palmt5_udc_init(); | ||
480 | pxa_set_udc_info(&palmt5_udc_info); | ||
481 | pxa_set_ac97_info(NULL); | ||
482 | pxa_set_ficp_info(&palmt5_ficp_platform_data); | ||
483 | pxa_set_keypad_info(&palmt5_keypad_platform_data); | ||
484 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); | ||
485 | palm27x_asoc_set_pdata(&palm27x_asoc_pdata); | ||
486 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
487 | } | ||
488 | |||
489 | MACHINE_START(PALMT5, "Palm Tungsten|T5") | ||
490 | .phys_io = PALMT5_PHYS_IO_START, | ||
491 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | ||
492 | .boot_params = 0xa0000100, | ||
493 | .map_io = pxa_map_io, | ||
494 | .init_irq = pxa27x_init_irq, | ||
495 | .timer = &pxa_timer, | ||
496 | .init_machine = palmt5_init | ||
497 | MACHINE_END | ||