2 * (C) Copyright 2016 - Beniamino Galvani <b.galvani@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0+
7 #ifndef __PINCTRL_MESON_H__
8 #define __PINCTRL_MESON_H__
10 #include <linux/types.h>
12 struct meson_pmx_group {
14 const unsigned int *pins;
15 unsigned int num_pins;
21 struct meson_pmx_func {
23 const char * const *groups;
24 unsigned int num_groups;
27 struct meson_pinctrl_data {
29 struct meson_pmx_group *groups;
30 struct meson_pmx_func *funcs;
31 unsigned int pin_base;
32 unsigned int num_pins;
33 unsigned int num_groups;
34 unsigned int num_funcs;
37 struct meson_pinctrl {
38 struct meson_pinctrl_data *data;
39 void __iomem *reg_mux;
42 #define PIN(x, b) (b + x)
44 #define GROUP(grp, r, b) \
47 .pins = grp ## _pins, \
48 .num_pins = ARRAY_SIZE(grp ## _pins), \
53 #define GPIO_GROUP(gpio, b) \
56 .pins = (const unsigned int[]){ PIN(gpio, b) }, \
61 #define FUNCTION(fn) \
64 .groups = fn ## _groups, \
65 .num_groups = ARRAY_SIZE(fn ## _groups), \
68 #define MESON_PIN(x, b) PINCTRL_PIN(PIN(x, b), #x)
70 extern const struct pinctrl_ops meson_pinctrl_ops;
72 int meson_pinctrl_probe(struct udevice *dev);
74 #endif /* __PINCTRL_MESON_H__ */