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 | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 19 | #include <linux/delay.h> |
Philipp Zabel | e181191 | 2008-06-22 13:00:55 +0100 | [diff] [blame] | 20 | #include <linux/gpio.h> |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 21 | #include <linux/gpio_keys.h> |
| 22 | #include <linux/input.h> |
Philipp Zabel | 70e357f | 2008-04-09 19:22:57 +0100 | [diff] [blame] | 23 | #include <linux/mfd/htc-egpio.h> |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 24 | #include <linux/mfd/htc-pasic3.h> |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 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 | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 27 | #include <linux/pwm_backlight.h> |
Philipp Zabel | 6489c61 | 2009-02-01 11:20:30 +0100 | [diff] [blame^] | 28 | #include <linux/usb/gpio_vbus.h> |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 29 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 30 | #include <mach/hardware.h> |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 31 | #include <asm/mach-types.h> |
| 32 | #include <asm/mach/arch.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 33 | #include <mach/magician.h> |
| 34 | #include <mach/mfp-pxa27x.h> |
| 35 | #include <mach/pxa-regs.h> |
| 36 | #include <mach/pxa2xx-regs.h> |
| 37 | #include <mach/pxafb.h> |
| 38 | #include <mach/i2c.h> |
| 39 | #include <mach/mmc.h> |
| 40 | #include <mach/irda.h> |
| 41 | #include <mach/ohci.h> |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 42 | |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 43 | #include "devices.h" |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 44 | #include "generic.h" |
| 45 | |
Philipp Zabel | 7a97010 | 2008-06-26 21:03:54 +0100 | [diff] [blame] | 46 | static unsigned long magician_pin_config[] __initdata = { |
Philipp Zabel | b168281 | 2008-04-12 13:29:22 +0100 | [diff] [blame] | 47 | |
| 48 | /* SDRAM and Static Memory I/O Signals */ |
| 49 | GPIO20_nSDCS_2, |
| 50 | GPIO21_nSDCS_3, |
| 51 | GPIO15_nCS_1, |
| 52 | GPIO78_nCS_2, /* PASIC3 */ |
| 53 | GPIO79_nCS_3, /* EGPIO CPLD */ |
| 54 | GPIO80_nCS_4, |
| 55 | GPIO33_nCS_5, |
| 56 | |
| 57 | /* I2C */ |
| 58 | GPIO117_I2C_SCL, |
| 59 | GPIO118_I2C_SDA, |
| 60 | |
| 61 | /* PWM 0 */ |
| 62 | GPIO16_PWM0_OUT, |
| 63 | |
| 64 | /* I2S */ |
| 65 | GPIO28_I2S_BITCLK_OUT, |
| 66 | GPIO29_I2S_SDATA_IN, |
| 67 | GPIO31_I2S_SYNC, |
| 68 | GPIO113_I2S_SYSCLK, |
| 69 | |
Philipp Zabel | 16c3ea4 | 2009-01-17 18:45:41 +0100 | [diff] [blame] | 70 | /* SSP 1 */ |
| 71 | GPIO23_SSP1_SCLK, |
| 72 | GPIO24_SSP1_SFRM, |
| 73 | GPIO25_SSP1_TXD, |
| 74 | |
Philipp Zabel | b168281 | 2008-04-12 13:29:22 +0100 | [diff] [blame] | 75 | /* SSP 2 */ |
| 76 | GPIO19_SSP2_SCLK, |
| 77 | GPIO14_SSP2_SFRM, |
| 78 | GPIO89_SSP2_TXD, |
| 79 | GPIO88_SSP2_RXD, |
| 80 | |
| 81 | /* MMC */ |
| 82 | GPIO32_MMC_CLK, |
| 83 | GPIO92_MMC_DAT_0, |
| 84 | GPIO109_MMC_DAT_1, |
| 85 | GPIO110_MMC_DAT_2, |
| 86 | GPIO111_MMC_DAT_3, |
| 87 | GPIO112_MMC_CMD, |
| 88 | |
| 89 | /* LCD */ |
| 90 | GPIO58_LCD_LDD_0, |
| 91 | GPIO59_LCD_LDD_1, |
| 92 | GPIO60_LCD_LDD_2, |
| 93 | GPIO61_LCD_LDD_3, |
| 94 | GPIO62_LCD_LDD_4, |
| 95 | GPIO63_LCD_LDD_5, |
| 96 | GPIO64_LCD_LDD_6, |
| 97 | GPIO65_LCD_LDD_7, |
| 98 | GPIO66_LCD_LDD_8, |
| 99 | GPIO67_LCD_LDD_9, |
| 100 | GPIO68_LCD_LDD_10, |
| 101 | GPIO69_LCD_LDD_11, |
| 102 | GPIO70_LCD_LDD_12, |
| 103 | GPIO71_LCD_LDD_13, |
| 104 | GPIO72_LCD_LDD_14, |
| 105 | GPIO73_LCD_LDD_15, |
| 106 | GPIO74_LCD_FCLK, |
| 107 | GPIO75_LCD_LCLK, |
| 108 | GPIO76_LCD_PCLK, |
| 109 | GPIO77_LCD_BIAS, |
| 110 | |
| 111 | /* QCI */ |
| 112 | GPIO12_CIF_DD_7, |
| 113 | GPIO17_CIF_DD_6, |
| 114 | GPIO50_CIF_DD_3, |
| 115 | GPIO51_CIF_DD_2, |
| 116 | GPIO52_CIF_DD_4, |
| 117 | GPIO53_CIF_MCLK, |
| 118 | GPIO54_CIF_PCLK, |
| 119 | GPIO55_CIF_DD_1, |
| 120 | GPIO81_CIF_DD_0, |
| 121 | GPIO82_CIF_DD_5, |
| 122 | GPIO84_CIF_FV, |
| 123 | GPIO85_CIF_LV, |
Philipp Zabel | 2f13195 | 2008-04-20 17:40:11 +0100 | [diff] [blame] | 124 | |
| 125 | /* Magician specific input GPIOs */ |
| 126 | GPIO9_GPIO, /* unknown */ |
| 127 | GPIO10_GPIO, /* GSM_IRQ */ |
| 128 | GPIO13_GPIO, /* CPLD_IRQ */ |
| 129 | GPIO107_GPIO, /* DS1WM_IRQ */ |
| 130 | GPIO108_GPIO, /* GSM_READY */ |
| 131 | GPIO115_GPIO, /* nPEN_IRQ */ |
Eric Miao | 6f584cf | 2008-11-28 16:00:24 +0800 | [diff] [blame] | 132 | |
| 133 | /* I2C */ |
| 134 | GPIO117_I2C_SCL, |
| 135 | GPIO118_I2C_SDA, |
Philipp Zabel | b168281 | 2008-04-12 13:29:22 +0100 | [diff] [blame] | 136 | }; |
| 137 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 138 | /* |
| 139 | * IRDA |
| 140 | */ |
| 141 | |
| 142 | static void magician_irda_transceiver_mode(struct device *dev, int mode) |
| 143 | { |
| 144 | gpio_set_value(GPIO83_MAGICIAN_nIR_EN, mode & IR_OFF); |
Dmitry Baryshkov | 0fc3ff3 | 2008-07-02 13:54:46 +0100 | [diff] [blame] | 145 | pxa2xx_transceiver_mode(dev, mode); |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 146 | } |
| 147 | |
| 148 | static struct pxaficp_platform_data magician_ficp_info = { |
| 149 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
| 150 | .transceiver_mode = magician_irda_transceiver_mode, |
| 151 | }; |
| 152 | |
| 153 | /* |
| 154 | * GPIO Keys |
| 155 | */ |
| 156 | |
Philipp Zabel | 51c10bb | 2009-01-17 18:45:44 +0100 | [diff] [blame] | 157 | #define INIT_KEY(_code, _gpio, _desc) \ |
| 158 | { \ |
| 159 | .code = KEY_##_code, \ |
| 160 | .gpio = _gpio, \ |
| 161 | .desc = _desc, \ |
| 162 | .type = EV_KEY, \ |
| 163 | .wakeup = 1, \ |
| 164 | } |
| 165 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 166 | static struct gpio_keys_button magician_button_table[] = { |
Philipp Zabel | 51c10bb | 2009-01-17 18:45:44 +0100 | [diff] [blame] | 167 | INIT_KEY(POWER, GPIO0_MAGICIAN_KEY_POWER, "Power button"), |
| 168 | INIT_KEY(ESC, GPIO37_MAGICIAN_KEY_HANGUP, "Hangup button"), |
| 169 | INIT_KEY(F10, GPIO38_MAGICIAN_KEY_CONTACTS, "Contacts button"), |
| 170 | INIT_KEY(CALENDAR, GPIO90_MAGICIAN_KEY_CALENDAR, "Calendar button"), |
| 171 | INIT_KEY(CAMERA, GPIO91_MAGICIAN_KEY_CAMERA, "Camera button"), |
| 172 | INIT_KEY(UP, GPIO93_MAGICIAN_KEY_UP, "Up button"), |
| 173 | INIT_KEY(DOWN, GPIO94_MAGICIAN_KEY_DOWN, "Down button"), |
| 174 | INIT_KEY(LEFT, GPIO95_MAGICIAN_KEY_LEFT, "Left button"), |
| 175 | INIT_KEY(RIGHT, GPIO96_MAGICIAN_KEY_RIGHT, "Right button"), |
| 176 | INIT_KEY(KPENTER, GPIO97_MAGICIAN_KEY_ENTER, "Action button"), |
| 177 | INIT_KEY(RECORD, GPIO98_MAGICIAN_KEY_RECORD, "Record button"), |
| 178 | INIT_KEY(VOLUMEUP, GPIO100_MAGICIAN_KEY_VOL_UP, "Volume up"), |
| 179 | INIT_KEY(VOLUMEDOWN, GPIO101_MAGICIAN_KEY_VOL_DOWN, "Volume down"), |
| 180 | INIT_KEY(PHONE, GPIO102_MAGICIAN_KEY_PHONE, "Phone button"), |
| 181 | INIT_KEY(PLAY, GPIO99_MAGICIAN_HEADPHONE_IN, "Headset button"), |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 182 | }; |
| 183 | |
| 184 | static struct gpio_keys_platform_data gpio_keys_data = { |
| 185 | .buttons = magician_button_table, |
| 186 | .nbuttons = ARRAY_SIZE(magician_button_table), |
| 187 | }; |
| 188 | |
| 189 | static struct platform_device gpio_keys = { |
| 190 | .name = "gpio-keys", |
| 191 | .dev = { |
| 192 | .platform_data = &gpio_keys_data, |
| 193 | }, |
| 194 | .id = -1, |
| 195 | }; |
| 196 | |
Philipp Zabel | 70e357f | 2008-04-09 19:22:57 +0100 | [diff] [blame] | 197 | |
| 198 | /* |
| 199 | * EGPIO (Xilinx CPLD) |
| 200 | * |
| 201 | * 7 32-bit aligned 8-bit registers: 3x output, 1x irq, 3x input |
| 202 | */ |
| 203 | |
| 204 | static struct resource egpio_resources[] = { |
| 205 | [0] = { |
| 206 | .start = PXA_CS3_PHYS, |
| 207 | .end = PXA_CS3_PHYS + 0x20, |
| 208 | .flags = IORESOURCE_MEM, |
| 209 | }, |
| 210 | [1] = { |
| 211 | .start = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), |
| 212 | .end = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), |
| 213 | .flags = IORESOURCE_IRQ, |
| 214 | }, |
| 215 | }; |
| 216 | |
| 217 | static struct htc_egpio_chip egpio_chips[] = { |
| 218 | [0] = { |
| 219 | .reg_start = 0, |
| 220 | .gpio_base = MAGICIAN_EGPIO(0, 0), |
| 221 | .num_gpios = 24, |
| 222 | .direction = HTC_EGPIO_OUTPUT, |
| 223 | .initial_values = 0x40, /* EGPIO_MAGICIAN_GSM_RESET */ |
| 224 | }, |
| 225 | [1] = { |
| 226 | .reg_start = 4, |
| 227 | .gpio_base = MAGICIAN_EGPIO(4, 0), |
| 228 | .num_gpios = 24, |
| 229 | .direction = HTC_EGPIO_INPUT, |
| 230 | }, |
| 231 | }; |
| 232 | |
| 233 | static struct htc_egpio_platform_data egpio_info = { |
| 234 | .reg_width = 8, |
| 235 | .bus_width = 32, |
| 236 | .irq_base = IRQ_BOARD_START, |
| 237 | .num_irqs = 4, |
| 238 | .ack_register = 3, |
| 239 | .chip = egpio_chips, |
| 240 | .num_chips = ARRAY_SIZE(egpio_chips), |
| 241 | }; |
| 242 | |
| 243 | static struct platform_device egpio = { |
| 244 | .name = "htc-egpio", |
| 245 | .id = -1, |
| 246 | .resource = egpio_resources, |
| 247 | .num_resources = ARRAY_SIZE(egpio_resources), |
| 248 | .dev = { |
| 249 | .platform_data = &egpio_info, |
| 250 | }, |
| 251 | }; |
| 252 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 253 | /* |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 254 | * LCD - Toppoly TD028STEB1 or Samsung LTP280QV |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 255 | */ |
| 256 | |
| 257 | static struct pxafb_mode_info toppoly_modes[] = { |
| 258 | { |
| 259 | .pixclock = 96153, |
| 260 | .bpp = 16, |
| 261 | .xres = 240, |
| 262 | .yres = 320, |
| 263 | .hsync_len = 11, |
| 264 | .vsync_len = 3, |
| 265 | .left_margin = 19, |
| 266 | .upper_margin = 2, |
| 267 | .right_margin = 10, |
| 268 | .lower_margin = 2, |
| 269 | .sync = 0, |
| 270 | }, |
| 271 | }; |
| 272 | |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 273 | static struct pxafb_mode_info samsung_modes[] = { |
| 274 | { |
| 275 | .pixclock = 96153, |
| 276 | .bpp = 16, |
| 277 | .xres = 240, |
| 278 | .yres = 320, |
| 279 | .hsync_len = 8, |
| 280 | .vsync_len = 4, |
| 281 | .left_margin = 9, |
| 282 | .upper_margin = 4, |
| 283 | .right_margin = 9, |
| 284 | .lower_margin = 4, |
| 285 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
| 286 | }, |
| 287 | }; |
| 288 | |
| 289 | static void toppoly_lcd_power(int on, struct fb_var_screeninfo *si) |
| 290 | { |
| 291 | pr_debug("Toppoly LCD power\n"); |
| 292 | |
| 293 | if (on) { |
| 294 | pr_debug("on\n"); |
| 295 | gpio_set_value(EGPIO_MAGICIAN_TOPPOLY_POWER, 1); |
| 296 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); |
| 297 | udelay(2000); |
| 298 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); |
| 299 | udelay(2000); |
| 300 | /* FIXME: enable LCDC here */ |
| 301 | udelay(2000); |
| 302 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); |
| 303 | udelay(2000); |
| 304 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); |
| 305 | } else { |
| 306 | pr_debug("off\n"); |
| 307 | msleep(15); |
| 308 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); |
| 309 | udelay(500); |
| 310 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); |
| 311 | udelay(1000); |
| 312 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0); |
| 313 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0); |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | static void samsung_lcd_power(int on, struct fb_var_screeninfo *si) |
| 318 | { |
| 319 | pr_debug("Samsung LCD power\n"); |
| 320 | |
| 321 | if (on) { |
| 322 | pr_debug("on\n"); |
| 323 | if (system_rev < 3) |
| 324 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 1); |
| 325 | else |
| 326 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); |
| 327 | mdelay(10); |
| 328 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); |
| 329 | mdelay(10); |
| 330 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); |
| 331 | mdelay(30); |
| 332 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); |
| 333 | mdelay(10); |
| 334 | } else { |
| 335 | pr_debug("off\n"); |
| 336 | mdelay(10); |
| 337 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); |
| 338 | mdelay(30); |
| 339 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); |
| 340 | mdelay(10); |
| 341 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0); |
| 342 | mdelay(10); |
| 343 | if (system_rev < 3) |
| 344 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 0); |
| 345 | else |
| 346 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0); |
| 347 | } |
| 348 | } |
| 349 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 350 | static struct pxafb_mach_info toppoly_info = { |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 351 | .modes = toppoly_modes, |
| 352 | .num_modes = 1, |
| 353 | .fixed_modes = 1, |
Eric Miao | 9587319 | 2008-12-07 17:49:01 +0800 | [diff] [blame] | 354 | .lcd_conn = LCD_COLOR_TFT_16BPP, |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 355 | .pxafb_lcd_power = toppoly_lcd_power, |
| 356 | }; |
| 357 | |
| 358 | static struct pxafb_mach_info samsung_info = { |
| 359 | .modes = samsung_modes, |
| 360 | .num_modes = 1, |
| 361 | .fixed_modes = 1, |
Eric Miao | 9587319 | 2008-12-07 17:49:01 +0800 | [diff] [blame] | 362 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL |\ |
| 363 | LCD_ALTERNATE_MAPPING, |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 364 | .pxafb_lcd_power = samsung_lcd_power, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 365 | }; |
| 366 | |
| 367 | /* |
| 368 | * Backlight |
| 369 | */ |
| 370 | |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 371 | static int magician_backlight_init(struct device *dev) |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 372 | { |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 373 | int ret; |
| 374 | |
| 375 | ret = gpio_request(EGPIO_MAGICIAN_BL_POWER, "BL_POWER"); |
| 376 | if (ret) |
| 377 | goto err; |
| 378 | ret = gpio_request(EGPIO_MAGICIAN_BL_POWER2, "BL_POWER2"); |
| 379 | if (ret) |
| 380 | goto err2; |
| 381 | return 0; |
| 382 | |
| 383 | err2: |
| 384 | gpio_free(EGPIO_MAGICIAN_BL_POWER); |
| 385 | err: |
| 386 | return ret; |
| 387 | } |
| 388 | |
| 389 | static int magician_backlight_notify(int brightness) |
| 390 | { |
| 391 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness); |
| 392 | if (brightness >= 200) { |
| 393 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1); |
| 394 | return brightness - 72; |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 395 | } else { |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 396 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 0); |
| 397 | return brightness; |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 398 | } |
| 399 | } |
| 400 | |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 401 | static void magician_backlight_exit(struct device *dev) |
| 402 | { |
| 403 | gpio_free(EGPIO_MAGICIAN_BL_POWER); |
| 404 | gpio_free(EGPIO_MAGICIAN_BL_POWER2); |
| 405 | } |
| 406 | |
| 407 | static struct platform_pwm_backlight_data backlight_data = { |
| 408 | .pwm_id = 0, |
| 409 | .max_brightness = 272, |
| 410 | .dft_brightness = 100, |
| 411 | .pwm_period_ns = 30923, |
| 412 | .init = magician_backlight_init, |
| 413 | .notify = magician_backlight_notify, |
| 414 | .exit = magician_backlight_exit, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 415 | }; |
| 416 | |
| 417 | static struct platform_device backlight = { |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 418 | .name = "pwm-backlight", |
Philipp Zabel | 14d1012 | 2008-06-30 18:11:55 +0100 | [diff] [blame] | 419 | .id = -1, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 420 | .dev = { |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 421 | .parent = &pxa27x_device_pwm0.dev, |
| 422 | .platform_data = &backlight_data, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 423 | }, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 424 | }; |
| 425 | |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 426 | /* |
| 427 | * LEDs |
| 428 | */ |
| 429 | |
Russell King | a55faca | 2008-09-25 14:35:48 +0100 | [diff] [blame] | 430 | static struct gpio_led gpio_leds[] = { |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 431 | { |
| 432 | .name = "magician::vibra", |
| 433 | .default_trigger = "none", |
| 434 | .gpio = GPIO22_MAGICIAN_VIBRA_EN, |
| 435 | }, |
| 436 | { |
| 437 | .name = "magician::phone_bl", |
| 438 | .default_trigger = "none", |
| 439 | .gpio = GPIO103_MAGICIAN_LED_KP, |
| 440 | }, |
| 441 | }; |
| 442 | |
| 443 | static struct gpio_led_platform_data gpio_led_info = { |
| 444 | .leds = gpio_leds, |
| 445 | .num_leds = ARRAY_SIZE(gpio_leds), |
| 446 | }; |
| 447 | |
| 448 | static struct platform_device leds_gpio = { |
| 449 | .name = "leds-gpio", |
| 450 | .id = -1, |
| 451 | .dev = { |
| 452 | .platform_data = &gpio_led_info, |
| 453 | }, |
| 454 | }; |
| 455 | |
| 456 | static struct pasic3_led pasic3_leds[] = { |
| 457 | { |
| 458 | .led = { |
| 459 | .name = "magician:red", |
| 460 | .default_trigger = "ds2760-battery.0-charging", |
| 461 | }, |
| 462 | .hw_num = 0, |
| 463 | .bit2 = PASIC3_BIT2_LED0, |
| 464 | .mask = PASIC3_MASK_LED0, |
| 465 | }, |
| 466 | { |
| 467 | .led = { |
| 468 | .name = "magician:green", |
| 469 | .default_trigger = "ds2760-battery.0-charging-or-full", |
| 470 | }, |
| 471 | .hw_num = 1, |
| 472 | .bit2 = PASIC3_BIT2_LED1, |
| 473 | .mask = PASIC3_MASK_LED1, |
| 474 | }, |
| 475 | { |
| 476 | .led = { |
| 477 | .name = "magician:blue", |
| 478 | .default_trigger = "bluetooth", |
| 479 | }, |
| 480 | .hw_num = 2, |
| 481 | .bit2 = PASIC3_BIT2_LED2, |
| 482 | .mask = PASIC3_MASK_LED2, |
| 483 | }, |
| 484 | }; |
| 485 | |
| 486 | static struct platform_device pasic3; |
| 487 | |
Philipp Zabel | e03e059 | 2008-04-24 18:10:46 +0100 | [diff] [blame] | 488 | static struct pasic3_leds_machinfo pasic3_leds_info = { |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 489 | .num_leds = ARRAY_SIZE(pasic3_leds), |
| 490 | .power_gpio = EGPIO_MAGICIAN_LED_POWER, |
| 491 | .leds = pasic3_leds, |
| 492 | }; |
| 493 | |
| 494 | /* |
| 495 | * PASIC3 with DS1WM |
| 496 | */ |
| 497 | |
| 498 | static struct resource pasic3_resources[] = { |
| 499 | [0] = { |
| 500 | .start = PXA_CS2_PHYS, |
| 501 | .end = PXA_CS2_PHYS + 0x1b, |
| 502 | .flags = IORESOURCE_MEM, |
| 503 | }, |
| 504 | /* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */ |
| 505 | [1] = { |
| 506 | .start = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), |
| 507 | .end = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), |
| 508 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
| 509 | } |
| 510 | }; |
| 511 | |
| 512 | static struct pasic3_platform_data pasic3_platform_data = { |
| 513 | .bus_shift = 2, |
| 514 | .led_pdata = &pasic3_leds_info, |
| 515 | .clock_rate = 4000000, |
| 516 | }; |
| 517 | |
| 518 | static struct platform_device pasic3 = { |
| 519 | .name = "pasic3", |
| 520 | .id = -1, |
| 521 | .num_resources = ARRAY_SIZE(pasic3_resources), |
| 522 | .resource = pasic3_resources, |
| 523 | .dev = { |
| 524 | .platform_data = &pasic3_platform_data, |
| 525 | }, |
| 526 | }; |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 527 | |
| 528 | /* |
Philipp Zabel | 6489c61 | 2009-02-01 11:20:30 +0100 | [diff] [blame^] | 529 | * USB "Transceiver" |
| 530 | */ |
| 531 | |
| 532 | static struct resource gpio_vbus_resource = { |
| 533 | .flags = IORESOURCE_IRQ, |
| 534 | .start = IRQ_MAGICIAN_VBUS, |
| 535 | .end = IRQ_MAGICIAN_VBUS, |
| 536 | }; |
| 537 | |
| 538 | static struct gpio_vbus_mach_info gpio_vbus_info = { |
| 539 | .gpio_pullup = GPIO27_MAGICIAN_USBC_PUEN, |
| 540 | .gpio_vbus = EGPIO_MAGICIAN_CABLE_STATE_USB, |
| 541 | }; |
| 542 | |
| 543 | static struct platform_device gpio_vbus = { |
| 544 | .name = "gpio-vbus", |
| 545 | .id = -1, |
| 546 | .num_resources = 1, |
| 547 | .resource = &gpio_vbus_resource, |
| 548 | .dev = { |
| 549 | .platform_data = &gpio_vbus_info, |
| 550 | }, |
| 551 | }; |
| 552 | |
| 553 | /* |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 554 | * External power |
| 555 | */ |
| 556 | |
Philipp Zabel | ff27920 | 2008-05-22 10:14:21 +0100 | [diff] [blame] | 557 | static int power_supply_init(struct device *dev) |
| 558 | { |
| 559 | int ret; |
| 560 | |
| 561 | ret = gpio_request(EGPIO_MAGICIAN_CABLE_STATE_AC, "CABLE_STATE_AC"); |
| 562 | if (ret) |
| 563 | goto err_cs_ac; |
| 564 | ret = gpio_request(EGPIO_MAGICIAN_CABLE_STATE_USB, "CABLE_STATE_USB"); |
| 565 | if (ret) |
| 566 | goto err_cs_usb; |
| 567 | ret = gpio_request(EGPIO_MAGICIAN_CHARGE_EN, "CHARGE_EN"); |
| 568 | if (ret) |
| 569 | goto err_chg_en; |
| 570 | ret = gpio_request(GPIO30_MAGICIAN_nCHARGE_EN, "nCHARGE_EN"); |
| 571 | if (!ret) |
| 572 | ret = gpio_direction_output(GPIO30_MAGICIAN_nCHARGE_EN, 0); |
| 573 | if (ret) |
| 574 | goto err_nchg_en; |
| 575 | |
| 576 | return 0; |
| 577 | |
| 578 | err_nchg_en: |
| 579 | gpio_free(EGPIO_MAGICIAN_CHARGE_EN); |
| 580 | err_chg_en: |
| 581 | gpio_free(EGPIO_MAGICIAN_CABLE_STATE_USB); |
| 582 | err_cs_usb: |
| 583 | gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC); |
| 584 | err_cs_ac: |
| 585 | return ret; |
| 586 | } |
| 587 | |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 588 | static int magician_is_ac_online(void) |
| 589 | { |
| 590 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC); |
| 591 | } |
| 592 | |
| 593 | static int magician_is_usb_online(void) |
| 594 | { |
| 595 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_USB); |
| 596 | } |
| 597 | |
| 598 | static void magician_set_charge(int flags) |
| 599 | { |
| 600 | gpio_set_value(GPIO30_MAGICIAN_nCHARGE_EN, !flags); |
| 601 | gpio_set_value(EGPIO_MAGICIAN_CHARGE_EN, flags); |
| 602 | } |
| 603 | |
Philipp Zabel | ff27920 | 2008-05-22 10:14:21 +0100 | [diff] [blame] | 604 | static void power_supply_exit(struct device *dev) |
| 605 | { |
| 606 | gpio_free(GPIO30_MAGICIAN_nCHARGE_EN); |
| 607 | gpio_free(EGPIO_MAGICIAN_CHARGE_EN); |
| 608 | gpio_free(EGPIO_MAGICIAN_CABLE_STATE_USB); |
| 609 | gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC); |
| 610 | } |
| 611 | |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 612 | static char *magician_supplicants[] = { |
| 613 | "ds2760-battery.0", "backup-battery" |
| 614 | }; |
| 615 | |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 616 | static struct pda_power_pdata power_supply_info = { |
Philipp Zabel | ff27920 | 2008-05-22 10:14:21 +0100 | [diff] [blame] | 617 | .init = power_supply_init, |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 618 | .is_ac_online = magician_is_ac_online, |
| 619 | .is_usb_online = magician_is_usb_online, |
| 620 | .set_charge = magician_set_charge, |
Philipp Zabel | ff27920 | 2008-05-22 10:14:21 +0100 | [diff] [blame] | 621 | .exit = power_supply_exit, |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 622 | .supplied_to = magician_supplicants, |
| 623 | .num_supplicants = ARRAY_SIZE(magician_supplicants), |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 624 | }; |
| 625 | |
| 626 | static struct resource power_supply_resources[] = { |
| 627 | [0] = { |
| 628 | .name = "ac", |
| 629 | .flags = IORESOURCE_IRQ, |
Philipp Zabel | 6489c61 | 2009-02-01 11:20:30 +0100 | [diff] [blame^] | 630 | .start = IRQ_MAGICIAN_VBUS, |
| 631 | .end = IRQ_MAGICIAN_VBUS, |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 632 | }, |
| 633 | [1] = { |
| 634 | .name = "usb", |
| 635 | .flags = IORESOURCE_IRQ, |
Philipp Zabel | 6489c61 | 2009-02-01 11:20:30 +0100 | [diff] [blame^] | 636 | .start = IRQ_MAGICIAN_VBUS, |
| 637 | .end = IRQ_MAGICIAN_VBUS, |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 638 | }, |
| 639 | }; |
| 640 | |
| 641 | static struct platform_device power_supply = { |
| 642 | .name = "pda-power", |
| 643 | .id = -1, |
| 644 | .dev = { |
| 645 | .platform_data = &power_supply_info, |
| 646 | }, |
| 647 | .resource = power_supply_resources, |
| 648 | .num_resources = ARRAY_SIZE(power_supply_resources), |
| 649 | }; |
| 650 | |
| 651 | |
| 652 | /* |
Philipp Zabel | bdb0c16 | 2008-04-09 19:24:55 +0100 | [diff] [blame] | 653 | * MMC/SD |
| 654 | */ |
| 655 | |
| 656 | static int magician_mci_init(struct device *dev, |
| 657 | irq_handler_t detect_irq, void *data) |
| 658 | { |
Philipp Zabel | a1999cd | 2008-04-20 17:39:12 +0100 | [diff] [blame] | 659 | int err; |
| 660 | |
| 661 | err = request_irq(IRQ_MAGICIAN_SD, detect_irq, |
Philipp Zabel | bdb0c16 | 2008-04-09 19:24:55 +0100 | [diff] [blame] | 662 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM, |
| 663 | "MMC card detect", data); |
Philipp Zabel | a1999cd | 2008-04-20 17:39:12 +0100 | [diff] [blame] | 664 | if (err) |
| 665 | goto err_request_irq; |
| 666 | err = gpio_request(EGPIO_MAGICIAN_SD_POWER, "SD_POWER"); |
| 667 | if (err) |
| 668 | goto err_request_power; |
| 669 | err = gpio_request(EGPIO_MAGICIAN_nSD_READONLY, "nSD_READONLY"); |
| 670 | if (err) |
| 671 | goto err_request_readonly; |
| 672 | |
| 673 | return 0; |
| 674 | |
| 675 | err_request_readonly: |
| 676 | gpio_free(EGPIO_MAGICIAN_SD_POWER); |
| 677 | err_request_power: |
| 678 | free_irq(IRQ_MAGICIAN_SD, data); |
| 679 | err_request_irq: |
| 680 | return err; |
Philipp Zabel | bdb0c16 | 2008-04-09 19:24:55 +0100 | [diff] [blame] | 681 | } |
| 682 | |
| 683 | static void magician_mci_setpower(struct device *dev, unsigned int vdd) |
| 684 | { |
| 685 | struct pxamci_platform_data *pdata = dev->platform_data; |
| 686 | |
| 687 | gpio_set_value(EGPIO_MAGICIAN_SD_POWER, (1 << vdd) & pdata->ocr_mask); |
| 688 | } |
| 689 | |
| 690 | static int magician_mci_get_ro(struct device *dev) |
| 691 | { |
| 692 | return (!gpio_get_value(EGPIO_MAGICIAN_nSD_READONLY)); |
| 693 | } |
| 694 | |
| 695 | static void magician_mci_exit(struct device *dev, void *data) |
| 696 | { |
Philipp Zabel | a1999cd | 2008-04-20 17:39:12 +0100 | [diff] [blame] | 697 | gpio_free(EGPIO_MAGICIAN_nSD_READONLY); |
| 698 | gpio_free(EGPIO_MAGICIAN_SD_POWER); |
Philipp Zabel | bdb0c16 | 2008-04-09 19:24:55 +0100 | [diff] [blame] | 699 | free_irq(IRQ_MAGICIAN_SD, data); |
| 700 | } |
| 701 | |
| 702 | static struct pxamci_platform_data magician_mci_info = { |
| 703 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
| 704 | .init = magician_mci_init, |
| 705 | .get_ro = magician_mci_get_ro, |
| 706 | .setpower = magician_mci_setpower, |
| 707 | .exit = magician_mci_exit, |
| 708 | }; |
| 709 | |
| 710 | |
| 711 | /* |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 712 | * USB OHCI |
| 713 | */ |
| 714 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 715 | static struct pxaohci_platform_data magician_ohci_info = { |
Eric Miao | 097b533 | 2008-09-27 15:49:57 +0800 | [diff] [blame] | 716 | .port_mode = PMM_PERPORT_MODE, |
| 717 | .flags = ENABLE_PORT1 | ENABLE_PORT3 | POWER_CONTROL_LOW, |
| 718 | .power_budget = 0, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 719 | }; |
| 720 | |
| 721 | |
| 722 | /* |
| 723 | * StrataFlash |
| 724 | */ |
| 725 | |
Philipp Zabel | aa79759 | 2008-04-09 19:24:05 +0100 | [diff] [blame] | 726 | static void magician_set_vpp(struct map_info *map, int vpp) |
| 727 | { |
| 728 | gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp); |
| 729 | } |
| 730 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 731 | static struct resource strataflash_resource = { |
| 732 | .start = PXA_CS0_PHYS, |
Philipp Zabel | fcb78d1 | 2009-01-17 18:45:43 +0100 | [diff] [blame] | 733 | .end = PXA_CS0_PHYS + SZ_64M - 1, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 734 | .flags = IORESOURCE_MEM, |
| 735 | }; |
| 736 | |
| 737 | static struct physmap_flash_data strataflash_data = { |
| 738 | .width = 4, |
Philipp Zabel | aa79759 | 2008-04-09 19:24:05 +0100 | [diff] [blame] | 739 | .set_vpp = magician_set_vpp, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 740 | }; |
| 741 | |
| 742 | static struct platform_device strataflash = { |
| 743 | .name = "physmap-flash", |
| 744 | .id = -1, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 745 | .resource = &strataflash_resource, |
Philipp Zabel | 70e357f | 2008-04-09 19:22:57 +0100 | [diff] [blame] | 746 | .num_resources = 1, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 747 | .dev = { |
| 748 | .platform_data = &strataflash_data, |
| 749 | }, |
| 750 | }; |
| 751 | |
| 752 | /* |
| 753 | * Platform devices |
| 754 | */ |
| 755 | |
| 756 | static struct platform_device *devices[] __initdata = { |
| 757 | &gpio_keys, |
Philipp Zabel | 70e357f | 2008-04-09 19:22:57 +0100 | [diff] [blame] | 758 | &egpio, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 759 | &backlight, |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 760 | &pasic3, |
Philipp Zabel | 6489c61 | 2009-02-01 11:20:30 +0100 | [diff] [blame^] | 761 | &gpio_vbus, |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 762 | &power_supply, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 763 | &strataflash, |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 764 | &leds_gpio, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 765 | }; |
| 766 | |
| 767 | static void __init magician_init(void) |
| 768 | { |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 769 | void __iomem *cpld; |
| 770 | int lcd_select; |
Philipp Zabel | a1999cd | 2008-04-20 17:39:12 +0100 | [diff] [blame] | 771 | int err; |
| 772 | |
| 773 | gpio_request(GPIO13_MAGICIAN_CPLD_IRQ, "CPLD_IRQ"); |
| 774 | gpio_request(GPIO107_MAGICIAN_DS1WM_IRQ, "DS1WM_IRQ"); |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 775 | |
Philipp Zabel | b168281 | 2008-04-12 13:29:22 +0100 | [diff] [blame] | 776 | pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config)); |
| 777 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 778 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
Philipp Zabel | a1999cd | 2008-04-20 17:39:12 +0100 | [diff] [blame] | 779 | |
| 780 | err = gpio_request(GPIO83_MAGICIAN_nIR_EN, "nIR_EN"); |
| 781 | if (!err) { |
| 782 | gpio_direction_output(GPIO83_MAGICIAN_nIR_EN, 1); |
| 783 | pxa_set_ficp_info(&magician_ficp_info); |
| 784 | } |
Philipp Zabel | dee6316 | 2009-01-17 18:45:42 +0100 | [diff] [blame] | 785 | pxa27x_set_i2c_power_info(NULL); |
Philipp Zabel | e6816f3 | 2008-04-09 19:14:15 +0100 | [diff] [blame] | 786 | pxa_set_i2c_info(NULL); |
Philipp Zabel | bdb0c16 | 2008-04-09 19:24:55 +0100 | [diff] [blame] | 787 | pxa_set_mci_info(&magician_mci_info); |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 788 | pxa_set_ohci_info(&magician_ohci_info); |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 789 | |
| 790 | /* Check LCD type we have */ |
| 791 | cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000); |
| 792 | if (cpld) { |
| 793 | u8 board_id = __raw_readb(cpld+0x14); |
Philipp Zabel | a1999cd | 2008-04-20 17:39:12 +0100 | [diff] [blame] | 794 | iounmap(cpld); |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 795 | system_rev = board_id & 0x7; |
| 796 | lcd_select = board_id & 0x8; |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 797 | pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly"); |
Philipp Zabel | a1999cd | 2008-04-20 17:39:12 +0100 | [diff] [blame] | 798 | if (lcd_select && (system_rev < 3)) { |
| 799 | gpio_request(GPIO75_MAGICIAN_SAMSUNG_POWER, "SAMSUNG_POWER"); |
| 800 | gpio_direction_output(GPIO75_MAGICIAN_SAMSUNG_POWER, 0); |
| 801 | } |
| 802 | gpio_request(GPIO104_MAGICIAN_LCD_POWER_1, "LCD_POWER_1"); |
| 803 | gpio_request(GPIO105_MAGICIAN_LCD_POWER_2, "LCD_POWER_2"); |
| 804 | gpio_request(GPIO106_MAGICIAN_LCD_POWER_3, "LCD_POWER_3"); |
| 805 | gpio_direction_output(GPIO104_MAGICIAN_LCD_POWER_1, 0); |
| 806 | gpio_direction_output(GPIO105_MAGICIAN_LCD_POWER_2, 0); |
| 807 | gpio_direction_output(GPIO106_MAGICIAN_LCD_POWER_3, 0); |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 808 | set_pxa_fb_info(lcd_select ? &samsung_info : &toppoly_info); |
| 809 | } else |
| 810 | pr_err("LCD detection: CPLD mapping failed\n"); |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 811 | } |
| 812 | |
| 813 | |
| 814 | MACHINE_START(MAGICIAN, "HTC Magician") |
| 815 | .phys_io = 0x40000000, |
| 816 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 817 | .boot_params = 0xa0000100, |
| 818 | .map_io = pxa_map_io, |
| 819 | .init_irq = pxa27x_init_irq, |
| 820 | .init_machine = magician_init, |
| 821 | .timer = &pxa_timer, |
| 822 | MACHINE_END |