linux-mips
[Top] [All Lists]

Re: [PATCH 5/5] spi: add bcm63xx HSSPI driver

To: Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH 5/5] spi: add bcm63xx HSSPI driver
From: Jonas Gorski <jogo@openwrt.org>
Date: Wed, 4 Dec 2013 15:04:48 +0100
Cc: MIPS Mailing List <linux-mips@linux-mips.org>, linux-spi@vger.kernel.org, Ralf Baechle <ralf@linux-mips.org>, John Crispin <blogic@openwrt.org>, Florian Fainelli <florian@openwrt.org>, Kevin Cernekee <cernekee@gmail.com>, Maxime Bizon <mbizon@freebox.fr>
In-reply-to: <20131204133823.GS29268@sirena.org.uk>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1385811726-6746-1-git-send-email-jogo@openwrt.org> <1385811726-6746-6-git-send-email-jogo@openwrt.org> <20131204133823.GS29268@sirena.org.uk>
Sender: linux-mips-bounce@linux-mips.org
On Wed, Dec 4, 2013 at 2:38 PM, Mark Brown <broonie@kernel.org> wrote:
> On Sat, Nov 30, 2013 at 12:42:06PM +0100, Jonas Gorski wrote:
>> Add a driver for the High Speed SPI controller found on newer BCM63XX SoCs.
>>
>> It does feature some new modes like 3-wire or dual spi, but neither of it
>> is currently implemented.
>
> This is basically good so I've applied it but there are a few minor
> things that could use improving, please send incremental patches for
> these.

Cool, thanks, will do. Expect a few days delay since I'm in the middle
of a cold. I Don't want to introduce thinkos ;-)

>
>> +     clk = clk_get(dev, "hsspi");
>
> Use devm_clk_get().

Oh, it indeed seems to work now. The last time I tried it broke
compilation because bcm63xx does not implement CLKDEV (or something
like that).

>
>> +     clk_prepare_enable(clk);
>
> You should check the return value here.

True, even if it can't fail in the current supported platforms.

>
>> +     /* register and we are done */
>> +     ret = spi_register_master(master);
>> +     if (ret)
>> +             goto out_put_master;
>
> devm_spi_register_master().

Sure thing.

>
>> +#ifdef CONFIG_PM
>
> This should be CONFIG_PM_SLEEP.

Ah, dammit, I knew I forgot something. I remember the same issue was
fixed for spi-bcm63xx.c, but somehow forgot to check for it in this
driver.


>> +static int bcm63xx_hsspi_suspend(struct device *dev)
>> +{
>> +     struct spi_master *master = dev_get_drvdata(dev);
>> +     struct bcm63xx_hsspi *bs = spi_master_get_devdata(master);
>> +
>> +     spi_master_suspend(master);
>> +     clk_disable(bs->clk);
>
> This ought to be disable_unprepare().  It would also be better to move
> this to runtime PM (you can set auto_runtime_pm to have the core manage
> the enable and disable for you) since that will save a bit of power.

I already set auto_runtime_pm to true. I basically copied what's
currently in spi-bcm63xx.c *coughs*. Is there anything else needed
besides what you mentioned?
>
>> +static int bcm63xx_hsspi_resume(struct device *dev)
>> +{
>> +     struct spi_master *master = dev_get_drvdata(dev);
>> +     struct bcm63xx_hsspi *bs = spi_master_get_devdata(master);
>> +
>> +     clk_enable(bs->clk);
>> +     spi_master_resume(master);
>
> Similar comments here, plus you should be checking errors.

Will fix that, too.


Regards
Jonas

<Prev in Thread] Current Thread [Next in Thread>