Re: Pine H64 won't boot with DTB version 5.13

From: Emmanuel Vadot <manu_at_bidouilliste.com>
Date: Sat, 10 Sep 2022 07:28:50 UTC
 Hi Peter,

On Sat, 10 Sep 2022 15:00:48 +1000
Peter Jeremy <peterj@freebsd.org> wrote:

> I have updated my Pine H64 to -current and the kernel advises me:
> WARNING: DTB version is 5.9 while kernel expects 5.13, please update the DTB in the ESP
> unfortunately, when I do so, it fails to attach mmc1 to aw_mmc0 (the
> microSD slot) and therefore there's no root device.  The onboard
> flash mmc0 connected to aw_mmc1 probes normally.
> 
> I've compared the boot messages and the critical difference seems to be
> that with the newer DTB, the following device is missing:
> aw_r_intc_gicp0: <Allwinner R INTC> mem 0x7021000-0x70213ff irq 48 on simplebus0
> Instead, I get:
> simplebus0: <interrupt-controller@7021000> mem 0x7021000-0x70213ff irq 51 compat allwinner,sun50i-h6-r-intc (no driver attached)
> 
> Looking through the DTS changes the crucial difference is:
> 
> --- /tmp/zzz/5def4c47d4bd/sys/contrib/device-tree/src/arm64/allwinner/sun50i-h6.dtsi    2022-09-10 12:49:39.000000000 +1000
> +++ /tmp/zzz/src/sys/contrib/device-tree/src/arm64/allwinner/sun50i-h6.dtsi     2022-09-10 13:24:13.751345000 +1000
> ...
> @@ -927,10 +929,9 @@
>                 };
>  
>                 r_intc: interrupt-controller@7021000 {
> -                       compatible = "allwinner,sun50i-h6-r-intc",
> -                                    "allwinner,sun6i-a31-r-intc";
> +                       compatible = "allwinner,sun50i-h6-r-intc";
>                         interrupt-controller;
> -                       #interrupt-cells = <2>;
> +                       #interrupt-cells = <3>;
>                         reg = <0x07021000 0x400>;
>                         interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
>                 };
> 
> The problem is that the FreeBSD interrupt controller drivers
> (sys/arm/allwinner/aw_nmi.c and sys/arm/allwinner/aw_r_intc.c) only
> recognize "allwinner,sun6i-a31-r-intc".
> 
> I tried adding "allwinner,sun6i-a31-r-intc" back in and the resultant
> DTB works.
> 
> I'm not sure if the correct fix is to locally patch sun50i-h6.dtsi
> or fix the interrupt controller drivers.
> 
> -- 
> Peter Jeremy

 Sorry I've missed that when I updated the DTS.
 The correct fix is to add the new compat string to the aw_r_intc
driver (sys/arm/allwinner/aw_r_intc.c).
 Not really sure why the a31 compat string was removed upstream as it's
not said in the commit message tought.
 Feel free to commit this change.
 While you're at it also add allwinner,sun50i-a64-r-intc to the list
just in case they remove the a31 compat string in the futur.

 Cheers,

-- 
Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>