All of lore.kernel.org
 help / color / mirror / Atom feed
From: leroy christophe <christophe.leroy@c-s.fr>
To: Stephen Warren <swarren@wwwdotorg.org>
Cc: devicetree@vger.kernel.org,
	Ian Campbell <ian.campbell@citrix.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <Mark.Rutland@arm.com>,
	Rob Herring <rob.herring@calxeda.com>,
	linux-spi@vger.kernel.org
Subject: Re: Fwd: [PATCH] SPI: Set SPI bits per words in an OF DeviceTree SPI node
Date: Wed, 14 Aug 2013 15:21:30 +0200	[thread overview]
Message-ID: <520B845A.4070602@c-s.fr> (raw)
In-Reply-To: <52027637.7000309@wwwdotorg.org>


>> In the node, you then have to include the 'spi-bits' property.
>>
>> Exemple:
>>      fpga-loader@7 {
>>          compatible = "cs,fpga-loader";
>>          spi-max-frequency = <10000000>;
>>          reg = <7>;
>>          spi-cs-high;
>>          spi-bits = <16>;
>>      };
> Shouldn't the driver for cs,fpga-loader be defining how many bit the SPI
> transactions should use? If the binding covers HW that can operate at
> various bits-per-word, it's reasonable for those individual bindings to
> define a property that sets that width, but I'm not convinced it's
> reasonable for the SPI core to allow any DT node to specify that, and
> presumably override the SPI device's driver's selection.
>
This is a tricky question.

The issue in the CPM (communication co-processor) on the MPC 8xx CPU is 
that, when you use the 16 bits mode, the CPM swaps the bytes, so the 
driver must unswap them to use them properly.
It looks like their is the same issue with other CPUs, like the MPCs 
having the Quick Engine. In the QE driver, it is done simple: the 
transfert is forced at 8bits at all time regardless on what the driver 
requests. This is known to work well, but I don't want to do that for 
the CPM driver, because the 16 bits mode is a lot less CPU consuming 
than the 8 bits mode, and my own drivers for my custom components do 
work in 16 bits mode (byte swap is included in those drivers).

That's the reason why I was proposing a way, through the Device Tree, to 
select the speed instead of forcing it inside the driver.
Because the MAX7301 driver for instance, which used to force 16 bits 
mode, does work perfectly well on the MPC8xx in 8 bits mode, but doesn't 
work in 16 bits because it doesn't unswap the bytes.
If I modify that driver to swap the bytes, it will not work anymore on 
platforms that don't require bytes to be swapped.

So, really, I don't know what to do here. Do you have any suggestion ?

  reply	other threads:[~2013-08-14 13:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-07 15:44 [PATCH] SPI: Set SPI bits per words in an OF DeviceTree SPI node Christophe Leroy
2013-08-07 15:44 ` Christophe Leroy
2013-08-07 15:54 ` Fwd: " leroy christophe
2013-08-07 16:27   ` Kumar Gala
2013-08-07 16:30   ` Fwd: " Stephen Warren
2013-08-14 13:21     ` leroy christophe [this message]
2013-08-14 16:19       ` Stephen Warren
2013-08-14 16:29         ` leroy christophe
2013-08-14 16:31           ` Stephen Warren

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=520B845A.4070602@c-s.fr \
    --to=christophe.leroy@c-s.fr \
    --cc=Mark.Rutland@arm.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=devicetree@vger.kernel.org \
    --cc=ian.campbell@citrix.com \
    --cc=linux-spi@vger.kernel.org \
    --cc=pawel.moll@arm.com \
    --cc=rob.herring@calxeda.com \
    --cc=swarren@wwwdotorg.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.