diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2018-06-26 12:57:39 +0200 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-06-28 03:43:22 -0700 |
commit | 02b12a8b42d92f35e574ca954c1fe553fbfacd2a (patch) | |
tree | 02e65eb0b6854b44e1191033c17f5412b39b5d87 | |
parent | 750aa8819a330dc52b5df89a0e5e6e905c9f78fb (diff) | |
download | chrome-ec-02b12a8b42d92f35e574ca954c1fe553fbfacd2a.tar.gz |
nocturne_fp: update flash_fp_mcu for the new power control
On Nocturne, the cros-ec-spi kernel driver controls the FPMCU power
(PCH_FP_PWR_EN) through the ACPI power resource.
Update the flashing script to take it into account:
- when cros-ec-spi driver is unloaded, it normally cuts power.
- cros-ec-spi might pulse reset on binding.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=poppy
BUG=b:79666174 b:79902391
TEST=On Nocturne with up-to-date coreboot, run './flash_fp_mcu ec.bin'.
Change-Id: I91aee95df640c7e89b2497fc3a8d8eb92a4d64a5
Reviewed-on: https://chromium-review.googlesource.com/1114743
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
-rwxr-xr-x | board/meowth_fp/flash_fp_mcu | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/board/meowth_fp/flash_fp_mcu b/board/meowth_fp/flash_fp_mcu index 251860d7bd..0a42252674 100755 --- a/board/meowth_fp/flash_fp_mcu +++ b/board/meowth_fp/flash_fp_mcu @@ -18,6 +18,8 @@ if [ -e "/sys/class/gpio/${CNL_GPIOCHIP}" ]; then GPIO_NRST=291 # FPMCU BOOT0 is on GPP_A21 = 268 + 21 = 289 GPIO_BOOT0=289 + # FP_PWR_EN is on GPP_A11 = 268 + 11 = 279 + GPIO_PWREN=279 elif [ -e "/sys/class/gpio/${KBL_GPIOCHIP}" ]; then # Nocturne configuration SPIDEV="/dev/spidev32765.0" @@ -25,6 +27,8 @@ elif [ -e "/sys/class/gpio/${KBL_GPIOCHIP}" ]; then GPIO_NRST=418 # FPMCU BOOT0 is on GPP_C8 = 360 + 56 = 416 GPIO_BOOT0=416 + # FP_PWR_EN is on GPP_A11 = 360 + 11 = 371 + GPIO_PWREN=371 else echo "Cannot find a known GPIO chip." exit 1 @@ -36,6 +40,11 @@ if [ ! -f "$1" ]; then exit 1 fi +# Ensure the ACPI is not cutting power when unloading cros-ec-spi +echo ${GPIO_PWREN} > /sys/class/gpio/export +echo "out" > /sys/class/gpio/gpio${GPIO_PWREN}/direction +echo 1 > /sys/class/gpio/gpio${GPIO_PWREN}/value + # Remove cros_fp if present echo "${SPIID}" > /sys/bus/spi/drivers/cros-ec-spi/unbind @@ -48,15 +57,15 @@ echo "out" > /sys/class/gpio/gpio${GPIO_NRST}/direction # Reset sequence to enter bootloader mode echo 1 > /sys/class/gpio/gpio${GPIO_BOOT0}/value echo 0 > /sys/class/gpio/gpio${GPIO_NRST}/value +sleep 0.001 +# Release reset as the SPI bus is now ready +echo 1 > /sys/class/gpio/gpio${GPIO_NRST}/value +echo "in" > /sys/class/gpio/gpio${GPIO_NRST}/direction # load spidev (fail on cros-ec-spi first to change modalias) echo "${SPIID}" > /sys/bus/spi/drivers/cros-ec-spi/bind echo "${SPIID}" > /sys/bus/spi/drivers/spidev/bind -# Release reset as the SPI bus is now ready -echo 1 > /sys/class/gpio/gpio${GPIO_NRST}/value - -echo "in" > /sys/class/gpio/gpio${GPIO_NRST}/direction stm32mon -p -s ${SPIDEV} -e -w $1 @@ -79,5 +88,7 @@ echo ${GPIO_NRST} > /sys/class/gpio/unexport sleep 2 # Put back cros_fp driver echo "${SPIID}" > /sys/bus/spi/drivers/cros-ec-spi/bind +# Kernel driver is back, we are no longer controlling power +echo ${GPIO_PWREN} > /sys/class/gpio/unexport # Test it ectool --name=cros_fp version |