All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jane Wan <Jane.Wan@gainspeed.com>
To: <grant.likely@secretlab.ca>, <rob.herring@calxeda.com>,
	<broonie@kernel.org>, <Emilian.Medve@Freescale.com>,
	<kenth.eriksson@transmode.com>,
	<thomas.de.schampheleire@gmail.com>, <b48286@Freescale.com>,
	<jg1.han@samsung.com>, <sr@denx.de>, <insop.song@gainspeed.com>
Cc: <spi-devel-general@lists.sourceforge.net>,
	<linux-kernel@vger.kernel.org>,
	<devicetree-discuss@lists.ozlabs.org>,
	Jane Wan <Jane.Wan@gainspeed.com>
Subject: [PATCH] Configure FSL eSPI CSBEF, CSAFT, and whether to send all received data to user
Date: Sat, 12 Apr 2014 11:48:35 -0700	[thread overview]
Message-ID: <1397328516-13260-1-git-send-email-Jane.Wan@gainspeed.com> (raw)

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


             reply	other threads:[~2014-04-12 19:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-12 18:48 Jane Wan [this message]
2014-04-12 18:48 ` [PATCH] Configure FSL eSPI CSBEF, CSAFT, and whether to send all received data to user 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1397328516-13260-1-git-send-email-Jane.Wan@gainspeed.com \
    --to=jane.wan@gainspeed.com \
    --cc=Emilian.Medve@Freescale.com \
    --cc=b48286@Freescale.com \
    --cc=broonie@kernel.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=insop.song@gainspeed.com \
    --cc=jg1.han@samsung.com \
    --cc=kenth.eriksson@transmode.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    --cc=spi-devel-general@lists.sourceforge.net \
    --cc=sr@denx.de \
    --cc=thomas.de.schampheleire@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.