* [PATCH 0/3] Fix Mediatek SPI bus driver clock usage error @ 2015-08-31 13:18 Leilk Liu 2015-08-31 13:18 ` [PATCH 1/3] spi: mediatek: remove clk_disable_unprepare() Leilk Liu ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: Leilk Liu @ 2015-08-31 13:18 UTC (permalink / raw) To: Mark Brown Cc: Mark Rutland, Matthias Brugger, Sascha Hauer, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r From: Leilk Liu <leilk.liu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> This series are based on 4.2-rc1 and provide three patches to fix mediatek spi driver clock usage error. spi clock manages flow: CLK_TOP_SYSPLL3_D2 ---> CLK_TOP_SPI_SEL ---> CLK_PERI_SPI0 (source clock) (clock mux) (clock gate) spi driver should choose source clock by clock mux, then enable clock gate. Leilk Liu (3): spi: mediatek: remove clk_disable_unprepare() spi: mediatek: fix spi clock usage error spi: Mediatek: Document devicetree bindings update for spi bus .../devicetree/bindings/spi/spi-mt65xx.txt | 16 +++++++++------ drivers/spi/spi-mt65xx.c | 24 ++++++++++++++-------- 2 files changed, 25 insertions(+), 15 deletions(-) -- 1.8.1.1.dirty -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] spi: mediatek: remove clk_disable_unprepare() 2015-08-31 13:18 [PATCH 0/3] Fix Mediatek SPI bus driver clock usage error Leilk Liu @ 2015-08-31 13:18 ` Leilk Liu [not found] ` <1441027138-16458-1-git-send-email-leilk.liu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 2015-08-31 13:18 ` [PATCH 3/3] spi: Mediatek: Document devicetree bindings update for spi bus Leilk Liu 2 siblings, 0 replies; 4+ messages in thread From: Leilk Liu @ 2015-08-31 13:18 UTC (permalink / raw) To: Mark Brown Cc: Mark Rutland, Matthias Brugger, Sascha Hauer, devicetree, linux-kernel, linux-arm-kernel, linux-spi, linux-mediatek, Leilk Liu This patch removes clk_disable_unprepare() in mtk_spi_remove(). clk_disable_prepare/unprepare must be balance, spi-clk is disabled in mtk_spi_probe, so not needs to disable again. Signed-off-by: Leilk Liu <leilk.liu@mediatek.com> --- drivers/spi/spi-mt65xx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c index d882261..3a177d0 100644 --- a/drivers/spi/spi-mt65xx.c +++ b/drivers/spi/spi-mt65xx.c @@ -630,7 +630,6 @@ static int mtk_spi_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); mtk_spi_reset(mdata); - clk_disable_unprepare(mdata->spi_clk); spi_master_put(master); return 0; -- 1.8.1.1.dirty ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <1441027138-16458-1-git-send-email-leilk.liu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>]
* [PATCH 2/3] spi: mediatek: fix spi clock usage error [not found] ` <1441027138-16458-1-git-send-email-leilk.liu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> @ 2015-08-31 13:18 ` Leilk Liu 0 siblings, 0 replies; 4+ messages in thread From: Leilk Liu @ 2015-08-31 13:18 UTC (permalink / raw) To: Mark Brown Cc: Mark Rutland, Matthias Brugger, Sascha Hauer, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Leilk Liu spi clock manages flow: CLK_TOP_SYSPLL3_D2 ---> CLK_TOP_SPI_SEL ---> CLK_PERI_SPI0 (source clock) (clock mux) (clock gate) spi driver should choose source clock by clock mux, then enable clock gate. Signed-off-by: Leilk Liu <leilk.liu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> --- drivers/spi/spi-mt65xx.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c index 3a177d0..5ecd644 100644 --- a/drivers/spi/spi-mt65xx.c +++ b/drivers/spi/spi-mt65xx.c @@ -85,7 +85,7 @@ struct mtk_spi { void __iomem *base; u32 state; u32 pad_sel; - struct clk *spi_clk, *parent_clk; + struct clk *parent_clk, *sel_clk, *spi_clk; struct spi_transfer *cur_transfer; u32 xfer_len; struct scatterlist *tx_sgl, *rx_sgl; @@ -576,17 +576,24 @@ static int mtk_spi_probe(struct platform_device *pdev) goto err_put_master; } - mdata->spi_clk = devm_clk_get(&pdev->dev, "spi-clk"); - if (IS_ERR(mdata->spi_clk)) { + mdata->parent_clk = devm_clk_get(&pdev->dev, "parent-clk"); + if (IS_ERR(mdata->parent_clk)) { + ret = PTR_ERR(mdata->parent_clk); + dev_err(&pdev->dev, "failed to get parent-clk: %d\n", ret); + goto err_put_master; + } + + mdata->sel_clk = devm_clk_get(&pdev->dev, "sel-clk"); + if (IS_ERR(mdata->sel_clk)) { ret = PTR_ERR(mdata->spi_clk); - dev_err(&pdev->dev, "failed to get spi-clk: %d\n", ret); + dev_err(&pdev->dev, "failed to get sel-clk: %d\n", ret); goto err_put_master; } - mdata->parent_clk = devm_clk_get(&pdev->dev, "parent-clk"); - if (IS_ERR(mdata->parent_clk)) { + mdata->spi_clk = devm_clk_get(&pdev->dev, "spi-clk"); + if (IS_ERR(mdata->spi_clk)) { ret = PTR_ERR(mdata->parent_clk); - dev_err(&pdev->dev, "failed to get parent-clk: %d\n", ret); + dev_err(&pdev->dev, "failed to get spi-clk: %d\n", ret); goto err_put_master; } @@ -596,7 +603,7 @@ static int mtk_spi_probe(struct platform_device *pdev) goto err_put_master; } - ret = clk_set_parent(mdata->spi_clk, mdata->parent_clk); + ret = clk_set_parent(mdata->sel_clk, mdata->parent_clk); if (ret < 0) { dev_err(&pdev->dev, "failed to clk_set_parent (%d)\n", ret); goto err_disable_clk; -- 1.8.1.1.dirty -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] spi: Mediatek: Document devicetree bindings update for spi bus 2015-08-31 13:18 [PATCH 0/3] Fix Mediatek SPI bus driver clock usage error Leilk Liu 2015-08-31 13:18 ` [PATCH 1/3] spi: mediatek: remove clk_disable_unprepare() Leilk Liu [not found] ` <1441027138-16458-1-git-send-email-leilk.liu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> @ 2015-08-31 13:18 ` Leilk Liu 2 siblings, 0 replies; 4+ messages in thread From: Leilk Liu @ 2015-08-31 13:18 UTC (permalink / raw) To: Mark Brown Cc: Mark Rutland, Matthias Brugger, Sascha Hauer, devicetree, linux-kernel, linux-arm-kernel, linux-spi, linux-mediatek, Leilk Liu This patch updates spi bindings, fixs clock usage description. Signed-off-by: Leilk Liu <leilk.liu@mediatek.com> --- Documentation/devicetree/bindings/spi/spi-mt65xx.txt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt index dcefc43..6160ffb 100644 --- a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt +++ b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt @@ -15,17 +15,18 @@ Required properties: - interrupts: Should contain spi interrupt - clocks: phandles to input clocks. - The first should be <&topckgen CLK_TOP_SPI_SEL>. - The second should be one of the following. + The first should be one of the following. It's PLL. - <&clk26m>: specify parent clock 26MHZ. - <&topckgen CLK_TOP_SYSPLL3_D2>: specify parent clock 109MHZ. It's the default one. - <&topckgen CLK_TOP_SYSPLL4_D2>: specify parent clock 78MHZ. - <&topckgen CLK_TOP_UNIVPLL2_D4>: specify parent clock 104MHZ. - <&topckgen CLK_TOP_UNIVPLL1_D8>: specify parent clock 78MHZ. + The second should be <&topckgen CLK_TOP_SPI_SEL>. It's clock mux. + The third is <&pericfg CLK_PERI_SPI0>. It's clock gate. -- clock-names: shall be "spi-clk" for the controller clock, and - "parent-clk" for the parent clock. +- clock-names: shall be "parent-clk" for the parent clock, "sel-clk" for the + muxes clock, and "spi-clk" for the clock gate. Optional properties: - mediatek,pad-select: specify which pins group(ck/mi/mo/cs) spi @@ -44,8 +45,11 @@ spi: spi@1100a000 { #size-cells = <0>; reg = <0 0x1100a000 0 0x1000>; interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_LOW>; - clocks = <&topckgen CLK_TOP_SPI_SEL>, <&topckgen CLK_TOP_SYSPLL3_D2>; - clock-names = "spi-clk", "parent-clk"; + clocks = <&topckgen CLK_TOP_SYSPLL3_D2>, + <&topckgen CLK_TOP_SPI_SEL>, + <&pericfg CLK_PERI_SPI0>; + clock-names = "parent-clk", "sel-clk", "spi-clk"; + mediatek,pad-select = <0>; status = "disabled"; }; -- 1.8.1.1.dirty ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-08-31 13:18 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-08-31 13:18 [PATCH 0/3] Fix Mediatek SPI bus driver clock usage error Leilk Liu 2015-08-31 13:18 ` [PATCH 1/3] spi: mediatek: remove clk_disable_unprepare() Leilk Liu [not found] ` <1441027138-16458-1-git-send-email-leilk.liu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 2015-08-31 13:18 ` [PATCH 2/3] spi: mediatek: fix spi clock usage error Leilk Liu 2015-08-31 13:18 ` [PATCH 3/3] spi: Mediatek: Document devicetree bindings update for spi bus Leilk Liu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).