Looking for users with no working WiFi or BT

You already wrote above

I compared android’s dts (convert from its dtb)

so I assume you know how to use fdtdump and/or dtc


# device tree decompile
dtc -I dtb -O dts source.dtb -o source.dts
fdtdump source.dtb > source.dts

# device tree compile
dtc -I dts -O dtb source.dts -o source.dtb_new

# dump dts
fdtdump source.dtb
1 Like

Compare also decompiled dtb from coreelec if this 2 pins are really there.
If I run fdtdump s4_s905w2_4g.dtb |grep GPIO_6 and fdtdump s4_s905w2_4g.dtb |grep GPIO_7, all return nothing. Does it mean the pin are not enable? How can I add to dts to enable them?
The level you mention (high/low), I did check android’s dtb, GPIO-6 and GPIO_7 all high (0x0), i don’t know how to comply with /sys/kernel/debug/gpio’s info, in which GPIO_6 (out hi), GPIO_7 (in lo).
Maybe from your experience, can you pls instruct me a bit more in this area? I am keen to fix it as the driver is ready, just don’t know why it cannot talk to the sdio hardware.

Decompiled dtb doesn’t use names for gpio but uses only numbers. Just compare second and third value for interrupt-gpios and power_on-gpios.

And also check in dmesg of any gpio conflict (grep gpio).

coreelec dtb fdtdump:

        compatible = "amlogic, aml-wifi";
        status = "okay";
        irq_trigger_type = "GPIO_IRQ_LOW";
        interrupt-gpios = <0x00000018 0x00000037 0x00000000>;
        power_on-gpios = <0x00000018 0x00000036 0x00000000>;
        pwm_config = <0x00000046>;
    };   
    wifi_pwm_conf {
        phandle = <0x00000046>;
        pwm_channel1_conf {
            pwms = <0x00000047 0x00000000 0x0000774d 0x00000000>;
            duty-cycle = <0x00003ba6>;
            times = <0x00000007>;
        };
        pwm_channel2_conf {
            pwms = <0x00000047 0x00000002 0x00007724 0x00000000>;
            duty-cycle = <0x00003b92>;
            times = <0x0000000a>;
        };
    };

android dtb fdtdump:

    aml_wifi {
        compatible = "amlogic, aml-wifi";
        status = "okay";
        irq_trigger_type = "GPIO_IRQ_LOW";
        pwm_config = <0x00000052>;
        interrupt-gpios = <0x0000001e 0x00000037 0x00000000>;
        power_on-gpios = <0x0000001e 0x00000036 0x00000000>;
    };   
    wifi_pwm_conf {
        phandle = <0x00000052>;
        pwm_channel1_conf {
            pwms = <0x00000053 0x00000000 0x0000774d 0x00000000>;
            duty-cycle = <0x00003ba6>;
            times = <0x00000007>;
        };
        pwm_channel2_conf {
            pwms = <0x00000053 0x00000002 0x00007724 0x00000000>;
            duty-cycle = <0x00003b92>;
            times = <0x0000000a>;
        };
    };

I can’t tell the difference, the second and third value are the same

In the case of wifi sdio cards, you do not modify the aml_wifi section, only the “sdio” section.
Somewhere here: https://github.com/CoreELEC/linux-amlogic/blob/amlogic-5.4.210/arch/arm64/boot/dts/amlogic/s4_s905w2_ap201_1g.dts , line 1278.
It worked on my box.

Hi @Secam7 , what you’ve added to this section &sd_emmc_a? Can you pls highlight more? I added like this, still not working

	status = "okay";
	pinctrl-0 = <&sdio_pins>;
	pinctrl-1 = <&sdio_clk_gate_pins>;
	pinctrl-names = "default", "clk-gate";
	#address-cells = <1>;
	#size-cells = <0>;

	bus-width = <4>;
	cap-sd-highspeed;
	sd-uhs-sdr50;
	sd-uhs-sdr104;
	max-frequency = <200000000>;

	non-removable;
	disable-wp;

+		interrupt-parent = <&gpio>;
+		interrupt-gpios = <&gpio  GPIOX_7  GPIO_ACTIVE_HIGH>;
+		power_on-gpios = <&gpio   GPIOX_6  GPIO_ACTIVE_HIGH>;	

	//vmmc-supply = <&vddao_3v3>;
	//vqmmc-supply = <&vddio_ao1v8>;

	brcmf: wifi@1 {
		reg = <1>;
		compatible = "brcm,bcm4329-fmac";
	};
};

Please update tomorrow with next Amlogic-ne nightly 20230919 and run:

udevadm info /sys/bus/pci/devices/* | paste

and

lspci | paste

@blueyeti2023

In my box, for sdio it was enough to reduce the clock to 40MHz.
Here is the link to my changes: MECOOL M8S PLUS (new, s905x2)

Check if sdio is working now:

CoreELEC:~ # cat /sys/kernel/debug/sdio/ios 
clock:		40000000 Hz
actual clock:	40000000 Hz
vdd:		21 (3.3 ~ 3.4 V)
bus mode:	2 (push-pull)
chip select:	0 (don't care)
power mode:	1 (up)
bus width:	2 (4 bits)
timing spec:	2 (sd high-speed)
signal voltage:	0 (3.30 V)
driver type:	0 (driver type B)
CoreELEC:~ # 

Thank you. It does not work for my box. There is no /sys/kernel/debug/sdio folder.
The command

udevadm info /sys/bus/sdio/devices/* | paste
http://ix.io/4GIw
dmesg
http://ix.io/4GIx

I have kernel 4.9, in kernel 5.x there may be a different path, e.g. /sys/kernel/debug/mmc*
Show: ls -la /sys/kernel/debug/

@Secam7 , I think it is mmc2

CoreELEC:~ # cat /sys/kernel/debug/mmc1/ios 
clock:		50000000 Hz
actual clock:	50000000 Hz
vdd:		21 (3.3 ~ 3.4 V)
bus mode:	2 (push-pull)
chip select:	0 (don't care)
power mode:	2 (on)
bus width:	2 (4 bits)
timing spec:	2 (sd high-speed)
signal voltage:	0 (3.30 V)
driver type:	0 (driver type B)
CoreELEC:~ # cat /sys/kernel/debug/mmc0/ios 
clock:		200000000 Hz
actual clock:	196608000 Hz
vdd:		21 (3.3 ~ 3.4 V)
bus mode:	2 (push-pull)
chip select:	0 (don't care)
power mode:	2 (on)
bus width:	3 (8 bits)
timing spec:	9 (mmc HS200)
signal voltage:	1 (1.80 V)
driver type:	0 (driver type B)
CoreELEC:~ # cat /sys/kernel/debug/mmc2/ios 
clock:		50000000 Hz
actual clock:	50000000 Hz
vdd:		21 (3.3 ~ 3.4 V)
bus mode:	2 (push-pull)
chip select:	0 (don't care)
power mode:	2 (on)
bus width:	2 (4 bits)
timing spec:	0 (legacy)
signal voltage:	0 (3.30 V)
driver type:	0 (driver type B)

##############################################

CoreELEC

https://coreelec.org

##############################################

CoreELEC (official): 21.0-Omega_nightly_20230919 (Amlogic-ne.aarch64)
Machine model: Amlogic
CoreELEC dt-id: sc2_s905x4_4g_1gbit

CoreELEC:~ # udevadm info /sys/bus/pci/devices/* | paste
Unknown device “/sys/bus/pci/devices/*”: No such device
CoreELEC:~ # lspci | paste
CoreELEC:~ # lspci | paste
CoreELEC:~ # lspci
CoreELEC:~ #

@Portisch @vpeter What happens when you can’t get it? It’s weird.

Boot this image and enable pci by SSH:

mount -o rw,remount /flash
fdtput -t s /flash/dtb.img /soc/pcie@f5000000 status okay
sync
reboot
dmesg | paste

After reboot try again if lspci give now a result or not.
If yes: udevadm info /sys/bus/pci/devices/* | paste

Latest nighty HAKO Pro (S905Y4-B). BT not working (No adaptor) , WIFI is fine

info /sys/bus/sdio/devices
http://ix.io/4GNs

dmesg | paste
http://ix.io/4GNt

CoreELEC:~ # udevadm info /sys/bus/pci/devices/* | paste
Unknown device “/sys/bus/pci/devices/*”: No such device

CoreELEC:~ # mount -o rw,remount /flash
CoreELEC:~ # fdtput -t s /flash/dtb.img /pcie@f5000000 status okay
Error at ‘/pcie@f5000000’: FDT_ERR_NOTFOUND

adb shell:
127|ohm:/sys/bus/pci/devices $ lspci
01:00.0 Class 0280: 14e4:449d
00:00.0 Class 0604: 16c3:abcd

1|ohm:/sys/bus/pci/devices $ lspci -k
01:00.0 Class 0280: 14e4:449d pcieh
00:00.0 Class 0604: 16c3:abcd pcieport

Android DTB file:
dtb.img (256 KB)

@Portisch @vpeter

Whether terminal sharing is required.

Yes, it’s mmc2 and it looks correct.
My box in LibreElec needed entries like this:

+/* SDIO */
+&sd_emmc_a {
+       status = "okay";
+       pinctrl-0 = <&sdio_pins>;
+       pinctrl-1 = <&sdio_clk_gate_pins>;
+       pinctrl-names = "default", "clk-gate";
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       bus-width = <4>;
+       cap-sd-highspeed;
+       max-frequency = <40000000>;
+
+       non-removable;
+       disable-wp;
+
+       /* WiFi firmware requires power to be kept while in suspend */
+       keep-power-in-suspend;
+
+       mmc-pwrseq = <&sdio_pwrseq>;
+
+       vmmc-supply = <&vddao_3v3>;
+       vqmmc-supply = <&vddao_1v8>;
+
+       rtl8189fs: wifi@1 {
+               reg = <1>;
+       };
+};

I changed the max-frequency and entries about the driver (in my case rtl8189fs).
I would still try with the driver sources unchanged. If this doesn’t work, I have no more ideas.

Please try again with tomorrow next Amlogic-ne nightly.
After update do these steps again:

I have tested the latest nightly version of ng and reported the previous errors. The latest nightly version of ne is not available yet and cannot be tested.
@Portisch

CoreELEC:~ # mount -o rw,remount /flash
CoreELEC:~ # fdtput -t s /flash/dtb.img /pcie@f5000000 status okay
Error at ‘/pcie@f5000000’: FDT_ERR_NOTFOUND

read above: it must be

/soc/pcie@f5000000

and I really doubt pci will work on 4.9 kernel on ng image

##############################################
#                  CoreELEC                  #
#            https://coreelec.org            #
##############################################

CoreELEC (official): 20.3-Nexus_nightly_20230922 (Amlogic-ng.arm)
      Machine model: Amlogic
     CoreELEC dt-id: sc2_s905x4_4g_1gbit
CoreELEC:~ # mount -o rw,remount /flash
CoreELEC:~ # fdtput -t s /flash/dtb.img /soc/pcie@f5000000 status okay
Error at '/soc/pcie@f5000000': FDT_ERR_NOTFOUND
CoreELEC:~ # lspci
-sh: lspci: command not found

Do you need today’s version test of ne? Thank you, please.
@vpeter