Linux 4.16.11
[linux/fpc-iii.git] / drivers / pinctrl / pxa / pinctrl-pxa2xx.h
blob8be1e0b797513d1268f4c9d789e06362c75c890a
1 /*
2 * Marvell PXA2xx family pin control
4 * Copyright (C) 2015 Robert Jarzmik
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
12 #ifndef __PINCTRL_PXA_H
13 #define __PINCTRL_PXA_H
15 #define PXA_FUNCTION(_dir, _af, _name) \
16 { \
17 .name = _name, \
18 .muxval = (_dir | (_af << 1)), \
21 #define PXA_PIN(_pin, funcs...) \
22 { \
23 .pin = _pin, \
24 .functions = (struct pxa_desc_function[]){ \
25 funcs, { } }, \
28 #define PXA_GPIO_PIN(_pin, funcs...) \
29 { \
30 .pin = _pin, \
31 .functions = (struct pxa_desc_function[]){ \
32 PXA_FUNCTION(0, 0, "gpio_in"), \
33 PXA_FUNCTION(1, 0, "gpio_out"), \
34 funcs, { } }, \
37 #define PXA_GPIO_ONLY_PIN(_pin) \
38 { \
39 .pin = _pin, \
40 .functions = (struct pxa_desc_function[]){ \
41 PXA_FUNCTION(0, 0, "gpio_in"), \
42 PXA_FUNCTION(1, 0, "gpio_out"), \
43 { } }, \
46 #define PXA_PINCTRL_PIN(pin) \
47 PINCTRL_PIN(pin, "P" #pin)
49 struct pxa_desc_function {
50 const char *name;
51 u8 muxval;
54 struct pxa_desc_pin {
55 struct pinctrl_pin_desc pin;
56 struct pxa_desc_function *functions;
59 struct pxa_pinctrl_group {
60 const char *name;
61 unsigned pin;
64 struct pxa_pinctrl_function {
65 const char *name;
66 const char **groups;
67 unsigned ngroups;
70 struct pxa_pinctrl {
71 spinlock_t lock;
72 void __iomem **base_gafr;
73 void __iomem **base_gpdr;
74 void __iomem **base_pgsr;
75 struct device *dev;
76 struct pinctrl_desc desc;
77 struct pinctrl_dev *pctl_dev;
78 unsigned npins;
79 const struct pxa_desc_pin *ppins;
80 unsigned ngroups;
81 struct pxa_pinctrl_group *groups;
82 unsigned nfuncs;
83 struct pxa_pinctrl_function *functions;
84 char *name;
87 int pxa2xx_pinctrl_init(struct platform_device *pdev,
88 const struct pxa_desc_pin *ppins, int npins,
89 void __iomem *base_gafr[], void __iomem *base_gpdr[],
90 void __iomem *base_gpsr[]);
92 #endif /* __PINCTRL_PXA_H */