mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 00/10] ARM i.MX: add gpiolib support
@ 2012-08-31  8:54 Steffen Trumtrar
  2012-08-31  8:54 ` [PATCH 01/10] " Steffen Trumtrar
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Steffen Trumtrar @ 2012-08-31  8:54 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

Hi all,

this patch series moves mach-imx to gpiolib support.
This was tested on imx6 and at least compiles on other SoC-defconfigs.

Greetings,
Steffen

Sascha Hauer (2):
  add gpiolib support
  ARM i.MX: switch to gpiolib support

Steffen Trumtrar (8):
  ARM i.MX5: add imx-gpio devices
  ARM i.MX6: add imx-gpio devices
  ARM i.MX53: add imx-gpio devices
  ARM i.MX35: add imx-gpio devices
  ARM i.MX27: add imx-gpio devices
  ARM i.MX25: add imx-gpio devices
  ARM i.MX1: add imx-gpio devices
  ARM i.MX21: add imx-gpio devices

 arch/arm/mach-imx/gpio.c  |   91 +++++++++++++++++++-----------
 arch/arm/mach-imx/imx1.c  |    9 +++
 arch/arm/mach-imx/imx21.c |   15 +++++
 arch/arm/mach-imx/imx25.c |    4 ++
 arch/arm/mach-imx/imx27.c |    6 ++
 arch/arm/mach-imx/imx35.c |    4 ++
 arch/arm/mach-imx/imx51.c |    5 ++
 arch/arm/mach-imx/imx53.c |    7 +++
 arch/arm/mach-imx/imx6.c  |   14 +++++
 drivers/Makefile          |    1 +
 drivers/gpio/Makefile     |    1 +
 drivers/gpio/gpio.c       |  134 +++++++++++++++++++++++++++++++++++++++++++++
 include/gpio.h            |   32 ++++++++---
 13 files changed, 283 insertions(+), 40 deletions(-)
 create mode 100644 drivers/gpio/Makefile
 create mode 100644 drivers/gpio/gpio.c

-- 
1.7.10.4


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

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

* [PATCH 01/10] add gpiolib support
  2012-08-31  8:54 [PATCH 00/10] ARM i.MX: add gpiolib support Steffen Trumtrar
@ 2012-08-31  8:54 ` Steffen Trumtrar
  2012-09-03  7:00   ` Sascha Hauer
  2012-09-03  7:03   ` Sascha Hauer
  2012-08-31  8:54 ` [PATCH 02/10] ARM i.MX: switch to " Steffen Trumtrar
                   ` (8 subsequent siblings)
  9 siblings, 2 replies; 14+ messages in thread
From: Steffen Trumtrar @ 2012-08-31  8:54 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 drivers/Makefile      |    1 +
 drivers/gpio/Makefile |    1 +
 drivers/gpio/gpio.c   |  134 +++++++++++++++++++++++++++++++++++++++++++++++++
 include/gpio.h        |   32 +++++++++---
 4 files changed, 160 insertions(+), 8 deletions(-)
 create mode 100644 drivers/gpio/Makefile
 create mode 100644 drivers/gpio/gpio.c

diff --git a/drivers/Makefile b/drivers/Makefile
index ea3263f..1d14e6c 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -17,3 +17,4 @@ obj-$(CONFIG_PWM) += pwm/
 obj-y	+= input/
 obj-y	+= dma/
 obj-y  += watchdog/
+obj-y	+= gpio/
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
new file mode 100644
index 0000000..7837966
--- /dev/null
+++ b/drivers/gpio/Makefile
@@ -0,0 +1 @@
+obj-y += gpio.o
diff --git a/drivers/gpio/gpio.c b/drivers/gpio/gpio.c
new file mode 100644
index 0000000..6ad8d27
--- /dev/null
+++ b/drivers/gpio/gpio.c
@@ -0,0 +1,134 @@
+#include <common.h>
+#include <gpio.h>
+#include <errno.h>
+
+static LIST_HEAD(chip_list);
+
+#define ARCH_NR_GPIOS 256
+
+static struct gpio_chip *gpio_desc[ARCH_NR_GPIOS];
+
+static int gpio_is_valid(unsigned gpio)
+{
+	if (gpio < ARCH_NR_GPIOS)
+		return 1;
+	return 0;
+}
+
+void gpio_set_value(unsigned gpio, int value)
+{
+	struct gpio_chip *chip = gpio_desc[gpio];
+
+	if (!gpio_is_valid(gpio))
+		return;
+	if (!chip)
+		return;
+	if (!chip->ops->set)
+		return;
+	chip->ops->set(chip, gpio - chip->base, value);
+}
+EXPORT_SYMBOL(gpio_set_value);
+
+int gpio_get_value(unsigned gpio)
+{
+	struct gpio_chip *chip = gpio_desc[gpio];
+
+	if (!gpio_is_valid(gpio))
+		return -EINVAL;
+	if (!chip)
+		return -ENODEV;
+	if (!chip->ops->get)
+		return -ENOSYS;
+	return chip->ops->get(chip, gpio - chip->base);
+}
+EXPORT_SYMBOL(gpio_get_value);
+
+int gpio_direction_output(unsigned gpio, int value)
+{
+	struct gpio_chip *chip = gpio_desc[gpio];
+
+	if (!gpio_is_valid(gpio))
+		return -EINVAL;
+	if (!chip)
+		return -ENODEV;
+	if (!chip->ops->direction_output)
+		return -ENOSYS;
+	return chip->ops->direction_output(chip, gpio - chip->base, value);
+}
+EXPORT_SYMBOL(gpio_direction_output);
+
+int gpio_direction_input(unsigned gpio)
+{
+	struct gpio_chip *chip = gpio_desc[gpio];
+
+	if (!gpio_is_valid(gpio))
+		return -EINVAL;
+	if (!chip)
+		return -ENODEV;
+	if (!chip->ops->direction_input)
+		return -ENOSYS;
+	return chip->ops->direction_input(chip, gpio - chip->base);
+}
+EXPORT_SYMBOL(gpio_direction_input);
+
+static int gpiochip_find_base(int start, int ngpio)
+{
+	int i;
+	int spare = 0;
+	int base = -ENOSPC;
+
+	if (start < 0)
+		start = 0;
+
+	for (i = start; i < ARCH_NR_GPIOS; i++) {
+		struct gpio_chip *chip = gpio_desc[i];
+
+		if (!chip) {
+			spare++;
+			if (spare == ngpio) {
+				base = i + 1 - ngpio;
+				break;
+			}
+		} else {
+			spare = 0;
+			i += chip->ngpio - 1;
+		}
+	}
+
+	if (gpio_is_valid(base))
+		debug("%s: found new base at %d\n", __func__, base);
+	return base;
+}
+
+int gpiochip_add(struct gpio_chip *chip)
+{
+	int base, i;
+
+	base = gpiochip_find_base(chip->base, chip->ngpio);
+	if (base < 0)
+		return base;
+
+	if (chip->base >= 0 && chip->base != base)
+		return -EBUSY;
+
+	chip->base = base;
+
+	list_add_tail(&chip->list, &chip_list);
+
+	for (i = chip->base; i < chip->base + chip->ngpio; i++)
+		gpio_desc[i] = chip;
+
+	return 0;
+}
+
+int gpio_get_num(struct device_d *dev, int gpio)
+{
+	struct gpio_chip *chip;
+
+	list_for_each_entry(chip, &chip_list, list) {
+		if (chip->dev == dev)
+			return chip->base + gpio;
+	}
+
+	return -ENODEV;
+}
diff --git a/include/gpio.h b/include/gpio.h
index b7d8402..903fa06 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -3,12 +3,28 @@
 
 #include <asm/gpio.h>
 
