(OSD3358) which device tree to start with?

Custom board
CPU: OSD3358
(4) UARTS: UART0 (debug/console), UART1, 2 and 4 connected to MAX232 transceivers
(1) EEPROM
(1) eMMC
(1) SD card
(1) USB (host)
(1) USB (peripheral)
(2) ethernet PHY LAN8710 on i2c bus RMII
(16) GPIO
No onboard LEDs
No HDMI
No sound
No display

I have followed https://www.digikey.com/eewiki/display/linuxonarm/BeagleBone+Black (June 05 2020) instructions. I am able to boot to linux and login.
I am using dtb-rebuilder. I copied/renamed am335x-boneblack.dts, am33xx.dtsi, am335x-bone-common.dtsi and am335x-boneblack-common.dtsi. I have changed/added uart1,2 and 4, commented out the leds/user_leds, added pinmux for the second RMII and other changes to the am335x-zzz-common.dtsi. I have commented out the tda19988 and sound section of amm335x-boneblack-common.dtsi. After doing all that, I found a post on this forum that mentioned to start with am335x-bonegreen.dts because it is same as boneblack except it doesn’t have HDMI. Thenk got me thinking if there is a existing device tree that I should start with instead of the boneblack.
Which device tree is closest match to my custom board?

Also, my custom board hardware is not going to change. I don’t think I need helper or cape manager. However I don’t understand the purpose the helper or cape manager. Ultimately I don’t think I need .dtsi (include) or overlay files. I would like to end up with a single .dts file that matches my board.
Comments about pros/cons of putting device tree in one .dts file are welcome.

Thank you,

Hi @jakthree, if I was doing this design, i’d start with something based on the PocketBeagle dts instead. Completely un-tested and not built, but start with something like:

/dts-v1/;

#include "am33xx.dtsi"
#include "am335x-osd335x-common.dtsi"

/ {
	model = "Custom OSD3358";
	compatible = "custom,osd3358-custom", "ti,am33xx";

	chosen {
		stdout-path = &uart0;
	};

};

&am33xx_pinmux {
	uart0_pins: pinmux-uart0-pins {
		pinctrl-single,pins = <
			AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
			AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
		>;
	};
};

&i2c0 {
	eeprom: eeprom@50 {
		compatible = "atmel,24c256";
		reg = <0x50>;
	};
};

&rtc {
	system-power-controller;
};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_pins>;

	status = "okay";
};

&usb0 {
	dr_mode = "otg";
};

&usb1 {
	dr_mode = "host";
};

PS, dtb-rebuilder has been replaced with: https://github.com/beagleboard/BeagleBoard-DeviceTrees

Regards,

Robert,
Thank you for suggesting the PocketBeagle DT to start with. I will check it out. I downloaded/extracted the BeagleBoard-DeviceTrees-4.19.x-ti.zip file. I now have several directories of DTS files located in linuxonarm/bb-kernel kernel source, dtb-rebuilder, BB-DeviceTrees, linuxonarm/uboot and other dirs. I am confused about which DTS directory I should be putting my dts files in. I don’t understand if I need to put my custom dts files in the kernel directory and in the BB-DT/src/arm directory. I will put my dts files in BB-DT/src/arm, use BB-DT make and copy the .dtb to my target.
Does copying the .dtb created by BB-DT to my target board satisfy the kernel?
Does the kernel need to know about the custom DT when then kernel is built/rebuilt?
The kernel I am using now is 4.19. I plan to use is 5.4. The BB-DT branch is v4.19.
Does the BB-DT branch need to match the kernel version?

Thank you,

As long as you make sure, to use the same kernel branch as the kernel you are booting. Just place the new *.dtb’s in:

/boot/dtbs/`uname -r`/ 

Regards,

The boneblack-common.dtsi uses AM33XX_IOPAD().
The osd335x-common.dtsi uses AM33XX_PADCONF().
Which should be used?

Thank you,

