Message ID | 1551360342-23981-3-git-send-email-gareth.williams.jx@renesas.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | spi: dw: Add support for an optional interface clock | expand |
On Thu, Feb 28, 2019 at 01:25:42PM +0000, Gareth Williams wrote: > From: Phil Edworthy <phil.edworthy@renesas.com> > > The Synopsys SSI Controller has an interface clock, but most SoCs hide > this away. However, on some SoCs you need to explicity enable the > interface clock in order to access the registers. Therefore, add > support for an optional interface clock. This doesn't build for me: CC drivers/spi/spi-dw-mmio.o drivers/spi/spi-dw-mmio.c: In function ‘dw_spi_mmio_probe’: drivers/spi/spi-dw-mmio.c:177:18: error: implicit declaration of function ‘devm_clk_get_optional’; did you mean ‘devm_gpiod_get_optional’? [-Werror=implicit-function-declaration] dwsmmio->pclk = devm_clk_get_optional(&pdev->dev, "pclk"); ^~~~~~~~~~~~~~~~~~~~~ devm_gpiod_get_optional drivers/spi/spi-dw-mmio.c:177:16: warning: assignment to ‘struct clk *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion] dwsmmio->pclk = devm_clk_get_optional(&pdev->dev, "pclk"); ^
Hi Mark, > On Mon, Mar 04, 2019 00:05:00, Mark Brown wrote: > > On Thu, Feb 28, 2019 at 01:25:42PM +0000, Gareth Williams wrote: > > From: Phil Edworthy <phil.edworthy@renesas.com> > > > > The Synopsys SSI Controller has an interface clock, but most SoCs hide > > this away. However, on some SoCs you need to explicity enable the > > interface clock in order to access the registers. Therefore, add > > support for an optional interface clock. > > This doesn't build for me: > > CC drivers/spi/spi-dw-mmio.o > drivers/spi/spi-dw-mmio.c: In function ‘dw_spi_mmio_probe’: > drivers/spi/spi-dw-mmio.c:177:18: error: implicit declaration of function > ‘devm_clk_get_optional’; did you mean ‘devm_gpiod_get_optional’? [- > Werror=implicit-function-declaration] > dwsmmio->pclk = devm_clk_get_optional(&pdev->dev, "pclk"); > ^~~~~~~~~~~~~~~~~~~~~ > devm_gpiod_get_optional > drivers/spi/spi-dw-mmio.c:177:16: warning: assignment to ‘struct clk *’ from > ‘int’ makes pointer from integer without a cast [-Wint-conversion] > dwsmmio->pclk = devm_clk_get_optional(&pdev->dev, "pclk"); > ^ Sorry, I should have noted the dependency for the patch below. I will add this into the next version. https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/clk/clk-devres.c?h=next-20190304&id=60b8f0ddf1a927ef02141a6610fd52575134f821 Kind Regards, Gareth Renesas Electronics Europe GmbH,Geschaeftsfuehrer/President : Michael Hannawald, Sitz der Gesellschaft/Registered office: Duesseldorf, Arcadiastrasse 10, 40472 Duesseldorf, Germany,Handelsregister/Commercial Register: Duesseldorf, HRB 3708 USt-IDNr./Tax identification no.: DE 119353406 WEEE-Reg.-Nr./WEEE reg. no.: DE 14978647
diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index 4bd59a9..7cbc173 100644 --- a/drivers/spi/spi-dw-mmio.c +++ b/drivers/spi/spi-dw-mmio.c @@ -30,6 +30,7 @@ struct dw_spi_mmio { struct dw_spi dws; struct clk *clk; + struct clk *pclk; void *priv; }; @@ -172,6 +173,14 @@ static int dw_spi_mmio_probe(struct platform_device *pdev) if (ret) return ret; + /* Optional interface clock */ + dwsmmio->pclk = devm_clk_get_optional(&pdev->dev, "pclk"); + if (IS_ERR(dwsmmio->pclk)) + return PTR_ERR(dwsmmio->pclk); + ret = clk_prepare_enable(dwsmmio->pclk); + if (ret) + goto out_clk; + dws->bus_num = pdev->id; dws->max_freq = clk_get_rate(dwsmmio->clk); @@ -199,6 +208,8 @@ static int dw_spi_mmio_probe(struct platform_device *pdev) return 0; out: + clk_disable_unprepare(dwsmmio->pclk); +out_clk: clk_disable_unprepare(dwsmmio->clk); return ret; } @@ -208,6 +219,7 @@ static int dw_spi_mmio_remove(struct platform_device *pdev) struct dw_spi_mmio *dwsmmio = platform_get_drvdata(pdev); dw_spi_remove_host(&dwsmmio->dws); + clk_disable_unprepare(dwsmmio->pclk); clk_disable_unprepare(dwsmmio->clk); return 0;