From: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Mark Brown <broonie@kernel.org>,
Chuanhong Guo <gch981213@gmail.com>
Cc: Xiangsheng Hou <xiangsheng.hou@mediatek.com>,
<linux-mtd@lists.infradead.org>, <devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <linux-spi@vger.kernel.org>,
<benliang.zhao@mediatek.com>, <bin.zhang@mediatek.com>
Subject: [PATCH 6/9] spi: mtk-snfi: add snfi sample delay and read latency adjustment
Date: Mon, 28 Nov 2022 10:06:10 +0800 [thread overview]
Message-ID: <20221128020613.14821-7-xiangsheng.hou@mediatek.com> (raw)
In-Reply-To: <20221128020613.14821-1-xiangsheng.hou@mediatek.com>
Add snfi sample delay and read latency adjustment which can get
from dts property.
Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
---
drivers/spi/spi-mtk-snfi.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/spi/spi-mtk-snfi.c b/drivers/spi/spi-mtk-snfi.c
index 85644308df23..e8587cf2aff2 100644
--- a/drivers/spi/spi-mtk-snfi.c
+++ b/drivers/spi/spi-mtk-snfi.c
@@ -195,6 +195,8 @@
#define DATA_READ_MODE_X4 2
#define DATA_READ_MODE_DUAL 5
#define DATA_READ_MODE_QUAD 6
+#define DATA_READ_LATCH_LAT GENMASK(9, 8)
+#define DATA_READ_LATCH_LAT_S 8
#define PG_LOAD_CUSTOM_EN BIT(7)
#define DATARD_CUSTOM_EN BIT(6)
#define CS_DESELECT_CYC_S 0
@@ -205,6 +207,7 @@
#define SNF_DLY_CTL3 0x548
#define SFCK_SAM_DLY_S 0
+#define SFCK_SAM_DLY GENMASK(5, 0)
#define SNF_STA_CTL1 0x550
#define CUS_PG_DONE BIT(28)
@@ -1368,6 +1371,7 @@ static int mtk_snand_probe(struct platform_device *pdev)
const struct of_device_id *dev_id;
struct spi_controller *ctlr;
struct mtk_snand *ms;
+ u32 val = 0;
int ret;
dev_id = of_match_node(mtk_snand_ids, np);
@@ -1446,6 +1450,15 @@ static int mtk_snand_probe(struct platform_device *pdev)
// switch to SNFI mode
nfi_write32(ms, SNF_CFG, SPI_MODE);
+ ret = of_property_read_u32(np, "rx-sample-delay", &val);
+ if (!ret)
+ nfi_rmw32(ms, SNF_DLY_CTL3, SFCK_SAM_DLY, val);
+
+ ret = of_property_read_u32(np, "rx-latch-latency", &val);
+ if (!ret)
+ nfi_rmw32(ms, SNF_MISC_CTL, DATA_READ_LATCH_LAT,
+ val << DATA_READ_LATCH_LAT_S);
+
// setup an initial page format for ops matching page_cache_op template
// before ECC is called.
ret = mtk_snand_setup_pagefmt(ms, SZ_2K, SZ_64);
--
2.25.1
next prev parent reply other threads:[~2022-11-28 2:08 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 2:06 [PATCH 0/9] Add MediaTek MT7986 SPI NAND and ECC support Xiangsheng Hou
2022-11-28 2:06 ` [PATCH 1/9] spi: mtk-snfi: add snfi support for mt7986 IC Xiangsheng Hou
2022-11-28 2:06 ` [PATCH 2/9] spi: mtk-snfi: change default page format to setup default setting Xiangsheng Hou
2022-11-28 2:06 ` [PATCH 3/9] spi: mtk-snfi: add optional nfi_hclk which needed for mt7986 Xiangsheng Hou
2022-11-28 2:06 ` [PATCH 4/9] mtd: nand: ecc-mtk: add ecc support fot mt7986 IC Xiangsheng Hou
2022-11-28 2:06 ` [PATCH 5/9] dt-bindings: spi: mtk-snfi: add mt7986 IC snfi bindings Xiangsheng Hou
2022-11-28 9:00 ` Krzysztof Kozlowski
2022-11-29 2:50 ` Xiangsheng Hou (侯祥胜)
2022-11-29 7:47 ` Krzysztof Kozlowski
2022-11-30 8:18 ` Xiangsheng Hou (侯祥胜)
2022-11-30 8:33 ` Krzysztof Kozlowski
2022-11-28 2:06 ` Xiangsheng Hou [this message]
2022-11-28 2:06 ` [PATCH 7/9] dt-bindings: spi: mtk-snfi: add two timing delay property Xiangsheng Hou
2022-11-28 9:04 ` Krzysztof Kozlowski
2022-11-29 2:50 ` Xiangsheng Hou (侯祥胜)
2022-11-29 7:47 ` Krzysztof Kozlowski
2022-11-30 8:18 ` Xiangsheng Hou (侯祥胜)
2022-11-30 8:35 ` Krzysztof Kozlowski
2022-11-30 9:08 ` Chuanhong Guo
2022-11-28 12:20 ` Rob Herring
2022-11-28 2:06 ` [PATCH 8/9] dt-bindings: mtd: Split ECC engine with rawnand controller Xiangsheng Hou
2022-11-28 9:13 ` Krzysztof Kozlowski
2022-11-29 2:50 ` Xiangsheng Hou (侯祥胜)
2022-11-28 12:20 ` Rob Herring
2022-12-01 5:24 ` kernel test robot
2022-11-28 2:06 ` [PATCH 9/9] dt-bindings: mtd: ecc-mtk: add mt7986 IC ecc bindings Xiangsheng Hou
2022-11-28 9:14 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221128020613.14821-7-xiangsheng.hou@mediatek.com \
--to=xiangsheng.hou@mediatek.com \
--cc=benliang.zhao@mediatek.com \
--cc=bin.zhang@mediatek.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gch981213@gmail.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=robh+dt@kernel.org \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®