[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] Adding SPI Driver causes Kernel to Hang



Hi Matt,

På tirsdag, den 24. februar 2009, klokka 11:08 (-0800) skrev Matt Staniszewski:
> From: Matt Staniszewski <matt.staniszewski@xxxxxxxxx>
> To: microblaze-uclinux@xxxxxxxxxxxxxx
> Date: Tue, 24 Feb 2009 11:08:40 -0800
> Subject: Re: [microblaze-uclinux] Adding SPI Driver causes Kernel to Hang
> 
> Hi Nicolas,
> 
> Thanks for the advice on cscope, that's a really good tool to have.  I was
> searching the various typedefs that I'm missing in the errors, and you're
> correct, most of them point to <linux/types.h>.
> 
> However, I added this #include, and I still am getting all the errors that I
> mentioned.  Do I need to include this file somewhere else, or is my path
> incorrect?
> 
> It seems like it isn't reading in the definitions from types.h.
> 

It might be a question of ordering. Do you include linux/types.h before
the first reference of any type defined in there (e.g. resource_size_t
must be defined before the first usage; usage includes also function
prototypes in other header files)? Thus, it might help to include
linux/types.h as first header file. 

> As for xspi.h, I was just asking whether I could use the higher level
> functions defined for the Xilinx SPI code in that file instead of the spi.h
> functions.  However, I think my current route will be to initialize the
> device using spi.h functions and then access the spi interface using the
> functions for the spi char driver located in xspi_ioctl.h.

I'm not really sure, but I think that you could run into problems using
the functions of xspi.h. As far as I know the 'clean' way to implement
a spi capable driver would be to use the spi-subsystem's functions
(spi.h) and not to rely on the real hardware driver below. Can you let
me know whether you succeed in using the xilinx spi functions directly?

Good effort,
Nicolas

> 
> Thanks.
> 
> Matt
> 
> On Tue, Feb 24, 2009 at 00:40, Nicolas Schier <schier@xxxxxx> wrote:
> 
> > På Mon, Feb 23, 2009 at 09:58:06PM -0800 skrev Matt Staniszewski:
> > > From: Matt Staniszewski <matt.staniszewski@xxxxxxxxx>
> > > To: microblaze-uclinux@xxxxxxxxxxxxxx
> > > Date: Mon, 23 Feb 2009 21:58:06 -0800
> > > Subject: Re: [microblaze-uclinux] Adding SPI Driver causes Kernel to Hang
> > >
> > > Thanks Nicolas,
> > >
> > > I see that is from spi.h.
> >
> > Might be. Actually I have used it in a kernel driver to register it as
> > a spi driver to be able to handle spi stuff (spi_write).
> >
> > > Can I use the structure from xspi in some way
> > > instead?  Thanks.
> >
> > I don't know where your question points to.
> >
> > Nicolas
> >
> > >
> > > Matt
> > >
> > > On Mon, Feb 23, 2009 at 01:34, Nicolas Schier <schier@xxxxxx> wrote:
> > >
> > > > På Mon, Feb 23, 2009 at 12:46:38AM -0800 skrev Matt Staniszewski:
> > > > > From: Matt Staniszewski <matt.staniszewski@xxxxxxxxx>
> > > > > To: microblaze-uclinux@xxxxxxxxxxxxxx
> > > > > Date: Mon, 23 Feb 2009 00:46:38 -0800
> > > > > Subject: Re: [microblaze-uclinux] Adding SPI Driver causes Kernel to
> > Hang
> > > > >
> > > > > I found the functions listed in xspi_ioctl.h.  I tried to write a
> > sample
> > > > > script similar to a gpio test script my friend wrote.  However,
> > there's
> > > > no
> > > > > /dev/spi to open a file descriptor for.  I have the xilinx_spi device
> > > > > recognized in the boot up, how do I map it to /dev/spi?  Thanks.
> > > >
> > > > Perhaps this code snips might help you:
> > > >
> > > >        static struct spi_driver spi_driver = {
> > > >                .driver = {
> > > >                        .name = "xilinx_spi",
> > > >                        .owner  = THIS_MODULE,
> > > >                },
> > > >                .probe  = spi_probe,
> > > >                .remove = __devexit_p(spi_remove),
> > > >        };
> > > >
> > > >        /* ... */
> > > >
> > > >        ret = spi_register_driver(&spi_driver);
> > > >
> > > >        /* ... */
> > > >
> > > >        static int __devinit
> > > >        spi_probe (struct spi_device *spi_device)
> > > >        {
> > > >                spi->mode = SPI_MODE_0 | SPI_LOOP;
> > > >
> > > >                return 0;
> > > >        }
> > > >
> > > >        static int __devexit
> > > >        spi_remove (struct spi_device *spi_device)
> > > >        {
> > > >                return 0;
> > > >        }
> > > >
> > > > Nicolas
> > > >
> > > > --
> > > > gpg public key: ID 0xACBC3B35, jabber: nicolas@xxxxxxxxx
> > > >  -- frykten for herren er opphav til kunnskap --
> > > >
> > >
> > --
> > gpg public key: ID 0xACBC3B35, jabber: nicolas@xxxxxxxxx
> >  -- frykten for herren er opphav til kunnskap --
> >
> 
-- 
gpg public key: ID 0xACBC3B35, jabber: nicolas@xxxxxxxxx
 -- frykten for herren er opphav til kunnskap --

Attachment: pgpgbeF6gNCZt.pgp
Description: PGP signature