linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: pxa2xx_spi with SFRM
@ 2008-08-08  8:02 nforrester-/d+BM93fTQY
       [not found] ` <1218182539.489bfd8b24a3d-2RFepEojUI3934Ez3d9NBg@public.gmane.org>
  0 siblings, 1 reply; 19+ messages in thread
From: nforrester-/d+BM93fTQY @ 2008-08-08  8:02 UTC (permalink / raw)
  To: vernoninhand-Re5JQEeQqe8AvxtiuMwx3w,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

I am as sea right now, with very limited email access.  If you can
wait until Wed or Thursday of next week, I might be of more help.  In
the mean time perhaps someone else will reply.

Since the orignal author, Stephen Steet, became silent on this driver,
I and several others have submitted patches for it.  I use an
extensivley modified version of pxa2xx_spi.c for one of my projects
and thus I have some familiarity with the driver, though somewhat less
with the details of SPI (I use the TI synchonous mode) and none at all
with flash on SPI.  I also work on a PXA255, and the PXA270 has some
differences.

> I am using a custom PXA270 board and tried to use the SSP port to
> communication with a SPI Flash. After reading docs on how to configure
> the spi_master and spi devices, I have the device driver's probe being
> called. But I cannot get the pxa2xx_spi driver to work correctly. I
> can connect either a SD card or a M26P16 Flash chip to the SPI port on
> my board. Neither device driver can completely operate their device.
>
> It looks like it is impossible for the device drivers to control the
> chip select (CS) line. If I use the manual cs_control callback, the
> timing is invalid because the SSP clock keeps running.

The cs_control() callback is the normal way of controlling chip select
with this driver.  That allows you to assign any GPIO pin or polarity.
I understand that this differs from way that the spi core expects chip
select to be handeled; in particular, the driver does not honor the
SPI_CS_HIGH nor SPI_LSB_FIRST bits in the spi_device.mode.  The PXA
SSP controllers do not have a dedicated chipselect mechanism
associated with the SSP controllers (outside of the single FRAME pin,
which may or may not do what you want), thus the use of GPIO lines is
required.

What version of the kernel/driver are you using?  There have been some
recent changes, and there may still be a bug regarding CS changes that
was discussed in:
Re: [spi-devel-general] odd behaviour of chipselect with bitbang driver?
on about 04/24/08 15:55.  I raised the question but, since I don't use
chipselect at all, I have not produced a patch.

The fact that the clock free runs strikes me as strange, I don't think
any of the supported SPI_MODE_n combinations can produce a free
running clock, though they do control polarity and phase of the clock.
If your problem involves one extra clock edge, you may have the wrong
setting for SPI_MODE_n.`

> That means that
> several bits are clocked out before the SSP controller starts to drive
> the TX line correctly. If the SFRM signal is used, it does not allow
> the driver to keep CS active for multiple transactions as they expect
> and assume. The spi_sync call takes an spi_message which contains a
> list of transactions to send. Normally, the device will need the CS
> active during the complete message. But the SSP controller deactivates
> SFRM when it is done with each buffer. For instance, the M25P16
> datasheet indicates that CS has to stay active from the READ command
> through the complete data transfer. When it goes high, it resets the
> command interface.

The driver should honor the per-transfer spi_transfer.cs_change flag
when used with a cs_control routine.  If you want the CS to stay
asserted between transfers, be sure the cs_change flag is 0.

> It looks like the SSP port needs to have a register bit to turn off
> the clock when there is nothing to transmit. Or a bit to tell the SSP
> controller to leave CS active. Or I can change the HW so CS gates the
> clock and a manual CS chip operates the device CS pin. I might also
> try the bitbanging SPI driver next to see if that can operate with the
> Flash chip.

