PINE64
writing dts overlay for mcp2515 - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: ROCK64 (https://forum.pine64.org/forumdisplay.php?fid=85)
+--- Forum: Linux on Rock64 (https://forum.pine64.org/forumdisplay.php?fid=88)
+--- Thread: writing dts overlay for mcp2515 (/showthread.php?tid=6618)



writing dts overlay for mcp2515 - Hydrocactus - 10-04-2018

Hi there I'm trying to write a dts file to make "pican2" mcp2515 based hat working on armbian, I've wrote a dts file, compiled it, and I've put it in /boot/overlay-user/.
It's not working.

I've tried hard, but now as I'm stuck and because I'm a noob in devices-tree world I come here to ask for help, so please take a look.


here is my dts file:


Code:
/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>;
           };
       };
   };
};


and here is what I can read in my dmesg:


Code:
[    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