07_PCI驱动程序框架#

PCI驱动程序框架#

参考资料:

开发板资料:

  • https://wiki.t-firefly.com/zh_CN/ROC-RK3399-PC-PLUS/

1. PCI驱动框架#

image-20211227180031140

2. RK3399驱动#

怎么找到驱动?

  • 在内核目录下根据芯片名字找到文件:drivers\pci\host\pcie-rockchip.c

    • 看到如下代码:

      static const struct of_device_id rockchip_pcie_of_match[] = {
      	{ .compatible = "rockchip,rk3399-pcie", },
      	{}
      };
      
  • 在内核arch/arm64/boot/dts下搜:grep "rockchip,rk3399-pcie" * -nr

    • 找到设备树文件:arch/arm64/boot/dts/rk3399.dtsi,代码如下:

              pcie0: pcie@f8000000 {
                      compatible = "rockchip,rk3399-pcie";
                      #address-cells = <3>;
                      #size-cells = <2>;
                      bus-range = <0x0 0x1f>;
                      ...... /* 省略 */
                      phys = <&pcie_phy>;
                      phy-names = "pcie-phy";
                      ranges = <0x83000000 0x0 0xfa000000 0x0 0xfa000000 0x0 0x1e00000
                                0x81000000 0x0 0xfbe00000 0x0 0xfbe00000 0x0 0x100000>;
                      reg = <0x0 0xf8000000 0x0 0x2000000>,
                            <0x0 0xfd000000 0x0 0x1000000>;
                      ...... /* 省略 */
                };