Jump to content

Recommended Posts

Posted

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. 

Posted

If you are unsure you can create your PR anyways and let Allwinner maintainers have a look and point you in the correct direction if changes are necessary.

Posted
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?

Posted
29 minutes ago, sgjava said:

How would a do an overlay for just the NanoPi Duo?


GPIOs are shared but also used differently. It would be best to find some universal solution. Overlay is optional in any case so it's irrelevant on which board will be loaded ...  @5kft @martinayotte what do you think how to drive this thing?

Posted

@IgorI plan on doing other allwinner boards, so a universal solution would be nice. Having the GPIO line names are a big help when using the kernel userspace tools.

Posted
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" ...

Posted
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 ...

 

Posted
11 hours ago, sgjava said:

How would that work?

In this specific case, since it is for exynos5420 which doesn't have any overlay mecanism yet, I will leave your PR as is ...

Posted

@martinayotte yes, and in that case XU3 had same lines, but my question was how do I do this for Duo using overlay, but make it part of normal build process?

Posted

@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.

Posted
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.

Posted
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" ...

Posted

@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";

Posted

Ah wrong location. You need to put dtbo in /boot/dtb/overlay, not /boot/dts/overlay as you suggested above.

Posted

No worries, I still need to find a way to cover both pin controllers? It appears compatible strings are different.

Posted
1 hour ago, sgjava said:

find a way to cover both pin controllers

Do you mean PL ?

Simply add another "gpio-line-names" entry into "pinctrl@1f02c00" node.

Posted

Yes, I'm wondering is that another fragment section in one file or another file?

Posted
50 minutes ago, sgjava said:

Yes, I'm wondering is that another fragment section in one file or another file?

I would choose to simply add another fragment in the same overlay ...

Posted

@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.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines