The officially official Devuan Forum!

You are not logged in.

#1 2019-01-20 20:09:29

krsna
Member
Registered: 2019-01-20
Posts: 4  

Devuan Ascii BananaPi M1 Bad dtb (solved)

So the issue I have ran into is no USB (power?) after kernel loading.
Uboot has it, but Devuan does not. I myself have not tested anything but
the keyboard.

Since I don't intend on using ethernet right away, my temporary fix is
using the Cubieboard2 device tree (dtb). Then everything works, except
for ethernet. I have used this same fix when other distros have had
issues like this.

With the cheap temp fix, USB is active.

https://groups.google.com/forum/#!topic … edunUfIPK4

As the link above suggests, the problem may be with CONFIG_AXP20X_POWER
not being set to yes in sunxi_defconfig. The problem with this fix was
that not all sunxi boards require CONFIG_AXP20X_POWER=y. So I don't know
if anything was ever done about this in the  mainline. It could be a
long gone problem on newer configurations. I really don't know.

I actually don't know if this is the issue I am having. I have been
wrong before. I have not looked at the default build configurations for
Devuan. I have also not looked into the
progress of or known bugs in mainline.

This has been tested on three different BananaPi M1 boards. And on
different SD(HC) cards.

I can't remember for certain, but I do not think this was a problem with
Devuan Jessie. I can remember that there was a problem. But I think it
had something to do with something not being enabled in the kernel for
using the setting up a NFS. That or else the ethernet mode for PC2PC
networking over a Gigabit connection.

Anyway, maybe I have no clue what the problem is. For now using the
Cubieboard2 dtb is file.

If anyone has run into this or knows of a solution, let me know. I am
not invested enough to do my own build. I install all packages locally
and require no ethernet. There may be other limitation of using the
Cubieboard2 dtb, as I have not tested X. But the only error I have ever
run into before, on any distro that I have used this temp fix, is the
ethernet not working.

I've thought about buying a Cubieboard2 just because of that. But it
would be a shame, since I already have 3 working Bananapi boards.

Last edited by krsna (2019-01-23 17:41:12)

Offline

#2 2019-01-21 16:51:06

krsna
Member
Registered: 2019-01-20
Posts: 4  

Re: Devuan Ascii BananaPi M1 Bad dtb (solved)

Do I need to compile a kernel to compile a dts with dtc?

Is the text output of the binary dtb usable as a source? Or do I have to git-clone mainline uboot to get a dts?

Maybe I am going at this the wrong way. Perhaps the kernel needs to be recompiled. But it would seem that since the Cubieboard2 dbt does everything but ethernet, that the problem is really just in the dtb.

The last time I really got into all of this, device trees were not standard. So aside from doing the whole build from scratch, I don't know what is exactly needed to compile a device tree binary. I imagine if it was not compiled into the kernel, it doesn't matter if it is in the device tree. But it would seem that if the cubieboard2 dtb can boot the board, that the kernel is fine.

Anybody?

Should I be asking these questions on a mailing list?

Offline

#3 2019-01-21 17:07:06

krsna
Member
Registered: 2019-01-20
Posts: 4  

Re: Devuan Ascii BananaPi M1 Bad dtb (solved)

Just in case someone else runs into this, The Cubieboard2 dbt work for everything but ethernet. Audio over hdmi does not work, but that has nothing to do with the dtb. No one has reimplemented it yet. So unless you use an old kernel setup, 3.5mm audio is all there is for now. Its probably going to be that way for a while. Or so that is what I have heard.

Offline

#4 2019-01-23 17:37:29

krsna
Member
Registered: 2019-01-20
Posts: 4  

Re: Devuan Ascii BananaPi M1 Bad dtb (solved)

So, I have a working solution for me. Its probably not 100% accurate. But it is really close. I haven't tested th OTG, and I think it may be altered from the original configuration. And what I believe could be two serial connections are disabled that didn't need to be. But I am not using them, so it doesn't bother me. I'll show where they are, so that if someone was bored, they can see if they actually need to be commented out or not.

I did not have to compile uboot or the kernel. DTC (device tree compiler) can assemble and disassemble dtb/dts files.

I did check the sources, regarding the possible issues I first assumed as a culprit. It has nothing to do with the def_config option, since it is now set to (y) by default.

This is what I have done.

Take the file "sun7i-a20-bananapi.dtb" from the first fat partition, on the Devuan ASCII SDcard/Image, found in the dtbs folder. Install "dtc". Then output the dtb file to source.

dtc -I dtb -o sun7i-a20-bananapi_r1.dts -O dts sun7i-a20-bananapi.dtb

Then open your new dts file in an editor. These are the changes I made. Not all of them probably have to be made. But they worked for me the first time, so I didn't test it without the possibly un-needed changes. All things changed, were not needed for my use case. You might look into it if the OTG or serial connections fail to work for you.

Change #1 (probably not needed)

        aliases {
                ethernet0 = "/soc@1c00000/ethernet@1c50000";
                serial0 = "/soc@1c00000/serial@1c28000";
                serial1 = "/soc@1c00000/serial@1c28c00";
                serial2 = "/soc@1c00000/serial@1c29c00";
        };

to

        aliases {
                ethernet0 = "/soc@1c00000/ethernet@1c50000";
                serial0 = "/soc@1c00000/serial@1c28000";
                #serial1 = "/soc@1c00000/serial@1c28c00";
                #serial2 = "/soc@1c00000/serial@1c29c00";
        };

Change #2 (Probably deals with power to the OTG?)

                phy@1c13400 {
                        #phy-cells = <0x1>;
                        compatible = "allwinner,sun7i-a20-usb-phy";
                        reg = <0x1c13400 0x10 0x1c14800 0x4 0x1c1c800 0x4>;
                        reg-names = "phy_ctrl", "pmu1", "pmu2";
                        clocks = <0x2 0x7d>;
                        clock-names = "usb_phy";
                        resets = <0x2 0x1 0x2 0x2 0x2 0x3>;
                        reset-names = "usb0_reset", "usb1_reset", "usb2_reset";
                        status = "okay";
                        pinctrl-names = "default";
                        pinctrl-0 = <0x1c>;
                        usb0_id_det-gpio = <0x19 0x7 0x4 0x0>;
                        usb0_vbus_power-supply = <0x1d>;
                        usb0_vbus-supply = <0x1e>;
                        usb1_vbus-supply = <0x1f>;
                        usb2_vbus-supply = <0x20>;
                        phandle = <0x1a>;
                };

to

                phy@1c13400 {
                        #phy-cells = <0x1>;
                        compatible = "allwinner,sun7i-a20-usb-phy";
                        reg = <0x1c13400 0x10 0x1c14800 0x4 0x1c1c800 0x4>;
                        reg-names = "phy_ctrl", "pmu1", "pmu2";
                        clocks = <0x2 0x7d>;
                        clock-names = "usb_phy";
                        resets = <0x2 0x1 0x2 0x2 0x2 0x3>;
                        reset-names = "usb0_reset", "usb1_reset", "usb2_reset";
                        status = "okay";
                        pinctrl-names = "default";
                        pinctrl-0 = <0x1c>;
                        usb0_id_det-gpio = <0x19 0x7 0x4 0x0>;
                        #usb0_vbus_power-supply = <0x1d>;
                        #usb0_vbus-supply = <0x1e>;
                        usb1_vbus-supply = <0x1f>;
                        usb2_vbus-supply = <0x20>;
                        phandle = <0x1a>;
                };

Change #3 (Probably needed)

                        usb-power-supply {
                                        compatible = "x-powers,axp202-usb-power-supply";
                                        status = "okay";
                                        phandle = <0x1d>;
                                };

to

                        usb-power-supply {
                                        compatible = "x-powers,axp202-usb-power-supply";
                                        status = "disabled";
                                        #phandle = <0x1d>;
                                };

Change #4 (Probably disabes power to the OTG[The change most needed is probably the change to "status" in ahci-5v])

        ahci-5v {
                compatible = "regulator-fixed";
                regulator-name = "ahci-5v";
                regulator-min-microvolt = <0x4c4b40>;
                regulator-max-microvolt = <0x4c4b40>;
                regulator-boot-on;
                enable-active-high;
                gpio = <0x19 0x1 0x8 0x0>;
                status = "disabled";
        };

        usb0-vbus {
                compatible = "regulator-fixed";
                regulator-name = "usb0-vbus";
                regulator-min-microvolt = <0x4c4b40>;
                regulator-max-microvolt = <0x4c4b40>;
                enable-active-high;
                gpio = <0x19 0x1 0x9 0x0>;
                status = "okay";
                phandle = <0x1e>;
        };

to

        ahci-5v {
                compatible = "regulator-fixed";
                regulator-name = "ahci-5v";
                regulator-min-microvolt = <0x4c4b40>;
                regulator-max-microvolt = <0x4c4b40>;
                regulator-boot-on;
                enable-active-high;
                gpio = <0x19 0x1 0x8 0x0>;
                status = "okay";
        };

        usb0-vbus {
                compatible = "regulator-fixed";
                regulator-name = "usb0-vbus";
                regulator-min-microvolt = <0x4c4b40>;
                regulator-max-microvolt = <0x4c4b40>;
                enable-active-high;
                gpio = <0x19 0x1 0x9 0x0>;
                status = "disabled";
                #phandle = <0x1e>;
        };

So once you have made the changes (maybe not all are needed), you compile the device tree source back into a blob.

dtc -I dts -o sun7i-a20-bananapi_r1.dtb -O dtb sun7i-a20-bananapi_r1.dts

Then copy your new revised blob into the dtbs folder on the fat partition of the Devuan ASCII SDcard/Image.

Then alter the file "boot.cmd", found in the first partition (fat) of the Devuan ASCII SDcard/Image, to match this.

setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10 ${extra}
load mmc 0:1 0x43000000 dtbs/sun7i-a20-bananapi_r1.dtb || load mmc 0:1 0x43000000 boot/dtbs/sun7i-a20-bananapi_r1.dtb
load mmc 0:1 0x42000000 zImage || load mmc 0:1 0x42000000 boot/zImage
bootz 0x42000000 - 0x43000000

This will make sure the the kernel uses the new device tree blob.

Alternatively, you can add the ".old" extension to the original blob; and copy the new one into the same directory without the "_r1" designation.

If you just rename it, then the following is not needed.

If you edited the "boot.cmd" file, then you will need to install and run mkimage to output a new "boot.src" file.

mkimage -C none -A arm -T script -d boot.cmd boot.scr

Thats it.

I am only sure that one of the changes I did actually needs to be done. (ahci-5v status changed from disabled to okay).

Last edited by krsna (2019-01-23 17:40:28)

Offline

Board footer