<p>Julius Werner has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/c/coreboot/+/29849">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">cheza: Add board reset via Chrome EC<br><br>This patch implements board reset on the Cheza board. The real board<br>reset used by the operating system uses the PMIC, but unfortunately the<br>PMIC needs to be configured right for that to work. The PMIC<br>configuration currently happens in the Qualcomm blob (QcLib) that is run<br>from romstage, but vboot needs to be able to reboot during verstage<br>already. Porting all the PMIC initialization code to run in the<br>bootblock seems excessive (and at odds with the goal of doing as little<br>as possible before verification), so we'll just do a little hack and ask<br>the EC to perform a cold reset instead. For vboot purposes, this should<br>work just as well.<br><br>BUG=b:118501305<br>TEST=Hacked vboot code to call vboot_reboot(), confirmed that board<br>reset and came back up as expected.<br><br>Change-Id: I3858d95f481884a87c243d4fa3d6369c1e8a5a2c<br>Signed-off-by: Julius Werner <jwerner@chromium.org><br>---<br>M src/mainboard/google/cheza/Kconfig<br>M src/mainboard/google/cheza/Makefile.inc<br>A src/mainboard/google/cheza/reset.c<br>3 files changed, 27 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/29849/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/mainboard/google/cheza/Kconfig b/src/mainboard/google/cheza/Kconfig</span><br><span>index 828a1f7..392c9b1 100644</span><br><span>--- a/src/mainboard/google/cheza/Kconfig</span><br><span>+++ b/src/mainboard/google/cheza/Kconfig</span><br><span>@@ -16,7 +16,6 @@</span><br><span>    select SPI_FLASH</span><br><span>     select SPI_FLASH_WINBOND</span><br><span>     select MAINBOARD_HAS_CHROMEOS</span><br><span style="color: hsl(0, 100%, 40%);">-   select MISSING_BOARD_RESET</span><br><span>   select MAINBOARD_HAS_TPM2</span><br><span>    select MAINBOARD_HAS_SPI_TPM_CR50</span><br><span> </span><br><span>diff --git a/src/mainboard/google/cheza/Makefile.inc b/src/mainboard/google/cheza/Makefile.inc</span><br><span>index 1d339c3..7655e24 100644</span><br><span>--- a/src/mainboard/google/cheza/Makefile.inc</span><br><span>+++ b/src/mainboard/google/cheza/Makefile.inc</span><br><span>@@ -18,18 +18,22 @@</span><br><span> bootblock-y += chromeos.c</span><br><span> bootblock-y += bootblock.c</span><br><span> bootblock-y += qupv3_config.c</span><br><span style="color: hsl(120, 100%, 40%);">+bootblock-y += reset.c</span><br><span> </span><br><span> verstage-y += boardid.c</span><br><span> verstage-y += memlayout.ld</span><br><span> verstage-y += chromeos.c</span><br><span style="color: hsl(120, 100%, 40%);">+verstage-y += reset.c</span><br><span> </span><br><span> romstage-y += boardid.c</span><br><span> romstage-y += memlayout.ld</span><br><span> romstage-y += chromeos.c</span><br><span> romstage-y += romstage.c</span><br><span style="color: hsl(120, 100%, 40%);">+romstage-y += reset.c</span><br><span> </span><br><span> ramstage-y += boardid.c</span><br><span> ramstage-y += memlayout.ld</span><br><span> ramstage-y += chromeos.c</span><br><span> ramstage-y += mainboard.c</span><br><span> ramstage-y += qupv3_config.c</span><br><span style="color: hsl(120, 100%, 40%);">+ramstage-y += reset.c</span><br><span>diff --git a/src/mainboard/google/cheza/reset.c b/src/mainboard/google/cheza/reset.c</span><br><span>new file mode 100644</span><br><span>index 0000000..0a835b5</span><br><span>--- /dev/null</span><br><span>+++ b/src/mainboard/google/cheza/reset.c</span><br><span>@@ -0,0 +1,23 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright 2018 Google LLC</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+ * it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(120, 100%, 40%);">+ * the Free Software Foundation; version 2 of the License.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <ec/google/chromeec/ec.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <reset.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* Can't do a "real" reset before the PMIC is initialized in QcLib (romstage),</span><br><span style="color: hsl(120, 100%, 40%);">+   but this works well enough for our purposes. */</span><br><span style="color: hsl(120, 100%, 40%);">+void do_board_reset(void) {</span><br><span style="color: hsl(120, 100%, 40%);">+       google_chromeec_reboot(0, EC_REBOOT_COLD, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/c/coreboot/+/29849">change 29849</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/c/coreboot/+/29849"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I3858d95f481884a87c243d4fa3d6369c1e8a5a2c </div>
<div style="display:none"> Gerrit-Change-Number: 29849 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Julius Werner <jwerner@chromium.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>