aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-04-25 14:04:14 -0400
committerOlof Johansson <olof@lixom.net>2012-04-25 14:04:14 -0400
commitfd273d4415027f9b519d5a94e4fc030f278f2ad3 (patch)
tree5c45f3b95817b82bff534e4b1f094c0147a23393 /arch/arm/mach-imx
parent66f75a5d028beaf67c931435fdc3e7823125730c (diff)
parent435ca24116bc5365a10fa0be1bf1c1e4c5680157 (diff)
Merge tag 'imx-features-board-20120411-2' of git://git.pengutronix.de/git/imx/linux-2.6 into next/boards
* tag 'imx-features-board-20120411-2' of git://git.pengutronix.de/git/imx/linux-2.6: ARM i.MX: Visstrim_M10: Add board version detection. ARM: imx_v4_v5_defconfig: enable adc and touch driver of mc13783 ARM: i.MX: i.MX35-PDK: Add regulator support
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r--arch/arm/mach-imx/mach-imx27_visstrim_m10.c55
-rw-r--r--arch/arm/mach-imx/mach-mx35_3ds.c193
2 files changed, 248 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index f7b074f496f0..748ba2e311b5 100644
--- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -38,6 +38,7 @@
38#include <asm/mach-types.h> 38#include <asm/mach-types.h>
39#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
40#include <asm/mach/time.h> 40#include <asm/mach/time.h>
41#include <asm/system.h>
41#include <mach/common.h> 42#include <mach/common.h>
42#include <mach/iomux-mx27.h> 43#include <mach/iomux-mx27.h>
43 44
@@ -48,6 +49,14 @@
48#define OTG_PHY_CS_GPIO (GPIO_PORTF + 17) 49#define OTG_PHY_CS_GPIO (GPIO_PORTF + 17)
49#define SDHC1_IRQ IRQ_GPIOB(25) 50#define SDHC1_IRQ IRQ_GPIOB(25)
50 51
52#define MOTHERBOARD_BIT2 (GPIO_PORTD + 31)
53#define MOTHERBOARD_BIT1 (GPIO_PORTD + 30)
54#define MOTHERBOARD_BIT0 (GPIO_PORTD + 29)
55
56#define EXPBOARD_BIT2 (GPIO_PORTD + 25)
57#define EXPBOARD_BIT1 (GPIO_PORTD + 27)
58#define EXPBOARD_BIT0 (GPIO_PORTD + 28)
59
51static const int visstrim_m10_pins[] __initconst = { 60static const int visstrim_m10_pins[] __initconst = {
52 /* UART1 (console) */ 61 /* UART1 (console) */
53 PE12_PF_UART1_TXD, 62 PE12_PF_UART1_TXD,
@@ -119,6 +128,23 @@ static const int visstrim_m10_pins[] __initconst = {
119 PB19_PF_CSI_D7, 128 PB19_PF_CSI_D7,
120 PB20_PF_CSI_VSYNC, 129 PB20_PF_CSI_VSYNC,
121 PB21_PF_CSI_HSYNC, 130 PB21_PF_CSI_HSYNC,
131 /* mother board version */
132 MOTHERBOARD_BIT2 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
133 MOTHERBOARD_BIT1 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
134 MOTHERBOARD_BIT0 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
135 /* expansion board version */
136 EXPBOARD_BIT2 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
137 EXPBOARD_BIT1 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
138 EXPBOARD_BIT0 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
139};
140
141static struct gpio visstrim_m10_version_gpios[] = {
142 { EXPBOARD_BIT0, GPIOF_IN, "exp-version-0" },
143 { EXPBOARD_BIT1, GPIOF_IN, "exp-version-1" },
144 { EXPBOARD_BIT2, GPIOF_IN, "exp-version-2" },
145 { MOTHERBOARD_BIT0, GPIOF_IN, "mother-version-0" },
146 { MOTHERBOARD_BIT1, GPIOF_IN, "mother-version-1" },
147 { MOTHERBOARD_BIT2, GPIOF_IN, "mother-version-2" },
122}; 148};
123 149
124/* Camera */ 150/* Camera */
@@ -369,11 +395,40 @@ static const struct imx_ssi_platform_data visstrim_m10_ssi_pdata __initconst = {
369 .flags = IMX_SSI_DMA | IMX_SSI_SYN, 395 .flags = IMX_SSI_DMA | IMX_SSI_SYN,
370}; 396};
371 397
398static void __init visstrim_m10_revision(void)
399{
400 int exp_version = 0;
401 int mo_version = 0;
402 int ret;
403
404 ret = gpio_request_array(visstrim_m10_version_gpios,
405 ARRAY_SIZE(visstrim_m10_version_gpios));
406 if (ret) {
407 pr_err("Failed to request version gpios");
408 return;
409 }
410
411 /* Get expansion board version (negative logic) */
412 exp_version |= !gpio_get_value(EXPBOARD_BIT2) << 2;
413 exp_version |= !gpio_get_value(EXPBOARD_BIT1) << 1;
414 exp_version |= !gpio_get_value(EXPBOARD_BIT0);
415
416 /* Get mother board version (negative logic) */
417 mo_version |= !gpio_get_value(MOTHERBOARD_BIT2) << 2;
418 mo_version |= !gpio_get_value(MOTHERBOARD_BIT1) << 1;
419 mo_version |= !gpio_get_value(MOTHERBOARD_BIT0);
420
421 system_rev = 0x27000;
422 system_rev |= (mo_version << 4);
423 system_rev |= exp_version;
424}
425
372static void __init visstrim_m10_board_init(void) 426static void __init visstrim_m10_board_init(void)
373{ 427{
374 int ret; 428 int ret;
375 429
376 imx27_soc_init(); 430 imx27_soc_init();
431 visstrim_m10_revision();
377 432
378 ret = mxc_gpio_setup_multiple_pins(visstrim_m10_pins, 433 ret = mxc_gpio_setup_multiple_pins(visstrim_m10_pins,
379 ARRAY_SIZE(visstrim_m10_pins), "VISSTRIM_M10"); 434 ARRAY_SIZE(visstrim_m10_pins), "VISSTRIM_M10");
diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c
index 6ae51c6b95b7..e99b016bbbb6 100644
--- a/arch/arm/mach-imx/mach-mx35_3ds.c
+++ b/arch/arm/mach-imx/mach-mx35_3ds.c
@@ -34,6 +34,8 @@
34#include <linux/usb/otg.h> 34#include <linux/usb/otg.h>
35 35
36#include <linux/mtd/physmap.h> 36#include <linux/mtd/physmap.h>
37#include <linux/mfd/mc13892.h>
38#include <linux/regulator/machine.h>
37 39
38#include <asm/mach-types.h> 40#include <asm/mach-types.h>
39#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
@@ -253,6 +255,8 @@ static iomux_v3_cfg_t mx35pdk_pads[] = {
253 MX35_PAD_CSI_MCLK__IPU_CSI_MCLK, 255 MX35_PAD_CSI_MCLK__IPU_CSI_MCLK,
254 MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK, 256 MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK,
255 MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC, 257 MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC,
258 /*PMIC IRQ*/
259 MX35_PAD_GPIO2_0__GPIO2_0,
256}; 260};
257 261
258/* 262/*
@@ -317,6 +321,193 @@ static struct platform_device mx35_3ds_ov2640 = {
317 }, 321 },
318}; 322};
319 323
324static struct regulator_consumer_supply sw1_consumers[] = {
325 {
326 .supply = "cpu_vcc",
327 }
328};
329
330static struct regulator_consumer_supply vcam_consumers[] = {
331 /* sgtl5000 */
332 REGULATOR_SUPPLY("VDDA", "0-000a"),
333};
334
335static struct regulator_consumer_supply vaudio_consumers[] = {
336 REGULATOR_SUPPLY("cmos_vio", "soc-camera-pdrv.0"),
337};
338
339static struct regulator_init_data sw1_init = {
340 .constraints = {
341 .name = "SW1",
342 .min_uV = 600000,
343 .max_uV = 1375000,
344 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
345 .valid_modes_mask = 0,
346 .always_on = 1,
347 .boot_on = 1,
348 },
349 .num_consumer_supplies = ARRAY_SIZE(sw1_consumers),
350 .consumer_supplies = sw1_consumers,
351};
352
353static struct regulator_init_data sw2_init = {
354 .constraints = {
355 .name = "SW2",
356 .always_on = 1,
357 .boot_on = 1,
358 }
359};
360
361static struct regulator_init_data sw3_init = {
362 .constraints = {
363 .name = "SW3",
364 .always_on = 1,
365 .boot_on = 1,
366 }
367};
368
369static struct regulator_init_data sw4_init = {
370 .constraints = {
371 .name = "SW4",
372 .always_on = 1,
373 .boot_on = 1,
374 }
375};
376
377static struct regulator_init_data viohi_init = {
378 .constraints = {
379 .name = "VIOHI",
380 .boot_on = 1,
381 }
382};
383
384static struct regulator_init_data vusb_init = {
385 .constraints = {
386 .name = "VUSB",
387 .boot_on = 1,
388 }
389};
390
391static struct regulator_init_data vdig_init = {
392 .constraints = {
393 .name = "VDIG",
394 .boot_on = 1,
395 }
396};
397
398static struct regulator_init_data vpll_init = {
399 .constraints = {
400 .name = "VPLL",
401 .boot_on = 1,
402 }
403};
404
405static struct regulator_init_data vusb2_init = {
406 .constraints = {
407 .name = "VUSB2",
408 .boot_on = 1,
409 }
410};
411
412static struct regulator_init_data vvideo_init = {
413 .constraints = {
414 .name = "VVIDEO",
415 .boot_on = 1
416 }
417};
418
419static struct regulator_init_data vaudio_init = {
420 .constraints = {
421 .name = "VAUDIO",
422 .min_uV = 2300000,
423 .max_uV = 3000000,
424 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
425 .boot_on = 1
426 },
427 .num_consumer_supplies = ARRAY_SIZE(vaudio_consumers),
428 .consumer_supplies = vaudio_consumers,
429};
430
431static struct regulator_init_data vcam_init = {
432 .constraints = {
433 .name = "VCAM",
434 .min_uV = 2500000,
435 .max_uV = 3000000,
436 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
437 REGULATOR_CHANGE_MODE,
438 .valid_modes_mask = REGULATOR_MODE_FAST | REGULATOR_MODE_NORMAL,
439 .boot_on = 1
440 },
441 .num_consumer_supplies = ARRAY_SIZE(vcam_consumers),
442 .consumer_supplies = vcam_consumers,
443};
444
445static struct regulator_init_data vgen1_init = {
446 .constraints = {
447 .name = "VGEN1",
448 }
449};
450
451static struct regulator_init_data vgen2_init = {
452 .constraints = {
453 .name = "VGEN2",
454 .boot_on = 1,
455 }
456};
457
458static struct regulator_init_data vgen3_init = {
459 .constraints = {
460 .name = "VGEN3",
461 }
462};
463
464static struct mc13xxx_regulator_init_data mx35_3ds_regulators[] = {
465 { .id = MC13892_SW1, .init_data = &sw1_init },
466 { .id = MC13892_SW2, .init_data = &sw2_init },
467 { .id = MC13892_SW3, .init_data = &sw3_init },
468 { .id = MC13892_SW4, .init_data = &sw4_init },
469 { .id = MC13892_VIOHI, .init_data = &viohi_init },
470 { .id = MC13892_VPLL, .init_data = &vpll_init },
471 { .id = MC13892_VDIG, .init_data = &vdig_init },
472 { .id = MC13892_VUSB2, .init_data = &vusb2_init },
473 { .id = MC13892_VVIDEO, .init_data = &vvideo_init },
474 { .id = MC13892_VAUDIO, .init_data = &vaudio_init },
475 { .id = MC13892_VCAM, .init_data = &vcam_init },
476 { .id = MC13892_VGEN1, .init_data = &vgen1_init },
477 { .id = MC13892_VGEN2, .init_data = &vgen2_init },
478 { .id = MC13892_VGEN3, .init_data = &vgen3_init },
479 { .id = MC13892_VUSB, .init_data = &vusb_init },
480};
481
482static struct mc13xxx_platform_data mx35_3ds_mc13892_data = {
483 .flags = MC13XXX_USE_RTC | MC13XXX_USE_TOUCHSCREEN,
484 .regulators = {
485 .num_regulators = ARRAY_SIZE(mx35_3ds_regulators),
486 .regulators = mx35_3ds_regulators,
487 },
488};
489
490#define GPIO_PMIC_INT IMX_GPIO_NR(2, 0)
491
492static struct i2c_board_info mx35_3ds_i2c_mc13892 = {
493
494 I2C_BOARD_INFO("mc13892", 0x08),
495 .platform_data = &mx35_3ds_mc13892_data,
496 .irq = IMX_GPIO_TO_IRQ(GPIO_PMIC_INT),
497};
498
499static void __init imx35_3ds_init_mc13892(void)
500{
501 int ret = gpio_request_one(GPIO_PMIC_INT, GPIOF_DIR_IN, "pmic irq");
502
503 if (ret) {
504 pr_err("failed to get pmic irq: %d\n", ret);
505 return;
506 }
507
508 i2c_register_board_info(0, &mx35_3ds_i2c_mc13892, 1);
509}
510
320static int mx35_3ds_otg_init(struct platform_device *pdev) 511static int mx35_3ds_otg_init(struct platform_device *pdev)
321{ 512{
322 return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY); 513 return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY);
@@ -412,6 +603,8 @@ static void __init mx35_3ds_init(void)
412 imx35_fb_pdev = imx35_add_mx3_sdc_fb(&mx3fb_pdata); 603 imx35_fb_pdev = imx35_add_mx3_sdc_fb(&mx3fb_pdata);
413 mx35_3ds_lcd.dev.parent = &imx35_fb_pdev->dev; 604 mx35_3ds_lcd.dev.parent = &imx35_fb_pdev->dev;
414 platform_device_register(&mx35_3ds_lcd); 605 platform_device_register(&mx35_3ds_lcd);
606
607 imx35_3ds_init_mc13892();
415} 608}
416 609
417static void __init mx35pdk_timer_init(void) 610static void __init mx35pdk_timer_init(void)