1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved.
4 * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
5 * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH,
8 #include <linux/errno.h>
9 #include <linux/init.h>
10 #include <linux/kernel.h>
11 #include <linux/module.h>
12 #include <linux/string.h>
13 #include <linux/gpio.h>
15 #include <asm/mach/map.h>
20 static void __iomem
*base
;
23 * configures a single pad in the iomuxer
25 int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t pad
)
27 u32 mux_ctrl_ofs
= (pad
& MUX_CTRL_OFS_MASK
) >> MUX_CTRL_OFS_SHIFT
;
28 u32 mux_mode
= (pad
& MUX_MODE_MASK
) >> MUX_MODE_SHIFT
;
29 u32 sel_input_ofs
= (pad
& MUX_SEL_INPUT_OFS_MASK
) >> MUX_SEL_INPUT_OFS_SHIFT
;
30 u32 sel_input
= (pad
& MUX_SEL_INPUT_MASK
) >> MUX_SEL_INPUT_SHIFT
;
31 u32 pad_ctrl_ofs
= (pad
& MUX_PAD_CTRL_OFS_MASK
) >> MUX_PAD_CTRL_OFS_SHIFT
;
32 u32 pad_ctrl
= (pad
& MUX_PAD_CTRL_MASK
) >> MUX_PAD_CTRL_SHIFT
;
35 imx_writel(mux_mode
, base
+ mux_ctrl_ofs
);
38 imx_writel(sel_input
, base
+ sel_input_ofs
);
40 if (!(pad_ctrl
& NO_PAD_CTRL
) && pad_ctrl_ofs
)
41 imx_writel(pad_ctrl
, base
+ pad_ctrl_ofs
);
46 int mxc_iomux_v3_setup_multiple_pads(const iomux_v3_cfg_t
*pad_list
,
49 const iomux_v3_cfg_t
*p
= pad_list
;
53 for (i
= 0; i
< count
; i
++) {
54 ret
= mxc_iomux_v3_setup_pad(*p
);
62 void mxc_iomux_v3_init(void __iomem
*iomux_v3_base
)