Thanks Greg,<br><br>I&#39;m having success more success with the driver now,<br><br>The device gets nicely probed and the probe function gets the properties from the device tree,<br><br>The following patch from Anton Vorontsov:<br>
<br><a href="http://kerneltrap.org/mailarchive/linux-kernel/2008/5/23/1922744">http://kerneltrap.org/mailarchive/linux-kernel/2008/5/23/1922744</a><br><br>Was very useful&nbsp; as example for adding the of support to my &#39;own&#39; spi slave driver.<br>
<br>(Thanks Anton,)<br><br>Henk.<br><br><div class="gmail_quote">On Fri, Feb 13, 2009 at 4:19 PM, Grant Likely <span dir="ltr">&lt;<a href="mailto:grant.likely@secretlab.ca">grant.likely@secretlab.ca</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">On Fri, Feb 13, 2009 at 3:40 AM, Henk Stegeman &lt;<a href="mailto:henk.stegeman@gmail.com">henk.stegeman@gmail.com</a>&gt; wrote:<br>

&gt; I&#39;m busy adding support for slave deviced behind mpc52xx-psc-spi.<br>
&gt; One complication I have is that my SPI slave device has an interrupt output<br>
&gt; to the CPU.<br>
&gt; My idea is to add it as a gpios property in the slave device&#39;s<br>
&gt; configuration:<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; spi@2400 { &nbsp; &nbsp; &nbsp; &nbsp;// PSC3 (SPI IF to the IO-controller )<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; device_type = &quot;spi&quot;;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #address-cells = &lt;1&gt;;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #size-cells = &lt;0&gt;;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; compatible = &quot;fsl,mpc5200-psc-spi&quot;,&quot;fsl,mpc5200b-psc-spi&quot;;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cell-index = &lt;2&gt;;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reg = &lt;0x2400 0x100&gt;;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; interrupts = &lt;2 3 0&gt;;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; interrupt-parent = &lt;&amp;mpc5200_pic&gt;;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gpios = &lt;&amp;gpt4 0 0&gt;;<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; io-controller@0 {<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; compatible = &quot;microkey,smc4000io&quot;;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spi-max-frequency = &lt;1000000&gt;;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reg = &lt;0&gt;;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // gpios: first is IRQ to cpu<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gpios = &lt;&amp;gpt6 0 0&gt;;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; };<br>
<br>
</div>There is a better way to do this, and driver support for it is<br>
currently merged into Ben Herrenschmidt&#39;s -next tree.<br>
<br>
Do this instead:<br>
<div class="Ih2E3d"> &nbsp; &nbsp; &nbsp; &nbsp;io-controller@0 {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;compatible = &quot;microkey,smc4000io&quot;;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;spi-max-frequency = &lt;1000000&gt;;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reg = &lt;0&gt;;<br>
</div> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;interrupt-controller = &lt; &amp;gpt6 &gt;; &nbsp; &nbsp; // Use GPT6 as<br>
the IRQ controller<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;interrupts = &lt; 1 &gt;; &nbsp; &nbsp;// And make it rising edge.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;};<br>
<br>
Then add these two properties to the GPT node:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;interrupt-controller;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#interrupt-cells = &lt;1&gt;;<br>
<br>
Then you can use normal irq_of_parse_and_map() to set up your handler.<br>
<div class="Ih2E3d"><br>
&gt; How should I then register my spi slave driver? My smc4000io_probe function<br>
&gt; gets called correctly by of_spi support but when I register as follows:<br>
&gt;<br>
&gt; static struct spi_driver smc4000io_driver = {<br>
&gt; &nbsp; &nbsp; .driver = {<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; .name &nbsp; &nbsp;= &quot;smc4000io&quot;,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; .bus &nbsp; &nbsp;= &amp;spi_bus_type,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; .owner &nbsp; &nbsp;= THIS_MODULE,<br>
&gt; &nbsp; &nbsp; },<br>
&gt; &nbsp; &nbsp; .probe &nbsp; &nbsp; &nbsp; &nbsp;= smc4000io_probe,<br>
&gt; &nbsp; &nbsp; .remove &nbsp; &nbsp; &nbsp; &nbsp;= __devexit_p(smc4000io_remove),<br>
&gt; };<br>
&gt;<br>
&gt; static int __init smc4000io_init(void)<br>
&gt; {<br>
&gt; &nbsp; &nbsp; return spi_register_driver(&amp;smc4000io_driver);<br>
&gt; }<br>
&gt;<br>
&gt; static void __exit smc4000io_exit(void)<br>
&gt; {<br>
&gt; &nbsp; &nbsp; spi_unregister_driver(&amp;smc4000io_driver);<br>
&gt; }<br>
&gt;<br>
&gt; module_init(smc4000io_init);<br>
<br>
</div>Yes, this is right. &nbsp;The psc_spi driver automatically registers all<br>
spi children that it finds in the device tree onto the SPI bus.<br>
Therefore registering an spi_driver() is the right thing to do.<br>
<div class="Ih2E3d"><br>
&gt; But when I do:<br>
&gt;<br>
&gt; static struct of_platform_driver smc4000_spi_of_driver = {<br>
&gt; &nbsp; &nbsp; .name = &quot;smc4000io&quot;,<br>
&gt; &nbsp; &nbsp; .match_table = smc4000io_of_match,<br>
&gt; &nbsp; &nbsp; .probe = smc4000io_of_probe,<br>
&gt; &nbsp; &nbsp; .remove &nbsp; &nbsp; &nbsp; &nbsp;= __devexit_p(smc4000io_of_remove),<br>
&gt; };<br>
&gt;<br>
&gt; static int __init smc4000io_init(void)<br>
&gt; {<br>
&gt; &nbsp; &nbsp; return of_register_platform_driver(&amp;smc4000_spi_of_driver);<br>
&gt; }<br>
&gt; module_init(smc4000io_init);<br>
&gt;<br>
&gt; Then my smc4000io_of_probe function never gets called.<br>
<br>
</div>Correct. &nbsp;of_platform_driver isn&#39;t useful in this case because the<br>
device cannot exist independently of the SPI bus. &nbsp;Plus an<br>
of_platform_device doesn&#39;t provide any information about the SPI bus<br>
itself.<br>
<div><div></div><div class="Wj3C7c"><br>
g.<br>
<br>
--<br>
Grant Likely, B.Sc., P.Eng.<br>
Secret Lab Technologies Ltd.<br>
</div></div></blockquote></div><br>