With 4.9 kernel on Hikey960 pcie devices is not detecting


We have connected pcie device to hikey960 through M.2 connector.
With kernel 4.4.82 it is working fine, but with kernel 4.9, even lspci is not showing up the connected device. please suggest.


I’ve just checked the 4.9 device-tree and seems that the pcie controller has a new compatible string, hisilicon,kirin960-pcie instead of hisilicon,kirin-pcie but the host pcie driver matches only the second one.

Since I don’t have any M2/PCIe module, could you please flash the following dtb and let me know:
$ fastboot flash dts hi3660-hikey960.dtb.img

@guodong, is it a known issue? do we need to add the new compatible string to the kirin pcie host driver ?

Thanks Loic. This is clearly an issue. The DTS compatible string comes from
mainline driver (drivers/pci/dwc/pcie-kirin.c) which we submitted to v4.13.
However, driver code in v4.9 aosp branch is still an old version.


Hi Loic,

I am not able to access :

please share in some other location.


Please find below patch.
Tried with below changes, still not working.

diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
index 7ae8711…144ed69 100644
— a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
@@ -1100,7 +1100,7 @@

            pcie@f4000000 {
  •                   compatible = "hisilicon,kirin960-pcie";
  •                   compatible = "hisilicon,kirin-pcie";
                      reg = <0x0 0xf4000000 0x0 0x1000>,
                            <0x0 0xff3fe000 0x0 0x1000>,

Yes, maybe only changing the compatible string is not enough, we need to align the DTB with the driver.

we need to align the DTB with the driver.

You mean flashing the dtb image:
I did below steps :

  1. Update the kernel in the boot image.

    Copy hi3660-hikey960.dtb (arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dtb) to the hikey-kernel directory as file: hi3660-hikey960.dtb-4.9
    Copy the Image file (arch/arm64/boot/Image.gz) to the hikey-kernel directory as file: Image.gz-hikey960-4.9

  2. Make the boot image:

make bootimage -j24

Even I tried images from below location :


So here the two changes I done on my side under the dtb pcie node:

  1. rename compatible string from hisilicon,kirin960-pcie to hisilicon,kirin-pcie
  2. rename reset-gpios to reset-gpio

After these two changes the PCI controller seems (at least) correclty enumerated at boot:
[ 3.008564] pci_bus 0000:00: root bus resource [bus 00-01]
[ 3.008573] pci_bus 0000:00: root bus resource [mem 0xf6000000-0xf7ffffff] (bus address [0x00000000-0x01ffffff])

[ 3.009785] pcie_pme 0000:00:00.0:pcie001: service driver pcie_pme loaded

You can give it a try and let me know, your building steps look good.

I mean having an unaligned DTB (too old or too new comparing to the kernel version) can break the driver expectation in term of pcie node structure, resources… And this is what we have to fix.

Thanks Loic for your support…
Its working after doing the changes as you mentioned.

Hi Loic,

lspci is showing up the connected device, but functionality is not working.
Memory allocation is failing with below error :

buf_len 24576, no memory available

Could you please try this DTB and let me know.

HiSilicon engineer provide these images to me. It includes the modifications suggested by @Loic, also it’s a build using an different v4.9 branch. His tested with Sandisk NVMe.
From the log, it seems PCIe enumeration and resource allocation are ok.

@Anonymous Can you give this kernel and dt.img a try, and let us know your result.

Note: download images here:

Here is the log:

OF: PCI: host bridge /soc/pcie@f4000000 ranges:
OF: PCI: MEM 0xf6000000…0xf7ffffff -> 0x00000000
Kirin-pcie f4000000.pcie: PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [bus 00-01]
pci_bus 0000:00: root bus resource [mem 0xf6000000-0xf7ffffff] (bus address [0x00000000-0x01ffffff])
pci 0000:00:00.0: [19e5:3660] type 01 class 0x060400
pci 0000:00:00.0: reg 0x10: [mem 0xf6000000-0xf6ffffff]
pci 0000:00:00.0: supports D1 D2
pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot
pci 0000:01:00.0: [1b4b:1093] type 00 class 0x010802
pci 0000:01:00.0: reg 0x10: [mem 0xf6000000-0xf6003fff 64bit]
pci 0000:01:00.0: reg 0x30: [mem 0xf6000000-0xf600ffff pref]
pci 0000:00:00.0: BAR 0: assigned [mem 0xf6000000-0xf6ffffff]
pci 0000:00:00.0: BAR 8: assigned [mem 0xf7000000-0xf70fffff]
pci 0000:00:00.0: BAR 9: assigned [mem 0xf7100000-0xf71fffff pref]
pci 0000:01:00.0: BAR 6: assigned [mem 0xf7100000-0xf710ffff pref]
pci 0000:01:00.0: BAR 0: assigned [mem 0xf7000000-0xf7003fff 64bit]
pci 0000:00:00.0: PCI bridge to [bus 01]
pci 0000:00:00.0: bridge window [mem 0xf7000000-0xf70fffff]
pci 0000:00:00.0: bridge window [mem 0xf7100000-0xf71fffff pref]
pcieport 0000:00:00.0: Signaling PME through PCIe PME interrupt
pci 0000:01:00.0: Signaling PME through PCIe PME interrupt
pcie_pme 0000:00:00.0:pcie001: service driver pcie_pme loaded
aer 0000:00:00.0:pcie002: service driver aer loaded

1 Like


If the images I mentioned above still cannot solve your problem, would you please send us:

  1. full kernel log
  2. PCIe device model.

Thank you.

@guodong are these changes available in the Open embedded builds as well? Can I use PCIe with oe

Sure. OE build is here: http://snapshots.linaro.org/reference-platform/embedded/morty/hikey960/99/rpb-wayland/

HiKey960 PCIe driver has been integrated into mainline kernel since v4.13. Latest kernel can be found here: https://github.com/96boards-hikey/linux/commits/hikey960-upstream-rebase

1 Like

this issue only exists in 4.9 kernel.
Mainline kernel works well.

1 Like