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.

TDA4VM: Device number cannot be fixed

Part Number: TDA4VM


Hi team,

When using the TDA4VM evaluation board, the CAN device number is changed. The customer is trying to fix the CAN device number using an alias. The DTS file is as follows: 

/ {
	chosen {
		stdout-path = "serial2:115200n8";
		bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000";
	};
	
    aliasis{
        can0 = &mcu_mcan0;
        can1 = &mcu_mcan1;
        can2 = &main_mcan0;
        can3 = &main_mcan2;
    };

However, there is still a change in the device number. For example, MCU_mcan0 is used, but the actual device number is can3, not can0. The contents of can0~3 of aliasis under /sys are passed correctly as follows: 

cat /sys/firmware/devicetree/base/aliasis/can0
/bus@100000/bus@28380000/can@40528000

cat /sys/firmware/devicetree/base/aliasis/can1
/bus@100000/bus@28380000/can@40568000

cat /sys/firmware/devicetree/base/aliasis/can2
/bus@100000/can@2701000

cat /sys/firmware/devicetree/base/aliasis/can3 
/bus@100000/can@2721000

Could you help check this case? Thanks.

Best Regards,

Cherry

  • Hi Cherry,

    However, there is still a change in the device number. For example, MCU_mcan0 is used, but the actual device number is can3, not can0. The contents of can0~3 of aliasis under /sys are passed correctly as follows: 

    Can you check the instances under /sys/class/net? If they are in the order mentioned in the alias?

    - Keerthy

  • Hi Keerthy,

    Thank you for the support.

    Under net is still the automatically recognized instances of can0 can1 can2 can3:

    root@j7-evm:~# ls /sys/class/net/
    can0  can1  can2  can3	docker0  eth0  eth1  eth2  lo

    lrwxrwxrwx 1 root root 0 Mar  3 23:11 can0 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/40568000.can/net/can0
    lrwxrwxrwx 1 root root 0 Mar  3 23:11 can1 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/40528000.can/net/can1
    lrwxrwxrwx 1 root root 0 Mar  3 23:11 can2 -> ../../devices/platform/bus@100000/2721000.can/net/can2
    lrwxrwxrwx 1 root root 0 Mar  3 23:11 can3 -> ../../devices/platform/bus@100000/2701000.can/net/can3

    Thanks and regards,

    Cherry

  • Hi Keerthy,

    The customer wants to try to fix the can device number by using udev, adding a new rule under /etc/udev/rules.d. 

    CAN belongs to the net subsystem, adding CAN rules under /etc/udev/rules.d/autonet.rules, which is associated with the current net. Now the DEVPATH of the CAN device is basically fixed and the device name then is created based on DEVPATH. 

    Is the above way feasible? 

    Thanks and regards,

    Cherry

  • Cherry,

    So in Summery even with the aliasing you are the device order is not changing right?

    Regards,

    Keerthy

  • Hi Keerthy,

    So in Summery even with the aliasing you are the device order is not changing right?

    Yes, correct.

    Thanks and regards,

    Cherry

  • Hi Cherry,

    Quick observation, the spelling of "aliases" is incorrect in the code you have copied in the question. Can you confirm that it is a typo while copying or is the issue even in the code?

    Regards,
    Tanmay

  • Hi Tanmay,

    Thank you and the customer has also found this issue, after correct the spelling, they retried to replace the device name with a non-enumerated device name as follows: 

            aliases{
                   mcu_can0 = &mcu_mcan0;
                   mcu_can1 = &mcu_mcan1;
                   main_can0 = &main_mcan0;
                   main_can2 = &main_mcan2;
            };

    However, CAN devices still use auto-enumerated names, not aliases. 

    can0: flags=128<NOARP>  mtu 16  metric 1
            unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10  (UNSPEC)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
            device interrupt 23  
    
    can1: flags=128<NOARP>  mtu 16  metric 1
            unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10  (UNSPEC)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
            device interrupt 25  
    
    can2: flags=128<NOARP>  mtu 16  metric 1
            unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10  (UNSPEC)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
            device interrupt 55  
    
    can3: flags=128<NOARP>  mtu 16  metric 1
            unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10  (UNSPEC)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
            device interrupt 57  

    root@j7-evm:~# ls /sys/firmware/devicetree/base/aliases/
    ethernet0  main_can2  mcu_can1	mmc1  serial0  serial10  serial2  serial4  serial6  serial8
    main_can0  mcu_can0   mmc0	name  serial1  serial11  serial3  serial5  serial7  serial9

    Now they are trying to modify the CAN name using udev mechanism, could you help give some guidance? 

    Thanks and regards,

    Cherry

  • Hi,

    Quick update: for example, there are two rules, automount.rules and local.rules for block devices, and for net devices, there is no socket CAN-related content at all.

    Also, it's found removing autonet.rules also does not affect the mount of net devices, indicating that there are other mechanisms for mounting net devices.

    May I know is there a mechanism description for device mounting for the current TDA4 for reference? 

    Thanks and regards,

    Cherry

  • Hi Cherry,

    Sorry for the delay,

    Is this issue still being observed?

    Regards,
    Tanmay