2008-10-08 05:07:48     SPI driver query

Document created by Aaronwu Employee on Aug 8, 2013
Version 1Show Document
  • View in full screen mode

2008-10-08 05:07:48     SPI driver query

Kiran Kumar B (INDIA)

Message: 63257   


Board :  BF527,    Distribution :  uClinux-dist-2008R1-RC8


Question 1:  From the user space can I do a read ( ) call only  if  "User Mode SPI device driver" support is enabled  in make menuconfig ? .   (  Device Drivers > SPI Support  > User Mode SPI device driver support *  )


Question 2: What if I do not want to call SPI read from User space and would want to read SPI within the kernel itself on occurance of an interrupt.








2008-10-08 14:48:40     Re: SPI driver query

Mike Frysinger (UNITED STATES)

Message: 63287   


well, if you dont enable the SPI user space driver, i dont see why you'd expect to be able to access SPI from user space ...


SPI is documented here:





2008-10-09 10:31:48     Re: SPI driver query

Kiran Kumar B (INDIA)

Message: 63336   


Thanks Mike,  I understand that spi.c is the class driver and spi_bfin5xx.c is the controller driver.    If I need to write a kernel module which does all the SPI read and write, do I have to call the functions of spi.c or do I need to use Spi_bfin5xx.c . 


( I have spent enough time in changing the spidev.c  which is basically a user space driver.  I tried to make the read calls locally in the kernel, but ended up in kernel panic !!!   NOTE that I have written a small user space program to open and configure the SPI device, and with this Device ID  reference I was trying to make a read within the kernel...  Temporarily I have my setup up and running with a User Space select call waiting on a queue released in a 1ms IRQ.  This is how I am managing to sync my interrupt and user space SPI read. But the latency is 60us, which I need to reduce... !!   )


The reason I asked the question is, basically I do not need any calls from the user space for SPI.  But need to handle everything in kernel.  Request you to please show me the right path....




2008-10-09 12:35:18     Re: SPI driver query

Mike Frysinger (UNITED STATES)

Message: 63344   


the document i already posted shows you how to write your own SPI kernel code.  you should not be digging into bus master drivers or spi core files to try and figure out the API.  the API is already documented.


you should also not be modifying other drivers ... you should use them as a reference, or copy their base.