Skip to contentSkip to conversation

omap: Don't use gpio_free to change direction to input

PATCH Superseded Joe Hershberger 2 participants 7 messages Oct 6, 2011 – Oct 12, 2011 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 omap: Don't use gpio_free to change direction to input

gpio_free() should not have the side effect of setting the line to input since this prevents the gpio command from being able to set a line as output.

Cc Joe Hershberger <[email protected]>
Cc Sandeep Paulraj <[email protected]>
---
 arch/arm/cpu/armv7/omap-common/gpio.c |    7 -------
 board/logicpd/zoom2/debug_board.c     |    1 -
 board/logicpd/zoom2/zoom2.c           |    1 -
 board/overo/overo.c                   |    7 +------
 board/ti/beagle/beagle.c              |    6 ------
 5 files changed, 1 insertions(+), 21 deletions(-)
arch/arm/cpu/armv7/omap-common/gpio.c +0 -7
index e62c6f4..75a02da 100644
@@ -237,11 +237,4 @@ int gpio_request(int gpio, const char *label)
  */
 void gpio_free(unsigned gpio)
 {
-	const struct gpio_bank *bank;
-
-	if (check_gpio(gpio) < 0)
-		return;
-	bank = get_gpio_bank(gpio);
-
-	_set_gpio_direction(bank, get_gpio_index(gpio), 1);
 }
board/logicpd/zoom2/debug_board.c +0 -1
index 33aa600..071e7f9 100644
@@ -40,7 +40,6 @@ static void zoom2_debug_board_detect (void)
 		 */
 		gpio_direction_input(158);
 		val = gpio_get_value(158);
-		gpio_free(158);
 	}
 
 	if (!val)
board/logicpd/zoom2/zoom2.c +0 -1
index 21964c2..be3083d 100644
@@ -95,7 +95,6 @@ void zoom2_identify(void)
 
 		gpio_direction_input(94);
 		val = gpio_get_value(94);
-		gpio_free(94);
 
 		if (val)
 			revision = ZOOM2_REVISION_BETA;
board/overo/overo.c +1 -6
index 850dfee..bdbd7f3 100644
@@ -118,10 +118,6 @@ int get_board_revision(void)
 		revision = gpio_get_value(115) << 2 |
 			   gpio_get_value(113) << 1 |
 			   gpio_get_value(112);
-
-		gpio_free(112);
-		gpio_free(113);
-		gpio_free(115);
 	} else {
 		printf("Error: unable to acquire board revision GPIOs\n");
 		revision = -1;
@@ -153,8 +149,7 @@ int get_sdio2_config(void)
 				sdio_direct = 0;
 		}
 
-		gpio_free(130);
-		gpio_free(139);
+		gpio_direction_input(130);
 	} else {
 		printf("Error: unable to acquire sdio2 clk GPIOs\n");
 		sdio_direct = -1;
board/ti/beagle/beagle.c +0 -6
index aa5047c..9482c5e 100644
@@ -127,10 +127,6 @@ int get_board_revision(void)
 		revision = gpio_get_value(173) << 2 |
 			   gpio_get_value(172) << 1 |
 			   gpio_get_value(171);
-
-		gpio_free(171);
-		gpio_free(172);
-		gpio_free(173);
 	} else {
 		printf("Error: unable to acquire board revision GPIOs\n");
 		revision = -1;
@@ -522,8 +518,6 @@ int do_userbutton(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		printf("NOT pressed.\n");
 	}
 
-	gpio_free(gpio);
-
 	return !button;
 }
 
Signature · 1 line
1.6.0.2
#1 lore raw

PATCH 2/2 omap4_panda: Build in cmd_gpio support on panda

Enable the gpio command

Configure the pads to allow access to the button on GPIO_121 and the 2 LEDS on GPIO_7 and GPIO_8

Cc Joe Hershberger <[email protected]>
Cc Sandeep Paulraj <[email protected]>
---
 board/ti/panda/panda_mux_data.h |    3 +++
 include/configs/omap4_panda.h   |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)
