help with coding a loadable kernel module

Daniel Braniss danny at cs.huji.ac.il
Sat Apr 18 13:17:56 UTC 2015


> On Apr 18, 2015, at 3:51 AM, Luiz Otavio O Souza <lists.br at gmail.com> wrote:
> 
> On 17 April 2015 at 11:08, Daniel Braniss  wrote:
>> 
>>> On Apr 17, 2015, at 4:42 PM, Warner Losh wrote:
>>> 
> ...
>>> 
>>> If you are using FDT in your system, then you’ll put your device into the
>>> FDT tree below the spibus to create the device_t node in the tree. When
>>> your module is loaded, its probe routine will be called, and you can
>>> match based on the compatible string given in the FDT.
>>> 
>> 
>> I was afraid of that :-), this FDT stuff is new to me, and so far I was successful
>> in adding a gpio/led, but grep has not found any spibus.
>> any chance for a small template/example ? rpi or bbb would help!
>> 
>> cheers
>>        danny
> 
> Hi Daniel,
> 
> Here is an example of such change for RPi: http://pastie.org/10099132
> 
> The SPI controller node is defined at
> sys/boot/fdt/dts/arm/bcm2835.dtsi, but usually the local changes go in
> sys/boot/fdt/dts/arm/rpi.dts.
> 
> Once you boot your system you can check your DTS tree with ofwdump -a
> 
> Cheers,
> Luiz

pending some cosmetics, the driver gets loaded! and a /dev/rfid0 appears!

thanks guys, I still have to figure out some magics, and some SPI  MFRC protocol.

as soon as I have a decent working version i’ll submit the driver.

thanks again,

	danny



More information about the freebsd-arm mailing list