summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/meson/pinctrl-meson.h
diff options
context:
space:
mode:
authorJerome Brunet <jbrunet@baylibre.com>2017-10-12 14:40:26 +0200
committerLinus Walleij <linus.walleij@linaro.org>2017-10-16 23:14:10 +0200
commitce385aa24a0dcccdc81dfcbc90cf7aa290d8b758 (patch)
treea819b80b58f149152363a31ed939b2a666016713 /drivers/pinctrl/meson/pinctrl-meson.h
parent277d14eb815fdfb95a72ea126bc09f75a2bd58fd (diff)
pinctrl: meson: rework pinmux ops
This change prepare the introduction of new meson SoC. This new SoC will share the same gpio/pinconf registers but the pinmux part will be different. While the format of the data associated with each pinmux group will change, the way to handle pinmuxing will be similar. To deal with this new situation, the meson_pmx_struture is kept but the data associated to it is now generic. This allows to reuse the basic functions which would otherwise be copy/pasted in each pinmux driver (such as getting the name a count of groups and functions) Only the functions actually using this specific data is taken out of the common code and is handling the SoC pinmuxing Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Reviewed-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/meson/pinctrl-meson.h')
-rw-r--r--drivers/pinctrl/meson/pinctrl-meson.h31
1 files changed, 11 insertions, 20 deletions
diff --git a/drivers/pinctrl/meson/pinctrl-meson.h b/drivers/pinctrl/meson/pinctrl-meson.h
index 284157d43612..183b6e471635 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.h
+++ b/drivers/pinctrl/meson/pinctrl-meson.h
@@ -32,9 +32,7 @@ struct meson_pmx_group {
const char *name;
const unsigned int *pins;
unsigned int num_pins;
- bool is_gpio;
- unsigned int reg;
- unsigned int bit;
+ const void *data;
};
/**
@@ -109,6 +107,7 @@ struct meson_pinctrl_data {
unsigned int num_funcs;
struct meson_bank *banks;
unsigned int num_banks;
+ const struct pinmux_ops *pmx_ops;
};
struct meson_pinctrl {
@@ -124,23 +123,6 @@ struct meson_pinctrl {
struct device_node *of_node;
};
-#define GROUP(grp, r, b) \
- { \
- .name = #grp, \
- .pins = grp ## _pins, \
- .num_pins = ARRAY_SIZE(grp ## _pins), \
- .reg = r, \
- .bit = b, \
- }
-
-#define GPIO_GROUP(gpio) \
- { \
- .name = #gpio, \
- .pins = (const unsigned int[]){ gpio }, \
- .num_pins = 1, \
- .is_gpio = true, \
- }
-
#define FUNCTION(fn) \
{ \
.name = #fn, \
@@ -166,5 +148,14 @@ struct meson_pinctrl {
#define MESON_PIN(x) PINCTRL_PIN(x, #x)
+/* Common pmx functions */
+int meson_pmx_get_funcs_count(struct pinctrl_dev *pcdev);
+const char *meson_pmx_get_func_name(struct pinctrl_dev *pcdev,
+ unsigned selector);
+int meson_pmx_get_groups(struct pinctrl_dev *pcdev,
+ unsigned selector,
+ const char * const **groups,
+ unsigned * const num_groups);
+
/* Common probe function */
int meson_pinctrl_probe(struct platform_device *pdev);