Difference between revisions of "Tests:MSIOF-SPI-CS-GPIO"

From eLinux.org
Jump to: navigation, search
(Add Hardware Test Environment)
(Add note about native chip select limitations)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{TOC right}}
 
{{TOC right}}
  
This document describes testing MSIOF SPI using GPIO chipselects for SPI on the [[R-Car/Boards/Koelsch|Renesas Koelsch]] board.
+
This document describes testing MSIOF SPI using GPIO chipselects on the [[R-Car/Boards/Koelsch|Renesas Koelsch]] board.
  
 
= Hardware Test Environment =
 
= Hardware Test Environment =
Line 8: Line 8:
  
 
If you use another AT25-compatible SPI flash, you have to update the properties in "arch/arm/boot/dts/r8a7791-koelsch-exio-a-msiof1-25lc040-x3.dtso".
 
If you use another AT25-compatible SPI flash, you have to update the properties in "arch/arm/boot/dts/r8a7791-koelsch-exio-a-msiof1-25lc040-x3.dtso".
 +
 +
Note that 25LC040 SPI EEPROMs cannot be accessed when using native MSIOF chip selects, as native chip selects are always deasserted in between transfers that are part of the same message.  This is a limitation of the MSIOF hardware block, which must be worked around by using GPIO chip selects.
  
 
== Breadboard Setup ==
 
== Breadboard Setup ==
Line 28: Line 30:
  
 
To ease wiring, you can use [[Samtec-Breakout-Adapters]].
 
To ease wiring, you can use [[Samtec-Breakout-Adapters]].
 +
 +
= Software Test Environment =
 +
 +
== Kernel Source Tree ==
 +
 +
Please use the following Git repository:
 +
* Repository: git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git
 +
* Branch: "topic/msiof-cs-gpios-integration" (This is a merge of "topic/renesas-overlays", "topic/25lc040-dt-v2", and "topic/msiof-multi-slave", meant for testing).
 +
 +
== Kernel Configuration ==
 +
 +
* Build and install a kernel using "shmobile_defconfig", with the following additional options enabled:
 +
<pre>
 +
CONFIG_EEPROM_AT25=y
 +
CONFIG_OF_OVERLAY=y
 +
CONFIG_OF_CONFIGFS=y
 +
CONFIG_DYNAMIC_DEBUG=y
 +
</pre>
 +
 +
* Make sure to copy the DT overlay to the target board:
 +
<pre>
 +
scp arch/arm/boot/dts/r8a7791-koelsch-exio-a-msiof1-25lc040-x3.dtbo koelsch:/lib/firmware/
 +
</pre>
 +
 +
== Test Utilities ==
 +
 +
