Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Trying to add gpio-line-names to nanopi duo

Featured Replies

Maybe my grep-fu is not powerful or following endless includes, but I ended up changing build/cache/sources/linux-mainline/orange-pi-5.9/arch/arm/boot/dts/sunxi-h3-h5.dtsi which seems like it would change other boards. Is there a surefire way to make the changes in the proper place for the Duo?

 

I tested the image I built and indeed this changes the dtb correctly, but will it effect orange pi, etc boards too (h3-h5 boards)? @Igor I have the changes ready to commit, but I didn't want to do something that effects multiple boards. 

On 12/27/2020 at 6:46 PM, sgjava said:

I have the changes ready to commit, but I didn't want to do something that effects multiple boards. 

 

/arch/arm/boot/dts/sunxi-h3-h5.dtsi
This is common file for all H3 and H5 boards so it will surely affect all boards. If this is what we want, ok, otherwise rather not. Perhaps moving this to overlay?

53 minutes ago, sgjava said:

is this documented somewhere? I'll give that a try.

Do you mean how to write an overlay ?

 

Or do you mean how "gpio-line-names" is used ?

 

Here is a general example from https://elixir.bootlin.com/linux/v4.7/source/Documentation/devicetree/bindings/gpio/gpio.txt

 

gpio-controller@00000000 {
	compatible = "foo";
	reg = <0x00000000 0x1000>;
	gpio-controller;
	#gpio-cells = <2>;
	ngpios = <18>;
	gpio-line-names = "MMC-CD", "MMC-WP", "VDD eth", "RST eth", "LED R",
		"LED G", "LED B", "Col A", "Col B", "Col C", "Col D",
		"Row A", "Row B", "Row C", "Row D", "NMI button",
		"poweroff", "reset";
}

 

It is not exact syntax, since it is depending of SoC main DT, for example, on H3, the controller would be "pinctrl@1c20800" ...

1 hour ago, sgjava said:

I need to know how to do overlay.

 

Here is a quick/not-tested/incomplete overlay sources named gpio-line-names.dts :

 

/dts-v1/;
/plugin/;
/ {
	compatible = "allwinner,sun8i-h3";
	fragment@1 {
		target = <&pio>;
		__overlay__ {
			gpio-line-names = "", "", "", "", "TX", "RX", "", "", 
					"", "", "", "", "", "", "", "STATUS-LED", 
					"MUTE", "SPDIF-OUT", "", "", "", "", "", "", 
					"", "", "", "", "", "", "", "", 
					"", "", "", "", "", "", "", "", 
					"", "", "", "", "", "", "", ""; 
		};
	};
};

 

Then, compile it as DTB with this command :

dtc -O dtb -I dts -o gpio-line-names.dtbo gpio-line-names.dts

 

To try loading DTB dynamically into main tree without doing it in /boot/armbianEnv.txt, execute those commands :

 

mkdir /sys/kernel/config/device-tree/overlays/gpionames
cat gpio-line-names.dtbo > /sys/kernel/config/device-tree/overlays/gpionames/dtbo
cat /sys/kernel/config/device-tree/overlays/gpionames/status

 

The last command should provide "applied" status.

 

Then, you can test names with your own tool ...

 

  • Author

@martinayotteI finally got my VM cranking and build pulled down. Looking around based on what you said wouldn't something duo specific be better off in something like ./patch/kernel/sunxi-dev/board-h2plus-nanopi-duo-add-device.patch? I still need to look at Makefile, but this should only impact Duo.

16 hours ago, sgjava said:

but this should only impact Duo.

Although I've never tried, patches could be board specific using a subdirectory such as ./patch/kernel/sunxi-dev/nanopi-duo/board-h2plus-nanopi-duo-add-device.patch

 

BTW, I've tried dynamic loading of gpio-line-names.dtbo overlay, but it doesn't work, but doing it in /boot/armbianEnv.txt works.

I think it is due that gpio-lines-names property is only checked while initializing pinctrl at boot time.

3 hours ago, sgjava said:

do you have an example for /boot/armbianEnv.txt gpio-line-names?

I've manually copied my gpio-line-names.dtbo under /boot/dts/overlay/sun8i-h3-gpio-line-names.dtbo

Then, I added "overlays=gpio-line-names" in /boot/armbianEnv.txt, and rebooted ...

3 hours ago, sgjava said:

This is generated board specific, correct?

Yes, my test was for OrangePiPC+, and tested using libgpiod "gpioinfo" ...

  • Author

@martinayotte OK, tried this and no luck on duo:

ls /boot/dts/overlay/
sun8i-h3-gpio-line-names.dtbo

cat /boot/armbianEnv.txt 
verbosity=1
bootlogo=false
console=serial
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
overlays=usbhost2 usbhost3
rootdev=UUID=d1e6e420-cd58-46c8-aa52-0f8cd59dabb7
rootfstype=ext4
overlays=gpio-line-names
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

cat sun8i-h3-gpio-line-names.dts 
/dts-v1/;
/plugin/;
/ {
	compatible = "allwinner,sun8i-h3";
	fragment@1 {
		target = <&pio>;
		__overlay__ {
			gpio-line-names = "", "", "", "", "GPIOA4 DTX", "GPIOA5 DRX", "", "", "", "",
			"", "GPIOA11 SCL", "GPIOA12 SDA", "GPIOA13 CS", "GPIOA14 CLK", "GPIOA15 MO", "GPIOA16 MI", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "GPIOG6 TX1", "GPIOG7 RX1",
			"", "", "", "GPIOG11 IOG11";
		};
	};
};

 

I suspect it has something to do with multiple pin controllers? pinctrl@1c20800 and pinctrl@1f02c00? Also noticed Duo has compatible = "allwinner,sun8i-h3-r-pinctrl";

  • Author

@martinayotteOK, I figured out the syntax for each pinctrl using phandle to identify. So next question is how do I make this part of build process, so it gets applied automatically in img?

 

Duo:

/dts-v1/;
/plugin/;
/ {
	compatible = "allwinner,sun8i-h3-pinctrl";
	fragment@0 {
		target = <0x0b>;
		__overlay__ {
			gpio-line-names = "", "", "", "", "GPIOA4 DTX", "GPIOA5 DRX", "", "", "", "",
			"", "GPIOA11 SCL", "GPIOA12 SDA", "GPIOA13 CS", "GPIOA14 CLK", "GPIOA15 MO", "GPIOA16 MI", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "", "",
			"", "", "", "", "", "", "", "", "GPIOG6 TX1", "GPIOG7 RX1",
			"", "", "", "GPIOG11 IOG11";
		};
	};

        fragment@1 {
                target = <0x3b>;
                __overlay__ {
			gpio-line-names = "", "", "", "BUTTON", "", "", "", "", "", "", "", "GPIOL11 IRRX";
                };
        };
};

 

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.