[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ae6235b9-be0c-525d-660e-66fb28577376@microchip.com>
Date: Thu, 31 Jan 2019 10:46:10 +0000
From: <Tudor.Ambarus@...rochip.com>
To: <bbrezillon@...nel.org>
CC: <broonie@...nel.org>, <Nicolas.Ferre@...rochip.com>,
<alexandre.belloni@...tlin.com>, <Ludovic.Desroches@...rochip.com>,
<linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <linux-spi@...r.kernel.org>
Subject: Re: [PATCH 9/9] spi: atmel-quadspi: add support for sam9x60 qspi
controller
On 01/30/2019 07:43 PM, Boris Brezillon wrote:
> On Wed, 30 Jan 2019 15:08:47 +0000
> <Tudor.Ambarus@...rochip.com> wrote:
>
>> +static int atmel_sam9x60_qspi_clk_prepare_enable(struct atmel_qspi *aq)
>> +{
>> + struct device *dev = &aq->pdev->dev;
>> + int ret;
>> +
>> + if (!aq->clk) {
>> + /* Get the peripheral clock */
>> + aq->clk = devm_clk_get(dev, "pclk");
>> + if (IS_ERR(aq->clk)) {
>> + dev_err(dev, "missing peripheral clock\n");
>> + return PTR_ERR(aq->clk);
>> + }
>> + }
>> +
>> + if (!aq->qspick) {
>> + /* Get the QSPI system clock */
>> + aq->qspick = devm_clk_get(dev, "qspick");
>> + if (IS_ERR(aq->qspick)) {
>> + dev_err(dev, "missing system clock\n");
>> + return PTR_ERR(aq->qspick);
>> + }
>> + }
>
> Move the devm_clk_get() calls to the probe path instead of doing it at
> prepare time, and you can make it generic for both compats with
> something like:
>
> aq->clk = devm_clk_get(dev, "pclk");
> if (IS_ERR(aq->clk))
> aq->clk = devm_clk_get(dev, NULL);
>
> if (IS_ERR(aq->clk))
> return PTR_ERR(aq->clk);
>
> if (aq->caps->qspick_required) {
> aq->qspick = devm_clk_get(dev, "qspick");
> if (IS_ERR(aq->qspick)) {
> return PTR_ERR(aq->qspick);
> }
good tip, will do, thanks!
ta
Powered by blists - more mailing lists