[U-Boot] [PATCH 48/50] rockchip: spi: Correct chip-enable code

Simon Glass
2016-01-13T23:25:38Z

At present there is an incorrect call to rkspi_enable_chip(). It should
be disabling the chip, not enabling it. Correct this and ensure that the
chip is disabled when releasing the bus.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

drivers/spi/rk_spi.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c
index 91538b4..ecda833 100644
--- a/drivers/spi/rk_spi.c
+++ b/drivers/spi/rk_spi.c
@@ -285,6 +285,11 @@ static int rockchip_spi_claim_bus(struct udevice *dev)

static int rockchip_spi_release_bus(struct udevice *dev)
{
+ struct udevice *bus = dev->parent;
+ struct rockchip_spi_priv *priv = dev_get_priv(bus);
+
+ rkspi_enable_chip(priv->regs, false);
+
return 0;
}

@@ -313,7 +318,7 @@ static int rockchip_spi_xfer(struct udevice *dev, unsigned int bitlen,
while (len > 0) {
int todo = min(len, 0xffff);

- rkspi_enable_chip(regs, true);
+ rkspi_enable_chip(regs, false);
writel(todo - 1, &regs->ctrlr1);
rkspi_enable_chip(regs, true);

--
2.6.0.rc2.230.g3dd15c0