Pcie root complex is not detecting and sysfs interface "usb_pcie_switch_mode" also not showing up

Hi,

I followed the instruction mentioned in the below link.

But sysfs interface is not listed.
ls /sys/class/usb_pcie_switch_mode: No such file or directory
ls /sys/class/mcu/usb_pcie_switch_mode: No such file or directory

“kbi init” command also not working in boot loader command prompt.

Kernel:
$ git clone https://android.googlesource.com/kernel/hikey-linaro
$ git checkout -b android-amlogic-bmeson-4.19 origin/android-amlogic-bmeson-4.19
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- CLANG_TRIPLE=aarch64-linux-gnu- CC=clang meson_defconfig

console:/ # uname -a
Linux localhost 4.19.130-g189ab31eccde-dirty #4 SMP PREEMPT Fri Aug 7 12:49:19 IST 2020 aarch64

AOSP:
$ repo init -u https://android.googlesource.com/platform/manifest -b master && repo sync -c -j24
$ . ./build/envsetup.sh
$ lunch yukawa-userdebug
$ make TARGET_VIM3L=true -j24

please let me know what is missing here.

Hello, Which image did you use ?
It might be a very old image, and might not be having the software, try using a newer copy of linux…

it is also important to know which device you want to connect and how correctly it is connected

@Electr1
Below are the images used:

Kernel:
$ git clone https://android.googlesource.com/kernel/hikey-linaro
$ git checkout -b android-amlogic-bmeson-4.19 origin/android-amlogic-bmeson-4.19
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- CLANG_TRIPLE=aarch64-linux-gnu- CC=clang meson_defconfig

console:/ # uname -a
Linux localhost 4.19.130-g189ab31eccde-dirty #4 SMP PREEMPT Fri Aug 7 12:49:19 IST 2020 aarch64

AOSP:
$ repo init -u https://android.googlesource.com/platform/manifest -b master && repo sync -c -j24
$ . ./build/envsetup.sh
$ lunch yukawa-userdebug
$ make TARGET_VIM3L=true -j24

Try setting the mode using Krescue(KBI) or KBI using serial tool.

@anilkumar I think that the switch protocol thing was incorporated, to be pre installed in Fenix, do you know Fenix Ubuntu/Debian build scripts ?

(note: I realized you were talking about android, in that case please ask @Terry for reference… )

We have connected pcie device via M.2 connector.
The same connection is working fine on Hikey960 platform but on vim3l platform even root complex is not getting listed when lspci command is issued.
I think the issue is due to usb_pcie_switch protocol is not enabled on Android.
Let me know which kernel and android I should use to get it working.

you did not say what kind of device you are connecting, you probably need driver support, or not compatibility, not enough power, there can be many reasons

You are telling about end point device, before that root complex should be listed when lspci command is issued.

I understand you, after switching to pci-e, did you reboot the device and then check?

Not able to switch to pcie either from bootloader or sysfs interface “usb_pcie_switch_mode”.

U-Boot 2020.04-00029-gc894d73d1a (Jul 07 2020 - 10:25:53 +0200) khadas-vim3l

Model: Khadas VIM3L
SoC: Amlogic Meson SM1 (Unknown) Revision 2b:c (4:2)
DRAM: 2 GiB
MMC: sd@ffe03000: 0, sd@ffe05000: 1, mmc@ffe07000: 2
Loading Environment from MMC… *** Warning - bad CRC, using default environment

stdio_add_devices: Video device failed (ret=-22)
In: serial@3000
Out: serial@3000
Err: serial@3000
Net: eth0: ethernet@ff3f0000
Verify GPT: success!
switch to partitions #0, OK
mmc2(part 0) is current device

MMC read: dev # 2, block # 1024, count 4096 … 4096 blocks read: OK
There is no valid bmp file at the given address
Hit any key to stop autoboot: 0
=>
=>
=> kbi
Unknown command ‘kbi’ - try ‘help’

ls /sys/class/usb_pcie_switch_mode: No such file or directory
ls /sys/class/mcu/usb_pcie_switch_mode: No such file or directory

Seems you don’t use our official source code. So the MCU driver is not supported.
The guidance is only for our official source code. And I’m not sure whether this kernel supports the PCIe or not.

Any way, If the kernel supports PCIe already, you can setup the MCU registers directly via I2C command in u-boot command line to enable PCIe.

Enable PCIe:

i2c mw 0x18 0x33 0x01

Power Off:

i2c mw 0x18 0x80 0x01

Then press POWER key to bootup.

Notice: Make sure the PCIe driver is supported in kernel.

More registers about the MCU:

Tried the commands you mentioned.
=> i2c mw 0x18 0x33 0x01
Unknown command ‘i2c’ - try ‘help’

Can you please point me from where to pick the official android and linux kernel for vim3l platform?
Also let me know if there are prebuilt binaries I can directly flash and try once.

I’m also facing the same problem, I have cloned the below sources:

But if I grep through the source, I am unable to find any “usb_pcie_switch_mode”
Could you please point to the correct kernel checkout and source file ?

I2C command is not enabled by default of your code, you have to enable it yourself.

Check here:

https://docs.khadas.com/vim3/DownloadAndroidSourceCode.html

https://dl.khadas.com/Firmware/VIM3L/Android/VIM3L_Pie_V200624.7z

This kernel is for Ubuntu linux