MCP251x CAN Controller for T2081

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

MCP251x CAN Controller for T2081

1,093 Views
anshulkhare
Contributor III

Hello All,

we have T2081 custom board based on T2080RDB-PC,
in the custom board we are using MCP2515 CAN Controller connected via SPI bus,
to enable the driver i have changed in kernel config and enabled microchip MCP251x SPI CAN controllers,
but i am getting issue to how to select chip select pin for the MCP2515,
because in SPI interface there are other slave devices are also connected,
as per the processor manual there are 4 chip select pins are there.
where to do the modification to select CS pin for the specific device.
kindly help to solve this issue.


Regards,
Anshul

Labels (1)
0 Kudos
2 Replies

845 Views
Pavel
NXP Employee
NXP Employee

Look at the following document:

https://www.kernel.org/doc/Documentation/devicetree/bindings/spi/spi-bus.txt

 

Find the <reg> in this document.

See as example the part of .dts file for the T2080qds eSPI:

 

                soc: soc@ffe000000 {

                               ranges = <0x00000000 0xf 0xfe000000 0x1000000>;

                               reg = <0xf 0xfe000000 0 0x00001000>;

                               spi@110000 {

                                               flash@0 {

                                                               #address-cells = <1>;

                                                               #size-cells = <1>;

                                                               compatible = "micron,n25q128a11", "jedec,spi-nor"; /* 16MB */

                                                               reg = <0>;

                                                               spi-max-frequency = <40000000>; /* input clock */

                                               };

 

                                               flash@1 {

                                                               #address-cells = <1>;

                                                               #size-cells = <1>;

                                                               compatible = "sst,sst25wf040", "jedec,spi-nor";

                                                               reg = <1>;

                                                               spi-max-frequency = <35000000>;

                                               };

 

                                               flash@2 {

                                                               #address-cells = <1>;

                                                               #size-cells = <1>;

                                                               compatible = "eon,en25s64", "jedec,spi-nor";

                                                               reg = <2>;

                                                               spi-max-frequency = <35000000>;

                                               };

                               };


Have a great day,
Pavel Chubakov

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

0 Kudos

845 Views
anshulkhare
Contributor III

Hello pavel,

Thank you for the reply ,

i am using 2 CAN devices so for that i did  below changes in device tree.

spi@110000 {

            flash@0 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "micron,n25q512a", "jedec,spi-nor";
                reg = <0>;
                spi-max-frequency = <10000000>; /* input clock */
            };

            can1: can@1 {
                compatible = "microchip,mcp2515";
                reg = <1>;
                spi-max-frequency = <300000000>;
            
            };

            can2: can@2 {
                compatible = "microchip,mcp2515";
                reg = <2>;
                spi-max-frequency = <300000000>;
                              
            };
        };

and when i am running the command

dmesg | fgrep -i can 
i am getting below output

CAN device driver interface can: controller area network core (rev 20120528 abi 9)
can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20120528 t)
can: netlink gateway (rev 20130117) max_hops=1

but when i am running command 
dmesg | fgrep -i mcp

i am getting below error in logs

mcp251x: probe of spi32766.1 failed with error -2
mcp251x: probe of spi32766.2 failed with error -2 

and when i run
cat /proc/net/dev
there i am not seeing can0 or can1 present.
how to use CAN device for communication from user interface.
Any suggestion would be appreciated.
Regards, Anshul
0 Kudos