This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Yst,
Could you clarify what the purpose is for loading the CAN interface in order? If the purpose is to have a specific CAN bus have a specific ID, then this FAQ can be referenced: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1267036/faq-am69-how-can-i-assign-interface-id-to-can-modules.
Regards,
Takuma
Is the intent to get the module probe happen in order or to have the CAN interface IDs in a specified order?
If it is he latter, the FAQ posted by Takuma will help.
Regards
Karan
Hi Takuma,
I want to use the CAN interfaces can0, can1, can2 and can3 from Linux user space ,and I hope it can correspond to the number on my board.
I tried the method mentioned above,but it can not work.
So,how can I do to make it in order to load?
Regards,
Yst
Hi Yst
I'm still unclear on what is the end goal here?
I want to use the CAN interfaces can0, can1, can2 and can3 from Linux user space ,and I hope it can correspond to the number on my board.
Can you please elaborate more on this? Also have you looked at this FAQ to update the udev rules?
Regards
Karan
Hi Karan,
When the system is up,I hope can0 in Linux user space to correspond to can0 on my board.But now,can drivers are not loaded in order.Therefore, the can0 device node may correspond to the can5 interface on my board.Like this:
The can devices are registered in a different order each time the system starts.
Regards,
Yst
Hi Yst
Can you mention what do SoC CAN instances map to the can0, can1 .. instances on your board?
The SoC CAN instances are MCAN0, MCAN1.. and so on for the MAIN domain and MCU_MCAN0 and MCU_MCAN1 in the MCU domain.
The FAQ I pointed to exactly tries to do what you want.
#11-can-mylocal.rules
KERNELS=="40528000.can", ACTION=="add", NAME="can1"
KERNELS=="40568000.can", ACTION=="add", NAME="can0"
KERNELS=="2771000.can", ACTION=="add", NAME="can6"
KERNELS=="2761000.can", ACTION=="add", NAME="can7"
The above would map can1 to MCU_MCAN0, can0 to MCU_MCAN1, can6 to MCAN7 and can7 yo MCAN6.
Regards
Karan
Hi,Karan
I tried the methods mentioned above, but it can not work
I want the can drivers to be loaded sequentially,like this:
Registration of can drivers in this order can correspond to the serial number of the CAN hardware interface on my board.
But now,registration of can drivers is random.
Regards,
Yst
Hi Yst
Can you mention what do SoC CAN instances map to the can0, can1 .. instances on your board?
Can you please answer this?
Also, please share the new udev rule you added for CAN.
Regards
Karan
Hi Karan,
The following is the can on my board:
I want it to correspond to the can interface on my soc.
The following is my udev rule:
Regards,
Yst
Hi Yst
I tried to use the same udev rule you had and I'm able to get the expected result.
root@am69-sk:~# cat /etc/udev/rules.d/06-can-load.rules #06-can-load.rules KERNELS=="2701000.can", ACTION=="add", NAME="can0" KERNELS=="2711000.can", ACTION=="add", NAME="can1" KERNELS=="2731000.can", ACTION=="add", NAME="can2" KERNELS=="2741000.can", ACTION=="add", NAME="can3" KERNELS=="2751000.can", ACTION=="add", NAME="can4" KERNELS=="2771000.can", ACTION=="add", NAME="can5" root@am69-sk:~# root@am69-sk:~# root@am69-sk:~# root@am69-sk:~# ls -la /sys/class/net/can*/device lrwxrwxrwx 1 root root 0 Sep 28 09:11 /sys/class/net/can0/device -> ../../../2701000.can lrwxrwxrwx 1 root root 0 Sep 28 09:11 /sys/class/net/can1/device -> ../../../2711000.can lrwxrwxrwx 1 root root 0 Sep 28 09:11 /sys/class/net/can2/device -> ../../../2731000.can lrwxrwxrwx 1 root root 0 Sep 28 09:11 /sys/class/net/can3/device -> ../../../2741000.can lrwxrwxrwx 1 root root 0 Sep 28 09:11 /sys/class/net/can4/device -> ../../../2751000.can lrwxrwxrwx 1 root root 0 Sep 28 09:11 /sys/class/net/can5/device -> ../../../2771000.can root@am69-sk:~# root@am69-sk:~# root@am69-sk:~# root@am69-sk:~# dmesg | grep -i can [ 0.563014] HugeTLB: 0 KiB vmemmap can be freed for a 1.00 GiB page [ 0.576355] HugeTLB: 0 KiB vmemmap can be freed for a 32.0 MiB page [ 0.589692] HugeTLB: 0 KiB vmemmap can be freed for a 2.00 MiB page [ 0.603030] HugeTLB: 0 KiB vmemmap can be freed for a 64.0 KiB page [ 4.681775] CAN device driver interface [ 4.699776] m_can_platform 2701000.can: m_can device registered (irq=485, version=32) [ 4.703573] m_can_platform 2711000.can: m_can device registered (irq=486, version=32) [ 4.750363] m_can_platform 2731000.can: m_can device registered (irq=489, version=32) [ 4.762294] m_can_platform 2741000.can: m_can device registered (irq=490, version=32) [ 4.774779] m_can_platform 2751000.can: m_can device registered (irq=491, version=32) [ 4.872072] m_can_platform 2771000.can: m_can device registered (irq=496, version=32) [ 5.027541] tidss 4a00000.dss: [drm] Cannot find any crtc or sizes root@am69-sk:~# root@am69-sk:~# root@am69-sk:~#
Can you check if your udev rule is getting triggered? Are there any other rules which are overwriting this?
Refer this thread - https://unix.stackexchange.com/questions/200194/how-to-debug-an-udev-rule-in-etc-udev-rules-d
Regards
Karan