From: Jean-Jacques Hiblot Date: Fri, 9 Feb 2018 11:09:27 +0000 (+0100) Subject: mmc: Fix bug in sd_set_card_speed() X-Git-Tag: v2018.03-rc3~3^2~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a0276f3eeed539cbc5ecba694030519dcd1fe308;p=u-boot mmc: Fix bug in sd_set_card_speed() After settings the speed of the sd with the switch command, a check is done to make sure that the new speed has been set. The current check has a masking error: speed are encoded on 4 bits only. Fix it by masking the upper bits. This fixes a problem seen with QEmu emulating a vexpress-a15. Reported-by: Jonathan Gray Signed-off-by: Jean-Jacques Hiblot Tested-by: Jonathan Gray --- diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 3a2e3b353f..b46e3f6024 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1333,7 +1333,7 @@ static int sd_set_card_speed(struct mmc *mmc, enum bus_mode mode) if (err) return err; - if ((__be32_to_cpu(switch_status[4]) >> 24) != speed) + if (((__be32_to_cpu(switch_status[4]) >> 24) & 0xF) != speed) return -ENOTSUPP; return 0;