mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Juergen Beisert <jbe@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/6] i.MX23: Add support for the gpio commands
Date: Mon, 22 Nov 2010 13:24:22 +0100	[thread overview]
Message-ID: <1290428665-23561-4-git-send-email-jbe@pengutronix.de> (raw)
In-Reply-To: <1290428665-23561-1-git-send-email-jbe@pengutronix.de>

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

diff --git a/arch/arm/mach-stm/iomux-imx23.c b/arch/arm/mach-stm/iomux-imx23.c
index 55e7798..88e0218 100644
--- a/arch/arm/mach-stm/iomux-imx23.c
+++ b/arch/arm/mach-stm/iomux-imx23.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>
 
@@ -124,3 +125,40 @@ void imx_gpio_mode(uint32_t m)
 		}
 	}
 }
+
+void gpio_set_value(unsigned gpio, int val)
+{
+	unsigned reg_offset;
+
+	reg_offset = calc_output_reg(gpio);
+	pr_debug("%u: Accessing %X+%X with value %X\n", gpio, IMX_IOMUXC_BASE,
+		reg_offset, 0x1 << (gpio % 32));
+	writel(0x1 << (gpio % 32),
+		IMX_IOMUXC_BASE + reg_offset + (val != 0 ? 4 : 8));
+}
+
+int gpio_direction_input(unsigned gpio)
+{
+	pr_err("Not yet supported\n");
+	return -EINVAL;
+}
+
+int gpio_direction_output(unsigned gpio, int val)
+{
+	pr_err("Not yet supported\n");
+	return -EINVAL;
+}
+
+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);
+	pr_debug("%u: Accessing %X+%X with value %X->%X\n", gpio, IMX_IOMUXC_BASE,
+		reg_offset, 0x1 << (gpio % 32), reg & (0x1 << (gpio % 32)));
+	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

  parent reply	other threads:[~2010-11-22 12:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-22 12:24 [PATCH] i.MX23/STM: Continue improving this architecture Juergen Beisert
2010-11-22 12:24 ` [PATCH 1/6] Remove variable size restrictions in i.MX23's gpio managing routines Juergen Beisert
2010-11-22 12:24 ` [PATCH 2/6] Simplify test for the max. possible GPIO number Juergen Beisert
2010-11-22 12:24 ` Juergen Beisert [this message]
2010-11-22 12:24 ` [PATCH 4/6] i.MX23: Add pixel clock calculation routine for framebuffer support Juergen Beisert
2010-11-22 12:24 ` [PATCH 5/6] i.MX23: Add framebuffer device support Juergen Beisert
2010-11-22 12:24 ` [PATCH 6/6] Separate i.MX23 clock handling Juergen Beisert
2010-11-22 12:27 ` [PATCH] i.MX23/STM: Continue improving this architecture Juergen Beisert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1290428665-23561-4-git-send-email-jbe@pengutronix.de \
    --to=jbe@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox