i.MX: iomuxv3: Add low-level pad code to headers
Add a basic low-level pad configuration function that can be used to implement early boot pin configuration code as well as shared with various iomuxv3 and vf610 drivers. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
21921f7f41
commit
b2282c18a4
|
@ -16,6 +16,8 @@
|
|||
#ifndef __MACH_IOMUX_V3_H__
|
||||
#define __MACH_IOMUX_V3_H__
|
||||
|
||||
#include <io.h>
|
||||
|
||||
/*
|
||||
* build IOMUX_PAD structure
|
||||
*
|
||||
|
@ -104,6 +106,32 @@ typedef u64 iomux_v3_cfg_t;
|
|||
|
||||
#define IOMUX_CONFIG_SION (0x1 << 4)
|
||||
|
||||
#define SHARE_MUX_CONF_REG 0x1
|
||||
#define ZERO_OFFSET_VALID 0x2
|
||||
|
||||
static inline void iomux_v3_setup_pad(void __iomem *iomux, unsigned int flags,
|
||||
u32 mux_reg, u32 conf_reg, u32 input_reg,
|
||||
u32 mux_val, u32 conf_val, u32 input_val)
|
||||
{
|
||||
const bool mux_ok = !!mux_reg || (flags & ZERO_OFFSET_VALID);
|
||||
const bool conf_ok = !!conf_reg;
|
||||
const bool input_ok = !!input_reg;
|
||||
|
||||
if (flags & SHARE_MUX_CONF_REG) {
|
||||
mux_val |= conf_val;
|
||||
} else {
|
||||
if (conf_ok)
|
||||
writel(conf_val, iomux + conf_reg);
|
||||
}
|
||||
|
||||
if (mux_ok)
|
||||
writel(mux_val, iomux + mux_reg);
|
||||
|
||||
if (input_ok)
|
||||
writel(input_val, iomux + input_reg);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* setups a single pad in the iomuxer
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue