build icon indicating copy to clipboard operation
build copied to clipboard

sunxi-6.10: Add armbian patches

Open The-going opened this issue 1 year ago • 13 comments

Description

  • Add armbian patches from sunxi-6.7
  • Adapt the patch series to the new v6.10.5 kernel version
  • Delete unused patches and add newly extracted patches.

How Has This Been Tested?

  • [x] Build for arm64 & test work on board
 ____  ____  _   __  __  __   _  _   
| __ )|  _ \(_) |  \/  |/ /_ | || |  
|  _ \| |_) | | | |\/| | '_ \| || |_ 
| |_) |  __/| | | |  | | (_) |__   _|
|____/|_|   |_| |_|  |_|\___/   |_|  
                                     
Welcome to Armbian_community 24.8.0-trunk Bookworm with bleeding edge Linux 6.10.5-edge-sunxi64

No end-user support: built from trunk

System load:   2%               Up time:       11 min
Memory usage:  6% of 1.94G      IP:            192.168.100.101
CPU temp:      26°C             Usage of /:    18% of 7.2G

Time        CPU    load %cpu %sys %usr %nice %io %irq   Tcpu  C.St.

15:14:27  1008 MHz  0.00   5%   0%   0%   0%   3%   0%  23,3 °C  0/7
15:14:33  1008 MHz  0.00   3%   2%   0%   0%   0%   0%  22,8 °C  0/7
15:14:38  1008 MHz  0.00   2%   2%   0%   0%   0%   0%  22,2 °C  0/7

The-going avatar Aug 23 '24 10:08 The-going

Proposing to remove the bigtreetech cb1 related patches that use the old pre-mainline device trees, for 6.10 the bigtreetech-pi device tree will be used with different patches.

JohnTheCoolingFan avatar Aug 23 '24 10:08 JohnTheCoolingFan

Proposing to remove the bigtreetech cb1 related patches that use the old pre-mainline device trees, for 6.10 the bigtreetech-pi device tree will be used with different patches.

I only have bananpi-m64 available. I thoughtlessly adapted all the other patches to the new version and did not test them. It is assumed that someone else will change this.

The-going avatar Aug 23 '24 10:08 The-going

That's fine, I'll touch this up in a later PR

JohnTheCoolingFan avatar Aug 23 '24 11:08 JohnTheCoolingFan

At this stage, the compilation is error-free for arm64, but with a lot of warnings for wifi drivers.

I'm done with this.

The-going avatar Aug 23 '24 18:08 The-going

building package linux-image-edge-sunxi without errors.

The-going avatar Aug 25 '24 20:08 The-going

@JohnTheCoolingFan You can just continue. I can give you access to my repository.

The-going avatar Aug 26 '24 12:08 The-going

Getting an error trying to do kernel-dtb for bigtreetech-cb1 or bananapim4zero edge, on commit c54ab52ac077aa35fa4c978d2132c4ac47b177b7:

arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi:708.21-723.5: ERROR (phandle_references): /soc/spi@5011000: Reference to non-existent node or label "spi1_cs1_pin"

  also defined at arch/arm64/boot/dts/allwinner/sun50i-h618-bananapi-m4-zero.dts:235.7-248.3

JohnTheCoolingFan avatar Aug 26 '24 13:08 JohnTheCoolingFan

Getting an error trying to do kernel-dtb for bigtreetech-cb1 or bananapim4zero edge

It looks like I haven't made a commit with the bugs fixed. This is my inattention.

The-going avatar Aug 26 '24 19:08 The-going

Simply changed some file names so that the cb1 dtsi enhancements would be applied and other dts files won't be created, trying to use the bigtreetech-pi dts. No Ethernet and no HDMI output, though... Not sure why.

JohnTheCoolingFan avatar Aug 27 '24 11:08 JohnTheCoolingFan

No Ethernet and no HDMI output, though... Not sure why.

What does dmesg report? UART console.

The-going avatar Aug 27 '24 13:08 The-going

What does dmesg report? UART console.

Well, there's no eth0 interface and the only snippet I could find about hdmi is this:

