mirror of
https://github.com/u-boot/u-boot.git
synced 2024-12-01 00:23:29 +08:00
spi: zynq_qspi: Add a check for baudrate and set default if not in limits
Add a check afer baudrate calculation to see if the resultant value falls within the range, else set it to default baudrate value. Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com> Link: https://lore.kernel.org/r/20220131052240.23403-4-ashok.reddy.soma@xilinx.com Signed-off-by: Michal Simek <michal.simek@xilinx.com>
This commit is contained in:
parent
a5a387a421
commit
30671860d7
@ -49,6 +49,9 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
#define ZYNQ_QSPI_CR_BAUD_SHIFT 3 /* Baud rate divisor shift */
|
||||
#define ZYNQ_QSPI_CR_SS_SHIFT 10 /* Slave select shift */
|
||||
|
||||
#define ZYNQ_QSPI_MAX_BAUD_RATE 0x7
|
||||
#define ZYNQ_QSPI_DEFAULT_BAUD_RATE 0x2
|
||||
|
||||
#define ZYNQ_QSPI_FIFO_DEPTH 63
|
||||
#define ZYNQ_QSPI_WAIT (CONFIG_SYS_HZ / 100) /* 10 ms */
|
||||
|
||||
@ -621,6 +624,9 @@ static int zynq_qspi_set_speed(struct udevice *bus, uint speed)
|
||||
(2 << baud_rate_val)) > speed))
|
||||
baud_rate_val++;
|
||||
|
||||
if (baud_rate_val > ZYNQ_QSPI_MAX_BAUD_RATE)
|
||||
baud_rate_val = ZYNQ_QSPI_DEFAULT_BAUD_RATE;
|
||||
|
||||
plat->speed_hz = speed / (2 << baud_rate_val);
|
||||
}
|
||||
confr &= ~ZYNQ_QSPI_CR_BAUD_MASK;
|
||||
|
Loading…
Reference in New Issue
Block a user