Commit 1a6d4fc2 authored by Cédric Le Goater's avatar Cédric Le Goater Committed by Peter Maydell
Browse files

aspeed/smc: handle dummies only in fast read mode



HW works fine in normal read mode with dummy bytes being set. So let's
check this case to not transfer bytes.

Signed-off-by: default avatarCédric Le Goater <clg@kaod.org>
Message-id: 1486648058-520-4-git-send-email-clg@kaod.org
Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parent 93bf276d
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -536,11 +536,14 @@ static uint64_t aspeed_smc_flash_read(void *opaque, hwaddr addr, unsigned size)
        /*
         * Use fake transfers to model dummy bytes. The value should
         * be configured to some non-zero value in fast read mode and
         * zero in read mode.
         * zero in read mode. But, as the HW allows inconsistent
         * settings, let's check for fast read mode.
         */
        if (aspeed_smc_flash_mode(fl) == CTRL_FREADMODE) {
            for (i = 0; i < aspeed_smc_flash_dummies(fl); i++) {
                ssi_transfer(fl->controller->spi, 0xFF);
            }
        }

        for (i = 0; i < size; i++) {
            ret |= ssi_transfer(s->spi, 0x0) << (8 * i);