mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] Add gpio command support to STM/i.MX arch
@ 2010-12-21 11:25 Juergen Beisert
  2010-12-21 11:25 ` [PATCH 1/9] Fix a typo in the GPIO doc Juergen Beisert
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: Juergen Beisert @ 2010-12-21 11:25 UTC (permalink / raw)
  To: barebox

In order to complete graphics handling on STM/i.MX architecture, the platforms
need GPIO command support (for example to enable the display and backlight).

The following changes since commit af05a9dd223f0a77133e37893354680c2f857a54:

  xyzModem.c: fix 'dummy' is used uninitialized in this function warning (2010-12-21 10:23:41 +0100)

are available in the git repository at:
  http://git.pengutronix.de/git/jbe/for_barebox_next/ next_stm_gpio_v3

Juergen Beisert (9):
      Fix a typo in the GPIO doc
      ARM STM/i.MX: Fix register offset calculation for GPIO input pins
      ARM STM/i.MX: Remove variable size restrictions in iomux managing routines
      ARM STM/i.MX: Setting the iomux needs at least 32 bit.
      ARM STM/i.MX: Just fix the docs
      ARM STM/i.MX: Add support for the gpio commands
      ARM STM/i.MX: Avoid very long lines
      ARM STM/i.MX: Replace cryptic numbers
      ARM Chumby: Add list of available GPIOs and their meaning

 arch/arm/Kconfig                               |    1 +
 arch/arm/boards/chumby_falconwing/falconwing.c |   85 ++++++++++++++++++++++++
 arch/arm/configs/chumbyone_defconfig           |    1 +
 arch/arm/configs/tx28stk5_defconfig            |    1 +
 arch/arm/mach-stm/include/mach/gpio.h          |    8 ++-
 arch/arm/mach-stm/iomux-imx.c                  |   85 +++++++++++++++++++++---
 commands/gpio.c                                |    2 +-
 7 files changed, 171 insertions(+), 12 deletions(-)

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/9] Fix a typo in the GPIO doc
  2010-12-21 11:25 [PATCH] Add gpio command support to STM/i.MX arch Juergen Beisert
@ 2010-12-21 11:25 ` Juergen Beisert
  2010-12-21 11:25 ` [PATCH 2/9] ARM STM/i.MX: Fix register offset calculation for GPIO input pins Juergen Beisert
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Juergen Beisert @ 2010-12-21 11:25 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 commands/gpio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/commands/gpio.c b/commands/gpio.c
index 0cf19fe..073c9d3 100644
--- a/commands/gpio.c
+++ b/commands/gpio.c
@@ -148,7 +148,7 @@ between @b barebox releases.
 - gpio_no: Architecture dependend GPIO number
 - initial_value: Output value
 
-<p> To avoid glitches on the pad the routines will first sett up the
+<p> To avoid glitches on the pad the routines will first set up the
 pad's value and afterwards switch the pad to output (if the silicon is
 able to do so). If the pad is already configured in non-GPIO mode (if
 available), this command may silently fail. </p>
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 2/9] ARM STM/i.MX: Fix register offset calculation for GPIO input pins
  2010-12-21 11:25 [PATCH] Add gpio command support to STM/i.MX arch Juergen Beisert
  2010-12-21 11:25 ` [PATCH 1/9] Fix a typo in the GPIO doc Juergen Beisert
@ 2010-12-21 11:25 ` Juergen Beisert
  2010-12-21 11:25 ` [PATCH 3/9] ARM STM/i.MX: Remove variable size restrictions in iomux managing routines Juergen Beisert
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Juergen Beisert @ 2010-12-21 11:25 UTC (permalink / raw)
  To: barebox

Fix the forgotten register calculation for GPIO input pins.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/arm/mach-stm/iomux-imx.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-stm/iomux-imx.c b/arch/arm/mach-stm/iomux-imx.c
index 2c68ebf..2c34d01 100644
--- a/arch/arm/mach-stm/iomux-imx.c
+++ b/arch/arm/mach-stm/iomux-imx.c
@@ -129,6 +129,8 @@ void imx_gpio_mode(unsigned m)
 			writel(0x1 << (gpio_pin % 32),
 				IMX_IOMUXC_BASE + reg_offset + BIT_SET);
 		} else {
+			/* then the direction */
+			reg_offset = calc_output_enable_reg(gpio_pin);
 			writel(0x1 << (gpio_pin % 32),
 				IMX_IOMUXC_BASE + reg_offset + BIT_CLR);
 		}
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 3/9] ARM STM/i.MX: Remove variable size restrictions in iomux managing routines
  2010-12-21 11:25 [PATCH] Add gpio command support to STM/i.MX arch Juergen Beisert
  2010-12-21 11:25 ` [PATCH 1/9] Fix a typo in the GPIO doc Juergen Beisert
  2010-12-21 11:25 ` [PATCH 2/9] ARM STM/i.MX: Fix register offset calculation for GPIO input pins Juergen Beisert
@ 2010-12-21 11:25 ` Juergen Beisert
  2010-12-21 11:25 ` [PATCH 4/9] ARM STM/i.MX: Setting the iomux needs at least 32 bit Juergen Beisert
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Juergen Beisert @ 2010-12-21 11:25 UTC (permalink / raw)
  To: barebox

There is no really need for restricted variable types for the parameters.
Replace them by standard C types with the same behaviour.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/arm/mach-stm/iomux-imx.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-stm/iomux-imx.c b/arch/arm/mach-stm/iomux-imx.c
index 2c34d01..2ebe058 100644
--- a/arch/arm/mach-stm/iomux-imx.c
+++ b/arch/arm/mach-stm/iomux-imx.c
@@ -46,31 +46,31 @@
 #define MAX_GPIO_NO 159
 #endif
 
-static uint32_t calc_mux_reg(uint32_t no)
+static unsigned calc_mux_reg(unsigned no)
 {
 	/* each register controls 16 pads */
 	return ((no >> 4) << 4) + HW_PINCTRL_MUXSEL0;
 }
 
-static uint32_t calc_strength_reg(uint32_t no)
+static unsigned calc_strength_reg(unsigned no)
 {
 	/* each register controls 8 pads */
 	return  ((no >> 3) << 4) + HW_PINCTRL_DRIVE0;
 }
 
-static uint32_t calc_pullup_reg(uint32_t no)
+static unsigned calc_pullup_reg(unsigned no)
 {
 	/* each register controls 32 pads */
 	return  ((no >> 5) << 4) + HW_PINCTRL_PULL0;
 }
 
-static uint32_t calc_output_enable_reg(uint32_t no)
+static unsigned calc_output_enable_reg(unsigned no)
 {
 	/* each register controls 32 pads */
 	return  ((no >> 5) << 4) + HW_PINCTRL_DOE0;
 }
 
-static uint32_t calc_output_reg(uint32_t no)
+static unsigned calc_output_reg(unsigned no)
 {
 	/* each register controls 32 pads */
 	return  ((no >> 5) << 4) + HW_PINCTRL_DOUT0;
@@ -81,7 +81,8 @@ static uint32_t calc_output_reg(uint32_t no)
  */
 void imx_gpio_mode(unsigned m)
 {
-	uint32_t reg_offset, gpio_pin, reg;
+	uint32_t reg;
+	unsigned gpio_pin, reg_offset;
 
 	gpio_pin = GET_GPIO_NO(m);
 
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 4/9] ARM STM/i.MX: Setting the iomux needs at least 32 bit.
  2010-12-21 11:25 [PATCH] Add gpio command support to STM/i.MX arch Juergen Beisert
                   ` (2 preceding siblings ...)
  2010-12-21 11:25 ` [PATCH 3/9] ARM STM/i.MX: Remove variable size restrictions in iomux managing routines Juergen Beisert
@ 2010-12-21 11:25 ` Juergen Beisert
  2010-12-21 11:25 ` [PATCH 5/9] ARM STM/i.MX: Just fix the docs Juergen Beisert
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Juergen Beisert @ 2010-12-21 11:25 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/arm/mach-stm/include/mach/gpio.h |    4 +++-
 arch/arm/mach-stm/iomux-imx.c         |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-stm/include/mach/gpio.h b/arch/arm/mach-stm/include/mach/gpio.h
index 5615b67..97566a2 100644
--- a/arch/arm/mach-stm/include/mach/gpio.h
+++ b/arch/arm/mach-stm/include/mach/gpio.h
@@ -20,6 +20,8 @@
 #ifndef __ASM_MACH_GPIO_H
 #define __ASM_MACH_GPIO_H
 
+#include <types.h>
+
 #if defined CONFIG_ARCH_IMX23
 # include <mach/iomux-imx23.h>
 #endif
@@ -27,6 +29,6 @@
 # include <mach/iomux-imx28.h>
 #endif
 
-void imx_gpio_mode(unsigned);
+void imx_gpio_mode(uint32_t);
 
 #endif /* __ASM_MACH_GPIO_H */
diff --git a/arch/arm/mach-stm/iomux-imx.c b/arch/arm/mach-stm/iomux-imx.c
index 2ebe058..85e9684 100644
--- a/arch/arm/mach-stm/iomux-imx.c
+++ b/arch/arm/mach-stm/iomux-imx.c
@@ -79,7 +79,7 @@ static unsigned calc_output_reg(unsigned no)
 /**
  * @param[in] m One of the defines from iomux-mx23.h to configure *one* pin
  */
-void imx_gpio_mode(unsigned m)
+void imx_gpio_mode(uint32_t m)
 {
 	uint32_t reg;
 	unsigned gpio_pin, reg_offset;
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 5/9] ARM STM/i.MX: Just fix the docs
  2010-12-21 11:25 [PATCH] Add gpio command support to STM/i.MX arch Juergen Beisert
                   ` (3 preceding siblings ...)
  2010-12-21 11:25 ` [PATCH 4/9] ARM STM/i.MX: Setting the iomux needs at least 32 bit Juergen Beisert
@ 2010-12-21 11:25 ` Juergen Beisert
  2010-12-21 11:25 ` [PATCH 6/9] ARM STM/i.MX: Add support for the gpio commands Juergen Beisert
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Juergen Beisert @ 2010-12-21 11:25 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/arm/mach-stm/iomux-imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-stm/iomux-imx.c b/arch/arm/mach-stm/iomux-imx.c
index 85e9684..8a34e4c 100644
--- a/arch/arm/mach-stm/iomux-imx.c
+++ b/arch/arm/mach-stm/iomux-imx.c
@@ -77,7 +77,7 @@ static unsigned calc_output_reg(unsigned no)
 }
 
 /**
- * @param[in] m One of the defines from iomux-mx23.h to configure *one* pin
+ * @param[in] m One pin define per call from iomux-mx23.h/iomux-mx28.h
  */
 void imx_gpio_mode(uint32_t m)
 {
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 6/9] ARM STM/i.MX: Add support for the gpio commands
  2010-12-21 11:25 [PATCH] Add gpio command support to STM/i.MX arch Juergen Beisert
                   ` (4 preceding siblings ...)
  2010-12-21 11:25 ` [PATCH 5/9] ARM STM/i.MX: Just fix the docs Juergen Beisert
@ 2010-12-21 11:25 ` Juergen Beisert
  2010-12-21 11:25 ` [PATCH 7/9] ARM STM/i.MX: Avoid very long lines Juergen Beisert
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Juergen Beisert @ 2010-12-21 11:25 UTC (permalink / raw)
  To: barebox

Just an architecture improvement.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/arm/Kconfig                      |    1 +
 arch/arm/configs/chumbyone_defconfig  |    1 +
 arch/arm/configs/tx28stk5_defconfig   |    1 +
 arch/arm/mach-stm/include/mach/gpio.h |    4 ++
 arch/arm/mach-stm/iomux-imx.c         |   60 +++++++++++++++++++++++++++++++++
 5 files changed, 67 insertions(+), 0 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c09d21b..f1536a5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -41,6 +41,7 @@ config ARCH_IMX
 
 config ARCH_STM
 	bool "SigmaTel/FSL iMX-based"
+	select GENERIC_GPIO
 
 config ARCH_NETX
 	bool "Hilscher NetX based"
diff --git a/arch/arm/configs/chumbyone_defconfig b/arch/arm/configs/chumbyone_defconfig
index 6e6623a..45804a8 100644
--- a/arch/arm/configs/chumbyone_defconfig
+++ b/arch/arm/configs/chumbyone_defconfig
@@ -24,6 +24,7 @@ CONFIG_CMD_RESET=y
 CONFIG_CMD_TIMEOUT=y
 CONFIG_CMD_PARTITION=y
 CONFIG_CMD_BMP=y
+CONFIG_CMD_GPIO=y
 # CONFIG_SPI is not set
 CONFIG_VIDEO=y
 CONFIG_DRIVER_VIDEO_STM=y
diff --git a/arch/arm/configs/tx28stk5_defconfig b/arch/arm/configs/tx28stk5_defconfig
index d6b81c6..0851d5e 100644
--- a/arch/arm/configs/tx28stk5_defconfig
+++ b/arch/arm/configs/tx28stk5_defconfig
@@ -32,6 +32,7 @@ CONFIG_CMD_GO=y
 CONFIG_CMD_TIMEOUT=y
 CONFIG_CMD_PARTITION=y
 CONFIG_CMD_BMP=y
+CONFIG_CMD_GPIO=y
 CONFIG_NET=y
 CONFIG_NET_DHCP=y
 CONFIG_NET_TFTP=y
