All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] mtd: spi-nor: fsl-quadspi: use quirk to distinguish different qspi version
@ 2015-07-21 19:39 Frank.Li
  2015-07-21 19:39 ` [PATCH 2/7] mtd: spi-nor: fsl-quadspi: add imx7d support Frank.Li
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Frank.Li @ 2015-07-21 19:39 UTC (permalink / raw)
  To: linux-mtd, b45815, computersforpeace, lznuaa

From: Han Xu <b45815@freescale.com>

add several quirk to distinguish different version of qspi module.

Signed-off-by: Han Xu <b45815@freescale.com>
---
 drivers/mtd/spi-nor/fsl-quadspi.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index e854004..258bebf 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -28,6 +28,11 @@
 #include <linux/mtd/spi-nor.h>
 #include <linux/mutex.h>
 
+/* Controller needs driver to swap endian */
+#define QUADSPI_QUIRK_SWAP_ENDIAN	(1 << 0)
+/* Controller needs 4x internal clock */
+#define QUADSPI_QUIRK_4X_INT_CLK	(1 << 1)
+
 /* The registers */
 #define QUADSPI_MCR			0x00
 #define QUADSPI_MCR_RESERVED_SHIFT	16
@@ -202,20 +207,23 @@ struct fsl_qspi_devtype_data {
 	int rxfifo;
 	int txfifo;
 	int ahb_buf_size;
+	int driver_data;
 };
 
 static struct fsl_qspi_devtype_data vybrid_data = {
 	.devtype = FSL_QUADSPI_VYBRID,
 	.rxfifo = 128,
 	.txfifo = 64,
-	.ahb_buf_size = 1024
+	.ahb_buf_size = 1024,
+	.driver_data = QUADSPI_QUIRK_SWAP_ENDIAN
 };
 
 static struct fsl_qspi_devtype_data imx6sx_data = {
 	.devtype = FSL_QUADSPI_IMX6SX,
 	.rxfifo = 128,
 	.txfifo = 512,
-	.ahb_buf_size = 1024
+	.ahb_buf_size = 1024,
+	.driver_data = QUADSPI_QUIRK_4X_INT_CLK
 };
 
 #define FSL_QSPI_MAX_CHIP	4
@@ -239,14 +247,14 @@ struct fsl_qspi {
 	struct mutex lock;
 };
 
-static inline int is_vybrid_qspi(struct fsl_qspi *q)
+static inline int needs_swap_endian(struct fsl_qspi *q)
 {
-	return q->devtype_data->devtype == FSL_QUADSPI_VYBRID;
+	return q->devtype_data->driver_data & QUADSPI_QUIRK_SWAP_ENDIAN;
 }
 
-static inline int is_imx6sx_qspi(struct fsl_qspi *q)
+static inline int needs_4x_clock(struct fsl_qspi *q)
 {
-	return q->devtype_data->devtype == FSL_QUADSPI_IMX6SX;
+	return q->devtype_data->driver_data & QUADSPI_QUIRK_4X_INT_CLK;
 }
 
 /*
@@ -255,7 +263,7 @@ static inline int is_imx6sx_qspi(struct fsl_qspi *q)
  */
 static inline u32 fsl_qspi_endian_xchg(struct fsl_qspi *q, u32 a)
 {
-	return is_vybrid_qspi(q) ? __swab32(a) : a;
+	return needs_swap_endian(q) ? __swab32(a) : a;
 }
 
 static inline void fsl_qspi_unlock_lut(struct fsl_qspi *q)
@@ -650,7 +658,7 @@ static int fsl_qspi_nor_setup_last(struct fsl_qspi *q)
 	unsigned long rate = q->clk_rate;
 	int ret;
 
-	if (is_imx6sx_qspi(q))
+	if (needs_4x_clock(q))
 		rate *= 4;
 
 	ret = clk_set_rate(q->clk, rate);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2015-07-24 19:44 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-21 19:39 [PATCH 1/7] mtd: spi-nor: fsl-quadspi: use quirk to distinguish different qspi version Frank.Li
2015-07-21 19:39 ` [PATCH 2/7] mtd: spi-nor: fsl-quadspi: add imx7d support Frank.Li
2015-07-24 15:37   ` Han Xu
2015-07-21 19:39 ` [PATCH 3/7] mtd: spi-nor: fsl-quadspi: add i.mx6ul support Frank.Li
2015-07-24 15:38   ` Han Xu
2015-07-21 19:39 ` [PATCH 4/7] mtd: spi-nor: fsl-quadspi: i.MX6SX: fixed the random QSPI access failed issue Frank.Li
2015-07-24 15:38   ` Han Xu
2015-07-24 16:56   ` Brian Norris
2015-07-24 17:10     ` Zhi Li
2015-07-24 19:44       ` Brian Norris
2015-07-21 19:39 ` [PATCH 5/7] mtd: spi-nor: fsl-quadspi: workaround qspi can't wakeup from wait mode Frank.Li
2015-07-24 15:39   ` Han Xu
2015-07-21 19:39 ` [PATCH 6/7] mtd: spi-nor: fsl-quadspi: reset the module in the probe Frank.Li
2015-07-24 15:40   ` Han Xu
2015-07-21 19:39 ` [PATCH 7/7] mtd: spi-nor: fsl-quadspi: fix unsupported cmd when run flash_erase Frank.Li
2015-07-24 15:42   ` Han Xu
2015-07-24 15:40 ` [PATCH 1/7] mtd: spi-nor: fsl-quadspi: use quirk to distinguish different qspi version Han Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.