arm/imx/iomux-v1: rename source file and reorganize Kconfig stuff
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 15 Feb 2010 08:42:59 +0000 (09:42 +0100)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 24 Feb 2010 09:07:08 +0000 (10:07 +0100)
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
arch/arm/plat-mxc/Kconfig
arch/arm/plat-mxc/Makefile
arch/arm/plat-mxc/iomux-mx1-mx2.c [deleted file]
arch/arm/plat-mxc/iomux-v1.c [new file with mode: 0644]

index 9c8d4e70c1767e9b22cd793e6b09b1d916ffa289..6debae2c798db2fcb8279ebfa0e981698ba4b5ea 100644 (file)
@@ -9,12 +9,14 @@ choice
 config ARCH_MX1
        bool "MX1-based"
        select CPU_ARM920T
+       select IMX_HAVE_IOMUX_V1
        help
          This enables support for systems based on the Freescale i.MX1 family
 
 config ARCH_MX2
        bool "MX2-based"
        select CPU_ARM926T
+       select IMX_HAVE_IOMUX_V1
        help
          This enables support for systems based on the Freescale i.MX2 family
 
@@ -68,6 +70,9 @@ config MXC_ULPI
 config ARCH_HAS_RNGA
        bool
 
+config IMX_HAVE_IOMUX_V1
+       bool
+
 config ARCH_MXC_IOMUX_V3
        bool
 
index 4074c1847b43d04379f5c62f14eb418ad3405619..41d31762bca460661da85e8085620c1599922b43 100644 (file)
@@ -5,9 +5,10 @@
 # Common support
 obj-y := irq.o clock.o gpio.o time.o devices.o cpu.o system.o
 
-obj-$(CONFIG_ARCH_MX1) += iomux-mx1-mx2.o dma-mx1-mx2.o
-obj-$(CONFIG_ARCH_MX2) += iomux-mx1-mx2.o dma-mx1-mx2.o
-CFLAGS_iomux-mx1-mx2.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS
+obj-$(CONFIG_ARCH_MX1) += dma-mx1-mx2.o
+obj-$(CONFIG_ARCH_MX2) += dma-mx1-mx2.o
+obj-$(CONFIG_IMX_HAVE_IOMUX_V1) += iomux-v1.o
+CFLAGS_iomux-v1.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS
 obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o
 obj-$(CONFIG_MXC_PWM)  += pwm.o
 obj-$(CONFIG_USB_EHCI_MXC) += ehci.o
