mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 14:42:24 +00:00
spi: mtk-snfi: Add optional nfi_hclk which is needed for MT7986
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> Link: https://lore.kernel.org/r/20230201020921.26712-3-xiangsheng.hou@mediatek.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
2b1e19811a
commit
e40fa32855
@ -297,6 +297,7 @@ struct mtk_snand {
|
|||||||
struct device *dev;
|
struct device *dev;
|
||||||
struct clk *nfi_clk;
|
struct clk *nfi_clk;
|
||||||
struct clk *pad_clk;
|
struct clk *pad_clk;
|
||||||
|
struct clk *nfi_hclk;
|
||||||
void __iomem *nfi_base;
|
void __iomem *nfi_base;
|
||||||
int irq;
|
int irq;
|
||||||
struct completion op_done;
|
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");
|
dev_err(ms->dev, "unable to enable pad clk\n");
|
||||||
goto err1;
|
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;
|
return 0;
|
||||||
|
|
||||||
|
err2:
|
||||||
|
clk_disable_unprepare(ms->pad_clk);
|
||||||
err1:
|
err1:
|
||||||
clk_disable_unprepare(ms->nfi_clk);
|
clk_disable_unprepare(ms->nfi_clk);
|
||||||
return ret;
|
return ret;
|
||||||
@ -1347,6 +1357,7 @@ err1:
|
|||||||
|
|
||||||
static void mtk_snand_disable_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->pad_clk);
|
||||||
clk_disable_unprepare(ms->nfi_clk);
|
clk_disable_unprepare(ms->nfi_clk);
|
||||||
}
|
}
|
||||||
@ -1401,6 +1412,13 @@ static int mtk_snand_probe(struct platform_device *pdev)
|
|||||||
goto release_ecc;
|
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);
|
ret = mtk_snand_enable_clk(ms);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto release_ecc;
|
goto release_ecc;
|
||||||
|
Loading…
Reference in New Issue
Block a user