-static inline int gpio_request(unsigned gpio, const char *label)
-{
-	return 0;
-}
-
-static inline void gpio_free(unsigned gpio)
-{
-}
+struct gpio_chip;
+
+struct gpio_ops {
+	int (*direction_input)(struct gpio_chip *chip, unsigned offset);
+	int (*direction_output)(struct gpio_chip *chip, unsigned offset, int value);
+	int (*get)(struct gpio_chip *chip, unsigned offset);
+	void (*set)(struct gpio_chip *chip, unsigned offset, int value);
+};
+
+struct gpio_chip {
+	struct device_d *dev;
+
+	int base;
+	int ngpio;
+
+	struct gpio_ops *ops;
+
+	struct list_head list;
+};
+
+int gpiochip_add(struct gpio_chip *chip);
+
+int gpio_get_num(struct device_d *dev, int gpio);
+
 #endif /* __GPIO_H */
-- 
1.7.10.4


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

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

* [PATCH 02/10] ARM i.MX: switch to gpiolib support
  2012-08-31  8:54 [PATCH 00/10] ARM i.MX: add gpiolib support Steffen Trumtrar
  2012-08-31  8:54 ` [PATCH 01/10] " Steffen Trumtrar
@ 2012-08-31  8:54 ` Steffen Trumtrar
  2012-08-31  8:54 ` [PATCH 03/10] ARM i.MX5: add imx-gpio devices Steffen Trumtrar
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Steffen Trumtrar @ 2012-08-31  8:54 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 arch/arm/mach-imx/gpio.c |   91 ++++++++++++++++++++++++++++++----------------
 1 file changed, 59 insertions(+), 32 deletions(-)

diff --git a/arch/arm/mach-imx/gpio.c b/arch/arm/mach-imx/gpio.c
index fdee20b..370b555 100644
--- a/arch/arm/mach-imx/gpio.c
+++ b/arch/arm/mach-imx/gpio.c
@@ -27,7 +27,8 @@
 #include <errno.h>
 #include <io.h>
 #include <mach/imx-regs.h>
-#include <mach/gpio.h>
+#include <gpio.h>
+#include <init.h>
 
 #if defined CONFIG_ARCH_IMX1 || defined CONFIG_ARCH_IMX21 || defined CONFIG_ARCH_IMX27
 #define GPIO_DR		0x1c
@@ -51,18 +52,15 @@
 extern void __iomem *imx_gpio_base[];
 extern int imx_gpio_count;
 
-static void __iomem *gpio_get_base(unsigned gpio)
-{
-	if (gpio >= imx_gpio_count)
-		return NULL;
-
-	return imx_gpio_base[gpio / 32];
-}
+struct imx_gpio_chip {
+	void __iomem *base;
+	struct gpio_chip chip;
+};
 
-void gpio_set_value(unsigned gpio, int value)
+static void imx_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
 {
-	void __iomem *base = gpio_get_base(gpio);
-	int shift = gpio % 32;
+	struct imx_gpio_chip *imxgpio = container_of(chip, struct imx_gpio_chip, chip);
+	void __iomem *base = imxgpio->base;
 	u32 val;
 
 	if (!base)
@@ -71,59 +69,88 @@ void gpio_set_value(unsigned gpio, int value)
 	val = readl(base + GPIO_DR);
 
 	if (value)
-		val |= 1 << shift;
+		val |= 1 << gpio;
 	else
-		val &= ~(1 << shift);
+		val &= ~(1 << gpio);
 
 	writel(val, base + GPIO_DR);
 }
 
-int gpio_direction_input(unsigned gpio)
+static int imx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
 {
-	void __iomem *base = gpio_get_base(gpio);
-	int shift = gpio % 32;
+	struct imx_gpio_chip *imxgpio = container_of(chip, struct imx_gpio_chip, chip);
+	void __iomem *base = imxgpio->base;
 	u32 val;
 
 	if (!base)
 		return -EINVAL;
 
 	val = readl(base + GPIO_GDIR);
-	val &= ~(1 << shift);
+	val &= ~(1 << gpio);
 	writel(val, base + GPIO_GDIR);
 
 	return 0;
 }
 
 
-int gpio_direction_output(unsigned gpio, int value)
+static int imx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int value)
 {
-	void __iomem *base = gpio_get_base(gpio);
-	int shift = gpio % 32;
+	struct imx_gpio_chip *imxgpio = container_of(chip, struct imx_gpio_chip, chip);
+	void __iomem *base = imxgpio->base;
 	u32 val;
 
-	if (!base)
-		return -EINVAL;
-
-	gpio_set_value(gpio, value);
+	gpio_set_value(gpio + chip->base, value);
 
 	val = readl(base + GPIO_GDIR);
-	val |= 1 << shift;
+	val |= 1 << gpio;
 	writel(val, base + GPIO_GDIR);
 
 	return 0;
 }
 
-int gpio_get_value(unsigned gpio)
+static int imx_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
 {
-	void __iomem *base = gpio_get_base(gpio);
-	int shift = gpio % 32;
+	struct imx_gpio_chip *imxgpio = container_of(chip, struct imx_gpio_chip, chip);
+	void __iomem *base = imxgpio->base;
 	u32 val;
 
-	if (!base)
-		return -EINVAL;
-
 	val = readl(base + GPIO_PSR);
 
-	return val & (1 << shift) ? 1 : 0;
+	return val & (1 << gpio) ? 1 : 0;
 }
 
+static struct gpio_ops imx_gpio_ops = {
+	.direction_input = imx_gpio_direction_input,
+	.direction_output = imx_gpio_direction_output,
+	.get = imx_gpio_get_value,
+	.set = imx_gpio_set_value,
+};
+
+static int imx_gpio_probe(struct device_d *dev)
+{
+	struct imx_gpio_chip *imxgpio;
+
+	imxgpio = xzalloc(sizeof(*imxgpio));
+	imxgpio->base = dev_request_mem_region(dev, 0);
+	imxgpio->chip.ops = &imx_gpio_ops;
+	imxgpio->chip.base = -1;
+	imxgpio->chip.ngpio = 32;
+	imxgpio->chip.dev = dev;
+	gpiochip_add(&imxgpio->chip);
+
+	dev_info(dev, "probed gpiochip%d with base %d\n", dev->id, imxgpio->chip.base);
+
+	return 0;
+}
+
+static struct driver_d imx_gpio_driver = {
+	.name = "imx-gpio",
+	.probe = imx_gpio_probe,
+};
+
+static int imx_gpio_add(void)
+{
+	register_driver(&imx_gpio_driver);
+	return 0;
+}
+coredevice_initcall(imx_gpio_add);
-- 
1.7.10.4


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

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

* [PATCH 03/10] ARM i.MX5: add imx-gpio devices
  2012-08-31  8:54 [PATCH 00/10] ARM i.MX: add gpiolib support Steffen Trumtrar
  2012-08-31  8:54 ` [PATCH 01/10] " Steffen Trumtrar
  2012-08-31  8:54 ` [PATCH 02/10] ARM i.MX: switch to " Steffen Trumtrar
@ 2012-08-31  8:54 ` Steffen Trumtrar
  2012-09-03  7:01   ` Sascha Hauer
  2012-08-31  8:54 ` [PATCH 04/10] ARM i.MX6: " Steffen Trumtrar
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Steffen Trumtrar @ 2012-08-31  8:54 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 arch/arm/mach-imx/imx51.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/mach-imx/imx51.c b/arch/arm/mach-imx/imx51.c
index 53205a9..506a7d9 100644
--- a/arch/arm/mach-imx/imx51.c
+++ b/arch/arm/mach-imx/imx51.c
@@ -89,6 +89,11 @@ static int imx51_init(void)
 	add_generic_device("imx_iim", 0, NULL, MX51_IIM_BASE_ADDR, SZ_4K,
 			IORESOURCE_MEM, NULL);
 
