Restrict baud rate disvisor value to max possible
baud rate value. This fixes the baud rate value overflow
condition which results in programming the incorrect baud
rate divisor value.
Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
#define SPI_XFER_ON_UPPER 2
#define ZYNQMP_QSPI_DMA_ALIGN 0x4
+#define ZYNQMP_QSPI_MAX_BAUD_RATE_VAL 7
/* QSPI register offsets */
struct zynqmp_qspi_regs {
(2 << baud_rate_val)) > speed))
baud_rate_val++;
+ if (baud_rate_val > ZYNQMP_QSPI_MAX_BAUD_RATE_VAL)
+ baud_rate_val = ZYNQMP_QSPI_MAX_BAUD_RATE_VAL;
+
plat->speed_hz = speed / (2 << baud_rate_val);
}
confr &= ~ZYNQMP_QSPI_BAUD_DIV_MASK;