Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 303420
b: refs/heads/master
c: 435ca24
h: refs/heads/master
v: v3
  • Loading branch information
Javier Martin authored and Sascha Hauer committed Apr 16, 2012
1 parent a94dc38 commit 9d1bb36
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 19a3dab69747e1bace7987da5cd527fe998d7012
refs/heads/master: 435ca24116bc5365a10fa0be1bf1c1e4c5680157
55 changes: 55 additions & 0 deletions trunk/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/time.h>
#include <asm/system.h>
#include <mach/common.h>
#include <mach/iomux-mx27.h>

Expand All @@ -48,6 +49,14 @@
#define OTG_PHY_CS_GPIO (GPIO_PORTF + 17)
#define SDHC1_IRQ IRQ_GPIOB(25)

#define MOTHERBOARD_BIT2 (GPIO_PORTD + 31)
#define MOTHERBOARD_BIT1 (GPIO_PORTD + 30)
#define MOTHERBOARD_BIT0 (GPIO_PORTD + 29)

#define EXPBOARD_BIT2 (GPIO_PORTD + 25)
#define EXPBOARD_BIT1 (GPIO_PORTD + 27)
#define EXPBOARD_BIT0 (GPIO_PORTD + 28)

static const int visstrim_m10_pins[] __initconst = {
/* UART1 (console) */
PE12_PF_UART1_TXD,
Expand Down Expand Up @@ -119,6 +128,23 @@ static const int visstrim_m10_pins[] __initconst = {
PB19_PF_CSI_D7,
PB20_PF_CSI_VSYNC,
PB21_PF_CSI_HSYNC,
/* mother board version */
MOTHERBOARD_BIT2 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
MOTHERBOARD_BIT1 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
MOTHERBOARD_BIT0 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
/* expansion board version */
EXPBOARD_BIT2 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
EXPBOARD_BIT1 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
EXPBOARD_BIT0 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
};

static struct gpio visstrim_m10_version_gpios[] = {
{ EXPBOARD_BIT0, GPIOF_IN, "exp-version-0" },
{ EXPBOARD_BIT1, GPIOF_IN, "exp-version-1" },
{ EXPBOARD_BIT2, GPIOF_IN, "exp-version-2" },
{ MOTHERBOARD_BIT0, GPIOF_IN, "mother-version-0" },
{ MOTHERBOARD_BIT1, GPIOF_IN, "mother-version-1" },
{ MOTHERBOARD_BIT2, GPIOF_IN, "mother-version-2" },
};

/* Camera */
Expand Down Expand Up @@ -369,11 +395,40 @@ static const struct imx_ssi_platform_data visstrim_m10_ssi_pdata __initconst = {
.flags = IMX_SSI_DMA | IMX_SSI_SYN,
};

static void __init visstrim_m10_revision(void)
{
int exp_version = 0;
int mo_version = 0;
int ret;

ret = gpio_request_array(visstrim_m10_version_gpios,
ARRAY_SIZE(visstrim_m10_version_gpios));
if (ret) {
pr_err("Failed to request version gpios");
return;
}

/* Get expansion board version (negative logic) */
exp_version |= !gpio_get_value(EXPBOARD_BIT2) << 2;
exp_version |= !gpio_get_value(EXPBOARD_BIT1) << 1;
exp_version |= !gpio_get_value(EXPBOARD_BIT0);

/* Get mother board version (negative logic) */
mo_version |= !gpio_get_value(MOTHERBOARD_BIT2) << 2;
mo_version |= !gpio_get_value(MOTHERBOARD_BIT1) << 1;
mo_version |= !gpio_get_value(MOTHERBOARD_BIT0);

system_rev = 0x27000;
system_rev |= (mo_version << 4);
system_rev |= exp_version;
}

static void __init visstrim_m10_board_init(void)
{
int ret;

imx27_soc_init();
visstrim_m10_revision();

ret = mxc_gpio_setup_multiple_pins(visstrim_m10_pins,
ARRAY_SIZE(visstrim_m10_pins), "VISSTRIM_M10");
Expand Down

0 comments on commit 9d1bb36

Please sign in to comment.