[PATCH] mx2 GPIO OCRx register
Teresa Gamez
T.Gamez at phytec.de
Tue Jun 8 06:03:02 EDT 2010
The GPIO OCRx register has to be set correct or the output is not set as expected.
Signed-off-by: Teresa Gámez <T.Gamez at phytec.de>
---
Index: barebox-2010.06.0/arch/arm/mach-imx/gpio.c
===================================================================
--- barebox-2010.06.0/arch/arm/mach-imx/gpio.c 2010-06-02 10:36:28.000000000 +0200
+++ barebox-2010.06.0/arch/arm/mach-imx/gpio.c 2010-06-08 11:02:31.282473877 +0200
@@ -31,6 +31,8 @@
#if defined CONFIG_ARCH_IMX1 || defined CONFIG_ARCH_IMX21 || defined CONFIG_ARCH_IMX27
#define GPIO_DR 0x1c
#define GPIO_GDIR 0x00
+#define GPIO_OCR1 0x04
+#define GPIO_OCR2 0x08
#define GPIO_PSR 0x24
#define GPIO_ICR1 0x28
#define GPIO_ICR2 0x2C
@@ -103,6 +105,18 @@
if (!base)
return -EINVAL;
+#if defined GPIO_OCR1 && defined GPIO_OCR2
+ if (shift < 16) {
+ val = readl(base + GPIO_OCR1);
+ val |= (3 << (shift * 2));
+ writel(val, base + GPIO_OCR1);
+ } else {
+ val = readl(base + GPIO_OCR2);
+ val |= (3 << ((shift - 16) * 2));
+ writel(val, base + GPIO_OCR2);
+ }
+#endif
+
gpio_set_value(gpio, value);
val = readl(base + GPIO_GDIR);
More information about the barebox
mailing list