diff --git a/arch/arm/mach-stm/include/mach/gpio.h b/arch/arm/mach-stm/include/mach/gpio.h
index 97566a2..c419926 100644
--- a/arch/arm/mach-stm/include/mach/gpio.h
+++ b/arch/arm/mach-stm/include/mach/gpio.h
@@ -30,5 +30,9 @@
 #endif
 
 void imx_gpio_mode(uint32_t);
+void gpio_set_value(unsigned, int);
+int gpio_direction_input(unsigned);
+int gpio_direction_output(unsigned, int);
+int gpio_get_value(unsigned);
 
 #endif /* __ASM_MACH_GPIO_H */
diff --git a/arch/arm/mach-stm/iomux-imx.c b/arch/arm/mach-stm/iomux-imx.c
index 8a34e4c..b9fa565 100644
--- a/arch/arm/mach-stm/iomux-imx.c
+++ b/arch/arm/mach-stm/iomux-imx.c
@@ -20,6 +20,7 @@
 #include <common.h>
 #include <init.h>
 #include <gpio.h>
+#include <errno.h>
 #include <asm/io.h>
 #include <mach/imx-regs.h>
 
@@ -76,6 +77,12 @@ static unsigned calc_output_reg(unsigned no)
 	return  ((no >> 5) << 4) + HW_PINCTRL_DOUT0;
 }
 
+static unsigned calc_input_reg(unsigned no)
+{
+	/* each register controls 32 pads */
+	return  ((no >> 5) << 4) + HW_PINCTRL_DIN0;
+}
+
 /**
  * @param[in] m One pin define per call from iomux-mx23.h/iomux-mx28.h
  */
@@ -137,3 +144,56 @@ void imx_gpio_mode(uint32_t m)
 		}
 	}
 }
+
+int gpio_direction_input(unsigned gpio)
+{
+	unsigned reg_offset;
+
+	if (gpio > MAX_GPIO_NO)
+		return -EINVAL;
+
+	reg_offset = calc_output_enable_reg(gpio);
+	writel(0x1 << (gpio % 32), IMX_IOMUXC_BASE + reg_offset + BIT_CLR);
+
+	return 0;
+}
+
+int gpio_direction_output(unsigned gpio, int val)
+{
+	unsigned reg_offset;
+
+	if (gpio > MAX_GPIO_NO)
+		return -EINVAL;
+
+	/* first set the output value... */
+	reg_offset = calc_output_reg(gpio);
+	writel(0x1 << (gpio % 32), IMX_IOMUXC_BASE +
+		reg_offset + (val != 0 ? BIT_SET : BIT_CLR));
+	/* ...then the direction */
+	reg_offset = calc_output_enable_reg(gpio);
+	writel(0x1 << (gpio % 32), IMX_IOMUXC_BASE + reg_offset + BIT_SET);
+
+	return 0;
+}
+
+void gpio_set_value(unsigned gpio, int val)
+{
+	unsigned reg_offset;
+
+	reg_offset = calc_output_reg(gpio);
+	writel(0x1 << (gpio % 32), IMX_IOMUXC_BASE +
+				reg_offset + (val != 0 ? BIT_SET : BIT_CLR));
+}
+
+int gpio_get_value(unsigned gpio)
+{
+	uint32_t reg;
+	unsigned reg_offset;
+
+	reg_offset = calc_input_reg(gpio);
+	reg = readl(IMX_IOMUXC_BASE + reg_offset);
+	if (reg & (0x1 << (gpio % 32)))
+		return 1;
+
+	return 0;
+}
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 7/9] ARM STM/i.MX: Avoid very long lines
  2010-12-21 11:25 [PATCH] Add gpio command support to STM/i.MX arch Juergen Beisert
                   ` (5 preceding siblings ...)
  2010-12-21 11:25 ` [PATCH 6/9] ARM STM/i.MX: Add support for the gpio commands Juergen Beisert
@ 2010-12-21 11:25 ` Juergen Beisert
  2010-12-21 11:25 ` [PATCH 8/9] ARM STM/i.MX: Replace cryptic numbers Juergen Beisert
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Juergen Beisert @ 2010-12-21 11:25 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/arm/mach-stm/iomux-imx.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-stm/iomux-imx.c b/arch/arm/mach-stm/iomux-imx.c
index b9fa565..c59f0ac 100644
--- a/arch/arm/mach-stm/iomux-imx.c
+++ b/arch/arm/mach-stm/iomux-imx.c
@@ -124,14 +124,16 @@ void imx_gpio_mode(uint32_t m)
 
 	if (PE_PRESENT(m)) {
 		reg_offset = calc_pullup_reg(gpio_pin);
-		writel(0x1 << (gpio_pin % 32), IMX_IOMUXC_BASE + reg_offset + (GET_PULLUP(m) == 1 ? 4 : 8));
+		writel(0x1 << (gpio_pin % 32), IMX_IOMUXC_BASE + reg_offset +
+				(GET_PULLUP(m) == 1 ? 4 : 8));
 	}
 
 	if (GET_FUNC(m) == IS_GPIO) {
 		if (GET_GPIODIR(m) == 1) {
 			/* first set the output value */
 			reg_offset = calc_output_reg(gpio_pin);
-			writel(0x1 << (gpio_pin % 32), IMX_IOMUXC_BASE + reg_offset + (GET_GPIOVAL(m) == 1 ? 4 : 8));
+			writel(0x1 << (gpio_pin % 32), IMX_IOMUXC_BASE +
+				reg_offset + (GET_GPIOVAL(m) == 1 ? 4 : 8));
 			/* then the direction */
 			reg_offset = calc_output_enable_reg(gpio_pin);
 			writel(0x1 << (gpio_pin % 32),
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 8/9] ARM STM/i.MX: Replace cryptic numbers
  2010-12-21 11:25 [PATCH] Add gpio command support to STM/i.MX arch Juergen Beisert
                   ` (6 preceding siblings ...)
  2010-12-21 11:25 ` [PATCH 7/9] ARM STM/i.MX: Avoid very long lines Juergen Beisert
@ 2010-12-21 11:25 ` Juergen Beisert
  2010-12-21 11:25 ` [PATCH 9/9] ARM Chumby: Add list of available GPIOs and their meaning Juergen Beisert
  2010-12-23 11:30 ` [PATCH] Add gpio command support to STM/i.MX arch Gregory CLEMENT
  9 siblings, 0 replies; 15+ messages in thread
From: Juergen Beisert @ 2010-12-21 11:25 UTC (permalink / raw)
  To: barebox

Try to make the source more understandable.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/arm/mach-stm/iomux-imx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-stm/iomux-imx.c b/arch/arm/mach-stm/iomux-imx.c
index c59f0ac..bf6165f 100644
--- a/arch/arm/mach-stm/iomux-imx.c
+++ b/arch/arm/mach-stm/iomux-imx.c
@@ -125,7 +125,7 @@ void imx_gpio_mode(uint32_t m)
 	if (PE_PRESENT(m)) {
 		reg_offset = calc_pullup_reg(gpio_pin);
 		writel(0x1 << (gpio_pin % 32), IMX_IOMUXC_BASE + reg_offset +
-				(GET_PULLUP(m) == 1 ? 4 : 8));
+				(GET_PULLUP(m) == 1 ? BIT_SET : BIT_CLR));
 	}
 
 	if (GET_FUNC(m) == IS_GPIO) {
@@ -133,7 +133,7 @@ void imx_gpio_mode(uint32_t m)
 			/* first set the output value */
 			reg_offset = calc_output_reg(gpio_pin);
 			writel(0x1 << (gpio_pin % 32), IMX_IOMUXC_BASE +
-				reg_offset + (GET_GPIOVAL(m) == 1 ? 4 : 8));
+				reg_offset + (GET_GPIOVAL(m) == 1 ? BIT_SET : BIT_CLR));
 			/* then the direction */
 			reg_offset = calc_output_enable_reg(gpio_pin);
 			writel(0x1 << (gpio_pin % 32),
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 9/9] ARM Chumby: Add list of available GPIOs and their meaning
  2010-12-21 11:25 [PATCH] Add gpio command support to STM/i.MX arch Juergen Beisert
                   ` (7 preceding siblings ...)
  2010-12-21 11:25 ` [PATCH 8/9] ARM STM/i.MX: Replace cryptic numbers Juergen Beisert
@ 2010-12-21 11:25 ` Juergen Beisert
  2010-12-23 11:30 ` [PATCH] Add gpio command support to STM/i.MX arch Gregory CLEMENT
  9 siblings, 0 replies; 15+ messages in thread
From: Juergen Beisert @ 2010-12-21 11:25 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/arm/boards/chumby_falconwing/falconwing.c |   85 ++++++++++++++++++++++++
 1 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boards/chumby_falconwing/falconwing.c b/arch/arm/boards/chumby_falconwing/falconwing.c
index f5ed133..76ff906 100644
--- a/arch/arm/boards/chumby_falconwing/falconwing.c
+++ b/arch/arm/boards/chumby_falconwing/falconwing.c
@@ -390,4 +390,89 @@ make ARCH=arm CROSS_COMPILE=armv5compiler
   partition or you can do it in the classic way: mkfs on it, mount it and copy
   all required data and programs into it.
 
+@section gpio_falconwing Available GPIOs
+
+The Falconwing uses some GPIOs to control various features. With the regular
+GPIO commands these features can be controlled at @a barebox's runtime.
+
+<table width="100%" border="1" cellspacing="1" cellpadding="3">
+	<tr>
+		<td>No</td>
+		<td>Direction</td>
+		<td>Function</td>
+		<td>Reset</td>
+		<td>Set</td>
+	</tr>
+	<tr>
+		<td>8</td>
+		<td>Output</td>
+		<td>Switch Audio Amplifier</td>
+		<td>Off</td>
+		<td>On</td>
+	</tr>
+	<tr>
+		<td>11</td>
+		<td>Input</td>
+		<td>Head Phone Detection</td>
+		<td>TBD</td>
+		<td>TBD</td>
+	</tr>
+	<tr>
+		<td>14</td>
+		<td>Input</td>
+		<td>Unused (J113)</td>
+		<td>User</td>
+		<td>User</td>
+	</tr>
+	<tr>
+		<td>15</td>
+		<td>Input</td>
+		<td>Unused (J114)</td>
+		<td>User</td>
+		<td>User</td>
+	</tr>
+	<tr>
+		<td>26</td>
+		<td>Output</td>
+		<td>USB Power</td>
+		<td>TBD</td>
+		<td>TBD</td>
+	</tr>
+	<tr>
+		<td>27</td>
+		<td>Input</td>
+		<td>Display Connected</td>
+		<td>Display<br>Attached</td>
+		<td>Display<br>Disconnected</td>
+	</tr>
+	<tr>
+		<td>29</td>
+		<td>Output</td>
+		<td>USB HUB Reset</td>
+		<td>TBD</td>
+		<td>TBD</td>
+	</tr>
+	<tr>
+		<td>50</td>
+		<td>Output</td>
+		<td>Display Reset</td>
+		<td>Display<br>Reset</td>
+		<td>Display<br>Running</td>
+	</tr>
+	<tr>
+		<td>60</td>
+		<td>Output</td>
+		<td>Display Backlight</td>
+		<td>Backlight<br>Off</td>
+		<td>Backlight<br>On (100 %)</td>
+	</tr>
+	<tr>
+		<td>62</td>
+		<td>Input</td>
+		<td>Bend</td>
+		<td>Not pressed</td>
+		<td>Pressed</td>
+	</tr>
+</table>
+
 */
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Add gpio command support to STM/i.MX arch
  2010-12-21 11:25 [PATCH] Add gpio command support to STM/i.MX arch Juergen Beisert
                   ` (8 preceding siblings ...)
  2010-12-21 11:25 ` [PATCH 9/9] ARM Chumby: Add list of available GPIOs and their meaning Juergen Beisert
@ 2010-12-23 11:30 ` Gregory CLEMENT
  2010-12-23 11:50   ` Juergen Beisert
  2010-12-23 11:53   ` Eric Bénard
  9 siblings, 2 replies; 15+ messages in thread
From: Gregory CLEMENT @ 2010-12-23 11:30 UTC (permalink / raw)
  To: Juergen Beisert; +Cc: barebox

2010/12/21 Juergen Beisert <jbe@pengutronix.de>:
> In order to complete graphics handling on STM/i.MX architecture, the platforms
> need GPIO command support (for example to enable the display and backlight).
>
Hi,
I tested this patchset on my board using an imx23. It seems OK.
So if you want you can add a
Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

> The following changes since commit af05a9dd223f0a77133e37893354680c2f857a54:
>
>  xyzModem.c: fix 'dummy' is used uninitialized in this function warning (2010-12-21 10:23:41 +0100)
>
> are available in the git repository at:
>  http://git.pengutronix.de/git/jbe/for_barebox_next/ next_stm_gpio_v3
>

I didn't manage to get your git tree:
$ git remote add -f jbe http://git.pengutronix.de/git/jbe/for_barebox_next
Updating jbe
fatal: http://git.pengutronix.de/git/jbe/for_barebox_next/info/refs
not found: did you run git update-server-info on the server?
error: Could not fetch jbe

Indeed http://git.pengutronix.de/git/jbe/for_barebox_next/info/refs
does not exist.
Maybe I did something wrong or maybe be you have to run git
update-server-info on the server ;)

> Juergen Beisert (9):
>      Fix a typo in the GPIO doc
>      ARM STM/i.MX: Fix register offset calculation for GPIO input pins
>      ARM STM/i.MX: Remove variable size restrictions in iomux managing routines
>      ARM STM/i.MX: Setting the iomux needs at least 32 bit.
>      ARM STM/i.MX: Just fix the docs
>      ARM STM/i.MX: Add support for the gpio commands
>      ARM STM/i.MX: Avoid very long lines
>      ARM STM/i.MX: Replace cryptic numbers
>      ARM Chumby: Add list of available GPIOs and their meaning
>
>  arch/arm/Kconfig                               |    1 +
>  arch/arm/boards/chumby_falconwing/falconwing.c |   85 ++++++++++++++++++++++++
>  arch/arm/configs/chumbyone_defconfig           |    1 +
>  arch/arm/configs/tx28stk5_defconfig            |    1 +
>  arch/arm/mach-stm/include/mach/gpio.h          |    8 ++-
>  arch/arm/mach-stm/iomux-imx.c                  |   85 +++++++++++++++++++++---
>  commands/gpio.c                                |    2 +-
>  7 files changed, 171 insertions(+), 12 deletions(-)
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>



-- 
Gregory CLEMENT

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Add gpio command support to STM/i.MX arch
  2010-12-23 11:30 ` [PATCH] Add gpio command support to STM/i.MX arch Gregory CLEMENT
@ 2010-12-23 11:50   ` Juergen Beisert
  2010-12-23 11:58     ` Gregory CLEMENT
  2010-12-23 14:36     ` Uwe Kleine-König
  2010-12-23 11:53   ` Eric Bénard
  1 sibling, 2 replies; 15+ messages in thread
From: Juergen Beisert @ 2010-12-23 11:50 UTC (permalink / raw)
  To: Uwe Kleine-Koenig; +Cc: barebox

Gregory CLEMENT wrote:
> [...]
> > are available in the git repository at:
> >  http://git.pengutronix.de/git/jbe/for_barebox_next/ next_stm_gpio_v3
>
> I didn't manage to get your git tree:
> $ git remote add -f jbe http://git.pengutronix.de/git/jbe/for_barebox_next
> Updating jbe
> fatal: http://git.pengutronix.de/git/jbe/for_barebox_next/info/refs
> not found: did you run git update-server-info on the server?
> error: Could not fetch jbe
>
> Indeed http://git.pengutronix.de/git/jbe/for_barebox_next/info/refs
> does not exist.
> Maybe I did something wrong or maybe be you have to run git
> update-server-info on the server ;)

Sorry, I'm not a git expert. But this will show the content:

http://git.pengutronix.de/?p=jbe/for_barebox_next;a=summary

Don't know, what's wrong.

@Uwe: ?

jbe
-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Add gpio command support to STM/i.MX arch
  2010-12-23 11:30 ` [PATCH] Add gpio command support to STM/i.MX arch Gregory CLEMENT
  2010-12-23 11:50   ` Juergen Beisert
@ 2010-12-23 11:53   ` Eric Bénard
  1 sibling, 0 replies; 15+ messages in thread
From: Eric Bénard @ 2010-12-23 11:53 UTC (permalink / raw)
  To: barebox

On 23/12/2010 12:30, Gregory CLEMENT wrote:
> I didn't manage to get your git tree:
> $ git remote add -f jbe http://git.pengutronix.de/git/jbe/for_barebox_next
> Updating jbe
> fatal: http://git.pengutronix.de/git/jbe/for_barebox_next/info/refs
> not found: did you run git update-server-info on the server?
> error: Could not fetch jbe
>
> Indeed http://git.pengutronix.de/git/jbe/for_barebox_next/info/refs
> does not exist.
> Maybe I did something wrong or maybe be you have to run git
> update-server-info on the server ;)
>
try using git protocol instead of http, this works on other tree on the 
pengutronix git server :
git://git.pengutronix.de/git/jbe/for_barebox_next

Eric

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Add gpio command support to STM/i.MX arch
  2010-12-23 11:50   ` Juergen Beisert
@ 2010-12-23 11:58     ` Gregory CLEMENT
  2010-12-23 14:36     ` Uwe Kleine-König
  1 sibling, 0 replies; 15+ messages in thread
From: Gregory CLEMENT @ 2010-12-23 11:58 UTC (permalink / raw)
  To: Juergen Beisert; +Cc: barebox, Uwe Kleine-Koenig

On 12/23/2010 12:50 PM, Juergen Beisert wrote:
> Gregory CLEMENT wrote:
>> [...]
>>> are available in the git repository at:
>>>  http://git.pengutronix.de/git/jbe/for_barebox_next/ next_stm_gpio_v3
>>
>> I didn't manage to get your git tree:
>> $ git remote add -f jbe http://git.pengutronix.de/git/jbe/for_barebox_next
>> Updating jbe
>> fatal: http://git.pengutronix.de/git/jbe/for_barebox_next/info/refs
>> not found: did you run git update-server-info on the server?
>> error: Could not fetch jbe
>>
>> Indeed http://git.pengutronix.de/git/jbe/for_barebox_next/info/refs
>> does not exist.
>> Maybe I did something wrong or maybe be you have to run git
>> update-server-info on the server ;)
> 
> Sorry, I'm not a git expert. But this will show the content:
> 
> http://git.pengutronix.de/?p=jbe/for_barebox_next;a=summary
> 
> Don't know, what's wrong.
> 
> @Uwe: ?
> 

The problem was that I used http protocol instead of git protocol.
this command finally worked perfectly:
$git remote add -f jbe git://git.pengutronix.de/git/jbe/for_barebox_next

Thanks to Eric Bénard for his advice.


> jbe


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Add gpio command support to STM/i.MX arch
  2010-12-23 11:50   ` Juergen Beisert
  2010-12-23 11:58     ` Gregory CLEMENT
@ 2010-12-23 14:36     ` Uwe Kleine-König
  1 sibling, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2010-12-23 14:36 UTC (permalink / raw)
  To: Juergen Beisert; +Cc: barebox

