1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * IMX pinmux core definitions
5 * Copyright (C) 2012 Freescale Semiconductor, Inc.
6 * Copyright (C) 2012 Linaro Ltd.
8 * Author: Dong Aisheng <dong.aisheng@linaro.org>
11 #ifndef __DRIVERS_PINCTRL_IMX_H
12 #define __DRIVERS_PINCTRL_IMX_H
14 #include <linux/pinctrl/pinconf-generic.h>
15 #include <linux/pinctrl/pinmux.h>
17 struct platform_device
;
19 extern struct pinmux_ops imx_pmx_ops
;
22 * struct imx_pin - describes a single i.MX pin
23 * @pin: the pin_id of this pin
24 * @mux_mode: the mux mode for this pin.
25 * @input_reg: the select input register offset for this pin if any
26 * 0 if no select input setting needed.
27 * @input_val: the select input value for this pin.
28 * @configs: the config for this pin.
32 unsigned int mux_mode
;
34 unsigned int input_val
;
39 * struct imx_pin_reg - describe a pin reg map
40 * @mux_reg: mux register offset
41 * @conf_reg: config register offset
48 /* decode a generic config into raw register value */
49 struct imx_cfg_params_decode
{
50 enum pin_config_param param
;
56 struct imx_pinctrl_soc_info
{
57 const struct pinctrl_pin_desc
*pins
;
60 const char *gpr_compatible
;
62 /* MUX_MODE shift and mask in case SHARE_MUX_CONF_REG */
63 unsigned int mux_mask
;
68 const struct pinconf_generic_params
*custom_params
;
69 unsigned int num_custom_params
;
70 const struct imx_cfg_params_decode
*decodes
;
71 unsigned int num_decodes
;
72 void (*fixup
)(unsigned long *configs
, unsigned int num_configs
,
75 int (*gpio_set_direction
)(struct pinctrl_dev
*pctldev
,
76 struct pinctrl_gpio_range
*range
,
82 * @dev: a pointer back to containing device
83 * @base: the offset to the controller in virtual memory
87 struct pinctrl_dev
*pctl
;
89 void __iomem
*input_sel_base
;
90 const struct imx_pinctrl_soc_info
*info
;
91 struct imx_pin_reg
*pin_regs
;
92 unsigned int group_index
;
96 #define IMX_CFG_PARAMS_DECODE(p, m, o) \
97 { .param = p, .mask = m, .shift = o, .invert = false, }
99 #define IMX_CFG_PARAMS_DECODE_INVERT(p, m, o) \
100 { .param = p, .mask = m, .shift = o, .invert = true, }
102 #define SHARE_MUX_CONF_REG 0x1
103 #define ZERO_OFFSET_VALID 0x2
108 #define IMX_PINCTRL_PIN(pin) PINCTRL_PIN(pin, #pin)
110 #define PAD_CTL_MASK(len) ((1 << len) - 1)
111 #define IMX_MUX_MASK 0x7
112 #define IOMUXC_CONFIG_SION (0x1 << 4)
114 int imx_pinctrl_probe(struct platform_device
*pdev
,
115 const struct imx_pinctrl_soc_info
*info
);
116 #endif /* __DRIVERS_PINCTRL_IMX_H */