* <code>overlay</code>, from [[R-Car/DT-Overlays#Helper_Script|R-Car/DT-Overlays]].
 +
 +
 +
= Test Procedure =
 +
 +
* Load the DT overlay:
 +
<pre>
 +
overlay add 25lc040-x3
 +
</pre>
 +
 +
Expected output in the kernel log:
 +
<pre>
 +
spi_sh_msiof e6e10000.spi: DMA available
 +
at25 spi2.2: 512 Byte at25 eeprom, pagesize 16
 +
at25 spi2.1: 512 Byte at25 eeprom, pagesize 16
 +
at25 spi2.0: 512 Byte at25 eeprom, pagesize 16
 +
</pre>
 +
 +
* Write labels to EEPROMs:
 +
<pre>
 +
# for i in /sys/bus/spi/drivers/at25/spi*; do printf "FLASH${i##*.}\n\0" > $i/eeprom; done
 +
</pre>
 +
 +
* Read back labels from EEPROMs:
 +
<pre>
 +
# grep -a FLASH /sys/bus/spi/drivers/at25/spi2.*/eeprom
 +
/sys/bus/spi/drivers/at25/spi2.0/eeprom:FLASH0
 +
/sys/bus/spi/drivers/at25/spi2.1/eeprom:FLASH1
 +
/sys/bus/spi/drivers/at25/spi2.2/eeprom:FLASH2
 +
#
 +
</pre>
 +
 +
* Without including the "topic/msiof-multi-slave" branch, either the EEPROMs will always read back zeroes, or they will simply not be detected, depending on reset state or boot loader setup.
 +
 +
In case the EEPROMs were not detected, and SPI EEPROM debugging was enabled:
 +
<pre>
 +
echo 'file at25.c +p' > /sys/kernel/debug/dynamic_debug/control
 +
</pre>
 +
the kernel log would have shown:
 +
<pre>
 +
at25 spi2.0: rdsr --> 255 (ff)
 +
</pre>

Latest revision as of 05:05, 15 December 2017

This document describes testing MSIOF SPI using GPIO chipselects on the Renesas Koelsch board.

Hardware Test Environment

All testing has been done on the Renesas Koelsch development board, using three Microchip 25LC040 (or compatible) SPI EEPROMs.

If you use another AT25-compatible SPI flash, you have to update the properties in "arch/arm/boot/dts/r8a7791-koelsch-exio-a-msiof1-25lc040-x3.dtso".

Note that 25LC040 SPI EEPROMs cannot be accessed when using native MSIOF chip selects, as native chip selects are always deasserted in between transfers that are part of the same message. This is a limitation of the MSIOF hardware block, which must be worked around by using GPIO chip selects.

Breadboard Setup

BreadBoardWith3x25lc040.png

Wiring to Koelsch

Power wiring between CN26 on Koelsch and the breadboard:

  • Connect pin 5 ("GND") to GND,
  • Connect pin 7 ("D3.3V") to VCC.

Signal wiring between MSIOF1 on EXIO Connector A on Koelsch and the breadboard:

  • Connect pin 46 ("MSIOF1 SCK") to SCK,
  • Connect pin 54 ("MSIOF1 TX/MOSI") to MOSI,
  • Connect pin 56 ("MSIOF1 RX/MISO") to MISO,
  • Connect pin 48 ("GP0_23") to CS0#,
  • Connect pin 50 ("GP0_24") to CS1#,
  • Connect pin 52 ("GP0_25") to CS2#.

To ease wiring, you can use Samtec-Breakout-Adapters.

Software Test Environment

Kernel Source Tree

Please use the following Git repository:

Kernel Configuration

  • Build and install a kernel using "shmobile_defconfig", with the following additional options enabled:
CONFIG_EEPROM_AT25=y
CONFIG_OF_OVERLAY=y
CONFIG_OF_CONFIGFS=y
CONFIG_DYNAMIC_DEBUG=y
  • Make sure to copy the DT overlay to the target board:
scp arch/arm/boot/dts/r8a7791-koelsch-exio-a-msiof1-25lc040-x3.dtbo koelsch:/lib/firmware/

Test Utilities


Test Procedure

  • Load the DT overlay:
overlay add 25lc040-x3

Expected output in the kernel log:

spi_sh_msiof e6e10000.spi: DMA available
at25 spi2.2: 512 Byte at25 eeprom, pagesize 16
at25 spi2.1: 512 Byte at25 eeprom, pagesize 16
at25 spi2.0: 512 Byte at25 eeprom, pagesize 16
  • Write labels to EEPROMs:
# for i in /sys/bus/spi/drivers/at25/spi*; do printf "FLASH${i##*.}\n\0" > $i/eeprom; done
  • Read back labels from EEPROMs:
# grep -a FLASH /sys/bus/spi/drivers/at25/spi2.*/eeprom
/sys/bus/spi/drivers/at25/spi2.0/eeprom:FLASH0
/sys/bus/spi/drivers/at25/spi2.1/eeprom:FLASH1
/sys/bus/spi/drivers/at25/spi2.2/eeprom:FLASH2
#
  • Without including the "topic/msiof-multi-slave" branch, either the EEPROMs will always read back zeroes, or they will simply not be detected, depending on reset state or boot loader setup.

In case the EEPROMs were not detected, and SPI EEPROM debugging was enabled:

echo 'file at25.c +p' > /sys/kernel/debug/dynamic_debug/control

the kernel log would have shown:

at25 spi2.0: rdsr --> 255 (ff)