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: <bus-address parent-bus-address
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>;
  };
 };
};

  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值