+	add_generic_device("imx-gpio", 0, NULL, 0x73f84000, 0x1000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 1, NULL, 0x73f88000, 0x1000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 2, NULL, 0x73f8c000, 0x1000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 3, NULL, 0x73f90000, 0x1000, IORESOURCE_MEM, NULL);
+
 	return 0;
 }
 coredevice_initcall(imx51_init);
-- 
1.7.10.4


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

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

* [PATCH 04/10] ARM i.MX6: add imx-gpio devices
  2012-08-31  8:54 [PATCH 00/10] ARM i.MX: add gpiolib support Steffen Trumtrar
                   ` (2 preceding siblings ...)
  2012-08-31  8:54 ` [PATCH 03/10] ARM i.MX5: add imx-gpio devices Steffen Trumtrar
@ 2012-08-31  8:54 ` Steffen Trumtrar
  2012-08-31  8:54 ` [PATCH 05/10] ARM i.MX53: " Steffen Trumtrar
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Steffen Trumtrar @ 2012-08-31  8:54 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 arch/arm/mach-imx/imx6.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
index a443343..b6067d7 100644
--- a/arch/arm/mach-imx/imx6.c
+++ b/arch/arm/mach-imx/imx6.c
@@ -69,3 +69,17 @@ void imx6_init_lowlevel(void)
 	writel(0xffffffff, 0x020c407c);
 	writel(0xffffffff, 0x020c4080);
 }