You are free to use either, on mainline we’ve been converting all am335x *.dts files to AM33XX_PADCONF()…

Regards,

I am changing AM33XX_IOPAD() to AM33XX_PADCONF(). Most are easy. However I don’t know how to handle the ‘SLEWCTRL_FAST’.
What is correct syntax to convert
AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)
into
AM33XX_PADCONG(AM335X_PIN_MDIO, PIN_INPUT_PULLUP, SLEWCTRL_FAST | MUX_MODE0)

Thank you,

You have it pretty close, just fix the spelling and move the | :wink:

AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)	/* mdio_data.mdio_data */

Regards,

I’m not sure how to describe this proble correctly but i will give it a try.
Here is a snippet during kernel boot of a good .dtb.
Starting kernel …

[ 0.000424] timer_probe: no matching timers found
[ 0.232477] omap_hwmod: emif: no dt node
[ 0.475595] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
[ 0.696767] CPUidle arm: CPU 0 failed to init idle CPU ops
[ 0.768612] omap_voltage_late_init: Voltage driver support not added
[ 9.110439] libphy: PHY 4a101000.mdio:00 not found
[ 9.151276] net eth0: phy “4a101000.mdio:00” not found on slave 0, err -19
[ 9.325908] libphy: PHY 4a101000.mdio:01 not found
[ 9.348300] net eth1: phy “4a101000.mdio:01” not found on slave 1, err -19
… (continues and starts Debian)

Here is snippet from .dtb I am building,
Starting kernel …

[ 0.000395] timer_probe: no matching timers found
[ 0.253453] l4_wkup_cm:clk:0010:0: failed to disable
[ 0.480284] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
[ 0.702537] CPUidle arm: CPU 0 failed to init idle CPU ops
[ 0.747520] omap_voltage_late_init: Voltage driver support not added
… (at this point I think it should report something about MDIO but hangs)

I think it has something to do with a ‘clock’ but that is only a guess.

How to proceed to debug what is causing the hang up?

Thank you,

I’m sorry, there is not enough to go on. It could be a clock, pinmux, or just a device-tree issue.

Regards,

cmdline update…
I removed ‘quiet’ from cmdline=. The kernel is outputting much more to the console. I will study the output for clues.
Thank you,

cmdline update…
I removed ‘quiet’ from cmdline=. The kernel is outputting much more to the console. I will study the output for clues.
Thank you,

I am booting from SD card on the same board. The only difference between the good and bad bootlog is in the uEnv.txt. Good ‘dtb=am335x-zcpu.dtb’, Bad ‘dtb=zcpu.dtb’.
GOOD_bootlog.txt (58.3 KB)

Here is bad bootlog.
BAD_bootlog.txt (36.6 KB)

I think my problems start after log entry
[ 1.676077] omap_hsmmc 48060000.mmc: Got CD GPIO

This entry may be the key problem.
[ 1.764900] mmc0: error -22 whilst initialising SD card

What does the following mean and where are the setting that control this in the DT?
[ 1.839925] omap_hsmmc 48060000.mmc: Linked as a consumer to regulator.1
[ 1.873490] omap_hsmmc 481d8000.mmc: Linked as a consumer to regulator.1

Thank you,

I am making progress. I can now boot and login. I added this and other to the DT. Now the SD card and eMMC are available.
// copied from am335x-boneblack-common
&mmc1 {
vmmc-supply = <&vmmcsd_fixed>;
pinctrl-names = “default”;
pinctrl-0 = <&mmc1_pins>;
bus-width = <8>;
status = “okay”;
};

// copied from am335x-boneblack-common
&mmc2 {
vmmc-supply = <&vmmcsd_fixed>;
pinctrl-names = “default”;
pinctrl-0 = <&emmc_pins>;
bus-width = <8>;
status = “okay”;
};

Now my problem is the GPIO I use in my program are no longer working. Obviously there is still something missing in my DT.

Thank you for being here as a sounding board.