• how to enable spi?

    From Sebastian Kuzminsky@21:1/5 to All on Tue Oct 25 18:10:01 2022
    I'm using the 2022-08-08 bookworm rpi4 image from <https://raspi.debian.net/tested-images/>, it's got linux-image-arm64
    5.18.14-1 and raspi-firmware 1.20220331+ds-2.

    It's working great, except I can't use the SPI devices.

    SPI works on same hardware when running Raspbian's Buster image, after
    running "dtparam spi=on" (or adding "dtparam=spi=on" to the firmware
    config.txt file).

    Raspbian Buster's dtparam program is not available on Debian Bookworm.

    On Raspbian it comes from the libraspberrypi-bin deb, which is made from
    the raspberrypi/firwmware git repo on github (the same repo that
    supplies all the dtb files in /boot). dtparam and the other programs
    there are provided in binary form (for armhf), not source :-(

    Does anyone have any advise for me on how to enable SPI on Debian?

    (In case it's not obvious, I'm a noob at dealing with device tree stuff.)


    --
    Sebastian Kuzminsky

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sebastian Kuzminsky@21:1/5 to Sebastian Kuzminsky on Sun Oct 30 18:10:01 2022
    On 10/25/22 12:03, Sebastian Kuzminsky wrote:
    I'm using the 2022-08-08 bookworm rpi4 image from <https://raspi.debian.net/tested-images/>, it's got linux-image-arm64 5.18.14-1 and raspi-firmware 1.20220331+ds-2.

    It's working great, except I can't use the SPI devices.

    SPI works on same hardware when running Raspbian's Buster image, after running "dtparam spi=on" (or adding "dtparam=spi=on" to the firmware config.txt file).

    Raspbian Buster's dtparam program is not available on Debian Bookworm.

    On Raspbian it comes from the libraspberrypi-bin deb, which is made from
    the raspberrypi/firwmware git repo on github (the same repo that
    supplies all the dtb files in /boot).  dtparam and the other programs
    there are provided in binary form (for armhf), not source :-(

    I don't have this working yet but I've made a little bit of progress.

    The Raspbian Buster armhf binaries can be made to run on Debian Bookworm
    arm64 with a little bit of coaxing, but they rely on kernel features
    that are not in Bookworm's arm64 kernel, so that's a bit of a dead end.

    I then tried editing the dtb directly:

    I "decompiled" the dtb `/boot/firmware/bcm2711-rpi-4-b.dtb` into an
    editable dts with `dtc -I dtb -O dts $DTB > $DTS`.

    I edited the dts to change the spi0 "status" field from "disabled" to "ok".

    I "compiled" the edited dts with `dtc -I dts -O dtb $DTS > $DTB`.

    I then replaced the old dtb with the new one and rebooted.

    The spi port seems to be present/enabled now: dmesg includes
    "spi-bcm2835 fe204000.spi: no tx-dma configuration found - not using dma
    mode", and /sys/bus/platform/drivers/spi-bcm2835/fe204000.spi shows up.

    But something is still wrong, there are still no /dev/spi* device files
    like i get with Raspbian Buster.

    So I'm closer, but I'm still missing something. The quest goes on!


    --
    Sebastian Kuzminsky

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Diederik de Haas@21:1/5 to Sebastian Kuzminsky on Sun Oct 30 19:32:17 2022
    Copy: [email protected]
    Copy: [email protected]

    On Sunday, 30 October 2022 18:04:28 CET Sebastian Kuzminsky wrote:
    The Raspbian Buster armhf binaries can be made to run on Debian Bookworm arm64 with a little bit of coaxing, but they rely on kernel features
    that are not in Bookworm's arm64 kernel

    Do you know which kernel features?
    I can then create a MR to get those enabled in Debian's Bookworm kernel. -----BEGIN PGP SIGNATURE-----

    iHUEABYIAB0WIQT1sUPBYsyGmi4usy/XblvOeH7bbgUCY17DMQAKCRDXblvOeH7b buUQAQD4TZT2rGNshqD181TSeb+DpMXcuAB4qBNrSp+xCnsvwwD+PHNtxA5P1EQe qV6aNteG17PmOJ1Pf6MQJj6WeRCCqQI=
    =oiua
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From gene heskett@21:1/5 to Sebastian Kuzminsky on Sun Oct 30 22:30:01 2022
    On 10/30/22 13:05, Sebastian Kuzminsky wrote:
    On 10/25/22 12:03, Sebastian Kuzminsky wrote:
    I'm using the 2022-08-08 bookworm rpi4 image from
    <https://raspi.debian.net/tested-images/>, it's got linux-image-arm64
    5.18.14-1 and raspi-firmware 1.20220331+ds-2.

    It's working great, except I can't use the SPI devices.

    SPI works on same hardware when running Raspbian's Buster image,
    after running "dtparam spi=on" (or adding "dtparam=spi=on" to the
    firmware config.txt file).

    Raspbian Buster's dtparam program is not available on Debian Bookworm.

    On Raspbian it comes from the libraspberrypi-bin deb, which is made
    from the raspberrypi/firwmware git repo on github (the same repo that
    supplies all the dtb files in /boot).  dtparam and the other programs
    there are provided in binary form (for armhf), not source :-(

    I don't have this working yet but I've made a little bit of progress.

    The Raspbian Buster armhf binaries can be made to run on Debian
    Bookworm arm64 with a little bit of coaxing, but they rely on kernel
    features that are not in Bookworm's arm64 kernel, so that's a bit of a
    dead end.

    I then tried editing the dtb directly:

    I "decompiled" the dtb `/boot/firmware/bcm2711-rpi-4-b.dtb` into an
    editable dts with `dtc -I dtb -O dts $DTB > $DTS`.

    I edited the dts to change the spi0 "status" field from "disabled" to
    "ok".

    I "compiled" the edited dts with `dtc -I dts -O dtb $DTS > $DTB`.

    I then replaced the old dtb with the new one and rebooted.

    The spi port seems to be present/enabled now: dmesg includes
    "spi-bcm2835 fe204000.spi: no tx-dma configuration found - not using
    dma mode", and /sys/bus/platform/drivers/spi-bcm2835/fe204000.spi
    shows up.

    But something is still wrong, there are still no /dev/spi* device
    files like i get with Raspbian Buster.

    So I'm closer, but I'm still missing something.  The quest goes on!


    Bored, I tried my make-debs script on the rpi4b running buster rasppios
    today, but it bailed out with can't find
    Documentation.de error.

    Is there anything I can do?

    Thanks Sebastian Kuzminsky. Take care & stay well.

    Cheers, Gene Heskett.
    --
    "There are four boxes to be used in defense of liberty:
    soap, ballot, jury, and ammo. Please use in that order."
    -Ed Howdershelt (Author, 1940)
    If we desire respect for the law, we must first make the law respectable.
    - Louis D. Brandeis
    Genes Web page <http://geneslinuxbox.net:6309/>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)