dt-bindings: reset: imx7: Fix the spelling of 'indices'
[sfrench/cifs-2.6.git] / drivers / pinctrl / pxa / pinctrl-pxa2xx.h
1 /*
2  * Marvell PXA2xx family pin control
3  *
4  * Copyright (C) 2015 Robert Jarzmik
5  *
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.
9  *
10  */
11
12 #ifndef __PINCTRL_PXA_H
13 #define __PINCTRL_PXA_H
14
15 #define PXA_FUNCTION(_dir, _af, _name)                          \
16         {                                                       \
17                 .name = _name,                                  \
18                 .muxval = (_dir | (_af << 1)),                  \
19         }
20
21 #define PXA_PIN(_pin, funcs...)                                 \
22         {                                                       \
23                 .pin = _pin,                                    \
24                 .functions = (struct pxa_desc_function[]){      \
25                         funcs, { } },                           \
26         }
27
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, { } },                           \
35         }
36
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                         { } },                                  \
44         }
45
46 #define PXA_PINCTRL_PIN(pin)            \
47         PINCTRL_PIN(pin, "P" #pin)
48
49 struct pxa_desc_function {
50         const char      *name;
51         u8              muxval;
52 };
53
54 struct pxa_desc_pin {
55         struct pinctrl_pin_desc         pin;
56         struct pxa_desc_function        *functions;
57 };
58
59 struct pxa_pinctrl_group {
60         const char      *name;
61         unsigned        pin;
62 };
63
64 struct pxa_pinctrl_function {
65         const char      *name;
66         const char      **groups;
67         unsigned        ngroups;
68 };
69
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;
85 };
86
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[]);
91
92 #endif /* __PINCTRL_PXA_H */