FreeBSD 12.0 - module init function is called few times - Raspberry Pi 3.

mattsk

New Member

Reaction score: 1
Messages: 1

Hi,
I write a driver of LCD, witch use SPI and GPIO and works on kernelspace. Source code is available on my github:
I'll try to test spi but I find strength things. When I load module into kernel:

kldload ./lcd.ko

I see that init module calls four times:


lcdRpiX0: <Lcd MattPro> at cs 1 mode 0 onspibus0
Module Init
lcdRpiX1: <Lcd MattPro> at cs 0 mode 0 onspibus0
Module Init
lcdRpiX2: <Lcd MattPro> at cs 0 mode 0 onspibus0
Module Init
lcdRpiX3: <Lcd MattPro> at cs 1 mode 0 onspibus0
Module Init

Before spi development, I applied SPI patch for Raspberry Pi 3, witch is described here:

When I comment spigen1 and cs pins:

C:
/* $FreeBSD:$ */
 
 /dts-v1/;
 /plugin/;
 
 / {
         compatible = "brcm,bcm2837";
 };
         
 &{/soc/spi@7e204000} {
         status = "okay";
         spigen0: spigen0 {
                 compatible = "freebsd,spigen";
                 reg = <0>;
                 spi-max-frequency = <500000>; /* Req'd property, override with spi(8) */
                 status = "okay";
         };
         //spigen1: spigen1 {
         //        compatible = "freebsd,spigen";
         //        reg = <1>;
         //        spi-max-frequency = <500000>; /* Req'd property, override with spi(8) */
         //        status = "okay";
         //};
 };
 
 &{/soc/gpio@7e200000/spi0_cs_pins} {
        // brcm,pins = <8 7>;
         brcm,pins = <7>;
         brcm,function = <4>; /* ALT0 */
 };
Module init call only three times.
What can be the reason for this?
 
Top