[coreboot-gerrit] Change in coreboot[master]: google/gru: Add config for scarlet-derived boards

Ege Mihmanli (Code Review) gerrit at coreboot.org
Sat Nov 18 01:45:56 CET 2017


Hello Ege Mihmanli,

I'd like you to do a code review. Please visit

    https://review.coreboot.org/22517

to review the following change.


Change subject: google/gru: Add config for scarlet-derived boards
......................................................................

google/gru: Add config for scarlet-derived boards

There is merit in having new boards use the pinouts and controls
in scarlet. This adds a config so new scarlet-derived boards can
easily use scarlet structure without going through every file
and adding new logic.

TEST=Run "emerge-scarlet coreboot"
Signed-off-by: egemih at chromium.org
Change-Id: I5808f93f4563033ce93050e1eedb6eac2b52c3b3
---
M src/mainboard/google/gru/Kconfig
M src/mainboard/google/gru/board.h
M src/mainboard/google/gru/bootblock.c
M src/mainboard/google/gru/mainboard.c
M src/mainboard/google/gru/pwm_regulator.c
5 files changed, 27 insertions(+), 20 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/17/22517/1

diff --git a/src/mainboard/google/gru/Kconfig b/src/mainboard/google/gru/Kconfig
index 5eb35d4..3026c7e 100644
--- a/src/mainboard/google/gru/Kconfig
+++ b/src/mainboard/google/gru/Kconfig
@@ -35,6 +35,11 @@
 	default y if BOARD_GOOGLE_GRU || BOARD_GOOGLE_KEVIN || BOARD_GOOGLE_BOB
 	default n
 
+config GRU_BASEBOARD_SCARLET
+	bool
+	default y if BOARD_GOOGLE_SCARLET
+	default n
+
 config BOARD_SPECIFIC_OPTIONS
 	def_bool y
 	select BOARD_ID_AUTO
diff --git a/src/mainboard/google/gru/board.h b/src/mainboard/google/gru/board.h
index f95db57..d32d768 100644
--- a/src/mainboard/google/gru/board.h
+++ b/src/mainboard/google/gru/board.h
@@ -24,15 +24,15 @@
 #define GPIO_RESET	GPIO(0, B, 3)
 #define GPIO_SDMMC_PWR	GPIO(4, D, 5)
 
-#if IS_ENABLED(CONFIG_BOARD_GOOGLE_SCARLET)
+#if IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET)
 #define GPIO_BACKLIGHT	GPIO(4, C, 5)
 #define GPIO_EC_IN_RW	GPIO(0, A, 1)
 #define GPIO_EC_IRQ	GPIO(1, C, 2)
-#define GPIO_P15V_EN	dead_code_t(gpio_t, "PP1500 doesn't exist on Scarlet")
-#define GPIO_P18V_AUDIO_PWREN dead_code_t(gpio_t, "doesn't exist on Scarlet")
+#define GPIO_P15V_EN	dead_code_t(gpio_t, "PP1500 doesn't exist on board.")
+#define GPIO_P18V_AUDIO_PWREN dead_code_t(gpio_t, "doesn't exist on board.")
 #define GPIO_P30V_EN	GPIO(0, B, 1)
 #define GPIO_SPK_PA_EN	GPIO(0, A, 2)
-#define GPIO_TP_RST_L	dead_code_t(gpio_t, "don't need TP_RST_L on Scarlet")
+#define GPIO_TP_RST_L	dead_code_t(gpio_t, "don't need TP_RST_L on board.")
 #define GPIO_TPM_IRQ	GPIO(1, C, 1)
 #define GPIO_WP		GPIO(0, B, 5)
 #else
diff --git a/src/mainboard/google/gru/bootblock.c b/src/mainboard/google/gru/bootblock.c
index 162a7e5..a18a61c 100644
--- a/src/mainboard/google/gru/bootblock.c
+++ b/src/mainboard/google/gru/bootblock.c
@@ -44,8 +44,8 @@
 	 */
 	write32(&rk3399_grf->io_vsel, RK_SETBITS(1 << 0));
 
-	/* Scarlet gpio4cd iodomain is 1.8V */
-	if (IS_ENABLED(CONFIG_BOARD_GOOGLE_SCARLET))
+	/* Scarlet-based gpio4cd iodomain is 1.8V */
+	if (IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET))
 		write32(&rk3399_grf->io_vsel, RK_SETBITS(1 << 3));
 
 	/* Reconfigure GPIO1 from dynamic voltage selection through GPIO0_B1 to
@@ -56,7 +56,7 @@
 
 	/* Enable rails powering GPIO blocks, among other things. */
 	gpio_output(GPIO_P30V_EN, 1);
-	if (!IS_ENABLED(CONFIG_BOARD_GOOGLE_SCARLET))
+	if (!IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET))
 		gpio_output(GPIO_P15V_EN, 1);	/* Scarlet: EC-controlled */
 
 #if IS_ENABLED(CONFIG_DRIVERS_UART)
