81 lines
2.9 KiB
Diff
81 lines
2.9 KiB
Diff
From 91bf6de1a7690174b9dad2c8188c7a1fd78f5d6d Mon Sep 17 00:00:00 2001
|
|
From: Yicong Yang <yangyicong@hisilicon.com>
|
|
Date: Thu, 24 Sep 2020 20:24:29 +0800
|
|
Subject: [PATCH 33/39] spi: hisi-sfc-v3xx: factor out the bit definition of
|
|
interrupt register
|
|
|
|
mainline inclusion
|
|
from mainline-v5.10-rc1
|
|
commit aac6edff843871d7d732a6aa6f495b9eb1dea83a
|
|
category: feature
|
|
bugzilla: https://gitee.com/openeuler/kernel/issues/I8CSBP
|
|
CVE: NA
|
|
|
|
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aac6edff843871d7d732a6aa6f495b9eb1dea83a
|
|
|
|
----------------------------------------------------------------------------
|
|
|
|
The definition of the register field in the interrupt corresponding
|
|
registers are the same. So factor them out to public place.
|
|
|
|
Acked-by: John Garry <john.garry@huawei.com>
|
|
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
|
|
Link: https://lore.kernel.org/r/1600950270-52536-4-git-send-email-yangyicong@hisilicon.com
|
|
Signed-off-by: Mark Brown <broonie@kernel.org>
|
|
Signed-off-by: YunYi Yang <yangyunyi2@huawei.com>
|
|
---
|
|
drivers/spi/spi-hisi-sfc-v3xx.c | 16 ++++++++++------
|
|
1 file changed, 10 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/drivers/spi/spi-hisi-sfc-v3xx.c b/drivers/spi/spi-hisi-sfc-v3xx.c
|
|
index 02b18fdd1a50..fbb9b837655c 100644
|
|
--- a/drivers/spi/spi-hisi-sfc-v3xx.c
|
|
+++ b/drivers/spi/spi-hisi-sfc-v3xx.c
|
|
@@ -18,10 +18,7 @@
|
|
#define HISI_SFC_V3XX_VERSION (0x1f8)
|
|
|
|
#define HISI_SFC_V3XX_INT_STAT (0x120)
|
|
-#define HISI_SFC_V3XX_INT_STAT_PP_ERR BIT(2)
|
|
-#define HISI_SFC_V3XX_INT_STAT_ADDR_IACCES BIT(5)
|
|
#define HISI_SFC_V3XX_INT_CLR (0x12c)
|
|
-#define HISI_SFC_V3XX_INT_CLR_CLEAR (0xff)
|
|
#define HISI_SFC_V3XX_CMD_CFG (0x300)
|
|
#define HISI_SFC_V3XX_CMD_CFG_DATA_CNT_OFF 9
|
|
#define HISI_SFC_V3XX_CMD_CFG_RW_MSK BIT(8)
|
|
@@ -34,6 +31,13 @@
|
|
#define HISI_SFC_V3XX_CMD_ADDR (0x30c)
|
|
#define HISI_SFC_V3XX_CMD_DATABUF0 (0x400)
|
|
|
|
+/* Common definition of interrupt bit masks */
|
|
+#define HISI_SFC_V3XX_INT_MASK_ALL (0x1ff) /* all the masks */
|
|
+#define HISI_SFC_V3XX_INT_MASK_PP_ERR BIT(2) /* page progrom error */
|
|
+#define HISI_SFC_V3XX_INT_MASK_IACCES BIT(5) /* error visiting inaccessible/
|
|
+ * protected address
|
|
+ */
|
|
+
|
|
/* IO Mode definition in HISI_SFC_V3XX_CMD_CFG */
|
|
#define HISI_SFC_V3XX_STD (0 << 17)
|
|
#define HISI_SFC_V3XX_DIDO (1 << 17)
|
|
@@ -269,15 +273,15 @@ static int hisi_sfc_v3xx_generic_exec_op(struct hisi_sfc_v3xx_host *host,
|
|
* next time judgement.
|
|
*/
|
|
int_stat = readl(host->regbase + HISI_SFC_V3XX_INT_STAT);
|
|
- writel(HISI_SFC_V3XX_INT_CLR_CLEAR,
|
|
+ writel(HISI_SFC_V3XX_INT_MASK_ALL,
|
|
host->regbase + HISI_SFC_V3XX_INT_CLR);
|
|
|
|
- if (int_stat & HISI_SFC_V3XX_INT_STAT_ADDR_IACCES) {
|
|
+ if (int_stat & HISI_SFC_V3XX_INT_MASK_IACCES) {
|
|
dev_err(host->dev, "fail to access protected address\n");
|
|
return -EIO;
|
|
}
|
|
|
|
- if (int_stat & HISI_SFC_V3XX_INT_STAT_PP_ERR) {
|
|
+ if (int_stat & HISI_SFC_V3XX_INT_MASK_PP_ERR) {
|
|
dev_err(host->dev, "page program operation failed\n");
|
|
return -EIO;
|
|
}
|
|
--
|
|
2.27.0
|
|
|