diff --git a/arch/arm/plat-mxc/iomux-mx1-mx2.c b/arch/arm/plat-mxc/iomux-mx1-mx2.c
deleted file mode 100644 (file)
index a37163c..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *  arch/arm/mach-mxc/generic.c
- *
- *  author: Sascha Hauer
- *  Created: april 20th, 2004
- *  Copyright: Synertronixx GmbH
- *
- *  Common code for i.MX machines
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- */
-
-#include <linux/errno.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/string.h>
-#include <linux/gpio.h>
-
-#include <mach/hardware.h>
-#include <asm/mach/map.h>
-#include <mach/iomux.h>
-
-void mxc_gpio_mode(int gpio_mode)
-{
-       unsigned int pin = gpio_mode & GPIO_PIN_MASK;
-       unsigned int port = (gpio_mode & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
-       unsigned int ocr = (gpio_mode & GPIO_OCR_MASK) >> GPIO_OCR_SHIFT;
-       unsigned int tmp;
-
-       /* Pullup enable */
-       tmp = __raw_readl(VA_GPIO_BASE + MXC_PUEN(port));
-       if (gpio_mode & GPIO_PUEN)
-               tmp |= (1 << pin);
-       else
-               tmp &= ~(1 << pin);
-       __raw_writel(tmp, VA_GPIO_BASE + MXC_PUEN(port));
-
-       /* Data direction */
-       tmp = __raw_readl(VA_GPIO_BASE + MXC_DDIR(port));
-       if (gpio_mode & GPIO_OUT)
-               tmp |= 1 << pin;
-       else
-               tmp &= ~(1 << pin);
-       __raw_writel(tmp, VA_GPIO_BASE + MXC_DDIR(port));
-
-       /* Primary / alternate function */
-       tmp = __raw_readl(VA_GPIO_BASE + MXC_GPR(port));
-       if (gpio_mode & GPIO_AF)
-               tmp |= (1 << pin);
-       else
-               tmp &= ~(1 << pin);
-       __raw_writel(tmp, VA_GPIO_BASE + MXC_GPR(port));
-
-       /* use as gpio? */
-       tmp = __raw_readl(VA_GPIO_BASE + MXC_GIUS(port));
-       if (gpio_mode & (GPIO_PF | GPIO_AF))
-               tmp &= ~(1 << pin);
-       else
-               tmp |= (1 << pin);
-       __raw_writel(tmp, VA_GPIO_BASE + MXC_GIUS(port));
-
-       if (pin < 16) {
-               tmp = __raw_readl(VA_GPIO_BASE + MXC_OCR1(port));
-               tmp &= ~(3 << (pin * 2));
-               tmp |= (ocr << (pin * 2));
-               __raw_writel(tmp, VA_GPIO_BASE + MXC_OCR1(port));
-
-               tmp = __raw_readl(VA_GPIO_BASE + MXC_ICONFA1(port));
-               tmp &= ~(3 << (pin * 2));
-               tmp |= ((gpio_mode >> GPIO_AOUT_SHIFT) & 3) << (pin * 2);
-               __raw_writel(tmp, VA_GPIO_BASE + MXC_ICONFA1(port));
-
-               tmp = __raw_readl(VA_GPIO_BASE + MXC_ICONFB1(port));
-               tmp &= ~(3 << (pin * 2));
-               tmp |= ((gpio_mode >> GPIO_BOUT_SHIFT) & 3) << (pin * 2);
-               __raw_writel(tmp, VA_GPIO_BASE + MXC_ICONFB1(port));
-       } else {
-               pin -= 16;
-
-               tmp = __raw_readl(VA_GPIO_BASE + MXC_OCR2(port));
-               tmp &= ~(3 << (pin * 2));
-               tmp |= (ocr << (pin * 2));
-               __raw_writel(tmp, VA_GPIO_BASE + MXC_OCR2(port));
-
-               tmp = __raw_readl(VA_GPIO_BASE + MXC_ICONFA2(port));
-               tmp &= ~(3 << (pin * 2));
-               tmp |= ((gpio_mode >> GPIO_AOUT_SHIFT) & 3) << (pin * 2);
-               __raw_writel(tmp, VA_GPIO_BASE + MXC_ICONFA2(port));
-
-               tmp = __raw_readl(VA_GPIO_BASE + MXC_ICONFB2(port));
-               tmp &= ~(3 << (pin * 2));
-               tmp |= ((gpio_mode >> GPIO_BOUT_SHIFT) & 3) << (pin * 2);
-               __raw_writel(tmp, VA_GPIO_BASE + MXC_ICONFB2(port));
-       }
-}
-EXPORT_SYMBOL(mxc_gpio_mode);
-
-int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
-               const char *label)
-{
-       const int *p = pin_list;
-       int i;
-       unsigned gpio;
-       unsigned mode;
-       int ret = -EINVAL;
-
-       for (i = 0; i < count; i++) {
-               gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK);
-               mode = *p & ~(GPIO_PIN_MASK | GPIO_PORT_MASK);
-
-               if (gpio >= (GPIO_PORT_MAX + 1) * 32)
-                       goto setup_error;
-
-               ret = gpio_request(gpio, label);
-               if (ret)
-                       goto setup_error;
-
-               mxc_gpio_mode(gpio | mode);
-
-               p++;
-       }
-       return 0;
-
-setup_error:
-       mxc_gpio_release_multiple_pins(pin_list, i);
-       return ret;
-}
-EXPORT_SYMBOL(mxc_gpio_setup_multiple_pins);
-
-void mxc_gpio_release_multiple_pins(const int *pin_list, int count)
-{
-       const int *p = pin_list;
-       int i;
-
-       for (i = 0; i < count; i++) {
-               unsigned gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK);
-               gpio_free(gpio);
-               p++;
-       }
-
-}
-EXPORT_SYMBOL(mxc_gpio_release_multiple_pins);
-
diff --git a/arch/arm/plat-mxc/iomux-v1.c b/arch/arm/plat-mxc/iomux-v1.c
new file mode 100644 (file)
index 0000000..0b74568
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * arch/arm/plat-mxc/iomux-v1.c
+ *
+ * author: Sascha Hauer
+ * Created: april 20th, 2004
+ * Copyright: Synertronixx GmbH
+ *
+ * Common code for i.MX1, i.MX21 and i.MX27
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/string.h>
+#include <linux/gpio.h>
+
+#include <mach/hardware.h>
+#include <asm/mach/map.h>
+#include <mach/iomux.h>
+
+void mxc_gpio_mode(int gpio_mode)
+{
+       unsigned int pin = gpio_mode & GPIO_PIN_MASK;
+       unsigned int port = (gpio_mode & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
+       unsigned int ocr = (gpio_mode & GPIO_OCR_MASK) >> GPIO_OCR_SHIFT;
+       unsigned int tmp;
+
+       /* Pullup enable */
+       tmp = __raw_readl(VA_GPIO_BASE + MXC_PUEN(port));
+       if (gpio_mode & GPIO_PUEN)
+               tmp |= (1 << pin);
+       else
+               tmp &= ~(1 << pin);
+       __raw_writel(tmp, VA_GPIO_BASE + MXC_PUEN(port));
+
+       /* Data direction */
+       tmp = __raw_readl(VA_GPIO_BASE + MXC_DDIR(port));
+       if (gpio_mode & GPIO_OUT)
+               tmp |= 1 << pin;
+       else
+               tmp &= ~(1 << pin);
+       __raw_writel(tmp, VA_GPIO_BASE + MXC_DDIR(port));
+
+       /* Primary / alternate function */
+       tmp = __raw_readl(VA_GPIO_BASE + MXC_GPR(port));
+       if (gpio_mode & GPIO_AF)
+               tmp |= (1 << pin);
+       else
+               tmp &= ~(1 << pin);
+       __raw_writel(tmp, VA_GPIO_BASE + MXC_GPR(port));
+
+       /* use as gpio? */
+       tmp = __raw_readl(VA_GPIO_BASE + MXC_GIUS(port));
+       if (gpio_mode & (GPIO_PF | GPIO_AF))
+               tmp &= ~(1 << pin);
+       else
+               tmp |= (1 << pin);
+       __raw_writel(tmp, VA_GPIO_BASE + MXC_GIUS(port));
+
+       if (pin < 16) {
+               tmp = __raw_readl(VA_GPIO_BASE + MXC_OCR1(port));
+               tmp &= ~(3 << (pin * 2));
+               tmp |= (ocr << (pin * 2));
+               __raw_writel(tmp, VA_GPIO_BASE + MXC_OCR1(port));
+
+               tmp = __raw_readl(VA_GPIO_BASE + MXC_ICONFA1(port));
+               tmp &= ~(3 << (pin * 2));
+               tmp |= ((gpio_mode >> GPIO_AOUT_SHIFT) & 3) << (pin * 2);
+               __raw_writel(tmp, VA_GPIO_BASE + MXC_ICONFA1(port));
+
+               tmp = __raw_readl(VA_GPIO_BASE + MXC_ICONFB1(port));
+               tmp &= ~(3 << (pin * 2));
+               tmp |= ((gpio_mode >> GPIO_BOUT_SHIFT) & 3) << (pin * 2);
+               __raw_writel(tmp, VA_GPIO_BASE + MXC_ICONFB1(port));
+       } else {
+               pin -= 16;
+
+               tmp = __raw_readl(VA_GPIO_BASE + MXC_OCR2(port));
+               tmp &= ~(3 << (pin * 2));
+               tmp |= (ocr << (pin * 2));
+               __raw_writel(tmp, VA_GPIO_BASE + MXC_OCR2(port));
+
+               tmp = __raw_readl(VA_GPIO_BASE + MXC_ICONFA2(port));
+               tmp &= ~(3 << (pin * 2));
+               tmp |= ((gpio_mode >> GPIO_AOUT_SHIFT) & 3) << (pin * 2);
+               __raw_writel(tmp, VA_GPIO_BASE + MXC_ICONFA2(port));
+
+               tmp = __raw_readl(VA_GPIO_BASE + MXC_ICONFB2(port));
+               tmp &= ~(3 << (pin * 2));
+               tmp |= ((gpio_mode >> GPIO_BOUT_SHIFT) & 3) << (pin * 2);
+               __raw_writel(tmp, VA_GPIO_BASE + MXC_ICONFB2(port));
+       }
+}
+EXPORT_SYMBOL(mxc_gpio_mode);
+
+int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
+               const char *label)
+{
+       const int *p = pin_list;
+       int i;
+       unsigned gpio;
+       unsigned mode;
+       int ret = -EINVAL;
+
+       for (i = 0; i < count; i++) {
+               gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK);
+               mode = *p & ~(GPIO_PIN_MASK | GPIO_PORT_MASK);
+
+               if (gpio >= (GPIO_PORT_MAX + 1) * 32)
+                       goto setup_error;
+
+               ret = gpio_request(gpio, label);
+               if (ret)
+                       goto setup_error;
+
+               mxc_gpio_mode(gpio | mode);
+
+               p++;
+       }
+       return 0;
+
+setup_error:
+       mxc_gpio_release_multiple_pins(pin_list, i);
+       return ret;
+}
+EXPORT_SYMBOL(mxc_gpio_setup_multiple_pins);
+
+void mxc_gpio_release_multiple_pins(const int *pin_list, int count)
+{
+       const int *p = pin_list;
+       int i;
+
+       for (i = 0; i < count; i++) {
+               unsigned gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK);
+               gpio_free(gpio);
+               p++;
+       }
+
+}
+EXPORT_SYMBOL(mxc_gpio_release_multiple_pins);
This page took 0.069054 seconds and 5 git commands to generate.