Jump to content

Recommended Posts

Posted

Hi there, I'm trying to made a dts file to handle a pican2 hat on ROCK64 armbian, but now I'm stuck. I'm a noob in writing dts files, I've tried to take as exemple dts from RPI and Thinker.

edit: I've rebuild the kernel, and build the mcp251x.ko module, it load like a charm. But I assume I've to write a correct .dts file to link it to my devices tree.

 

here is my loaded modules list:

 

Module                  Size  Used by
can_bcm                24576  0
can_raw                20480  0
can                    53248  2 can_bcm,can_raw
mali                  262144  0
rt2800usb              28672  0
rt2800lib              81920  1 rt2800usb
rt2x00usb              20480  1 rt2800usb
rt2x00lib              49152  3 rt2x00usb,rt2800lib,rt2800usb
zram                   32768  5
lz4_compress           16384  1 zram
mcp251x                20480  0
dw_hdmi_i2s_audio      16384  0
can_dev                20480  1 mcp251x
binfmt_misc            20480  1
ip_tables              24576  0
x_tables               32768  1 ip_tables
autofs4                40960  2
uas                    20480  0
usb_storage            61440  1 uas
Cannot find device "can0"
eth0  lo  wlx00c141390c5a

And as you can see, there is no can0 devices in /sys/class/net.

 

here is my dts file:

 

/dts-v1/;
/plugin/;


/ {
    compatible = "rockchip,rk3328", "pine64,rock64";
    fragment@0 {
        target-path = "/spi@ff190000";
                //target = <&spi0>;
        __overlay__ {
            status="okay";
            spidev@0{
                            status = "disabled";
                        };
                        spidev@1{
                                status = "disabled";
                        };
        };
    };
 /* the interrupt pin of the can-controller */
    fragment@1 {
          target-path = "/pinctrl/gpio3@ff240000";
          //target = <&gpio3>;
          __overlay__ {
              can0_pins: can0_pins {
                  rockchip,pins = <0 7 0 &pcfg_pull_none>;
          //phandle = <1>;
              };
          };
    };

/* the clock/oscillator of the can-controller */
    fragment@2 {
        target-path = "/";
        __overlay__ {
            /* external oscillator of mcp2515 on SPI0.0 */
            can0_osc: can0_osc {
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency  = <16000000>;
            };
        };
    };

/* the spi config of the can-controller itself binding everything together */
    fragment@3 {
        target-path = "/spi@ff190000";
        //target = <&spi0>;
        __overlay__ {
            /* needed to avoid dtc warning */
           #address-cells = <1>;
            #size-cells = <0>;
            can0: can0@0 {
        //phandle = <1>;
                reg = <0>;
                compatible = "microchip,mcp2515";
                pinctrl-names = "default";
                pinctrl-0 = <&can0_pins>;
        //pinctrl-0 = "/pinctrl/gpio3@ff240000/can0_pins/";
                spi-max-frequency = <10000000>;
                interrupt-parent = <&gpio3>;
                //interrupt-parent = "/pinctrl/gpio3@ff240000";
                interrupts = <7 0x2>; // 7 2
                //clocks = "/can0_osc";
                clocks = <&can0_osc>;
            };
        };
    };
};
                  

 

here is what I can read from dmesg:

pi@rock64:/boot/overlay-user$ dmesg | fgrep -i spi
[    0.199580] bus: 'spi': registered
[    0.199591] device class 'spi_master': registering
[    0.215439] device: 'ff190000.spi': device_add
[    0.215471] bus: 'platform': add device ff190000.spi
[    0.215560] PM: Adding info for platform:ff190000.spi
[    2.069101] bus: 'spi': add driver cros-ec-spi
[    2.069297] device class 'spi_transport': registering
[    2.069329] device class 'spi_host': registering
[    2.070797] bus: 'spi': add driver m25p80
[    2.070861] device class 'spidev': registering
[    2.070890] bus: 'spi': add driver spidev
[    2.070956] bus: 'platform': add driver rockchip-spi
[    2.071145] bus: 'platform': driver_probe_device: matched device ff190000.spi with driver rockchip-spi
[    2.071162] bus: 'platform': really_probe: probing driver rockchip-spi with device ff190000.spi
[    2.071495] rockchip-spi ff190000.spi: no init pinctrl state
[    2.071552] rockchip-spi ff190000.spi: no sleep pinctrl state
[    2.071566] rockchip-spi ff190000.spi: no idle pinctrl state
[    2.071795] rockchip-spi ff190000.spi: no high_speed pinctrl state
[    2.071820] device: 'spi32766': device_add
[    2.072075] PM: Adding info for No Bus:spi32766
[    2.072326] device: 'spi32766.0': device_add
[    2.072362] bus: 'spi': add device spi32766.0
[    2.072582] PM: Adding info for spi:spi32766.0
[    2.072661] rockchip-spi ff190000.spi: chipselect 0 already in use
[    2.072675] spi_master spi32766: spi_device register error /spi@ff190000/flash@0
[    2.072692] spi_master spi32766: Failed to create SPI device for /spi@ff190000/flash@0
[    2.072709] driver: 'rockchip-spi': driver_bound: bound to device 'ff190000.spi'
[    2.072758] bus: 'platform': really_probe: bound device ff190000.spi to driver rockchip-spi
[    8.643523] bus: 'spi': add driver mcp251x
[    8.643560] bus: 'spi': driver_probe_device: matched device spi32766.0 with driver mcp251x
[    8.643570] bus: 'spi': really_probe: probing driver mcp251x with device spi32766.0
[    8.643678] mcp251x spi32766.0: no pinctrl handle
[    8.646051] mcp251x spi32766.0: Looking up vdd-supply from device tree
[    8.646071] mcp251x spi32766.0: Looking up vdd-supply property in node /spi@ff190000/can0@0 failed
[    8.648100] mcp251x spi32766.0: Looking up xceiver-supply from device tree
[    8.648120] mcp251x spi32766.0: Looking up xceiver-supply property in node /spi@ff190000/can0@0 failed
[    8.661924] mcp251x: probe of spi32766.0 rejects match -19
pi@rock64:/boot/overlay-user$ 

 help me plz.

 

Posted
  On 10/4/2018 at 4:34 PM, Hydrocactus said:
[ 8.646051] mcp251x spi32766.0: Looking up vdd-supply from device tree 
[ 8.646071] mcp251x spi32766.0: Looking up vdd-supply property in node /spi@ff190000/can0@0 failed 
[ 8.648100] mcp251x spi32766.0: Looking up xceiver-supply from device tree 
[ 8.648120] mcp251x spi32766.0: Looking up xceiver-supply property in node /spi@ff190000/can0@0 failed [ 8.661924] mcp251x: probe of spi32766.0 rejects match -19

 

Expand  

 

I assume you need at least an mpc251x driver (as module). Seems not to be here for rock64.

  Reveal hidden contents

Go through this one to see how you can change that. :) 

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines