Add spi agent onto ls1043 dspi bus

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add spi agent onto ls1043 dspi bus

Jump to solution
1,332 Views
sergepayre
Contributor III

Hi,

I want to add mcp2515 spi/can agent onto Ls1043 dspi bus. To do this :

- I modified RCW configuration word to activate the fonctionnality

- I added the following line in my devicetree file :

&dspi0 {
      status = "okay";
      bus-num = <0>;

      can0: can@1 {
         compatible = "microchip,mcp2515";
         reg = <1>;
         spi-max-frequency = <5000000>;

      };

};

- I included "fsl-ls1043a.dtsi" file in my devicetree file

When I start, i obtain the following messages (with dmesg) :

[ 1.121190] fsl-quadspi 1550000.quadspi: n25q128a11 (16384 Kbytes)
[ 1.128048] fsl-dspi 2100000.dspi: registered master spi0
[ 1.128133] spi spi0.1: setup mode 0, 8 bits/w, 5000000 Hz max --> 0
[ 1.128178] fsl-dspi 2100000.dspi: registered child spi0.1
[ 11.915630] Here I am: /home/bip/QorIQ-SDK-V2.0-20160527-yocto/build_bipls1043/tmp/work-shared/bipls1043/kernel-source/drivers/net/can/spi/mcp251x.c:1035
[ 11.929414] Here I am: /home/bip/QorIQ-SDK-V2.0-20160527-yocto/build_bipls1043/tmp/work-shared/bipls1043/kernel-source/drivers/net/can/spi/mcp251x.c:1043 data=-2
[ 11.943973] mcp251x: probe of spi0.1 failed with error -2

As you can see, I add some trace in mcp251x.c. I see that "mcp251x_platform_data" in "mcp251x_can_probe" function returned null pointer.

Why ?

What did I forget to do ?

Best regards

Labels (1)
0 Kudos
1 Solution
988 Views
bpe
NXP Employee
NXP Employee

The modifications you introduced do make sense, but keep in mind that
peripheral drivers may require specific DTS properties, consult
at the driver and the peripheral documentation. Based on the log
you provided it is not clear why exactly the probing function fails,
this may be an incorrect chip select specification or a hardware-level
problem. The suggestion in this regard is to: (a) debug the driver;
(b) monitor the bus activity with a scope.

Have a great day,
Platon

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
989 Views
bpe
NXP Employee
NXP Employee

The modifications you introduced do make sense, but keep in mind that
peripheral drivers may require specific DTS properties, consult
at the driver and the peripheral documentation. Based on the log
you provided it is not clear why exactly the probing function fails,
this may be an incorrect chip select specification or a hardware-level
problem. The suggestion in this regard is to: (a) debug the driver;
(b) monitor the bus activity with a scope.

Have a great day,
Platon

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
988 Views
sergepayre
Contributor III

Hi,

I check my dts file and i found some error

I had the following line in my DTS file

/dts-v1/;
#include "fsl-ls1043a.dtsi"

/ {
      model = "xxx";
      compatible = "fsl,ls1043a-rdb", "fsl,ls1043a";

      aliases {
            crypto = &crypto;
      };

      /* external oscillator */
      clocks {
            mcp251x_clk: oscillator {
            compatible = "fixed-clock";
            #clock-cells = <0>;
            clock-frequency = <16000000>;
          };
      };
};

and

&dspi0 {
    status = "okay";
    bus-num = <0>;
    
    can0: can@1 {
        compatible = "microchip,mcp2515";
        reg = <1>;
        clocks = <&mcp251x_clk>;
        spi-max-frequency = <5000000>;
        status = "okay";
    };
};

I have an external oscillator at 16MHz on my board for mcp2515 chip

When I start mcp251x init driver failed because it's waiting an input frequency between 100 khz and 25 Mhz and I have 100 Mhz

Thanks for your help

Regards

0 Kudos