+
+static int imx6_init(void)
+{
+	add_generic_device("imx-gpio", 0, NULL, MX6_GPIO1_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 1, NULL, MX6_GPIO2_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 2, NULL, MX6_GPIO3_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 3, NULL, MX6_GPIO4_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 4, NULL, MX6_GPIO5_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 5, NULL, MX6_GPIO6_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 6, NULL, MX6_GPIO7_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL);
+
+	return 0;
+}
+coredevice_initcall(imx6_init);
-- 
1.7.10.4


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

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

* [PATCH 05/10] ARM i.MX53: add imx-gpio devices
  2012-08-31  8:54 [PATCH 00/10] ARM i.MX: add gpiolib support Steffen Trumtrar
                   ` (3 preceding siblings ...)
  2012-08-31  8:54 ` [PATCH 04/10] ARM i.MX6: " Steffen Trumtrar
@ 2012-08-31  8:54 ` Steffen Trumtrar
  2012-08-31  8:54 ` [PATCH 06/10] ARM i.MX35: " Steffen Trumtrar
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Steffen Trumtrar @ 2012-08-31  8:54 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 arch/arm/mach-imx/imx53.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/mach-imx/imx53.c b/arch/arm/mach-imx/imx53.c
index 7c679bb..4071dce 100644
--- a/arch/arm/mach-imx/imx53.c
+++ b/arch/arm/mach-imx/imx53.c
@@ -88,6 +88,13 @@ static int imx53_init(void)
 	add_generic_device("imx_iim", 0, NULL, MX53_IIM_BASE_ADDR, SZ_4K,
 			IORESOURCE_MEM, NULL);
 
+	add_generic_device("imx-gpio", 0, NULL, MX53_GPIO1_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 1, NULL, MX53_GPIO2_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 2, NULL, MX53_GPIO3_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 3, NULL, MX53_GPIO4_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 4, NULL, MX53_GPIO5_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 5, NULL, MX53_GPIO6_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 6, NULL, MX53_GPIO7_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
 	return 0;
 }
 coredevice_initcall(imx53_init);
-- 
1.7.10.4


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

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

* [PATCH 06/10] ARM i.MX35: add imx-gpio devices
  2012-08-31  8:54 [PATCH 00/10] ARM i.MX: add gpiolib support Steffen Trumtrar
                   ` (4 preceding siblings ...)
  2012-08-31  8:54 ` [PATCH 05/10] ARM i.MX53: " Steffen Trumtrar
@ 2012-08-31  8:54 ` Steffen Trumtrar
  2012-08-31  8:54 ` [PATCH 07/10] ARM i.MX27: " Steffen Trumtrar
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Steffen Trumtrar @ 2012-08-31  8:54 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 arch/arm/mach-imx/imx35.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-imx/imx35.c b/arch/arm/mach-imx/imx35.c
index fe0c99e..066436c 100644
--- a/arch/arm/mach-imx/imx35.c
+++ b/arch/arm/mach-imx/imx35.c
@@ -66,6 +66,10 @@ static int imx35_init(void)
 	add_generic_device("imx_iim", 0, NULL, IMX_IIM_BASE, SZ_4K,
 			IORESOURCE_MEM, NULL);
 
