summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainboard/google/veyron_pinky/chromeos.c8
-rw-r--r--src/mainboard/google/veyron_pinky/mainboard.c20
-rw-r--r--src/mainboard/google/veyron_pinky/reset.c2
-rw-r--r--src/mainboard/google/veyron_pinky/sdram_configs.c8
-rw-r--r--src/soc/rockchip/rk3288/gpio.h2
5 files changed, 21 insertions, 19 deletions
diff --git a/src/mainboard/google/veyron_pinky/chromeos.c b/src/mainboard/google/veyron_pinky/chromeos.c
index 4e1e50cc47..50dc4947dc 100644
--- a/src/mainboard/google/veyron_pinky/chromeos.c
+++ b/src/mainboard/google/veyron_pinky/chromeos.c
@@ -25,10 +25,10 @@
#include <vendorcode/google/chromeos/chromeos.h>
#include <soc/rockchip/rk3288/gpio.h>
-#define GPIO_WP (gpio_t){.port = 7, .bank = GPIO_A, .idx = 6}
-#define GPIO_LID (gpio_t){.port = 7, .bank = GPIO_B, .idx = 5}
-#define GPIO_POWER (gpio_t){.port = 0, .bank = GPIO_A, .idx = 5}
-#define GPIO_RECOVERY (gpio_t){.port = 0, .bank = GPIO_B, .idx = 1}
+#define GPIO_WP GPIO(7, A, 6)
+#define GPIO_LID GPIO(7, B, 5)
+#define GPIO_POWER GPIO(0, A, 5)
+#define GPIO_RECOVERY GPIO(0, B, 1)
void setup_chromeos_gpios(void)
{
diff --git a/src/mainboard/google/veyron_pinky/mainboard.c b/src/mainboard/google/veyron_pinky/mainboard.c
index d3537bf093..4d647d3e09 100644
--- a/src/mainboard/google/veyron_pinky/mainboard.c
+++ b/src/mainboard/google/veyron_pinky/mainboard.c
@@ -39,16 +39,16 @@
static void setup_gpio(void)
{
/*SOC and TPM reset GPIO, active high.*/
- gpio_output((gpio_t){.port = 0, .bank = GPIO_B, .idx = 2}, 0);
+ gpio_output(GPIO(0, B, 2), 0);
/* Configure GPIO for lcd_bl_en */
- gpio_output((gpio_t){.port = 7, .bank = GPIO_A, .idx = 2}, 1);
+ gpio_output(GPIO(7, A, 2), 1);
/*Configure backlight PWM 100% brightness*/
- gpio_output((gpio_t){.port = 7, .bank = GPIO_A, .idx = 0}, 0);
+ gpio_output(GPIO(7, A, 0), 0);
/* Configure GPIO for lcd_en */
- gpio_output((gpio_t){.port = 7, .bank = GPIO_B, .idx = 7}, 1);
+ gpio_output(GPIO(7, B, 7), 1);
}
static void setup_iomux(void)
@@ -76,22 +76,22 @@ static void setup_iomux(void)
static void setup_usb_poweron(void)
{
/* Configure GPIO for usb1_pwr_en */
- gpio_output((gpio_t){.port = 0, .bank = GPIO_B, .idx = 3}, 1);
+ gpio_output(GPIO(0, B, 3), 1);
/* Configure GPIO for usb2_pwr_en */
- gpio_output((gpio_t){.port = 0, .bank = GPIO_B, .idx = 4}, 1);
+ gpio_output(GPIO(0, B, 4), 1);
/* Configure GPIO for 5v_drv */
- gpio_output((gpio_t){.port = 7, .bank = GPIO_B, .idx = 3}, 1);
+ gpio_output(GPIO(7, B, 3), 1);
}
static void configure_sdmmc(void)
{
/* Configure GPIO for sd_en */
- gpio_output((gpio_t){.port = 7, .bank = GPIO_C, .idx = 5}, 1);
+ gpio_output(GPIO(7, C, 5), 1);
/* Configure GPIO for sd_detec */
- gpio_input_pullup((gpio_t){.port = 7, .bank = GPIO_A, .idx = 5});
+ gpio_input_pullup(GPIO(7, A, 5));
/*use sdmmc0 io, disable JTAG function*/
writel(RK_CLRBITS(1 << 12), &rk3288_grf->soc_con0);
@@ -100,7 +100,7 @@ static void configure_sdmmc(void)
static void configure_emmc(void)
{
/* Configure GPIO for emmc_pwrctrl */
- gpio_output((gpio_t){.port = 7, .bank = GPIO_B, .idx = 4}, 1);
+ gpio_output(GPIO(7, B, 4), 1);
}
static void configure_i2s(void)
diff --git a/src/mainboard/google/veyron_pinky/reset.c b/src/mainboard/google/veyron_pinky/reset.c
index fa90f549bd..d769665a9e 100644
--- a/src/mainboard/google/veyron_pinky/reset.c
+++ b/src/mainboard/google/veyron_pinky/reset.c
@@ -23,6 +23,6 @@
void hard_reset(void)
{
- gpio_output((gpio_t){.port = 0, .bank = GPIO_B, .idx = 2}, 1);
+ gpio_output(GPIO(0, B, 2), 1);
while (1);
}
diff --git a/src/mainboard/google/veyron_pinky/sdram_configs.c b/src/mainboard/google/veyron_pinky/sdram_configs.c
index b3600fbfff..21a483ce73 100644
--- a/src/mainboard/google/veyron_pinky/sdram_configs.c
+++ b/src/mainboard/google/veyron_pinky/sdram_configs.c
@@ -42,10 +42,10 @@ static struct rk3288_sdram_params sdram_configs[] = {
#include "sdram_inf/sdram-unused.inc" /* ram_code = 1111 */
};
-#define GPIO_RAMCODE0 (gpio_t){.port = 8, .bank = GPIO_A, .idx = 0}
-#define GPIO_RAMCODE1 (gpio_t){.port = 8, .bank = GPIO_A, .idx = 1}
-#define GPIO_RAMCODE2 (gpio_t){.port = 8, .bank = GPIO_A, .idx = 2}
-#define GPIO_RAMCODE3 (gpio_t){.port = 8, .bank = GPIO_A, .idx = 3}
+#define GPIO_RAMCODE0 GPIO(8, A, 0)
+#define GPIO_RAMCODE1 GPIO(8, A, 1)
+#define GPIO_RAMCODE2 GPIO(8, A, 2)
+#define GPIO_RAMCODE3 GPIO(8, A, 3)
u32 sdram_get_ram_code(void)
{
diff --git a/src/soc/rockchip/rk3288/gpio.h b/src/soc/rockchip/rk3288/gpio.h
index 6cac6cbdec..7049ddffe2 100644
--- a/src/soc/rockchip/rk3288/gpio.h
+++ b/src/soc/rockchip/rk3288/gpio.h
@@ -23,6 +23,8 @@
#include "addressmap.h"
#include "grf.h"
+#define GPIO(p, b, i) ((gpio_t){.port = p, .bank = GPIO_##b, .idx = i})
+
struct rk3288_gpio_regs {
u32 swporta_dr;
u32 swporta_ddr;