Re: [PATCH 3/4] spi: Add OF binding support for SPI busses

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Guennadi Liakhovetski <g.liakhovetski@...>
Cc: <linuxppc-dev@...>, <spi-devel-general@...>, <linux-kernel@...>, <dbrownell@...>, <fabrizio.garetto@...>, <jonsmirl@...>
Date: Tuesday, May 20, 2008 - 1:13 am

On Mon, May 19, 2008 at 10:30 AM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:

Hurrmmmm...

I'm not so fond of this approach.  cs-parent doesn't seem to make much
sense to me.  It might be better to have a cs-handler property on the
SPI bus node instead of on the SPI slave nodes, but even then it
leaves a number of questions about what it really means.  In some
cases it would be overkill.  For example, if the SPI node simply had
multiple GPIO lines then an extra cs-parent node wouldn't be needed at
all.  Then there are the complex arrangements.  When setting CS
requires inserting a special 'set cs' SPI message at the right time.
Or worse; when setting CS requires /modifying/ the sent SPI message.
Essentially, the binding would need to describe the ability to
completely intercept and rewrite all SPI messages going through the CS
scheme.

I'm not saying it's not possible to do, but I am saying that I'd like
to have a better feel for all the use cases before it is defined.  I'm
not convinced that adding a cs-parent phandle will do that
appropriately.  That being said, my gut feel is that the solution will
be to support spi-bridge nodes that handle the complex CS
configuration settings; the spi-bridge would be a child of the
spi-master and the parent of the spi devices; and simple CS settings
being handled with regular old GPIO bindings.  (Much like the last
suggestion you make; except that I think that it *does* looks
elegant.)  :-)

example; here's an SPI bus that has 2 GPIOs for two bus CS lines and
an SPI bridge that uses both CSes; one address for accessing the
bridge's CS register and one CS to access the downstream devices.

+    SPI example for an MPC5200 SPI bus:
+               spi@f00 {
+                   #address-cells = <1>;
+                   #size-cells = <0>;
+                   compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi";
+                   reg = <0xf00 0x20>;
+                   interrupts = <2 13 0 2 14 0>;
+                   interrupt-parent = <&mpc5200_pic>;
+                   gpios = <&gpio1 0 0 &gpio1 1 0>;
+                   spi-bridge@0 {
+                       compatible = "oem,spi-bridge-type";
+                       reg = < 0 1 >;  // note: 2 SPI CS addresses;
first one to access bridge registers
+
+                       ethernet-switch@0 {
+                           compatible = "micrel,ks8995m";
+                           linux,modalias = "ks8995";
+                           max-speed = <1000000>;
+                           reg = <0>;
+                       };
...                     // and more SPI child nodes here...
+                   };
+               };

But even this doesn't reflect the hardware layout well.  What if the
SS lines are on SPI GPIO expanders on the same bus?  Then does it make
sense for them to be layed out as spi bridges?

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 3/4] spi: Add OF binding support for SPI busses, Grant Likely, (Fri May 16, 3:36 pm)
Re: [PATCH 3/4] spi: Add OF binding support for SPI busses, Guennadi Liakhovetski, (Mon May 19, 9:17 am)
Re: [PATCH 3/4] spi: Add OF binding support for SPI busses, Guennadi Liakhovetski, (Mon May 19, 12:30 pm)
Re: [PATCH 3/4] spi: Add OF binding support for SPI busses, Grant Likely, (Tue May 20, 1:13 am)
Re: [PATCH 3/4] spi: Add OF binding support for SPI busses, Guennadi Liakhovetski, (Tue May 20, 11:26 am)
Re: [PATCH 3/4] spi: Add OF binding support for SPI busses, Segher Boessenkool, (Wed May 21, 3:11 pm)
Re: [PATCH 3/4] spi: Add OF binding support for SPI busses, Gary Jennejohn, (Mon May 19, 1:09 pm)
Re: [PATCH 3/4] spi: Add OF binding support for SPI busses, Anton Vorontsov, (Mon May 19, 1:19 pm)
Re: [PATCH 3/4] spi: Add OF binding support for SPI busses, Anton Vorontsov, (Wed May 21, 11:19 am)
Re: [PATCH 3/4] spi: Add OF binding support for SPI busses, David Brownell, (Thu May 22, 10:05 pm)
Re: [PATCH 3/4] spi: Add OF binding support for SPI busses, David Brownell, (Sat May 24, 1:43 pm)
Re: [PATCH 3/4] spi: Add OF binding support for SPI busses, Jochen Friedrich, (Sat May 24, 1:14 pm)
Re: [PATCH 3/4] spi: Add OF binding support for SPI busses, David Brownell, (Sat May 24, 1:45 pm)
Re: [PATCH 3/4] spi: Add OF binding support for SPI busses, Anton Vorontsov, (Fri May 16, 6:03 pm)
Re: [PATCH 3/4] spi: Add OF binding support for SPI busses, Anton Vorontsov, (Fri May 16, 6:49 pm)
Re: [PATCH 3/4] spi: Add OF binding support for SPI busses, David Brownell, (Wed May 21, 9:16 pm)