summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx31/iomuxc-imx31.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2010-04-23 13:46:04 +0000
committerMichael Sevakis <jethead71@rockbox.org>2010-04-23 13:46:04 +0000
commit6cee7579dbdc4d41c4df08c9395cf96c952ebab1 (patch)
treecd62801c3dc65be5923aa156ef9d5c2726629664 /firmware/target/arm/imx31/iomuxc-imx31.c
parent57dc493db55ec9388e3e3a3eb848fffccb07b301 (diff)
downloadrockbox-6cee7579dbdc4d41c4df08c9395cf96c952ebab1.tar.gz
rockbox-6cee7579dbdc4d41c4df08c9395cf96c952ebab1.zip
i.MX31: Add some enums and a couple helper functions to make dealing with pin muxing and pad configuration a bit more sane. Convert any existing code which changes mux/pad settings to use helpers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25698 a1c6a512-1295-4272-9138-f99709370657
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}