summaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-04-07 12:00:47 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2009-05-19 12:30:42 +0200
commit36581777756c25cf5a63de19d88d832f946602bb (patch)
tree5493f88e8e25dd11bb84094050270ce3bda9f646 /arch/arm
parentaec91d05374bd4a0babc0d6ad2e4e78252304cd0 (diff)
downloadbarebox-36581777756c25cf5a63de19d88d832f946602bb.tar.gz
barebox-36581777756c25cf5a63de19d88d832f946602bb.tar.xz
i.MX35: Add iomux support from kernel
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-imx/Makefile2
-rw-r--r--arch/arm/mach-imx/gpio-imx35.c27
-rw-r--r--arch/arm/mach-imx/iomux-v3.c58
3 files changed, 59 insertions, 28 deletions
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index c9bc8434bb..a4a2527d88 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -3,7 +3,7 @@ obj-$(CONFIG_ARCH_IMX1) += speed-imx1.o gpio.o
obj-$(CONFIG_ARCH_IMX21) += speed-imx21.o gpio.o imx21.o
obj-$(CONFIG_ARCH_IMX27) += speed-imx27.o gpio.o imx27.o
obj-$(CONFIG_ARCH_IMX31) += speed-imx31.o iomux-v2.o
-obj-$(CONFIG_ARCH_IMX35) += speed-imx35.o gpio-imx35.o
+obj-$(CONFIG_ARCH_IMX35) += speed-imx35.o iomux-v3.o
obj-$(CONFIG_IMX_CLKO) += clko.o
obj-y += speed.o
diff --git a/arch/arm/mach-imx/gpio-imx35.c b/arch/arm/mach-imx/gpio-imx35.c
deleted file mode 100644
index 89283fd7d5..0000000000
--- a/arch/arm/mach-imx/gpio-imx35.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * (C) 2007, Sascha Hauer <sha@pengutronix.de>
- *
- * 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 <common.h>
-#include <asm/io.h>
-#include <asm/arch/imx-regs.h>
-
-void imx_gpio_mode(unsigned long mode)
-{
- writel((mode >> 16) & 0xff, IMX_IOMUXC_BASE + (mode & 0xffff));
-}
diff --git a/arch/arm/mach-imx/iomux-v3.c b/arch/arm/mach-imx/iomux-v3.c
new file mode 100644
index 0000000000..3b9416e95f
--- /dev/null
+++ b/arch/arm/mach-imx/iomux-v3.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
+ * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH,
+ * <armlinux@phytec.de>
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/iomux-v3.h>
+#include <asm/arch/imx-regs.h>
+
+/*
+ * setups a single pin:
+ * - reserves the pin so that it is not claimed by another driver
+ * - setups the iomux according to the configuration
+ */
+int mxc_iomux_v3_setup_pad(struct pad_desc *pad)
+{
+ if (pad->mux_ctrl_ofs)
+ writel(pad->mux_mode, IMX_IOMUXC_BASE + pad->mux_ctrl_ofs);
+
+ if (pad->select_input_ofs)
+ writel(pad->select_input,
+ IMX_IOMUXC_BASE + pad->select_input_ofs);
+
+ if (!(pad->pad_ctrl & NO_PAD_CTRL))
+ writel(pad->pad_ctrl, IMX_IOMUXC_BASE + pad->pad_ctrl_ofs);
+ return 0;
+}
+EXPORT_SYMBOL(mxc_iomux_v3_setup_pad);
+
+int mxc_iomux_v3_setup_multiple_pads(struct pad_desc *pad_list, unsigned count)
+{
+ struct pad_desc *p = pad_list;
+ int i;
+
+ for (i = 0; i < count; i++) {
+ mxc_iomux_v3_setup_pad(p);
+ p++;
+ }
+ return 0;
+}
+EXPORT_SYMBOL(mxc_iomux_v3_setup_multiple_pads);
+