Appendix A – Loading WILCS02/ATWILC1000/3000 Module

After the kernel boots, call the modprobe/insmod command for loading the wilc-spi or wilc-sdio module if the ATWILC module is not built along with kernel. The sequence followed by both the SDIO and SPI interfaces are almost the same and are explained as follows.

The modprobe/insmod command adds or removes the modules from the Linux kernel. The modprobe command checks in the module directory /lib/modules/ for all the modules, while the insmod command checks the base directory of the driver that is mentioned as a parameter.

During compilation, the build process extracts this information from all the drivers. Upon loading the module, the device in the driver is compared with the devices declared in the device tree file.

Load the power sequence driver pwrseq_sd8787.ko module prior to loading the wilc-spi or wilc-sdio module if the WILC1000/3000 did not power up properly at startup (in other words, did not connect resistor R321 for the WILC3000 Shield Board mentioned in Chapter 4.2.1). Do not load pwrseq_sd8787.ko if WILC1000/3000 is at power-on during start up.

While using the Microchip Common Linux Kernel (Linux4Microchip), the power sequence driver is included in the kernel and is dependent on the WILC driver. Enable the PWRSEQ_SD8787 module in the kernel configuration to enable the feature.

The pwseq_sd8787 driver can be downloaded from - pwrseq_sd8787.c (GitHub Link).

The DTS documentation can be found at - mmc-pwrseq-sd8787.yaml (GitHub Link).

modprobe wilc-spi/ modprobe wilc-sdio

Upon receiving the modprobe command, the driver is loaded and the execution starts from the module_spi_driver()* function for SPI or module_driver() function for SDIO. This function passes to the kernel, the structure containing the device_id, probe and remove function and so on. When a device ID match is found in the DTS file, the probe function is called. Either the wilc_bus_probe() or linux_sdio_probe() function is called, respectively for the SPI/SDIO interface. The probe function performs early initialization for modules and registers the device ATWILC with the kernel.

The sequence of actions performed by the probe function is illustrated in the following figure:
Figure . Sequence of Probe Function

This concludes the probe operation and the success log is illustrated in the following figure.

Figure . modprobe/insmod Log