1d1523b52SThierry RedingNVIDIA Tegra PCIe controller 2d1523b52SThierry Reding 3d1523b52SThierry RedingRequired properties: 494716cddSJay Agarwal- compatible: "nvidia,tegra20-pcie" or "nvidia,tegra30-pcie" 5d1523b52SThierry Reding- device_type: Must be "pci" 6d1523b52SThierry Reding- reg: A list of physical base address and length for each set of controller 7d1523b52SThierry Reding registers. Must contain an entry for each entry in the reg-names property. 8d1523b52SThierry Reding- reg-names: Must include the following entries: 9d1523b52SThierry Reding "pads": PADS registers 10d1523b52SThierry Reding "afi": AFI registers 11d1523b52SThierry Reding "cs": configuration space region 12d1523b52SThierry Reding- interrupts: A list of interrupt outputs of the controller. Must contain an 13d1523b52SThierry Reding entry for each entry in the interrupt-names property. 14d1523b52SThierry Reding- interrupt-names: Must include the following entries: 15d1523b52SThierry Reding "intr": The Tegra interrupt that is asserted for controller interrupts 16d1523b52SThierry Reding "msi": The Tegra interrupt that is asserted when an MSI is received 17d1523b52SThierry Reding- pex-clk-supply: Supply voltage for internal reference clock 18d1523b52SThierry Reding- vdd-supply: Power supply for controller (1.05V) 1994716cddSJay Agarwal- avdd-supply: Power supply for controller (1.05V) (not required for Tegra20) 20d1523b52SThierry Reding- bus-range: Range of bus numbers associated with this controller 21d1523b52SThierry Reding- #address-cells: Address representation for root ports (must be 3) 22d1523b52SThierry Reding - cell 0 specifies the bus and device numbers of the root port: 23d1523b52SThierry Reding [23:16]: bus number 24d1523b52SThierry Reding [15:11]: device number 25d1523b52SThierry Reding - cell 1 denotes the upper 32 address bits and should be 0 26d1523b52SThierry Reding - cell 2 contains the lower 32 address bits and is used to translate to the 27d1523b52SThierry Reding CPU address space 28d1523b52SThierry Reding- #size-cells: Size representation for root ports (must be 2) 29d1523b52SThierry Reding- ranges: Describes the translation of addresses for root ports and standard 30d1523b52SThierry Reding PCI regions. The entries must be 6 cells each, where the first three cells 31d1523b52SThierry Reding correspond to the address as described for the #address-cells property 32d1523b52SThierry Reding above, the fourth cell is the physical CPU address to translate to and the 33d1523b52SThierry Reding fifth and six cells are as described for the #size-cells property above. 34d1523b52SThierry Reding - The first two entries are expected to translate the addresses for the root 35d1523b52SThierry Reding port registers, which are referenced by the assigned-addresses property of 36d1523b52SThierry Reding the root port nodes (see below). 37d1523b52SThierry Reding - The remaining entries setup the mapping for the standard I/O, memory and 38d1523b52SThierry Reding prefetchable PCI regions. The first cell determines the type of region 39d1523b52SThierry Reding that is setup: 40d1523b52SThierry Reding - 0x81000000: I/O memory region 41d1523b52SThierry Reding - 0x82000000: non-prefetchable memory region 42d1523b52SThierry Reding - 0xc2000000: prefetchable memory region 43d1523b52SThierry Reding Please refer to the standard PCI bus binding document for a more detailed 44d1523b52SThierry Reding explanation. 45*97070bd4SLucas Stach- #interrupt-cells: Size representation for interrupts (must be 1) 46*97070bd4SLucas Stach- interrupt-map-mask and interrupt-map: Standard PCI IRQ mapping properties 47*97070bd4SLucas Stach Please refer to the standard PCI bus binding document for a more detailed 48*97070bd4SLucas Stach explanation. 49d8f64797SStephen Warren- clocks: Must contain an entry for each entry in clock-names. 50d8f64797SStephen Warren See ../clocks/clock-bindings.txt for details. 51d1523b52SThierry Reding- clock-names: Must include the following entries: 52d8f64797SStephen Warren - pex 53d8f64797SStephen Warren - afi 54d8f64797SStephen Warren - pll_e 55d8f64797SStephen Warren - cml (not required for Tegra20) 5607999587SStephen Warren- resets: Must contain an entry for each entry in reset-names. 5707999587SStephen Warren See ../reset/reset.txt for details. 5807999587SStephen Warren- reset-names: Must include the following entries: 5907999587SStephen Warren - pex 6007999587SStephen Warren - afi 6107999587SStephen Warren - pcie_x 62d1523b52SThierry Reding 63d1523b52SThierry RedingRoot ports are defined as subnodes of the PCIe controller node. 64d1523b52SThierry Reding 65d1523b52SThierry RedingRequired properties: 66d1523b52SThierry Reding- device_type: Must be "pci" 67d1523b52SThierry Reding- assigned-addresses: Address and size of the port configuration registers 68d1523b52SThierry Reding- reg: PCI bus address of the root port 69d1523b52SThierry Reding- #address-cells: Must be 3 70d1523b52SThierry Reding- #size-cells: Must be 2 71d1523b52SThierry Reding- ranges: Sub-ranges distributed from the PCIe controller node. An empty 72d1523b52SThierry Reding property is sufficient. 73d1523b52SThierry Reding- nvidia,num-lanes: Number of lanes to use for this port. Valid combinations 74d1523b52SThierry Reding are: 75d1523b52SThierry Reding - Root port 0 uses 4 lanes, root port 1 is unused. 76d1523b52SThierry Reding - Both root ports use 2 lanes. 77d1523b52SThierry Reding 78d1523b52SThierry RedingExample: 79d1523b52SThierry Reding 80d1523b52SThierry RedingSoC DTSI: 81d1523b52SThierry Reding 82d1523b52SThierry Reding pcie-controller { 83d1523b52SThierry Reding compatible = "nvidia,tegra20-pcie"; 84d1523b52SThierry Reding device_type = "pci"; 85d1523b52SThierry Reding reg = <0x80003000 0x00000800 /* PADS registers */ 86d1523b52SThierry Reding 0x80003800 0x00000200 /* AFI registers */ 87d1523b52SThierry Reding 0x90000000 0x10000000>; /* configuration space */ 88d1523b52SThierry Reding reg-names = "pads", "afi", "cs"; 89d1523b52SThierry Reding interrupts = <0 98 0x04 /* controller interrupt */ 90d1523b52SThierry Reding 0 99 0x04>; /* MSI interrupt */ 91d1523b52SThierry Reding interrupt-names = "intr", "msi"; 92d1523b52SThierry Reding 93*97070bd4SLucas Stach #interrupt-cells = <1>; 94*97070bd4SLucas Stach interrupt-map-mask = <0 0 0 0>; 95*97070bd4SLucas Stach interrupt-map = <0 0 0 0 &intc GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>; 96*97070bd4SLucas Stach 97d1523b52SThierry Reding bus-range = <0x00 0xff>; 98d1523b52SThierry Reding #address-cells = <3>; 99d1523b52SThierry Reding #size-cells = <2>; 100d1523b52SThierry Reding 101d1523b52SThierry Reding ranges = <0x82000000 0 0x80000000 0x80000000 0 0x00001000 /* port 0 registers */ 102d1523b52SThierry Reding 0x82000000 0 0x80001000 0x80001000 0 0x00001000 /* port 1 registers */ 103d1523b52SThierry Reding 0x81000000 0 0 0x82000000 0 0x00010000 /* downstream I/O */ 104d1523b52SThierry Reding 0x82000000 0 0xa0000000 0xa0000000 0 0x10000000 /* non-prefetchable memory */ 105d1523b52SThierry Reding 0xc2000000 0 0xb0000000 0xb0000000 0 0x10000000>; /* prefetchable memory */ 106d1523b52SThierry Reding 10707999587SStephen Warren clocks = <&tegra_car 70>, <&tegra_car 72>, <&tegra_car 118>; 10807999587SStephen Warren clock-names = "pex", "afi", "pll_e"; 10907999587SStephen Warren resets = <&tegra_car 70>, <&tegra_car 72>, <&tegra_car 74>; 11007999587SStephen Warren reset-names = "pex", "afi", "pcie_x"; 111d1523b52SThierry Reding status = "disabled"; 112d1523b52SThierry Reding 113d1523b52SThierry Reding pci@1,0 { 114d1523b52SThierry Reding device_type = "pci"; 115d1523b52SThierry Reding assigned-addresses = <0x82000800 0 0x80000000 0 0x1000>; 116d1523b52SThierry Reding reg = <0x000800 0 0 0 0>; 117d1523b52SThierry Reding status = "disabled"; 118d1523b52SThierry Reding 119d1523b52SThierry Reding #address-cells = <3>; 120d1523b52SThierry Reding #size-cells = <2>; 121d1523b52SThierry Reding 122d1523b52SThierry Reding ranges; 123d1523b52SThierry Reding 124d1523b52SThierry Reding nvidia,num-lanes = <2>; 125d1523b52SThierry Reding }; 126d1523b52SThierry Reding 127d1523b52SThierry Reding pci@2,0 { 128d1523b52SThierry Reding device_type = "pci"; 129d1523b52SThierry Reding assigned-addresses = <0x82001000 0 0x80001000 0 0x1000>; 130d1523b52SThierry Reding reg = <0x001000 0 0 0 0>; 131d1523b52SThierry Reding status = "disabled"; 132d1523b52SThierry Reding 133d1523b52SThierry Reding #address-cells = <3>; 134d1523b52SThierry Reding #size-cells = <2>; 135d1523b52SThierry Reding 136d1523b52SThierry Reding ranges; 137d1523b52SThierry Reding 138d1523b52SThierry Reding nvidia,num-lanes = <2>; 139d1523b52SThierry Reding }; 140d1523b52SThierry Reding }; 141d1523b52SThierry Reding 142d1523b52SThierry Reding 143d1523b52SThierry RedingBoard DTS: 144d1523b52SThierry Reding 145d1523b52SThierry Reding pcie-controller { 146d1523b52SThierry Reding status = "okay"; 147d1523b52SThierry Reding 148d1523b52SThierry Reding vdd-supply = <&pci_vdd_reg>; 149d1523b52SThierry Reding pex-clk-supply = <&pci_clk_reg>; 150d1523b52SThierry Reding 151d1523b52SThierry Reding /* root port 00:01.0 */ 152d1523b52SThierry Reding pci@1,0 { 153d1523b52SThierry Reding status = "okay"; 154d1523b52SThierry Reding 155d1523b52SThierry Reding /* bridge 01:00.0 (optional) */ 156d1523b52SThierry Reding pci@0,0 { 157d1523b52SThierry Reding reg = <0x010000 0 0 0 0>; 158d1523b52SThierry Reding 159d1523b52SThierry Reding #address-cells = <3>; 160d1523b52SThierry Reding #size-cells = <2>; 161d1523b52SThierry Reding 162d1523b52SThierry Reding device_type = "pci"; 163d1523b52SThierry Reding 164d1523b52SThierry Reding /* endpoint 02:00.0 */ 165d1523b52SThierry Reding pci@0,0 { 166d1523b52SThierry Reding reg = <0x020000 0 0 0 0>; 167d1523b52SThierry Reding }; 168d1523b52SThierry Reding }; 169d1523b52SThierry Reding }; 170d1523b52SThierry Reding }; 171d1523b52SThierry Reding 172d1523b52SThierry RedingNote that devices on the PCI bus are dynamically discovered using PCI's bus 173d1523b52SThierry Redingenumeration and therefore don't need corresponding device nodes in DT. However 174d1523b52SThierry Redingif a device on the PCI bus provides a non-probeable bus such as I2C or SPI, 175d1523b52SThierry Redingdevice nodes need to be added in order to allow the bus' children to be 176d1523b52SThierry Redinginstantiated at the proper location in the operating system's device tree (as 177d1523b52SThierry Redingillustrated by the optional nodes in the example above). 178