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.
6 * Copyright (c) 2006-2007 Philipp Zabel
8 * Based on hx4700.c, spitz.c and others.
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.
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>
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>
41 static void magician_irda_transceiver_mode(struct device
*dev
, int mode
)
43 gpio_set_value(GPIO83_MAGICIAN_nIR_EN
, mode
& IR_OFF
);
46 static struct pxaficp_platform_data magician_ficp_info
= {
47 .transceiver_cap
= IR_SIRMODE
| IR_OFF
,
48 .transceiver_mode
= magician_irda_transceiver_mode
,
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"},
73 static struct gpio_keys_platform_data gpio_keys_data
= {
74 .buttons
= magician_button_table
,
75 .nbuttons
= ARRAY_SIZE(magician_button_table
),
78 static struct platform_device gpio_keys
= {
81 .platform_data
= &gpio_keys_data
,
87 * LCD - Toppoly TD028STEB1
90 static struct pxafb_mode_info toppoly_modes
[] = {
106 static struct pxafb_mach_info toppoly_info
= {
107 .modes
= toppoly_modes
,
110 .lccr0
= LCCR0_Color
| LCCR0_Sngl
| LCCR0_Act
,
111 .lccr3
= LCCR3_PixRsEdg
,
118 static void magician_set_bl_intensity(int intensity
)
123 PWM_PWDUTY0
= intensity
;
124 pxa_set_cken(CKEN_PWM0
, 1);
126 pxa_set_cken(CKEN_PWM0
, 0);
130 static struct generic_bl_info backlight_info
= {
131 .default_intensity
= 0x64,
133 .max_intensity
= 0xc7,
134 .set_bl_intensity
= magician_set_bl_intensity
,
137 static struct platform_device backlight
= {
140 .platform_data
= &backlight_info
,
150 static int magician_ohci_init(struct device
*dev
)
152 UHCHR
= (UHCHR
| UHCHR_SSEP2
| UHCHR_PCPL
| UHCHR_CGR
) &
153 ~(UHCHR_SSEP1
| UHCHR_SSEP3
| UHCHR_SSE
);
158 static struct pxaohci_platform_data magician_ohci_info
= {
159 .port_mode
= PMM_PERPORT_MODE
,
160 .init
= magician_ohci_init
,
169 #define PXA_CS_SIZE 0x04000000
171 static struct resource strataflash_resource
= {
172 .start
= PXA_CS0_PHYS
,
173 .end
= PXA_CS0_PHYS
+ PXA_CS_SIZE
- 1,
174 .flags
= IORESOURCE_MEM
,
177 static struct physmap_flash_data strataflash_data
= {
181 static struct platform_device strataflash
= {
182 .name
= "physmap-flash",
185 .resource
= &strataflash_resource
,
187 .platform_data
= &strataflash_data
,
195 static struct platform_device
*devices
[] __initdata
= {
201 static void __init
magician_init(void)
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
);
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
,