I haven't been able to make it work by modifying /opt/bb.org-overlays/src/arm/BB-BELA-00A10.dts.
I did manage to do it with the software driven version though.
However, it appears that in addition to the steps you described, one needs to comment the line that states that the SPI interface uses that GPIO in /opt/bb.org-overlays/src/arm/BB-SPIDEV0-00A0.dts , like so:
/* state the resources this cape uses */
exclusive-use =
/* the pin header uses */
"P9.17", /* spi0_cs0 */
"P9.18", /* spi0_d1 */
"P9.21", /* spi0_d0 */
// "P9.22", /* spi0_sclk */
/* the hardware ip uses */
"spi0";
And for anyone passing by, gpio.open also requires another parameter for direction so the correct call would be gpio.open(5, Gpio::OUTPUT)
From what I understand, in the expression 0x15c 0x20, the value 0x15c refers to the pin number or address, and 0x20 represents the pin configuration as a bitfield.
If that's correct, I'm confused about why pin 0x15c and pin 0x158 don't have the same configuration value, since according to the comments they should be configured identically.
To be honest, I'm not sure if I'll really need the CS pin to be hardware driven by the SPI controller but I'm quite interested in getting it to work.
I'm really thankful for your replies as I'm able to understand linux kernel a little better now.