Figured it out on my own:
Solution:
Debugging requires changing the kernel itself to provide more startup information, which is described in https://www.fpgadeveloper.com/how-to-patch-petalinux/
The only difference is using the Petalinux 2022.1 sdk, so requires a different branch to be checked out. There is a note in the afformentioned article which describes where to find the appropriate rebase branch by looking at the appropriate petalinux release notes. For Petalinux 2022.1, it is xlnx_rebase_v5.15_LTS based on https://support.xilinx.com/s/article/000033799?language=en_US.
Essentially, the only change I made was in the parser code, in drivers/mtd/parsers/ofpart_core.c, to change the pr_debug messages to pr_err so they show during the kernel booting.
This led to more information:
spi-nor spi0.0: s25fl128s1 (16384 Kbytes)
spi0.0: 'partitions' subnode not found on /axi/spi@e000d000/flash@0. Trying to parse direct subnodes as partitions.
spi0.0: ofpart partition /axi/spi@e000d000/flash@0/partition@0 (/axi/spi@e000d000/flash@0) error parsing reg property.
spi0.0: error parsing ofpart partition /axi/spi@e000d000/flash@0/partition@0 (/axi/spi@e000d000/flash@0)
Looking at the ofpart_core.c code, these messages only happen for the following peice of code:
if (len / 4 != a_cells + s_cells) {
pr_err("%s: ofpart partition %pOF (%pOF) error parsing reg property.\n",
master->name, pp,
mtd_node);
...
}
After further debugging, it was found that "len" was taking a value of 8. To do this I added this line:
pr_err("%s: ofpart partition %pOF (%pOF) info-- reg: 0x%x, len %d, a_cells %d, s_cells %d.\n",
master->name, pp,
mtd_node,
reg, len, a_cells, s_cells
);
Since system-conf.dtsi defines a_cells as 1 and s_cells as 0, the if statement above evaluates to true since 8/4 should be 2. So to fix this, I overload the bindings and make #size-cells 1.
&flash0 {
compatible = "s25fl128s1", "jedec,spi-nor";
reg = <0>;
#address-cells = <1>; // <------------
#size-cells = <1>; // <------------
spi-tx-bus-width = <1>;
spi-rx-bus-width = <4>;
spi-max-frequency = <100000000>;
};
So I built the kernel again, started it up on the zybo using my SD card and finally got the partitions to automatically load, like I wanted.
Was there an easier way of debugging this? Yeah probably. I tried enabling debug messages for printk in the petalinux configuration, but I think it only works on loadable modules, and not at boot up. If anyone knows an easy way to get pr_debug statements to show up while the kernel is loading, please share.
I don't know if the autoconfiguration is incorrectly setting #address-cells and #size-cells or the Zybo BSP has an issue. I also have been unable to find any consistent documentation on the device tree bindings for this node, so if anyone has any idea where those are located for Petalinux, I'd also appreciate y'all letting me know.
Hopefully this prevents some head banging for someone out there.
- Matt