Message ID | 1384729577-7336-9-git-send-email-gsi@denx.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Nov 18, 2013 at 12:06:08AM +0100, Gerhard Sittig wrote: > after device tree based clock lookup became available, the peripheral > driver need no longer construct clock names which include the PSC index, > remove the "psc%d_mclk" template and unconditionally use 'mclk' Have there been other changes which make this happen?
On Mon, Nov 25, 2013 at 17:30 +0000, Mark Brown wrote: > > On Mon, Nov 18, 2013 at 12:06:08AM +0100, Gerhard Sittig wrote: > > after device tree based clock lookup became available, the peripheral > > driver need no longer construct clock names which include the PSC index, > > remove the "psc%d_mclk" template and unconditionally use 'mclk' > > Have there been other changes which make this happen? Not yet in mainline. The patch you respond to is 08/17 within the series, and depends on earlier patches in the series (namely the introduction of CCF support for the MPC512x platform, making the 'mclk' lookup against the PSC's OF node work while keeping the global 'pscN_mclk' in place during migration). This information was listed in the cover letter, but was not duplicated within the individual patches. Patches were sent to individual Cc: lists to not spam too many people, but the cover letter was CC'ed to every recipient of any part of the series. Please note that I will have to re-submit the series, since it no longer cleanly applies against v3.13-rc1 (which was not available when I sent v5). This patch won't change in its content, but may experience changes in its context (catchup with changes between v3.12 and v3.13-rc1). Thank you for considering the patch, and for your feedback on past versions! virtually yours Gerhard Sittig
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index 6adf4e35816d..5beb30c61a39 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b/drivers/spi/spi-mpc512x-psc.c @@ -39,6 +39,7 @@ struct mpc512x_psc_spi { unsigned int irq; u8 bits_per_word; struct clk *clk_mclk; + struct clk *clk_ipg; u32 mclk_rate; struct completion txisrdone; @@ -474,8 +475,6 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, struct spi_master *master; int ret; void *tempp; - int psc_num; - char clk_name[16]; struct clk *clk; master = spi_alloc_master(dev, sizeof *mps); @@ -519,9 +518,7 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, goto free_master; init_completion(&mps->txisrdone); - psc_num = master->bus_num; - snprintf(clk_name, sizeof(clk_name), "psc%d_mclk", psc_num); - clk = devm_clk_get(dev, clk_name); + clk = devm_clk_get(dev, "mclk"); if (IS_ERR(clk)) { ret = PTR_ERR(clk); goto free_irq; @@ -532,17 +529,29 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, mps->clk_mclk = clk; mps->mclk_rate = clk_get_rate(clk); + clk = devm_clk_get(dev, "ipg"); + if (IS_ERR(clk)) { + ret = PTR_ERR(clk); + goto free_mclk_clock; + } + ret = clk_prepare_enable(clk); + if (ret) + goto free_mclk_clock; + mps->clk_ipg = clk; + ret = mpc512x_psc_spi_port_config(master, mps); if (ret < 0) - goto free_clock; + goto free_ipg_clock; ret = spi_register_master(master); if (ret < 0) - goto free_clock; + goto free_ipg_clock; return ret; -free_clock: +free_ipg_clock: + clk_disable_unprepare(mps->clk_ipg); +free_mclk_clock: clk_disable_unprepare(mps->clk_mclk); free_irq: free_irq(mps->irq, mps); @@ -561,6 +570,7 @@ static int mpc512x_psc_spi_do_remove(struct device *dev) spi_unregister_master(master); clk_disable_unprepare(mps->clk_mclk); + clk_disable_unprepare(mps->clk_ipg); free_irq(mps->irq, mps); if (mps->psc) iounmap(mps->psc);
after device tree based clock lookup became available, the peripheral driver need no longer construct clock names which include the PSC index, remove the "psc%d_mclk" template and unconditionally use 'mclk' acquire and release the 'ipg' clock item for register access as well Cc: Mark Brown <broonie@kernel.org> Cc: linux-spi@vger.kernel.org Signed-off-by: Gerhard Sittig <gsi@denx.de> --- drivers/spi/spi-mpc512x-psc.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)