[    0.033135] platform 3001000.clock: Fixed dependency cycle(s) with /soc/rtc@7000000
[    0.036404] platform 6000000.hdmi: Fixed dependency cycle(s) with /soc/tcon-top@6510000
[    0.036813] platform 6000000.hdmi: Fixed dependency cycle(s) with /soc/tcon-top@6510000
[    0.036922] platform 6510000.tcon-top: Fixed dependency cycle(s) with /soc/hdmi@6000000
[    0.036979] platform 6510000.tcon-top: Fixed dependency cycle(s) with /soc/lcd-controller@6515000
[    0.036996] platform 6510000.tcon-top: Fixed dependency cycle(s) with /soc/bus@1000000/mixer@100000
[    0.037163] platform 6510000.tcon-top: Fixed dependency cycle(s) with /soc/lcd-controller@6515000
[    0.037232] platform 6515000.lcd-controller: Fixed dependency cycle(s) with /soc/tcon-top@6510000
[    0.037477] platform 7000000.rtc: Fixed dependency cycle(s) with /soc/clock@7010000
[    0.037582] platform 7000000.rtc: Fixed dependency cycle(s) with /soc/clock@7010000
[    0.037679] platform 7010000.clock: Fixed dependency cycle(s) with /soc/rtc@7000000
[    0.038781] platform 6000000.hdmi: Fixed dependency cycle(s) with /connector
[    0.038861] platform connector: Fixed dependency cycle(s) with /soc/hdmi@6000000

I suspect that there might be something about the device tree not loading properly, but the patches to explicitly enable hdmi and ethernet are applied with no errors, perhaps I overlooked something? A warning during compile, or changes in drivers from 6.6... Will have to do quite a bit of investigation on that one. At least the board boots properly, wifi works fine at least.

JohnTheCoolingFan avatar Aug 27 '24 13:08 JohnTheCoolingFan

I suspect that there might be something about the device tree not loading properly, but the patches to explicitly enable hdmi and ethernet are applied with no errors, perhaps I overlooked something? A warning during compile, or changes in drivers from 6.6...

After I adapted the patches and began to build, the compiler reported an error of duplicate nodes in the DTS many times. I had to remove some of them. I could have confused something. If you have a working image (with a different core), will you be able to compare the HDMI nodes in the DTS. Not the files, but the ones that were applied on a working device? Using the command:

dtc --sort -I fs -O dts  /sys/firmware/devicetree/base > dts-out.txt

Maybe this will give you a clue.

As for Ethernet eth0. I realized that the problem is with the pwm driver. @chraac has kindly agreed to add a pwm driver to this pull request. He seems to have a working option here #7139. Let's wait a bit.

The-going avatar Aug 27 '24 19:08 The-going

Well, here's the output file from that command: dts-out.txt

As for ethernet, yes, it is dependent on sunxi pwm, but also from what I remember u-boot also plays a role in initializing the ethernet PHY.

JohnTheCoolingFan avatar Aug 28 '24 13:08 JohnTheCoolingFan

Hi @The-going , regarding the sunxi's pwm driver and gmac driver, created a PR at you fork, please have a look: https://github.com/The-going/armbian-build/pull/25

chraac avatar Aug 29 '24 14:08 chraac

Well, here's the output file from that command: dts-out.txt

To be honest, this information doesn't tell me anything. I don't have another such file extracted from a well-functioning device.

I canceled your changes. As far as I understand, the sun50i-h616-bigtreetech-cb1-emc.dts and the sun50i-h616-bigtreetech-cb1-sd.dts are different devices. If someone added them, does it mean that someone needs them?

The-going avatar Aug 31 '24 13:08 The-going

As far as I understand, the sun50i-h616-bigtreetech-cb1-emc.dts and the sun50i-h616-bigtreetech-cb1-sd.dts are different devices. If someone added them, does it mean that someone needs them?

These files are added by BigTreeTech. These are two revisions of the CB1 module: with eMMC and without, the latter needing an sd card to boot.

But 6.10 mainline has a bigtreetech-pi device tree, which can be used for BigTreeTech Pi or CB1 module in a PI4B adapter, and there is another device tree for a CB1 installed into a Manta carrier board, which simply integrates a 3d printer main board and a compute module slot for CB1/CB2.

Armbian has just one board representing that: bigtreetech-cb1. And so I assumed the safest case of a BigTreeTech Pi or CB1+PI4B. The only device tree used by armbian before bigtreetech-pi was added to mainline is the sd variant. I think it might be possible to support an emmc CB1 version using a device tree overlay. As for Manta case, it seems we are going to just ignore it and shove it under the same board config: bigtreetech-cb1.

CB2/Pi2 has a similar problem in my eyes, but it's out of scope for discussion in this PR as it's a rockchip-based board.

JohnTheCoolingFan avatar Aug 31 '24 13:08 JohnTheCoolingFan

These files are added by BigTreeTech.

Thanks for the detailed explanations.

I'm wondering on which device did you check the performance of HDMI? model = "BigTreeTech Pi"?

The-going avatar Aug 31 '24 19:08 The-going

I've checked on a BigTreeTech Pi v1.2, that's the only version of the "first gen" I have.

JohnTheCoolingFan avatar Sep 01 '24 05:09 JohnTheCoolingFan

I've checked on a BigTreeTech Pi v1.2, that's the only version of the "first gen" I have.

Very good. Can you check the performance of sunxi-6.6, sunxi-6.7 for this device?

