summaryrefslogtreecommitdiff
path: root/src/soc/amd
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-08-03 03:15:27 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-09-08 00:15:30 +0000
commitf5658cf1a56d48683dc63b5998523e2e21169d10 (patch)
tree4733e7ac789b936c37de0097690ff2fd16e05d4b /src/soc/amd
parent029a4a0b88a9602e80aa35c5a6ba35e44f478d95 (diff)
soc/amd/common: move GPIO ACPIMMIO access functions to gpio_banks block
Since the raw GPIO MMIO register access is now only used inside the gpio_banks block, the gpio_read32 and gpio_write32 functions can be moved to that block to reduce the visibility and enforce the usage of the functions provided by the gpio_banks block. The iomux_read8 and iomux_write8 functions can't be easily moved to the gpio_banks block, since it's also used in the pre-SOC AMD chipsets that use the ACPIMMIO access functions directly. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: Ia0d6dea72c6bebbbe6ce545bedfc74f91e0042c4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/56781 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com> Reviewed-by: Jason Glenesk <jason.glenesk@amd.corp-partner.google.com>
Diffstat (limited to 'src/soc/amd')
-rw-r--r--src/soc/amd/common/block/gpio_banks/gpio.c16
-rw-r--r--src/soc/amd/common/block/include/amdblocks/acpimmio.h17
2 files changed, 16 insertions, 17 deletions
diff --git a/src/soc/amd/common/block/gpio_banks/gpio.c b/src/soc/amd/common/block/gpio_banks/gpio.c
index 018c61430e..fbeb38f717 100644
--- a/src/soc/amd/common/block/gpio_banks/gpio.c
+++ b/src/soc/amd/common/block/gpio_banks/gpio.c
@@ -15,6 +15,22 @@
#include <assert.h>
#include <string.h>
+/* MMIO access of new-style GPIO bank configuration registers */
+static inline void *gpio_ctrl_ptr(uint8_t gpio_num)
+{
+ return acpimmio_gpio0 + gpio_num * sizeof(uint32_t);
+}
+
+static inline uint32_t gpio_read32(uint8_t gpio_num)
+{
+ return read32(gpio_ctrl_ptr(gpio_num));
+}
+
+static inline void gpio_write32(uint8_t gpio_num, uint32_t value)
+{
+ write32(gpio_ctrl_ptr(gpio_num), value);
+}
+
static int get_gpio_gevent(gpio_t gpio, const struct soc_amd_event *table,
size_t items)
{
diff --git a/src/soc/amd/common/block/include/amdblocks/acpimmio.h b/src/soc/amd/common/block/include/amdblocks/acpimmio.h
index 9c007e7668..bf84a2564e 100644
--- a/src/soc/amd/common/block/include/amdblocks/acpimmio.h
+++ b/src/soc/amd/common/block/include/amdblocks/acpimmio.h
@@ -325,23 +325,6 @@ static inline void gpio_100_write8(uint8_t reg, uint8_t value)
write8(acpimmio_gpio_100 + reg, value);
}
-/* New GPIO banks configuration registers */
-
-static inline void *gpio_ctrl_ptr(uint8_t gpio_num)
-{
- return acpimmio_gpio0 + gpio_num * sizeof(uint32_t);
-}
-
-static inline uint32_t gpio_read32(uint8_t gpio_num)
-{
- return read32(gpio_ctrl_ptr(gpio_num));
-}
-
-static inline void gpio_write32(uint8_t gpio_num, uint32_t value)
-{
- write32(gpio_ctrl_ptr(gpio_num), value);
-}
-
static inline uint8_t xhci_pm_read8(uint8_t reg)
{
return read8(acpimmio_xhci_pm + reg);