sgjava Posted December 27, 2020 Share Posted December 27, 2020 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. 0 Quote Link to comment Share on other sites More sharing options...
Werner Posted December 27, 2020 Share Posted December 27, 2020 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. 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted December 27, 2020 Author Share Posted December 27, 2020 @Werner done https://github.com/armbian/build/pull/2505 0 Quote Link to comment Share on other sites More sharing options...
Igor Posted December 28, 2020 Share Posted December 28, 2020 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? 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted December 28, 2020 Author Share Posted December 28, 2020 @IgorYep, go ahead and reject that PR. How would a do an overlay for just the NanoPi Duo? 0 Quote Link to comment Share on other sites More sharing options...
Igor Posted December 29, 2020 Share Posted December 29, 2020 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? 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted December 29, 2020 Author Share Posted December 29, 2020 @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. 0 Quote Link to comment Share on other sites More sharing options...
martinayotte Posted December 29, 2020 Share Posted December 29, 2020 14 hours ago, Igor said: what do you think how to drive this thing? I don't see much other ways than doing it using overlays ... 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted December 29, 2020 Author Share Posted December 29, 2020 @martinayotteis this documented somewhere? I'll give that a try. 0 Quote Link to comment Share on other sites More sharing options...
martinayotte Posted December 29, 2020 Share Posted December 29, 2020 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" ... 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted December 29, 2020 Author Share Posted December 29, 2020 @martinayotte I need to know how to do overlay. I already know how to do gpio-line-names already, thanks. 0 Quote Link to comment Share on other sites More sharing options...
martinayotte Posted December 29, 2020 Share Posted December 29, 2020 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 ... 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted December 30, 2020 Author Share Posted December 30, 2020 @martinayotte so I'm trying to make this part of the build like https://github.com/armbian/build/pull/2449 so it's part of the image. How would that work? 0 Quote Link to comment Share on other sites More sharing options...
martinayotte Posted December 30, 2020 Share Posted December 30, 2020 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 ... 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted December 30, 2020 Author Share Posted December 30, 2020 @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? 0 Quote Link to comment Share on other sites More sharing options...
martinayotte Posted December 30, 2020 Share Posted December 30, 2020 4 minutes ago, sgjava said: but my question was how do I do this for Duo using overlay For Allwinners SoC, you simply add new overlay to existing patch located there : https://github.com/armbian/build/blob/master/patch/kernel/sunxi-dev/general-sunxi-overlays.patch You need to add DTS, but also add entry into the Makefile. 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted December 30, 2020 Author Share Posted December 30, 2020 OK, let me try that. Working on a new build VM today. 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted December 31, 2020 Author Share Posted December 31, 2020 @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. 0 Quote Link to comment Share on other sites More sharing options...
martinayotte Posted December 31, 2020 Share Posted December 31, 2020 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. 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted December 31, 2020 Author Share Posted December 31, 2020 @martinayotte do you have an example for /boot/armbianEnv.txt gpio-line-names? This is generated board specific, correct? How would I do it that way for Duo? I'll try my grep-fu and google-fu in the meantime. I assume you are talking about loading the overlay from armbianEnv.txt i.e. https://docs.armbian.com/User-Guide_Allwinner_overlays 0 Quote Link to comment Share on other sites More sharing options...
martinayotte Posted December 31, 2020 Share Posted December 31, 2020 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" ... 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted January 1, 2021 Author Share Posted January 1, 2021 @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"; 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted January 2, 2021 Author Share Posted January 2, 2021 Ah wrong location. You need to put dtbo in /boot/dtb/overlay, not /boot/dts/overlay as you suggested above. 0 Quote Link to comment Share on other sites More sharing options...
martinayotte Posted January 2, 2021 Share Posted January 2, 2021 13 hours ago, sgjava said: not /boot/dts/overlay as you suggested above. Sorry for the typo ... 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted January 2, 2021 Author Share Posted January 2, 2021 No worries, I still need to find a way to cover both pin controllers? It appears compatible strings are different. 0 Quote Link to comment Share on other sites More sharing options...
martinayotte Posted January 2, 2021 Share Posted January 2, 2021 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. 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted January 2, 2021 Author Share Posted January 2, 2021 Yes, I'm wondering is that another fragment section in one file or another file? 0 Quote Link to comment Share on other sites More sharing options...
martinayotte Posted January 2, 2021 Share Posted January 2, 2021 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 ... 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted January 2, 2021 Author Share Posted January 2, 2021 How does it know which pinctrl to place the line names? 0 Quote Link to comment Share on other sites More sharing options...
sgjava Posted January 2, 2021 Author Share Posted January 2, 2021 @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"; }; }; }; 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.