2 * Copyright 2012 Freescale Semiconductor, Inc.
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
12 #ifndef __PINCTRL_MXS_H
13 #define __PINCTRL_MXS_H
15 #include <linux/platform_device.h>
16 #include <linux/pinctrl/pinctrl.h>
22 #define MXS_PINCTRL_PIN(pin) PINCTRL_PIN(pin, #pin)
23 #define PINID(bank, pin) ((bank) * 32 + (pin))
26 * pinmux-id bit field definitions
32 #define MUXID_TO_PINID(m) PINID((m) >> 12 & 0xf, (m) >> 4 & 0xff)
33 #define MUXID_TO_MUXSEL(m) ((m) & 0xf)
35 #define PINID_TO_BANK(p) ((p) >> 5)
36 #define PINID_TO_PIN(p) ((p) % 32)
39 * pin config bit field definitions
45 * MSB of each field is presence bit for the config.
47 #define PULL_PRESENT (1 << 6)
49 #define VOL_PRESENT (1 << 4)
51 #define MA_PRESENT (1 << 2)
53 #define CONFIG_TO_PULL(c) ((c) >> PULL_SHIFT & 0x1)
54 #define CONFIG_TO_VOL(c) ((c) >> VOL_SHIFT & 0x1)
55 #define CONFIG_TO_MA(c) ((c) >> MA_SHIFT & 0x3)
77 struct mxs_pinctrl_soc_data {
78 const struct mxs_regs *regs;
79 const struct pinctrl_pin_desc *pins;
81 struct mxs_function *functions;
83 struct mxs_group *groups;
87 int mxs_pinctrl_probe(struct platform_device *pdev,
88 struct mxs_pinctrl_soc_data *soc);
89 int mxs_pinctrl_remove(struct platform_device *pdev);
91 #endif /* __PINCTRL_MXS_H */