]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
spi: zynq_qspi: Fix slave max speed configuration
authorIvan Sergeev <vsergeev@kumunetworks.com>
Mon, 6 Jan 2014 22:16:42 +0000 (14:16 -0800)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 14 Jan 2014 13:01:10 +0000 (14:01 +0100)
spi_setup_slave() was ignoring the slave max speed defined by
CONFIG_SF_DEFAULT_SPEED or provided at the command line by the user, and always
configuring the QSPI slave max speed to the QSPI master speed. This fix chooses
the QSPI slave max speed to be the minimum of the provided one (default
configuration or user supplied) and the QSPI master speed.

Signed-off-by: Ivan Sergeev <vsergeev@kumunetworks.com>
Acked-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/spi/zynq_qspi.c

index af28aa3ddbd0da5c29faf62342b443cbb26fcc07..b9bf2b95fad976ffaf555c715a80258c68df11d2 100644 (file)
@@ -910,7 +910,8 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
        qspi->slave.rd_cmd = READ_CMD_FULL;
        qspi->slave.wr_cmd = PAGE_PROGRAM | QUAD_PAGE_PROGRAM;
        qspi->qspi.master.speed_hz = qspi->qspi.master.input_clk_hz / 2;
-       qspi->qspi.max_speed_hz = qspi->qspi.master.speed_hz;
+       qspi->qspi.max_speed_hz = (max_hz < qspi->qspi.master.speed_hz) ?
+                                                               max_hz : qspi->qspi.master.speed_hz;
        qspi->qspi.master.is_dual = is_dual;
        qspi->qspi.mode = mode;
        qspi->qspi.chip_select = 0;