[PATCH] Configure FSL eSPI CSBEF, CSAFT, and whether to send all received data to user

From: Jane Wan
Date: Sat Apr 12 2014 - 15:05:28 EST


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@xxxxxxxxxxxxxxxxxxxxx/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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/