aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-imx/mach-imx27_visstrim_m10.c')
-rw-r--r--arch/arm/mach-imx/mach-imx27_visstrim_m10.c57
1 files changed, 56 insertions, 1 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..dff82eb57cd9 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 */
@@ -152,7 +178,7 @@ static struct soc_camera_link iclink_tvp5150 = {
152 178
153static struct mx2_camera_platform_data visstrim_camera = { 179static struct mx2_camera_platform_data visstrim_camera = {
154 .flags = MX2_CAMERA_CCIR | MX2_CAMERA_CCIR_INTERLACE | 180 .flags = MX2_CAMERA_CCIR | MX2_CAMERA_CCIR_INTERLACE |
155 MX2_CAMERA_SWAP16 | MX2_CAMERA_PCLK_SAMPLE_RISING, 181 MX2_CAMERA_PCLK_SAMPLE_RISING,
156 .clk = 100000, 182 .clk = 100000,
157}; 183};
158 184
@@ -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");