LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 04-10-2012, 09:54 PM   #1
Brahmsian
LQ Newbie
 
Registered: Apr 2012
Posts: 2

Rep: Reputation: Disabled
Smile Problems with dynamic registration of SPI protocol slave devices


Hi,

I am trying to write a loadable kernel module that dynamically registers a slave SPI protocol device driver on a SPI bus.

I am using the Embest SBC6000x board with AT91SAM9261S. I note that the board has two SPI buses, Bus 0 and Bus 1, and both use the SPI master controller driver in /driver/atmel_spi.c. In my case, I would like my device registered on bus 1.

The problem I encounter is that when I try to get the spi master associated with Bus 1 in the init functions of my LKM by using the spi.c function, spi_busnum_to_master(1), the function returns NULL during insmod. (i.e. no master was found associated with bus 1, spi_busnum_to_master(1) returns NULL).

How can this be? In atmel_spi.c, the master seems to be registered with the SPI framework at the end of its probe function using the spi.c function spi_register_master(). I confirmed this in my kernel init.

Everything seems to work fine if I were to use spidev instead, and statically register my spidev slave device driver during kernel startup.
 
Old 04-18-2012, 01:20 AM   #2
Brahmsian
LQ Newbie
 
Registered: Apr 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Solved the problem:

My arm at91 board is using the 2.6.24 kernel, and in the spi_register_master function in spi.c, you should add list_add(&master->dev.node, &spi_master_class.children); to it somewhere near the end.

list_del(&master->dev.node); should also be added to spi_unregister_master in the same file.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Design of a communication protocol over SPI with master/slave switching xhpohanka Programming 1 11-30-2011 10:34 AM
About use FIQ for SPI slave in device driver. jason222333 Linux - Kernel 4 10-25-2010 02:37 PM
About How to SPI slave keep up master jason222333 Linux - Kernel 0 10-11-2010 08:32 PM
how to interface ade7758 to at91sam9261 by SPI protocol raulapati Linux - Hardware 1 10-11-2010 07:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 10:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration