OpenWrt Support for Banana Pi BPI-R3

Please, help with DT Overlay. I've made a file w1-gpio.dts

/dts-v1/;
/plugin/;

&{/} {
        compatible = "bananapi,bpi-r3", "mediatek,mt7986a";

    fragment@0 {
        target-path = "/";
        __overlay__ {
            w1: onewire {
                compatible = "w1-gpio";
                gpios = <&gpio 22>;
            };
        };
    };
};

and successfully compiled it by comand

dtc -@ -I dts -O dtb -o /root/w1-gpio.dtbo /root/w1-gpio.dts

What I can do yet?

You need to add this DTO into the image and have U-Boot select it using the bootconf environment variable. Grep for mt7986a-bananapi-bpi-r3-respeaker-2mics in OpenWrt tree to find out how.

Another way would be to add a custom filesystem (eg. an additional UBI volume and UBIFS on NAND, or ext4 or fat on eMMC or SD) to store that overlay blob and modify bootcmd to use step-by-step, ie.

Sub-commands to do part of the bootm sequence.  The sub-commands must be
issued in the order below (it's ok to not issue all sub-commands):
        start [addr [arg ...]]
        loados  - load OS image
        ramdisk - relocate initrd, set env initrd_start/initrd_end
        fdt     - relocate flat device tree
        cmdline - OS specific command line processing/setup
        bdt     - OS specific bd_info processing
        prep    - OS specific prep before relocation or go
        go      - start OS

fdt - flattened device tree utility commands

Usage:
fdt addr [-c] [-q] <addr> [<size>]  - Set the [control] fdt location to <addr>
fdt apply <addr>                    - Apply overlay to the DT
fdt systemsetup                     - Do system-specific set up
fdt move   <fdt> <newaddr> <length> - Copy the fdt to <addr> and make it active
fdt resize [<extrasize>]            - Resize fdt to size + padding to 4k addr + some optional <extrasize> if needed
fdt print  <path> [<prop>]          - Recursive print starting at <path>
fdt list   <path> [<prop>]          - Print one level starting at <path>
fdt get value <var> <path> <prop> [<index>] - Get <property> and store in <var>
                                      In case of stringlist property, use optional <index>
                                      to select string within the stringlist. Default is 0.
fdt get name <var> <path> <index>   - Get name of node <index> and store in <var>
fdt get addr <var> <path> <prop>    - Get start address of <property> and store in <var>
fdt get size <var> <path> [<prop>]  - Get size of [<property>] or num nodes and store in <var>
fdt set    <path> <prop> [<val>]    - Set <property> [to <val>]
fdt mknode <path> <node>            - Create a new node after <path>
fdt rm     <path> [<prop>]          - Delete the node or <property>
fdt header [get <var> <member>]     - Display header info
                                      get - get header member <member> and store it in <var>
fdt bootcpu <id>                    - Set boot cpuid
fdt memory <addr> <size>            - Add/Update memory node
fdt rsvmem print                    - Show current mem reserves
fdt rsvmem add <addr> <size>        - Add a mem reserve
fdt rsvmem delete <index>           - Delete a mem reserves
fdt chosen [<start> <size>]         - Add/update the /chosen branch in the tree
                                        <start>/<size> - initrd start addr/size
NOTE: Dereference aliases by omitting the leading '/', e.g. fdt print ethernet0.

So what you would need to do is rougly

bootm start $loadaddr $bootconf
bootm loados
bootm fdt
fdt apply ....
bootm bdt
bootm prep
bootm go

A couple of things I've noticed with the R3 in setting up a new one:

  1. Although it appears to support background radar detection for DFS channels (i.e. the option is available to set), I don't think it can actually do zero-wait DFS. At least, I can't get it to switch to another DFS channel immediately without waiting through another 60-second CAC (with Canada country code), no matter what conditions I've tried.

  2. On my first R3 build using a snapshot about a year ago, I was able to use autopart to partition the extra space on the eMMC and then uvol to create the filesystem and mount it. This didn't work for me with my new unit and stable 24.10.1. autopart failed to create the partition so uvol couldn't work. I ended up having to do it all manually (which wasn't difficult, but it's not the "recommended" approach). I have an NVMe SSD installed in this unit, but it seems unlikely that it's the source of the problem.

You are right, autopart needs some love to work with 24.10.x and beyond, I'll take care of it asap.

2 Likes

You may test updated autopart which should work for OpenWrt 24.10 and later

Thanks! I won't be able to test this any time soon, unfortunately. I hope that someone else can give it a try.

I've made new partition with fat fs on mmc (0:6). Put to this partition a compiled dtb file.

/dts-v1/;
/plugin/;

/ {
    compatible = "bananapi,bpi-r3", "mediatek,mt7986a";

    fragment@0 {
        target = <&pinctrl>;
        __overlay__ {
            w1_pins: w1-pins {
                mediatek,pins = <4>;  
                mediatek,function = "gpio";
                bias-pull-up;
            };
        };
    };

    fragment@1 {
        target-path = "/";
        __overlay__ {
            onewire: onewire {
                compatible = "w1-gpio";
                gpios = <&pinctrl 4 0>;
                pinctrl-names = "default";
                pinctrl-0 = <&w1_pins>;
                status = "okay";
            };
        };
    };
};

dtc -@ -I dts -O dtb -o /mnt/1w-overlay.dtb /mnt/1w-overlay.dts

and set variable bootcmd

bootcmd=load mmc 0:6 $loadaddr /1w-overlay.dtb; bootm start $loadaddr $bootconf; bootm loados; bootm fdt; fdt apply $loadaddr ; bootm bdt; bootm prep; if pstore check; then run boot_recovery; else run boot_emmc; fi

Then I connect w1 module with DS18B20 to 7pin of GPIO socket... Reboot and got empty /sys/bus/w1/devices/ dir.

Please, help. What is wrong? The sensor and PlugableTerminal (with resistor) are tested with my RPI.