Move gpio configuration out of common and into u-boot code as it is
not used by the SPL.

Signed-off-by: Tim Harvey <thar...@gateworks.com>
---
 board/gateworks/gw_ventana/common.c     | 86 -------------------------
 board/gateworks/gw_ventana/common.h     |  2 -
 board/gateworks/gw_ventana/gw_ventana.c | 85 ++++++++++++++++++++++++
 3 files changed, 85 insertions(+), 88 deletions(-)

diff --git a/board/gateworks/gw_ventana/common.c 
b/board/gateworks/gw_ventana/common.c
index 6b8900e45ba7..725f948b874b 100644
--- a/board/gateworks/gw_ventana/common.c
+++ b/board/gateworks/gw_ventana/common.c
@@ -1209,92 +1209,6 @@ void setup_iomux_gpio(int board, struct 
ventana_board_info *info)
        }
 }
 
-/* setup GPIO pinmux and default configuration per baseboard and env */
-void setup_board_gpio(int board, struct ventana_board_info *info)
-{
-       const char *s;
-       char arg[10];
-       size_t len;
-       int i;
-       int quiet = simple_strtol(env_get("quiet"), NULL, 10);
-
-       if (board >= GW_UNKNOWN)
-               return;
-
-       /* RS232_EN# */
-       if (gpio_cfg[board].rs232_en) {
-               gpio_direction_output(gpio_cfg[board].rs232_en,
-                                     (hwconfig("rs232")) ? 0 : 1);
-       }
-
-       /* MSATA Enable */
-       if (gpio_cfg[board].msata_en && is_cpu_type(MXC_CPU_MX6Q)) {
-               gpio_direction_output(GP_MSATA_SEL,
-                                     (hwconfig("msata")) ? 1 : 0);
-       }
-
-       /* USBOTG Select (PCISKT or FrontPanel) */
-       if (gpio_cfg[board].usb_sel) {
-               gpio_direction_output(gpio_cfg[board].usb_sel,
-                                     (hwconfig("usb_pcisel")) ? 1 : 0);
-       }
-
-       /*
-        * Configure DIO pinmux/padctl registers
-        * see IMX6DQRM/IMX6SDLRM IOMUXC_SW_PAD_CTL_PAD_* register definitions
-        */
-       for (i = 0; i < gpio_cfg[board].dio_num; i++) {
-               struct dio_cfg *cfg = &gpio_cfg[board].dio_cfg[i];
-               iomux_v3_cfg_t ctrl = DIO_PAD_CFG;
-               unsigned cputype = is_cpu_type(MXC_CPU_MX6Q) ? 0 : 1;
-
-               if (!cfg->gpio_padmux[0] && !cfg->gpio_padmux[1])
-                       continue;
-               sprintf(arg, "dio%d", i);
-               if (!hwconfig(arg))
-                       continue;
-               s = hwconfig_subarg(arg, "padctrl", &len);
-               if (s) {
-                       ctrl = MUX_PAD_CTRL(hextoul(s, NULL)
-                                           & 0x1ffff) | MUX_MODE_SION;
-               }
-               if (hwconfig_subarg_cmp(arg, "mode", "gpio")) {
-                       if (!quiet) {
-                               printf("DIO%d:  GPIO%d_IO%02d (gpio-%d)\n", i,
-                                      (cfg->gpio_param/32)+1,
-                                      cfg->gpio_param%32,
-                                      cfg->gpio_param);
-                       }
-                       imx_iomux_v3_setup_pad(cfg->gpio_padmux[cputype] |
-                                              ctrl);
-                       gpio_requestf(cfg->gpio_param, "dio%d", i);
-                       gpio_direction_input(cfg->gpio_param);
-               } else if (hwconfig_subarg_cmp(arg, "mode", "pwm") &&
-                          cfg->pwm_padmux) {
-                       if (!cfg->pwm_param) {
-                               printf("DIO%d:  Error: pwm config invalid\n",
-                                       i);
-                               continue;
-                       }
-                       if (!quiet)
-                               printf("DIO%d:  pwm%d\n", i, cfg->pwm_param);
-                       imx_iomux_v3_setup_pad(cfg->pwm_padmux[cputype] |
-                                              MUX_PAD_CTRL(ctrl));
-               }
-       }
-
-       if (!quiet) {
-               if (gpio_cfg[board].msata_en && is_cpu_type(MXC_CPU_MX6Q)) {
-                       printf("MSATA: %s\n", (hwconfig("msata") ?
-                              "enabled" : "disabled"));
-               }
-               if (gpio_cfg[board].rs232_en) {
-                       printf("RS232: %s\n", (hwconfig("rs232")) ?
-                              "enabled" : "disabled");
-               }
-       }
-}
-
 #include <fdt_support.h>
 #define WDOG1_ADDR      0x20bc000
 #define WDOG2_ADDR      0x20c0000