pxa2xx_spi.c uses format SSCR0_Motorola.  I think, as I said above,
that this mode does not allow the clock to free run.  I expect that
you have some other problem.  As I understand it (and I may be wrong,
since I don't use Motorola SPI format) the clock is only active if
data is being transfered, and data is only transferred if there is
something the in the transmit FIFO to go out (and thus something to
receive at the same time).  I wonder if you have a zero byte in the TX
FIFO when you think you have nothing.  Perhaps spi_transfer.len is not
set right.

> Is there some other setting I am missing here? Is anyone else using
> the M25P16 chip with PXA270 SPI driver?



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

^ permalink raw reply	[flat|nested] 19+ messages in thread
* pxa2xx_spi with SFRM
@ 2008-08-07 18:03 Vernon Sauder
  0 siblings, 0 replies; 19+ messages in thread
From: Vernon Sauder @ 2008-08-07 18:03 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f; +Cc: David Brownell

Hi,

I am using a custom PXA270 board and tried to use the SSP port to 
communication with a SPI Flash. After reading docs on how to configure 
the spi_master and spi devices, I have the device driver's probe being 
called. But I cannot get the pxa2xx_spi driver to work correctly. I can 
connect either a SD card or a M26P16 Flash chip to the SPI port on my 
board. Neither device driver can completely operate their device.

It looks like it is impossible for the device drivers to control the 
chip select (CS) line. If I use the manual cs_control callback, the 
timing is invalid because the SSP clock keeps running. That means that 
several bits are clocked out before the SSP controller starts to drive 
the TX line correctly. If the SFRM signal is used, it does not allow the 
driver to keep CS active for multiple transactions as they expect and 
assume. The spi_sync call takes an spi_message which contains a list of 
transactions to send. Normally, the device will need the CS active 
during the complete message. But the SSP controller deactivates SFRM 
when it is done with each buffer. For instance, the M25P16 datasheet 
indicates that CS has to stay active from the READ command through the 
complete data transfer. When it goes high, it resets the command interface.

It looks like the SSP port needs to have a register bit to turn off the 
clock when there is nothing to transmit. Or a bit to tell the SSP 
controller to leave CS active. Or I can change the HW so CS gates the 
clock and a manual CS chip operates the device CS pin. I might also try 
the bitbanging SPI driver next to see if that can operate with the Flash 
chip.

Is there some other setting I am missing here? Is anyone else using the 
M25P16 chip with PXA270 SPI driver?

Vernon Sauder

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2008-11-13  1:31 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-08  8:02 pxa2xx_spi with SFRM nforrester-/d+BM93fTQY
     [not found] ` <1218182539.489bfd8b24a3d-2RFepEojUI3934Ez3d9NBg@public.gmane.org>
2008-08-08 10:08   ` Jonathan Cameron
     [not found]     ` <489C1B23.6040804-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2008-08-11 22:55       ` Vernon Sauder
     [not found]         ` <48A0C35D.5010606-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2008-08-14 15:29           ` Ned Forrester
     [not found]             ` <48A44F77.1020908-/d+BM93fTQY@public.gmane.org>
2008-08-15  2:44               ` Vernon Sauder
     [not found]                 ` <48A4ED85.1030803-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2008-08-15 19:01                   ` Limitations on transfer length [was: pxa2xx_spi with SFRM] Ned Forrester
     [not found]                     ` <48A5D272.1070804-/d+BM93fTQY@public.gmane.org>
2008-09-08 22:42                       ` David Brownell
2008-10-24  5:11                       ` Vernon Sauder
     [not found]                         ` <490158E8.8060502-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2008-11-13  1:31                           ` Ned Forrester
2008-08-15 19:09                   ` pxa2xx_spi with SFRM Ned Forrester
     [not found]                     ` <48A5D44D.6040106-/d+BM93fTQY@public.gmane.org>
2008-08-16  2:33                       ` Vernon Sauder
     [not found]                         ` <20080815223307.02db86aa-W37fpRALFaH6NKmgiXY+hA0JkcsJGQge@public.gmane.org>
2008-08-18 18:34                           ` Ned Forrester
     [not found]                             ` <48A9C0D0.5050304-/d+BM93fTQY@public.gmane.org>
2008-08-20  0:59                               ` Ned Forrester
     [not found]                                 ` <48AB6C8F.4040408-/d+BM93fTQY@public.gmane.org>
2008-08-21 22:08                                   ` Vernon Sauder
     [not found]                                     ` <20080821180826.491ac70b-W37fpRALFaH6NKmgiXY+hA0JkcsJGQge@public.gmane.org>
2008-08-23  3:23                                       ` Ned Forrester
     [not found]                                         ` <48AF82B3.8040709-/d+BM93fTQY@public.gmane.org>
2008-08-29 19:18                                           ` Vernon Sauder
     [not found]                                             ` <20080829151839.7a85e7d6-W37fpRALFaH6NKmgiXY+hA0JkcsJGQge@public.gmane.org>
2008-08-30  3:07                                               ` Ned Forrester
2008-09-08 22:50                           ` David Brownell
  -- strict thread matches above, loose matches on Subject: below --
2008-08-07 18:03 Vernon Sauder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).