WIP FPC-III support
[linux/fpc-iii.git] / drivers / pinctrl / freescale / pinctrl-mxs.h
blobab9f834b03e6bfd37e16888f4857332ad7a465ab
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3 * Copyright 2012 Freescale Semiconductor, Inc.
4 */
6 #ifndef __PINCTRL_MXS_H
7 #define __PINCTRL_MXS_H
9 #include <linux/platform_device.h>
10 #include <linux/pinctrl/pinctrl.h>
12 #define SET 0x4
13 #define CLR 0x8
14 #define TOG 0xc
16 #define MXS_PINCTRL_PIN(pin) PINCTRL_PIN(pin, #pin)
17 #define PINID(bank, pin) ((bank) * 32 + (pin))
20 * pinmux-id bit field definitions
22 * bank: 15..12 (4)
23 * pin: 11..4 (8)
24 * muxsel: 3..0 (4)
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
35 * pull-up: 6..5 (2)
36 * voltage: 4..3 (2)
37 * mA: 2..0 (3)
39 * MSB of each field is presence bit for the config.
41 #define PULL_PRESENT (1 << 6)
42 #define PULL_SHIFT 5
43 #define VOL_PRESENT (1 << 4)
44 #define VOL_SHIFT 3
45 #define MA_PRESENT (1 << 2)
46 #define MA_SHIFT 0
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)
51 struct mxs_function {
52 const char *name;
53 const char **groups;
54 unsigned ngroups;
57 struct mxs_group {
58 const char *name;
59 unsigned int *pins;
60 unsigned npins;
61 u8 *muxsel;
62 u8 config;
65 struct mxs_regs {
66 u16 muxsel;
67 u16 drive;
68 u16 pull;
71 struct mxs_pinctrl_soc_data {
72 const struct mxs_regs *regs;
73 const struct pinctrl_pin_desc *pins;
74 unsigned npins;
75 struct mxs_function *functions;
76 unsigned nfunctions;
77 struct mxs_group *groups;
78 unsigned ngroups;
81 int mxs_pinctrl_probe(struct platform_device *pdev,
82 struct mxs_pinctrl_soc_data *soc);
84 #endif /* __PINCTRL_MXS_H */