[PATCH 4/7] spi: zynqmp_gqspi: Fix tap delay values

Ashok Reddy Soma ashok.reddy.soma at xilinx.com
Mon Jan 18 13:32:25 CET 2021


From: Siva Durga Prasad Paladugu <siva.durga.paladugu at xilinx.com>

There is no need of read modify write for tapdelay settings
ans hence remove the read operations while setting tapdelays.
Also, correct tapdelay value settings at 40MHZ by modifying
the if check to <= instead of <.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu at xilinx.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma at xilinx.com>
---

 drivers/spi/zynqmp_gqspi.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c
index ae7b70aa57..136c20f09e 100644
--- a/drivers/spi/zynqmp_gqspi.c
+++ b/drivers/spi/zynqmp_gqspi.c
@@ -282,24 +282,19 @@ void zynqmp_qspi_set_tapdelay(struct udevice *bus, u32 baudrateval)
        debug("%s, req_hz:%d, clk_rate:%d, baudrateval:%d\n",
              __func__, reqhz, clk_rate, baudrateval);

-       if (reqhz < GQSPI_FREQ_40MHZ) {
-               zynqmp_mmio_read(IOU_TAPDLY_BYPASS_OFST, &tapdlybypass);
-               tapdlybypass |= (TAP_DLY_BYPASS_LQSPI_RX_VALUE <<
-                               TAP_DLY_BYPASS_LQSPI_RX_SHIFT);
+       if (reqhz <= GQSPI_FREQ_40MHZ) {
+               tapdlybypass = TAP_DLY_BYPASS_LQSPI_RX_VALUE <<
+                               TAP_DLY_BYPASS_LQSPI_RX_SHIFT;
        } else if (reqhz <= GQSPI_FREQ_100MHZ) {
-               zynqmp_mmio_read(IOU_TAPDLY_BYPASS_OFST, &tapdlybypass);
-               tapdlybypass |= (TAP_DLY_BYPASS_LQSPI_RX_VALUE <<
-                               TAP_DLY_BYPASS_LQSPI_RX_SHIFT);
-               lpbkdlyadj = readl(&regs->lpbkdly);
-               lpbkdlyadj |= (GQSPI_LPBK_DLY_ADJ_LPBK_MASK);
-               datadlyadj = readl(&regs->gqspidlyadj);
-               datadlyadj |= ((GQSPI_USE_DATA_DLY << GQSPI_USE_DATA_DLY_SHIFT)
-                               | (GQSPI_DATA_DLY_ADJ_VALUE <<
-                                       GQSPI_DATA_DLY_ADJ_SHIFT));
+               tapdlybypass = TAP_DLY_BYPASS_LQSPI_RX_VALUE <<
+                               TAP_DLY_BYPASS_LQSPI_RX_SHIFT;
+               lpbkdlyadj = GQSPI_LPBK_DLY_ADJ_LPBK_MASK;
+               datadlyadj = (GQSPI_USE_DATA_DLY << GQSPI_USE_DATA_DLY_SHIFT) |
+                             (GQSPI_DATA_DLY_ADJ_VALUE <<
+                              GQSPI_DATA_DLY_ADJ_SHIFT);
        } else if (reqhz <= GQSPI_FREQ_150MHZ) {
-               lpbkdlyadj = readl(&regs->lpbkdly);
-               lpbkdlyadj |= ((GQSPI_LPBK_DLY_ADJ_LPBK_MASK) |
-                               GQSPI_LPBK_DLY_ADJ_DLY_0);
+               lpbkdlyadj = GQSPI_LPBK_DLY_ADJ_LPBK_MASK |
+                             GQSPI_LPBK_DLY_ADJ_DLY_0;
        }

        zynqmp_mmio_write(IOU_TAPDLY_BYPASS_OFST, IOU_TAPDLY_BYPASS_MASK,
--
2.17.1

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.


More information about the U-Boot mailing list