@@ -102,7 +102,7 @@
 	if (IS_ENABLED(CONFIG_GRU_HAS_TPM2)) {
 		rockchip_spi_init(CONFIG_DRIVER_TPM_SPI_BUS, 1500*KHz);
 
-		if (IS_ENABLED(CONFIG_BOARD_GOOGLE_SCARLET)) {
+		if (IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET)) {
 			gpio_input(GPIO(2, B, 1));	/* SPI2_MISO no-pull */
 			gpio_input(GPIO(2, B, 2));	/* SPI2_MOSI no-pull */
 			gpio_input(GPIO(2, B, 3));	/* SPI2_CLK no-pull */
diff --git a/src/mainboard/google/gru/mainboard.c b/src/mainboard/google/gru/mainboard.c
index 3721ce8..99b335a 100644
--- a/src/mainboard/google/gru/mainboard.c
+++ b/src/mainboard/google/gru/mainboard.c
@@ -34,7 +34,8 @@
 
 /*
  * We have to drive the stronger pull-up within 1 second of powering up the
- * touchpad to prevent its firmware from falling into recovery. Not on Scarlet.
+ * touchpad to prevent its firmware from falling into recovery. Not on
+ * Scarlet-based boards.
  */
 static void configure_touchpad(void)
 {
@@ -90,9 +91,10 @@
 	 * with highest voltage first.
 	 * Since register_bl31() appends to the front of the list, we need to
 	 * register them backwards, with 1.5V coming first.
-	 * 1.5V and 1.8V are EC-controlled on Scarlet, so we skip them.
+	 * 1.5V and 1.8V are EC-controlled on Scarlet derivatives,
+	 * so we skip them.
 	 */
-	if (!IS_ENABLED(CONFIG_BOARD_GOOGLE_SCARLET)) {
+	if (!IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET)) {
 		static struct bl31_gpio_param param_p15_en = {
 			.h = { .type = PARAM_SUSPEND_GPIO },
 			.gpio = { .polarity = BL31_GPIO_LEVEL_LOW },
@@ -159,7 +161,7 @@
 	gpio_output(GPIO(2, A, 2), 1);  /* SDMMC_SDIO_PWR_EN */
 
 	/* set SDMMC_DET_L pin */
-	if (IS_ENABLED(CONFIG_BOARD_GOOGLE_SCARLET))
+	if (IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET))
 		/*
 		 * do not have external pull up, so need to
 		 * set this pin internal pull up
@@ -170,10 +172,10 @@
 
 	/*
 	 * Keep sd card io domain 3v
-	 * In Scarlet this GPIO set to high will get 3v,
+	 * In Scarlet derivatives, this GPIO set to high will get 3v,
 	 * With other board variants setting this GPIO low results in 3V.
 	 */
-	if (IS_ENABLED(CONFIG_BOARD_GOOGLE_SCARLET))
+	if (IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET))
 		gpio_output(GPIO(2, D, 4), 1);
 	else
 		gpio_output(GPIO(2, D, 4), 0);
@@ -226,7 +228,7 @@
 	/* AUDIO IO domain 1.8V voltage selection */
 	write32(&rk3399_grf->io_vsel, RK_SETBITS(1 << 1));
 
-	if (!IS_ENABLED(CONFIG_BOARD_GOOGLE_SCARLET))
+	if (!IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET))
 		gpio_output(GPIO_P18V_AUDIO_PWREN, 1);
 	gpio_output(GPIO_SPK_PA_EN, 0);
 
@@ -235,7 +237,7 @@
 
 static void configure_display(void)
 {
-	if (IS_ENABLED(CONFIG_BOARD_GOOGLE_SCARLET)) {
+	if (IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET)) {
 		gpio_output(GPIO(4, D, 1), 0);	/* DISPLAY_RST_L */
 		gpio_output(GPIO(4, D, 3), 1);	/* PPVARP_LCD */
 		mdelay(10);
@@ -340,7 +342,7 @@
 	setup_usb(0);
 	if (IS_ENABLED(CONFIG_GRU_HAS_WLAN_RESET))
 		assert_wifi_reset();
-	if (!IS_ENABLED(CONFIG_BOARD_GOOGLE_SCARLET)) {
+	if (!IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET)) {
 		configure_touchpad();		/* Scarlet: works differently */
 		setup_usb(1);			/* Scarlet: only one USB port */
 	}
diff --git a/src/mainboard/google/gru/pwm_regulator.c b/src/mainboard/google/gru/pwm_regulator.c
index 6a9f171..3ea37cf 100644
--- a/src/mainboard/google/gru/pwm_regulator.c
+++ b/src/mainboard/google/gru/pwm_regulator.c
@@ -48,7 +48,7 @@
 	[PWM_REGULATOR_CENTERLOG] = {7994, 10499}
 };
 
-/* Applies for Scarlet */
+/* Applies for Scarlet-based boards. */
 int scarlet_pwm_design_voltage[][2] = {
 	[PWM_REGULATOR_GPU] = {7996, 10990},
 	[PWM_REGULATOR_BIG] = {8000, 12992},
@@ -63,7 +63,7 @@
 #else
 	[PWM_REGULATOR_CENTERLOG] = -1,
 #endif
-#if IS_ENABLED(CONFIG_BOARD_GOOGLE_SCARLET)
+#if IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET)
 	[PWM_REGULATOR_BIG] = 3,
 #else
 	[PWM_REGULATOR_BIG] = 1,
@@ -85,7 +85,7 @@
 	} else if (IS_ENABLED(CONFIG_BOARD_GOOGLE_KEVIN) && board_id() >= 6) {
 		voltage_min = kevin6_pwm_design_voltage[pwm][0];
 		voltage_max = kevin6_pwm_design_voltage[pwm][1];
-	} else if (IS_ENABLED(CONFIG_BOARD_GOOGLE_SCARLET)) {
+	} else if (IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET)) {
 		voltage_min = scarlet_pwm_design_voltage[pwm][0];
 		voltage_max = scarlet_pwm_design_voltage[pwm][1];
 	}

-- 
To view, visit https://review.coreboot.org/22517
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5808f93f4563033ce93050e1eedb6eac2b52c3b3
Gerrit-Change-Number: 22517
Gerrit-PatchSet: 1
Gerrit-Owner: Ege Mihmanli <egemih at google.com>
Gerrit-Reviewer: Ege Mihmanli <egemih at chromium.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20171118/0ebd03a1/attachment-0001.html>


More information about the coreboot-gerrit mailing list