4.4 Working with SPI interface

The device tree configuration for SPI bus is disabled by default. To enable this feature, perform the following steps:
  1. Locate and press the PB1 (NRST) button. This action resets the SAMA5D27-SOM1-EK1 board.
  2. The SAMA5D27-SOM1-EK1 board starts to boot up. full form Press any key to interrupt at the U-Boot timeout to make changes to the U-Boot environment variables.
  3. Configure the U-boot bootloader to load a Flattened Image Tree (FIT) image from Multi Media Card (MMC) and apply the MMC-SPI device tree overlay during the boot process using the following command:
    => edit bootcmd_boot
    fatload mmc 1:1 ${loadaddr} ${board_name}.itb; bootm ${loadaddr}#kernel_dtb$
    {at91_overlays_config}#wilc_mmc_spi;
  4. Save the environment using the following U-Boot following:
    => saveenv\
    The following message appears after executing the => saveenv command:
    Saving Environment to FAT... OK boot
  5. Boot the board using the following U-Boot command:
    => boot

For the SPI mode to work, the user must enable the MMC SPI kernel module as a loadable module before starting to build the kernel. To do this, the user can set this in the kernel menu config GUI:

  • Go to Device Drivers > MMC/SD/SDIO card support
  • Select [M] to include the MMC/SD/SDIO over SPI
Note: The image in the online reference document already has the MMC SPI module enabled by default. The users only need to handle this if porting the WILCS02 to other platforms.

After the above configuration, enter the following commands to install the WILCS02 driver to the system:

  • modprobe wilc-sdio
  • modprobe mmc-spi
# modprobe wilc-sdio
# modprobe mmc-spi
mmc_spi spi1.0: ASSUMING 3.2-3.4 V slot power
mmc_spi spi1.0: SD/MMC host mmc2, no DMA, no WP, no poweroff
# mmc2: new SDIO card on SPI
got gpio_irq successfully 55
wilc_sdio mmc2:0000:1: SDIO single driver speed: 25000000
wilc_sdio mmc2:0000:1: chipid 00000053
loading firmware mchp/wilcs02_wifi_firmware.bin
Downloading Firmware ...
The best firmware already installed on WILCS02
Download Succeeded
wilc_sdio mmc2:0000:1: Driver Initializing success