summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx31/iomuxc-imx31.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/imx31/iomuxc-imx31.c')
-rw-r--r--firmware/target/arm/imx31/iomuxc-imx31.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/firmware/target/arm/imx31/iomuxc-imx31.c b/firmware/target/arm/imx31/iomuxc-imx31.c
new file mode 100644
index 0000000000..876b8b2a9c
--- /dev/null
+++ b/firmware/target/arm/imx31/iomuxc-imx31.c
@@ -0,0 +1,50 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (c) 2010 Michael Sevakis
11 *
12 * i.MX31 IOMUXC helper routines
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 ****************************************************************************/
23#include "config.h"
24#include "system.h"
25#include "iomuxc-imx31.h"
26
27
28/* Set the pin multiplexing configuration (functional, GPIO, etc.) */
29void iomuxc_set_pin_mux(enum IMX31_IOMUXC_PINS pin,
30 unsigned long mux)
31{
32 unsigned long index = pin / 4;
33 unsigned int shift = 8*(pin % 4);
34
35 imx31_regmod32((unsigned long *)(IOMUXC_BASE_ADDR + 0xc) + index,
36 mux << shift, IOMUXC_MUX_MASK << shift);
37}
38
39
40/* Set the pin pad configuration (keeper, drive strength, etc.) */
41void iomuxc_set_pad_config(enum IMX31_IOMUXC_PINS pin,
42 unsigned long config)
43{
44 unsigned long padoffs = pin + 2;
45 unsigned long index = padoffs / 3;
46 unsigned int shift = 10*(padoffs % 3);
47
48 imx31_regmod32((unsigned long *)(IOMUXC_BASE_ADDR + 0x154) + index,
49 config << shift, IOMUXC_PAD_MASK << shift);
50}