Jump to content

X88 King S922X TV Box for Armbian


amirul

Recommended Posts

With dtc tool you can also get the dts (text) from the dtb (binary)

$ dtc -I dtb -O dts meson-g12b-ugoos-am6.dtb > meson-g12b-ugoos-am6.dts

And you get the device tree in a text file, see attachment.

I guess you need to get data from the X88 android dts files I uploaded in the last post and create a linux dts like the one in this attachment. I guess it won't be easy.

 

And then you can compile the dtb binary and try it

$ dtc -O dtb -o meson-g12b-X88king.dtb meson-g12b-X88king.dts
 

 

meson-g12b-ugoos-am6.dts

Link to comment
Share on other sites

I think the dts extracted from the X88 King image is linked to the android kernel, so when you create the meson-g12b-X88king.dts file it has to be linked to the armbian kernel, I guess only kernel developers know how to do that.

Link to comment
Share on other sites

I have gone dtb -> dts -> changed a few things -> dtb with some success, cpuspeed for eg, but in this case the usb subsystem doesn't fire up at all.

With meson-g12b-ugoos-am6.dtb I can get to the desktop, but without usb no keyboard and mouse. 1'll try looking for clues in the extracted dtb/dts.

There is reference to g12b_w400_a in the dtb, for odroid N2 perhaps?

Link to comment
Share on other sites

18 hours ago, amirul said:

 

Having a look at the X88 dts files extracted from the android image, I think you need to add some new amlogic USB modules in the armbian kernel: amlogic-new-usb2-v2 and amlogic-new-usb3-v2

Link to comment
Share on other sites

55 minutes ago, ramoncio said:

Having a look at the X88 dts files extracted from the android image, I think you need to add some new amlogic USB modules in the armbian kernel: amlogic-new-usb2-v2 and amlogic-new-usb3-v2

Thanks for the suggestion but that might just be beyond my capabilities :)

Link to comment
Share on other sites

As far as I can tell from the android dts, these are the bits that look like they have reference to usb

	dwc3@ff500000 {
		compatible = "synopsys, dwc3";
		status = "okay";
		reg = <0xff500000 0x100000>;
		interrupts = <0x0 0x1e 0x4>;
		usb-phy = <0x2a 0x2b>;
		cpu-type = "gxl";
		clock-src = "usb3.0";
		clocks = <0x13 0x41>;
		clock-names = "dwc_general";
		phandle = <0xdd>;
	};

	usb2phy@ffe09000 {
		compatible = "amlogic, amlogic-new-usb2-v2";
		status = "okay";
		reg = <0xffe09000 0x80 0xffd01008 0x100 0xff636000 0x2000 0xff63a000 0x2000>;
		pll-setting-1 = <0x9400414>;
		pll-setting-2 = <0x927e0000>;
		pll-setting-3 = <0xac5f69e5>;
		pll-setting-4 = <0xfe18>;
		pll-setting-5 = <0x8000fff>;
		pll-setting-6 = <0x78000>;
		pll-setting-7 = <0xe0004>;
		pll-setting-8 = <0xe000c>;
		portnum = <0x2>;
		phandle = <0x2a>;
	};

	usb3phy@ffe09080 {
		compatible = "amlogic, amlogic-new-usb3-v2";
		status = "okay";
		reg = <0xffe09080 0x20>;
		phy-reg = <0xff646000>;
		phy-reg-size = <0x2000>;
		usb2-phy-reg = <0xffe09000>;
		usb2-phy-reg-size = <0x80>;
		interrupts = <0x0 0x10 0x4>;
		clocks = <0x13 0x18>;
		clock-names = "pcie_refpll";
		portnum = <0x0>;
		otg = <0x1>;
		phandle = <0x2b>;
	};

	dwc2_a@ff400000 {
		compatible = "amlogic, dwc2";
		status = "okay";
		device_name = "dwc2_a";
		reg = <0xff400000 0x40000>;
		interrupts = <0x0 0x1f 0x4>;
		pl-periph-id = <0x0>;
		clock-src = "usb0";
		port-id = <0x0>;
		port-type = <0x2>;
		port-speed = <0x0>;
		port-config = <0x0>;
		port-dma = <0x0>;
		port-id-mode = <0x0>;
		usb-fifo = <0x2d8>;
		cpu-type = "v2";
		phy-reg = <0xffe09000>;
		phy-reg-size = <0xa0>;
		phy-interface = <0x0>;
		clocks = <0x13 0x41 0x13 0x49>;
		clock-names = "usb_general", "usb1";
		controller-type = <0x3>;
		phandle = <0xde>;
	};

How to translate to armbian dts is beyond me at the moment

Link to comment
Share on other sites

14 hours ago, amirul said:

As far as I can tell from the android dts, these are the bits that look like they have reference to usb


	dwc3@ff500000 {
		compatible = "synopsys, dwc3";
		status = "okay";
		reg = <0xff500000 0x100000>;
		interrupts = <0x0 0x1e 0x4>;
		usb-phy = <0x2a 0x2b>;
		cpu-type = "gxl";
		clock-src = "usb3.0";
		clocks = <0x13 0x41>;
		clock-names = "dwc_general";
		phandle = <0xdd>;
	};

	usb2phy@ffe09000 {
		compatible = "amlogic, amlogic-new-usb2-v2";
		status = "okay";
		reg = <0xffe09000 0x80 0xffd01008 0x100 0xff636000 0x2000 0xff63a000 0x2000>;
		pll-setting-1 = <0x9400414>;
		pll-setting-2 = <0x927e0000>;
		pll-setting-3 = <0xac5f69e5>;
		pll-setting-4 = <0xfe18>;
		pll-setting-5 = <0x8000fff>;
		pll-setting-6 = <0x78000>;
		pll-setting-7 = <0xe0004>;
		pll-setting-8 = <0xe000c>;
		portnum = <0x2>;
		phandle = <0x2a>;
	};

	usb3phy@ffe09080 {
		compatible = "amlogic, amlogic-new-usb3-v2";
		status = "okay";
		reg = <0xffe09080 0x20>;
		phy-reg = <0xff646000>;
		phy-reg-size = <0x2000>;
		usb2-phy-reg = <0xffe09000>;
		usb2-phy-reg-size = <0x80>;
		interrupts = <0x0 0x10 0x4>;
		clocks = <0x13 0x18>;
		clock-names = "pcie_refpll";
		portnum = <0x0>;
		otg = <0x1>;
		phandle = <0x2b>;
	};

	dwc2_a@ff400000 {
		compatible = "amlogic, dwc2";
		status = "okay";
		device_name = "dwc2_a";
		reg = <0xff400000 0x40000>;
		interrupts = <0x0 0x1f 0x4>;
		pl-periph-id = <0x0>;
		clock-src = "usb0";
		port-id = <0x0>;
		port-type = <0x2>;
		port-speed = <0x0>;
		port-config = <0x0>;
		port-dma = <0x0>;
		port-id-mode = <0x0>;
		usb-fifo = <0x2d8>;
		cpu-type = "v2";
		phy-reg = <0xffe09000>;
		phy-reg-size = <0xa0>;
		phy-interface = <0x0>;
		clocks = <0x13 0x41 0x13 0x49>;
		clock-names = "usb_general", "usb1";
		controller-type = <0x3>;
		phandle = <0xde>;
	};

How to translate to armbian dts is beyond me at the moment

It seems that Odroid N2 also uses the same amlogic-new-usb2-v2 driver, and should be included in the kernel, as it appears in a coreelec log here:

 

https://discourse.coreelec.org/t/odroid-n2-test-builds/4560%3Fpage%3D89&ved=2ahUKEwj4n8b9z-rmAhXI0eAKHUL1Ce0QFjAAegQIBhAC&usg=AOvVaw1iva3UyWfsd1781fs0eTVh&cshid=1578164449966

 

Yesterday I ordered a X88 King for a good friend of mine who lives next door. He will just use kodi and very light gaming in Android, and he wanted a very fast box with good internal memory, and gigabit network, so he chose it amongst the rest of S922X devices we saw. No brainer, 80€ for this beast with 4Gb LPDDR4 and 128 Emmc is amazing.

I will be able to do armbian testing with it, I guess usb and Ethernet will get supported soon, I don't care much about wifi and BT atm. I have started to read some device trees tutorials to see if I can help with it.

And I'll keep my A95X F2 4/64 for now, instead of selling it and getting a new box. Maybe Ugoos AM6 will drop price in some moment and I'll get one, we'll see. 

 

Link to comment
Share on other sites

3 hours ago, ramoncio said:

It seems that Odroid N2 also uses the same amlogic-new-usb2-v2 driver, and should be included in the kernel, as it appears in a coreelec log here:

 

https://discourse.coreelec.org/t/odroid-n2-test-builds/4560%3Fpage%3D89&ved=2ahUKEwj4n8b9z-rmAhXI0eAKHUL1Ce0QFjAAegQIBhAC&usg=AOvVaw1iva3UyWfsd1781fs0eTVh&cshid=1578164449966

 

Yesterday I ordered a X88 King for a good friend of mine who lives next door. He will just use kodi and very light gaming in Android, and he wanted a very fast box with good internal memory, and gigabit network, so he chose it amongst the rest of S922X devices we saw. No brainer, 80€ for this beast with 4Gb LPDDR4 and 128 Emmc is amazing.

I will be able to do armbian testing with it, I guess usb and Ethernet will get supported soon, I don't care much about wifi and BT atm. I have started to read some device trees tutorials to see if I can help with it.

And I'll keep my A95X F2 4/64 for now, instead of selling it and getting a new box. Maybe Ugoos AM6 will drop price in some moment and I'll get one, we'll see. 

 

Awesome. I look forward to the results of your investigations :)

Link to comment
Share on other sites

 

On 1/1/2020 at 2:25 PM, amirul said:

 

I have just ordered this one for me, a H96 Max X3, with a S905x3 and 4Gb/128Gb, for 42€ included shipping. 😁

https://rover.ebay.com/rover/0/0/0?mpre=https%3A%2F%2Fwww.ebay.es%2Fulk%2Fitm%2F274165708444

 

so I can test with more different socks.

I will probably also get a 25€ TX9S S912 2Gb/8Gb so I can test latest midgard support in panfrost that should be already working.

I also have a S905 that works great with coreelec.

Link to comment
Share on other sites

2 hours ago, ramoncio said:

 

I have just ordered this one for me, a H96 Max X3, with a S905x3 and 4Gb/128Gb, for 42€ included shipping. 😁

https://rover.ebay.com/rover/0/0/0?mpre=https%3A%2F%2Fwww.ebay.es%2Fulk%2Fitm%2F274165708444

 

so I can test with more different socks.

I will probably also get a 25€ TX9S S912 2Gb/8Gb so I can test latest midgard support in panfrost that should be already working.

I also have a S905 that works great with coreelec.

Look forward to your results.

I already have Armbian running on TX9 Pro s912 3gb but probably TX9S is wildly different :)

Waiting for reviews to come in for the Orange Pi 4 rk3399 before putting in the order. Looks great on paper, performance and price

Link to comment
Share on other sites

I have a very nice find.

g12b_s922x_odroid_n2.dts from Coreelec 9.2.1 has a really similar structure to the dts I extracted from the X88 King image, check it out in the attached files, at least the usb related stuff.

It looks pretty straightforward to adapt, and make it work at least with the kernel they use, and get usbs working in corelec.

 

g12b_s922x_odroid_n2.dts dtb_2

Link to comment
Share on other sites

So you can modify g12b_s922x_odroid_n2.dts using the reg values in dtb_2 and rename it as g12b_s922x_x88king.dts, compile the dtb and try it in coreelec 9.2.1. 

If this works, we will need to adapt the  odroid n2 armbian dts with the different reg values and maybe usb can work.

My box will take a couple of weeks for shipping. I think the H6 MAX X3 S905X3 will be here first.

Link to comment
Share on other sites

I have a feeling it's a bit more complicated because in the armbian odroid n2 dtb are the following references to usb:

					bank@40 {
						reg = <0x0 0x40 0x0 0x4c 0x0 0xe8 0x0 0x18 0x0 0x120 0x0 0x18 0x0 0x2c0 0x0 0x40 0x0 0x340 0x0 0x1c>;
						reg-names = "gpio", "pull", "pull-enable", "mux", "ds";
						gpio-controller;
						#gpio-cells = <0x2>;
						gpio-ranges = <0xe 0x0 0x0 0x56>;
						phandle = <0x14>;

						usb-hub {
							gpio-hog;
							gpios = <0x14 0x0>;
							output-high;
							line-name = "usb-hub-reset";
						};
					};
....
			phy@36000 {
				compatible = "amlogic,g12a-usb2-phy";
				reg = <0x0 0x36000 0x0 0x2000>;
				clocks = <0x10>;
				clock-names = "xtal";
				resets = <0x8 0x30>;
				reset-names = "phy";
				#phy-cells = <0x0>;
				phy-supply = <0xb>;
				phandle = <0x31>;
			};
---
			phy@3a000 {
				compatible = "amlogic,g12a-usb2-phy";
				reg = <0x0 0x3a000 0x0 0x2000>;
				clocks = <0x10>;
				clock-names = "xtal";
				resets = <0x8 0x31>;
				reset-names = "phy";
				#phy-cells = <0x0>;
				phy-supply = <0x11>;
				phandle = <0x32>;
			};
...
			phy@46000 {
				compatible = "amlogic,g12a-usb3-pcie-phy";
				reg = <0x0 0x46000 0x0 0x2000>;
				clocks = <0x3 0xc9>;
				clock-names = "ref_clk";
				resets = <0x8 0xe>;
				reset-names = "phy";
				assigned-clocks = <0x3 0xc9>;
				assigned-clock-rates = <0x5f5e100>;
				#phy-cells = <0x1>;
				phandle = <0x33>;
			};
---
		usb@ffe09000 {
			status = "okay";
			compatible = "amlogic,meson-g12a-usb-ctrl";
			reg = <0x0 0xffe09000 0x0 0xa0>;
			interrupts = <0x0 0x10 0x4>;
			#address-cells = <0x2>;
			#size-cells = <0x2>;
			ranges;
			clocks = <0x3 0x2f>;
			resets = <0x8 0x22>;
			dr_mode = "otg";
			phys = <0x31 0x32 0x33 0x4>;
			phy-names = "usb2-phy0", "usb2-phy1", "usb3-phy0";
			vbus-supply = <0x34>;

			usb@ff400000 {
				compatible = "amlogic,meson-g12a-usb", "snps,dwc2";
				reg = <0x0 0xff400000 0x0 0x40000>;
				interrupts = <0x0 0x1f 0x4>;
				clocks = <0x3 0x37>;
				clock-names = "ddr";
				phys = <0x32>;
				phy-names = "usb2-phy";
				dr_mode = "peripheral";
				g-rx-fifo-size = <0xc0>;
				g-np-tx-fifo-size = <0x80>;
				g-tx-fifo-size = <0x80 0x80 0x10 0x10 0x10>;
			};

			usb@ff500000 {
				compatible = "snps,dwc3";
				reg = <0x0 0xff500000 0x0 0x100000>;
				interrupts = <0x0 0x1e 0x4>;
				dr_mode = "host";
				snps,dis_u2_susphy_quirk;
				snps,quirk-frame-length-adjustment;
			};
		};
...
	regulator-usb_pwr_en {
		compatible = "regulator-fixed";
		regulator-name = "USB_PWR_EN";
		regulator-min-microvolt = <0x4c4b40>;
		regulator-max-microvolt = <0x4c4b40>;
		vin-supply = <0xb>;
		gpio = <0x14 0x16 0x0>;
		enable-active-high;
		phandle = <0x34>;
	};


 

Link to comment
Share on other sites

53 minutes ago, amirul said:

Could be the difference in kernel version, android is kernel 4.9 while armbian is kernel 5.5?

Yes, I think so.

But first I would try in coreelec 9.2.1 that has nearly identical dts. And if it works there we know that in armbian will work as well, just need to find the right dts settings, but kernel modules should be the same and are installed in armbian kernel, as in odroid n2 they work. 

Link to comment
Share on other sites

1 hour ago, amirul said:

It seems that running coreelec will alter the tv box and would require full firmware recovery in order to run armbian afterwards.

I think this is only if you install it in the emmc, I have tried it in at least 2 boxes (S905, S905X2) with no problems at all, when you remove the microsd/usb it boots to android. And after this armbian worked, only had to use the toothstick again. 

Anyway you can always restore the original firmware easily with USB tool or microsd recovery. 

Link to comment
Share on other sites

40 minutes ago, balbes150 said:

If you like problems, you can try ....

Problems why? Well, in worst case scenario he just needs to recover factory firmware, right? 

I haven't had problems in 2 different devices without restoring them I can boot armbian from USB again, after coreelec from microsd. 

Link to comment
Share on other sites

2 hours ago, balbes150 said:

If you like problems, you can try ....

I see, now ethernet is not working in armbian in my S905, and it was working before running coreelec. Anyway, in this case we are trying to get usb working in the X88 King, there is no support at all at the moment, so armbian is not very useful until we get it working. Only for a headless server. 

Link to comment
Share on other sites

1 hour ago, ramoncio said:

I see, now ethernet is not working in armbian in my S905, and it was working before running coreelec. Anyway, in this case we are trying to get usb working in the X88 King, there is no support at all at the moment, so armbian is not very useful until we get it working. Only for a headless server. 

Not even headless because I believe ethernet is not working either on the X88

Link to comment
Share on other sites

@amirul - one thing you might try is to boot an 4.9 bsp kernel based linux image (from the odroid n2 or khadas vim3) with the dtb from the box and see how far you get and if usb is working there ... this would at least be some basic check if usb is working in any setup ...

Link to comment
Share on other sites

29 minutes ago, hexdump said:

@amirul - one thing you might try is to boot an 4.9 bsp kernel based linux image (from the odroid n2 or khadas vim3) with the dtb from the box and see how far you get and if usb is working there ... this would at least be some basic check if usb is working in any setup ...

I've tried Armbian_5.87_Odroid-n2_Ubuntu_bionic_default_4.9.177_desktop_20190529, does not boot :(

there is no uEnv.ini to fiddle with

 

I guess what would work is an Armbian_19.11.4_Arm-64 spin with a 4.9 kernel :)

Link to comment
Share on other sites

3 minutes ago, hexdump said:

for testing you might start with the native odroid and khadas images to see if something works at all without having to invest too much effort and if that is the case you might look into building armbian with it ...

Pardon the ignorance, but where do I get a native odroid image? 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines