Chipselect in SPI binding with mpc5200-psc-spi

Henk Stegeman henk.stegeman at gmail.com
Fri Feb 13 21:40:31 EST 2009


I'm busy adding support for slave deviced behind mpc52xx-psc-spi.
One complication I have is that my SPI slave device has an interrupt output
to the CPU.
My idea is to add it as a gpios property in the slave device's
configuration:

        spi at 2400 {        // PSC3 (SPI IF to the IO-controller )
            device_type = "spi";
            #address-cells = <1>;
            #size-cells = <0>;
            compatible = "fsl,mpc5200-psc-spi","fsl,mpc5200b-psc-spi";
            cell-index = <2>;
            reg = <0x2400 0x100>;
            interrupts = <2 3 0>;
            interrupt-parent = <&mpc5200_pic>;
            gpios = <&gpt4 0 0>;

            io-controller at 0 {
                compatible = "microkey,smc4000io";
                spi-max-frequency = <1000000>;
                reg = <0>;
                // gpios: first is IRQ to cpu
                gpios = <&gpt6 0 0>;
            };
        };


Are there better/easier ways to do this?

How should I then register my spi slave driver? My smc4000io_probe function
gets called correctly by of_spi support but when I register as follows:

static struct spi_driver smc4000io_driver = {
    .driver = {
        .name    = "smc4000io",
        .bus    = &spi_bus_type,
        .owner    = THIS_MODULE,
    },
    .probe        = smc4000io_probe,
    .remove        = __devexit_p(smc4000io_remove),
};

static int __init smc4000io_init(void)
{
    return spi_register_driver(&smc4000io_driver);
}

static void __exit smc4000io_exit(void)
{
    spi_unregister_driver(&smc4000io_driver);
}

module_init(smc4000io_init);

But when I do:

static struct of_platform_driver smc4000_spi_of_driver = {
    .name = "smc4000io",
    .match_table = smc4000io_of_match,
    .probe = smc4000io_of_probe,
    .remove        = __devexit_p(smc4000io_of_remove),
};

static int __init smc4000io_init(void)
{
    return of_register_platform_driver(&smc4000_spi_of_driver);
}
module_init(smc4000io_init);

Then my smc4000io_of_probe function never gets called.

Thanks in advance,

Henk.






On Wed, Oct 29, 2008 at 3:45 PM, Grant Likely <grant.likely at secretlab.ca>wrote:

> On Wed, Oct 29, 2008 at 7:43 AM, Henk Stegeman <henk.stegeman at gmail.com>
> wrote:
> > ..
> > ..
> > In my dts
> >
> > I have my chipselect defined as follows:
> >
> >         gpt4: timer at 640 {    // General Purpose Timer GPT4 in GPIO mode
> for
> > SMC4000IO chip select.
> >             compatible = "fsl,mpc5200b-gpt-gpio","fsl,mpc5200-gpt-gpio";
> >             cell-index = <4>;
> >             reg = <0x640 0x10>;
> >             interrupts = <1 13 0>;
> >             interrupt-parent = <&mpc5200_pic>;
> >             gpio-controller;
> >             #gpio-cells = <2>;
> >         };
> >
> > I found the gpio in
> > # cat /sys/class/gpio/gpiochip215/label
> > /soc5200 at f0000000/timer at 640
> >
> > The spi controller is defined like this:
> >
> >         spi at 2400 {
> >             device_type = "spi";
> >             #address-cells = <1>;
> >             #size-cells = <0>;
> >             compatible = "fsl,mpc5200-psc-spi","fsl,mpc5200b-psc-spi";
> >             cell-index = <2>;
> >             reg = <2400 100>;
> >             interrupts = <2 3 0>;
> >             interrupt-parent = <&mpc5200_pic>;
> >             gpios = <&gpt4 0 0>;
> >
> >             io-controller at 0 {
> >                 compatible = "microkey,smc4000io";
> >                 spi-max-frequency = <1000000>;
> >                 reg = <0>;
> >             };
> >         };
> >
> > At bootup linux (2.6.27) reports:
> >
> > mpc52xx-psc-spi f0000960.spi: probe called without platform data, no
> > (de)activate_cs function will be called.
> >
> > Is my assumption wrong that the gpios property is the way to map
> chipselects
> > to the spi driver?
>
> Yes, that is the way you should work specify the chip selects, but the
> driver hasn't been updated to support it yet.
>
> g.
>
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20090213/24b83b86/attachment.htm>


More information about the Linuxppc-dev mailing list