]> git.ipfire.org Git - thirdparty/u-boot.git/commit
mmc: Add support for downgrading HS200/HS400 to HS mode
authorMarek Vasut <marek.vasut@gmail.com>
Thu, 3 Jan 2019 20:19:24 +0000 (21:19 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 15 Jan 2019 20:28:42 +0000 (15:28 -0500)
commitb9a2a0e2e9c024009010a9755d5377795f660b1a
tree1b6761a3d2f3b487977dc68014847fec25435fee
parent9a878e8f1714cade4021c997f68b7f86321c0421
mmc: Add support for downgrading HS200/HS400 to HS mode

The mmc_select_mode_and_width() function can be called while the card
is in HS200/HS400 mode and can be used to downgrade the card to lower
mode, e.g. HS. This is used for example by mmc_boot_part_access_chk()
which cannot access the card in HS200/HS400 mode and which is in turn
called by saveenv if env is in the MMC.

In such case, forcing the card clock to legacy frequency cannot work.
Instead, the card must be switched to HS mode first, from which it can
then be reprogrammed as needed.

However, this procedure needs additional code changes, since the current
implementation checks whether the card correctly switched to HS mode in
mmc_set_card_speed(). The check only expects that the card will be going
to HS mode from lower modes, not from higher modes, hence add a parameter
which indicates that the HS200/HS400 to HS downgrade is happening. This
makes the code send the switch command first, reconfigure the controller
next and finally perform the EXT_CSD readback check. The last two steps
cannot be done in reverse order as the card is already in HS mode when
the clock are being switched on the controller side.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
drivers/mmc/mmc.c