Arthur Heymans (arthur(a)aheymans.xyz) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16354
-gerrit
commit 2ad79277540545a6ab37995d72c3a578d77f5f13
Author: Arthur Heymans <arthur(a)aheymans.xyz>
Date: Tue Aug 30 13:42:33 2016 +0200
[UNTESTED] lenovo/T400: correct GPIO for hybrid driver
Currently the hybrid driver uses GPIO 52 to configure mux. This is not
the right GPIO on the T400 according to the schematics "MALIBU-3 EXT".
It should be GPIO22.
The polarities on the gpio's are also set differently on Lenovo T400.
On the Lenovo T400 HIGH on GPIO22 means enable.
Previously also gpio 49 (GFX_PWR_EN) and 19 (BKLT_CTRL_SEL),
were configured for hybrid graphics to work on T400,
but this was reverted in 14d1a93e: "Revert mainboard/lenovo/t400:
Add initial hybrid graphics support".
This patch sets those gpios correctly again for the Lenovo T400.
Change-Id: I3167303abeb6b3711d53508c61a340d03b1e050a
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
src/drivers/lenovo/Kconfig | 5 +++++
src/drivers/lenovo/hybrid_graphics.c | 19 +++++++++++++++++--
src/mainboard/lenovo/t400/Kconfig | 16 ++++++++++++++++
3 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/src/drivers/lenovo/Kconfig b/src/drivers/lenovo/Kconfig
index 38b86da..4c62de1 100644
--- a/src/drivers/lenovo/Kconfig
+++ b/src/drivers/lenovo/Kconfig
@@ -39,3 +39,8 @@ config HYBRID_GRAPHICS_GPIO_NUM
help
Set a default GPIO that sets the panel LVDS signal routing to
integrated or discrete GPU.
+
+config ENABLE_DISCRETE_IS_HIGH
+ depends on DRIVERS_LENOVO_HYBRID_GRAPHICS
+ bool
+ default n
diff --git a/src/drivers/lenovo/hybrid_graphics.c b/src/drivers/lenovo/hybrid_graphics.c
index 9b46646..1560eb7 100644
--- a/src/drivers/lenovo/hybrid_graphics.c
+++ b/src/drivers/lenovo/hybrid_graphics.c
@@ -43,9 +43,18 @@
static void hybrid_graphics_disable_peg(struct device *dev)
{
struct device *peg_dev;
+ u8 disable_lvl = CONFIG_ENABLE_DISCRETE_IS_HIGH ?
+ GPIO_LEVEL_LOW : GPIO_LEVEL_HIGH;
/* connect LVDS interface to iGPU */
- set_gpio(CONFIG_HYBRID_GRAPHICS_GPIO_NUM, GPIO_LEVEL_HIGH);
+ set_gpio(CONFIG_HYBRID_GRAPHICS_GPIO_NUM, disable_lvl);
+ /* configure BKLT_CTL */
+ if (CONFIG_BKLT_CTRL_SEL_GPIO)
+ set_gpio(CONFIG_BKLT_CTRL_SEL_GPIO, disable_lvl);
+ /* configure GFX_PWR_EN_GPIO */
+ if (CONFIG_GFX_PWR_EN_GPIO)
+ set_gpio(CONFIG_GFX_PWR_EN_GPIO, disable_lvl);
+
printk(BIOS_DEBUG, "Hybrid graphics: Switching panel to integrated GPU.\n");
dev->enabled = 0;
@@ -62,13 +71,19 @@ static void hybrid_graphics_disable_peg(struct device *dev)
static void hybrid_graphics_enable_peg(struct device *dev)
{
u8 hybrid_graphics_mode;
+ u8 enable_lvl = CONFIG_ENABLE_DISCRETE_IS_HIGH ?
+ GPIO_LEVEL_HIGH : GPIO_LEVEL_LOW;
hybrid_graphics_mode = HYBRID_GRAPHICS_INTEGRATED;
get_option(&hybrid_graphics_mode, "hybrid_graphics_mode");
if (hybrid_graphics_mode == HYBRID_GRAPHICS_DISCRETE) {
/* connect LVDS interface to dGPU */
- set_gpio(CONFIG_HYBRID_GRAPHICS_GPIO_NUM, GPIO_LEVEL_LOW);
+ set_gpio(CONFIG_HYBRID_GRAPHICS_GPIO_NUM, enable_lvl);
+ if (CONFIG_BKLT_CTRL_SEL_GPIO)
+ set_gpio(CONFIG_BKLT_CTRL_SEL_GPIO, enable_lvl);
+ if (CONFIG_GFX_PWR_EN_GPIO)
+ set_gpio(CONFIG_GFX_PWR_EN_GPIO, enable_lvl);
printk(BIOS_DEBUG, "Hybrid graphics: Switching panel to discrete GPU.\n");
dev->enabled = 1;
diff --git a/src/mainboard/lenovo/t400/Kconfig b/src/mainboard/lenovo/t400/Kconfig
index a444bf8..a136dd0 100644
--- a/src/mainboard/lenovo/t400/Kconfig
+++ b/src/mainboard/lenovo/t400/Kconfig
@@ -56,4 +56,20 @@ config ONBOARD_VGA_IS_PRIMARY
bool
default y
+config HYBRID_GRAPHICS_GPIO_NUM
+ int
+ default 22
+
+config BKLT_CTRL_SEL_GPIO
+ int
+ default 19
+
+config GFX_PWR_EN_GPIO
+ int
+ default 49
+
+config ENABLE_DISCRETE_IS_HIGH
+ bool
+ default y
+
endif # BOARD_LENOVO_T400
Arthur Heymans (arthur(a)aheymans.xyz) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16354
-gerrit
commit e58ea6f425d3d81ff3eb4fdb222dca3fc82275d1
Author: Arthur Heymans <arthur(a)aheymans.xyz>
Date: Tue Aug 30 13:42:33 2016 +0200
[UNTESTED] lenovo/T400: correct GPIO for hybrid driver
Currently the hybrid driver uses GPIO 52 to configure mux. This is not
the right GPIO on the T400 according to the schematics "MALIBU-3 EXT".
It should be GPIO22.
The polarities on the gpio's are also set differently on Lenovo T400.
On the Lenovo T400 HIGH on GPIO22 means enable.
Previously also gpio 49 (GFX_PWR_EN) and 19 (BKLT_CTRL_SEL),
were configured for hybrid graphics to work on T400,
but this was reverted in 14d1a93e: "Revert mainboard/lenovo/t400:
Add initial hybrid graphics support".
This patch sets those gpios correctly again for the Lenovo T400.
Change-Id: I3167303abeb6b3711d53508c61a340d03b1e050a
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
src/drivers/lenovo/Kconfig | 5 +++++
src/drivers/lenovo/hybrid_graphics.c | 19 +++++++++++++++++--
src/mainboard/lenovo/t400/Kconfig | 20 ++++++++++++++++++++
3 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/src/drivers/lenovo/Kconfig b/src/drivers/lenovo/Kconfig
index 38b86da..4c62de1 100644
--- a/src/drivers/lenovo/Kconfig
+++ b/src/drivers/lenovo/Kconfig
@@ -39,3 +39,8 @@ config HYBRID_GRAPHICS_GPIO_NUM
help
Set a default GPIO that sets the panel LVDS signal routing to
integrated or discrete GPU.
+
+config ENABLE_DISCRETE_IS_HIGH
+ depends on DRIVERS_LENOVO_HYBRID_GRAPHICS
+ bool
+ default n
diff --git a/src/drivers/lenovo/hybrid_graphics.c b/src/drivers/lenovo/hybrid_graphics.c
index 9b46646..1560eb7 100644
--- a/src/drivers/lenovo/hybrid_graphics.c
+++ b/src/drivers/lenovo/hybrid_graphics.c
@@ -43,9 +43,18 @@
static void hybrid_graphics_disable_peg(struct device *dev)
{
struct device *peg_dev;
+ u8 disable_lvl = CONFIG_ENABLE_DISCRETE_IS_HIGH ?
+ GPIO_LEVEL_LOW : GPIO_LEVEL_HIGH;
/* connect LVDS interface to iGPU */
- set_gpio(CONFIG_HYBRID_GRAPHICS_GPIO_NUM, GPIO_LEVEL_HIGH);
+ set_gpio(CONFIG_HYBRID_GRAPHICS_GPIO_NUM, disable_lvl);
+ /* configure BKLT_CTL */
+ if (CONFIG_BKLT_CTRL_SEL_GPIO)
+ set_gpio(CONFIG_BKLT_CTRL_SEL_GPIO, disable_lvl);
+ /* configure GFX_PWR_EN_GPIO */
+ if (CONFIG_GFX_PWR_EN_GPIO)
+ set_gpio(CONFIG_GFX_PWR_EN_GPIO, disable_lvl);
+
printk(BIOS_DEBUG, "Hybrid graphics: Switching panel to integrated GPU.\n");
dev->enabled = 0;
@@ -62,13 +71,19 @@ static void hybrid_graphics_disable_peg(struct device *dev)
static void hybrid_graphics_enable_peg(struct device *dev)
{
u8 hybrid_graphics_mode;
+ u8 enable_lvl = CONFIG_ENABLE_DISCRETE_IS_HIGH ?
+ GPIO_LEVEL_HIGH : GPIO_LEVEL_LOW;
hybrid_graphics_mode = HYBRID_GRAPHICS_INTEGRATED;
get_option(&hybrid_graphics_mode, "hybrid_graphics_mode");
if (hybrid_graphics_mode == HYBRID_GRAPHICS_DISCRETE) {
/* connect LVDS interface to dGPU */
- set_gpio(CONFIG_HYBRID_GRAPHICS_GPIO_NUM, GPIO_LEVEL_LOW);
+ set_gpio(CONFIG_HYBRID_GRAPHICS_GPIO_NUM, enable_lvl);
+ if (CONFIG_BKLT_CTRL_SEL_GPIO)
+ set_gpio(CONFIG_BKLT_CTRL_SEL_GPIO, enable_lvl);
+ if (CONFIG_GFX_PWR_EN_GPIO)
+ set_gpio(CONFIG_GFX_PWR_EN_GPIO, enable_lvl);
printk(BIOS_DEBUG, "Hybrid graphics: Switching panel to discrete GPU.\n");
dev->enabled = 1;
diff --git a/src/mainboard/lenovo/t400/Kconfig b/src/mainboard/lenovo/t400/Kconfig
index a444bf8..2fbe403 100644
--- a/src/mainboard/lenovo/t400/Kconfig
+++ b/src/mainboard/lenovo/t400/Kconfig
@@ -56,4 +56,24 @@ config ONBOARD_VGA_IS_PRIMARY
bool
default y
+config HYBRID_GRAPHICS_GPIO_NUM
+ int
+ default 22
+
+config BKLT_CTRL_SEL_GPIO
+ int
+ default 19
+
+config DGFX_PWRGD_GPIO
+ int
+ default 17
+
+config GFX_PWR_EN_GPIO
+ int
+ default 49
+
+config ENABLE_DISCRETE_IS_HIGH
+ bool
+ default y
+
endif # BOARD_LENOVO_T400
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16265
-gerrit
commit 0725c23619f6cfd44e0820f2039b58f4587fbc0e
Author: Julius Werner <jwerner(a)chromium.org>
Date: Mon Aug 15 17:58:05 2016 -0700
gru: Add USB 2.0 PHY tuning for Kevin
This patch sets some magic number in magic undocumented registers that
are rumored to make USB 2.0 signal integrity better on Kevin. I don't
see any difference (unfortunately it doesn't solve the problems with
long cables on my board), but I guess it doesn't hurt either way.
BRANCH=None
BUG=chrome-os-partner:56108,chrome-os-partner:54788
TEST=Booted Kevin with USB connected through Servo. Seems to have
roughly the same failure rate as before.
Change-Id: If31fb49f1ed7218b50f24e251e54c9400db72720
Signed-off-by: Martin Roth <martinroth(a)chromium.org>
Original-Commit-Id: 0c5c8f0f80ea1ebb042bcb91506a6100833e7e84
Original-Change-Id: Ifbd47bf6adb63a2ca5371c0b05c5ec27a0fe3195
Original-Signed-off-by: Julius Werner <jwerner(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/370900
Original-Reviewed-by: Guenter Roeck <groeck(a)chromium.org>
Original-Reviewed-by: David Schneider <dnschneid(a)chromium.org>
---
src/mainboard/google/gru/mainboard.c | 9 +++++++++
src/soc/rockchip/rk3399/include/soc/grf.h | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/mainboard/google/gru/mainboard.c b/src/mainboard/google/gru/mainboard.c
index 8a6cda2..a2b74ba 100644
--- a/src/mainboard/google/gru/mainboard.c
+++ b/src/mainboard/google/gru/mainboard.c
@@ -158,6 +158,15 @@ static void configure_display(void)
static void setup_usb(void)
{
+ /* A few magic PHY tuning values that improve eye diagram amplitude
+ * and make it extra sure we get reliable communication in firmware. */
+ /* Set max ODT compensation voltage and current tuning reference. */
+ write32(&rk3399_grf->usbphy0_ctrl[3], 0x0fff02e3);
+ write32(&rk3399_grf->usbphy1_ctrl[3], 0x0fff02e3);
+ /* Set max pre-emphasis level, only on Kevin PHY0. */
+ if (IS_ENABLED(CONFIG_BOARD_GOOGLE_KEVIN))
+ write32(&rk3399_grf->usbphy0_ctrl[12], 0xffff00a7);
+
setup_usb_otg0();
setup_usb_otg1();
}
diff --git a/src/soc/rockchip/rk3399/include/soc/grf.h b/src/soc/rockchip/rk3399/include/soc/grf.h
index d76b827..c1fd690 100644
--- a/src/soc/rockchip/rk3399/include/soc/grf.h
+++ b/src/soc/rockchip/rk3399/include/soc/grf.h
@@ -73,7 +73,7 @@ struct rk3399_grf_regs {
u32 reserved11[3];
u32 usbphy0_ctrl[26];
u32 reserved12[6];
- u32 usbphy1[26];
+ u32 usbphy1_ctrl[26];
u32 reserved13[0x72f];
u32 soc_con9;
u32 reserved14[0x0a];
Martin Roth (martinroth(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16367
-gerrit
commit 071caf2e3aa2ef18900d5931e2921c87dcb003d7
Author: Shunqian Zheng <zhengsq(a)rock-chips.com>
Date: Thu Aug 25 02:28:19 2016 +0800
rockchip/rk3399: Move romstage.c to mainboard/gru
The romstage.c is more board related than soc specific, like
setting the pwm regulators, so moving it to mainboard/gru.
BRANCH=none
BUG=chrome-os-partner:54819
TEST=Bootup on kevin board
Change-Id: I83c6cde9f451480e47e2b4b549cedf65b345134c
Signed-off-by: Martin Roth <martinroth(a)chromium.org>
Original-Commit-Id: 35feeb07131a6a9de4adde035236987391833474
Original-Change-Id: If2bf245302eb4fb20bb089c1b3ffa03909722443
Original-Signed-off-by: Shunqian Zheng <zhengsq(a)rock-chips.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/375398
Original-Reviewed-by: Julius Werner <jwerner(a)chromium.org>
---
src/mainboard/google/gru/Makefile.inc | 1 +
src/mainboard/google/gru/romstage.c | 133 ++++++++++++++++++++++++++++++++++
src/soc/rockchip/rk3399/Makefile.inc | 1 -
src/soc/rockchip/rk3399/romstage.c | 133 ----------------------------------
4 files changed, 134 insertions(+), 134 deletions(-)
diff --git a/src/mainboard/google/gru/Makefile.inc b/src/mainboard/google/gru/Makefile.inc
index 07b27a7..e1ba56a 100644
--- a/src/mainboard/google/gru/Makefile.inc
+++ b/src/mainboard/google/gru/Makefile.inc
@@ -26,6 +26,7 @@ verstage-y += reset.c
romstage-y += boardid.c
romstage-y += chromeos.c
romstage-y += memlayout.ld
+romstage-y += romstage.c
romstage-y += sdram_configs.c
ramstage-y += boardid.c
diff --git a/src/mainboard/google/gru/romstage.c b/src/mainboard/google/gru/romstage.c
new file mode 100644
index 0000000..ccf42b9
--- /dev/null
+++ b/src/mainboard/google/gru/romstage.c
@@ -0,0 +1,133 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2016 Rockchip Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <arch/cache.h>
+#include <arch/cpu.h>
+#include <arch/exception.h>
+#include <arch/io.h>
+#include <arch/mmu.h>
+#include <boardid.h>
+#include <cbfs.h>
+#include <console/console.h>
+#include <delay.h>
+#include <program_loading.h>
+#include <romstage_handoff.h>
+#include <soc/addressmap.h>
+#include <soc/grf.h>
+#include <soc/mmu_operations.h>
+#include <soc/pwm.h>
+#include <soc/tsadc.h>
+#include <soc/sdram.h>
+#include <symbols.h>
+#include <soc/usb.h>
+
+static const uint64_t dram_size =
+ (uint64_t)min((uint64_t)CONFIG_DRAM_SIZE_MB * MiB, MAX_DRAM_ADDRESS);
+
+static void init_dvs_outputs(void)
+{
+ int duty_ns;
+ uint32_t i;
+ uint32_t id;
+
+ write32(&rk3399_grf->iomux_pwm_0, IOMUX_PWM_0); /* GPU */
+ write32(&rk3399_grf->iomux_pwm_1, IOMUX_PWM_1); /* Big */
+ write32(&rk3399_pmugrf->iomux_pwm_2, IOMUX_PWM_2); /* Little */
+ write32(&rk3399_pmugrf->iomux_pwm_3a, IOMUX_PWM_3_A); /* Centerlog */
+
+ /*
+ * Set up voltages for all DVS rails.
+ *
+ * LITTLE CPU: At the speed we're running at right now and on the
+ * early silicon, .9V is sane. If/when we run faster, let's bump this.
+ *
+ * CENTER LOGIC: There are some claims that this should simply always
+ * be .9 V. There are other claims that say that we need to adjust this
+ * dynamically depending on the memory frequency. Until this is sorted
+ * out, it appears that .9 V works for the 800 MHz.
+ *
+ * BIG CPU / GPU: These aren't used in coreboot. Init to .9V which is
+ * supposed to be a good default.
+ *
+ * Details:
+ * design_min = 0.8
+ * design_max = 1.5
+ * period = 3337 # 300 kHz
+ * volt = 1.1
+ * # Intentionally round down (higher volt) to be safe.
+ * int((period / (design_max - design_min)) * (design_max - volt))
+ *
+ * Apparently a period of 3333 is determined by EEs to be ideal for our
+ * board design / resistors / capacitors / regulators but due to
+ * clock dividers we actually get 3337. Solving, we get:
+ * period = 3337, volt = 1.1: 1906
+ * period = 3337, volt = 1.0: 2383
+ * period = 3337, volt = 0.9: 2860
+ */
+ duty_ns = 2860; /* 0.9v */
+
+ /* TODO: Clean all this up, implement proper pwm_regulator driver. */
+ if (IS_ENABLED(CONFIG_BOARD_GOOGLE_KEVIN)) {
+ id = board_id();
+ if (id <= 2)
+ duty_ns = 1906; /* 1.1v */
+ else if (id == 3)
+ duty_ns = 2621; /* 0.95v */
+ else if (id >= 6) {
+ /* GPU: 3337 * (12043 - 9000) / (12043 - 7984) = 2501 */
+ pwm_init(0, 3337, 2501);
+ /* BIG: 3337 * (12837 - 9000) / (12837 - 7985) = 2638 */
+ pwm_init(1, 3337, 2638);
+ /* LIT: 3337 * (12807 - 9000) / (12807 - 8009) = 2647 */
+ pwm_init(2, 3337, 2647);
+ /* CTR: 3337 * (10507 - 9500) / (10507 - 7996) = 1338 */
+ pwm_init(3, 3337, 1338);
+ return;
+ }
+ }
+
+ for (i = 0; i < 4; i++)
+ pwm_init(i, 3337, duty_ns);
+}
+
+static void prepare_usb(void)
+{
+ /*
+ * Do dwc3 core soft reset and phy reset. Kick these resets
+ * off early so they get at least 100ms to settle.
+ */
+ reset_usb_otg0();
+ reset_usb_otg1();
+}
+
+void main(void)
+{
+ console_init();
+ tsadc_init(TSHUT_POL_HIGH);
+ exception_init();
+
+ /* Init DVS to conservative values. */
+ init_dvs_outputs();
+
+ prepare_usb();
+
+ sdram_init(get_sdram_config());
+
+ mmu_config_range((void *)0, (uintptr_t)dram_size, CACHED_MEM);
+ mmu_config_range(_dma_coherent, _dma_coherent_size, UNCACHED_MEM);
+ cbmem_initialize_empty();
+ run_ramstage();
+}
diff --git a/src/soc/rockchip/rk3399/Makefile.inc b/src/soc/rockchip/rk3399/Makefile.inc
index 3bfc05e..6e75278 100644
--- a/src/soc/rockchip/rk3399/Makefile.inc
+++ b/src/soc/rockchip/rk3399/Makefile.inc
@@ -49,7 +49,6 @@ romstage-y += clock.c
romstage-y += mmu_operations.c
romstage-y += ../common/pwm.c
romstage-y += timer.c
-romstage-y += romstage.c
romstage-y += tsadc.c
romstage-y += usb.c
romstage-y += gpio.c
diff --git a/src/soc/rockchip/rk3399/romstage.c b/src/soc/rockchip/rk3399/romstage.c
deleted file mode 100644
index ccf42b9..0000000
--- a/src/soc/rockchip/rk3399/romstage.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright 2016 Rockchip Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#include <arch/cache.h>
-#include <arch/cpu.h>
-#include <arch/exception.h>
-#include <arch/io.h>
-#include <arch/mmu.h>
-#include <boardid.h>
-#include <cbfs.h>
-#include <console/console.h>
-#include <delay.h>
-#include <program_loading.h>
-#include <romstage_handoff.h>
-#include <soc/addressmap.h>
-#include <soc/grf.h>
-#include <soc/mmu_operations.h>
-#include <soc/pwm.h>
-#include <soc/tsadc.h>
-#include <soc/sdram.h>
-#include <symbols.h>
-#include <soc/usb.h>
-
-static const uint64_t dram_size =
- (uint64_t)min((uint64_t)CONFIG_DRAM_SIZE_MB * MiB, MAX_DRAM_ADDRESS);
-
-static void init_dvs_outputs(void)
-{
- int duty_ns;
- uint32_t i;
- uint32_t id;
-
- write32(&rk3399_grf->iomux_pwm_0, IOMUX_PWM_0); /* GPU */
- write32(&rk3399_grf->iomux_pwm_1, IOMUX_PWM_1); /* Big */
- write32(&rk3399_pmugrf->iomux_pwm_2, IOMUX_PWM_2); /* Little */
- write32(&rk3399_pmugrf->iomux_pwm_3a, IOMUX_PWM_3_A); /* Centerlog */
-
- /*
- * Set up voltages for all DVS rails.
- *
- * LITTLE CPU: At the speed we're running at right now and on the
- * early silicon, .9V is sane. If/when we run faster, let's bump this.
- *
- * CENTER LOGIC: There are some claims that this should simply always
- * be .9 V. There are other claims that say that we need to adjust this
- * dynamically depending on the memory frequency. Until this is sorted
- * out, it appears that .9 V works for the 800 MHz.
- *
- * BIG CPU / GPU: These aren't used in coreboot. Init to .9V which is
- * supposed to be a good default.
- *
- * Details:
- * design_min = 0.8
- * design_max = 1.5
- * period = 3337 # 300 kHz
- * volt = 1.1
- * # Intentionally round down (higher volt) to be safe.
- * int((period / (design_max - design_min)) * (design_max - volt))
- *
- * Apparently a period of 3333 is determined by EEs to be ideal for our
- * board design / resistors / capacitors / regulators but due to
- * clock dividers we actually get 3337. Solving, we get:
- * period = 3337, volt = 1.1: 1906
- * period = 3337, volt = 1.0: 2383
- * period = 3337, volt = 0.9: 2860
- */
- duty_ns = 2860; /* 0.9v */
-
- /* TODO: Clean all this up, implement proper pwm_regulator driver. */
- if (IS_ENABLED(CONFIG_BOARD_GOOGLE_KEVIN)) {
- id = board_id();
- if (id <= 2)
- duty_ns = 1906; /* 1.1v */
- else if (id == 3)
- duty_ns = 2621; /* 0.95v */
- else if (id >= 6) {
- /* GPU: 3337 * (12043 - 9000) / (12043 - 7984) = 2501 */
- pwm_init(0, 3337, 2501);
- /* BIG: 3337 * (12837 - 9000) / (12837 - 7985) = 2638 */
- pwm_init(1, 3337, 2638);
- /* LIT: 3337 * (12807 - 9000) / (12807 - 8009) = 2647 */
- pwm_init(2, 3337, 2647);
- /* CTR: 3337 * (10507 - 9500) / (10507 - 7996) = 1338 */
- pwm_init(3, 3337, 1338);
- return;
- }
- }
-
- for (i = 0; i < 4; i++)
- pwm_init(i, 3337, duty_ns);
-}
-
-static void prepare_usb(void)
-{
- /*
- * Do dwc3 core soft reset and phy reset. Kick these resets
- * off early so they get at least 100ms to settle.
- */
- reset_usb_otg0();
- reset_usb_otg1();
-}
-
-void main(void)
-{
- console_init();
- tsadc_init(TSHUT_POL_HIGH);
- exception_init();
-
- /* Init DVS to conservative values. */
- init_dvs_outputs();
-
- prepare_usb();
-
- sdram_init(get_sdram_config());
-
- mmu_config_range((void *)0, (uintptr_t)dram_size, CACHED_MEM);
- mmu_config_range(_dma_coherent, _dma_coherent_size, UNCACHED_MEM);
- cbmem_initialize_empty();
- run_ramstage();
-}