+	add_generic_device("imx-gpio", 0, NULL, 0x53fcc000, 0x1000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 1, NULL, 0x53fd0000, 0x1000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 2, NULL, 0x53fa4000, 0x1000, IORESOURCE_MEM, NULL);
+
 	return 0;
 }
 coredevice_initcall(imx35_init);
-- 
1.7.10.4


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

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

* [PATCH 07/10] ARM i.MX27: add imx-gpio devices
  2012-08-31  8:54 [PATCH 00/10] ARM i.MX: add gpiolib support Steffen Trumtrar
                   ` (5 preceding siblings ...)
  2012-08-31  8:54 ` [PATCH 06/10] ARM i.MX35: " Steffen Trumtrar
@ 2012-08-31  8:54 ` Steffen Trumtrar
  2012-08-31  8:54 ` [PATCH 08/10] ARM i.MX25: " Steffen Trumtrar
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Steffen Trumtrar @ 2012-08-31  8:54 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 arch/arm/mach-imx/imx27.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-imx/imx27.c b/arch/arm/mach-imx/imx27.c
index 1af291d..cf5ec21 100644
--- a/arch/arm/mach-imx/imx27.c
+++ b/arch/arm/mach-imx/imx27.c
@@ -86,6 +86,12 @@ static int imx27_init(void)
 
 	imx27_init_max();
 
+	add_generic_device("imx-gpio", 0, NULL, 0x10015000, 0x100, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 1, NULL, 0x10015100, 0x100, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 2, NULL, 0x10015200, 0x100, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 3, NULL, 0x10015300, 0x100, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 4, NULL, 0x10015400, 0x100, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 5, NULL, 0x10015500, 0x100, IORESOURCE_MEM, NULL);
 	return 0;
 }
 coredevice_initcall(imx27_init);
-- 
1.7.10.4


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

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

* [PATCH 08/10] ARM i.MX25: add imx-gpio devices
  2012-08-31  8:54 [PATCH 00/10] ARM i.MX: add gpiolib support Steffen Trumtrar
                   ` (6 preceding siblings ...)
  2012-08-31  8:54 ` [PATCH 07/10] ARM i.MX27: " Steffen Trumtrar
@ 2012-08-31  8:54 ` Steffen Trumtrar
  2012-08-31  8:54 ` [PATCH 09/10] ARM i.MX1: " Steffen Trumtrar
  2012-08-31  8:54 ` [PATCH 10/10] ARM i.MX21: " Steffen Trumtrar
  9 siblings, 0 replies; 14+ messages in thread
From: Steffen Trumtrar @ 2012-08-31  8:54 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 arch/arm/mach-imx/imx25.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-imx/imx25.c b/arch/arm/mach-imx/imx25.c
index 19a2909..7552af3 100644
--- a/arch/arm/mach-imx/imx25.c
+++ b/arch/arm/mach-imx/imx25.c
@@ -59,6 +59,10 @@ static int imx25_init(void)
 	add_generic_device("imx_iim", 0, NULL, IMX_IIM_BASE, SZ_4K,
 			IORESOURCE_MEM, &imx25_iim_pdata);
 
+	add_generic_device("imx-gpio", 0, NULL, 0x53fcc000, 0x1000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 1, NULL, 0x53fd0000, 0x1000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 2, NULL, 0x53fa4000, 0x1000, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 3, NULL, 0x53f9c000, 0x1000, IORESOURCE_MEM, NULL);
 	return 0;
 }
 coredevice_initcall(imx25_init);
-- 
1.7.10.4


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

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

* [PATCH 09/10] ARM i.MX1: add imx-gpio devices
  2012-08-31  8:54 [PATCH 00/10] ARM i.MX: add gpiolib support Steffen Trumtrar
                   ` (7 preceding siblings ...)
  2012-08-31  8:54 ` [PATCH 08/10] ARM i.MX25: " Steffen Trumtrar
@ 2012-08-31  8:54 ` Steffen Trumtrar
  2012-08-31  8:54 ` [PATCH 10/10] ARM i.MX21: " Steffen Trumtrar
  9 siblings, 0 replies; 14+ messages in thread
From: Steffen Trumtrar @ 2012-08-31  8:54 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 arch/arm/mach-imx/imx1.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/mach-imx/imx1.c b/arch/arm/mach-imx/imx1.c
index 742a260..1ce0e39 100644
--- a/arch/arm/mach-imx/imx1.c
+++ b/arch/arm/mach-imx/imx1.c
@@ -28,4 +28,13 @@ void *imx_gpio_base[] = {
 
 int imx_gpio_count = ARRAY_SIZE(imx_gpio_base) * 32;
 
+static int imx1_init(void)
+{
+	add_generic_device("imx-gpio", 0, NULL, 0x0021c000, 0x100, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 1, NULL, 0x0021c100, 0x100, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 2, NULL, 0x0021c200, 0x100, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 3, NULL, 0x0021c300, 0x100, IORESOURCE_MEM, NULL);
 
+	return 0;
+}
+coredevice_initcall(imx1_init);
-- 
1.7.10.4


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

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

* [PATCH 10/10] ARM i.MX21: add imx-gpio devices
  2012-08-31  8:54 [PATCH 00/10] ARM i.MX: add gpiolib support Steffen Trumtrar
                   ` (8 preceding siblings ...)
  2012-08-31  8:54 ` [PATCH 09/10] ARM i.MX1: " Steffen Trumtrar
@ 2012-08-31  8:54 ` Steffen Trumtrar
  9 siblings, 0 replies; 14+ messages in thread
