summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2015-05-13 20:48:09 +0200
committerMax Krummenacher <max.krummenacher@toradex.com>2015-05-13 20:48:09 +0200
commit0de8d62ff5cb24d72206d9bee5ad42d517ee530e (patch)
tree3f82a922625c74cca75ccb4a4da8cbd5c8ba7895 /board
parent3b1dcb176c2e211d00ba0cf9386f1f0b07a33729 (diff)
apalis_imx6.c: prepare Apalis GPIO pins to be GPIO
In order to use the gpio commandline feature of U-Boot the pins one wants to control must be muxed to GPIO. Do that for Apalis pins GPIO[1:8] and for WAKE1_MICO. This feature can be used as follows: e.g. set GPIO1 to 1: Apalis iMX6 # gpio set 36 gpio: pin 36 (gpio 36) value is 1 e.g. read the state of GPIO8: Apalis iMX6 # gpio input 6 gpio: pin 6 (gpio 6) value is 1
Diffstat (limited to 'board')
-rw-r--r--board/toradex/apalis_imx6/apalis_imx6.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c
index 154e858d43..41ffdd4f5f 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -63,6 +63,10 @@ DECLARE_GLOBAL_DATA_PTR;
PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \
PAD_CTL_SRE_SLOW)
+#define NO_PULLUP ( \
+ PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \
+ PAD_CTL_SRE_SLOW)
+
#define WEAK_PULLDOWN (PAD_CTL_PUS_100K_DOWN | \
PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \
PAD_CTL_HYS | PAD_CTL_SRE_SLOW)
@@ -259,6 +263,24 @@ static int reset_enet_phy (struct mii_dev *bus)
return 0;
}
+/* mux the Apalis GPIO pins to gpio, so they can be used from the U-Boot commandline */
+iomux_v3_cfg_t const gpio_pads[] = {
+ MX6_PAD_NANDF_D4__GPIO2_IO04 | MUX_PAD_CTRL(WEAK_PULLUP), /* Apalis GPIO1 */
+ MX6_PAD_NANDF_D5__GPIO2_IO05 | MUX_PAD_CTRL(WEAK_PULLUP), /* Apalis GPIO2 */
+ MX6_PAD_NANDF_D6__GPIO2_IO06 | MUX_PAD_CTRL(WEAK_PULLUP), /* Apalis GPIO3 */
+ MX6_PAD_NANDF_D7__GPIO2_IO07 | MUX_PAD_CTRL(WEAK_PULLUP), /* Apalis GPIO4 */
+ MX6_PAD_NANDF_RB0__GPIO6_IO10 | MUX_PAD_CTRL(WEAK_PULLUP), /* Apalis GPIO5 */
+ MX6_PAD_NANDF_WP_B__GPIO6_IO09 | MUX_PAD_CTRL(WEAK_PULLUP), /* Apalis GPIO6 */
+ MX6_PAD_GPIO_2__GPIO1_IO02 | MUX_PAD_CTRL(WEAK_PULLDOWN), /* Apalis GPIO7 */
+ MX6_PAD_GPIO_6__GPIO1_IO06 | MUX_PAD_CTRL(WEAK_PULLUP), /* Apalis GPIO8 */
+ MX6_PAD_GPIO_4__GPIO1_IO04 | MUX_PAD_CTRL(WEAK_PULLUP), /* Power Button */
+};
+
+static void setup_iomux_gpio(void)
+{
+ imx_iomux_v3_setup_multiple_pads(gpio_pads, ARRAY_SIZE(gpio_pads));
+}
+
iomux_v3_cfg_t const usb_pads[] = {
/* TODO This pin has a dedicated USB power functionality, can we use it? */
/* USBH_EN */
@@ -804,6 +826,8 @@ int board_init(void)
setup_sata();
#endif
+ setup_iomux_gpio();
+
return 0;
}