Showing results for 
Search instead for 
Did you mean: 
Honored Contributor I

Nios SPI master support in kernel version 2.6.30

Hello all: 


I am trying to compile and load a driver for a WiFi device with an SPI interface to my Nios2 host controller. For the kernel, I am compiling in Altera SPI master support with bitbanging support. My nios2-linux-gcc version is 3.4.6. The kernel and WiFi driver seem to build without problems however, when I try to load the driver with modprobe or insmod (from busybox) the driver hangs and the system locks up. I'm using printk's for debugging through the console and have been able to determine that the Altera SPI driver (altspi.c) appears to be registering the master controller and getting the correct IRQ. Debugging the WiFi driver and spi.c in the same way, I have been able to trace the lockup point... it locks up within spi_async in linux/spi/spi.h. So, probably something is wrong with either the spi_device struct or the spi_message struct but I'm not sure where to go from here.  


I guess I should point out that the the WiFi driver is proprietary so I need to compile and load it as a module.... 


Any suggestions would be helpful, thanks!
0 Kudos
3 Replies
Honored Contributor I

You do know that modules need to be crafted for exactly the Kernel version they are supposed to run with ? There is no guarantee that the Kernel module interface is the same with a different version. 


Honored Contributor I

The vendor swears that their driver is compatible with 2.6.30....

Honored Contributor I

Well, I don't know if this is actually going to mean anything to anyone out there but I'll try anyway.... 


My driver calls spi_sync whic calls spi_async below. In the following code from spi.h, spi->master is NULL. I am fairly confident that the Nios SPI master is getting registered, at least I am sure that altspi is loading, running, acquiring the correct IRQ from the Nios2 system and is not returning any errors about not being able to register the SPI master & such. The other pointers below that I am "printk-ing" appear to be valid. 


spi_async(struct spi_device *spi, struct spi_message *message) 

printk("++++++++++ IN SPI_ASYNC +++++++++++++++\n"); 

message->spi = spi; 


printk("++++++++++ RETURNING FROM SPI_ASYNC +++++++++++++++\n"); 


printk("$$$$$$$ spi_device: %p $$$$$$$$$$$\n", spi); 

printk("$$$$$$$ spi_message: %p $$$$$$$$$$$\n", message); 


printk("$$$$$$$ spi->master->transfer: %p %p %p $$$$$$$$$$$\n", spi, spi->master, spi->master->transfer); 


return spi->master->transfer(spi, message);