diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2018-06-28 10:56:56 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-07-11 23:06:38 -0700 |
commit | 263a7ad89c702e6b34dfbe782e347a2d35178630 (patch) | |
tree | e6da0c88b59bfb6162365e38bfb72998f13df299 /common/flash.c | |
parent | 7884e76ea35140d91a787160a5b81ae371f24c22 (diff) | |
download | chrome-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 'common/flash.c')
0 files changed, 0 insertions, 0 deletions