Skip to content

Commit 27d1f73

Browse files
amboarlinusw
authored andcommitted
pinctrl: aspeed: Add PIN_DECL_3() helper
This case is common in the AST2600, so add to the collection. Signed-off-by: Andrew Jeffery <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 7b38897 commit 27d1f73

File tree

1 file changed

+40
-32
lines changed

1 file changed

+40
-32
lines changed

drivers/pinctrl/aspeed/pinmux-aspeed.h

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -604,38 +604,6 @@ struct aspeed_pin_desc {
604604
static const struct aspeed_pin_desc PIN_SYM(pin) = \
605605
{ #pin, PIN_EXPRS_PTR(pin) }
606606

607-
/**
608-
* Declare a two-signal pin
609-
*
610-
* @pin: The pin number
611-
* @other: Macro name for "other" functionality (subjected to stringification)
612-
* @high: Macro name for the highest priority signal functions
613-
* @low: Macro name for the low signal functions
614-
*
615-
* For example:
616-
*
617-
* #define A8 56
618-
* SIG_EXPR_DECL(ROMD8, ROM16, SIG_DESC_SET(SCU90, 6));
619-
* SIG_EXPR_DECL(ROMD8, ROM16S, SIG_DESC_SET(HW_STRAP1, 4),
620-
* { HW_STRAP1, GENMASK(1, 0), 0, 0 });
621-
* SIG_EXPR_LIST_DECL(ROMD8, SIG_EXPR_PTR(ROMD8, ROM16),
622-
* SIG_EXPR_PTR(ROMD8, ROM16S));
623-
* SIG_EXPR_LIST_DECL_SINGLE(NCTS6, NCTS6, SIG_DESC_SET(SCU90, 7));
624-
* PIN_DECL_2(A8, GPIOH0, ROMD8, NCTS6);
625-
*/
626-
#define PIN_DECL_2(pin, other, high, low) \
627-
SIG_EXPR_LIST_DECL_SINGLE(other, other); \
628-
PIN_DECL_(pin, \
629-
SIG_EXPR_LIST_PTR(high), \
630-
SIG_EXPR_LIST_PTR(low), \
631-
SIG_EXPR_LIST_PTR(other))
632-
633-
#define PIN_GROUP_SYM(func) pins_ ## func
634-
#define FUNC_GROUP_SYM(func) groups_ ## func
635-
#define FUNC_GROUP_DECL(func, ...) \
636-
static const int PIN_GROUP_SYM(func)[] = { __VA_ARGS__ }; \
637-
static const char *FUNC_GROUP_SYM(func)[] = { #func }
638-
639607
/**
640608
* Declare a single signal pin
641609
*
@@ -670,6 +638,46 @@ struct aspeed_pin_desc {
670638
SIG_EXPR_LIST_DECL_SINGLE(other, other); \
671639
PIN_DECL_(pin, SIG_EXPR_LIST_PTR(sig), SIG_EXPR_LIST_PTR(other)); \
672640
FUNC_GROUP_DECL(sig, pin)
641+
/**
642+
* Declare a two-signal pin
643+
*
644+
* @pin: The pin number
645+
* @other: Macro name for "other" functionality (subjected to stringification)
646+
* @high: Macro name for the highest priority signal functions
647+
* @low: Macro name for the low signal functions
648+
*
649+
* For example:
650+
*
651+
* #define A8 56
652+
* SIG_EXPR_DECL(ROMD8, ROM16, SIG_DESC_SET(SCU90, 6));
653+
* SIG_EXPR_DECL(ROMD8, ROM16S, SIG_DESC_SET(HW_STRAP1, 4),
654+
* { HW_STRAP1, GENMASK(1, 0), 0, 0 });
655+
* SIG_EXPR_LIST_DECL(ROMD8, SIG_EXPR_PTR(ROMD8, ROM16),
656+
* SIG_EXPR_PTR(ROMD8, ROM16S));
657+
* SIG_EXPR_LIST_DECL_SINGLE(NCTS6, NCTS6, SIG_DESC_SET(SCU90, 7));
658+
* PIN_DECL_2(A8, GPIOH0, ROMD8, NCTS6);
659+
*/
660+
#define PIN_DECL_2(pin, other, high, low) \
661+
SIG_EXPR_LIST_DECL_SINGLE(other, other); \
662+
PIN_DECL_(pin, \
663+
SIG_EXPR_LIST_PTR(high), \
664+
SIG_EXPR_LIST_PTR(low), \
665+
SIG_EXPR_LIST_PTR(other))
666+
667+
#define PIN_DECL_3(pin, other, high, medium, low) \
668+
SIG_EXPR_LIST_DECL_SINGLE(other, other); \
669+
PIN_DECL_(pin, \
670+
SIG_EXPR_LIST_PTR(high), \
671+
SIG_EXPR_LIST_PTR(medium), \
672+
SIG_EXPR_LIST_PTR(low), \
673+
SIG_EXPR_LIST_PTR(other))
674+
675+
#define PIN_GROUP_SYM(func) pins_ ## func
676+
#define FUNC_GROUP_SYM(func) groups_ ## func
677+
#define FUNC_GROUP_DECL(func, ...) \
678+
static const int PIN_GROUP_SYM(func)[] = { __VA_ARGS__ }; \
679+
static const char *FUNC_GROUP_SYM(func)[] = { #func }
680+
673681

674682
#define GPIO_PIN_DECL(pin, gpio) \
675683
SIG_EXPR_LIST_DECL_SINGLE(gpio, gpio); \

0 commit comments

Comments
 (0)