device tree中对PCIe的描述



/dts-v1/;

/ {
 compatible = "xlnx,zynqmp-zu9", "xlnx,zynqmp";
 #address-cells = <0x2>;
 #size-cells = <0x2>;
 model = "ZCU102 RDB";

 cpus {
  #address-cells = <0x1>;
  #size-cells = <0x0>;

  cpu@0 {
   compatible = "arm,cortex-a53", "arm,armv8";
   device_type = "cpu";
   enable-method = "psci";
   reg = <0x0>;
  };
 };

 power-domains {
  compatible = "xlnx,zynqmp-genpd";
 };

 timer {
  compatible = "arm,armv8-timer";
  interrupt-parent = <0x1>;
  interrupts = <0x1 0xd 0xf01 0x1 0xe 0xf01 0x1 0xb 0xf01 0x1 0xa 0xf01>;
 };

 amba_apu {

 };

 amba {
  compatible = "simple-bus";
  #address-cells = <0x2>;
  #size-cells = <0x1>;
  ranges = <0x0 0x0 0x0 0x0 0xffffffff>;

  gpio@ff0a0000 {
   compatible = "xlnx,zynqmp-gpio-1.0";
   status = "okay";
   #gpio-cells = <0x2>;
   #interrupt-cells = <0x2>;
   interrupt-controller;
   interrupt-parent = <0x1>;
   interrupts = <0x0 0x10 0x4>;
   reg = <0x0 0xff0a0000 0x1000>;
   power-domains = <0x11>;
   clocks = <0x3>;
   emio-gpio-width = <0x20>;
   gpio-mask-high = <0x0>;
   gpio-mask-low = <0x5600>;
  };

  pcie@fd0e0000 {
   compatible = "xlnx,nwl-pcie-2.11";
   status = "disabled";
   #address-cells = <0x3>;
   #size-cells = <0x2>;
   #interrupt-cells = <0x1>;
   device_type = "pci";
   interrupt-parent = <0x1>;
   interrupts = <0x0 0x76 0x4 0x0 0x74 0x4 0x0 0x73 0x4 0x0 0x72 0x4>;
   interrupt-names = "misc", "intx", "msi_1", "msi_0";
   reg = <0x0 0xfd0e0000 0x1000 0x0 0xfd480000 0x1000 0x0 0xe0000000 0x1000000>;
   reg-names = "breg", "pcireg", "cfg";
   ranges = <0x2000000 0x0 0xe1000000 0x0 0xe1000000 0x0 0xf000000>;
   interrupt-map-mask = <0x0 0x0 0x0 0x7>;
   interrupt-map = <0x0 0x0 0x0 0x1 0x14 0x1 0x0 0x0 0x0 0x2 0x14 0x2 0x0 0x0 0x0 0x3 0x14 0x3 0x0 0x0 0x0 0x4 0x14 0x4>;

   legacy-interrupt-controller {
    interrupt-controller;
    #address-cells = <0x0>;
    #interrupt-cells = <0x1>;
    linux,phandle = <0x14>;
    phandle = <0x14>;
   };
  };


在上面对PCIe bridge的描述中每个属性的一点解释:

#address-cells = <0x3>;指ranges中PCIe地址域包含3个32位数值,第一个(0x2000000)指示是I/O,mem或ECAM

#size-cells = <0x2>;指长度域中包含2个32数


reg = <0x0 0xfd0e0000 0x1000 0x0 0xfd480000 0x1000 0x0 0xe0000000 0x1000000>;
   reg-names = "breg", "pcireg", "cfg";

这两个组合表示

breg的起始地址是0x00000000_0xFD0E0000长度是0x1000

pcireg的起始地址是0x00000000_0xfd480000长度是0x1000

ECAM reg的起始地址是0x00000000_E0000000长度是0x1000000

注意这里的地址和长度使用的是父节点(amba)的#address-cells = <0x2>;  #size-cells = <0x1>;


ranges = <0x2000000 0x0 0xe1000000 0x0 0xe1000000 0x0 0xf000000>;


这个属性表示了PCIe地址空间和CPU地址空间的地址映射关系

PCIe:内存地址0x00000000_0xe1000000映射到CPU 0x00000000_0xe1000000地址,映射长度是0x00000000_0F000000

The ranges property defines a range of addresses for the child devices in this format: size>
• bus-address — bus base address, using #address-size of this bus node
• parent-bus-address — base address in the parent’s address space, using #address-size of the parent node
• size — size of mapping, using #address-size of this node

Note that an empty ranges property indicates that the translation from parent to child address space is an identity mapping
only, meaning that the parent bus address space is the same as the child bus address space. The absence of a ranges property
is not the same as an empty ranges property. The absence of a ranges property means that translation is not possible (for
example, with CPU nodes).






  rtc@ffa60000 {
   compatible = "xlnx,zynqmp-rtc";
   status = "okay";
   reg = <0x0 0xffa60000 0x100>;
   interrupt-parent = <0x1>;
   interrupts = <0x0 0x1a 0x4 0x0 0x1b 0x4>;
   interrupt-names = "alarm", "sec";
  };

  timer@ff110000 {
   compatible = "cdns,ttc";

  };

  timer@ff120000 {
   compatible = "cdns,ttc";

  };

  timer@ff130000 {
   compatible = "cdns,ttc";
   status = "disabled";

  };

  timer@ff140000 {
   compatible = "cdns,ttc";
   status = "disabled";

  };
  clk125 {
   compatible = "fixed-clock";
   #clock-cells = <0x0>;
   clock-frequency = <0x7735940>;
   linux,phandle = <0xb>;
   phandle = <0xb>;
  };
 };
};

你可能感兴趣的:(device tree中对PCIe的描述)