1 From be9165b9fdcf2a18ee201ffdaf8d69801387eb91 Mon Sep 17 00:00:00 2001
2 From: Kuldeep Singh <kuldeep.singh@nxp.com>
3 Date: Tue, 18 Feb 2020 10:42:50 +0800
4 Subject: [PATCH] spi: spi-fsl-qspi: Introduce variable to fix different
7 Different platforms have different Master with different SourceID on
8 AHB bus. The 0X0E Master ID is used by cluster 3 in case of LS2088A.
9 So, patch introduce an invalid master id variable to fix invalid
10 mastered on different platforms.
12 Signed-off-by: Suresh Gupta <suresh.gupta@nxp.com>
13 Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
15 Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
17 drivers/spi/spi-fsl-qspi.c | 17 +++++++++++++++++
18 1 file changed, 17 insertions(+)
20 --- a/drivers/spi/spi-fsl-qspi.c
21 +++ b/drivers/spi/spi-fsl-qspi.c
23 #define QUADSPI_FLSHCR_TCSH_MASK GENMASK(11, 8)
24 #define QUADSPI_FLSHCR_TDH_MASK GENMASK(17, 16)
26 +#define QUADSPI_BUF0CR 0x10
27 +#define QUADSPI_BUF1CR 0x14
28 +#define QUADSPI_BUF2CR 0x18
29 +#define QUADSPI_BUFXCR_INVALID_MSTRID 0xe
31 #define QUADSPI_BUF3CR 0x1c
32 #define QUADSPI_BUF3CR_ALLMST_MASK BIT(31)
33 #define QUADSPI_BUF3CR_ADATSZ(x) ((x) << 8)
35 struct fsl_qspi_devtype_data {
39 unsigned int ahb_buf_size;
42 @@ -205,6 +211,7 @@ struct fsl_qspi_devtype_data {
43 static const struct fsl_qspi_devtype_data vybrid_data = {
46 + .invalid_mstrid = QUADSPI_BUFXCR_INVALID_MSTRID,
47 .ahb_buf_size = SZ_1K,
48 .quirks = QUADSPI_QUIRK_SWAP_ENDIAN,
49 .little_endian = true,
50 @@ -213,6 +220,7 @@ static const struct fsl_qspi_devtype_dat
51 static const struct fsl_qspi_devtype_data imx6sx_data = {
54 + .invalid_mstrid = QUADSPI_BUFXCR_INVALID_MSTRID,
55 .ahb_buf_size = SZ_1K,
56 .quirks = QUADSPI_QUIRK_4X_INT_CLK | QUADSPI_QUIRK_TKT245618,
57 .little_endian = true,
58 @@ -221,6 +229,7 @@ static const struct fsl_qspi_devtype_dat
59 static const struct fsl_qspi_devtype_data imx7d_data = {
62 + .invalid_mstrid = QUADSPI_BUFXCR_INVALID_MSTRID,
63 .ahb_buf_size = SZ_1K,
64 .quirks = QUADSPI_QUIRK_TKT253890 | QUADSPI_QUIRK_4X_INT_CLK |
65 QUADSPI_QUIRK_USE_TDH_SETTING,
66 @@ -230,6 +239,7 @@ static const struct fsl_qspi_devtype_dat
67 static const struct fsl_qspi_devtype_data imx6ul_data = {
70 + .invalid_mstrid = QUADSPI_BUFXCR_INVALID_MSTRID,
71 .ahb_buf_size = SZ_1K,
72 .quirks = QUADSPI_QUIRK_TKT253890 | QUADSPI_QUIRK_4X_INT_CLK |
73 QUADSPI_QUIRK_USE_TDH_SETTING,
74 @@ -239,6 +249,7 @@ static const struct fsl_qspi_devtype_dat
75 static const struct fsl_qspi_devtype_data ls1021a_data = {
78 + .invalid_mstrid = QUADSPI_BUFXCR_INVALID_MSTRID,
79 .ahb_buf_size = SZ_1K,
81 .little_endian = false,
82 @@ -248,6 +259,7 @@ static const struct fsl_qspi_devtype_dat
85 .ahb_buf_size = SZ_1K,
86 + .invalid_mstrid = 0x0,
87 .quirks = QUADSPI_QUIRK_TKT253890 | QUADSPI_QUIRK_BASE_INTERNAL,
88 .little_endian = true,
90 @@ -661,6 +673,7 @@ static int fsl_qspi_exec_op(struct spi_m
91 void __iomem *base = q->iobase;
94 + int invalid_mstrid = q->devtype_data->invalid_mstrid;
98 @@ -684,6 +697,10 @@ static int fsl_qspi_exec_op(struct spi_m
99 qspi_writel(q, QUADSPI_SPTRCLR_BFPTRC | QUADSPI_SPTRCLR_IPPTRC,
100 base + QUADSPI_SPTRCLR);
102 + qspi_writel(q, invalid_mstrid, base + QUADSPI_BUF0CR);
103 + qspi_writel(q, invalid_mstrid, base + QUADSPI_BUF1CR);
104 + qspi_writel(q, invalid_mstrid, base + QUADSPI_BUF2CR);
106 fsl_qspi_prepare_lut(q, op);