help with coding a loadable kernel module

Luiz Otavio O Souza lists.br at gmail.com
Sat Apr 18 00:51:43 UTC 2015


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


More information about the freebsd-arm mailing list