Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 1 | /* |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 2 | * Support for CompuLab EM-X270 platform |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 3 | * |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 4 | * Copyright (C) 2007, 2008 CompuLab, Ltd. |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 5 | * Author: Mike Rapoport <mike@compulab.co.il> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/irq.h> |
| 13 | #include <linux/platform_device.h> |
| 14 | |
| 15 | #include <linux/dm9000.h> |
| 16 | #include <linux/rtc-v3020.h> |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 17 | #include <linux/mtd/nand.h> |
| 18 | #include <linux/mtd/partitions.h> |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 19 | #include <linux/mtd/physmap.h> |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 20 | #include <linux/input.h> |
| 21 | #include <linux/gpio_keys.h> |
| 22 | #include <linux/gpio.h> |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 23 | #include <linux/mfd/da903x.h> |
| 24 | #include <linux/regulator/machine.h> |
| 25 | #include <linux/spi/spi.h> |
| 26 | #include <linux/spi/tdo24m.h> |
Mike Rapoport | 9f055c4 | 2009-02-02 08:57:53 +0200 | [diff] [blame^] | 27 | #include <linux/power_supply.h> |
| 28 | #include <linux/apm-emulation.h> |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 29 | |
| 30 | #include <media/soc_camera.h> |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 31 | |
| 32 | #include <asm/mach-types.h> |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 33 | #include <asm/mach/arch.h> |
| 34 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 35 | #include <mach/mfp-pxa27x.h> |
| 36 | #include <mach/pxa-regs.h> |
| 37 | #include <mach/pxa27x-udc.h> |
| 38 | #include <mach/audio.h> |
| 39 | #include <mach/pxafb.h> |
| 40 | #include <mach/ohci.h> |
| 41 | #include <mach/mmc.h> |
| 42 | #include <mach/pxa27x_keypad.h> |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 43 | #include <mach/i2c.h> |
| 44 | #include <mach/camera.h> |
| 45 | #include <mach/pxa2xx_spi.h> |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 46 | |
| 47 | #include "generic.h" |
Mike Rapoport | 6432f46 | 2009-02-02 08:57:51 +0200 | [diff] [blame] | 48 | #include "devices.h" |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 49 | |
| 50 | /* GPIO IRQ usage */ |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 51 | #define GPIO41_ETHIRQ (41) |
| 52 | #define GPIO13_MMC_CD (13) |
| 53 | #define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ) |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 54 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 55 | /* NAND control GPIOs */ |
| 56 | #define GPIO11_NAND_CS (11) |
| 57 | #define GPIO56_NAND_RB (56) |
| 58 | |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 59 | /* Miscelaneous GPIOs */ |
| 60 | #define GPIO93_CAM_RESET (93) |
Mike Rapoport | 6432f46 | 2009-02-02 08:57:51 +0200 | [diff] [blame] | 61 | #define GPIO95_MMC_WP (95) |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 62 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 63 | static unsigned long em_x270_pin_config[] = { |
| 64 | /* AC'97 */ |
| 65 | GPIO28_AC97_BITCLK, |
| 66 | GPIO29_AC97_SDATA_IN_0, |
| 67 | GPIO30_AC97_SDATA_OUT, |
| 68 | GPIO31_AC97_SYNC, |
| 69 | GPIO98_AC97_SYSCLK, |
| 70 | GPIO113_AC97_nRESET, |
| 71 | |
| 72 | /* BTUART */ |
| 73 | GPIO42_BTUART_RXD, |
| 74 | GPIO43_BTUART_TXD, |
| 75 | GPIO44_BTUART_CTS, |
| 76 | GPIO45_BTUART_RTS, |
| 77 | |
| 78 | /* STUART */ |
| 79 | GPIO46_STUART_RXD, |
| 80 | GPIO47_STUART_TXD, |
| 81 | |
| 82 | /* MCI controller */ |
| 83 | GPIO32_MMC_CLK, |
| 84 | GPIO112_MMC_CMD, |
| 85 | GPIO92_MMC_DAT_0, |
| 86 | GPIO109_MMC_DAT_1, |
| 87 | GPIO110_MMC_DAT_2, |
| 88 | GPIO111_MMC_DAT_3, |
| 89 | |
| 90 | /* LCD */ |
| 91 | GPIO58_LCD_LDD_0, |
| 92 | GPIO59_LCD_LDD_1, |
| 93 | GPIO60_LCD_LDD_2, |
| 94 | GPIO61_LCD_LDD_3, |
| 95 | GPIO62_LCD_LDD_4, |
| 96 | GPIO63_LCD_LDD_5, |
| 97 | GPIO64_LCD_LDD_6, |
| 98 | GPIO65_LCD_LDD_7, |
| 99 | GPIO66_LCD_LDD_8, |
| 100 | GPIO67_LCD_LDD_9, |
| 101 | GPIO68_LCD_LDD_10, |
| 102 | GPIO69_LCD_LDD_11, |
| 103 | GPIO70_LCD_LDD_12, |
| 104 | GPIO71_LCD_LDD_13, |
| 105 | GPIO72_LCD_LDD_14, |
| 106 | GPIO73_LCD_LDD_15, |
| 107 | GPIO74_LCD_FCLK, |
| 108 | GPIO75_LCD_LCLK, |
| 109 | GPIO76_LCD_PCLK, |
| 110 | GPIO77_LCD_BIAS, |
| 111 | |
| 112 | /* QCI */ |
| 113 | GPIO84_CIF_FV, |
| 114 | GPIO25_CIF_LV, |
| 115 | GPIO53_CIF_MCLK, |
| 116 | GPIO54_CIF_PCLK, |
| 117 | GPIO81_CIF_DD_0, |
| 118 | GPIO55_CIF_DD_1, |
| 119 | GPIO51_CIF_DD_2, |
| 120 | GPIO50_CIF_DD_3, |
| 121 | GPIO52_CIF_DD_4, |
| 122 | GPIO48_CIF_DD_5, |
| 123 | GPIO17_CIF_DD_6, |
| 124 | GPIO12_CIF_DD_7, |
| 125 | |
| 126 | /* I2C */ |
| 127 | GPIO117_I2C_SCL, |
| 128 | GPIO118_I2C_SDA, |
| 129 | |
| 130 | /* Keypad */ |
| 131 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, |
| 132 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, |
| 133 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, |
| 134 | GPIO34_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, |
| 135 | GPIO39_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH, |
| 136 | GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH, |
| 137 | GPIO91_KP_MKIN_6 | WAKEUP_ON_LEVEL_HIGH, |
| 138 | GPIO36_KP_MKIN_7 | WAKEUP_ON_LEVEL_HIGH, |
| 139 | GPIO103_KP_MKOUT_0, |
| 140 | GPIO104_KP_MKOUT_1, |
| 141 | GPIO105_KP_MKOUT_2, |
| 142 | GPIO106_KP_MKOUT_3, |
| 143 | GPIO107_KP_MKOUT_4, |
| 144 | GPIO108_KP_MKOUT_5, |
| 145 | GPIO96_KP_MKOUT_6, |
| 146 | GPIO22_KP_MKOUT_7, |
| 147 | |
| 148 | /* SSP1 */ |
| 149 | GPIO26_SSP1_RXD, |
| 150 | GPIO23_SSP1_SCLK, |
| 151 | GPIO24_SSP1_SFRM, |
| 152 | GPIO57_SSP1_TXD, |
| 153 | |
| 154 | /* SSP2 */ |
| 155 | GPIO19_SSP2_SCLK, |
| 156 | GPIO14_SSP2_SFRM, |
| 157 | GPIO89_SSP2_TXD, |
| 158 | GPIO88_SSP2_RXD, |
| 159 | |
| 160 | /* SDRAM and local bus */ |
| 161 | GPIO15_nCS_1, |
| 162 | GPIO78_nCS_2, |
| 163 | GPIO79_nCS_3, |
| 164 | GPIO80_nCS_4, |
| 165 | GPIO49_nPWE, |
| 166 | GPIO18_RDY, |
| 167 | |
| 168 | /* GPIO */ |
Mike Rapoport | 6432f46 | 2009-02-02 08:57:51 +0200 | [diff] [blame] | 169 | GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* sleep/resume button */ |
| 170 | GPIO95_GPIO, /* MMC Write protect */ |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 171 | |
| 172 | /* power controls */ |
| 173 | GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */ |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 174 | GPIO93_GPIO | MFP_LPM_DRIVE_LOW, /* Camera reset */ |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 175 | GPIO115_GPIO | MFP_LPM_DRIVE_LOW, /* WLAN_PWEN */ |
| 176 | |
| 177 | /* NAND controls */ |
| 178 | GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */ |
| 179 | GPIO56_GPIO, /* NAND Ready/Busy */ |
| 180 | |
| 181 | /* interrupts */ |
| 182 | GPIO13_GPIO, /* MMC card detect */ |
| 183 | GPIO41_GPIO, /* DM9000 interrupt */ |
| 184 | }; |
| 185 | |
| 186 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
| 187 | static struct resource em_x270_dm9000_resource[] = { |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 188 | [0] = { |
| 189 | .start = PXA_CS2_PHYS, |
| 190 | .end = PXA_CS2_PHYS + 3, |
| 191 | .flags = IORESOURCE_MEM, |
| 192 | }, |
| 193 | [1] = { |
| 194 | .start = PXA_CS2_PHYS + 8, |
| 195 | .end = PXA_CS2_PHYS + 8 + 0x3f, |
| 196 | .flags = IORESOURCE_MEM, |
| 197 | }, |
| 198 | [2] = { |
| 199 | .start = EM_X270_ETHIRQ, |
| 200 | .end = EM_X270_ETHIRQ, |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 201 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 202 | } |
| 203 | }; |
| 204 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 205 | static struct dm9000_plat_data em_x270_dm9000_platdata = { |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 206 | .flags = DM9000_PLATF_32BITONLY, |
| 207 | }; |
| 208 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 209 | static struct platform_device em_x270_dm9000 = { |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 210 | .name = "dm9000", |
| 211 | .id = 0, |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 212 | .num_resources = ARRAY_SIZE(em_x270_dm9000_resource), |
| 213 | .resource = em_x270_dm9000_resource, |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 214 | .dev = { |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 215 | .platform_data = &em_x270_dm9000_platdata, |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 216 | } |
| 217 | }; |
| 218 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 219 | static void __init em_x270_init_dm9000(void) |
| 220 | { |
| 221 | platform_device_register(&em_x270_dm9000); |
| 222 | } |
| 223 | #else |
| 224 | static inline void em_x270_init_dm9000(void) {} |
| 225 | #endif |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 226 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 227 | /* V3020 RTC */ |
| 228 | #if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE) |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 229 | static struct resource em_x270_v3020_resource[] = { |
| 230 | [0] = { |
| 231 | .start = PXA_CS4_PHYS, |
| 232 | .end = PXA_CS4_PHYS + 3, |
| 233 | .flags = IORESOURCE_MEM, |
| 234 | }, |
| 235 | }; |
| 236 | |
| 237 | static struct v3020_platform_data em_x270_v3020_platdata = { |
| 238 | .leftshift = 0, |
| 239 | }; |
| 240 | |
| 241 | static struct platform_device em_x270_rtc = { |
| 242 | .name = "v3020", |
| 243 | .num_resources = ARRAY_SIZE(em_x270_v3020_resource), |
| 244 | .resource = em_x270_v3020_resource, |
| 245 | .id = -1, |
| 246 | .dev = { |
| 247 | .platform_data = &em_x270_v3020_platdata, |
| 248 | } |
| 249 | }; |
| 250 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 251 | static void __init em_x270_init_rtc(void) |
| 252 | { |
| 253 | platform_device_register(&em_x270_rtc); |
| 254 | } |
| 255 | #else |
| 256 | static inline void em_x270_init_rtc(void) {} |
| 257 | #endif |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 258 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 259 | /* NAND flash */ |
| 260 | #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE) |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 261 | static inline void nand_cs_on(void) |
| 262 | { |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 263 | gpio_set_value(GPIO11_NAND_CS, 0); |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 264 | } |
| 265 | |
| 266 | static void nand_cs_off(void) |
| 267 | { |
| 268 | dsb(); |
| 269 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 270 | gpio_set_value(GPIO11_NAND_CS, 1); |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | /* hardware specific access to control-lines */ |
| 274 | static void em_x270_nand_cmd_ctl(struct mtd_info *mtd, int dat, |
| 275 | unsigned int ctrl) |
| 276 | { |
| 277 | struct nand_chip *this = mtd->priv; |
| 278 | unsigned long nandaddr = (unsigned long)this->IO_ADDR_W; |
| 279 | |
| 280 | dsb(); |
| 281 | |
| 282 | if (ctrl & NAND_CTRL_CHANGE) { |
| 283 | if (ctrl & NAND_ALE) |
| 284 | nandaddr |= (1 << 3); |
| 285 | else |
| 286 | nandaddr &= ~(1 << 3); |
| 287 | if (ctrl & NAND_CLE) |
| 288 | nandaddr |= (1 << 2); |
| 289 | else |
| 290 | nandaddr &= ~(1 << 2); |
| 291 | if (ctrl & NAND_NCE) |
| 292 | nand_cs_on(); |
| 293 | else |
| 294 | nand_cs_off(); |
| 295 | } |
| 296 | |
| 297 | dsb(); |
| 298 | this->IO_ADDR_W = (void __iomem *)nandaddr; |
| 299 | if (dat != NAND_CMD_NONE) |
| 300 | writel(dat, this->IO_ADDR_W); |
| 301 | |
| 302 | dsb(); |
| 303 | } |
| 304 | |
| 305 | /* read device ready pin */ |
| 306 | static int em_x270_nand_device_ready(struct mtd_info *mtd) |
| 307 | { |
| 308 | dsb(); |
| 309 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 310 | return gpio_get_value(GPIO56_NAND_RB); |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | static struct mtd_partition em_x270_partition_info[] = { |
| 314 | [0] = { |
| 315 | .name = "em_x270-0", |
| 316 | .offset = 0, |
| 317 | .size = SZ_4M, |
| 318 | }, |
| 319 | [1] = { |
| 320 | .name = "em_x270-1", |
| 321 | .offset = MTDPART_OFS_APPEND, |
| 322 | .size = MTDPART_SIZ_FULL |
| 323 | }, |
| 324 | }; |
| 325 | |
| 326 | static const char *em_x270_part_probes[] = { "cmdlinepart", NULL }; |
| 327 | |
| 328 | struct platform_nand_data em_x270_nand_platdata = { |
| 329 | .chip = { |
| 330 | .nr_chips = 1, |
| 331 | .chip_offset = 0, |
| 332 | .nr_partitions = ARRAY_SIZE(em_x270_partition_info), |
| 333 | .partitions = em_x270_partition_info, |
| 334 | .chip_delay = 20, |
| 335 | .part_probe_types = em_x270_part_probes, |
| 336 | }, |
| 337 | .ctrl = { |
| 338 | .hwcontrol = 0, |
| 339 | .dev_ready = em_x270_nand_device_ready, |
| 340 | .select_chip = 0, |
| 341 | .cmd_ctrl = em_x270_nand_cmd_ctl, |
| 342 | }, |
| 343 | }; |
| 344 | |
| 345 | static struct resource em_x270_nand_resource[] = { |
| 346 | [0] = { |
| 347 | .start = PXA_CS1_PHYS, |
| 348 | .end = PXA_CS1_PHYS + 12, |
| 349 | .flags = IORESOURCE_MEM, |
| 350 | }, |
| 351 | }; |
| 352 | |
| 353 | static struct platform_device em_x270_nand = { |
| 354 | .name = "gen_nand", |
| 355 | .num_resources = ARRAY_SIZE(em_x270_nand_resource), |
| 356 | .resource = em_x270_nand_resource, |
| 357 | .id = -1, |
| 358 | .dev = { |
| 359 | .platform_data = &em_x270_nand_platdata, |
| 360 | } |
| 361 | }; |
| 362 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 363 | static void __init em_x270_init_nand(void) |
| 364 | { |
| 365 | int err; |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 366 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 367 | err = gpio_request(GPIO11_NAND_CS, "NAND CS"); |
| 368 | if (err) { |
| 369 | pr_warning("EM-X270: failed to request NAND CS gpio\n"); |
| 370 | return; |
| 371 | } |
| 372 | |
| 373 | gpio_direction_output(GPIO11_NAND_CS, 1); |
| 374 | |
| 375 | err = gpio_request(GPIO56_NAND_RB, "NAND R/B"); |
| 376 | if (err) { |
| 377 | pr_warning("EM-X270: failed to request NAND R/B gpio\n"); |
| 378 | gpio_free(GPIO11_NAND_CS); |
| 379 | return; |
| 380 | } |
| 381 | |
| 382 | gpio_direction_input(GPIO56_NAND_RB); |
| 383 | |
| 384 | platform_device_register(&em_x270_nand); |
| 385 | } |
| 386 | #else |
| 387 | static inline void em_x270_init_nand(void) {} |
| 388 | #endif |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 389 | |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 390 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
| 391 | static struct mtd_partition em_x270_nor_parts[] = { |
| 392 | { |
| 393 | .name = "Bootloader", |
| 394 | .offset = 0x00000000, |
| 395 | .size = 0x00050000, |
| 396 | .mask_flags = MTD_WRITEABLE /* force read-only */ |
| 397 | }, { |
| 398 | .name = "Environment", |
| 399 | .offset = 0x00050000, |
| 400 | .size = 0x00010000, |
| 401 | }, { |
| 402 | .name = "Reserved", |
| 403 | .offset = 0x00060000, |
| 404 | .size = 0x00050000, |
| 405 | .mask_flags = MTD_WRITEABLE /* force read-only */ |
| 406 | }, { |
| 407 | .name = "Splashscreen", |
| 408 | .offset = 0x000b0000, |
| 409 | .size = 0x00050000, |
| 410 | } |
| 411 | }; |
| 412 | |
| 413 | static struct physmap_flash_data em_x270_nor_data[] = { |
| 414 | [0] = { |
| 415 | .width = 2, |
| 416 | .parts = em_x270_nor_parts, |
| 417 | .nr_parts = ARRAY_SIZE(em_x270_nor_parts), |
| 418 | }, |
| 419 | }; |
| 420 | |
| 421 | static struct resource em_x270_nor_flash_resource = { |
| 422 | .start = PXA_CS0_PHYS, |
| 423 | .end = PXA_CS0_PHYS + SZ_1M - 1, |
| 424 | .flags = IORESOURCE_MEM, |
| 425 | }; |
| 426 | |
| 427 | static struct platform_device em_x270_physmap_flash = { |
| 428 | .name = "physmap-flash", |
| 429 | .id = 0, |
| 430 | .num_resources = 1, |
| 431 | .resource = &em_x270_nor_flash_resource, |
| 432 | .dev = { |
| 433 | .platform_data = &em_x270_nor_data, |
| 434 | }, |
| 435 | }; |
| 436 | |
| 437 | static void __init em_x270_init_nor(void) |
| 438 | { |
| 439 | platform_device_register(&em_x270_physmap_flash); |
| 440 | } |
| 441 | #else |
| 442 | static inline void em_x270_init_nor(void) {} |
| 443 | #endif |
| 444 | |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 445 | /* PXA27x OHCI controller setup */ |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 446 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 447 | static int em_x270_ohci_init(struct device *dev) |
| 448 | { |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 449 | /* enable port 2 transiever */ |
| 450 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE; |
| 451 | |
| 452 | return 0; |
| 453 | } |
| 454 | |
| 455 | static struct pxaohci_platform_data em_x270_ohci_platform_data = { |
| 456 | .port_mode = PMM_PERPORT_MODE, |
Eric Miao | 097b533 | 2008-09-27 15:49:57 +0800 | [diff] [blame] | 457 | .flags = ENABLE_PORT1 | ENABLE_PORT2 | POWER_CONTROL_LOW, |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 458 | .init = em_x270_ohci_init, |
| 459 | }; |
| 460 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 461 | static void __init em_x270_init_ohci(void) |
| 462 | { |
| 463 | pxa_set_ohci_info(&em_x270_ohci_platform_data); |
| 464 | } |
| 465 | #else |
| 466 | static inline void em_x270_init_ohci(void) {} |
| 467 | #endif |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 468 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 469 | /* MCI controller setup */ |
| 470 | #if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE) |
Mike Rapoport | 6432f46 | 2009-02-02 08:57:51 +0200 | [diff] [blame] | 471 | static struct regulator *em_x270_sdio_ldo; |
| 472 | |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 473 | static int em_x270_mci_init(struct device *dev, |
| 474 | irq_handler_t em_x270_detect_int, |
| 475 | void *data) |
| 476 | { |
Mike Rapoport | 6432f46 | 2009-02-02 08:57:51 +0200 | [diff] [blame] | 477 | int err; |
| 478 | |
| 479 | em_x270_sdio_ldo = regulator_get(dev, "vcc sdio"); |
| 480 | if (IS_ERR(em_x270_sdio_ldo)) { |
| 481 | dev_err(dev, "can't request SDIO power supply: %ld\n", |
| 482 | PTR_ERR(em_x270_sdio_ldo)); |
| 483 | return PTR_ERR(em_x270_sdio_ldo); |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 484 | } |
| 485 | |
Mike Rapoport | 6432f46 | 2009-02-02 08:57:51 +0200 | [diff] [blame] | 486 | err = request_irq(gpio_to_irq(GPIO13_MMC_CD), em_x270_detect_int, |
| 487 | IRQF_DISABLED | IRQF_TRIGGER_RISING | |
| 488 | IRQF_TRIGGER_FALLING, |
| 489 | "MMC card detect", data); |
| 490 | if (err) { |
| 491 | dev_err(dev, "can't request MMC card detect IRQ: %d\n", err); |
| 492 | goto err_irq; |
| 493 | } |
| 494 | |
| 495 | err = gpio_request(GPIO95_MMC_WP, "MMC WP"); |
| 496 | if (err) { |
| 497 | dev_err(dev, "can't request MMC write protect: %d\n", err); |
| 498 | goto err_gpio_wp; |
| 499 | } |
| 500 | |
| 501 | gpio_direction_input(GPIO95_MMC_WP); |
| 502 | |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 503 | return 0; |
Mike Rapoport | 6432f46 | 2009-02-02 08:57:51 +0200 | [diff] [blame] | 504 | |
| 505 | err_gpio_wp: |
| 506 | free_irq(gpio_to_irq(GPIO13_MMC_CD), data); |
| 507 | err_irq: |
| 508 | regulator_put(em_x270_sdio_ldo); |
| 509 | |
| 510 | return err; |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 511 | } |
| 512 | |
| 513 | static void em_x270_mci_setpower(struct device *dev, unsigned int vdd) |
| 514 | { |
Mike Rapoport | 6432f46 | 2009-02-02 08:57:51 +0200 | [diff] [blame] | 515 | struct pxamci_platform_data* p_d = dev->platform_data; |
| 516 | |
| 517 | if ((1 << vdd) & p_d->ocr_mask) { |
| 518 | int vdd_uV = (2000 + (vdd - __ffs(MMC_VDD_20_21)) * 100) * 1000; |
| 519 | |
| 520 | regulator_set_voltage(em_x270_sdio_ldo, vdd_uV, vdd_uV); |
| 521 | regulator_enable(em_x270_sdio_ldo); |
| 522 | } else { |
| 523 | regulator_disable(em_x270_sdio_ldo); |
| 524 | } |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 525 | } |
| 526 | |
| 527 | static void em_x270_mci_exit(struct device *dev, void *data) |
| 528 | { |
Mike Rapoport | 6432f46 | 2009-02-02 08:57:51 +0200 | [diff] [blame] | 529 | free_irq(gpio_to_irq(GPIO13_MMC_CD), data); |
| 530 | } |
| 531 | |
| 532 | static int em_x270_mci_get_ro(struct device *dev) |
| 533 | { |
| 534 | return gpio_get_value(GPIO95_MMC_WP); |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 535 | } |
| 536 | |
| 537 | static struct pxamci_platform_data em_x270_mci_platform_data = { |
Mike Rapoport | 6432f46 | 2009-02-02 08:57:51 +0200 | [diff] [blame] | 538 | .ocr_mask = MMC_VDD_20_21|MMC_VDD_21_22|MMC_VDD_22_23| |
| 539 | MMC_VDD_24_25|MMC_VDD_25_26|MMC_VDD_26_27| |
| 540 | MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30| |
| 541 | MMC_VDD_30_31|MMC_VDD_31_32, |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 542 | .init = em_x270_mci_init, |
| 543 | .setpower = em_x270_mci_setpower, |
Mike Rapoport | 6432f46 | 2009-02-02 08:57:51 +0200 | [diff] [blame] | 544 | .get_ro = em_x270_mci_get_ro, |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 545 | .exit = em_x270_mci_exit, |
| 546 | }; |
| 547 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 548 | static void __init em_x270_init_mmc(void) |
| 549 | { |
Mike Rapoport | 6432f46 | 2009-02-02 08:57:51 +0200 | [diff] [blame] | 550 | em_x270_mci_platform_data.detect_delay = msecs_to_jiffies(250); |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 551 | pxa_set_mci_info(&em_x270_mci_platform_data); |
| 552 | } |
| 553 | #else |
| 554 | static inline void em_x270_init_mmc(void) {} |
| 555 | #endif |
| 556 | |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 557 | /* LCD */ |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 558 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 559 | static struct pxafb_mode_info em_x270_lcd_modes[] = { |
| 560 | [0] = { |
| 561 | .pixclock = 38250, |
| 562 | .bpp = 16, |
| 563 | .xres = 480, |
| 564 | .yres = 640, |
| 565 | .hsync_len = 8, |
| 566 | .vsync_len = 2, |
| 567 | .left_margin = 8, |
| 568 | .upper_margin = 2, |
| 569 | .right_margin = 24, |
| 570 | .lower_margin = 4, |
| 571 | .sync = 0, |
| 572 | }, |
| 573 | [1] = { |
| 574 | .pixclock = 153800, |
| 575 | .bpp = 16, |
| 576 | .xres = 240, |
| 577 | .yres = 320, |
| 578 | .hsync_len = 8, |
| 579 | .vsync_len = 2, |
| 580 | .left_margin = 8, |
| 581 | .upper_margin = 2, |
| 582 | .right_margin = 88, |
| 583 | .lower_margin = 2, |
| 584 | .sync = 0, |
| 585 | }, |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 586 | }; |
| 587 | |
| 588 | static struct pxafb_mach_info em_x270_lcd = { |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 589 | .modes = em_x270_lcd_modes, |
| 590 | .num_modes = 2, |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 591 | .lcd_conn = LCD_COLOR_TFT_16BPP, |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 592 | }; |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 593 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 594 | static void __init em_x270_init_lcd(void) |
| 595 | { |
| 596 | set_pxa_fb_info(&em_x270_lcd); |
| 597 | } |
| 598 | #else |
| 599 | static inline void em_x270_init_lcd(void) {} |
| 600 | #endif |
| 601 | |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 602 | #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE) |
| 603 | static struct pxa2xx_spi_master em_x270_spi_info = { |
| 604 | .num_chipselect = 1, |
| 605 | }; |
| 606 | |
| 607 | static struct pxa2xx_spi_chip em_x270_tdo24m_chip = { |
| 608 | .rx_threshold = 1, |
| 609 | .tx_threshold = 1, |
| 610 | }; |
| 611 | |
| 612 | static struct tdo24m_platform_data em_x270_tdo24m_pdata = { |
| 613 | .model = TDO35S, |
| 614 | }; |
| 615 | |
| 616 | static struct spi_board_info em_x270_spi_devices[] __initdata = { |
| 617 | { |
| 618 | .modalias = "tdo24m", |
| 619 | .max_speed_hz = 1000000, |
| 620 | .bus_num = 1, |
| 621 | .chip_select = 0, |
| 622 | .controller_data = &em_x270_tdo24m_chip, |
| 623 | .platform_data = &em_x270_tdo24m_pdata, |
| 624 | }, |
| 625 | }; |
| 626 | |
| 627 | static void __init em_x270_init_spi(void) |
| 628 | { |
| 629 | pxa2xx_set_spi_info(1, &em_x270_spi_info); |
| 630 | spi_register_board_info(ARRAY_AND_SIZE(em_x270_spi_devices)); |
| 631 | } |
| 632 | #else |
| 633 | static inline void em_x270_init_spi(void) {} |
| 634 | #endif |
| 635 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 636 | #if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE) |
| 637 | static void __init em_x270_init_ac97(void) |
| 638 | { |
| 639 | pxa_set_ac97_info(NULL); |
| 640 | } |
| 641 | #else |
| 642 | static inline void em_x270_init_ac97(void) {} |
| 643 | #endif |
| 644 | |
| 645 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
| 646 | static unsigned int em_x270_matrix_keys[] = { |
| 647 | KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B), |
| 648 | KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT), |
| 649 | KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D), |
| 650 | }; |
| 651 | |
| 652 | struct pxa27x_keypad_platform_data em_x270_keypad_info = { |
| 653 | /* code map for the matrix keys */ |
| 654 | .matrix_key_rows = 3, |
| 655 | .matrix_key_cols = 3, |
| 656 | .matrix_key_map = em_x270_matrix_keys, |
| 657 | .matrix_key_map_size = ARRAY_SIZE(em_x270_matrix_keys), |
| 658 | }; |
| 659 | |
| 660 | static void __init em_x270_init_keypad(void) |
| 661 | { |
| 662 | pxa_set_keypad_info(&em_x270_keypad_info); |
| 663 | } |
| 664 | #else |
| 665 | static inline void em_x270_init_keypad(void) {} |
| 666 | #endif |
| 667 | |
| 668 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 669 | static struct gpio_keys_button gpio_keys_button[] = { |
| 670 | [0] = { |
| 671 | .desc = "sleep/wakeup", |
| 672 | .code = KEY_SUSPEND, |
| 673 | .type = EV_PWR, |
| 674 | .gpio = 1, |
| 675 | .wakeup = 1, |
| 676 | }, |
| 677 | }; |
| 678 | |
| 679 | static struct gpio_keys_platform_data em_x270_gpio_keys_data = { |
| 680 | .buttons = gpio_keys_button, |
| 681 | .nbuttons = 1, |
| 682 | }; |
| 683 | |
| 684 | static struct platform_device em_x270_gpio_keys = { |
| 685 | .name = "gpio-keys", |
| 686 | .id = -1, |
| 687 | .dev = { |
| 688 | .platform_data = &em_x270_gpio_keys_data, |
| 689 | }, |
| 690 | }; |
| 691 | |
| 692 | static void __init em_x270_init_gpio_keys(void) |
| 693 | { |
| 694 | platform_device_register(&em_x270_gpio_keys); |
| 695 | } |
| 696 | #else |
| 697 | static inline void em_x270_init_gpio_keys(void) {} |
| 698 | #endif |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 699 | |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 700 | /* Quick Capture Interface and sensor setup */ |
| 701 | #if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE) |
| 702 | static struct regulator *em_x270_camera_ldo; |
| 703 | |
| 704 | static int em_x270_sensor_init(struct device *dev) |
| 705 | { |
| 706 | int ret; |
| 707 | |
| 708 | ret = gpio_request(GPIO93_CAM_RESET, "camera reset"); |
| 709 | if (ret) |
| 710 | return ret; |
| 711 | |
| 712 | gpio_direction_output(GPIO93_CAM_RESET, 0); |
| 713 | |
| 714 | em_x270_camera_ldo = regulator_get(NULL, "vcc cam"); |
| 715 | if (em_x270_camera_ldo == NULL) { |
| 716 | gpio_free(GPIO93_CAM_RESET); |
| 717 | return -ENODEV; |
| 718 | } |
| 719 | |
| 720 | ret = regulator_enable(em_x270_camera_ldo); |
| 721 | if (ret) { |
| 722 | regulator_put(em_x270_camera_ldo); |
| 723 | gpio_free(GPIO93_CAM_RESET); |
| 724 | return ret; |
| 725 | } |
| 726 | |
| 727 | gpio_set_value(GPIO93_CAM_RESET, 1); |
| 728 | |
| 729 | return 0; |
| 730 | } |
| 731 | |
| 732 | struct pxacamera_platform_data em_x270_camera_platform_data = { |
| 733 | .init = em_x270_sensor_init, |
| 734 | .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | |
| 735 | PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN, |
| 736 | .mclk_10khz = 2600, |
| 737 | }; |
| 738 | |
| 739 | static int em_x270_sensor_power(struct device *dev, int on) |
| 740 | { |
| 741 | int ret; |
| 742 | int is_on = regulator_is_enabled(em_x270_camera_ldo); |
| 743 | |
| 744 | if (on == is_on) |
| 745 | return 0; |
| 746 | |
| 747 | gpio_set_value(GPIO93_CAM_RESET, !on); |
| 748 | |
| 749 | if (on) |
| 750 | ret = regulator_enable(em_x270_camera_ldo); |
| 751 | else |
| 752 | ret = regulator_disable(em_x270_camera_ldo); |
| 753 | |
| 754 | if (ret) |
| 755 | return ret; |
| 756 | |
| 757 | gpio_set_value(GPIO93_CAM_RESET, on); |
| 758 | |
| 759 | return 0; |
| 760 | } |
| 761 | |
| 762 | static struct soc_camera_link iclink = { |
| 763 | .bus_id = 0, |
| 764 | .power = em_x270_sensor_power, |
| 765 | }; |
| 766 | |
| 767 | static struct i2c_board_info em_x270_i2c_cam_info[] = { |
| 768 | { |
| 769 | I2C_BOARD_INFO("mt9m111", 0x48), |
| 770 | .platform_data = &iclink, |
| 771 | }, |
| 772 | }; |
| 773 | |
| 774 | static struct i2c_pxa_platform_data em_x270_i2c_info = { |
| 775 | .fast_mode = 1, |
| 776 | }; |
| 777 | |
| 778 | static void __init em_x270_init_camera(void) |
| 779 | { |
| 780 | pxa_set_i2c_info(&em_x270_i2c_info); |
| 781 | i2c_register_board_info(0, ARRAY_AND_SIZE(em_x270_i2c_cam_info)); |
| 782 | pxa_set_camera_info(&em_x270_camera_platform_data); |
| 783 | } |
| 784 | #else |
| 785 | static inline void em_x270_init_camera(void) {} |
| 786 | #endif |
| 787 | |
| 788 | /* DA9030 related initializations */ |
Mike Rapoport | 432adf1 | 2009-02-02 08:57:52 +0200 | [diff] [blame] | 789 | #define REGULATOR_CONSUMER(_name, _dev, _supply) \ |
| 790 | static struct regulator_consumer_supply _name##_consumers[] = { \ |
| 791 | { \ |
| 792 | .dev = _dev, \ |
| 793 | .supply = _supply, \ |
| 794 | }, \ |
| 795 | } |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 796 | |
Mike Rapoport | 432adf1 | 2009-02-02 08:57:52 +0200 | [diff] [blame] | 797 | REGULATOR_CONSUMER(ldo3, NULL, "vcc gps"); |
| 798 | REGULATOR_CONSUMER(ldo5, NULL, "vcc cam"); |
| 799 | REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio"); |
| 800 | REGULATOR_CONSUMER(ldo12, NULL, "vcc usb"); |
| 801 | REGULATOR_CONSUMER(ldo19, NULL, "vcc gprs"); |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 802 | |
Mike Rapoport | 432adf1 | 2009-02-02 08:57:52 +0200 | [diff] [blame] | 803 | #define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \ |
| 804 | static struct regulator_init_data _ldo##_data = { \ |
| 805 | .constraints = { \ |
| 806 | .min_uV = _min_uV, \ |
| 807 | .max_uV = _max_uV, \ |
| 808 | .state_mem = { \ |
| 809 | .enabled = 0, \ |
| 810 | }, \ |
| 811 | .valid_ops_mask = _ops_mask, \ |
| 812 | }, \ |
| 813 | .num_consumer_supplies = ARRAY_SIZE(_ldo##_consumers), \ |
| 814 | .consumer_supplies = _ldo##_consumers, \ |
| 815 | }; |
Mike Rapoport | 6432f46 | 2009-02-02 08:57:51 +0200 | [diff] [blame] | 816 | |
Mike Rapoport | 432adf1 | 2009-02-02 08:57:52 +0200 | [diff] [blame] | 817 | REGULATOR_INIT(ldo3, 3200000, 3200000, REGULATOR_CHANGE_STATUS); |
| 818 | REGULATOR_INIT(ldo5, 3000000, 3000000, REGULATOR_CHANGE_STATUS); |
| 819 | REGULATOR_INIT(ldo10, 2000000, 3200000, |
| 820 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE); |
| 821 | REGULATOR_INIT(ldo12, 3000000, 3000000, REGULATOR_CHANGE_STATUS); |
| 822 | REGULATOR_INIT(ldo19, 3200000, 3200000, REGULATOR_CHANGE_STATUS); |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 823 | |
| 824 | struct led_info em_x270_led_info = { |
| 825 | .name = "em-x270:orange", |
| 826 | .default_trigger = "battery-charging-or-full", |
| 827 | }; |
| 828 | |
Mike Rapoport | 9f055c4 | 2009-02-02 08:57:53 +0200 | [diff] [blame^] | 829 | struct power_supply_info em_x270_psy_info = { |
| 830 | .name = "LP555597P6H-FPS", |
| 831 | .technology = POWER_SUPPLY_TECHNOLOGY_LIPO, |
| 832 | .voltage_max_design = 4200000, |
| 833 | .voltage_min_design = 3000000, |
| 834 | .use_for_apm = 1, |
| 835 | }; |
| 836 | |
| 837 | static void em_x270_battery_low(void) |
| 838 | { |
| 839 | apm_queue_event(APM_LOW_BATTERY); |
| 840 | } |
| 841 | |
| 842 | static void em_x270_battery_critical(void) |
| 843 | { |
| 844 | apm_queue_event(APM_CRITICAL_SUSPEND); |
| 845 | } |
| 846 | |
| 847 | struct da9030_battery_info em_x270_batterty_info = { |
| 848 | .battery_info = &em_x270_psy_info, |
| 849 | |
| 850 | .charge_milliamp = 1000, |
| 851 | .charge_millivolt = 4200, |
| 852 | |
| 853 | .vbat_low = 3600, |
| 854 | .vbat_crit = 3400, |
| 855 | .vbat_charge_start = 4100, |
| 856 | .vbat_charge_stop = 4200, |
| 857 | .vbat_charge_restart = 4000, |
| 858 | |
| 859 | .vcharge_min = 3200, |
| 860 | .vcharge_max = 5500, |
| 861 | |
| 862 | .tbat_low = 197, |
| 863 | .tbat_high = 78, |
| 864 | .tbat_restart = 100, |
| 865 | |
| 866 | .batmon_interval = 0, |
| 867 | |
| 868 | .battery_low = em_x270_battery_low, |
| 869 | .battery_critical = em_x270_battery_critical, |
| 870 | }; |
| 871 | |
Mike Rapoport | 432adf1 | 2009-02-02 08:57:52 +0200 | [diff] [blame] | 872 | #define DA9030_SUBDEV(_name, _id, _pdata) \ |
| 873 | { \ |
| 874 | .name = "da903x-" #_name, \ |
| 875 | .id = DA9030_ID_##_id, \ |
| 876 | .platform_data = _pdata, \ |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 877 | } |
Mike Rapoport | 432adf1 | 2009-02-02 08:57:52 +0200 | [diff] [blame] | 878 | |
| 879 | #define DA9030_LDO(num) DA9030_SUBDEV(regulator, LDO##num, &ldo##num##_data) |
| 880 | |
| 881 | struct da903x_subdev_info em_x270_da9030_subdevs[] = { |
| 882 | DA9030_LDO(3), |
| 883 | DA9030_LDO(5), |
| 884 | DA9030_LDO(10), |
| 885 | DA9030_LDO(12), |
| 886 | DA9030_LDO(19), |
| 887 | |
| 888 | DA9030_SUBDEV(led, LED_PC, &em_x270_led_info), |
| 889 | DA9030_SUBDEV(backlight, WLED, &em_x270_led_info), |
Mike Rapoport | 9f055c4 | 2009-02-02 08:57:53 +0200 | [diff] [blame^] | 890 | DA9030_SUBDEV(battery, BAT, &em_x270_batterty_info), |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 891 | }; |
| 892 | |
| 893 | static struct da903x_platform_data em_x270_da9030_info = { |
| 894 | .num_subdevs = ARRAY_SIZE(em_x270_da9030_subdevs), |
| 895 | .subdevs = em_x270_da9030_subdevs, |
| 896 | }; |
| 897 | |
| 898 | static struct i2c_board_info em_x270_i2c_pmic_info = { |
| 899 | I2C_BOARD_INFO("da9030", 0x49), |
| 900 | .irq = IRQ_GPIO(0), |
| 901 | .platform_data = &em_x270_da9030_info, |
| 902 | }; |
| 903 | |
| 904 | static struct i2c_pxa_platform_data em_x270_pwr_i2c_info = { |
| 905 | .use_pio = 1, |
| 906 | }; |
| 907 | |
| 908 | static void __init em_x270_init_da9030(void) |
| 909 | { |
| 910 | pxa27x_set_i2c_power_info(&em_x270_pwr_i2c_info); |
| 911 | i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1); |
| 912 | } |
| 913 | |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 914 | static void __init em_x270_init(void) |
| 915 | { |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 916 | pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_pin_config)); |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 917 | |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 918 | em_x270_init_da9030(); |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 919 | em_x270_init_dm9000(); |
| 920 | em_x270_init_rtc(); |
| 921 | em_x270_init_nand(); |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 922 | em_x270_init_nor(); |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 923 | em_x270_init_lcd(); |
| 924 | em_x270_init_mmc(); |
| 925 | em_x270_init_ohci(); |
| 926 | em_x270_init_keypad(); |
| 927 | em_x270_init_gpio_keys(); |
| 928 | em_x270_init_ac97(); |
Mike Rapoport | 28c8804 | 2008-12-03 09:38:10 +0200 | [diff] [blame] | 929 | em_x270_init_camera(); |
| 930 | em_x270_init_spi(); |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 931 | } |
| 932 | |
Mike Rapoport | 3c85bce | 2008-06-16 08:16:46 +0100 | [diff] [blame] | 933 | MACHINE_START(EM_X270, "Compulab EM-X270") |
Mike Rapoport | 3d50527 | 2007-07-18 11:31:46 +0100 | [diff] [blame] | 934 | .boot_params = 0xa0000100, |
| 935 | .phys_io = 0x40000000, |
| 936 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 937 | .map_io = pxa_map_io, |
| 938 | .init_irq = pxa27x_init_irq, |
| 939 | .timer = &pxa_timer, |
| 940 | .init_machine = em_x270_init, |
| 941 | MACHINE_END |