diff --git a/board/gateworks/gw_ventana/common.h 
b/board/gateworks/gw_ventana/common.h
index d7f60a0b5d92..a03663487f9f 100644
--- a/board/gateworks/gw_ventana/common.h
+++ b/board/gateworks/gw_ventana/common.h
@@ -81,8 +81,6 @@ extern struct ventana gpio_cfg[GW_UNKNOWN];
 
 /* configure gpio iomux/defaults */
 void setup_iomux_gpio(int board, struct ventana_board_info *);
-/* late setup of GPIO (configuration per baseboard and env) */
-void setup_board_gpio(int board, struct ventana_board_info *);
 /* early model/revision ft fixups */
 void ft_early_fixup(void *fdt, int board_type);
 
diff --git a/board/gateworks/gw_ventana/gw_ventana.c 
b/board/gateworks/gw_ventana/gw_ventana.c
index a76f0ea62f9d..9b8f7b517749 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -576,6 +576,91 @@ static const struct boot_mode board_boot_modes[] = {
 };
 #endif
 
+/* setup GPIO pinmux and default configuration per baseboard and env */
+void setup_board_gpio(int board, struct ventana_board_info *info)
+{
+       const char *s;
+       char arg[10];
+       size_t len;
+       int i;
+       int quiet = simple_strtol(env_get("quiet"), NULL, 10);
+
+       if (board >= GW_UNKNOWN)
+               return;
+
+       /* RS232_EN# */
+       if (gpio_cfg[board].rs232_en) {
+               gpio_direction_output(gpio_cfg[board].rs232_en,
+                                     (hwconfig("rs232")) ? 0 : 1);
+       }
+
+       /* MSATA Enable */
+       if (gpio_cfg[board].msata_en && is_cpu_type(MXC_CPU_MX6Q)) {
+               gpio_direction_output(GP_MSATA_SEL,
+                                     (hwconfig("msata")) ? 1 : 0);
+       }
+
+       /* USBOTG Select (PCISKT or FrontPanel) */
+       if (gpio_cfg[board].usb_sel) {
+               gpio_direction_output(gpio_cfg[board].usb_sel,
+                                     (hwconfig("usb_pcisel")) ? 1 : 0);
+       }
+
+       /*
+        * Configure DIO pinmux/padctl registers
+        * see IMX6DQRM/IMX6SDLRM IOMUXC_SW_PAD_CTL_PAD_* register definitions
+        */
+       for (i = 0; i < gpio_cfg[board].dio_num; i++) {
+               struct dio_cfg *cfg = &gpio_cfg[board].dio_cfg[i];
+               iomux_v3_cfg_t ctrl = DIO_PAD_CFG;
+               unsigned int cputype = is_cpu_type(MXC_CPU_MX6Q) ? 0 : 1;
+
+               if (!cfg->gpio_padmux[0] && !cfg->gpio_padmux[1])
+                       continue;
+               sprintf(arg, "dio%d", i);
+               if (!hwconfig(arg))
+                       continue;
+               s = hwconfig_subarg(arg, "padctrl", &len);
+               if (s) {
+                       ctrl = MUX_PAD_CTRL(hextoul(s, NULL)
+                                           & 0x1ffff) | MUX_MODE_SION;
+               }
+               if (hwconfig_subarg_cmp(arg, "mode", "gpio")) {
+                       if (!quiet) {
+                               printf("DIO%d:  GPIO%d_IO%02d (gpio-%d)\n", i,
+                                      (cfg->gpio_param / 32) + 1,
+                                      cfg->gpio_param % 32,
+                                      cfg->gpio_param);
+                       }
+                       imx_iomux_v3_setup_pad(cfg->gpio_padmux[cputype] |
+                                              ctrl);
+                       gpio_requestf(cfg->gpio_param, "dio%d", i);
+                       gpio_direction_input(cfg->gpio_param);
+               } else if (hwconfig_subarg_cmp(arg, "mode", "pwm") &&
+                          cfg->pwm_padmux) {
+                       if (!cfg->pwm_param) {
+                               printf("DIO%d:  Error: pwm config invalid\n",
+                                      i);
+                               continue;
+                       }
+                       if (!quiet)
+                               printf("DIO%d:  pwm%d\n", i, cfg->pwm_param);
+                       imx_iomux_v3_setup_pad(cfg->pwm_padmux[cputype] |
+                                              MUX_PAD_CTRL(ctrl));
+               }
+       }
+
+       if (!quiet) {
+               if (gpio_cfg[board].msata_en && is_cpu_type(MXC_CPU_MX6Q)) {
+                       printf("MSATA: %s\n", (hwconfig("msata") ?
+                              "enabled" : "disabled"));
+               }
+               if (gpio_cfg[board].rs232_en) {
+                       printf("RS232: %s\n", (hwconfig("rs232")) ?
+                              "enabled" : "disabled");
+               }
+       }
+}
 /* late init */
 int misc_init_r(void)
 {
-- 
2.17.1

Reply via email to