summaryrefslogtreecommitdiff
path: root/board/kukui/build.mk
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-06-28 10:56:56 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-07-11 23:06:38 -0700
commit263a7ad89c702e6b34dfbe782e347a2d35178630 (patch)
treee6da0c88b59bfb6162365e38bfb72998f13df299 /board/kukui/build.mk
parent7884e76ea35140d91a787160a5b81ae371f24c22 (diff)
downloadchrome-ec-263a7ad89c702e6b34dfbe782e347a2d35178630.tar.gz
kukui: emulate eMMC boot mode using SPI controller.
Kukui is not able to boot from SPI-NOR, it can only boot from eMMC or UFS. Here we emulates the eMMC boot using SPI controller. AP tranmits on CMD line, and eMMC replies on DAT0 line. eMMC boot operation looks a lot like SPI: CMD is unidirectional MOSI, DAT is unidirectional MISO. CLK is driven by the master. However, there is no chip-select, and the clock is active for a long time before any command is sent on the CMD line. From SPI perspective, this looks like a lot of '1' are being sent from the master. To catch the commands, we setup DMA to write the data into a circular buffer (in_msg), and monitor for a falling edge on CMD (emmc_cmd_interrupt). Once an interrupt is received, we scan the circular buffer, in reverse, to be as fast as possible and minimize chances of missing the command. We then figure out the bit-wise command alignment, decode it, and, upon receiving BOOT_INITIATION command, setup DMA to respond with the data on the DAT line. The data in bootblock_data.h is preprocessed to include necessary eMMC headers: acknowledge boot mode, start of block, CRC, end of block, etc. The host can only slow down transfer by stopping the clock, which is compatible with SPI. In some cases (e.g. if the BootROM expects data over 8 lanes instead of 1), the BootROM will quickly interrupt the transfer with an IDLE command. In this case we interrupt the transfer, and the BootROM will try again. BRANCH=None BUG=b:110907438 TEST=make BOARD=kukui BOOTBLOCK=abc -j # check build pass Change-Id: I0f1f2d35c525c6475d90fca2cd6e97f87cd747cc Signed-off-by: Yilun Lin <yllin@google.com> Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1126579 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'board/kukui/build.mk')
-rw-r--r--board/kukui/build.mk3
1 files changed, 3 insertions, 0 deletions
diff --git a/board/kukui/build.mk b/board/kukui/build.mk
index 7e238d3ac9..02ef585861 100644
--- a/board/kukui/build.mk
+++ b/board/kukui/build.mk
@@ -12,3 +12,6 @@ CHIP_FAMILY:=stm32f0
CHIP_VARIANT:=stm32f09x
board-y=battery.o board.o usb_pd_policy.o led.o
+board-$(CONFIG_BOOTBLOCK)+=emmc.o
+
+$(out)/RO/board/$(BOARD)/emmc.o: $(out)/bootblock_data.h