summaryrefslogtreecommitdiff
path: root/src/mainboard/google/veyron_pinky
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2014-09-24 15:40:49 -0700
committerPatrick Georgi <pgeorgi@google.com>2015-04-10 11:57:33 +0200
commiteaa9c4596b083ee1d1a48c5e7632abdb5b7e5297 (patch)
treed3294fcdf788dbd85f84e4fc2806d1443cf575f7 /src/mainboard/google/veyron_pinky
parente9e0eec4faa46ff3879c3350000c4a20b9053270 (diff)
downloadcoreboot-eaa9c4596b083ee1d1a48c5e7632abdb5b7e5297.tar.xz
gpio: Extend common GPIO header, simplify function names
We've had gpiolib.h which defines a few common GPIO access functions for a while, but it wasn't really complete. This patch adds the missing gpio_output() function, and also renames the unwieldy gpio_get_in_value() and gpio_set_out_value() to the much easier to handle gpio_get() and gpio_set(). The header is renamed to the simpler gpio.h while we're at it (there was never really anything "lib" about it, and it was presumably just chosen due to the IPQ806x include/ conflict problem that is now resolved). It also moves the definition of gpio_t into SoC-specific code, so that different implementations are free to encode their platform-specific GPIO parameters in those 4 bytes in the most convenient way (such as the rk3288 with a bitfield struct). Every SoC intending to use this common API should supply a <soc/gpio.h> that typedefs gpio_t to a type at most 4 bytes in length. Files accessing the API only need to include <gpio.h> which may pull in additional things (like a gpio_t creation macro) from <soc/gpio.h> on its own. For now the API is still only used on non-x86 SoCs. Whether it makes sense to expand it to x86 as well should be separately evaluated at a later point (by someone who understands those systems better). Also, Exynos retains its old, incompatible GPIO API even though it would be a prime candidate, because it's currently just not worth the effort. BUG=None TEST=Compiled on Daisy, Peach_Pit, Nyan_Blaze, Rush_Ryu, Storm and Veyron_Pinky. Change-Id: Ieee77373c2bd13d07ece26fa7f8b08be324842fe Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 9e04902ada56b929e3829f2c3b4aeb618682096e Original-Change-Id: I6c1e7d1e154d9b02288aabedb397e21e1aadfa15 Original-Signed-off-by: Julius Werner <jwerner@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/220975 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/9400 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/mainboard/google/veyron_pinky')
-rw-r--r--src/mainboard/google/veyron_pinky/board.h2
-rw-r--r--src/mainboard/google/veyron_pinky/boardid.c4
-rw-r--r--src/mainboard/google/veyron_pinky/chromeos.c12
-rw-r--r--src/mainboard/google/veyron_pinky/mainboard.c6
-rw-r--r--src/mainboard/google/veyron_pinky/reset.c2
-rw-r--r--src/mainboard/google/veyron_pinky/sdram_configs.c10
6 files changed, 18 insertions, 18 deletions
diff --git a/src/mainboard/google/veyron_pinky/board.h b/src/mainboard/google/veyron_pinky/board.h
index 8d452c8a89..73eb5efc44 100644
--- a/src/mainboard/google/veyron_pinky/board.h
+++ b/src/mainboard/google/veyron_pinky/board.h
@@ -21,7 +21,7 @@
#define __MAINBOARD_GOOGLE_VEYRON_PINKY_BOARD_H
#include <boardid.h>
-#include <soc/gpio.h>
+#include <gpio.h>
#define PMIC_BUS 0
diff --git a/src/mainboard/google/veyron_pinky/boardid.c b/src/mainboard/google/veyron_pinky/boardid.c
index 01e92a3d32..d8f4a3d7f7 100644
--- a/src/mainboard/google/veyron_pinky/boardid.c
+++ b/src/mainboard/google/veyron_pinky/boardid.c
@@ -19,7 +19,7 @@
#include <boardid.h>
#include <console/console.h>
-#include <soc/gpio.h>
+#include <gpio.h>
#include <stdlib.h>
uint8_t board_id(void)
@@ -38,7 +38,7 @@ uint8_t board_id(void)
id = 0;
for (i = 0; i < ARRAY_SIZE(pins); i++) {
gpio_input(pins[i]);
- id |= gpio_get_in_value(pins[i]) << i;
+ id |= gpio_get(pins[i]) << i;
}
printk(BIOS_SPEW, "Board ID: %#x.\n", id);
}
diff --git a/src/mainboard/google/veyron_pinky/chromeos.c b/src/mainboard/google/veyron_pinky/chromeos.c
index 30cd277623..dc224a5a2f 100644
--- a/src/mainboard/google/veyron_pinky/chromeos.c
+++ b/src/mainboard/google/veyron_pinky/chromeos.c
@@ -21,7 +21,7 @@
#include <console/console.h>
#include <ec/google/chromeec/ec.h>
#include <ec/google/chromeec/ec_commands.h>
-#include <soc/gpio.h>
+#include <gpio.h>
#include <string.h>
#include <vendorcode/google/chromeos/chromeos.h>
@@ -47,7 +47,7 @@ void fill_lb_gpios(struct lb_gpios *gpios)
/* Write Protect: active low */
gpios->gpios[count].port = GPIO_WP.raw;
gpios->gpios[count].polarity = ACTIVE_LOW;
- gpios->gpios[count].value = gpio_get_in_value(GPIO_WP);
+ gpios->gpios[count].value = gpio_get(GPIO_WP);
strncpy((char *)gpios->gpios[count].name, "write protect",
GPIO_MAX_NAME_LENGTH);
count++;
@@ -63,14 +63,14 @@ void fill_lb_gpios(struct lb_gpios *gpios)
/* Lid: active high */
gpios->gpios[count].port = GPIO_LID.raw;
gpios->gpios[count].polarity = ACTIVE_HIGH;
- gpios->gpios[count].value = gpio_get_in_value(GPIO_LID);
+ gpios->gpios[count].value = gpio_get(GPIO_LID);
strncpy((char *)gpios->gpios[count].name, "lid", GPIO_MAX_NAME_LENGTH);
count++;
/* Power:GPIO active high */
gpios->gpios[count].port = GPIO_POWER.raw;
gpios->gpios[count].polarity = ACTIVE_HIGH;
- gpios->gpios[count].value = gpio_get_in_value(GPIO_POWER);
+ gpios->gpios[count].value = gpio_get(GPIO_POWER);
strncpy((char *)gpios->gpios[count].name, "power",
GPIO_MAX_NAME_LENGTH);
count++;
@@ -99,7 +99,7 @@ int get_recovery_mode_switch(void)
uint32_t ec_events;
/* The GPIO is active low. */
- if (!gpio_get_in_value(GPIO_RECOVERY))
+ if (!gpio_get(GPIO_RECOVERY))
return 1;
ec_events = google_chromeec_get_events_b();
@@ -109,6 +109,6 @@ int get_recovery_mode_switch(void)
int get_write_protect_state(void)
{
- return !gpio_get_in_value(GPIO_WP);
+ return !gpio_get(GPIO_WP);
}
diff --git a/src/mainboard/google/veyron_pinky/mainboard.c b/src/mainboard/google/veyron_pinky/mainboard.c
index a8cc3c3aa4..2442472b67 100644
--- a/src/mainboard/google/veyron_pinky/mainboard.c
+++ b/src/mainboard/google/veyron_pinky/mainboard.c
@@ -19,13 +19,13 @@
#include <arch/cache.h>
#include <arch/io.h>
+#include <boot/coreboot_tables.h>
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
-#include <edid.h>
-#include <boot/coreboot_tables.h>
#include <device/i2c.h>
-#include <soc/gpio.h>
+#include <edid.h>
+#include <gpio.h>
#include <soc/grf.h>
#include <soc/soc.h>
#include <soc/pmu.h>
diff --git a/src/mainboard/google/veyron_pinky/reset.c b/src/mainboard/google/veyron_pinky/reset.c
index a2777f86d6..9cbe9c1551 100644
--- a/src/mainboard/google/veyron_pinky/reset.c
+++ b/src/mainboard/google/veyron_pinky/reset.c
@@ -18,7 +18,7 @@
*/
#include <arch/io.h>
-#include <soc/gpio.h>
+#include <gpio.h>
#include <reset.h>
#include "board.h"
diff --git a/src/mainboard/google/veyron_pinky/sdram_configs.c b/src/mainboard/google/veyron_pinky/sdram_configs.c
index 1a331cebef..a58c6dd3d3 100644
--- a/src/mainboard/google/veyron_pinky/sdram_configs.c
+++ b/src/mainboard/google/veyron_pinky/sdram_configs.c
@@ -18,8 +18,8 @@
*/
#include <arch/io.h>
#include <console/console.h>
+#include <gpio.h>
#include <soc/sdram.h>
-#include <soc/gpio.h>
#include <string.h>
#include <types.h>
@@ -56,10 +56,10 @@ u32 sdram_get_ram_code(void)
gpio_input(GPIO_RAMCODE2);
gpio_input(GPIO_RAMCODE3);
- code = gpio_get_in_value(GPIO_RAMCODE3) << 3
- | gpio_get_in_value(GPIO_RAMCODE2) << 2
- | gpio_get_in_value(GPIO_RAMCODE1) << 1
- | gpio_get_in_value(GPIO_RAMCODE0) << 0;
+ code = gpio_get(GPIO_RAMCODE3) << 3
+ | gpio_get(GPIO_RAMCODE2) << 2
+ | gpio_get(GPIO_RAMCODE1) << 1
+ | gpio_get(GPIO_RAMCODE0) << 0;
return code;
}