board/ti/panda/panda_mux_data.h +3 -0
index 63448b6..d630c71 100644
@@ -222,6 +222,9 @@ const struct pad_conf_entry wkup_padconf_array_non_essential[] = {
 	{PAD1_SYS_PWRON_RESET, (M3)},		/* gpio_wk29 */
 	{PAD0_SYS_BOOT6, (IEN | M3)},		/* gpio_wk9 */
 	{PAD1_SYS_BOOT7, (IEN | M3)},		/* gpio_wk10 */
+	{PAD1_FREF_CLK3_REQ, (M3)},		/* gpio_wk30 */
+	{PAD1_FREF_CLK4_REQ, (IEN | M3)},	/* gpio_wk7 */
+	{PAD0_FREF_CLK4_OUT, (IEN | M3)},	/* gpio_wk8 */
 };
 
 #endif /* _PANDA_MUX_DATA_H_ */
include/configs/omap4_panda.h +3 -0
index 67da70e..b88e5ad 100644
@@ -35,6 +35,9 @@
 
 #include <configs/omap4_common.h>
 
+/* GPIO */
+#define CONFIG_CMD_GPIO 1
+
 /* ENV related config options */
 #define CONFIG_ENV_IS_NOWHERE
 
Signature · 1 line
1.6.0.2
#2 lore raw

PATCH v2 1/2 omap: Don't use gpio_free to change direction to input

In reply to Joe Hershberger

gpio_free() should not have the side effect of setting the line to input since this prevents the gpio command from being able to set a line as output.

Cc Joe Hershberger <[email protected]>
Cc Sandeep Paulraj <[email protected]>

---
Changes for v2:

 arch/arm/cpu/armv7/omap-common/gpio.c |    7 -------
 board/logicpd/zoom2/debug_board.c     |    1 -
 board/logicpd/zoom2/zoom2.c           |    1 -
 board/overo/overo.c                   |    7 +------
 board/ti/beagle/beagle.c              |    6 ------
 5 files changed, 1 insertions(+), 21 deletions(-)
arch/arm/cpu/armv7/omap-common/gpio.c +0 -7
index e62c6f4..75a02da 100644
@@ -237,11 +237,4 @@ int gpio_request(int gpio, const char *label)
  */
 void gpio_free(unsigned gpio)
 {
-	const struct gpio_bank *bank;
-
-	if (check_gpio(gpio) < 0)
-		return;
-	bank = get_gpio_bank(gpio);
-
-	_set_gpio_direction(bank, get_gpio_index(gpio), 1);
 }
board/logicpd/zoom2/debug_board.c +0 -1
index 33aa600..071e7f9 100644
@@ -40,7 +40,6 @@ static void zoom2_debug_board_detect (void)
 		 */
 		gpio_direction_input(158);
 		val = gpio_get_value(158);
-		gpio_free(158);
 	}
 
 	if (!val)
board/logicpd/zoom2/zoom2.c +0 -1
index 21964c2..be3083d 100644
@@ -95,7 +95,6 @@ void zoom2_identify(void)
 
 		gpio_direction_input(94);
 		val = gpio_get_value(94);
-		gpio_free(94);
 
 		if (val)
 			revision = ZOOM2_REVISION_BETA;
board/overo/overo.c +1 -6
index 850dfee..bdbd7f3 100644
@@ -118,10 +118,6 @@ int get_board_revision(void)
 		revision = gpio_get_value(115) << 2 |
 			   gpio_get_value(113) << 1 |
 			   gpio_get_value(112);
-
-		gpio_free(112);
-		gpio_free(113);
-		gpio_free(115);
 	} else {
 		printf("Error: unable to acquire board revision GPIOs\n");
 		revision = -1;
@@ -153,8 +149,7 @@ int get_sdio2_config(void)
 				sdio_direct = 0;
 		}
 
-		gpio_free(130);
-		gpio_free(139);
+		gpio_direction_input(130);
 	} else {
 		printf("Error: unable to acquire sdio2 clk GPIOs\n");
 		sdio_direct = -1;
board/ti/beagle/beagle.c +0 -6
index aa5047c..9482c5e 100644
@@ -127,10 +127,6 @@ int get_board_revision(void)
 		revision = gpio_get_value(173) << 2 |
 			   gpio_get_value(172) << 1 |
 			   gpio_get_value(171);
-
-		gpio_free(171);
-		gpio_free(172);
-		gpio_free(173);
 	} else {
 		printf("Error: unable to acquire board revision GPIOs\n");
 		revision = -1;
@@ -522,8 +518,6 @@ int do_userbutton(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		printf("NOT pressed.\n");
 	}
 
-	gpio_free(gpio);
-
 	return !button;
 }
 
Signature · 1 line
1.6.0.2
#3 lore raw

PATCH v2 2/2 omap4_panda: Build in cmd_gpio support on panda

In reply to Joe Hershberger

Enable the gpio command

Cc Joe Hershberger <[email protected]>
Cc Sandeep Paulraj <[email protected]>

---
Changes for v2:
- Correct a bad merge... sorry.

 board/ti/panda/panda_mux_data.h |    2 +-
 include/configs/omap4_panda.h   |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)
board/ti/panda/panda_mux_data.h +1 -1
index 63448b6..c692c7b 100644
@@ -212,7 +212,7 @@ const struct pad_conf_entry wkup_padconf_array_non_essential[] = {
 	{PAD0_FREF_SLICER_IN, (M0)},		/* fref_slicer_in */
 	{PAD1_FREF_CLK_IOREQ, (M0)},		/* fref_clk_ioreq */
 	{PAD0_FREF_CLK0_OUT, (M2)},		/* sys_drm_msecure */
-	{PAD1_FREF_CLK3_REQ, M7},					/* safe mode */
+	{PAD1_FREF_CLK3_REQ, M7},		/* safe mode */
 	{PAD0_FREF_CLK3_OUT, (M0)},		/* fref_clk3_out */
 	{PAD1_FREF_CLK4_REQ, (PTU | M3)},	/* led status_1 */
 	{PAD0_FREF_CLK4_OUT, (PTU | M3)},	/* led status_2 */
include/configs/omap4_panda.h +3 -0
index 67da70e..b88e5ad 100644
@@ -35,6 +35,9 @@
 
 #include <configs/omap4_common.h>
 
+/* GPIO */
+#define CONFIG_CMD_GPIO 1
+
 /* ENV related config options */
 #define CONFIG_ENV_IS_NOWHERE
 
Signature · 1 line
1.6.0.2
#4 lore raw

PATCH v2 2/2 omap4_panda: Build in cmd_gpio support on panda

Hi Joe,

Quoted 31 lines · Joe Hershberger

Enable the gpio command

Cc Joe Hershberger <[email protected]>
Cc Sandeep Paulraj <[email protected]>

---
Changes for v2:
- Correct a bad merge... sorry.

 board/ti/panda/panda_mux_data.h |    2 +-
 include/configs/omap4_panda.h   |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)