On Thu, Dec 23, 2010 at 12:50:07PM +0100, Juergen Beisert wrote:
> Gregory CLEMENT wrote:
> > [...]
> > > are available in the git repository at:
> > >  http://git.pengutronix.de/git/jbe/for_barebox_next/ next_stm_gpio_v3
> >
> > I didn't manage to get your git tree:
> > $ git remote add -f jbe http://git.pengutronix.de/git/jbe/for_barebox_next
> > Updating jbe
> > fatal: http://git.pengutronix.de/git/jbe/for_barebox_next/info/refs
> > not found: did you run git update-server-info on the server?
                           ^^^^^^^^^^^^^^^^^^^^^^
you only need to believe this :-)

> > error: Could not fetch jbe
> >
> > Indeed http://git.pengutronix.de/git/jbe/for_barebox_next/info/refs
> > does not exist.
> > Maybe I did something wrong or maybe be you have to run git
> > update-server-info on the server ;)
> 
> Sorry, I'm not a git expert. But this will show the content:
> 
> http://git.pengutronix.de/?p=jbe/for_barebox_next;a=summary
> 
> Don't know, what's wrong.
> 
> @Uwe: ?
You need to do

	cd /path/to/your/for_barebox_next-repo
	git update-server-info

(to fix this for now and )

	mv hooks/post-update.sample hooks/post-update

