Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 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> |
Philipp Zabel | e07ff8d | 2008-04-09 19:27:10 +0100 | [diff] [blame^] | 19 | #include <linux/delay.h> |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 20 | #include <linux/gpio_keys.h> |
| 21 | #include <linux/input.h> |
Philipp Zabel | 70e357f | 2008-04-09 19:22:57 +0100 | [diff] [blame] | 22 | #include <linux/mfd/htc-egpio.h> |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 23 | #include <linux/mtd/mtd.h> |
| 24 | #include <linux/mtd/map.h> |
| 25 | #include <linux/mtd/physmap.h> |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 26 | #include <linux/pda_power.h> |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 27 | |
| 28 | #include <asm/gpio.h> |
| 29 | #include <asm/hardware.h> |
| 30 | #include <asm/mach-types.h> |
| 31 | #include <asm/mach/arch.h> |
| 32 | #include <asm/arch/magician.h> |
| 33 | #include <asm/arch/pxa-regs.h> |
| 34 | #include <asm/arch/pxafb.h> |
Philipp Zabel | e6816f3 | 2008-04-09 19:14:15 +0100 | [diff] [blame] | 35 | #include <asm/arch/i2c.h> |
Philipp Zabel | bdb0c16 | 2008-04-09 19:24:55 +0100 | [diff] [blame] | 36 | #include <asm/arch/mmc.h> |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 37 | #include <asm/arch/irda.h> |
| 38 | #include <asm/arch/ohci.h> |
| 39 | |
| 40 | #include "generic.h" |
| 41 | |
| 42 | /* |
| 43 | * IRDA |
| 44 | */ |
| 45 | |
| 46 | static void magician_irda_transceiver_mode(struct device *dev, int mode) |
| 47 | { |
| 48 | gpio_set_value(GPIO83_MAGICIAN_nIR_EN, mode & IR_OFF); |
| 49 | } |
| 50 | |
| 51 | static struct pxaficp_platform_data magician_ficp_info = { |
| 52 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
| 53 | .transceiver_mode = magician_irda_transceiver_mode, |
| 54 | }; |
| 55 | |
| 56 | /* |
| 57 | * GPIO Keys |
| 58 | */ |
| 59 | |
| 60 | static struct gpio_keys_button magician_button_table[] = { |
| 61 | {KEY_POWER, GPIO0_MAGICIAN_KEY_POWER, 0, "Power button"}, |
| 62 | {KEY_ESC, GPIO37_MAGICIAN_KEY_HANGUP, 0, "Hangup button"}, |
| 63 | {KEY_F10, GPIO38_MAGICIAN_KEY_CONTACTS, 0, "Contacts button"}, |
| 64 | {KEY_CALENDAR, GPIO90_MAGICIAN_KEY_CALENDAR, 0, "Calendar button"}, |
| 65 | {KEY_CAMERA, GPIO91_MAGICIAN_KEY_CAMERA, 0, "Camera button"}, |
| 66 | {KEY_UP, GPIO93_MAGICIAN_KEY_UP, 0, "Up button"}, |
| 67 | {KEY_DOWN, GPIO94_MAGICIAN_KEY_DOWN, 0, "Down button"}, |
| 68 | {KEY_LEFT, GPIO95_MAGICIAN_KEY_LEFT, 0, "Left button"}, |
| 69 | {KEY_RIGHT, GPIO96_MAGICIAN_KEY_RIGHT, 0, "Right button"}, |
| 70 | {KEY_KPENTER, GPIO97_MAGICIAN_KEY_ENTER, 0, "Action button"}, |
| 71 | {KEY_RECORD, GPIO98_MAGICIAN_KEY_RECORD, 0, "Record button"}, |
| 72 | {KEY_VOLUMEUP, GPIO100_MAGICIAN_KEY_VOL_UP, 0, "Volume up"}, |
| 73 | {KEY_VOLUMEDOWN, GPIO101_MAGICIAN_KEY_VOL_DOWN, 0, "Volume down"}, |
| 74 | {KEY_PHONE, GPIO102_MAGICIAN_KEY_PHONE, 0, "Phone button"}, |
| 75 | {KEY_PLAY, GPIO99_MAGICIAN_HEADPHONE_IN, 0, "Headset button"}, |
| 76 | }; |
| 77 | |
| 78 | static struct gpio_keys_platform_data gpio_keys_data = { |
| 79 | .buttons = magician_button_table, |
| 80 | .nbuttons = ARRAY_SIZE(magician_button_table), |
| 81 | }; |
| 82 | |
| 83 | static struct platform_device gpio_keys = { |
| 84 | .name = "gpio-keys", |
| 85 | .dev = { |
| 86 | .platform_data = &gpio_keys_data, |
| 87 | }, |
| 88 | .id = -1, |
| 89 | }; |
| 90 | |
Philipp Zabel | 70e357f | 2008-04-09 19:22:57 +0100 | [diff] [blame] | 91 | |
| 92 | /* |
| 93 | * EGPIO (Xilinx CPLD) |
| 94 | * |
| 95 | * 7 32-bit aligned 8-bit registers: 3x output, 1x irq, 3x input |
| 96 | */ |
| 97 | |
| 98 | static struct resource egpio_resources[] = { |
| 99 | [0] = { |
| 100 | .start = PXA_CS3_PHYS, |
| 101 | .end = PXA_CS3_PHYS + 0x20, |
| 102 | .flags = IORESOURCE_MEM, |
| 103 | }, |
| 104 | [1] = { |
| 105 | .start = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), |
| 106 | .end = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), |
| 107 | .flags = IORESOURCE_IRQ, |
| 108 | }, |
| 109 | }; |
| 110 | |
| 111 | static struct htc_egpio_chip egpio_chips[] = { |
| 112 | [0] = { |
| 113 | .reg_start = 0, |
| 114 | .gpio_base = MAGICIAN_EGPIO(0, 0), |
| 115 | .num_gpios = 24, |
| 116 | .direction = HTC_EGPIO_OUTPUT, |
| 117 | .initial_values = 0x40, /* EGPIO_MAGICIAN_GSM_RESET */ |
| 118 | }, |
| 119 | [1] = { |
| 120 | .reg_start = 4, |
| 121 | .gpio_base = MAGICIAN_EGPIO(4, 0), |
| 122 | .num_gpios = 24, |
| 123 | .direction = HTC_EGPIO_INPUT, |
| 124 | }, |
| 125 | }; |
| 126 | |
| 127 | static struct htc_egpio_platform_data egpio_info = { |
| 128 | .reg_width = 8, |
| 129 | .bus_width = 32, |
| 130 | .irq_base = IRQ_BOARD_START, |
| 131 | .num_irqs = 4, |
| 132 | .ack_register = 3, |
| 133 | .chip = egpio_chips, |
| 134 | .num_chips = ARRAY_SIZE(egpio_chips), |
| 135 | }; |
| 136 | |
| 137 | static struct platform_device egpio = { |
| 138 | .name = "htc-egpio", |
| 139 | .id = -1, |
| 140 | .resource = egpio_resources, |
| 141 | .num_resources = ARRAY_SIZE(egpio_resources), |
| 142 | .dev = { |
| 143 | .platform_data = &egpio_info, |
| 144 | }, |
| 145 | }; |
| 146 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 147 | /* |
Philipp Zabel | e07ff8d | 2008-04-09 19:27:10 +0100 | [diff] [blame^] | 148 | * LCD - Toppoly TD028STEB1 or Samsung LTP280QV |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 149 | */ |
| 150 | |
| 151 | static struct pxafb_mode_info toppoly_modes[] = { |
| 152 | { |
| 153 | .pixclock = 96153, |
| 154 | .bpp = 16, |
| 155 | .xres = 240, |
| 156 | .yres = 320, |
| 157 | .hsync_len = 11, |
| 158 | .vsync_len = 3, |
| 159 | .left_margin = 19, |
| 160 | .upper_margin = 2, |
| 161 | .right_margin = 10, |
| 162 | .lower_margin = 2, |
| 163 | .sync = 0, |
| 164 | }, |
| 165 | }; |
| 166 | |
Philipp Zabel | e07ff8d | 2008-04-09 19:27:10 +0100 | [diff] [blame^] | 167 | static struct pxafb_mode_info samsung_modes[] = { |
| 168 | { |
| 169 | .pixclock = 96153, |
| 170 | .bpp = 16, |
| 171 | .xres = 240, |
| 172 | .yres = 320, |
| 173 | .hsync_len = 8, |
| 174 | .vsync_len = 4, |
| 175 | .left_margin = 9, |
| 176 | .upper_margin = 4, |
| 177 | .right_margin = 9, |
| 178 | .lower_margin = 4, |
| 179 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
| 180 | }, |
| 181 | }; |
| 182 | |
| 183 | static void toppoly_lcd_power(int on, struct fb_var_screeninfo *si) |
| 184 | { |
| 185 | pr_debug("Toppoly LCD power\n"); |
| 186 | |
| 187 | if (on) { |
| 188 | pr_debug("on\n"); |
| 189 | gpio_set_value(EGPIO_MAGICIAN_TOPPOLY_POWER, 1); |
| 190 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); |
| 191 | udelay(2000); |
| 192 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); |
| 193 | udelay(2000); |
| 194 | /* FIXME: enable LCDC here */ |
| 195 | udelay(2000); |
| 196 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); |
| 197 | udelay(2000); |
| 198 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); |
| 199 | } else { |
| 200 | pr_debug("off\n"); |
| 201 | msleep(15); |
| 202 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); |
| 203 | udelay(500); |
| 204 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); |
| 205 | udelay(1000); |
| 206 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0); |
| 207 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | static void samsung_lcd_power(int on, struct fb_var_screeninfo *si) |
| 212 | { |
| 213 | pr_debug("Samsung LCD power\n"); |
| 214 | |
| 215 | if (on) { |
| 216 | pr_debug("on\n"); |
| 217 | if (system_rev < 3) |
| 218 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 1); |
| 219 | else |
| 220 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); |
| 221 | mdelay(10); |
| 222 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); |
| 223 | mdelay(10); |
| 224 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); |
| 225 | mdelay(30); |
| 226 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); |
| 227 | mdelay(10); |
| 228 | } else { |
| 229 | pr_debug("off\n"); |
| 230 | mdelay(10); |
| 231 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); |
| 232 | mdelay(30); |
| 233 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); |
| 234 | mdelay(10); |
| 235 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0); |
| 236 | mdelay(10); |
| 237 | if (system_rev < 3) |
| 238 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 0); |
| 239 | else |
| 240 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0); |
| 241 | } |
| 242 | } |
| 243 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 244 | static struct pxafb_mach_info toppoly_info = { |
Philipp Zabel | e07ff8d | 2008-04-09 19:27:10 +0100 | [diff] [blame^] | 245 | .modes = toppoly_modes, |
| 246 | .num_modes = 1, |
| 247 | .fixed_modes = 1, |
| 248 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, |
| 249 | .lccr3 = LCCR3_PixRsEdg, |
| 250 | .pxafb_lcd_power = toppoly_lcd_power, |
| 251 | }; |
| 252 | |
| 253 | static struct pxafb_mach_info samsung_info = { |
| 254 | .modes = samsung_modes, |
| 255 | .num_modes = 1, |
| 256 | .fixed_modes = 1, |
| 257 | .lccr0 = LCCR0_LDDALT | LCCR0_Color | LCCR0_Sngl | LCCR0_Act, |
| 258 | .lccr3 = LCCR3_PixFlEdg, |
| 259 | .pxafb_lcd_power = samsung_lcd_power, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 260 | }; |
| 261 | |
| 262 | /* |
| 263 | * Backlight |
| 264 | */ |
| 265 | |
| 266 | static void magician_set_bl_intensity(int intensity) |
| 267 | { |
| 268 | if (intensity) { |
| 269 | PWM_CTRL0 = 1; |
| 270 | PWM_PERVAL0 = 0xc8; |
| 271 | PWM_PWDUTY0 = intensity; |
| 272 | pxa_set_cken(CKEN_PWM0, 1); |
| 273 | } else { |
| 274 | pxa_set_cken(CKEN_PWM0, 0); |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | static struct generic_bl_info backlight_info = { |
| 279 | .default_intensity = 0x64, |
| 280 | .limit_mask = 0x0b, |
| 281 | .max_intensity = 0xc7, |
| 282 | .set_bl_intensity = magician_set_bl_intensity, |
| 283 | }; |
| 284 | |
| 285 | static struct platform_device backlight = { |
Philipp Zabel | df56eac | 2008-04-08 19:36:06 +0100 | [diff] [blame] | 286 | .name = "generic-bl", |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 287 | .dev = { |
| 288 | .platform_data = &backlight_info, |
| 289 | }, |
| 290 | .id = -1, |
| 291 | }; |
| 292 | |
| 293 | |
| 294 | /* |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 295 | * External power |
| 296 | */ |
| 297 | |
| 298 | static int magician_is_ac_online(void) |
| 299 | { |
| 300 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC); |
| 301 | } |
| 302 | |
| 303 | static int magician_is_usb_online(void) |
| 304 | { |
| 305 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_USB); |
| 306 | } |
| 307 | |
| 308 | static void magician_set_charge(int flags) |
| 309 | { |
| 310 | gpio_set_value(GPIO30_MAGICIAN_nCHARGE_EN, !flags); |
| 311 | gpio_set_value(EGPIO_MAGICIAN_CHARGE_EN, flags); |
| 312 | } |
| 313 | |
| 314 | static struct pda_power_pdata power_supply_info = { |
| 315 | .is_ac_online = magician_is_ac_online, |
| 316 | .is_usb_online = magician_is_usb_online, |
| 317 | .set_charge = magician_set_charge, |
| 318 | }; |
| 319 | |
| 320 | static struct resource power_supply_resources[] = { |
| 321 | [0] = { |
| 322 | .name = "ac", |
| 323 | .flags = IORESOURCE_IRQ, |
| 324 | .start = IRQ_MAGICIAN_AC, |
| 325 | .end = IRQ_MAGICIAN_AC, |
| 326 | }, |
| 327 | [1] = { |
| 328 | .name = "usb", |
| 329 | .flags = IORESOURCE_IRQ, |
| 330 | .start = IRQ_MAGICIAN_AC, |
| 331 | .end = IRQ_MAGICIAN_AC, |
| 332 | }, |
| 333 | }; |
| 334 | |
| 335 | static struct platform_device power_supply = { |
| 336 | .name = "pda-power", |
| 337 | .id = -1, |
| 338 | .dev = { |
| 339 | .platform_data = &power_supply_info, |
| 340 | }, |
| 341 | .resource = power_supply_resources, |
| 342 | .num_resources = ARRAY_SIZE(power_supply_resources), |
| 343 | }; |
| 344 | |
| 345 | |
| 346 | /* |
Philipp Zabel | bdb0c16 | 2008-04-09 19:24:55 +0100 | [diff] [blame] | 347 | * MMC/SD |
| 348 | */ |
| 349 | |
| 350 | static int magician_mci_init(struct device *dev, |
| 351 | irq_handler_t detect_irq, void *data) |
| 352 | { |
| 353 | return request_irq(IRQ_MAGICIAN_SD, detect_irq, |
| 354 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM, |
| 355 | "MMC card detect", data); |
| 356 | } |
| 357 | |
| 358 | static void magician_mci_setpower(struct device *dev, unsigned int vdd) |
| 359 | { |
| 360 | struct pxamci_platform_data *pdata = dev->platform_data; |
| 361 | |
| 362 | gpio_set_value(EGPIO_MAGICIAN_SD_POWER, (1 << vdd) & pdata->ocr_mask); |
| 363 | } |
| 364 | |
| 365 | static int magician_mci_get_ro(struct device *dev) |
| 366 | { |
| 367 | return (!gpio_get_value(EGPIO_MAGICIAN_nSD_READONLY)); |
| 368 | } |
| 369 | |
| 370 | static void magician_mci_exit(struct device *dev, void *data) |
| 371 | { |
| 372 | free_irq(IRQ_MAGICIAN_SD, data); |
| 373 | } |
| 374 | |
| 375 | static struct pxamci_platform_data magician_mci_info = { |
| 376 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
| 377 | .init = magician_mci_init, |
| 378 | .get_ro = magician_mci_get_ro, |
| 379 | .setpower = magician_mci_setpower, |
| 380 | .exit = magician_mci_exit, |
| 381 | }; |
| 382 | |
| 383 | |
| 384 | /* |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 385 | * USB OHCI |
| 386 | */ |
| 387 | |
| 388 | static int magician_ohci_init(struct device *dev) |
| 389 | { |
| 390 | UHCHR = (UHCHR | UHCHR_SSEP2 | UHCHR_PCPL | UHCHR_CGR) & |
| 391 | ~(UHCHR_SSEP1 | UHCHR_SSEP3 | UHCHR_SSE); |
| 392 | |
| 393 | return 0; |
| 394 | } |
| 395 | |
| 396 | static struct pxaohci_platform_data magician_ohci_info = { |
| 397 | .port_mode = PMM_PERPORT_MODE, |
| 398 | .init = magician_ohci_init, |
| 399 | .power_budget = 0, |
| 400 | }; |
| 401 | |
| 402 | |
| 403 | /* |
| 404 | * StrataFlash |
| 405 | */ |
| 406 | |
Philipp Zabel | aa79759 | 2008-04-09 19:24:05 +0100 | [diff] [blame] | 407 | static void magician_set_vpp(struct map_info *map, int vpp) |
| 408 | { |
| 409 | gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp); |
| 410 | } |
| 411 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 412 | #define PXA_CS_SIZE 0x04000000 |
| 413 | |
| 414 | static struct resource strataflash_resource = { |
| 415 | .start = PXA_CS0_PHYS, |
| 416 | .end = PXA_CS0_PHYS + PXA_CS_SIZE - 1, |
| 417 | .flags = IORESOURCE_MEM, |
| 418 | }; |
| 419 | |
| 420 | static struct physmap_flash_data strataflash_data = { |
| 421 | .width = 4, |
Philipp Zabel | aa79759 | 2008-04-09 19:24:05 +0100 | [diff] [blame] | 422 | .set_vpp = magician_set_vpp, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 423 | }; |
| 424 | |
| 425 | static struct platform_device strataflash = { |
| 426 | .name = "physmap-flash", |
| 427 | .id = -1, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 428 | .resource = &strataflash_resource, |
Philipp Zabel | 70e357f | 2008-04-09 19:22:57 +0100 | [diff] [blame] | 429 | .num_resources = 1, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 430 | .dev = { |
| 431 | .platform_data = &strataflash_data, |
| 432 | }, |
| 433 | }; |
| 434 | |
| 435 | /* |
| 436 | * Platform devices |
| 437 | */ |
| 438 | |
| 439 | static struct platform_device *devices[] __initdata = { |
| 440 | &gpio_keys, |
Philipp Zabel | 70e357f | 2008-04-09 19:22:57 +0100 | [diff] [blame] | 441 | &egpio, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 442 | &backlight, |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 443 | &power_supply, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 444 | &strataflash, |
| 445 | }; |
| 446 | |
| 447 | static void __init magician_init(void) |
| 448 | { |
Philipp Zabel | e07ff8d | 2008-04-09 19:27:10 +0100 | [diff] [blame^] | 449 | void __iomem *cpld; |
| 450 | int lcd_select; |
| 451 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 452 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
Philipp Zabel | e6816f3 | 2008-04-09 19:14:15 +0100 | [diff] [blame] | 453 | pxa_set_i2c_info(NULL); |
Philipp Zabel | bdb0c16 | 2008-04-09 19:24:55 +0100 | [diff] [blame] | 454 | pxa_set_mci_info(&magician_mci_info); |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 455 | pxa_set_ohci_info(&magician_ohci_info); |
| 456 | pxa_set_ficp_info(&magician_ficp_info); |
Philipp Zabel | e07ff8d | 2008-04-09 19:27:10 +0100 | [diff] [blame^] | 457 | |
| 458 | /* Check LCD type we have */ |
| 459 | cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000); |
| 460 | if (cpld) { |
| 461 | u8 board_id = __raw_readb(cpld+0x14); |
| 462 | system_rev = board_id & 0x7; |
| 463 | lcd_select = board_id & 0x8; |
| 464 | iounmap(cpld); |
| 465 | pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly"); |
| 466 | if (lcd_select && (system_rev < 3)) |
| 467 | pxa_gpio_mode(GPIO75_MAGICIAN_SAMSUNG_POWER_MD); |
| 468 | pxa_gpio_mode(GPIO104_MAGICIAN_LCD_POWER_1_MD); |
| 469 | pxa_gpio_mode(GPIO105_MAGICIAN_LCD_POWER_2_MD); |
| 470 | pxa_gpio_mode(GPIO106_MAGICIAN_LCD_POWER_3_MD); |
| 471 | set_pxa_fb_info(lcd_select ? &samsung_info : &toppoly_info); |
| 472 | } else |
| 473 | pr_err("LCD detection: CPLD mapping failed\n"); |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 474 | } |
| 475 | |
| 476 | |
| 477 | MACHINE_START(MAGICIAN, "HTC Magician") |
| 478 | .phys_io = 0x40000000, |
| 479 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 480 | .boot_params = 0xa0000100, |
| 481 | .map_io = pxa_map_io, |
| 482 | .init_irq = pxa27x_init_irq, |
| 483 | .init_machine = magician_init, |
| 484 | .timer = &pxa_timer, |
| 485 | MACHINE_END |