-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hx30: restore RW firmware access #35
Draft
Emantor
wants to merge
9
commits into
FrameworkComputer:fwk-hx20-hx30-4410
Choose a base branch
from
Emantor:topic/hx30-fix-ec-rw
base: fwk-hx20-hx30-4410
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
hx30: restore RW firmware access #35
Emantor
wants to merge
9
commits into
FrameworkComputer:fwk-hx20-hx30-4410
from
Emantor:topic/hx30-fix-ec-rw
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The alternate function table for LFW on the hx20 contained a few incorrect values that resulted in LFW being unable to read from flash, which disabled the use of the RW (and in some cases the RO) firmware image. 1. SHD_IO0 is function 1 on the MEC152x, not function 2. 2. SHD_IO2 and SHD_IO3 were not included in the alternate function table. The alternate function table from hx20/gpio.inc is correct, but it is missing the SPI alternate for SHD_GLK/GPIO_0056. In the future, we may want to move to model where hx20/gpio.inc includes hx20/lfw/gpio.inc and common pin configurations are shared.
On the hx20 (and presumably hx30,) a design issue prevents us from hibernating the EC properly. Therefore, every time we bring the machine down we cut power instead of hibernating. That results in the next boot being a complete reset. There is code in lfw that checks whether the current boot is due to a watchdog reset or a power-on reset and if it is, clears the image type back to EC_IMAGE_UNKNOWN. Due to that design issue, the hx20 EC is *always* in POR/VTR or WDT on startup. By storing whether the last shutdown was graceful/intended and checking it before resetting the image type, we can work around this issue.
This ensures that the hook in common/system.c that triggers an "at-shutdown" reboot from RO to RW fires. Without this, `ectool reboot_ec RW at-shutdown` doesn't work.
Over the past six months with this patch set, I've observed one troubling behavior: the laptop would not always boot when it was powered completely off (with the EC off as well) and I clicked the power button. It turns out that the power buttons control VCI_IN[01] and that the VBAT-powered control interface is configured to drive GPIO250 as VCI_OUT based on the status of those inputs. Now, GPIO250 is also known as EC_ON on hx20/30: it controls whether 3VL_EC is on. The MEC1521 manual recommends the following example of using VCI_OUT on a "mobile platform" (abbreviated): 1. A coin cell battery is installed, powering VBAT 2. The power button on VCI_IN0# is pushed causing VCI_OUT to be asserted, powering the VTR rail 3. The EC reconfigures VCI so that firmware controls the VCI_OUT pin. Now, the EC is doing this over in vci_task (hx20/hx30), which is long after LFW has started and jumped to main firmware. The problem is, restoring access to RO and RW images in the prior three commits causes us to try to read from flash on startup. Reading from flash is slightly slower, so we extend the period of time between step 2 and 3 where 3VL_EC is only driven by VCI_IN0#. When the user releases the power button during that window, 3VL_EC is cut and the EC shuts down. This patch fixes the issue by asserting firmware control of VCI_OUT as early as is safe in lfw.
Basically a copy from hx20 commit 7f78c55.
Implementation of c187ce1 for hx30. Signed-off-by: Rouven Czerwinski <rouven@czerwinskis.de>
Implementation of 4ed2983 for hx30. Signed-off-by: Rouven Czerwinski <rouven@czerwinskis.de>
If the lfw is stopped after the firmware was loaded, we will only ever be ablt to boot the bootrom loaded RO FW, since we otherwise don't have the time to load a bigger image from the SPI flash. Signed-off-by: Rouven Czerwinski <rouven@czerwinskis.de>
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
recheck |
kiram9
added a commit
that referenced
this pull request
Oct 10, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on #16, this implements the same fixes for hx30.
Also moves the watchdog deactivation, I am not yet entirely sure this fix is required.