(to assert it stays fixed when you push the next time.)

But in general git:// is preferable because it only transfers the needed
objects (in contrast to the complete history when the repository is
perfectly packed even you only miss a single object).

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2010-12-23 14:36 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-21 11:25 [PATCH] Add gpio command support to STM/i.MX arch Juergen Beisert
2010-12-21 11:25 ` [PATCH 1/9] Fix a typo in the GPIO doc Juergen Beisert
2010-12-21 11:25 ` [PATCH 2/9] ARM STM/i.MX: Fix register offset calculation for GPIO input pins Juergen Beisert
2010-12-21 11:25 ` [PATCH 3/9] ARM STM/i.MX: Remove variable size restrictions in iomux managing routines Juergen Beisert
2010-12-21 11:25 ` [PATCH 4/9] ARM STM/i.MX: Setting the iomux needs at least 32 bit Juergen Beisert
2010-12-21 11:25 ` [PATCH 5/9] ARM STM/i.MX: Just fix the docs Juergen Beisert
2010-12-21 11:25 ` [PATCH 6/9] ARM STM/i.MX: Add support for the gpio commands Juergen Beisert
2010-12-21 11:25 ` [PATCH 7/9] ARM STM/i.MX: Avoid very long lines Juergen Beisert
2010-12-21 11:25 ` [PATCH 8/9] ARM STM/i.MX: Replace cryptic numbers Juergen Beisert
2010-12-21 11:25 ` [PATCH 9/9] ARM Chumby: Add list of available GPIOs and their meaning Juergen Beisert
2010-12-23 11:30 ` [PATCH] Add gpio command support to STM/i.MX arch Gregory CLEMENT
2010-12-23 11:50   ` Juergen Beisert
2010-12-23 11:58     ` Gregory CLEMENT
2010-12-23 14:36     ` Uwe Kleine-König
2010-12-23 11:53   ` Eric Bénard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox