SD card support in SDHCI driver

The SDHCI driver is being modified and refactored to support both eMMC
and SD media. While debugging SD card operations it was discovered,
that the host controller behaves differently when communicating with
the SD cards.

One of the fundamental differences between eMMC and SD is that SD
cards allow arbitrary power of 2 block sizes for data transfers,
whereas eMMC devices support only single fixed block size.

Furthermore, even though the SDHCI controller specification describes
the block count register as follows:

  "This register is enabled when Block Count Enable in the Transfer
   Mode register is set to 1 and is valid only for multiple block
   transfers."

in reality. for single block SD card data transfers the controller
Block Count register must be set to 1, if it is not - the following
multiblock transfer times out.

The CD card presence logic is modified to match Rambi hardware.

BUG=chrome-os-partner:24396
TEST=manual
    . with these modifications Rambi successfully boots from both eMMC
      and SD card.

Change-Id: Ic58fd40c08802b72f15003f5c0fae2c4cc14ca7c
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185890
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
1 file changed