summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/meson/pinctrl-meson-gx.h
diff options
context:
space:
mode:
authorJerome Brunet <jbrunet@baylibre.com>2018-10-05 09:35:26 +0200
committerNeil Armstrong <narmstrong@baylibre.com>2018-11-26 14:40:52 +0100
commit7c9dcfed50fb3c63d746d6b4108872d906606a9e (patch)
treef2bb0ec249d5d5f25ddf17bc9408ad15b0b7f150 /drivers/pinctrl/meson/pinctrl-meson-gx.h
parentf58d633e538858bf1ccdb93d5b5dc8edc368e30e (diff)
pinctrl: meson: rework gx pmx function
In preparation of supporting the new Amlogix AGX SoCs, we need to move the Amlogic GX pinmux functions out of the common code to be able to add a different set of SoC specific pinmux functions for AXG. Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Diffstat (limited to 'drivers/pinctrl/meson/pinctrl-meson-gx.h')
-rw-r--r--drivers/pinctrl/meson/pinctrl-meson-gx.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/pinctrl/meson/pinctrl-meson-gx.h b/drivers/pinctrl/meson/pinctrl-meson-gx.h
new file mode 100644
index 0000000000..4c1aa1a300
--- /dev/null
+++ b/drivers/pinctrl/meson/pinctrl-meson-gx.h
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
+ * Copyright (C) 2017 Jerome Brunet <jbrunet@baylibre.com>
+ */
+
+#ifndef __PINCTRL_MESON_GX_H__
+#define __PINCTRL_MESON_GX_H__
+
+#include "pinctrl-meson.h"
+
+struct meson_gx_pmx_data {
+ bool is_gpio;
+ unsigned int reg;
+ unsigned int bit;
+};
+
+#define PMX_DATA(r, b, g) \
+ { \
+ .reg = r, \
+ .bit = b, \
+ .is_gpio = g, \
+ }
+
+#define GROUP(grp, r, b) \
+ { \
+ .name = #grp, \
+ .pins = grp ## _pins, \
+ .num_pins = ARRAY_SIZE(grp ## _pins), \
+ .data = (const struct meson_gx_pmx_data[]){ \
+ PMX_DATA(r, b, false), \
+ }, \
+ }
+
+#define GPIO_GROUP(gpio, b) \
+ { \
+ .name = #gpio, \
+ .pins = (const unsigned int[]){ PIN(gpio, b) }, \
+ .num_pins = 1, \
+ .data = (const struct meson_gx_pmx_data[]){ \
+ PMX_DATA(0, 0, true), \
+ }, \
+ }
+
+extern const struct pinctrl_ops meson_gx_pinctrl_ops;
+extern const struct driver meson_gx_gpio_driver;
+
+#endif /* __PINCTRL_MESON_GX_H__ */