1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (c) 2010 Michael Sevakis
12 * i.MX31 IOMUXC helper routines
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.
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
22 ****************************************************************************/
25 #include "iomuxc-imx31.h"
28 /* Set the pin multiplexing configuration (functional, GPIO, etc.) */
29 void iomuxc_set_pin_mux(enum IMX31_IOMUXC_PINS pin
,
32 unsigned long index
= pin
/ 4;
33 unsigned int shift
= 8*(pin
% 4);
35 imx31_regmod32((unsigned long *)(IOMUXC_BASE_ADDR
+ 0xc) + index
,
36 mux
<< shift
, IOMUXC_MUX_MASK
<< shift
);
40 /* Set the pin pad configuration (keeper, drive strength, etc.) */
41 void iomuxc_set_pad_config(enum IMX31_IOMUXC_PINS pin
,
44 unsigned long padoffs
= pin
+ 2;
45 unsigned long index
= padoffs
/ 3;
46 unsigned int shift
= 10*(padoffs
% 3);
48 imx31_regmod32((unsigned long *)(IOMUXC_BASE_ADDR
+ 0x154) + index
,
49 config
<< shift
, IOMUXC_PAD_MASK
<< shift
);