> -----Ursprüngliche Nachricht----- > Von: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> > Gesendet: Mittwoch, 16. Dezember 2020 14:27 > An: Sven Schuchmann <schuchmann@xxxxxxxxxxxxxxxxx>; linux-can@xxxxxxxxxxxxxxx > Betreff: Re: assignment of spi to can channels > > The classic solution would be a udev rule in e.g. /etc/udev/rules.d/70-can.rules" > > > SUBSYSTEM=="net", ACTION=="add", DEVPATH=="/devices/platform/soc/*/*/*/spi0.0/net/can?", NAME="mcp0" > > SUBSYSTEM=="net", ACTION=="add", DEVPATH=="/devices/platform/soc/*/*/*/spi1.0/net/can?", NAME="mcp1" > > SUBSYSTEM=="net", ACTION=="add", DEVPATH=="/devices/platform/soc/*/*/*/spi2.0/net/can?", NAME="mcp2" > > SUBSYSTEM=="net", ACTION=="add", DEVPATH=="/devices/platform/soc/*/*/*/spi2.1/net/can?", NAME="mcp3" > > Figure out the exact DEVPATH with > > > udevadm test /sys/class/net/can0 > > udevadm test /sys/class/net/can1 > > Note, with older versions of udev it was possible to rename interfaces within > the same namespace, e.g. use "NAME=can0". I think this doesn't work with newer > udevs anymore, so in this example "mcp?" is used. > Since I am on systemd 241 on a RaspberryPi I decided to go for udev style created /etc/udev/rules.d/70-can.rules with SUBSYSTEM=="net", ACTION=="add", DEVPATH=="/devices/platform/soc/*/*/*/spi0.0/net/can?", NAME="can0" SUBSYSTEM=="net", ACTION=="add", DEVPATH=="/devices/platform/soc/*/*/*/spi1.0/net/can?", NAME="can1" and tadaaaaa: [ 6.917578] spi_master spi1: will run message pump with realtime priority [ 6.936957] mcp251xfd spi1.0 can0: MCP2518FD rev0.0 (-RX_... [ 6.956523] spi_master spi0: will run message pump with realtime priority [ 6.971942] mcp251xfd spi0.0 can1: MCP2518FD rev0.0 (-RX_... [ 7.006515] mcp251xfd spi1.0 rename3: renamed from can0 [ 7.041681] mcp251xfd spi0.0 can0: renamed from can1 [ 7.091563] mcp251xfd spi1.0 can1: renamed from rename3 Thank you Marc! Sven