Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/37404 )
Change subject: soc/intel/bsw/gpio: Factor out GPI macros ......................................................................
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 th3fanbus@gmail.com --- M src/soc/intel/braswell/include/soc/gpio.h 1 file changed, 9 insertions(+), 22 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/04/37404/1
diff --git a/src/soc/intel/braswell/include/soc/gpio.h b/src/soc/intel/braswell/include/soc/gpio.h index 2240ae1..24318c5 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) \
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37404 )
Change subject: soc/intel/bsw/gpio: Factor out GPI macros ......................................................................
Patch Set 1: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/37404 )
Change subject: soc/intel/bsw/gpio: Factor out GPI macros ......................................................................
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 th3fanbus@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/37404 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Nico Huber nico.h@gmx.de --- M src/soc/intel/braswell/include/soc/gpio.h 1 file changed, 9 insertions(+), 22 deletions(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved
diff --git a/src/soc/intel/braswell/include/soc/gpio.h b/src/soc/intel/braswell/include/soc/gpio.h index 2240ae1..24318c5 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) \