All of lore.kernel.org
 help / color / mirror / Atom feed
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>,
	"AngeloGioacchino Del Regno" 
	<angelogioacchino.delregno@collabora.com>
Subject: [RESEND PATCH v5 02/10] spi: mtk-snfi: Add optional nfi_hclk which is needed for MT7986
Date: Mon, 30 Jan 2023 11:06:48 +0800	[thread overview]
Message-ID: <20230130030656.12127-3-xiangsheng.hou@mediatek.com> (raw)
In-Reply-To: <20230130030656.12127-1-xiangsheng.hou@mediatek.com>

Add optional nfi_hclk which is needed for MT7986.

Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/spi/spi-mtk-snfi.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/spi/spi-mtk-snfi.c b/drivers/spi/spi-mtk-snfi.c
index 719fc6f53ab1..85644308df23 100644
--- a/drivers/spi/spi-mtk-snfi.c
+++ b/drivers/spi/spi-mtk-snfi.c
@@ -297,6 +297,7 @@ struct mtk_snand {
 	struct device *dev;
 	struct clk *nfi_clk;
 	struct clk *pad_clk;
+	struct clk *nfi_hclk;
 	void __iomem *nfi_base;
 	int irq;
 	struct completion op_done;
@@ -1339,7 +1340,16 @@ static int mtk_snand_enable_clk(struct mtk_snand *ms)
 		dev_err(ms->dev, "unable to enable pad clk\n");
 		goto err1;
 	}
+	ret = clk_prepare_enable(ms->nfi_hclk);
+	if (ret) {
+		dev_err(ms->dev, "unable to enable nfi hclk\n");
+		goto err2;
+	}
+
 	return 0;
+
+err2:
+	clk_disable_unprepare(ms->pad_clk);
 err1:
 	clk_disable_unprepare(ms->nfi_clk);
 	return ret;
@@ -1347,6 +1357,7 @@ static int mtk_snand_enable_clk(struct mtk_snand *ms)
 
 static void mtk_snand_disable_clk(struct mtk_snand *ms)
 {
+	clk_disable_unprepare(ms->nfi_hclk);
 	clk_disable_unprepare(ms->pad_clk);
 	clk_disable_unprepare(ms->nfi_clk);
 }
@@ -1401,6 +1412,13 @@ static int mtk_snand_probe(struct platform_device *pdev)
 		goto release_ecc;
 	}
 
+	ms->nfi_hclk = devm_clk_get_optional(&pdev->dev, "nfi_hclk");
+	if (IS_ERR(ms->nfi_hclk)) {
+		ret = PTR_ERR(ms->nfi_hclk);
+		dev_err(&pdev->dev, "unable to get nfi_hclk, err = %d\n", ret);
+		goto release_ecc;
+	}
+
 	ret = mtk_snand_enable_clk(ms);
 	if (ret)
 		goto release_ecc;
-- 
2.25.1


  parent reply	other threads:[~2023-01-30  3:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30  3:06 [RESEND PATCH v5 00/10] Add MediaTek MT7986 SPI NAND and ECC support Xiangsheng Hou
2023-01-30  3:06 ` [RESEND PATCH v5 01/10] spi: mtk-snfi: Change default page format to setup default setting Xiangsheng Hou
2023-01-30  3:06 ` Xiangsheng Hou [this message]
2023-01-30  3:06 ` [RESEND PATCH v5 03/10] mtd: nand: ecc-mtk: Add ECC support fot MT7986 IC Xiangsheng Hou
2023-01-30  3:06 ` [RESEND PATCH v5 04/10] dt-bindings: spi: mtk-snfi: Add compatible for MT7986 Xiangsheng Hou
2023-01-30  3:06 ` [RESEND PATCH v5 05/10] spi: mtk-snfi: Add snfi sample delay and read latency adjustment Xiangsheng Hou
2023-01-30  3:06 ` [RESEND PATCH v5 06/10] dt-bindings: spi: mtk-snfi: Add read latch latency property Xiangsheng Hou
2023-01-30  3:06 ` [RESEND PATCH v5 07/10] dt-bindings: mtd: Split ECC engine with rawnand controller Xiangsheng Hou
2023-01-30 16:28   ` kernel test robot
2023-01-30 16:28     ` kernel test robot
2023-01-30 16:28     ` kernel test robot
2023-01-30  3:06 ` [RESEND PATCH v5 08/10] arm64: dts: mediatek: Fix existing NAND controller node name Xiangsheng Hou
2023-01-30  3:06 ` [RESEND PATCH v5 09/10] arm: " Xiangsheng Hou
2023-01-30  3:06 ` [RESEND PATCH v5 10/10] dt-bindings: mtd: mediatek,nand-ecc-engine: Add compatible for MT7986 Xiangsheng Hou
2023-01-30 16:11 ` [RESEND PATCH v5 00/10] Add MediaTek MT7986 SPI NAND and ECC support Miquel Raynal
2023-01-30 16:11   ` Miquel Raynal
2023-01-30 16:11   ` Miquel Raynal
2023-01-30 16:18   ` Mark Brown
2023-01-30 16:18     ` Mark Brown
2023-01-30 16:18     ` Mark Brown
2023-01-30 16:33     ` Miquel Raynal
2023-01-30 16:33       ` Miquel Raynal
2023-01-30 16:33       ` Miquel Raynal
2023-01-31  5:54       ` Xiangsheng Hou (侯祥胜)
2023-01-31  5:54         ` Xiangsheng Hou (侯祥胜)
2023-01-31  5:54         ` Xiangsheng Hou (侯祥胜)

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=20230130030656.12127-3-xiangsheng.hou@mediatek.com \
    --to=xiangsheng.hou@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.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 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.