[coreboot-gerrit] Patch set updated for coreboot: b76bfb5 ARM: when setting a GPIO to put, set the value, then the direction

Gabe Black (gabeblack@chromium.org) gerrit at coreboot.org
Wed Jul 10 11:36:13 CEST 2013


Gabe Black (gabeblack at chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3679

-gerrit

commit b76bfb542c90238f6902ffb7fdcbce683fdea439
Author: Ronald G. Minnich <rminnich at google.com>
Date:   Tue Jun 18 13:02:23 2013 -0700

    ARM: when setting a GPIO to put, set the value, then the direction
    
    We saw a problem on x86 last year in which setting direction, then value,
    glitched the output and caused problems. Change this code to set the output,
    then the direction.
    
    Change-Id: I3e1e17ffe82ae270eea539530368a58c6cfe0ebe
    Signed-off-by: Ronald G. Minnich <rminnich at google.com>
    Signed-off-by: Gabe Black <gabeblack at chromium.org>
---
 src/cpu/samsung/exynos5250/gpio.c | 4 ++--
 src/cpu/samsung/exynos5420/gpio.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/cpu/samsung/exynos5250/gpio.c b/src/cpu/samsung/exynos5250/gpio.c
index b8ebb0a..2a93328 100644
--- a/src/cpu/samsung/exynos5250/gpio.c
+++ b/src/cpu/samsung/exynos5250/gpio.c
@@ -170,14 +170,14 @@ int gpio_direction_output(unsigned gpio, int value)
 	unsigned int val;
 	struct gpio_bank *bank = gpio_get_bank(gpio);
 
-	gpio_cfg_pin(gpio, GPIO_OUTPUT);
-
 	val = readl(&bank->dat);
 	val &= ~DAT_MASK(GPIO_BIT(gpio));
 	if (value)
 		val |= DAT_SET(GPIO_BIT(gpio));
 	writel(val, &bank->dat);
 
+	gpio_cfg_pin(gpio, GPIO_OUTPUT);
+
 	return 0;
 }
 
diff --git a/src/cpu/samsung/exynos5420/gpio.c b/src/cpu/samsung/exynos5420/gpio.c
index b8ebb0a..2a93328 100644
--- a/src/cpu/samsung/exynos5420/gpio.c
+++ b/src/cpu/samsung/exynos5420/gpio.c
@@ -170,14 +170,14 @@ int gpio_direction_output(unsigned gpio, int value)
 	unsigned int val;
 	struct gpio_bank *bank = gpio_get_bank(gpio);
 
-	gpio_cfg_pin(gpio, GPIO_OUTPUT);
-
 	val = readl(&bank->dat);
 	val &= ~DAT_MASK(GPIO_BIT(gpio));
 	if (value)
 		val |= DAT_SET(GPIO_BIT(gpio));
 	writel(val, &bank->dat);
 
+	gpio_cfg_pin(gpio, GPIO_OUTPUT);
+
 	return 0;
 }
 



More information about the coreboot-gerrit mailing list