summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-mtk-nor.c
diff options
context:
space:
mode:
authorGuochun Mao <guochun.mao@mediatek.com>2022-01-18 22:28:20 +0800
committerMark Brown <broonie@kernel.org>2022-01-24 13:32:12 +0000
commit58b0a653b8dac40bbeb01a2c8a230aa8f84a7530 (patch)
tree1c9946571f97b5826f3fb9f691e4e77a8baa6a9a /drivers/spi/spi-mtk-nor.c
parent4e8bfe5cdf77621cb4e7b196448ceeff20d9d6a6 (diff)
downloadlinux-58b0a653b8dac40bbeb01a2c8a230aa8f84a7530.tar.gz
linux-58b0a653b8dac40bbeb01a2c8a230aa8f84a7530.tar.bz2
linux-58b0a653b8dac40bbeb01a2c8a230aa8f84a7530.zip
spi: spi-mtk-nor: add axi_s clock for mt8186
MT8186 needs axi_s clock for DMA feature. Signed-off-by: Guochun Mao <guochun.mao@mediatek.com> Signed-off-by: Zhen Zhang <zhen.zhang@mediatek.com> Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220118142820.2729-5-guochun.mao@mediatek.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-mtk-nor.c')
-rw-r--r--drivers/spi/spi-mtk-nor.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/spi/spi-mtk-nor.c b/drivers/spi/spi-mtk-nor.c
index e44fdf7c9e4b..455b4dcb26e9 100644
--- a/drivers/spi/spi-mtk-nor.c
+++ b/drivers/spi/spi-mtk-nor.c
@@ -115,6 +115,7 @@ struct mtk_nor {
struct clk *spi_clk;
struct clk *ctlr_clk;
struct clk *axi_clk;
+ struct clk *axi_s_clk;
unsigned int spi_freq;
bool wbuf_en;
bool has_irq;
@@ -691,6 +692,7 @@ static void mtk_nor_disable_clk(struct mtk_nor *sp)
clk_disable_unprepare(sp->spi_clk);
clk_disable_unprepare(sp->ctlr_clk);
clk_disable_unprepare(sp->axi_clk);
+ clk_disable_unprepare(sp->axi_s_clk);
}
static int mtk_nor_enable_clk(struct mtk_nor *sp)
@@ -714,6 +716,14 @@ static int mtk_nor_enable_clk(struct mtk_nor *sp)
return ret;
}
+ ret = clk_prepare_enable(sp->axi_s_clk);
+ if (ret) {
+ clk_disable_unprepare(sp->spi_clk);
+ clk_disable_unprepare(sp->ctlr_clk);
+ clk_disable_unprepare(sp->axi_clk);
+ return ret;
+ }
+
return 0;
}
@@ -789,7 +799,7 @@ static int mtk_nor_probe(struct platform_device *pdev)
struct mtk_nor *sp;
struct mtk_nor_caps *caps;
void __iomem *base;
- struct clk *spi_clk, *ctlr_clk, *axi_clk;
+ struct clk *spi_clk, *ctlr_clk, *axi_clk, *axi_s_clk;
int ret, irq;
base = devm_platform_ioremap_resource(pdev, 0);
@@ -808,6 +818,10 @@ static int mtk_nor_probe(struct platform_device *pdev)
if (IS_ERR(axi_clk))
return PTR_ERR(axi_clk);
+ axi_s_clk = devm_clk_get_optional(&pdev->dev, "axi_s");
+ if (IS_ERR(axi_s_clk))
+ return PTR_ERR(axi_s_clk);
+
caps = (struct mtk_nor_caps *)of_device_get_match_data(&pdev->dev);
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(caps->dma_bits));
@@ -843,6 +857,7 @@ static int mtk_nor_probe(struct platform_device *pdev)
sp->spi_clk = spi_clk;
sp->ctlr_clk = ctlr_clk;
sp->axi_clk = axi_clk;
+ sp->axi_s_clk = axi_s_clk;
sp->caps = caps;
sp->high_dma = caps->dma_bits > 32;
sp->buffer = dmam_alloc_coherent(&pdev->dev,