Appendix A – Loading ATWILC Module

After the kernel is booted, 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 same and are explained as follows.

modprobe/insmod command add or remove the modules from the Linux kernel. 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 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, in case the WILC1000/ 3000 did not power up properly at startup (i.e., 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 startup.

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 github.com/linux4microchip/linux/blob/master/drivers/mmc/core/pwrseq_sd8787.c.

The DTS documentation can be found at github.com/linux4microchip/linux/blob/master/Documentation/devicetree/bindings/mmc/mmc-pwrseq-sd8787.yaml.

modprobe wilc-spi/ modprobe wilc-sdio

On 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. Once 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 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 shown in the following figure:
Figure . Sequence of Probe Function

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

Figure . modprobe/insmod Log