summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2020-06-27 16:30:18 -0700
committerFurquan Shaikh <furquan@google.com>2020-06-30 23:31:18 +0000
commite9fe3661b3de1916af7d82bbb78dc3f8a2a5e1b2 (patch)
treec533a2815c465d8fa63edd7db3de7eddeb2eee71 /src
parent10185866f08a192d6fddb6f707d6877fcd81cb94 (diff)
soc/amd/common/gpio: Add new helper macro PAD_CFG_STRUCT_FLAGS
`flags` field of soc_amd_gpio structure is set only for SCI and SMI configurations. This change adds a new helper macro PAD_CFG_STRUCT_FLAGS that allows setting of all soc_amd_gpio members including `flags` field. This can be used directly by PAD_SCI and PAD_SMI. For all other pad configurations, PAD_CFG_STRUCT macro uses PAD_CFG_STRUCT_FLAGS with flags set to 0. This allows dropping of redundant parameter 0 for flags for all other pad configurations. BUG=b:159944426 Change-Id: I835b62f5502375ffc4215548b51338a67546d699 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/42876 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/soc/amd/common/block/include/amdblocks/gpio_banks.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/soc/amd/common/block/include/amdblocks/gpio_banks.h b/src/soc/amd/common/block/include/amdblocks/gpio_banks.h
index f02c8e86b4..92eae73430 100644
--- a/src/soc/amd/common/block/include/amdblocks/gpio_banks.h
+++ b/src/soc/amd/common/block/include/amdblocks/gpio_banks.h
@@ -249,14 +249,17 @@ static inline bool is_gpio_event_active_low(uint32_t flags)
* debounce_time the debounce time
*/
-#define PAD_CFG_STRUCT(__pin, __function, __control, __flags) \
- { \
- .gpio = __pin, \
- .function = __function, \
- .control = __control, \
- .flags = __flags, \
+#define PAD_CFG_STRUCT_FLAGS(__pin, __function, __control, __flags) \
+ { \
+ .gpio = __pin, \
+ .function = __function, \
+ .control = __control, \
+ .flags = __flags, \
}
+#define PAD_CFG_STRUCT(__pin, __function, __control) \
+ PAD_CFG_STRUCT_FLAGS(__pin, __function, __control, 0)
+
#define PAD_PULL(__pull) GPIO_PULL_ ## __pull
#define PAD_OUTPUT(__dir) GPIO_OUTPUT_OUT_ ## __dir
#define PAD_TRIGGER(__trig) GPIO_TRIGGER_ ## __trig
@@ -267,45 +270,42 @@ static inline bool is_gpio_event_active_low(uint32_t flags)
/* Native function pad configuration */
#define PAD_NF(pin, func, pull) \
- PAD_CFG_STRUCT(pin, pin ## _IOMUX_ ## func, PAD_PULL(pull), 0)
+ PAD_CFG_STRUCT(pin, pin ## _IOMUX_ ## func, PAD_PULL(pull))
/* General purpose input pad configuration */
#define PAD_GPI(pin, pull) \
- PAD_CFG_STRUCT(pin, pin ## _IOMUX_GPIOxx, PAD_PULL(pull), 0)
+ PAD_CFG_STRUCT(pin, pin ## _IOMUX_GPIOxx, PAD_PULL(pull))
/* General purpose output pad configuration */
#define PAD_GPO(pin, direction) \
- PAD_CFG_STRUCT(pin, pin ## _IOMUX_GPIOxx, PAD_OUTPUT(direction), 0)
+ PAD_CFG_STRUCT(pin, pin ## _IOMUX_GPIOxx, PAD_OUTPUT(direction))
/* Legacy interrupt pad configuration */
#define PAD_INT(pin, pull, trigger, action) \
PAD_CFG_STRUCT(pin, pin ## _IOMUX_GPIOxx, \
- PAD_PULL(pull) | PAD_TRIGGER(trigger) | PAD_INT_ENABLE(action), \
- 0)
+ PAD_PULL(pull) | PAD_TRIGGER(trigger) | PAD_INT_ENABLE(action))
/* SCI pad configuration */
#define PAD_SCI(pin, pull, trigger) \
- PAD_CFG_STRUCT(pin, pin ## _IOMUX_GPIOxx, \
+ PAD_CFG_STRUCT_FLAGS(pin, pin ## _IOMUX_GPIOxx, \
PAD_PULL(pull) | PAD_TRIGGER(LEVEL_HIGH), \
PAD_FLAG_EVENT_TRIGGER(trigger) | GPIO_FLAG_SCI)
/* SMI pad configuration */
#define PAD_SMI(pin, pull, trigger) \
- PAD_CFG_STRUCT(pin, pin ## _IOMUX_GPIOxx, \
+ PAD_CFG_STRUCT_FLAGS(pin, pin ## _IOMUX_GPIOxx, \
PAD_PULL(pull) | PAD_TRIGGER(LEVEL_HIGH), \
PAD_FLAG_EVENT_TRIGGER(trigger) | GPIO_FLAG_SMI)
/* WAKE pad configuration */
#define PAD_WAKE(pin, pull, trigger, type) \
PAD_CFG_STRUCT(pin, pin ## _IOMUX_GPIOxx, \
- PAD_PULL(pull) | PAD_TRIGGER(trigger) | PAD_WAKE_ENABLE(type), \
- 0)
+ PAD_PULL(pull) | PAD_TRIGGER(trigger) | PAD_WAKE_ENABLE(type))
/* pin debounce configuration */
#define PAD_DEBOUNCE(pin, pull, type, time) \
PAD_CFG_STRUCT(pin, pin ## _IOMUX_GPIOxx, \
- PAD_PULL(pull) | PAD_DEBOUNCE_CONFIG(type) | PAD_DEBOUNCE_CONFIG(time), \
- 0)
+ PAD_PULL(pull) | PAD_DEBOUNCE_CONFIG(type) | PAD_DEBOUNCE_CONFIG(time))
typedef uint32_t gpio_t;