linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SPI bridge
@ 2008-05-09 16:24 Grant Likely
       [not found] ` <fa686aa40805090924r1b6f06fhb0369f18958bd8a6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Grant Likely @ 2008-05-09 16:24 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

I don't see anything in the SPI documentation about this... has any
work been done on supporting drivers for SPI bridges?  Specifically,
an SPI device that has local registers, but can also pass through the
SPI signals to child devices.

As an example; imagine the following configuration:

+------------+
| SPI Master |
+------------+
 |
 |MDIO,MISO,MCK,SS0,SS1
 |
+-------------+  SS2  +--------------+
|             |-------| SPI Device 1 |
| SPI Bridge  |       +--------------+
|             |
|             |  SS3  +--------------+
|             |-------| SPI Device 1 |
|             |       +--------------+
|             |
|             |  SS4  +--------------+
|             |-------| SPI Device 1 |
+-------------+       +--------------+

So, SS0 access registers on the SPI bridge
SS1 is passed through so SS2, SS3 or SS4 based on a register value in
the SPI bridge.  I thought about just overriding the SPI controller's
SS activate function, but that leaves a bit of a chicken and egg
problem.  The message has already been dequeued when the CS is called,
but the new SPI message so set the SS register needs to be inserted
before the current message.  I could hack it to make it work, but I'd
like to do this in a reusable/adaptable way.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: SPI bridge
       [not found] ` <fa686aa40805090924r1b6f06fhb0369f18958bd8a6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2008-05-09 23:22   ` Erwin Authried
  2008-05-10  2:28     ` Grant Likely
  0 siblings, 1 reply; 3+ messages in thread
From: Erwin Authried @ 2008-05-09 23:22 UTC (permalink / raw)
  To: spi-devel-general

I'm I'm using something close to your description. On the SPI master, I
have one chipselect (SS)only. When the master starts a transfer to SPI
device N, it activates SS and sends the slave address as the first byte.
When the SPI bridge receives the address byte, it activates the
chipselect for the required peripheral. When the SPI transfer is
finished and SS is deselected, the SPI bridge deactivates the
peripheral's chipselect.
I have used this with the bitbang driver. In spi_gpio, I have modified
the chipselect function so that it sends the address byte each time
chipselect goes active. I have used this with success for SD-card, RTC
and LCD sharing the same SPI bus.

Regards,
Erwin

Am Freitag, den 09.05.2008, 10:24 -0600 schrieb Grant Likely:
> I don't see anything in the SPI documentation about this... has any
> work been done on supporting drivers for SPI bridges?  Specifically,
> an SPI device that has local registers, but can also pass through the
> SPI signals to child devices.
> 
> As an example; imagine the following configuration:
> 
> +------------+
> | SPI Master |
> +------------+
>  |
>  |MDIO,MISO,MCK,SS0,SS1
>  |
> +-------------+  SS2  +--------------+
> |             |-------| SPI Device 1 |
> | SPI Bridge  |       +--------------+
> |             |
> |             |  SS3  +--------------+
> |             |-------| SPI Device 1 |
> |             |       +--------------+
> |             |
> |             |  SS4  +--------------+
> |             |-------| SPI Device 1 |
> +-------------+       +--------------+
> 
> So, SS0 access registers on the SPI bridge
> SS1 is passed through so SS2, SS3 or SS4 based on a register value in
> the SPI bridge.  I thought about just overriding the SPI controller's
> SS activate function, but that leaves a bit of a chicken and egg
> problem.  The message has already been dequeued when the CS is called,
> but the new SPI message so set the SS register needs to be inserted
> before the current message.  I could hack it to make it work, but I'd
> like to do this in a reusable/adaptable way.
> 
> Cheers,
> g.
> 


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: SPI bridge
  2008-05-09 23:22   ` Erwin Authried
@ 2008-05-10  2:28     ` Grant Likely
  0 siblings, 0 replies; 3+ messages in thread
From: Grant Likely @ 2008-05-10  2:28 UTC (permalink / raw)
  To: Erwin Authried; +Cc: spi-devel-general

On Fri, May 9, 2008 at 5:22 PM, Erwin Authried <eauth-T13/FXdtSm+ALaLeEb27IQ@public.gmane.org> wrote:
> I'm I'm using something close to your description. On the SPI master, I
> have one chipselect (SS)only. When the master starts a transfer to SPI
> device N, it activates SS and sends the slave address as the first byte.
> When the SPI bridge receives the address byte, it activates the
> chipselect for the required peripheral. When the SPI transfer is
> finished and SS is deselected, the SPI bridge deactivates the
> peripheral's chipselect.
> I have used this with the bitbang driver. In spi_gpio, I have modified
> the chipselect function so that it sends the address byte each time
> chipselect goes active. I have used this with success for SD-card, RTC
> and LCD sharing the same SPI bus.

Can you send me your patch?  (Mostly for interest sake, I'd just like
to see how you've done it.  From your description, it sounds like you
made a board specific change to the driver itself.  Am I correct?

What I'm hoping to do is define a 'shim' interface that makes the SPI
bridge transparent to the SPI master device (ie; the SPI bridge is
both a master and a device; the devices are registered with the
bridge, and the bridge is registered with the SPI master.  Devices
issues their SPI messages to the bridge and the bridge reissues them
to the master).  That way the master drivers don't need to be hacked
for board specific layouts.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-05-10  2:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-09 16:24 SPI bridge Grant Likely
     [not found] ` <fa686aa40805090924r1b6f06fhb0369f18958bd8a6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-05-09 23:22   ` Erwin Authried
2008-05-10  2:28     ` Grant Likely

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