!. You'll need to have enabled SPI3 using one of the "spi3-<n>cs" overlays, e.g.:You may also want to set a custom CS0 GPIO. For more information:2. Get a copy of the kernel source tree:Put a directory name on the end if you don't want it to be called "linux".
3. Go into the new directory, and open arch/arm/boot/dts/overlays/mcp251xfd-overlay.dts in an editor.
4. Locate the __overrides__ section and make a copy of the spi2-0 property, calling it "spi3-0".
5. Within spi3-0, delete the first bit that says:and change all of the occurrences of "spi2" to "spi3", so "&spi3", "name=mcp251xfd_spi3_0_pins", etc. It should end up looking something like this (here's one I prepared earlier):6. Compile it. It's a bit awkward because it is expecting to load some header files (this is why we cloned the whole branch), but fortunately we can make use of the kernel make system:Inside arch/arm/boot/dts/overlays you should now find mcp251xfd.dtbo. Copy that to your device and give it a go.
Code:
dtoverlay=spi3-1cs,cs0_spidev=offCode:
$ dtoverlay -h spi3-1csName: spi3-1csInfo: Enables spi3 on GPIOs 1-3 with a single chip select (CS) line and associated spidev dev node. The gpio pin number for the CS line and spidev device node creation are configurable. BCM2711 only, spi3-1cs-pi5 is substituted on Pi 5.Usage: dtoverlay=spi3-1cs,<param>=<val>Params: cs0_pin GPIO pin for CS0 (default 0 - BCM SPI3_CE0). cs0_spidev Set to 'off' to prevent the creation of a userspace device node /dev/spidev3.0 (default is 'on' or enabled).Code:
git clone --branch=rpi-6.6.y --single-branch --depth 1 https://github.com/raspberrypi/linux.git3. Go into the new directory, and open arch/arm/boot/dts/overlays/mcp251xfd-overlay.dts in an editor.
4. Locate the __overrides__ section and make a copy of the spi2-0 property, calling it "spi3-0".
5. Within spi3-0, delete the first bit that says:
Code:
<0>, "+5",Code:
spi3-0 =<&mcp251xfd_frag>, "target:0=", <&spi3>,<&mcp251xfd>, "reg:0=0",<&mcp251xfd_pins>, "name=mcp251xfd_spi3_0_pins",<&clk_mcp251xfd_osc>, "name=mcp251xfd-spi3-0-osc",<&mcp251xfd_xceiver_pins>, "name=mcp251xfd_spi3_0_xceiver_pins",<®_mcp251xfd_xceiver>, "name=reg-mcp251xfd-spi3-0-xceiver",<®_mcp251xfd_xceiver>, "regulator-name=mcp251xfd-spi3-0-xceiver";Code:
$ make ARCH=arm bcm2711_defconfig dtbsStatistics: Posted by PhilE — Thu Dec 12, 2024 2:28 pm