diff options
author | Tomáš Čech <sleep_walker@suse.cz> | 2009-09-11 07:57:01 -0400 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2009-11-30 20:02:48 -0500 |
commit | bb2ae8f0325221a2dfd9eb31554f42e9c24abdf2 (patch) | |
tree | 678a540431139e6c9b60ec7895e8b5f9ed0b0b7a | |
parent | d62238711a0a917ddc6bb47390c7502806c963b1 (diff) |
[ARM] pxa/treo: generalisation of Treo680 code
Signed-off-by: Tomáš Čech <sleep_walker@suse.cz>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
-rw-r--r-- | arch/arm/mach-pxa/Kconfig | 5 | ||||
-rw-r--r-- | arch/arm/mach-pxa/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/include/mach/palmtreo.h | 60 | ||||
-rw-r--r-- | arch/arm/mach-pxa/include/mach/treo680.h | 49 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmtreo.c (renamed from arch/arm/mach-pxa/treo680.c) | 202 |
5 files changed, 183 insertions, 135 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index a6f8eab14ba5..ce6519c000a6 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig | |||
@@ -421,12 +421,17 @@ config MACH_PALMZ72 | |||
421 | Say Y here if you intend to run this kernel on Palm Zire 72 | 421 | Say Y here if you intend to run this kernel on Palm Zire 72 |
422 | handheld computer. | 422 | handheld computer. |
423 | 423 | ||
424 | config PALM_TREO | ||
425 | bool | ||
426 | depends on ARCH_PXA_PALM | ||
427 | |||
424 | config MACH_TREO680 | 428 | config MACH_TREO680 |
425 | bool "Palm Treo 680" | 429 | bool "Palm Treo 680" |
426 | default y | 430 | default y |
427 | depends on ARCH_PXA_PALM | 431 | depends on ARCH_PXA_PALM |
428 | select PXA27x | 432 | select PXA27x |
429 | select IWMMXT | 433 | select IWMMXT |
434 | select PALM_TREO | ||
430 | help | 435 | help |
431 | Say Y here if you intend to run this kernel on Palm Treo 680 | 436 | Say Y here if you intend to run this kernel on Palm Treo 680 |
432 | smartphone. | 437 | smartphone. |
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index f10e152bfc27..e5d450c54340 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
@@ -64,7 +64,7 @@ obj-$(CONFIG_MACH_PALMT5) += palmt5.o | |||
64 | obj-$(CONFIG_MACH_PALMTX) += palmtx.o | 64 | obj-$(CONFIG_MACH_PALMTX) += palmtx.o |
65 | obj-$(CONFIG_MACH_PALMLD) += palmld.o | 65 | obj-$(CONFIG_MACH_PALMLD) += palmld.o |
66 | obj-$(CONFIG_MACH_PALMZ72) += palmz72.o | 66 | obj-$(CONFIG_MACH_PALMZ72) += palmz72.o |
67 | obj-$(CONFIG_MACH_TREO680) += treo680.o | 67 | obj-$(CONFIG_PALM_TREO) += palmtreo.o |
68 | obj-$(CONFIG_ARCH_VIPER) += viper.o | 68 | obj-$(CONFIG_ARCH_VIPER) += viper.o |
69 | 69 | ||
70 | ifeq ($(CONFIG_MACH_ZYLONITE),y) | 70 | ifeq ($(CONFIG_MACH_ZYLONITE),y) |
diff --git a/arch/arm/mach-pxa/include/mach/palmtreo.h b/arch/arm/mach-pxa/include/mach/palmtreo.h new file mode 100644 index 000000000000..8cb0bca7f707 --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/palmtreo.h | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * GPIOs and interrupts for Palm Treo smartphones | ||
3 | * | ||
4 | * currently supported: | ||
5 | * Palm Treo 680 (GSM) | ||
6 | * | ||
7 | * Author: Tomas Cech <sleep_walker@suse.cz> | ||
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 | * find more info at www.hackndev.com | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #ifndef _INCLUDE_TREO_H_ | ||
18 | #define _INCLUDE_TREO_H_ | ||
19 | |||
20 | /* GPIOs */ | ||
21 | #define GPIO_NR_TREO_POWER_DETECT 0 | ||
22 | #define GPIO_NR_TREO_AMP_EN 27 | ||
23 | #define GPIO_NR_TREO_GREEN_LED 20 | ||
24 | #define GPIO_NR_TREO_RED_LED 79 | ||
25 | #define GPIO_NR_TREO_SD_DETECT_N 113 | ||
26 | #define GPIO_NR_TREO_EP_DETECT_N 116 | ||
27 | #define GPIO_NR_TREO_USB_DETECT 1 | ||
28 | #define GPIO_NR_TREO_USB_PULLUP 114 | ||
29 | #define GPIO_NR_TREO_GSM_POWER 40 | ||
30 | #define GPIO_NR_TREO_GSM_RESET 87 | ||
31 | #define GPIO_NR_TREO_GSM_WAKE 57 | ||
32 | #define GPIO_NR_TREO_GSM_HOST_WAKE 14 | ||
33 | #define GPIO_NR_TREO_GSM_TRIGGER 10 | ||
34 | #define GPIO_NR_TREO_IR_EN 115 | ||
35 | #define GPIO_NR_TREO_IR_TXD 47 | ||
36 | #define GPIO_NR_TREO_BL_POWER 38 | ||
37 | #define GPIO_NR_TREO_LCD_POWER 25 | ||
38 | |||
39 | /* Treo680 specific GPIOs */ | ||
40 | #ifdef CONFIG_MACH_TREO680 | ||
41 | #define GPIO_NR_TREO680_SD_READONLY 33 | ||
42 | #define GPIO_NR_TREO680_SD_POWER 42 | ||
43 | #define GPIO_NR_TREO680_VIBRATE_EN 44 | ||
44 | #define GPIO_NR_TREO680_KEYB_BL 24 | ||
45 | #define GPIO_NR_TREO680_BT_EN 43 | ||
46 | #endif /* CONFIG_MACH_TREO680 */ | ||
47 | |||
48 | /* Various addresses */ | ||
49 | #define TREO_PHYS_RAM_START 0xa0000000 | ||
50 | #define TREO_PHYS_IO_START 0x40000000 | ||
51 | #define TREO_STR_BASE 0xa2000000 | ||
52 | |||
53 | /* BACKLIGHT */ | ||
54 | #define TREO_MAX_INTENSITY 254 | ||
55 | #define TREO_DEFAULT_INTENSITY 160 | ||
56 | #define TREO_LIMIT_MASK 0x7F | ||
57 | #define TREO_PRESCALER 63 | ||
58 | #define TREO_PERIOD_NS 3500 | ||
59 | |||
60 | #endif | ||
diff --git a/arch/arm/mach-pxa/include/mach/treo680.h b/arch/arm/mach-pxa/include/mach/treo680.h deleted file mode 100644 index af443b24d99a..000000000000 --- a/arch/arm/mach-pxa/include/mach/treo680.h +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | /* | ||
2 | * GPIOs and interrupts for Palm Treo 680 smartphone | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #ifndef _INCLUDE_TREO680_H_ | ||
11 | #define _INCLUDE_TREO680_H_ | ||
12 | |||
13 | /* GPIOs */ | ||
14 | #define GPIO_NR_TREO680_POWER_DETECT 0 | ||
15 | #define GPIO_NR_TREO680_AMP_EN 27 | ||
16 | #define GPIO_NR_TREO680_KEYB_BL 24 | ||
17 | #define GPIO_NR_TREO680_VIBRATE_EN 44 | ||
18 | #define GPIO_NR_TREO680_GREEN_LED 20 | ||
19 | #define GPIO_NR_TREO680_RED_LED 79 | ||
20 | #define GPIO_NR_TREO680_SD_DETECT_N 113 | ||
21 | #define GPIO_NR_TREO680_SD_READONLY 33 | ||
22 | #define GPIO_NR_TREO680_EP_DETECT_N 116 | ||
23 | #define GPIO_NR_TREO680_SD_POWER 42 | ||
24 | #define GPIO_NR_TREO680_USB_DETECT 1 | ||
25 | #define GPIO_NR_TREO680_USB_PULLUP 114 | ||
26 | #define GPIO_NR_TREO680_GSM_POWER 40 | ||
27 | #define GPIO_NR_TREO680_GSM_RESET 87 | ||
28 | #define GPIO_NR_TREO680_GSM_WAKE 57 | ||
29 | #define GPIO_NR_TREO680_GSM_HOST_WAKE 14 | ||
30 | #define GPIO_NR_TREO680_GSM_TRIGGER 10 | ||
31 | #define GPIO_NR_TREO680_BT_EN 43 | ||
32 | #define GPIO_NR_TREO680_IR_EN 115 | ||
33 | #define GPIO_NR_TREO680_IR_TXD 47 | ||
34 | #define GPIO_NR_TREO680_BL_POWER 38 | ||
35 | #define GPIO_NR_TREO680_LCD_POWER 25 | ||
36 | |||
37 | /* Various addresses */ | ||
38 | #define TREO680_PHYS_RAM_START 0xa0000000 | ||
39 | #define TREO680_PHYS_IO_START 0x40000000 | ||
40 | #define TREO680_STR_BASE 0xa2000000 | ||
41 | |||
42 | /* BACKLIGHT */ | ||
43 | #define TREO680_MAX_INTENSITY 254 | ||
44 | #define TREO680_DEFAULT_INTENSITY 160 | ||
45 | #define TREO680_LIMIT_MASK 0x7F | ||
46 | #define TREO680_PRESCALER 63 | ||
47 | #define TREO680_PERIOD_NS 3500 | ||
48 | |||
49 | #endif | ||
diff --git a/arch/arm/mach-pxa/treo680.c b/arch/arm/mach-pxa/palmtreo.c index fe085076fbf2..5e66028d2911 100644 --- a/arch/arm/mach-pxa/treo680.c +++ b/arch/arm/mach-pxa/palmtreo.c | |||
@@ -1,5 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Hardware definitions for Palm Treo 680 | 2 | * Hardware definitions for Palm Treo smartphones |
3 | * | ||
4 | * currently supported: | ||
5 | * Palm Treo 680 (GSM) | ||
3 | * | 6 | * |
4 | * Author: Tomas Cech <sleep_walker@suse.cz> | 7 | * Author: Tomas Cech <sleep_walker@suse.cz> |
5 | * | 8 | * |
@@ -31,7 +34,7 @@ | |||
31 | #include <mach/pxa27x.h> | 34 | #include <mach/pxa27x.h> |
32 | #include <mach/pxa27x-udc.h> | 35 | #include <mach/pxa27x-udc.h> |
33 | #include <mach/audio.h> | 36 | #include <mach/audio.h> |
34 | #include <mach/treo680.h> | 37 | #include <mach/palmtreo.h> |
35 | #include <mach/mmc.h> | 38 | #include <mach/mmc.h> |
36 | #include <mach/pxafb.h> | 39 | #include <mach/pxafb.h> |
37 | #include <mach/irda.h> | 40 | #include <mach/irda.h> |
@@ -50,7 +53,7 @@ | |||
50 | /****************************************************************************** | 53 | /****************************************************************************** |
51 | * Pin configuration | 54 | * Pin configuration |
52 | ******************************************************************************/ | 55 | ******************************************************************************/ |
53 | static unsigned long treo680_pin_config[] __initdata = { | 56 | static unsigned long treo_pin_config[] __initdata = { |
54 | /* MMC */ | 57 | /* MMC */ |
55 | GPIO32_MMC_CLK, | 58 | GPIO32_MMC_CLK, |
56 | GPIO92_MMC_DAT_0, | 59 | GPIO92_MMC_DAT_0, |
@@ -58,7 +61,6 @@ static unsigned long treo680_pin_config[] __initdata = { | |||
58 | GPIO110_MMC_DAT_2, | 61 | GPIO110_MMC_DAT_2, |
59 | GPIO111_MMC_DAT_3, | 62 | GPIO111_MMC_DAT_3, |
60 | GPIO112_MMC_CMD, | 63 | GPIO112_MMC_CMD, |
61 | GPIO33_GPIO, /* SD read only */ | ||
62 | GPIO113_GPIO, /* SD detect */ | 64 | GPIO113_GPIO, /* SD detect */ |
63 | 65 | ||
64 | /* AC97 */ | 66 | /* AC97 */ |
@@ -80,12 +82,10 @@ static unsigned long treo680_pin_config[] __initdata = { | |||
80 | GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* usb detect */ | 82 | GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* usb detect */ |
81 | 83 | ||
82 | /* MATRIX KEYPAD */ | 84 | /* MATRIX KEYPAD */ |
83 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, | ||
84 | GPIO101_KP_MKIN_1, | 85 | GPIO101_KP_MKIN_1, |
85 | GPIO102_KP_MKIN_2, | 86 | GPIO102_KP_MKIN_2, |
86 | GPIO97_KP_MKIN_3, | 87 | GPIO97_KP_MKIN_3, |
87 | GPIO98_KP_MKIN_4, | 88 | GPIO98_KP_MKIN_4, |
88 | GPIO99_KP_MKIN_5, | ||
89 | GPIO91_KP_MKIN_6, | 89 | GPIO91_KP_MKIN_6, |
90 | GPIO13_KP_MKIN_7, | 90 | GPIO13_KP_MKIN_7, |
91 | GPIO103_KP_MKOUT_0 | MFP_LPM_DRIVE_HIGH, | 91 | GPIO103_KP_MKOUT_0 | MFP_LPM_DRIVE_HIGH, |
@@ -150,19 +150,32 @@ static unsigned long treo680_pin_config[] __initdata = { | |||
150 | GPIO11_GPIO | WAKEUP_ON_EDGE_BOTH, /* bluetooth host wake up */ | 150 | GPIO11_GPIO | WAKEUP_ON_EDGE_BOTH, /* bluetooth host wake up */ |
151 | }; | 151 | }; |
152 | 152 | ||
153 | #ifdef CONFIG_MACH_TREO680 | ||
154 | static unsigned long treo680_pin_config[] __initdata = { | ||
155 | GPIO33_GPIO, /* SD read only */ | ||
156 | |||
157 | /* MATRIX KEYPAD - different wake up source */ | ||
158 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, | ||
159 | GPIO99_KP_MKIN_5, | ||
160 | }; | ||
161 | #endif /* CONFIG_MACH_TREO680 */ | ||
162 | |||
153 | /****************************************************************************** | 163 | /****************************************************************************** |
154 | * SD/MMC card controller | 164 | * SD/MMC card controller |
155 | ******************************************************************************/ | 165 | ******************************************************************************/ |
166 | #ifdef CONFIG_MACH_TREO680 | ||
156 | static struct pxamci_platform_data treo680_mci_platform_data = { | 167 | static struct pxamci_platform_data treo680_mci_platform_data = { |
157 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | 168 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
158 | .gpio_card_detect = GPIO_NR_TREO680_SD_DETECT_N, | 169 | .gpio_card_detect = GPIO_NR_TREO_SD_DETECT_N, |
159 | .gpio_card_ro = GPIO_NR_TREO680_SD_READONLY, | 170 | .gpio_card_ro = GPIO_NR_TREO680_SD_READONLY, |
160 | .gpio_power = GPIO_NR_TREO680_SD_POWER, | 171 | .gpio_power = GPIO_NR_TREO680_SD_POWER, |
161 | }; | 172 | }; |
173 | #endif /* CONFIG_MACH_TREO680 */ | ||
162 | 174 | ||
163 | /****************************************************************************** | 175 | /****************************************************************************** |
164 | * GPIO keyboard | 176 | * GPIO keyboard |
165 | ******************************************************************************/ | 177 | ******************************************************************************/ |
178 | #ifdef CONFIG_MACH_TREO680 | ||
166 | static unsigned int treo680_matrix_keys[] = { | 179 | static unsigned int treo680_matrix_keys[] = { |
167 | KEY(0, 0, KEY_F8), /* Red/Off/Power */ | 180 | KEY(0, 0, KEY_F8), /* Red/Off/Power */ |
168 | KEY(0, 1, KEY_LEFT), | 181 | KEY(0, 1, KEY_LEFT), |
@@ -232,92 +245,95 @@ static struct pxa27x_keypad_platform_data treo680_keypad_platform_data = { | |||
232 | 245 | ||
233 | .debounce_interval = 30, | 246 | .debounce_interval = 30, |
234 | }; | 247 | }; |
248 | #endif /* CONFIG_MACH_TREO680 */ | ||
235 | 249 | ||
236 | /****************************************************************************** | 250 | /****************************************************************************** |
237 | * aSoC audio | 251 | * aSoC audio |
238 | ******************************************************************************/ | 252 | ******************************************************************************/ |
239 | 253 | ||
240 | static pxa2xx_audio_ops_t treo680_ac97_pdata = { | 254 | static pxa2xx_audio_ops_t treo_ac97_pdata = { |
241 | .reset_gpio = 95, | 255 | .reset_gpio = 95, |
242 | }; | 256 | }; |
243 | 257 | ||
244 | /****************************************************************************** | 258 | /****************************************************************************** |
245 | * Backlight | 259 | * Backlight |
246 | ******************************************************************************/ | 260 | ******************************************************************************/ |
247 | static int treo680_backlight_init(struct device *dev) | 261 | static int treo_backlight_init(struct device *dev) |
248 | { | 262 | { |
249 | int ret; | 263 | int ret; |
250 | 264 | ||
251 | ret = gpio_request(GPIO_NR_TREO680_BL_POWER, "BL POWER"); | 265 | ret = gpio_request(GPIO_NR_TREO_BL_POWER, "BL POWER"); |
252 | if (ret) | 266 | if (ret) |
253 | goto err; | 267 | goto err; |
254 | ret = gpio_direction_output(GPIO_NR_TREO680_BL_POWER, 0); | 268 | ret = gpio_direction_output(GPIO_NR_TREO_BL_POWER, 0); |
255 | if (ret) | 269 | if (ret) |
256 | goto err2; | 270 | goto err2; |
257 | 271 | ||
258 | return 0; | 272 | return 0; |
259 | 273 | ||
260 | err2: | 274 | err2: |
261 | gpio_free(GPIO_NR_TREO680_BL_POWER); | 275 | gpio_free(GPIO_NR_TREO_BL_POWER); |
262 | err: | 276 | err: |
263 | return ret; | 277 | return ret; |
264 | } | 278 | } |
265 | 279 | ||
266 | static int treo680_backlight_notify(int brightness) | 280 | static int treo_backlight_notify(int brightness) |
267 | { | 281 | { |
268 | gpio_set_value(GPIO_NR_TREO680_BL_POWER, brightness); | 282 | gpio_set_value(GPIO_NR_TREO_BL_POWER, brightness); |
269 | return TREO680_MAX_INTENSITY - brightness; | 283 | return TREO_MAX_INTENSITY - brightness; |
270 | }; | 284 | }; |
271 | 285 | ||
272 | static void treo680_backlight_exit(struct device *dev) | 286 | static void treo_backlight_exit(struct device *dev) |
273 | { | 287 | { |
274 | gpio_free(GPIO_NR_TREO680_BL_POWER); | 288 | gpio_free(GPIO_NR_TREO_BL_POWER); |
275 | } | 289 | } |
276 | 290 | ||
277 | static struct platform_pwm_backlight_data treo680_backlight_data = { | 291 | static struct platform_pwm_backlight_data treo_backlight_data = { |
278 | .pwm_id = 0, | 292 | .pwm_id = 0, |
279 | .max_brightness = TREO680_MAX_INTENSITY, | 293 | .max_brightness = TREO_MAX_INTENSITY, |
280 | .dft_brightness = TREO680_DEFAULT_INTENSITY, | 294 | .dft_brightness = TREO_DEFAULT_INTENSITY, |
281 | .pwm_period_ns = TREO680_PERIOD_NS, | 295 | .pwm_period_ns = TREO_PERIOD_NS, |
282 | .init = treo680_backlight_init, | 296 | .init = treo_backlight_init, |
283 | .notify = treo680_backlight_notify, | 297 | .notify = treo_backlight_notify, |
284 | .exit = treo680_backlight_exit, | 298 | .exit = treo_backlight_exit, |
285 | }; | 299 | }; |
286 | 300 | ||
287 | static struct platform_device treo680_backlight = { | 301 | static struct platform_device treo_backlight = { |
288 | .name = "pwm-backlight", | 302 | .name = "pwm-backlight", |
289 | .dev = { | 303 | .dev = { |
290 | .parent = &pxa27x_device_pwm0.dev, | 304 | .parent = &pxa27x_device_pwm0.dev, |
291 | .platform_data = &treo680_backlight_data, | 305 | .platform_data = &treo_backlight_data, |
292 | }, | 306 | }, |
293 | }; | 307 | }; |
294 | 308 | ||
295 | /****************************************************************************** | 309 | /****************************************************************************** |
296 | * IrDA | 310 | * IrDA |
297 | ******************************************************************************/ | 311 | ******************************************************************************/ |
298 | static struct pxaficp_platform_data treo680_ficp_info = { | 312 | static struct pxaficp_platform_data treo_ficp_info = { |
299 | .gpio_pwdown = GPIO_NR_TREO680_IR_EN, | 313 | .gpio_pwdown = GPIO_NR_TREO_IR_EN, |
300 | .transceiver_cap = IR_SIRMODE | IR_OFF, | 314 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
301 | }; | 315 | }; |
302 | 316 | ||
303 | /****************************************************************************** | 317 | /****************************************************************************** |
304 | * UDC | 318 | * UDC |
305 | ******************************************************************************/ | 319 | ******************************************************************************/ |
306 | static struct pxa2xx_udc_mach_info treo680_udc_info __initdata = { | 320 | static struct pxa2xx_udc_mach_info treo_udc_info __initdata = { |
307 | .gpio_vbus = GPIO_NR_TREO680_USB_DETECT, | 321 | .gpio_vbus = GPIO_NR_TREO_USB_DETECT, |
308 | .gpio_vbus_inverted = 1, | 322 | .gpio_vbus_inverted = 1, |
309 | .gpio_pullup = GPIO_NR_TREO680_USB_PULLUP, | 323 | .gpio_pullup = GPIO_NR_TREO_USB_PULLUP, |
310 | }; | 324 | }; |
311 | 325 | ||
312 | 326 | ||
313 | /****************************************************************************** | 327 | /****************************************************************************** |
314 | * USB host | 328 | * USB host |
315 | ******************************************************************************/ | 329 | ******************************************************************************/ |
330 | #ifdef CONFIG_MACH_TREO680 | ||
316 | static struct pxaohci_platform_data treo680_ohci_info = { | 331 | static struct pxaohci_platform_data treo680_ohci_info = { |
317 | .port_mode = PMM_PERPORT_MODE, | 332 | .port_mode = PMM_PERPORT_MODE, |
318 | .flags = ENABLE_PORT1 | ENABLE_PORT3, | 333 | .flags = ENABLE_PORT1 | ENABLE_PORT3, |
319 | .power_budget = 0, | 334 | .power_budget = 0, |
320 | }; | 335 | }; |
336 | #endif /* CONFIG_MACH_TREO680 */ | ||
321 | 337 | ||
322 | /****************************************************************************** | 338 | /****************************************************************************** |
323 | * Power supply | 339 | * Power supply |
@@ -326,41 +342,41 @@ static int power_supply_init(struct device *dev) | |||
326 | { | 342 | { |
327 | int ret; | 343 | int ret; |
328 | 344 | ||
329 | ret = gpio_request(GPIO_NR_TREO680_POWER_DETECT, "CABLE_STATE_AC"); | 345 | ret = gpio_request(GPIO_NR_TREO_POWER_DETECT, "CABLE_STATE_AC"); |
330 | if (ret) | 346 | if (ret) |
331 | goto err1; | 347 | goto err1; |
332 | ret = gpio_direction_input(GPIO_NR_TREO680_POWER_DETECT); | 348 | ret = gpio_direction_input(GPIO_NR_TREO_POWER_DETECT); |
333 | if (ret) | 349 | if (ret) |
334 | goto err2; | 350 | goto err2; |
335 | 351 | ||
336 | return 0; | 352 | return 0; |
337 | 353 | ||
338 | err2: | 354 | err2: |
339 | gpio_free(GPIO_NR_TREO680_POWER_DETECT); | 355 | gpio_free(GPIO_NR_TREO_POWER_DETECT); |
340 | err1: | 356 | err1: |
341 | return ret; | 357 | return ret; |
342 | } | 358 | } |
343 | 359 | ||
344 | static int treo680_is_ac_online(void) | 360 | static int treo_is_ac_online(void) |
345 | { | 361 | { |
346 | return gpio_get_value(GPIO_NR_TREO680_POWER_DETECT); | 362 | return gpio_get_value(GPIO_NR_TREO_POWER_DETECT); |
347 | } | 363 | } |
348 | 364 | ||
349 | static void power_supply_exit(struct device *dev) | 365 | static void power_supply_exit(struct device *dev) |
350 | { | 366 | { |
351 | gpio_free(GPIO_NR_TREO680_POWER_DETECT); | 367 | gpio_free(GPIO_NR_TREO_POWER_DETECT); |
352 | } | 368 | } |
353 | 369 | ||
354 | static char *treo680_supplicants[] = { | 370 | static char *treo_supplicants[] = { |
355 | "main-battery", | 371 | "main-battery", |
356 | }; | 372 | }; |
357 | 373 | ||
358 | static struct pda_power_pdata power_supply_info = { | 374 | static struct pda_power_pdata power_supply_info = { |
359 | .init = power_supply_init, | 375 | .init = power_supply_init, |
360 | .is_ac_online = treo680_is_ac_online, | 376 | .is_ac_online = treo_is_ac_online, |
361 | .exit = power_supply_exit, | 377 | .exit = power_supply_exit, |
362 | .supplied_to = treo680_supplicants, | 378 | .supplied_to = treo_supplicants, |
363 | .num_supplicants = ARRAY_SIZE(treo680_supplicants), | 379 | .num_supplicants = ARRAY_SIZE(treo_supplicants), |
364 | }; | 380 | }; |
365 | 381 | ||
366 | static struct platform_device power_supply = { | 382 | static struct platform_device power_supply = { |
@@ -374,7 +390,8 @@ static struct platform_device power_supply = { | |||
374 | /****************************************************************************** | 390 | /****************************************************************************** |
375 | * Vibra and LEDs | 391 | * Vibra and LEDs |
376 | ******************************************************************************/ | 392 | ******************************************************************************/ |
377 | static struct gpio_led gpio_leds[] = { | 393 | #ifdef CONFIG_MACH_TREO680 |
394 | static struct gpio_led treo680_gpio_leds[] = { | ||
378 | { | 395 | { |
379 | .name = "treo680:vibra:vibra", | 396 | .name = "treo680:vibra:vibra", |
380 | .default_trigger = "none", | 397 | .default_trigger = "none", |
@@ -383,34 +400,34 @@ static struct gpio_led gpio_leds[] = { | |||
383 | { | 400 | { |
384 | .name = "treo680:green:led", | 401 | .name = "treo680:green:led", |
385 | .default_trigger = "mmc0", | 402 | .default_trigger = "mmc0", |
386 | .gpio = GPIO_NR_TREO680_GREEN_LED, | 403 | .gpio = GPIO_NR_TREO_GREEN_LED, |
387 | }, | 404 | }, |
388 | { | 405 | { |
389 | .name = "treo680:keybbl:keybbl", | 406 | .name = "treo680:white:keybbl", |
390 | .default_trigger = "none", | 407 | .default_trigger = "none", |
391 | .gpio = GPIO_NR_TREO680_KEYB_BL, | 408 | .gpio = GPIO_NR_TREO680_KEYB_BL, |
392 | }, | 409 | }, |
393 | }; | 410 | }; |
394 | 411 | ||
395 | static struct gpio_led_platform_data gpio_led_info = { | 412 | static struct gpio_led_platform_data treo680_gpio_led_info = { |
396 | .leds = gpio_leds, | 413 | .leds = treo680_gpio_leds, |
397 | .num_leds = ARRAY_SIZE(gpio_leds), | 414 | .num_leds = ARRAY_SIZE(treo680_gpio_leds), |
398 | }; | 415 | }; |
399 | 416 | ||
400 | static struct platform_device treo680_leds = { | 417 | static struct platform_device treo680_leds = { |
401 | .name = "leds-gpio", | 418 | .name = "leds-gpio", |
402 | .id = -1, | 419 | .id = -1, |
403 | .dev = { | 420 | .dev = { |
404 | .platform_data = &gpio_led_info, | 421 | .platform_data = &treo680_gpio_led_info, |
405 | } | 422 | } |
406 | }; | 423 | }; |
407 | 424 | #endif /* CONFIG_MACH_TREO680 */ | |
408 | 425 | ||
409 | /****************************************************************************** | 426 | /****************************************************************************** |
410 | * Framebuffer | 427 | * Framebuffer |
411 | ******************************************************************************/ | 428 | ******************************************************************************/ |
412 | /* TODO: add support for 324x324 */ | 429 | /* TODO: add support for 324x324 */ |
413 | static struct pxafb_mode_info treo680_lcd_modes[] = { | 430 | static struct pxafb_mode_info treo_lcd_modes[] = { |
414 | { | 431 | { |
415 | .pixclock = 86538, | 432 | .pixclock = 86538, |
416 | .xres = 320, | 433 | .xres = 320, |
@@ -427,21 +444,21 @@ static struct pxafb_mode_info treo680_lcd_modes[] = { | |||
427 | }, | 444 | }, |
428 | }; | 445 | }; |
429 | 446 | ||
430 | static void treo680_lcd_power(int on, struct fb_var_screeninfo *info) | 447 | static void treo_lcd_power(int on, struct fb_var_screeninfo *info) |
431 | { | 448 | { |
432 | gpio_set_value(GPIO_NR_TREO680_BL_POWER, on); | 449 | gpio_set_value(GPIO_NR_TREO_BL_POWER, on); |
433 | } | 450 | } |
434 | 451 | ||
435 | static struct pxafb_mach_info treo680_lcd_screen = { | 452 | static struct pxafb_mach_info treo_lcd_screen = { |
436 | .modes = treo680_lcd_modes, | 453 | .modes = treo_lcd_modes, |
437 | .num_modes = ARRAY_SIZE(treo680_lcd_modes), | 454 | .num_modes = ARRAY_SIZE(treo_lcd_modes), |
438 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, | 455 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, |
439 | }; | 456 | }; |
440 | 457 | ||
441 | /****************************************************************************** | 458 | /****************************************************************************** |
442 | * Power management - standby | 459 | * Power management - standby |
443 | ******************************************************************************/ | 460 | ******************************************************************************/ |
444 | static void __init treo680_pm_init(void) | 461 | static void __init treo_pm_init(void) |
445 | { | 462 | { |
446 | static u32 resume[] = { | 463 | static u32 resume[] = { |
447 | 0xe3a00101, /* mov r0, #0x40000000 */ | 464 | 0xe3a00101, /* mov r0, #0x40000000 */ |
@@ -450,70 +467,85 @@ static void __init treo680_pm_init(void) | |||
450 | }; | 467 | }; |
451 | 468 | ||
452 | /* this is where the bootloader jumps */ | 469 | /* this is where the bootloader jumps */ |
453 | memcpy(phys_to_virt(TREO680_STR_BASE), resume, sizeof(resume)); | 470 | memcpy(phys_to_virt(TREO_STR_BASE), resume, sizeof(resume)); |
454 | } | 471 | } |
455 | 472 | ||
456 | /****************************************************************************** | 473 | /****************************************************************************** |
457 | * Machine init | 474 | * Machine init |
458 | ******************************************************************************/ | 475 | ******************************************************************************/ |
459 | static struct platform_device *devices[] __initdata = { | 476 | static struct platform_device *treo_devices[] __initdata = { |
460 | &treo680_backlight, | 477 | &treo_backlight, |
461 | &treo680_leds, | ||
462 | &power_supply, | 478 | &power_supply, |
463 | }; | 479 | }; |
464 | 480 | ||
481 | #ifdef CONFIG_MACH_TREO680 | ||
482 | static struct platform_device *treo680_devices[] __initdata = { | ||
483 | &treo680_leds, | ||
484 | }; | ||
485 | #endif /* CONFIG_MACH_TREO680 */ | ||
486 | |||
465 | /* setup udc GPIOs initial state */ | 487 | /* setup udc GPIOs initial state */ |
466 | static void __init treo680_udc_init(void) | 488 | static void __init treo_udc_init(void) |
467 | { | 489 | { |
468 | if (!gpio_request(GPIO_NR_TREO680_USB_PULLUP, "UDC Vbus")) { | 490 | if (!gpio_request(GPIO_NR_TREO_USB_PULLUP, "UDC Vbus")) { |
469 | gpio_direction_output(GPIO_NR_TREO680_USB_PULLUP, 1); | 491 | gpio_direction_output(GPIO_NR_TREO_USB_PULLUP, 1); |
470 | gpio_free(GPIO_NR_TREO680_USB_PULLUP); | 492 | gpio_free(GPIO_NR_TREO_USB_PULLUP); |
471 | } | 493 | } |
472 | } | 494 | } |
473 | 495 | ||
474 | static void __init treo680_lcd_power_init(void) | 496 | static void __init treo_lcd_power_init(void) |
475 | { | 497 | { |
476 | int ret; | 498 | int ret; |
477 | 499 | ||
478 | ret = gpio_request(GPIO_NR_TREO680_LCD_POWER, "LCD POWER"); | 500 | ret = gpio_request(GPIO_NR_TREO_LCD_POWER, "LCD POWER"); |
479 | if (ret) { | 501 | if (ret) { |
480 | pr_err("Treo680: LCD power GPIO request failed!\n"); | 502 | pr_err("Treo680: LCD power GPIO request failed!\n"); |
481 | return; | 503 | return; |
482 | } | 504 | } |
483 | 505 | ||
484 | ret = gpio_direction_output(GPIO_NR_TREO680_LCD_POWER, 0); | 506 | ret = gpio_direction_output(GPIO_NR_TREO_LCD_POWER, 0); |
485 | if (ret) { | 507 | if (ret) { |
486 | pr_err("Treo680: setting LCD power GPIO direction failed!\n"); | 508 | pr_err("Treo680: setting LCD power GPIO direction failed!\n"); |
487 | gpio_free(GPIO_NR_TREO680_LCD_POWER); | 509 | gpio_free(GPIO_NR_TREO_LCD_POWER); |
488 | return; | 510 | return; |
489 | } | 511 | } |
490 | 512 | ||
491 | treo680_lcd_screen.pxafb_lcd_power = treo680_lcd_power; | 513 | treo_lcd_screen.pxafb_lcd_power = treo_lcd_power; |
492 | } | 514 | } |
493 | 515 | ||
516 | static void __init treo_init(void) | ||
517 | { | ||
518 | treo_pm_init(); | ||
519 | pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config)); | ||
520 | treo_lcd_power_init(); | ||
521 | set_pxa_fb_info(&treo_lcd_screen); | ||
522 | treo_udc_init(); | ||
523 | pxa_set_udc_info(&treo_udc_info); | ||
524 | pxa_set_ac97_info(&treo_ac97_pdata); | ||
525 | pxa_set_ficp_info(&treo_ficp_info); | ||
526 | |||
527 | platform_add_devices(ARRAY_AND_SIZE(treo_devices)); | ||
528 | } | ||
529 | |||
530 | #ifdef CONFIG_MACH_TREO680 | ||
494 | static void __init treo680_init(void) | 531 | static void __init treo680_init(void) |
495 | { | 532 | { |
496 | treo680_pm_init(); | 533 | treo_init(); |
497 | pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config)); | 534 | pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config)); |
498 | pxa_set_keypad_info(&treo680_keypad_platform_data); | ||
499 | treo680_lcd_power_init(); | ||
500 | set_pxa_fb_info(&treo680_lcd_screen); | ||
501 | pxa_set_mci_info(&treo680_mci_platform_data); | 535 | pxa_set_mci_info(&treo680_mci_platform_data); |
502 | treo680_udc_init(); | 536 | pxa_set_keypad_info(&treo680_keypad_platform_data); |
503 | pxa_set_udc_info(&treo680_udc_info); | ||
504 | pxa_set_ac97_info(&treo680_ac97_pdata); | ||
505 | pxa_set_ficp_info(&treo680_ficp_info); | ||
506 | pxa_set_ohci_info(&treo680_ohci_info); | 537 | pxa_set_ohci_info(&treo680_ohci_info); |
507 | 538 | ||
508 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 539 | platform_add_devices(ARRAY_AND_SIZE(treo680_devices)); |
509 | } | 540 | } |
510 | 541 | ||
511 | MACHINE_START(TREO680, "Palm Treo 680") | 542 | MACHINE_START(TREO680, "Palm Treo 680") |
512 | .phys_io = TREO680_PHYS_IO_START, | 543 | .phys_io = TREO_PHYS_IO_START, |
513 | .io_pg_offst = io_p2v(0x40000000), | 544 | .io_pg_offst = io_p2v(0x40000000), |
514 | .boot_params = 0xa0000100, | 545 | .boot_params = 0xa0000100, |
515 | .map_io = pxa_map_io, | 546 | .map_io = pxa_map_io, |
516 | .init_irq = pxa27x_init_irq, | 547 | .init_irq = pxa27x_init_irq, |
517 | .timer = &pxa_timer, | 548 | .timer = &pxa_timer, |
518 | .init_machine = treo680_init, | 549 | .init_machine = treo680_init, |
519 | MACHINE_END | 550 | MACHINE_END |
551 | #endif /* CONFIG_MACH_TREO680 */ | ||