board/ti/panda/panda_mux_data.h +1 -1
index 63448b6..c692c7b 100644
@@ -212,7 +212,7 @@ const struct pad_conf_entry wkup_padconf_array_non_essential[] = {
 	{PAD0_FREF_SLICER_IN, (M0)},		/* fref_slicer_in */
 	{PAD1_FREF_CLK_IOREQ, (M0)},		/* fref_clk_ioreq */
 	{PAD0_FREF_CLK0_OUT, (M2)},		/* sys_drm_msecure */
-	{PAD1_FREF_CLK3_REQ, M7},					/* safe mode */
+	{PAD1_FREF_CLK3_REQ, M7},		/* safe mode */
 	{PAD0_FREF_CLK3_OUT, (M0)},		/* fref_clk3_out */
 	{PAD1_FREF_CLK4_REQ, (PTU | M3)},	/* led status_1 */
 	{PAD0_FREF_CLK4_OUT, (PTU | M3)},	/* led status_2 */
include/configs/omap4_panda.h +0 -0
index 67da70e..b88e5ad 100644

include/configs/omap4_panda.h line 39

Quoted 5 lines
include/configs/omap4_panda.h +2 -0
@@ -35,6 +35,9 @@
 
 #include <configs/omap4_common.h>
 
+/* GPIO */
+#define CONFIG_CMD_GPIO 1

Boolean defines should not have a value.

Signature · 2 lines
Regards,
Igor.
#5 lore raw

PATCH v3 1/2 omap: Don't use gpio_free to change direction to input

gpio_free() should not have the side effect of setting the line to input since this prevents the gpio command from being able to set a line as output.

Cc Joe Hershberger <[email protected]>
Cc Sandeep Paulraj <[email protected]>

---
Changes for v2:
Changes for v3:

 arch/arm/cpu/armv7/omap-common/gpio.c |    7 -------
 board/logicpd/zoom2/debug_board.c     |    1 -
 board/logicpd/zoom2/zoom2.c           |    1 -
 board/overo/overo.c                   |    7 +------
 board/ti/beagle/beagle.c              |    6 ------
 5 files changed, 1 insertions(+), 21 deletions(-)
arch/arm/cpu/armv7/omap-common/gpio.c +0 -7
index e62c6f4..75a02da 100644
@@ -237,11 +237,4 @@ int gpio_request(int gpio, const char *label)
  */
 void gpio_free(unsigned gpio)
 {
-	const struct gpio_bank *bank;
-
-	if (check_gpio(gpio) < 0)
-		return;
-	bank = get_gpio_bank(gpio);
-
-	_set_gpio_direction(bank, get_gpio_index(gpio), 1);
 }
board/logicpd/zoom2/debug_board.c +0 -1
index 33aa600..071e7f9 100644
@@ -40,7 +40,6 @@ static void zoom2_debug_board_detect (void)
 		 */
 		gpio_direction_input(158);
 		val = gpio_get_value(158);
-		gpio_free(158);
 	}
 
 	if (!val)
board/logicpd/zoom2/zoom2.c +0 -1
index 21964c2..be3083d 100644
@@ -95,7 +95,6 @@ void zoom2_identify(void)
 
 		gpio_direction_input(94);
 		val = gpio_get_value(94);
-		gpio_free(94);
 
 		if (val)
 			revision = ZOOM2_REVISION_BETA;
board/overo/overo.c +1 -6
index 850dfee..bdbd7f3 100644
@@ -118,10 +118,6 @@ int get_board_revision(void)
 		revision = gpio_get_value(115) << 2 |
 			   gpio_get_value(113) << 1 |
 			   gpio_get_value(112);
-
-		gpio_free(112);
-		gpio_free(113);
-		gpio_free(115);
 	} else {
 		printf("Error: unable to acquire board revision GPIOs\n");
 		revision = -1;
@@ -153,8 +149,7 @@ int get_sdio2_config(void)
 				sdio_direct = 0;
 		}
 
-		gpio_free(130);
-		gpio_free(139);
+		gpio_direction_input(130);
 	} else {
 		printf("Error: unable to acquire sdio2 clk GPIOs\n");
 		sdio_direct = -1;
board/ti/beagle/beagle.c +0 -6
index aa5047c..9482c5e 100644
@@ -127,10 +127,6 @@ int get_board_revision(void)
 		revision = gpio_get_value(173) << 2 |
 			   gpio_get_value(172) << 1 |
 			   gpio_get_value(171);
-
-		gpio_free(171);
-		gpio_free(172);
-		gpio_free(173);
 	} else {
 		printf("Error: unable to acquire board revision GPIOs\n");
 		revision = -1;
@@ -522,8 +518,6 @@ int do_userbutton(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		printf("NOT pressed.\n");
 	}
 
-	gpio_free(gpio);
-
 	return !button;
 }
 
Signature · 1 line
1.6.0.2
#6 lore raw

PATCH v3 2/2 omap4_panda: Build in cmd_gpio support on panda

In reply to Igor Grinberg

Enable the gpio command

Cc Joe Hershberger <[email protected]>
Cc Sandeep Paulraj <[email protected]>

---
Changes for v2:
- Correct a bad merge... sorry.
Changes for v3:
- Boolean defines should not have a value

 include/configs/omap4_panda.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/configs/omap4_panda.h +3 -0
index 67da70e..e9ef2a3 100644
@@ -35,6 +35,9 @@
 
 #include <configs/omap4_common.h>
 
+/* GPIO */
+#define CONFIG_CMD_GPIO
+
 /* ENV related config options */
 #define CONFIG_ENV_IS_NOWHERE
 
Signature · 1 line
1.6.0.2