From: Ivan Sergeev Date: Mon, 6 Jan 2014 22:16:42 +0000 (-0800) Subject: spi: zynq_qspi: Fix slave max speed configuration X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=30bb6042f233edc97888a435576ea7682b9bdebe;p=thirdparty%2Fu-boot.git spi: zynq_qspi: Fix slave max speed configuration 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 Acked-by: Siva Durga Prasad Paladugu Signed-off-by: Michal Simek --- diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c index af28aa3ddbd..b9bf2b95fad 100644 --- a/drivers/spi/zynq_qspi.c +++ b/drivers/spi/zynq_qspi.c @@ -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;