]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spi: zynq_qspi: Fix to configure CPOL, CPHA mask
authorJagan Teki <jteki@openedev.com>
Mon, 7 Sep 2015 20:09:44 +0000 (01:39 +0530)
committerJagan Teki <jteki@openedev.com>
Sun, 25 Oct 2015 14:47:03 +0000 (20:17 +0530)
priv->mode is initialized when .set_speed triggers
with mode value, so checking mode for configuring
CPOL, CPHA using priv->mode is invalid hence use
mode from .set_speed argument, and at the end
priv->mode will initialized with mode.

This patch also replaces formatting string to use
speed instead of mode in .set_speed ops.

Signed-off-by: Jagan Teki <jteki@openedev.com>
drivers/spi/zynq_qspi.c

index 0ce61270525f2eb3c468d7bebb2d016c3fcb437c..8aa61d7a507f93fc8892968e20a609993d08c4f6 100644 (file)
@@ -569,7 +569,8 @@ static int zynq_qspi_set_speed(struct udevice *bus, uint speed)
        writel(confr, &regs->cr);
        priv->freq = speed;
 
-       debug("zynq_spi_set_speed: regs=%p, mode=%d\n", priv->regs, priv->freq);
+       debug("zynq_spi_set_speed: regs=%p, speed=%d\n",
+             priv->regs, priv->freq);
 
        return 0;
 }
@@ -584,9 +585,9 @@ static int zynq_qspi_set_mode(struct udevice *bus, uint mode)
        confr = readl(&regs->cr);
        confr &= ~(ZYNQ_QSPI_CR_CPHA_MASK | ZYNQ_QSPI_CR_CPOL_MASK);
 
-       if (priv->mode & SPI_CPHA)
+       if (mode & SPI_CPHA)
                confr |= ZYNQ_QSPI_CR_CPHA_MASK;
-       if (priv->mode & SPI_CPOL)
+       if (mode & SPI_CPOL)
                confr |= ZYNQ_QSPI_CR_CPOL_MASK;
 
        writel(confr, &regs->cr);