]> git.sur5r.net Git - u-boot/blobdiff - drivers/pinctrl/uniphier/pinctrl-uniphier.h
pinctrl: uniphier: include <linux/build_bug.h> instead of <linux/bug.h>
[u-boot] / drivers / pinctrl / uniphier / pinctrl-uniphier.h
index 6bdebf28cd59de02ffd7d72d56d1d6d5bd28d1a6..55f2b1a4d56903621d51466bffde4863c647b6ed 100644 (file)
@@ -1,20 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
+ * Copyright (C) 2015-2016 Socionext Inc.
+ *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  */
 
 #ifndef __PINCTRL_UNIPHIER_H__
 #define __PINCTRL_UNIPHIER_H__
 
-#include <linux/bug.h>
+#include <linux/bitops.h>
+#include <linux/build_bug.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 
-#define UNIPHIER_PINCTRL_PINMUX_BASE   0x0
-#define UNIPHIER_PINCTRL_LOAD_PINMUX   0x700
-#define UNIPHIER_PINCTRL_IECTRL                0xd00
-
 #define UNIPHIER_PIN_ATTR_PACKED(iectrl)       (iectrl)
 
 static inline unsigned int uniphier_pin_get_iectrl(unsigned long data)
@@ -45,7 +42,7 @@ struct uniphier_pinctrl_group {
        const char *name;
        const unsigned *pins;
        unsigned num_pins;
-       const unsigned *muxvals;
+       const int *muxvals;
 };
 
 /**
@@ -59,8 +56,7 @@ struct uniphier_pinctrl_group {
  * @functions_count: number of pinmux functions
  * @mux_bits: bit width of each pinmux register
  * @reg_stride: stride of pinmux register address
- * @load_pinctrl: if true, LOAD_PINMUX register must be set to one for new
- *               values in pinmux registers to become really effective
+ * @caps: SoC-specific capability flag
  */
 struct uniphier_pinctrl_socdata {
        const struct uniphier_pinctrl_pin *pins;
@@ -69,9 +65,11 @@ struct uniphier_pinctrl_socdata {
        int groups_count;
        const char * const *functions;
        int functions_count;
-       unsigned mux_bits;
-       unsigned reg_stride;
-       bool load_pinctrl;
+       unsigned caps;
+#define UNIPHIER_PINCTRL_CAPS_PUPD_SIMPLE      BIT(3)
+#define UNIPHIER_PINCTRL_CAPS_PERPIN_IECTRL    BIT(2)
+#define UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE  BIT(1)
+#define UNIPHIER_PINCTRL_CAPS_MUX_4BIT         BIT(0)
 };
 
 #define UNIPHIER_PINCTRL_PIN(a, b)                                     \
@@ -80,7 +78,7 @@ struct uniphier_pinctrl_socdata {
        .data = UNIPHIER_PIN_ATTR_PACKED(b),                            \
 }
 
-#define UNIPHIER_PINCTRL_GROUP(grp)                                    \
+#define __UNIPHIER_PINCTRL_GROUP(grp)                                  \
        {                                                               \
                .name = #grp,                                           \
                .pins = grp##_pins,                                     \
@@ -90,6 +88,24 @@ struct uniphier_pinctrl_socdata {
                                          ARRAY_SIZE(grp##_muxvals)),   \
        }
 
+#define __UNIPHIER_PINMUX_FUNCTION(func)       #func
+
+#ifdef CONFIG_SPL_BUILD
+       /*
+        * a tricky way to drop unneeded *_pins and *_muxvals arrays from SPL,
+        * suppressing "defined but not used" warnings.
+        */
+#define UNIPHIER_PINCTRL_GROUP(grp)                                    \
+       { .num_pins = ARRAY_SIZE(grp##_pins) + ARRAY_SIZE(grp##_muxvals) }
+#define UNIPHIER_PINMUX_FUNCTION(func)         NULL
+#else
+#define UNIPHIER_PINCTRL_GROUP(grp)            __UNIPHIER_PINCTRL_GROUP(grp)
+#define UNIPHIER_PINMUX_FUNCTION(func)         __UNIPHIER_PINMUX_FUNCTION(func)
+#endif
+
+#define UNIPHIER_PINCTRL_GROUP_SPL(grp)                __UNIPHIER_PINCTRL_GROUP(grp)
+#define UNIPHIER_PINMUX_FUNCTION_SPL(func)     __UNIPHIER_PINMUX_FUNCTION(func)
+
 /**
  * struct uniphier_pinctrl_priv - private data for UniPhier pinctrl driver
  *
@@ -106,6 +122,4 @@ extern const struct pinctrl_ops uniphier_pinctrl_ops;
 int uniphier_pinctrl_probe(struct udevice *dev,
                           struct uniphier_pinctrl_socdata *socdata);
 
-int uniphier_pinctrl_remove(struct udevice *dev);
-
 #endif /* __PINCTRL_UNIPHIER_H__ */