[coreboot-gerrit] Change in coreboot[master]: soc/amd/stoneyridge: Add gpio_interrupt_status

Chris Ching (Code Review) gerrit at coreboot.org
Tue Feb 6 20:38:42 CET 2018


Chris Ching has uploaded this change for review. ( https://review.coreboot.org/23625


Change subject: soc/amd/stoneyridge: Add gpio_interrupt_status
......................................................................

soc/amd/stoneyridge: Add gpio_interrupt_status

BUG=b:72838769
BRANCH=none
TEST=read interrupt and check is cleared on grunt TPM

Change-Id: I7ed76eaf56338a314a8d0ee6faad1ab8dbf8dfb0
Signed-off-by: Chris Ching <chingcodes at chromium.org>
---
M src/soc/amd/stoneyridge/gpio.c
M src/soc/amd/stoneyridge/include/soc/gpio.h
2 files changed, 20 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/25/23625/1

diff --git a/src/soc/amd/stoneyridge/gpio.c b/src/soc/amd/stoneyridge/gpio.c
index ec02c99..d1ffc39 100644
--- a/src/soc/amd/stoneyridge/gpio.c
+++ b/src/soc/amd/stoneyridge/gpio.c
@@ -117,3 +117,19 @@
 
 	write32((void *)gpio_address, reg | flags);
 }
+
+int gpio_interrupt_status(gpio_t gpio)
+{
+	uint32_t reg;
+	uintptr_t gpio_address = gpio_get_address(gpio);
+
+	reg = read32((void *)gpio_address);
+
+	if (reg & GPIO_INT_STATUS) {
+		/* Clear the status bit. */
+		write32((void *)gpio_address, reg);
+		return 1;
+	}
+
+	return 0;
+}
diff --git a/src/soc/amd/stoneyridge/include/soc/gpio.h b/src/soc/amd/stoneyridge/include/soc/gpio.h
index 63f6dfa..8b00976 100644
--- a/src/soc/amd/stoneyridge/include/soc/gpio.h
+++ b/src/soc/amd/stoneyridge/include/soc/gpio.h
@@ -158,5 +158,9 @@
 /* Configure the gpio with specific flags. */
 void gpio_set_config(gpio_t gpio, uint32_t flags);
 
+
+/* Return the interrupt status and clear if set. */
+int gpio_interrupt_status(gpio_t gpio);
+
 #endif /* __ACPI__ */
 #endif /* __STONEYRIDGE_GPIO_H__ */

-- 
To view, visit https://review.coreboot.org/23625
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7ed76eaf56338a314a8d0ee6faad1ab8dbf8dfb0
Gerrit-Change-Number: 23625
Gerrit-PatchSet: 1
Gerrit-Owner: Chris Ching <chingcodes at chromium.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180206/92b52936/attachment.html>


More information about the coreboot-gerrit mailing list