The-going avatar Sep 01 '24 08:09 The-going

Can you check the performance of sunxi-6.6, sunxi-6.7 for this device?

I've been getting the device to work with these mainline versions with patches in #6656 What do you mean by "check the performance"? The board worked well on 6.6 and 6.7, but there are problems on 6.10.

JohnTheCoolingFan avatar Sep 01 '24 09:09 JohnTheCoolingFan

The test is at this stage:

 ____  ____  _   __  __ _____ 
| __ )|  _ \(_) |  \/  |___ / 
|  _ \| |_) | | | |\/| | |_ \ 
| |_) |  __/| | | |  | |___) |
|____/|_|   |_| |_|  |_|____/ 
                              
Welcome to Armbian_community 24.8.0-trunk Bookworm with bleeding edge Linux 6.10.5-edge-sunxi

No end-user support: built from trunk

System load:   18%              Up time:       0 min
Memory usage:  8% of 1.96G      IP:            192.168.100.101
CPU temp:      34°C             Usage of /:    17% of 7.2G
 ____  ____  _   __  __  __   _  _   
| __ )|  _ \(_) |  \/  |/ /_ | || |  
|  _ \| |_) | | | |\/| | '_ \| || |_ 
| |_) |  __/| | | |  | | (_) |__   _|
|____/|_|   |_| |_|  |_|\___/   |_|  
                                     
Welcome to Armbian_community 24.8.0-trunk Bookworm with bleeding edge Linux 6.10.5-edge-sunxi64

No end-user support: built from trunk

System load:   86%              Up time:       1 min
Memory usage:  6% of 1.94G      IP:            192.168.100.102
CPU temp:      28°C             Usage of /:    22% of 7.2G

The-going avatar Sep 01 '24 09:09 The-going

What do you mean by "check the performance"?

This is an inaccurate translation. But you answered my question:

The board worked well on 6.6 and 6.7,

Can you check how it works now? After the @chraac has added its changes.

The-going avatar Sep 01 '24 10:09 The-going

Well, on this branch, 6.6 works fine, and 6.10 works if the FDTFILE is changed to be the same as in 6.6 (I have added a hook that changed it to bigtreetech-pi in #6656 ). Ethernet works, but HDMI doesn't. Should I commit the hook removal to this branch? It was previously done because there wasn't a usual bigtreetech-cb1 device tree before patches in this PR were added.

JohnTheCoolingFan avatar Sep 01 '24 15:09 JohnTheCoolingFan

Well, on this branch, 6.6 works fine, and 6.10 works if the FDTFILE is changed to be the same as in 6.6 (I have added a hook that changed it to bigtreetech-pi in #6656 ). Ethernet works, but HDMI doesn't. Should I commit the hook removal to this branch? It was previously done because there wasn't a usual bigtreetech-cb1 device tree before patches in this PR were added.

I didn't understand what it was about. What kind of hook are we talking about? The commit number? 816101bc777?

The-going avatar Sep 01 '24 15:09 The-going

Yes, that one.

JohnTheCoolingFan avatar Sep 01 '24 15:09 JohnTheCoolingFan

Yes, that one.

What does this code do? It's not clear to me. I really don't understand what this code does.

It is a very bad practice to use any hooks for patches. Instead, it would be preferable to make a new DTS file.

It is also a very bad practice to make symbolic links in a folder for one kernel version to existing patch files in a folder for another kernel version. Patches for a single version live their own lives. They may change and then your links will stop working or your patches will not be able to be applied cleanly.

The-going avatar Sep 01 '24 16:09 The-going

Should I commit the hook removal to this branch?

Please do this in a separate pull request. And replace symbolic links with real patch files.

The-going avatar Sep 01 '24 16:09 The-going

What does this code do?

Change BOOT_FDT_FILE to a different one because the original plan was to go along with the mainline dts and adapt patches to build on top of it. Otherwise there would be a bunch of dts files (two from a patch, one in mainline) and only one of them used for the board. others being just a leftover junk.

Please do this in a separate pull request. And replace symbolic links with real patch files.

Will do. A PR to main armbian repo or to the branch of this PR? Just to clarify

JohnTheCoolingFan avatar Sep 01 '24 17:09 JohnTheCoolingFan

PR to main armbian repo

And please mark it as a bugfix

The-going avatar Sep 01 '24 17:09 The-going

BigTreeTech CB1 working on this branch rebased on current main (https://github.com/JohnTheCoolingFan/armbian-build/tree/main-sunxi-6.10-btt-cb1-hdmi), Ethernet works, HDMI doesn't, I don't know the reason, but it's ok for this PR and I will address that in a future PR after this gets merged. As for which device trees to use, also matter of discussion for next PRs.

JohnTheCoolingFan avatar Sep 04 '24 21:09 JohnTheCoolingFan