From: Steffen Trumtrar @ 2012-08-31  8:54 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 arch/arm/mach-imx/imx21.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/mach-imx/imx21.c b/arch/arm/mach-imx/imx21.c
index bbef33d..19e9bd0 100644
--- a/arch/arm/mach-imx/imx21.c
+++ b/arch/arm/mach-imx/imx21.c
@@ -39,3 +39,18 @@ void *imx_gpio_base[] = {
 
 int imx_gpio_count = ARRAY_SIZE(imx_gpio_base) * 32;
 
+static int imx21_init(void)
+{
+	add_generic_device("imx_iim", 0, NULL, MX51_IIM_BASE_ADDR, SZ_4K,
+			IORESOURCE_MEM, NULL);
+
+	add_generic_device("imx-gpio", 0, NULL, 0x10015000, 0x100, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 1, NULL, 0x10015100, 0x100, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 2, NULL, 0x10015200, 0x100, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 3, NULL, 0x10015300, 0x100, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 4, NULL, 0x10015400, 0x100, IORESOURCE_MEM, NULL);
+	add_generic_device("imx-gpio", 5, NULL, 0x10015500, 0x100, IORESOURCE_MEM, NULL);
+
+	return 0;
+}
+coredevice_initcall(imx21_init);
-- 
1.7.10.4


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

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

* Re: [PATCH 01/10] add gpiolib support
  2012-08-31  8:54 ` [PATCH 01/10] " Steffen Trumtrar
@ 2012-09-03  7:00   ` Sascha Hauer
  2012-09-03  7:03   ` Sascha Hauer
  1 sibling, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2012-09-03  7:00 UTC (permalink / raw)
  To: Steffen Trumtrar; +Cc: barebox

Hi Steffen,

On Fri, Aug 31, 2012 at 10:54:23AM +0200, Steffen Trumtrar wrote:
> diff --git a/include/gpio.h b/include/gpio.h
> index b7d8402..903fa06 100644
> --- a/include/gpio.h
> +++ b/include/gpio.h
> @@ -3,12 +3,28 @@
>  
>  #include <asm/gpio.h>
>  
> -static inline int gpio_request(unsigned gpio, const char *label)
> -{
> -	return 0;
> -}
> -
> -static inline void gpio_free(unsigned gpio)
> -{
> -}

We have to keep these. They are used by some code.


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: [PATCH 03/10] ARM i.MX5: add imx-gpio devices
  2012-08-31  8:54 ` [PATCH 03/10] ARM i.MX5: add imx-gpio devices Steffen Trumtrar
@ 2012-09-03  7:01   ` Sascha Hauer
  0 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2012-09-03  7:01 UTC (permalink / raw)
  To: Steffen Trumtrar; +Cc: barebox

On Fri, Aug 31, 2012 at 10:54:25AM +0200, Steffen Trumtrar wrote:
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
>  arch/arm/mach-imx/imx51.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/imx51.c b/arch/arm/mach-imx/imx51.c
> index 53205a9..506a7d9 100644
> --- a/arch/arm/mach-imx/imx51.c
> +++ b/arch/arm/mach-imx/imx51.c
> @@ -89,6 +89,11 @@ static int imx51_init(void)
>  	add_generic_device("imx_iim", 0, NULL, MX51_IIM_BASE_ADDR, SZ_4K,
>  			IORESOURCE_MEM, NULL);
>  
> +	add_generic_device("imx-gpio", 0, NULL, 0x73f84000, 0x1000, IORESOURCE_MEM, NULL);
> +	add_generic_device("imx-gpio", 1, NULL, 0x73f88000, 0x1000, IORESOURCE_MEM, NULL);
> +	add_generic_device("imx-gpio", 2, NULL, 0x73f8c000, 0x1000, IORESOURCE_MEM, NULL);
> +	add_generic_device("imx-gpio", 3, NULL, 0x73f90000, 0x1000, IORESOURCE_MEM, NULL);

I am missing the removal of imx_gpio_base[] here. Also in the patches
for the other i.MXs

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: [PATCH 01/10] add gpiolib support
  2012-08-31  8:54 ` [PATCH 01/10] " Steffen Trumtrar
  2012-09-03  7:00   ` Sascha Hauer
@ 2012-09-03  7:03   ` Sascha Hauer
  1 sibling, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2012-09-03  7:03 UTC (permalink / raw)
  To: Steffen Trumtrar; +Cc: barebox

On Fri, Aug 31, 2012 at 10:54:23AM +0200, Steffen Trumtrar wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
>  drivers/Makefile      |    1 +
>  drivers/gpio/Makefile |    1 +
>  drivers/gpio/gpio.c   |  134 +++++++++++++++++++++++++++++++++++++++++++++++++
>  include/gpio.h        |   32 +++++++++---

Please add drivers/gpio/Kconfig with:

config GPIOLIB
	bool

Then you can add a 'select GPIOLIB' to the i.MXs already converted to
make this series bisectable.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

end of thread, other threads:[~2012-09-03  7:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-31  8:54 [PATCH 00/10] ARM i.MX: add gpiolib support Steffen Trumtrar
2012-08-31  8:54 ` [PATCH 01/10] " Steffen Trumtrar
2012-09-03  7:00   ` Sascha Hauer
2012-09-03  7:03   ` Sascha Hauer
2012-08-31  8:54 ` [PATCH 02/10] ARM i.MX: switch to " Steffen Trumtrar
2012-08-31  8:54 ` [PATCH 03/10] ARM i.MX5: add imx-gpio devices Steffen Trumtrar
2012-09-03  7:01   ` Sascha Hauer
2012-08-31  8:54 ` [PATCH 04/10] ARM i.MX6: " Steffen Trumtrar
2012-08-31  8:54 ` [PATCH 05/10] ARM i.MX53: " Steffen Trumtrar
2012-08-31  8:54 ` [PATCH 06/10] ARM i.MX35: " Steffen Trumtrar
2012-08-31  8:54 ` [PATCH 07/10] ARM i.MX27: " Steffen Trumtrar
2012-08-31  8:54 ` [PATCH 08/10] ARM i.MX25: " Steffen Trumtrar
2012-08-31  8:54 ` [PATCH 09/10] ARM i.MX1: " Steffen Trumtrar
2012-08-31  8:54 ` [PATCH 10/10] ARM i.MX21: " Steffen Trumtrar

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