aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTroy Kisky <troy.kisky@boundarydevices.com>2011-12-22 08:42:02 +0100
committerJohn Rigby <john.rigby@linaro.org>2012-01-19 17:08:50 -0700
commitb606281ae381711aded0acef9a9afade151c164c (patch)
tree6213a9def8770e563c72941d1d5bf987d6a6d4e5
parent112dd68f59fba23a5a7996a52ffb6e5591c4f2f6 (diff)
mx6qsabrelite: use IMX_GPIO_NR macro
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
-rw-r--r--arch/arm/include/asm/arch-mx6/gpio.h2
-rw-r--r--board/freescale/mx6qsabrelite/mx6qsabrelite.c24
2 files changed, 14 insertions, 12 deletions
diff --git a/arch/arm/include/asm/arch-mx6/gpio.h b/arch/arm/include/asm/arch-mx6/gpio.h
index 20c4e5748..8cfad28fd 100644
--- a/arch/arm/include/asm/arch-mx6/gpio.h
+++ b/arch/arm/include/asm/arch-mx6/gpio.h
@@ -25,6 +25,8 @@
#ifndef __ASM_ARCH_MX6_GPIO_H
#define __ASM_ARCH_MX6_GPIO_H
+#define IMX_GPIO_NR(port, offset) (((port - 1) << 5) | offset)
+
/* GPIO registers */
struct gpio_regs {
u32 gpio_dr;
diff --git a/board/freescale/mx6qsabrelite/mx6qsabrelite.c b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
index e6c12a502..5c811dec6 100644
--- a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
+++ b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
@@ -121,18 +121,18 @@ static void setup_iomux_uart(void)
static void setup_iomux_enet(void)
{
- gpio_direction_output(87, 0); /* GPIO 3-23 */
- gpio_direction_output(190, 1); /* GPIO 6-30 */
- gpio_direction_output(185, 1); /* GPIO 6-25 */
- gpio_direction_output(187, 1); /* GPIO 6-27 */
- gpio_direction_output(188, 1); /* GPIO 6-28*/
- gpio_direction_output(189, 1); /* GPIO 6-29 */
+ gpio_direction_output(IMX_GPIO_NR(3, 23), 0);
+ gpio_direction_output(IMX_GPIO_NR(6, 30), 1);
+ gpio_direction_output(IMX_GPIO_NR(6, 25), 1);
+ gpio_direction_output(IMX_GPIO_NR(6, 27), 1);
+ gpio_direction_output(IMX_GPIO_NR(6, 28), 1);
+ gpio_direction_output(IMX_GPIO_NR(6, 29), 1);
imx_iomux_v3_setup_multiple_pads(enet_pads1, ARRAY_SIZE(enet_pads1));
- gpio_direction_output(184, 1); /* GPIO 6-24 */
+ gpio_direction_output(IMX_GPIO_NR(6, 24), 1);
/* Need delay 10ms according to KSZ9021 spec */
udelay(1000 * 10);
- gpio_direction_output(87, 1); /* GPIO 3-23 */
+ gpio_direction_output(IMX_GPIO_NR(3, 23), 1);
imx_iomux_v3_setup_multiple_pads(enet_pads2, ARRAY_SIZE(enet_pads2));
}
@@ -148,11 +148,11 @@ int board_mmc_getcd(u8 *cd, struct mmc *mmc)
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
if (cfg->esdhc_base == USDHC3_BASE_ADDR) {
- gpio_direction_input(192); /*GPIO7_0*/
- *cd = gpio_get_value(192);
+ gpio_direction_input(IMX_GPIO_NR(7, 0));
+ *cd = gpio_get_value(IMX_GPIO_NR(7, 0));
} else {
- gpio_direction_input(38); /*GPIO2_6*/
- *cd = gpio_get_value(38);
+ gpio_direction_input(IMX_GPIO_NR(2, 6));
+ *cd = gpio_get_value(IMX_GPIO_NR(2, 6));
}
return 0;