* [PATCH] SPI bit bang: Deactivate CS before restoring speed & wordsize
@ 2008-03-07 15:52 Joakim Tjernlund
[not found] ` <1204905149.29669.22.camel-/EMGr9iCeazgSi9v3i4K4Pmbkio/vSLMs0AfqQuZ5sE@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Joakim Tjernlund @ 2008-03-07 15:52 UTC (permalink / raw)
To: spi-devel-general
Restoring speed & wordsize on mpc83xx disables the controller temporarily
which makes the SPI outputs floating. This can cause a glich on
the SPI CLK which makes the slave in the other end unhappy.
Make sure that CS is disabled before restoring speed & wordsize
so any gliches are ignored by the SPI slave.
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org>
---
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c
index 0c85c98..53649cd 100644
--- a/drivers/spi/spi_bitbang.c
+++ b/drivers/spi/spi_bitbang.c
@@ -371,10 +371,6 @@ static void bitbang_work(struct work_struct *work)
m->status = status;
m->complete(m->context);
- /* restore speed and wordsize */
- if (setup_transfer)
- setup_transfer(spi, NULL);
-
/* normally deactivate chipselect ... unless no error and
* cs_change has hinted that the next message will probably
* be for this chip too.
@@ -385,6 +381,10 @@ static void bitbang_work(struct work_struct *work)
ndelay(nsecs);
}
+ /* restore speed and wordsize */
+ if (setup_transfer)
+ setup_transfer(spi, NULL);
+
spin_lock_irqsave(&bitbang->lock, flags);
}
bitbang->busy = 0;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] SPI bit bang: Deactivate CS before restoring speed & wordsize
[not found] ` <1204905149.29669.22.camel-/EMGr9iCeazgSi9v3i4K4Pmbkio/vSLMs0AfqQuZ5sE@public.gmane.org>
@ 2008-03-08 1:55 ` David Brownell
0 siblings, 0 replies; 2+ messages in thread
From: David Brownell @ 2008-03-08 1:55 UTC (permalink / raw)
To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
joakim.tjernlund-SNLAxHN9vbcOP4wsBPIw7w
On Friday 07 March 2008, Joakim Tjernlund wrote:
> Restoring speed & wordsize on mpc83xx disables the controller temporarily
> which makes the SPI outputs floating. This can cause a glich on
> the SPI CLK which makes the slave in the other end unhappy.
This will also cause trouble with any driver using these protocol
tweaking options:
- per-transfer overrides of speed and/or wordsize
- leaving chip selected between messages
The mpc83xx driver is not overriding master->transfer, so all of
those are behaviors this driver claims to support...
> Make sure that CS is disabled before restoring speed & wordsize
> so any gliches are ignored by the SPI slave.
I think the correct fix hast to be in mpc83xx_spi_setup_transfer().
If that routine is fixed, the bitbang core won't need to change,
and those protocol tweaking options will just work.
Or else, this patch would need to be accompanied by a patch which
updates spi_mpc83xx to override master->transfer and filter out all
messages which use those protocol tweaking options, so that all the
places this glitch can appear will be addressed.
- Dave
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-08 1:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-07 15:52 [PATCH] SPI bit bang: Deactivate CS before restoring speed & wordsize Joakim Tjernlund
[not found] ` <1204905149.29669.22.camel-/EMGr9iCeazgSi9v3i4K4Pmbkio/vSLMs0AfqQuZ5sE@public.gmane.org>
2008-03-08 1:55 ` David Brownell
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).