summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2019-12-01 21:37:58 +0100
committerPatrick Georgi <pgeorgi@google.com>2019-12-09 09:43:48 +0000
commit96e2a5da34eda9a9c9c78c475696915f2b23d2ef (patch)
tree5cb97130e70949f6f38c22aca7d1d08e49164fe5
parent3b34db6c0f1a2758e06faff8a72c4afd073aa056 (diff)
downloadcoreboot-96e2a5da34eda9a9c9c78c475696915f2b23d2ef.tar.xz
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>
-rw-r--r--src/soc/intel/braswell/include/soc/gpio.h31
1 files changed, 9 insertions, 22 deletions
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) \