From e35e2e7867607520fa242d4f7d1b0b0e96fa959a Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Fri, 26 Sep 2014 17:48:28 -0700 Subject: rk3288: Add GPIO() macro The static gpio_t initializers are stylish, but they are still a little too annoying to write and read in day-to-day use. Let's wrap that in a macro to make it a little easier to handle. BUG=None TEST=None Change-Id: If41b2b3fd3c3f94797d314ba5f3ffcb2a250a005 Signed-off-by: Patrick Georgi Original-Commit-Id: 102a5c0a800f43d688d11d1d7bbc51e360341517 Original-Change-Id: I385ae5182776c8cbb20bbf3c79b986628040f1cf Original-Signed-off-by: Julius Werner Original-Reviewed-on: https://chromium-review.googlesource.com/220250 Original-Reviewed-by: David Hendricks Reviewed-on: http://review.coreboot.org/9052 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Stefan Reinauer --- src/mainboard/google/veyron_pinky/chromeos.c | 8 ++++---- src/mainboard/google/veyron_pinky/mainboard.c | 20 ++++++++++---------- src/mainboard/google/veyron_pinky/reset.c | 2 +- src/mainboard/google/veyron_pinky/sdram_configs.c | 8 ++++---- 4 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/mainboard') 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 #include -#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) { -- cgit v1.2.3