Jump to content

UARTA / UARTC dtbo not loading (FDT_ERR_NOTFOUND/ FDT_ERR_BADMAGIC)


Recommended Posts

Hi!

 

Using the vanilla ARMBIAN image 23.02.2_Bananapim5_bullseye_current_6.1.11_minimal

Enabling the provided uartA and uartC dtbos fails.

Here is the output from the boot process, as captured via the Serial Debug interface:

 

238 bytes read in 3 ms (77.1 KiB/s)
Applying kernel provided DT overlay meson-uartA.dtbo
failed on fdt_overlay_apply(): FDT_ERR_NOTFOUND
238 bytes read in 3 ms (77.1 KiB/s)
Applying kernel provided DT overlay meson-uartC.dtbo
failed on fdt_overlay_apply(): FDT_ERR_BADMAGIC

 

It seems that this image provides invalid dtbos, likely not properly built alongside the same kernel image.

 

I'm happy to help debug this as I have a system at the ready.

Link to comment
Share on other sites

After decompiling the meson-uartA.dtbo, it seems like the addresses are wrong:

 

/dts-v1/;

/ {
	compatible = "amlogic,meson-gxbb";

	fragment@0 {
		target-path = "/soc/bus@c1100000/serial@84c0";

		__overlay__ {
			status = "okay";
		};
	};
};

Looking at the CPUs datasheet https://dn.odroid.com/S905X3/ODROID-C4/Docs/S905X3_Public_Datasheet_Hardkernel.pdf, the memory map is:

Start    End      Peripheral
FFD24000 FFD24FFF uart0
FFD23000 FFD23FFF uart1
FFD22000 FFD22FFF uart2

 

Thus, I have changed the DTS like so:

 

/dts-v1/;

/ {
	compatible = "amlogic,sm1";

	fragment@0 {
		target-path = "/aliases";

		__overlay__ {
			serial1 = "/soc/bus@ffd00000/serial@24000";
		};
	};

	fragment@1 {
		target-path = "/soc/bus@ffd00000/serial@24000";

		__overlay__ {
			status = "okay";
		};
	};
};

 

This DTS is the one used by Sinovo's Armbian release and now I have two devices /dev/ttyAML0 and /dev/ttyAML1

 

I suspect that none of the "enablea-ble" DTBs from armbian-config are actually functional. Additionally, armbian doesn't come with SPI dtbo overlay in order to enable the HW. I recommend for the maintainers to add that to the images. If there is a guide for how to do this, I might be able to give it a shot to update it myself.

Edited by Vicentiu Ciorbaru
Link to comment
Share on other sites

After further debugging, the DTS from above is not enough. Crosschecking between Armbian's banana-pi-m5.dtb and the one provided by Sinovo's Armbian, I noticed the following change in "serial@24000" node.

 

-                               phandle = <0x128>;
+                               pinctrl-0 = <0x27 0x28>;
+                               pinctrl-names = "default";
+                               uart-has-rtscts;
+                               phandle = <0x12a>;

 

 

I'm not an expert in DTS definitions, but as far as I understand, the phandle is a reference. The reference doesn't seem to be used anywhere in the main DTS, so I haven't changed it.

Instead I've modified the overlay to add the other changes:

 

/dts-v1/;

/ {
	compatible = "amlogic,sm1";

	fragment@0 {
		target-path = "/aliases";

		__overlay__ {
			serial1 = "/soc/bus@ffd00000/serial@24000";
		};
	};

	fragment@1 {
		target-path = "/soc/bus@ffd00000/serial@24000";

		__overlay__ {
			pinctrl-0 = <0x27 0x28>;
			pinctrl-names = "default";
			uart-has-rtscts;
			status = "okay";
		};
	};
};

 

 

I confirm that after these changes, UART finally works. Hope this helps anyone in search of a solution. I hope the Armbian maintainers can address these problems related to the Banana Pi M5 board.

 

 

EDIT:

After reverting the previous DTS, as I pasted in the previous post and doing a full power cycle, the UART works still. So it's likely that I didn't power cycle the board properly. I just kept pressing the reset button, but that doesn't seem to be enough apparently?

Edited by Vicentiu Ciorbaru
Link to comment
Share on other sites

I had the same problem, I had to grope a bit, knowing nothing about dt overlays.

 

Here are the ones I came up with, if they can be useful to anyone as a temp fix at least.

I've not bothered with the UARTs RTS/CTS, having no use for them, and these might break on kernel upgrade when the pinctrl phandles change.

 

UART#1 -> U1F : UART_EE_A = GPIO pins 8(TX),10(RX)

/dts-v1/;

/ {
	compatible = "amlogic,meson-gxbb";

	fragment@0 {
		target-path = "/aliases";

		__overlay__ {
			serial1 = "/soc/bus@ffd00000/serial@24000";
		};
	};

	fragment@1 {
		target-path = "/soc/bus@ffd00000/serial@24000";

		__overlay__ {
			pinctrl-0 = <0xdc 0xdd>;
			pinctrl-names = "default";
			status = "okay";
		};
	};
};

 

UART#2 ->  U1F : UART_EE_B = GPIO pins 33(TX), 15(RX)

/dts-v1/;

/ {
	compatible = "amlogic,meson-gxbb";

	fragment@0 {
		target-path = "/aliases";

		__overlay__ {
			serial2 = "/soc/bus@ffd00000/serial@23000";
		};
	};

	fragment@1 {
		target-path = "/soc/bus@ffd00000/serial@23000";

		__overlay__ {
			pinctrl-0 = <0xde>;
			pinctrl-names = "default";
			status = "okay";
		};
	};
};

 

UART#4 ->  U1A : UART_AO_B = GPIO pins 12(TX), 37(RX)

/dts-v1/;

/ {
	compatible = "amlogic,meson-gxbb";

	fragment@0 {
		target-path = "/aliases";

		__overlay__ {
			serial4 = "/soc/bus@ff800000/serial@4000";
		};
	};

	fragment@1 {
		target-path = "/soc/bus@ff800000/serial@4000";

		__overlay__ {
			pinctrl-0 = <0x103>;
			pinctrl-names = "default";
			status = "okay";
		};
	};
};

 

I2C_EE_M2 = GPIO pins 3(SDA), 5(SCL)

/dts-v1/;

/ {
	compatible = "amlogic,meson-gxbb";

	fragment@0 {
		target-path = "/aliases";

		__overlay__ {
			i2c0 = "/soc/bus@ffd00000/i2c@1d000";
		};
	};

	fragment@1 {
		target-path = "/soc/bus@ffd00000/i2c@1d000";

		__overlay__ {
			pinctrl-0 = <0x6f 0x70>;
			pinctrl-names = "default";
			status = "okay";
		};
	};
};

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines