mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
UPSTREAM: drivers/storage: Delay after SD SWITCH operations
Delay for a while after the switch operations to let the card recover.
TEST=Build and run on Galileo Gen2
Change-Id: I5164215678ef54a0d3101b1f92efffe0ef26f375
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Original-Commit-Id: f542aca090
Original-Change-Id: I938e227a142e43ed6afda80d56af90df0bae1b05
Original-Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com>
Original-Reviewed-on: https://review.coreboot.org/19671
Original-Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Original-Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/506214
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
This commit is contained in:
parent
9a43d28a6f
commit
e7ff9870e9
1 changed files with 13 additions and 0 deletions
|
@ -136,6 +136,7 @@ static void sd_recalculate_clock(struct storage_media *media)
|
|||
|
||||
int sd_change_freq(struct storage_media *media)
|
||||
{
|
||||
int delay;
|
||||
int err, timeout;
|
||||
struct mmc_command cmd;
|
||||
struct sd_mmc_ctrlr *ctrlr = media->ctrlr;
|
||||
|
@ -225,11 +226,23 @@ int sd_change_freq(struct storage_media *media)
|
|||
if (!((ctrlr->caps & DRVR_CAP_HS52) && (ctrlr->caps & DRVR_CAP_HS)))
|
||||
goto out;
|
||||
|
||||
/* Give the card time to recover afer the switch operation. Wait for
|
||||
* 9 (>= 8) clock cycles receiving the switch status.
|
||||
*/
|
||||
delay = (9000000 + ctrlr->bus_hz - 1) / ctrlr->bus_hz;
|
||||
udelay(delay);
|
||||
|
||||
/* Switch to high speed */
|
||||
err = sd_switch(ctrlr, SD_SWITCH_SWITCH, 0, 1,
|
||||
(uint8_t *)switch_status);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* Give the card time to perform the switch operation. Wait for 9
|
||||
* (>= 8) clock cycles receiving the switch status.
|
||||
*/
|
||||
udelay(delay);
|
||||
|
||||
if ((ntohl(switch_status[4]) & 0x0f000000) == 0x01000000) {
|
||||
media->caps |= DRVR_CAP_HS;
|
||||
SET_TIMING(ctrlr, BUS_TIMING_SD_HS);
|
||||
|
|
Loading…
Add table
Reference in a new issue