linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: John Crispin <blogic@openwrt.org>
Cc: spi-devel-general@lists.sourceforge.net,
	linux-mips@linux-mips.org,
	Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
Subject: Re: [PATCH] SPI: MIPS: lantiq: adds spi-xway
Date: Wed, 22 Aug 2012 19:59:44 +0100	[thread overview]
Message-ID: <20120822185944.GD7995@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1345103821-12543-1-git-send-email-blogic@openwrt.org>

[-- Attachment #1: Type: text/plain, Size: 2474 bytes --]

On Thu, Aug 16, 2012 at 09:57:01AM +0200, John Crispin wrote:
> This patch adds support for the SPI core found on several Lantiq SoCs.
> The Driver has been runtime tested in combination with m25p80 Flash Devices
> on Amazon_SE and VR9.
> 
> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
> Signed-off-by: John Crispin <blogic@openwrt.org>

I'm not seeing any binding documentation in here but there's OF
bindings - any new device tree bindings should have documentation
attached.

> +static inline u32 ltq_spi_reg_read(struct ltq_spi *hw, u32 reg)
> +{
> +	return ioread32be(hw->base + reg);
> +}

Can you use regmap_mmio?  Not that it makes much difference, really -
it's totally unimportant, just something to consider.

> +static void ltq_spi_hw_enable(struct ltq_spi *hw)
> +{
> +	u32 clc;

Obviously it'd be nice if this were only done during SPI transfers,
currently the module is enabled whenever the driver is loaded.  Again
just something to consider.

> +static u32 ltq_spi_tx_word_u8(struct ltq_spi *hw)
> +{
> +	const u8 *tx = hw->tx;
> +	u32 data = *tx++;
> +
> +	hw->tx_cnt++;
> +	hw->tx++;
> +
> +	return data;
> +}

I can't help but think that there's some stuff here that ought to be
factored out for bitbanging controllers, but it's not that important.

> +static void ltq_spi_cleanup(struct spi_device *spi)
> +{
> +
> +}

Just remove empty functions - if the function is mandatory it at least
needs an explanation as to why your driver doesn't need to do anything.

> +       if (of_machine_is_compatible("lantiq,ase"))
> +               master->num_chipselect = 3;
> +       else
> +               master->num_chipselect = 6;

This is very suspicious - why is this being done based on the machine
rather than based on the IP?  Surely there can be machines with this SoC
on which aren't compatible with whatever (reference?) board this is
matching on.  I'd expect that the driver would have multiple compatible
strings which it uses to distinguish the capabilities of the IP.

Though actually the driver never reads this value so perhaps the code
can just be deleted and we rely on the fact that if the /CS isn't
physically present nobody's going to hook it up on a board so just
always set it to 6?

> +	pr_info("Lantiq SoC SPI controller rev %u (TXFS %u, RXFS %u, DMA %u)\n",
> +		id & LTQ_SPI_ID_REV_MASK, hw->txfs, hw->rxfs, hw->dma_support);

dev_info().

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2012-08-22 18:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-16  7:57 [PATCH] SPI: MIPS: lantiq: adds spi-xway John Crispin
2012-08-22 18:59 ` Mark Brown [this message]
     [not found]   ` <20120822185944.GD7995-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-08-22 19:04     ` John Crispin
2012-08-22 19:09       ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120822185944.GD7995@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=blogic@openwrt.org \
    --cc=daniel.schwierzeck@googlemail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).