Hi Ned & Harry,
> >>> You have a non-null cs_control function defined in the above struct,
> >>> too. Right?
> >> That was the case, but I've followed your example and used the NSSP
> >> frame signal instead.
> >
> > Well, actually, my device does not use a chip_select at all, hence I
> > have no cs_control routine. I have never understood how chip select is
> > supposed to work in the SPI framework otherwise. I gather there is
> > mechanism involving the struct spi_board_info.chip_select which selects
> > an index for a chip select at a higher level of the SPI framework. I
> > don't know where the connection is between this and a physical GPIO line
> > connected to an external chip. Dave, can you shed light for me?
>
> Also, in connection with the Framework chip select mechanism, I have
> never understood, even if a correspondence is made between a
> spi_board_info.chip_select index and a physical IO line, how that CS is
> supposed to know when to change state. It is clear in pxa2xx_spi.c that
> when a cs_control function is called, the appropriate action defined in
> the function will take place. However, the null_cs_control routine in
> pxa2xx_spi.c, which is called if the user does not specify a routine in
> struct pxa2xx_spi_chip.cs_control, simply returns without calling any
> function defined in the SPI framework.
So this is my understanding of how it was intended to work (I'm
looking at my buildroot based on 2.6.21)
When you do SPI stuff, you perform a transfer. At the beginning of the
transfer, the chip select is asserted, and at the end of the transfer
the chip select is deasserted.
An SPI device ignores the clock and data data lines when it's chip
select is deasserted.
The intention is that you can have several devices connected to the
host, with the data and clock lines being shared by all of the
devices, and each device has its own custom chip select.
Each device on the SPI "bus" is represented by a pxa2xx_spi_chip
structure, and each device would provide a cs_control routine which
would assert and deassert the chip select line for the device in
question (usually the ASSERT portion would set a GPIO line to 0, and
the DEASSERT portion would set a GPIO line to 1).
--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/
|