Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dtp does not include GPIO PIN names #5

Closed
Rastafabisch opened this issue Nov 15, 2023 · 4 comments
Closed

dtp does not include GPIO PIN names #5

Rastafabisch opened this issue Nov 15, 2023 · 4 comments

Comments

@Rastafabisch
Copy link

Rastafabisch commented Nov 15, 2023

I just flashed the rock-5b_bookworm-v12-6.6.img.xz image.

Now I got a slight problem: I can't sanely control my GPIO pins anymore. I used to do this via (lib)gpiod and the gpioset $(gpiofind PIN_XY)=A command.
That worked just fine on Radxa's latest Debian release.
However it does not wo here, because apparently the PIN names are not defined in the DeviceTree.

@Rastafabisch
Copy link
Author

Rastafabisch commented Nov 18, 2023

Well, I fixed it myself. I tried using a .dtbo file and adding fdtoverlay /boot/overlay/GPIO-line-names.dbto but couldn't get this to work. (The Rock would just fail to boot.) I ended up uncomplying the default .dtb file and recompile it with GPIO descriptions.
In case someone would like to have it: GPIO-line-names.zip (They have been updated to the ones from the 6.7 rc1 kernel.)

That said a follow up to my question would be how to load .dtbo files - especially ones describing GPIO addresses, as those won't even compile from .dts to .dbto.

@inindev
Copy link
Owner

inindev commented Nov 19, 2023

I am not actively developing code for the rock-5b and am pretty much tracking Sebastian Reichel's patches from here: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-misc.git/log/?h=rk3588

I will state this more clearly on the project page as the goal here is to track mainline Linux development for the rock-5b. Thank you for the report though, and I will keep this open for others to find until this gets added to the mainline device tree.

@Rastafabisch

This comment was marked as resolved.

@Rastafabisch
Copy link
Author

Rastafabisch commented Nov 20, 2023

I managed to come up with a .dts file which does apply and injects the GPIO PIN names.

rk3588-rock-5b-gpio-line-names.dts
/dts-v1/;
/plugin/;

/ {
	compatible = "radxa,rock-5b", "rockchip,rk3588";
};

&{/} {
	pinctrl {
gpio@fd8a0000 {
	gpio-line-names =
		/* GPIO0_A0-A3 */
		"", "", "", "",
		/* GPIO0_A4-A7 */
		"", "", "", "",

		/* GPIO0_B0-B3 */
		"", "", "", "",
		/* GPIO0_B4-B7 */
		"", "PIN_8", "PIN_10", "",

		/* GPIO0_C0-C3 */
		"", "", "", "",
		/* GPIO0_C4-C7 */
		"", "", "", "",

		/* GPIO0_D0-D3 */
		"", "", "", "",
		/* GPIO0_D4-D7 */
		"", "", "", "";
};

gpio@fec20000 {
	gpio-line-names =
		/* GPIO1_A0-A3 */
		"", "", "", "",
		/* GPIO1_A4-A7 */
		"", "", "", "",

		/* GPIO1_B0-B3 */
		"", "PIN_21", "PIN_19", "PIN_23",
		/* GPIO1_B4-B7 */
		"PIN_24", "PIN_26", "", "PIN_31",

		/* GPIO1_C0-C3 */
		"", "", "", "",
		/* GPIO1_C4-C7 */
		"", "", "", "",

		/* GPIO1_D0-D3 */
		"", "", "", "",
		/* GPIO1_D4-D7 */
		"", "", "", "PIN_29";
};

gpio@fec30000 {
	gpio-line-names =
		/* GPIO2_A0-A3 */
		"", "", "", "",
		/* GPIO2_A4-A7 */
		"", "", "", "",

		/* GPIO2_B0-B3 */
		"", "", "", "",
		/* GPIO2_B4-B7 */
		"", "", "", "",

		/* GPIO2_C0-C3 */
		"", "", "", "",
		/* GPIO2_C4-C7 */
		"", "", "", "",

		/* GPIO2_D0-D3 */
		"", "", "", "",
		/* GPIO2_D4-D7 */
		"", "", "", "";
};

gpio@fec40000 {
	gpio-line-names =
		/* GPIO3_A0-A3 */
		"", "", "", "",
		/* GPIO3_A4-A7 */
		"PIN_16", "", "", "PIN_33",

		/* GPIO3_B0-B3 */
		"", "PIN_36", "PIN_38", "PIN_40",
		/* GPIO3_B4-B7 */
		"", "PIN_12", "PIN_35", "PIN_13",

		/* GPIO3_C0-C3 */
		"PIN_15", "PIN_11", "PIN_32", "PIN_7",
		/* GPIO3_C4-C7 */
		"", "", "", "",

		/* GPIO3_D0-D3 */
		"", "", "", "",
		/* GPIO3_D4-D7 */
		"", "", "", "";
};

gpio@fec50000 {

	gpio-line-names =
		/* GPIO4_A0-A3 */
		"", "", "", "",
		/* GPIO4_A4-A7 */
		"", "", "", "",

		/* GPIO4_B0-B3 */
		"", "", "PIN_5", "PIN_3",
		/* GPIO4_B4-B7 */
		"", "", "", "",

		/* GPIO4_C0-C3 */
		"", "", "", "",
		/* GPIO4_C4-C7 */
		"PIN_18", "PIN_28", "PIN_27", "",

		/* GPIO4_D0-D3 */
		"", "", "", "",
		/* GPIO4_D4-D7 */
		"", "", "", "";
		};
	};
};

This just needs to be compiled using dtc, and than referenced under fdt in the /boot/extlinux/extlinux.conf configuration file like fdtoverlays /boot/overlays/rk3588-rock-5b-gpio-line-names.dtbo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants