ophub / amlogic-s9xxx-armbian

Support for Armbian in Amlogic, Rockchip and Allwinner boxes. Support a311d, s922x, s905x3, s905x2, s912, s905d, s905x, s905w, s905, s905l, rk3588, rk3568, rk3399, rk3328, h6, etc.
GNU General Public License v2.0
6.27k stars 2.02k forks source link

Working dtb for X96 Max Plus Q2 and X96 Air Q1000 #366

Closed danboid closed 2 years ago

danboid commented 2 years ago

Using the attached .dtb file I get working ethernet, wifi and bluetooth on both my X96 Max Plus Q2 and my X96 Air Q1000, which both use the Qualcomm qca9377 wifi chipset or a clone of it. I extracted this dtb from the Manjaro linux-odroid kernel then tweaked it to get bluetooth working.

meson-g12a-x96-max-plus-q2.dtb.zip

danboid commented 2 years ago

meson-g12a-x96-max-rmii.dtb gives me working wifi but no ethernet on these boxes whilst the meson-g12a-x96-max.dtb in Armbian doesn't boot at all on the X96 Max Plus Q2 / X96 Air Q1000.

It seems the X96 Air Q1000 is pretty much the same as a X96 Max Plus Q2 but with an extra USB 2.0 port.

danboid commented 2 years ago

What's interesting is that after I got bluetooth working with this dtb under Armbian, I tried the same dtb under Manjaro but X96 onboard bluetooth isn't working under Manjaro.

danboid commented 2 years ago

I've also uploaded this dtb to https://github.com/danboid/meson-sm1-sei610-qca9377-bt

ophub commented 2 years ago

thank you for your sharing.

This dts file, can you find out the difference between it and the current meson-g12a-x96-max-plus.dts? This creates a separate dtb alone. This decompilation is not conducive to maintenance, and cannot take into account the continuous upgrade of the kernel. The source code for this dtb should be in the Manjaro source/patch.

danboid commented 2 years ago

Here is the original meson-g12a-x96-max.dtb from the Manjaro linux-odroid kernel. This doesn't have working bluetooth,

The meson-g12a-x96-max.dtb included with Armbian doesn't boot at all on my X96 boxes. Also worth noting is that linux-odroid doesn't include a meson-sm1-x96-max-plus.dtb which was the Armbian dtb that worked the best with these two TVBs.

I realise X96 Max is a different model and supposedly uses a different SoC to X96 Max Plus but the meson-g12a-x96-max.dtb from Manjaro is the dtb that currently works the best for these boxes.

meson-g12a-x96-max.dtb.zip

danboid commented 2 years ago

I have done a diff between meson-g12a-x96-max.dts from Manjaro and the meson-g12a-x96-max.dts from Armbian and they don't have much in common

X96-Max-dts-files.zip

danboid commented 2 years ago

Interesting!

I re-installed Armbian using the latest image ( Armbian_22.08.0_Aml_s905x3_jammy_5.10.120_server_2022.06.06.img ) and now wifi is working on my X96 boxes when using meson-sm1-x96-max-plus.dtb! This wasn't the case a few days ago so something has changed.

However, I've not been able to get bluetooth working by modifying meson-sm1-x96-max-plus.dtb yet.

ophub commented 2 years ago

But the kernel configuration has not changed at all

https://github.com/ophub/amlogic-s9xxx-armbian/commit/18f2e30b0f7a622e9fc7939d5356960f5c99935f

danboid commented 2 years ago

-

danboid commented 2 years ago

Are we not going to be able to include my custom dtb in Armbian then?

danboid commented 2 years ago

It seems meson-g12a-x96-max-plus-q2.dtb only fully works with your 5.15 kernels. Wifi and BT work on my X96 TVBs when I use it under 5.10.120 but ethernet does not. I have to use meson-g12a-x96-max-plus-q2.dtb with the Armbian 5.15 series kernels to get working ethernet, wifi and bluetooth.

danboid commented 2 years ago

I have updated the README of https://github.com/danboid/meson-sm1-sei610-qca9377-bt to include the kernel compatibility notes.

danboid commented 2 years ago

It seems meson-g12a-x96-max-plus-q2.dtb only fully works with your 5.15 kernels. Wifi and BT work on my X96 TVBs when I use it under 5.10.120 but ethernet does not. I have to use meson-g12a-x96-max-plus-q2.dtb with the Armbian 5.15 series kernels to get working ethernet, wifi and bluetooth.

ophub commented 2 years ago

This dtb file is the result of kernel compilation. Different versions of the kernel are different, so some cannot be used universally. This dtb file can be used in the /boot/dtb/amlogic directory, but This source code is decompiled code and cannot be well compatible with related patches and upgrades in the kernel. Need to find the difference between this and the existing file and add a compatibility source file.

ophub commented 2 years ago

meson-g12a-x96-max-plus-qca9377.dtb.zip

Unzip it, add it to the /boot/dtb/amlogic directory, modify the name of the dtb in /boot/uEnv.txt to meson-g12a-x96-max-plus-qca9377.dtb and restart the test.

tsgiannis commented 2 years ago

Side question...I am pretty sure I have the Q2 variant of X96 Max Plus...curious...did you managed to have it working via MicroSD or USB 3.0...because from all my tests with various distros they all failed with microSD...while USB 3.0 at least for CoreElec it worked.

danboid commented 2 years ago

@ophub

meson-g12a-x96-max-plus-qca9377.dtb doesn't boot using 5.15.45. Its worth noting that the normal meson-g12a-x96-max.dtb included with flippy 5.15.x also doesn't boot on the X96 Air Q1000 or X96 Air Q2 but the meson-g12a-x96-max.dtb from linux-odroid does. I used that one as the base because it was the easiest one to get BT working with. Well, its the only one I've fluked a working config with.

tsgiannis:

Have you tried my custom dtb ( meson-g12a-x96-max-plus-q2.dtb ) with a 5.15.x kernel? Note that 4K/UHD HDMI output is broken for the Max Plus Q2 with the current 5.15 kernels. You can use my dtb with a 5.10 kernel if you are using a 4K monitor but the ethernet doesn't work with 5.10.x and that dtb.

danboid commented 2 years ago

tsgiannis:

I have had Manjaro Linux booting off USB 3.0 on my X96 Air Q1000 so you should also be able to do that with Armbian on the X96 Max Plus Q2 although I've not tested that.

tsgiannis commented 2 years ago

I will try it 1st chance I get...right now I have the system running happily CoreElec but I am planning to buy one more TV Box

tsgiannis commented 2 years ago

So its USB 3.0...this was my main question...if I was the only one who could boot only from USB 3.0...thanks

danboid commented 2 years ago

I've been testing Armbian using microSD cards.

danboid commented 2 years ago

@ophub

I haven't found a dtb with both working ethernet and wifi for these X96's out of the ones included with it. I am able to boot and use wifi with meson-sm1-sei610.dtb and meson-g12a-sei510.dtb but the ethernet doesn't work with both when using a 5.15 kernel.

ophub commented 2 years ago

Can the wifi of meson-sm1-sei610.dtb be used? it is: https://github.com/unifreq/linux-5.15.y/blob/131c58e5e1ce69345cd844d1c2f6d18f1568e9d8/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts#L591

Which of the default dtb in the kernel package can use wired network?

danboid commented 2 years ago

I have now tested all of the meson-sm1 dtbs that come with 5.15.45 on my X96 Air Q1000 and the following all boot and have working ethernet and wifi:

meson-sm1-a95xf3-air-gbit.dtb meson-sm1-h96-max.dtb meson-sm1-ugoos-x3.dtb meson-sm1-x96-air-gbit.dtb

Its very likely the X96 Max+ Q2 will have the same compatibility.

Non of them currently have working onboard bluetooth but I'm going to see if I can add that to one of them.

danboid commented 2 years ago

Done it!

meson-sm1-h96-max-qca9377-bt.dtb.zip

This dtb gives me working bluetooth, ethernet and wifi on a X96 Air Q1000 with 5.15.45-flippy and its based off the meson-sm1-h96-max.dtb included with the current 5.15 kernel.

Instead of calling it meson-sm1-h96-max-qca9377-bt.dtb we might want to call it meson-sm1-x96-air-q1000.dtb or meson-sm1-x96-max-plus-q2.dtb?

ophub commented 2 years ago

Did you rename meson-sm1-h96-max.dtb to meson-sm1-x96-air-q1000.dtb? Did you modify the source code?

danboid commented 2 years ago

I decompiled meson-sm1-h96-max.dtb, changed 2 lines in the bluetooth section then recompiled it.and changed its name.

On Tue, Jun 7, 2022 at 11:08 PM ophub @.***> wrote:

Did you rename meson-sm1-h96-max.dtb to meson-sm1-x96-air-q1000.dtb? Did you modify the source code?

— Reply to this email directly, view it on GitHub https://github.com/ophub/amlogic-s9xxx-armbian/issues/366#issuecomment-1149221674, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK5CFYHINXBWAHE7FPPOIDVN7B4DANCNFSM5X5AN6TQ . You are receiving this because you authored the thread.Message ID: @.***>

danboid commented 2 years ago
$ diff -u meson-sm1-h96-max.dts meson-sm1-h96-max-qca9377-bt.dts
--- meson-sm1-h96-max.dts   2022-06-07 21:25:42.738173128 +0100
+++ meson-sm1-h96-max-qca9377-bt.dts    2022-06-07 21:28:43.254229509 +0100
@@ -2894,8 +2894,8 @@
                phandle = <0x121>;

                bluetooth {
-                   compatible = "brcm,bcm43438-bt";
-                   shutdown-gpios = <0x1d 0x52 0x00>;
+                   compatible = "qcom,qca9377-bt";
+                   enable-gpios = <0x1d 0x52 0x00>;
                    max-speed = <0x1e8480>;
                    clocks = <0x31>;
                    clock-names = "lpo";
ophub commented 2 years ago

Your change was tested on both X96 Air Q1000 and X96 Max+ Q2 Can it work with wired, wireless, bluetooth? Are these two devices gigabit wired network cards?

ophub commented 2 years ago

https://github.com/unifreq/linux-5.15.y/blob/main/arch/arm64/boot/dts/amlogic/meson-sm1-h96-max.dts#L139-L140

This is the standard source code, use this modification. Explain which lines have been changed. After modifying this file, send me the dts file. I will compile it in the kernel and you will test it again.

danboid commented 2 years ago

Yes x3! It enables all 3 features w/ gigabit ethernet for both models.

danboid commented 2 years ago

meson-sm1-h96-max.dts.zip

ophub commented 2 years ago

Wait 5 minutes, I will compile it in the kernel according to your modification, you can test it again

ophub commented 2 years ago

meson-sm1-x96-max-plus-q2.dtb.zip

This is the dtb running in the 5.15 kernel, you can test whether it is normal under both devices

Unzip it into a dtb file, put it in the /boot/dtb/amlogic directory, and modify the dtb file name in /boot/uEnv.txt. Restart the test after modification.

danboid commented 2 years ago

I have tested your meson-sm1-x96-max-plus-q2.dtb and it works fine - wifi, gbit ethernet and BT all work.

ophub commented 2 years ago

Ok, I submitted it to unifreq today in several kernel repositories, which will be automatically included when the kernel is compiled in the future. thank you very much for sharing

danboid commented 2 years ago

Thanks @ophub !

ophub commented 2 years ago

https://github.com/ophub/amlogic-s9xxx-armbian/commit/1920aa6a8b57f9cecd4d8e7121c4f722c6ef7df1

https://github.com/unifreq/linux-5.15.y/commit/5ed890ac09aaec7c0f2f2fc43a92212eaace41ac

Your results have been added to the kernel source repository, thank you for sharing

https://github.com/ophub/amlogic-s9xxx-armbian/blob/28dcc99c9472018aa5f4548cd5843821be82b584/build-armbian/common-files/rootfs/etc/amlogic_model_database.conf#L58

https://github.com/ophub/amlogic-s9xxx-armbian/blob/28dcc99c9472018aa5f4548cd5843821be82b584/build-armbian/common-files/rootfs/etc/amlogic_model_database.conf#L71

hillz2 commented 1 year ago

Done it!

meson-sm1-h96-max-qca9377-bt.dtb.zip

This dtb gives me working bluetooth, ethernet and wifi on a X96 Air Q1000 with 5.15.45-flippy and its based off the meson-sm1-h96-max.dtb included with the current 5.15 kernel.

Instead of calling it meson-sm1-h96-max-qca9377-bt.dtb we might want to call it meson-sm1-x96-air-q1000.dtb or meson-sm1-x96-max-plus-q2.dtb?

I'll try this, sorry for bumping up an old thread, @danboid can I use meson-sm1-h96-max-qca9377-bt.dtb.zip for OpenWrt instead of armbian ? and do I have to use kernel 5.15.45-flippy to get it to work ? I have X96 Air with ophub openwrt and ethernet not working right now.

yaleh commented 1 year ago

I have tested your meson-sm1-x96-max-plus-q2.dtb and it works fine - wifi, gbit ethernet and BT all work.

Are the dd operations mentioned in https://www.5288z.com/2989.html still necessary?

dd if=/tmp/hk1box-bootloader.img of=/dev/mmcblk2 bs=1 count=442
dd if=/tmp/hk1box-bootloader.img of=/dev/mmcblk2 bs=512 skip=1 seek=1
sync
reboot
citral23 commented 1 year ago

FYI, I received a scam X96 max+, sticker says 4G/64G but inside it's this model:

X96Max Plus 5 Memory 2/16, Amlogic W150S1 WiFi chip, one antenna, board without BT antenna track.

The X96 Air dtb works mostly fine apart from a minor graphical issue on boot that disappears once kernel properly kicks in, maybe related to panfrost ffe40000.gpu: dev_pm_opp_set_regulators: no regulator (mali) found: -19

Cf dmesg: https://pastebin.com/c2LZiRCR

As one can see, internal storage install went fine, and ETH works as well.

No wifi, but I don't think there's even a linux driver for the Amlogic W150S1 so this can't be solved I suppose.

Thanks for your work ophub

myallten commented 11 months ago

你好,这款X96 air 4+64的配置,WiFi是这个型号的,识别不出来 862fd4a3834ee1240ebc9c52ce660b4c

myallten commented 11 months ago

使用的是506安装 有线可以

myallten commented 11 months ago

506