From 96e2a5da34eda9a9c9c78c475696915f2b23d2ef Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Sun, 1 Dec 2019 21:37:58 +0100 Subject: soc/intel/bsw/gpio: Factor out GPI macros This patch simplifies some GPIO macros by removing redundant code. Also, for the sake of completeness, add two missing macros. Change-Id: I838efe8b26f60d3e059f4ce18c116aefbc0b0400 Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/37404 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- src/soc/intel/braswell/include/soc/gpio.h | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/soc/intel/braswell/include/soc/gpio.h b/src/soc/intel/braswell/include/soc/gpio.h index 2240ae1e4b..24318c5e5e 100644 --- a/src/soc/intel/braswell/include/soc/gpio.h +++ b/src/soc/intel/braswell/include/soc/gpio.h @@ -228,30 +228,17 @@ #define PAD_CONFIG1_CSEN 0x0DC00000 #define PAD_CONFIG1_DEFAULT1 0x05C00020 -#define GPIO_INPUT_NO_PULL \ - { .pad_conf0 = PAD_PULL_DISABLE | PAD_GPIO_ENABLE \ - | PAD_CONFIG0_GPI_DEFAULT, \ +#define GPIO_INPUT_PULL(pull) \ + { .pad_conf0 = pull | PAD_GPIO_ENABLE | PAD_CONFIG0_GPI_DEFAULT, \ .pad_conf1 = PAD_CONFIG1_DEFAULT0 } -#define GPIO_INPUT_PU_20K \ - { .pad_conf0 = PAD_PULL_UP_20K | PAD_GPIO_ENABLE \ - | PAD_CONFIG0_GPI_DEFAULT, \ - .pad_conf1 = PAD_CONFIG1_DEFAULT0 } - -#define GPIO_INPUT_PD_5K \ - { .pad_conf0 = PAD_PULL_DOWN_5K | PAD_GPIO_ENABLE \ - | PAD_CONFIG0_GPI_DEFAULT, \ - .pad_conf1 = PAD_CONFIG1_DEFAULT0 } - -#define GPIO_INPUT_PD_20K \ - { .pad_conf0 = PAD_PULL_DOWN_20K | PAD_GPIO_ENABLE \ - | PAD_CONFIG0_GPI_DEFAULT, \ - .pad_conf1 = PAD_CONFIG1_DEFAULT0 } - -#define GPIO_INPUT_PU_5K \ - { .pad_conf0 = PAD_PULL_UP_5K | PAD_GPIO_ENABLE \ - | PAD_CONFIG0_GPI_DEFAULT, \ - .pad_conf1 = PAD_CONFIG1_DEFAULT0 } +#define GPIO_INPUT_NO_PULL GPIO_INPUT_PULL(PAD_PULL_DISABLE) +#define GPIO_INPUT_PU_20K GPIO_INPUT_PULL(PAD_PULL_UP_20K) +#define GPIO_INPUT_PU_5K GPIO_INPUT_PULL(PAD_PULL_UP_5K) +#define GPIO_INPUT_PU_1K GPIO_INPUT_PULL(PAD_PULL_UP_1K) +#define GPIO_INPUT_PD_20K GPIO_INPUT_PULL(PAD_PULL_DOWN_20K) +#define GPIO_INPUT_PD_5K GPIO_INPUT_PULL(PAD_PULL_DOWN_5K) +#define GPIO_INPUT_PD_1K GPIO_INPUT_PULL(PAD_PULL_DOWN_1K) #define GPI(int_type, int_sel, term, int_msk, glitch_cfg, wake_msk, gpe_val) { \ .pad_conf0 = PAD_INT_SEL(int_sel) | PAD_GFCFG(glitch_cfg) \ -- cgit v1.2.3