Patchwork [U-Boot] spi: xilinx_spi: Perform software reset during slave setup

login
register
mail settings
Submitter Michal Simek
Date Jan. 23, 2013, 12:47 p.m.
Message ID <1358945277-10584-1-git-send-email-michal.simek@xilinx.com>
Download mbox | patch
Permalink /patch/214930/
State Accepted
Headers show

Comments

Michal Simek - Jan. 23, 2013, 12:47 p.m.
From: Jason Wu <jason.wu@petalogix.com>

to make sure it is in the clear state.

Signed-off-by: Jason Wu <huanyu@xilinx.com>
---
 drivers/spi/xilinx_spi.c |    2 ++
 drivers/spi/xilinx_spi.h |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)

Patch

diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index 52a4134..db01cc2 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -99,6 +99,8 @@  struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 	debug("%s: bus:%i cs:%i base:%p mode:%x max_hz:%d\n", __func__,
 		bus, cs, xilspi->regs, xilspi->mode, xilspi->freq);
 
+	writel(SPISSR_RESET_VALUE, &xilspi->regs->srr);
+
 	return &xilspi->slave;
 }
 
diff --git a/drivers/spi/xilinx_spi.h b/drivers/spi/xilinx_spi.h
index 32610d2..69d0b94 100644
--- a/drivers/spi/xilinx_spi.h
+++ b/drivers/spi/xilinx_spi.h
@@ -119,6 +119,9 @@  struct xilinx_spi_reg {
 #define SPIRFOR_OCYVAL_POS	0
 #define SPIRFOR_OCYVAL_MASK	(0xf << SPIRFOR_OCYVAL_POS)
 
+/* SPI Software Reset Register (ssr) */
+#define SPISSR_RESET_VALUE	0x0a
+
 struct xilinx_spi_slave {
 	struct spi_slave slave;
 	struct xilinx_spi_reg *regs;