All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Configure FSL eSPI CSBEF, CSAFT, and whether to send all received data to user
@ 2014-04-12 18:48 Jane Wan
  2014-04-12 18:48 ` Jane Wan
  2014-04-14 20:51 ` Mark Brown
  0 siblings, 2 replies; 18+ messages in thread
From: Jane Wan @ 2014-04-12 18:48 UTC (permalink / raw)
  To: grant.likely, rob.herring, broonie, Emilian.Medve,
	kenth.eriksson, thomas.de.schampheleire, b48286, jg1.han, sr,
	insop.song
  Cc: spi-devel-general, linux-kernel, devicetree-discuss, Jane Wan

Make FSL eSPI properties configurable through device tree.  The
configurable parameters include CSnBEF and CSnAFT in ESPI_SPMODEn
registers (n=0,1,2,3), and whether to send all received data to user.

The FSL eSPI driver hardcodes CSnBEF and CSnAFT to 0.  Some device
needs to set them to different values.

When user sends n_tx bytes and receives n_rx bytes on FSL eSPI
interface, the FSL eSPI driver sends (n_tx + n_rx) bytes on MOSI.
Simultaniously, there are (n_tx + n_rx) received on MISO.  The FSL
eSPI driver only passes the last n_rx bytes to user device driver.
The other n_tx bytes received from the slave device are dropped.  
Some device has issue with this mechanism.  The device driver
requires to know all bytes that the slave device puts on MISO.

Part of this fix is based on a previous patch that was not included,
see http://www.mail-archive.com/spi-devel-general@lists.sourceforge.net/msg08658.html

Test done:
- Kernel version 3.8.13
- Three devices attached to FSL eSPI interface with chip select 0-2.
- The device at cs0 and cs1 work with original FSL eSPI driver.
- The device driver at cs2 has issue with original FSL eSPI driver.
  It requires to receive all data that the slave device puts on MISO.
  It also requires CS2BEF in SPI_SPMODE2 register to be set to 1.
- After set proper values in the device tree (as example below), all
  three  devices work fine with the FSL eSPI driver.
        spi@110000 {
                redpine@2 {
                        #address-cells = <1>;
                        #size-cells = <1>;
                        compatible = "spidev";
                        reg = <2>;
                        spi-max-frequency = <10000000>; /* input clock */
                        fsl,csbef = <1>; /* CS assertiion time in bits before frame start */
                        fsl,csaft = <1>; /* CS assertiion time in bits after frame end */
                        fsl,spi-raw-rxdata-to-user = <1>; /* send all rx data to user */
                };
        };


Jane Wan (1):
  Configure fsl espi CSBEF, CSAFT, and whether to send all received
    data to user

 drivers/spi/spi-fsl-espi.c       |   68 ++++++++++++++++++++++++++++++++++----
 1 files changed, 61 insertions(+), 7 deletions(-)

-- 
1.7.9.5


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

end of thread, other threads:[~2014-04-16 17:29 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-12 18:48 [PATCH] Configure FSL eSPI CSBEF, CSAFT, and whether to send all received data to user Jane Wan
2014-04-12 18:48 ` Jane Wan
2014-04-14 20:55   ` Mark Brown
2014-04-16 16:39     ` Jane Wan
2014-04-16 16:39       ` Jane Wan
2014-04-16 17:28       ` Mark Brown
2014-04-16 17:28         ` Mark Brown
2014-04-14 20:51 ` Mark Brown
2014-04-14 21:38   ` Insop Song
2014-04-14 21:38     ` Insop Song
2014-04-14 23:49     ` Mark Brown
2014-04-14 23:49       ` Mark Brown
2014-04-14 23:59       ` Insop Song
2014-04-14 23:59         ` Insop Song
2014-04-15  0:00       ` Insop Song
2014-04-15  0:00         ` Insop Song
2014-04-15 12:11         ` Mark Brown
2014-04-15 12:11           ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.