linux-mips
[Top] [All Lists]

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

To: Jonas Gorski <jogo@openwrt.org>
Subject: Re: [PATCH 5/5] spi: add bcm63xx HSSPI driver
From: Mark Brown <broonie@kernel.org>
Date: Wed, 4 Dec 2013 13:38:23 +0000
Cc: 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: <1385811726-6746-6-git-send-email-jogo@openwrt.org>
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>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.21 (2010-09-15)
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.

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

Use devm_clk_get().

> +     clk_prepare_enable(clk);

You should check the return value here.

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

devm_spi_register_master().

> +#ifdef CONFIG_PM

This should be CONFIG_PM_SLEEP.

> +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.

> +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.

Attachment: signature.asc
Description: Digital signature

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