diff options
-rw-r--r-- | arch/arm/mach-pxa/Kconfig | 6 | ||||
-rw-r--r-- | arch/arm/mach-pxa/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-pxa/magician.c | 218 | ||||
-rw-r--r-- | include/asm-arm/arch-pxa/magician.h | 111 |
4 files changed, 336 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index b08f55d906c8..619f6fc2bfe1 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig | |||
@@ -112,6 +112,12 @@ config MACH_ARMCORE | |||
112 | select PXA27x | 112 | select PXA27x |
113 | select IWMMXT | 113 | select IWMMXT |
114 | 114 | ||
115 | config MACH_MAGICIAN | ||
116 | bool "Enable HTC Magician Support" | ||
117 | depends on ARCH_PXA | ||
118 | select PXA27x | ||
119 | select IWMMXT | ||
120 | |||
115 | endchoice | 121 | endchoice |
116 | 122 | ||
117 | if PXA_SHARPSL | 123 | if PXA_SHARPSL |
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index 04f8323c8c89..fca4e819dc5d 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
@@ -22,6 +22,7 @@ obj-$(CONFIG_MACH_AKITA) += akita-ioexp.o | |||
22 | obj-$(CONFIG_MACH_POODLE) += poodle.o corgi_ssp.o | 22 | obj-$(CONFIG_MACH_POODLE) += poodle.o corgi_ssp.o |
23 | obj-$(CONFIG_MACH_TOSA) += tosa.o | 23 | obj-$(CONFIG_MACH_TOSA) += tosa.o |
24 | obj-$(CONFIG_MACH_EM_X270) += em-x270.o | 24 | obj-$(CONFIG_MACH_EM_X270) += em-x270.o |
25 | obj-$(CONFIG_MACH_MAGICIAN) += magician.o | ||
25 | obj-$(CONFIG_ARCH_PXA_ESERIES) += eseries.o | 26 | obj-$(CONFIG_ARCH_PXA_ESERIES) += eseries.o |
26 | 27 | ||
27 | ifeq ($(CONFIG_MACH_ZYLONITE),y) | 28 | ifeq ($(CONFIG_MACH_ZYLONITE),y) |
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c new file mode 100644 index 000000000000..d98ef7ada2f8 --- /dev/null +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -0,0 +1,218 @@ | |||
1 | /* | ||
2 | * Support for HTC Magician PDA phones: | ||
3 | * i-mate JAM, O2 Xda mini, Orange SPV M500, Qtek s100, Qtek s110 | ||
4 | * and T-Mobile MDA Compact. | ||
5 | * | ||
6 | * Copyright (c) 2006-2007 Philipp Zabel | ||
7 | * | ||
8 | * Based on hx4700.c, spitz.c and others. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/gpio_keys.h> | ||
20 | #include <linux/input.h> | ||
21 | #include <linux/mtd/mtd.h> | ||
22 | #include <linux/mtd/map.h> | ||
23 | #include <linux/mtd/physmap.h> | ||
24 | |||
25 | #include <asm/gpio.h> | ||
26 | #include <asm/hardware.h> | ||
27 | #include <asm/mach-types.h> | ||
28 | #include <asm/mach/arch.h> | ||
29 | #include <asm/arch/magician.h> | ||
30 | #include <asm/arch/pxa-regs.h> | ||
31 | #include <asm/arch/pxafb.h> | ||
32 | #include <asm/arch/irda.h> | ||
33 | #include <asm/arch/ohci.h> | ||
34 | |||
35 | #include "generic.h" | ||
36 | |||
37 | /* | ||
38 | * IRDA | ||
39 | */ | ||
40 | |||
41 | static void magician_irda_transceiver_mode(struct device *dev, int mode) | ||
42 | { | ||
43 | gpio_set_value(GPIO83_MAGICIAN_nIR_EN, mode & IR_OFF); | ||
44 | } | ||
45 | |||
46 | static struct pxaficp_platform_data magician_ficp_info = { | ||
47 | .transceiver_cap = IR_SIRMODE | IR_OFF, | ||
48 | .transceiver_mode = magician_irda_transceiver_mode, | ||
49 | }; | ||
50 | |||
51 | /* | ||
52 | * GPIO Keys | ||
53 | */ | ||
54 | |||
55 | static struct gpio_keys_button magician_button_table[] = { | ||
56 | {KEY_POWER, GPIO0_MAGICIAN_KEY_POWER, 0, "Power button"}, | ||
57 | {KEY_ESC, GPIO37_MAGICIAN_KEY_HANGUP, 0, "Hangup button"}, | ||
58 | {KEY_F10, GPIO38_MAGICIAN_KEY_CONTACTS, 0, "Contacts button"}, | ||
59 | {KEY_CALENDAR, GPIO90_MAGICIAN_KEY_CALENDAR, 0, "Calendar button"}, | ||
60 | {KEY_CAMERA, GPIO91_MAGICIAN_KEY_CAMERA, 0, "Camera button"}, | ||
61 | {KEY_UP, GPIO93_MAGICIAN_KEY_UP, 0, "Up button"}, | ||
62 | {KEY_DOWN, GPIO94_MAGICIAN_KEY_DOWN, 0, "Down button"}, | ||
63 | {KEY_LEFT, GPIO95_MAGICIAN_KEY_LEFT, 0, "Left button"}, | ||
64 | {KEY_RIGHT, GPIO96_MAGICIAN_KEY_RIGHT, 0, "Right button"}, | ||
65 | {KEY_KPENTER, GPIO97_MAGICIAN_KEY_ENTER, 0, "Action button"}, | ||
66 | {KEY_RECORD, GPIO98_MAGICIAN_KEY_RECORD, 0, "Record button"}, | ||
67 | {KEY_VOLUMEUP, GPIO100_MAGICIAN_KEY_VOL_UP, 0, "Volume up"}, | ||
68 | {KEY_VOLUMEDOWN, GPIO101_MAGICIAN_KEY_VOL_DOWN, 0, "Volume down"}, | ||
69 | {KEY_PHONE, GPIO102_MAGICIAN_KEY_PHONE, 0, "Phone button"}, | ||
70 | {KEY_PLAY, GPIO99_MAGICIAN_HEADPHONE_IN, 0, "Headset button"}, | ||
71 | }; | ||
72 | |||
73 | static struct gpio_keys_platform_data gpio_keys_data = { | ||
74 | .buttons = magician_button_table, | ||
75 | .nbuttons = ARRAY_SIZE(magician_button_table), | ||
76 | }; | ||
77 | |||
78 | static struct platform_device gpio_keys = { | ||
79 | .name = "gpio-keys", | ||
80 | .dev = { | ||
81 | .platform_data = &gpio_keys_data, | ||
82 | }, | ||
83 | .id = -1, | ||
84 | }; | ||
85 | |||
86 | /* | ||
87 | * LCD - Toppoly TD028STEB1 | ||
88 | */ | ||
89 | |||
90 | static struct pxafb_mode_info toppoly_modes[] = { | ||
91 | { | ||
92 | .pixclock = 96153, | ||
93 | .bpp = 16, | ||
94 | .xres = 240, | ||
95 | .yres = 320, | ||
96 | .hsync_len = 11, | ||
97 | .vsync_len = 3, | ||
98 | .left_margin = 19, | ||
99 | .upper_margin = 2, | ||
100 | .right_margin = 10, | ||
101 | .lower_margin = 2, | ||
102 | .sync = 0, | ||
103 | }, | ||
104 | }; | ||
105 | |||
106 | static struct pxafb_mach_info toppoly_info = { | ||
107 | .modes = toppoly_modes, | ||
108 | .num_modes = 1, | ||
109 | .fixed_modes = 1, | ||
110 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, | ||
111 | .lccr3 = LCCR3_PixRsEdg, | ||
112 | }; | ||
113 | |||
114 | /* | ||
115 | * Backlight | ||
116 | */ | ||
117 | |||
118 | static void magician_set_bl_intensity(int intensity) | ||
119 | { | ||
120 | if (intensity) { | ||
121 | PWM_CTRL0 = 1; | ||
122 | PWM_PERVAL0 = 0xc8; | ||
123 | PWM_PWDUTY0 = intensity; | ||
124 | pxa_set_cken(CKEN_PWM0, 1); | ||
125 | } else { | ||
126 | pxa_set_cken(CKEN_PWM0, 0); | ||
127 | } | ||
128 | } | ||
129 | |||
130 | static struct generic_bl_info backlight_info = { | ||
131 | .default_intensity = 0x64, | ||
132 | .limit_mask = 0x0b, | ||
133 | .max_intensity = 0xc7, | ||
134 | .set_bl_intensity = magician_set_bl_intensity, | ||
135 | }; | ||
136 | |||
137 | static struct platform_device backlight = { | ||
138 | .name = "corgi-bl", | ||
139 | .dev = { | ||
140 | .platform_data = &backlight_info, | ||
141 | }, | ||
142 | .id = -1, | ||
143 | }; | ||
144 | |||
145 | |||
146 | /* | ||
147 | * USB OHCI | ||
148 | */ | ||
149 | |||
150 | static int magician_ohci_init(struct device *dev) | ||
151 | { | ||
152 | UHCHR = (UHCHR | UHCHR_SSEP2 | UHCHR_PCPL | UHCHR_CGR) & | ||
153 | ~(UHCHR_SSEP1 | UHCHR_SSEP3 | UHCHR_SSE); | ||
154 | |||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | static struct pxaohci_platform_data magician_ohci_info = { | ||
159 | .port_mode = PMM_PERPORT_MODE, | ||
160 | .init = magician_ohci_init, | ||
161 | .power_budget = 0, | ||
162 | }; | ||
163 | |||
164 | |||
165 | /* | ||
166 | * StrataFlash | ||
167 | */ | ||
168 | |||
169 | #define PXA_CS_SIZE 0x04000000 | ||
170 | |||
171 | static struct resource strataflash_resource = { | ||
172 | .start = PXA_CS0_PHYS, | ||
173 | .end = PXA_CS0_PHYS + PXA_CS_SIZE - 1, | ||
174 | .flags = IORESOURCE_MEM, | ||
175 | }; | ||
176 | |||
177 | static struct physmap_flash_data strataflash_data = { | ||
178 | .width = 4, | ||
179 | }; | ||
180 | |||
181 | static struct platform_device strataflash = { | ||
182 | .name = "physmap-flash", | ||
183 | .id = -1, | ||
184 | .num_resources = 1, | ||
185 | .resource = &strataflash_resource, | ||
186 | .dev = { | ||
187 | .platform_data = &strataflash_data, | ||
188 | }, | ||
189 | }; | ||
190 | |||
191 | /* | ||
192 | * Platform devices | ||
193 | */ | ||
194 | |||
195 | static struct platform_device *devices[] __initdata = { | ||
196 | &gpio_keys, | ||
197 | &backlight, | ||
198 | &strataflash, | ||
199 | }; | ||
200 | |||
201 | static void __init magician_init(void) | ||
202 | { | ||
203 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
204 | pxa_set_ohci_info(&magician_ohci_info); | ||
205 | pxa_set_ficp_info(&magician_ficp_info); | ||
206 | set_pxa_fb_info(&toppoly_info); | ||
207 | } | ||
208 | |||
209 | |||
210 | MACHINE_START(MAGICIAN, "HTC Magician") | ||
211 | .phys_io = 0x40000000, | ||
212 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | ||
213 | .boot_params = 0xa0000100, | ||
214 | .map_io = pxa_map_io, | ||
215 | .init_irq = pxa27x_init_irq, | ||
216 | .init_machine = magician_init, | ||
217 | .timer = &pxa_timer, | ||
218 | MACHINE_END | ||
diff --git a/include/asm-arm/arch-pxa/magician.h b/include/asm-arm/arch-pxa/magician.h new file mode 100644 index 000000000000..337f51f06b3a --- /dev/null +++ b/include/asm-arm/arch-pxa/magician.h | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | * GPIO and IRQ definitions for HTC Magician PDA phones | ||
3 | * | ||
4 | * Copyright (c) 2007 Philipp Zabel | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef _MAGICIAN_H_ | ||
13 | #define _MAGICIAN_H_ | ||
14 | |||
15 | #include <asm/arch/pxa-regs.h> | ||
16 | |||
17 | /* | ||
18 | * PXA GPIOs | ||
19 | */ | ||
20 | |||
21 | #define GPIO0_MAGICIAN_KEY_POWER 0 | ||
22 | #define GPIO9_MAGICIAN_UNKNOWN 9 | ||
23 | #define GPIO10_MAGICIAN_GSM_IRQ 10 | ||
24 | #define GPIO11_MAGICIAN_GSM_OUT1 11 | ||
25 | #define GPIO13_MAGICIAN_CPLD_IRQ 13 | ||
26 | #define GPIO18_MAGICIAN_UNKNOWN 18 | ||
27 | #define GPIO22_MAGICIAN_VIBRA_EN 22 | ||
28 | #define GPIO26_MAGICIAN_GSM_POWER 26 | ||
29 | #define GPIO27_MAGICIAN_USBC_PUEN 27 | ||
30 | #define GPIO30_MAGICIAN_nCHARGE_EN 30 | ||
31 | #define GPIO37_MAGICIAN_KEY_HANGUP 37 | ||
32 | #define GPIO38_MAGICIAN_KEY_CONTACTS 38 | ||
33 | #define GPIO40_MAGICIAN_GSM_OUT2 40 | ||
34 | #define GPIO48_MAGICIAN_UNKNOWN 48 | ||
35 | #define GPIO56_MAGICIAN_UNKNOWN 56 | ||
36 | #define GPIO57_MAGICIAN_CAM_RESET 57 | ||
37 | #define GPIO83_MAGICIAN_nIR_EN 83 | ||
38 | #define GPIO86_MAGICIAN_GSM_RESET 86 | ||
39 | #define GPIO87_MAGICIAN_GSM_SELECT 87 | ||
40 | #define GPIO90_MAGICIAN_KEY_CALENDAR 90 | ||
41 | #define GPIO91_MAGICIAN_KEY_CAMERA 91 | ||
42 | #define GPIO93_MAGICIAN_KEY_UP 93 | ||
43 | #define GPIO94_MAGICIAN_KEY_DOWN 94 | ||
44 | #define GPIO95_MAGICIAN_KEY_LEFT 95 | ||
45 | #define GPIO96_MAGICIAN_KEY_RIGHT 96 | ||
46 | #define GPIO97_MAGICIAN_KEY_ENTER 97 | ||
47 | #define GPIO98_MAGICIAN_KEY_RECORD 98 | ||
48 | #define GPIO99_MAGICIAN_HEADPHONE_IN 99 | ||
49 | #define GPIO100_MAGICIAN_KEY_VOL_UP 100 | ||
50 | #define GPIO101_MAGICIAN_KEY_VOL_DOWN 101 | ||
51 | #define GPIO102_MAGICIAN_KEY_PHONE 102 | ||
52 | #define GPIO103_MAGICIAN_LED_KP 103 | ||
53 | #define GPIO104_MAGICIAN_LCD_POWER_1 104 | ||
54 | #define GPIO105_MAGICIAN_LCD_POWER_2 105 | ||
55 | #define GPIO106_MAGICIAN_LCD_POWER_3 106 | ||
56 | #define GPIO107_MAGICIAN_DS1WM_IRQ 107 | ||
57 | #define GPIO108_MAGICIAN_GSM_READY 108 | ||
58 | #define GPIO114_MAGICIAN_UNKNOWN 114 | ||
59 | #define GPIO115_MAGICIAN_nPEN_IRQ 115 | ||
60 | #define GPIO116_MAGICIAN_nCAM_EN 116 | ||
61 | #define GPIO119_MAGICIAN_UNKNOWN 119 | ||
62 | #define GPIO120_MAGICIAN_UNKNOWN 120 | ||
63 | |||
64 | /* | ||
65 | * PXA GPIO alternate function mode & direction | ||
66 | */ | ||
67 | |||
68 | #define GPIO0_MAGICIAN_KEY_POWER_MD (0 | GPIO_IN) | ||
69 | #define GPIO9_MAGICIAN_UNKNOWN_MD (9 | GPIO_IN) | ||
70 | #define GPIO10_MAGICIAN_GSM_IRQ_MD (10 | GPIO_IN) | ||
71 | #define GPIO11_MAGICIAN_GSM_OUT1_MD (11 | GPIO_OUT) | ||
72 | #define GPIO13_MAGICIAN_CPLD_IRQ_MD (13 | GPIO_IN) | ||
73 | #define GPIO18_MAGICIAN_UNKNOWN_MD (18 | GPIO_OUT) | ||
74 | #define GPIO22_MAGICIAN_VIBRA_EN_MD (22 | GPIO_OUT) | ||
75 | #define GPIO26_MAGICIAN_GSM_POWER_MD (26 | GPIO_OUT) | ||
76 | #define GPIO27_MAGICIAN_USBC_PUEN_MD (27 | GPIO_OUT) | ||
77 | #define GPIO30_MAGICIAN_nCHARGE_EN_MD (30 | GPIO_OUT) | ||
78 | #define GPIO37_MAGICIAN_KEY_HANGUP_MD (37 | GPIO_OUT) | ||
79 | #define GPIO38_MAGICIAN_KEY_CONTACTS_MD (38 | GPIO_OUT) | ||
80 | #define GPIO40_MAGICIAN_GSM_OUT2_MD (40 | GPIO_OUT) | ||
81 | #define GPIO48_MAGICIAN_UNKNOWN_MD (48 | GPIO_OUT) | ||
82 | #define GPIO56_MAGICIAN_UNKNOWN_MD (56 | GPIO_OUT) | ||
83 | #define GPIO57_MAGICIAN_CAM_RESET_MD (57 | GPIO_OUT) | ||
84 | #define GPIO83_MAGICIAN_nIR_EN_MD (83 | GPIO_OUT) | ||
85 | #define GPIO86_MAGICIAN_GSM_RESET_MD (86 | GPIO_OUT) | ||
86 | #define GPIO87_MAGICIAN_GSM_SELECT_MD (87 | GPIO_OUT) | ||
87 | #define GPIO90_MAGICIAN_KEY_CALENDAR_MD (90 | GPIO_OUT) | ||
88 | #define GPIO91_MAGICIAN_KEY_CAMERA_MD (91 | GPIO_OUT) | ||
89 | #define GPIO93_MAGICIAN_KEY_UP_MD (93 | GPIO_IN) | ||
90 | #define GPIO94_MAGICIAN_KEY_DOWN_MD (94 | GPIO_IN) | ||
91 | #define GPIO95_MAGICIAN_KEY_LEFT_MD (95 | GPIO_IN) | ||
92 | #define GPIO96_MAGICIAN_KEY_RIGHT_MD (96 | GPIO_IN) | ||
93 | #define GPIO97_MAGICIAN_KEY_ENTER_MD (97 | GPIO_IN) | ||
94 | #define GPIO98_MAGICIAN_KEY_RECORD_MD (98 | GPIO_IN) | ||
95 | #define GPIO99_MAGICIAN_HEADPHONE_IN_MD (99 | GPIO_IN) | ||
96 | #define GPIO100_MAGICIAN_KEY_VOL_UP_MD (100 | GPIO_IN) | ||
97 | #define GPIO101_MAGICIAN_KEY_VOL_DOWN_MD (101 | GPIO_IN) | ||
98 | #define GPIO102_MAGICIAN_KEY_PHONE_MD (102 | GPIO_IN) | ||
99 | #define GPIO103_MAGICIAN_LED_KP_MD (103 | GPIO_OUT) | ||
100 | #define GPIO104_MAGICIAN_LCD_POWER_1_MD (104 | GPIO_OUT) | ||
101 | #define GPIO105_MAGICIAN_LCD_POWER_2_MD (105 | GPIO_OUT) | ||
102 | #define GPIO106_MAGICIAN_LCD_POWER_3_MD (106 | GPIO_OUT) | ||
103 | #define GPIO107_MAGICIAN_DS1WM_IRQ_MD (107 | GPIO_IN) | ||
104 | #define GPIO108_MAGICIAN_GSM_READY_MD (108 | GPIO_IN) | ||
105 | #define GPIO114_MAGICIAN_UNKNOWN_MD (114 | GPIO_OUT) | ||
106 | #define GPIO115_MAGICIAN_nPEN_IRQ_MD (115 | GPIO_IN) | ||
107 | #define GPIO116_MAGICIAN_nCAM_EN_MD (116 | GPIO_OUT) | ||
108 | #define GPIO119_MAGICIAN_UNKNOWN_MD (119 | GPIO_OUT) | ||
109 | #define GPIO120_MAGICIAN_UNKNOWN_MD (120 | GPIO_OUT) | ||
110 | |||
111 | #endif /* _MAGICIAN_H_ */ | ||