1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright 2012 Freescale Semiconductor, Inc.
6 #ifndef __PINCTRL_MXS_H
7 #define __PINCTRL_MXS_H
9 #include <linux/platform_device.h>
10 #include <linux/pinctrl/pinctrl.h>
16 #define MXS_PINCTRL_PIN(pin) PINCTRL_PIN(pin, #pin)
17 #define PINID(bank, pin) ((bank) * 32 + (pin))
20 * pinmux-id bit field definitions
26 #define MUXID_TO_PINID(m) PINID((m) >> 12 & 0xf, (m) >> 4 & 0xff)
27 #define MUXID_TO_MUXSEL(m) ((m) & 0xf)
29 #define PINID_TO_BANK(p) ((p) >> 5)
30 #define PINID_TO_PIN(p) ((p) % 32)
33 * pin config bit field definitions
39 * MSB of each field is presence bit for the config.
41 #define PULL_PRESENT (1 << 6)
43 #define VOL_PRESENT (1 << 4)
45 #define MA_PRESENT (1 << 2)
47 #define CONFIG_TO_PULL(c) ((c) >> PULL_SHIFT & 0x1)
48 #define CONFIG_TO_VOL(c) ((c) >> VOL_SHIFT & 0x1)
49 #define CONFIG_TO_MA(c) ((c) >> MA_SHIFT & 0x3)
71 struct mxs_pinctrl_soc_data
{
72 const struct mxs_regs
*regs
;
73 const struct pinctrl_pin_desc
*pins
;
75 struct mxs_function
*functions
;
77 struct mxs_group
*groups
;
81 int mxs_pinctrl_probe(struct platform_device
*pdev
,
82 struct mxs_pinctrl_soc_data
*soc
);
84 #endif /* __PINCTRL_MXS_H */