aboutsummaryrefslogtreecommitdiff
path: root/src/soc/amd/common/block/include/amdblocks/gpio_banks.h
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2020-08-17 16:22:09 -0600
committerPatrick Georgi <pgeorgi@google.com>2020-08-19 07:16:23 +0000
commite05f4dc7d448137324eb9f638a285f3727fb4690 (patch)
tree5c44eeefc7329f72f20c76ef01d6d0d920493650 /src/soc/amd/common/block/include/amdblocks/gpio_banks.h
parente21698bcb7369bdbe6f1ee1c7acef80ade0af830 (diff)
soc/amd/common: add gpio subsystem event reporting
In order to log gpio events for wake purposes the state of the gpio subsystem should be snapshotted. Add the ability to capture state of gpio subystem as well as saving up to 16 gpios that indicate their wake status. Likewise, provide the eventlog additions based on state. BUG=b:159947207 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Change-Id: I49fca56c87543aa8aad0eb7da5c5cb570c4349d5 Reviewed-on: https://review.coreboot.org/c/coreboot/+/44534 Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/amd/common/block/include/amdblocks/gpio_banks.h')
-rw-r--r--src/soc/amd/common/block/include/amdblocks/gpio_banks.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/soc/amd/common/block/include/amdblocks/gpio_banks.h b/src/soc/amd/common/block/include/amdblocks/gpio_banks.h
index fdcd0f8ae4..b1663cf374 100644
--- a/src/soc/amd/common/block/include/amdblocks/gpio_banks.h
+++ b/src/soc/amd/common/block/include/amdblocks/gpio_banks.h
@@ -20,6 +20,23 @@ struct soc_amd_event {
#define GPIO_MASTER_SWITCH 0xFC
#define GPIO_MASK_STS_EN BIT(28)
#define GPIO_INTERRUPT_EN BIT(30)
+#define GPIO_WAKE_EN BIT(31)
+
+#define GPIO_WAKE_STAT_0 0x2F0
+#define GPIO_WAKE_STAT_1 0x2F4
+struct gpio_wake_state {
+ uint32_t control_switch;
+ uint32_t wake_stat[2];
+ /* Number of wake_gpio with a valid setting. */
+ uint32_t num_valid_wake_gpios;
+ /* GPIO index number that caused a wake. */
+ uint8_t wake_gpios[16];
+};
+
+/* Fill gpio_wake_state object for future event reporting. */
+void gpio_fill_wake_state(struct gpio_wake_state *state);
+/* Add gpio events to the eventlog. */
+void gpio_add_events(const struct gpio_wake_state *state);
#define GPIO_PIN_IN (1 << 0) /* for byte access */
#define GPIO_PIN_OUT (1 << 6) /* for byte access */