From 5852854cdf407d70f4fbaa9703b3e3c35179c04b Mon Sep 17 00:00:00 2001 From: Maxim Polyakov Date: Sun, 9 Aug 2020 01:30:47 +0300 Subject: [PATCH] soc/intel/common/gpio_defs: Add macros for bidirectional pad Adds new macros to configure the pad in bidirectional mode when both (Tx/Rx) buffers are enabled in the configuration register DW0. This corresponds to FSP's < GpioDirInOut > parameter for port direction (for example see config for SOUTH_GROUP0_DFX_SPARE2 pad in src/mainboard/intel/harcuvar/gpio.h). This macro is used in the pad configuration for some boards: CB:43456 - mb/intel/cedarisland_crb; CB:39133 - mb/kontron/mal10; CB:43410 - mb/51nb/x210; CB:43411 - mb/razer/blade_stealth_kbl. Change-Id: I7b65f4da7616f2eefcd33a728d4d3ae5a79b014e Signed-off-by: Maxim Polyakov Reviewed-on: https://review.coreboot.org/c/coreboot/+/42914 Reviewed-by: coreboot org Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- .../common/block/include/intelblocks/gpio_defs.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/soc/intel/common/block/include/intelblocks/gpio_defs.h b/src/soc/intel/common/block/include/intelblocks/gpio_defs.h index a51ebf3667..f0ff08c492 100644 --- a/src/soc/intel/common/block/include/intelblocks/gpio_defs.h +++ b/src/soc/intel/common/block/include/intelblocks/gpio_defs.h @@ -395,6 +395,20 @@ #define PAD_CFG_GPI_INT_LOCK_SWAPPED(pad, pull, trig, lock_action) \ PAD_CFG_GPI_TRIG_OWN_LOCK_SWAPPED(pad, pull, PWROK, trig, DRIVER, lock_action) +/* Bidirectional GPIO port when both RX and TX buffer is enabled */ +#define PAD_CFG_GPIO_BIDIRECT_IOS(pad, val, pull, rst, trig, iosstate, iosterm, own) \ + _PAD_CFG_STRUCT(pad, \ + PAD_FUNC(GPIO) | PAD_RESET(rst) | PAD_TRIG(trig) | \ + PAD_BUF(NO_DISABLE) | val, \ + PAD_PULL(pull) | PAD_CFG_OWN_GPIO(own) | \ + PAD_IOSSTATE(iosstate) | PAD_IOSTERM(iosterm)) + +#define PAD_CFG_GPIO_BIDIRECT(pad, val, pull, rst, trig, own) \ + _PAD_CFG_STRUCT(pad, \ + PAD_FUNC(GPIO) | PAD_RESET(rst) | PAD_TRIG(trig) | \ + PAD_BUF(NO_DISABLE) | val, \ + PAD_PULL(pull) | PAD_CFG_OWN_GPIO(own)) + /* * No Connect configuration for unconnected or unused pad. * Both TX and RX are disabled. RX disabling is done to avoid unnecessary