diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-06 19:50:35 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-06 19:50:35 -0500 |
commit | 3c0cb7c31c206aaedb967e44b98442bbeb17a6c4 (patch) | |
tree | 3ecba45d7ffae4fba4a5aafaef4af5b0b1105bde /arch/arm/mach-mxs/iomux.c | |
parent | f70f5b9dc74ca7d0a64c4ead3fb28da09dc1b234 (diff) | |
parent | 404a02cbd2ae8bf256a2fa1169bdfe86bb5ebb34 (diff) |
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (416 commits)
ARM: DMA: add support for DMA debugging
ARM: PL011: add DMA burst threshold support for ST variants
ARM: PL011: Add support for transmit DMA
ARM: PL011: Ensure IRQs are disabled in UART interrupt handler
ARM: PL011: Separate hardware FIFO size from TTY FIFO size
ARM: PL011: Allow better handling of vendor data
ARM: PL011: Ensure error flags are clear at startup
ARM: PL011: include revision number in boot-time port printk
ARM: vexpress: add sched_clock() for Versatile Express
ARM i.MX53: Make MX53 EVK bootable
ARM i.MX53: Some bug fix about MX53 MSL code
ARM: 6607/1: sa1100: Update platform device registration
ARM: 6606/1: sa1100: Fix platform device registration
ARM i.MX51: rename IPU irqs
ARM i.MX51: Add ipu clock support
ARM: imx/mx27_3ds: Add PMIC support
ARM: DMA: Replace page_to_dma()/dma_to_page() with pfn_to_dma()/dma_to_pfn()
mx51: fix usb clock support
MX51: Add support for usb host 2
arch/arm/plat-mxc/ehci.c: fix errors/typos
...
Diffstat (limited to 'arch/arm/mach-mxs/iomux.c')
-rw-r--r-- | arch/arm/mach-mxs/iomux.c | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/arch/arm/mach-mxs/iomux.c b/arch/arm/mach-mxs/iomux.c new file mode 100644 index 000000000000..0e804e2f11f4 --- /dev/null +++ b/arch/arm/mach-mxs/iomux.c | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * Copyright 2004-2006,2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de> | ||
4 | * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH, | ||
5 | * <armlinux@phytec.de> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version 2 | ||
10 | * of the License, or (at your option) any later version. | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
19 | * MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | #include <linux/errno.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/string.h> | ||
27 | #include <linux/gpio.h> | ||
28 | |||
29 | #include <asm/mach/map.h> | ||
30 | |||
31 | #include <mach/mxs.h> | ||
32 | #include <mach/iomux.h> | ||
33 | |||
34 | /* | ||
35 | * configures a single pad in the iomuxer | ||
36 | */ | ||
37 | int mxs_iomux_setup_pad(iomux_cfg_t pad) | ||
38 | { | ||
39 | u32 reg, ofs, bp, bm; | ||
40 | void __iomem *iomux_base = MXS_IO_ADDRESS(MXS_PINCTRL_BASE_ADDR); | ||
41 | |||
42 | /* muxsel */ | ||
43 | ofs = 0x100; | ||
44 | ofs += PAD_BANK(pad) * 0x20 + PAD_PIN(pad) / 16 * 0x10; | ||
45 | bp = PAD_PIN(pad) % 16 * 2; | ||
46 | bm = 0x3 << bp; | ||
47 | reg = __raw_readl(iomux_base + ofs); | ||
48 | reg &= ~bm; | ||
49 | reg |= PAD_MUXSEL(pad) << bp; | ||
50 | __raw_writel(reg, iomux_base + ofs); | ||
51 | |||
52 | /* drive */ | ||
53 | ofs = cpu_is_mx23() ? 0x200 : 0x300; | ||
54 | ofs += PAD_BANK(pad) * 0x40 + PAD_PIN(pad) / 8 * 0x10; | ||
55 | /* mA */ | ||
56 | if (PAD_MA_VALID(pad)) { | ||
57 | bp = PAD_PIN(pad) % 8 * 4; | ||
58 | bm = 0x3 << bp; | ||
59 | reg = __raw_readl(iomux_base + ofs); | ||
60 | reg &= ~bm; | ||
61 | reg |= PAD_MA(pad) << bp; | ||
62 | __raw_writel(reg, iomux_base + ofs); | ||
63 | } | ||
64 | /* vol */ | ||
65 | if (PAD_VOL_VALID(pad)) { | ||
66 | bp = PAD_PIN(pad) % 8 * 4 + 2; | ||
67 | if (PAD_VOL(pad)) | ||
68 | __mxs_setl(1 << bp, iomux_base + ofs); | ||
69 | else | ||
70 | __mxs_clrl(1 << bp, iomux_base + ofs); | ||
71 | } | ||
72 | |||
73 | /* pull */ | ||
74 | if (PAD_PULL_VALID(pad)) { | ||
75 | ofs = cpu_is_mx23() ? 0x400 : 0x600; | ||
76 | ofs += PAD_BANK(pad) * 0x10; | ||
77 | bp = PAD_PIN(pad); | ||
78 | if (PAD_PULL(pad)) | ||
79 | __mxs_setl(1 << bp, iomux_base + ofs); | ||
80 | else | ||
81 | __mxs_clrl(1 << bp, iomux_base + ofs); | ||
82 | } | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | int mxs_iomux_setup_multiple_pads(const iomux_cfg_t *pad_list, unsigned count) | ||
88 | { | ||
89 | const iomux_cfg_t *p = pad_list; | ||
90 | int i; | ||
91 | int ret; | ||
92 | |||
93 | for (i = 0; i < count; i++) { | ||
94 | ret = mxs_iomux_setup_pad(*p); | ||
95 | if (ret) | ||
96 | return ret; | ||
97 | p++; | ||
98 | } | ||
99 | |||
100 | return 0; | ||
101 | } | ||