diff options
| author | Mikhail Kshevetskiy <[email protected]> | 2026-07-03 14:56:19 +0300 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-07-08 13:29:18 -0600 |
| commit | 7518f6fbc4b9f786dabef4ada2881024a2039bb9 (patch) | |
| tree | af1dd332a318156bfd4f4a9f669973f4f82c2fb6 /include/dm | |
| parent | d26cb20e6bd70a47ca7ca2ca8d9145e669475824 (diff) | |
pinctrl: add more pinconf/pinctrl definitions
These pinconf/pinctrl definitions will be used by the next patches.
The definitions was taken from public headers of linux-7.0. It's used
by several linux pinctrl drivers, so it might be helpful for U-Boot as
well.
Pinconf definitions are placed near the corresponding U-Boot definitions
in file include/dm/pinctrl.h. Pin/group/function definitions stored within
the same path as in linux (include/linux/pinctrl/pinctrl.h).
Signed-off-by: Mikhail Kshevetskiy <[email protected]>
Reviewed-by: David Lechner <[email protected]>
Diffstat (limited to 'include/dm')
| -rw-r--r-- | include/dm/pinctrl.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/dm/pinctrl.h b/include/dm/pinctrl.h index e41baea6200..36db47802c7 100644 --- a/include/dm/pinctrl.h +++ b/include/dm/pinctrl.h @@ -481,6 +481,34 @@ enum pin_config_param { PIN_CONFIG_MAX = 255, /* 0xFF */ }; +/* + * Helpful configuration macro to be used in tables etc. + */ +#define PIN_CONF_PACKED(p, a) ((a << 8) | ((unsigned long) p & 0xffUL)) + +/* + * The following inlines stuffs a configuration parameter and data value + * into and out of an unsigned long argument, as used by the generic pin config + * system. We put the parameter in the lower 8 bits and the argument in the + * upper 24 bits. + */ + +static inline enum pin_config_param pinconf_to_config_param(unsigned long config) +{ + return (enum pin_config_param) (config & 0xffUL); +} + +static inline u32 pinconf_to_config_argument(unsigned long config) +{ + return (u32) ((config >> 8) & 0xffffffUL); +} + +static inline unsigned long pinconf_to_config_packed(enum pin_config_param param, + u32 argument) +{ + return PIN_CONF_PACKED(param, argument); +} + #if CONFIG_IS_ENABLED(PINCTRL_GENERIC) /** * pinctrl_generic_set_state() - Generic set_state operation |
