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>
This commit is contained in:
Angel Pons 2019-12-01 21:37:58 +01:00 committed by Patrick Georgi
parent 3b34db6c0f
commit 96e2a5da34
1 changed files with 9 additions and 22 deletions

View File

@ -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) \