Attention is currently required from: Taniya Das. Hello Taniya Das,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/55078
to review the following change.
Change subject: sc7280: gpio: eGPIO support on sc7280 ......................................................................
sc7280: gpio: eGPIO support on sc7280
eGPIO is a scheme which allows special power island domain IOs to be reused as regular chip GPIOs by muxing regular TLMM functions with Island Domain functions. With this scheme, an IO can be controlled both by APPS and Island processor.
This change provides an API to configure the eGPIO's.
BUG=b:182963902 TEST=Validated on qualcomm sc7280 development board
Signed-off-by: Taniya Das tdas@codeaurora.org Change-Id: I2c54a14c50fb7b5921d1961d2de83098ed2d4358 --- M src/soc/qualcomm/sc7280/Makefile.inc M src/soc/qualcomm/sc7280/include/soc/gpio.h A src/soc/qualcomm/sc7280/sc7280_egpio.c 3 files changed, 73 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/55078/1
diff --git a/src/soc/qualcomm/sc7280/Makefile.inc b/src/soc/qualcomm/sc7280/Makefile.inc index abcc3fb..7462664 100644 --- a/src/soc/qualcomm/sc7280/Makefile.inc +++ b/src/soc/qualcomm/sc7280/Makefile.inc @@ -3,6 +3,7 @@ all-y += ../common/timer.c all-y += spi.c all-y += ../common/gpio.c +all-y += sc7280_egpio.c
################################################################################ bootblock-y += bootblock.c diff --git a/src/soc/qualcomm/sc7280/include/soc/gpio.h b/src/soc/qualcomm/sc7280/include/soc/gpio.h index 6d6d0cd..b12aa70 100644 --- a/src/soc/qualcomm/sc7280/include/soc/gpio.h +++ b/src/soc/qualcomm/sc7280/include/soc/gpio.h @@ -192,4 +192,16 @@ PIN(174, RES_1, RES_2, RES_3, RES_4), };
+enum egpio_cfg { + EGPIO_CFG_BMSK = 0x1, + EGPIO_CFG_SHFT = 11, + EGPIO_CFG_EN = 12, +}; + +struct egpio { + gpio_t index; +}; + +int egpio_configure_all(void); + #endif /* _SOC_QUALCOMM_SC7280_GPIO_H_ */ diff --git a/src/soc/qualcomm/sc7280/sc7280_egpio.c b/src/soc/qualcomm/sc7280/sc7280_egpio.c new file mode 100644 index 0000000..1fdc1e8 --- /dev/null +++ b/src/soc/qualcomm/sc7280/sc7280_egpio.c @@ -0,0 +1,60 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <console/console.h> +#include <device/mmio.h> +#include <gpio.h> + +static struct egpio egpio_list[] = { + {GPIO(144)}, + {GPIO(145)}, + {GPIO(146)}, + {GPIO(147)}, + {GPIO(148)}, + {GPIO(149)}, + {GPIO(150)}, + {GPIO(151)}, + {GPIO(152)}, + {GPIO(153)}, + {GPIO(154)}, + {GPIO(155)}, + {GPIO(156)}, + {GPIO(157)}, + {GPIO(158)}, + {GPIO(159)}, + {GPIO(160)}, + {GPIO(161)}, + {GPIO(162)}, + {GPIO(163)}, + {GPIO(164)}, + {GPIO(165)}, + {GPIO(166)}, + {GPIO(167)}, + {GPIO(168)}, + {GPIO(169)}, + {GPIO(170)}, + {GPIO(171)}, + {GPIO(172)}, + {GPIO(173)}, + {GPIO(174)}, +}; + +int egpio_configure_all(void) +{ + struct tlmm_gpio *regs; + int idx; + + for (idx = 0; idx < ARRAY_SIZE(egpio_list); idx++) { + regs = (void *)(uintptr_t)egpio_list[idx].index.addr; + + if (!((read32(®s->cfg) >> EGPIO_CFG_SHFT) & + EGPIO_CFG_BMSK)) { + printk(BIOS_ERR, + "ERROR: eGPIO index %d is not a valid eGPIO\n", + idx); + continue; + } + setbits32(®s->cfg, BIT(EGPIO_CFG_EN)); + } + + return CB_SUCCESS; +}