Jump to content

u-boot 2018.05 parser issue w/Armbian sunxi-next DT scripts (e.g., spi-spidev overlay configuration failure)


Recommended Posts

Posted

There appears to be a problem or incompatibility with the new 2018.05 u-boot configuration and/or implementation and the Armbian sunxi-next startup scripts (both in the current master branch).  The "fdt" command processing doesn't appear to properly expand local environment variables before trying to execute them (?).  Here's an example from a vanilla Armbian boot (u-boot 2018.05) - notice the "libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND" errors when the DT fixup script runs:

                      ...
Err:   serial
Net:   No ethernet found.
230454 bytes read in 15 ms (14.7 MiB/s)
starting USB...
No controllers found
Autoboot in 1 seconds, press <Space> to stop
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
3100 bytes read in 7 ms (431.6 KiB/s)
## Executing script at 4fc00000
U-boot loaded from SD
Boot script loaded from mmc
230 bytes read in 5 ms (44.9 KiB/s)
26379 bytes read in 19 ms (1.3 MiB/s)
780 bytes read in 18 ms (42 KiB/s)
Applying kernel provided DT overlay sun50i-h5-spi-spidev.dtbo
504 bytes read in 30 ms (15.6 KiB/s)
Applying kernel provided DT overlay sun50i-h5-usbhost1.dtbo
504 bytes read in 32 ms (14.6 KiB/s)
Applying kernel provided DT overlay sun50i-h5-usbhost2.dtbo
4179 bytes read in 26 ms (156.3 KiB/s)
Applying kernel provided DT fixup script (sun50i-h5-fixup.scr)
## Executing script at 44000000
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
4534427 bytes read in 230 ms (18.8 MiB/s)
13942792 bytes read in 695 ms (19.1 MiB/s)
## Loading init Ramdisk from Legacy Image at 4fe00000 ...
                      ...

 

These particular "FDT_ERR_NOTFOUND" errors are coming from the processing for the /boot/armbianEnv.txt setting "param_spidev_spibus=".  The two "fdt set /soc/${tmp_spi_path} ..." commands are failing because ${tmp_spi_path} is not getting expanded (or is expanded incorrectly, or something}.

 

I've excerpted the necessary commands from the board DT startup scripts to illustrate this.  Simply boot into u-boot on a top-of-tree build from master on an H5 device - hit spacebar repeatedly while u-boot is starting up - and enter the following commands in the u-boot command line (in this example I'm using my NanoPi NEO2):

                      ...
In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
230454 bytes read in 15 ms (14.7 MiB/s)
starting USB...
No controllers found
Autoboot in 1 seconds, press <Space> to stop
=>
=>
=>
=> setenv load_addr "0x44000000"
=> print fdt_addr_r
fdt_addr_r=0x4FA00000
=> setenv devtype mmc
=> setenv devnum 0
=> load ${devtype} ${devnum} ${fdt_addr_r} dtb/allwinner/sun50i-h5-nanopi-neo2.dtb
26379 bytes read in 18 ms (1.4 MiB/s)
=> fdt addr ${fdt_addr_r}
=> fdt resize 65536
=> load ${devtype} ${devnum} ${load_addr} dtb/allwinner/overlay/sun50i-h5-spi-spidev.dtbo
780 bytes read in 18 ms (42 KiB/s)
=> fdt apply ${load_addr}
=>
=> #### now if I set a temporary variable and use that variable (as in "sun50i-h5-fixup.scr"), it fails:
=> setenv tmp_spi_path "spi@01c68000"
=> fdt list /soc/${tmp_spi_path}
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
=>
=> #### however if I specify the value directly, it works fine:
=> fdt list /soc/spi@1c68000
spi@1c68000 {
        compatible = "allwinner,sun8i-h3-spi";
        reg = <0x01c68000 0x00001000>;
        interrupts = <0x00000000 0x00000041 0x00000004>;
        clocks = <0x00000003 0x0000001e 0x00000003 0x00000052>;
        clock-names = "ahb", "mod";
        dmas = <0x00000017 0x00000017 0x00000017 0x00000017>;
        dma-names = "rx", "tx";
        pinctrl-names = "default";
        pinctrl-0 = <0x00000018>;
        resets = <0x00000003 0x0000000f>;
        status = "okay";
        #address-cells = <0x00000001>;
        #size-cells = <0x00000000>;
        phandle = <0x0000004e>;
        spidev {
        };
};
=>

The effect of this is that the current fixup scripts in the master branch won't process everything properly, and (in my case), SPI fails to be enabled and configured properly.  I did some quick comparisons between the prior 2017.11 version and this version (cmdline processing and fdt processing), and there isn't anything obvious that stands out.  Any ideas what might be going on here?  Perhaps the startup DT scripts need to be updated?

 

 

Posted
2 hours ago, peter314 said:

Hi there!

I am experiencing the same problem on fresh install of https://dl.armbian.com/orangepione/Ubuntu_bionic_next_nightly.7z, that is supposed to be supported according to the website.

Would you mind to elaborate what exactly to do to fix this?

Thanks in advance!

 

 

I just fixed this for the H5 boards, and have submitted a PR (https://github.com/armbian/build/pull/1056).  With these changes SPI is working for me again :)  Similar changes likely need to be made for the H3 DTs.

Posted
2 minutes ago, peter314 said:

I got it running now by patching sun8i-h3-fixup.scr :)

But where do i find the all the dts files to be patched? Are they these ones: https://github.com/armbian/sunxi-DT-overlays?

Thanks!

 

Great :) !  The DT files are actually all generated from a patch, e.g., see https://github.com/5kft/build/blob/9ad96bd2090325092142a5c1dc75fe085c940bc5/patch/kernel/sunxi-next/general-sunxi-overlays.patch (this version has my changes to fix the H5-related entries, and some other things).  You can edit the sun8i-h3 DT entries locally in the file ".../build/patch/kernel/sunxi-next/general-sunxi-overlays.patch".

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines