Rewrite Tegra PCIe driver
Subsystems (7)
v6 cover Rewrite Tegra PCIe driver
Hi Stephen,
This is the latest version of the Tegra PCIe driver patch series. I've dropped the PCI xclk clamping code as discussed and successfully tested on Beaver. The patches that touch the PCI subsystem have Bjorn's Acked-by and I've tested this on top of next-20130809, which has Jason's common branch. Once he's comfortable with making the branch stable you should be able to merge that branch and apply these patches on top.
Thierry
Jay Agarwal (3):
PCI: tegra: Add Tegra 30 PCIe support
ARM: tegra: Enable PCIe controller on Cardhu
ARM: dts: tegra: Increase prefetchable PCI memory space
Stephen Warren (2):
PCI: tegra: set up PADS_REFCLK_CFG1
ARM: tegra: Fix Beaver's PCIe lane configuration
Thierry Reding (9):
PCI: tegra: Move PCIe driver to drivers/pci/host
ARM: tegra: tamonten: Add PCIe support
ARM: tegra: tec: Add PCIe support
ARM: tegra: harmony: Initialize PCIe from DT
ARM: tegra: trimslice: Initialize PCIe from DT
ARM: tegra: Add Tegra30 PCIe support
ARM: tegra: Enable PCIe controller on Beaver
ARM: tegra: Update default configuration (PCIe)
MAINTAINERS: Add myself as Tegra PCIe maintainer
.../bindings/pci/nvidia,tegra20-pcie.txt | 163 ++ MAINTAINERS | 7 + arch/arm/boot/dts/tegra20-harmony.dts | 20 +- arch/arm/boot/dts/tegra20-tamonten.dtsi | 17 +- arch/arm/boot/dts/tegra20-tec.dts | 8 + arch/arm/boot/dts/tegra20-trimslice.dts | 28 + arch/arm/boot/dts/tegra20.dtsi | 55 + arch/arm/boot/dts/tegra30-beaver.dts | 21 + arch/arm/boot/dts/tegra30-cardhu.dtsi | 20 + arch/arm/boot/dts/tegra30.dtsi | 70 + arch/arm/configs/tegra_defconfig | 5 +- arch/arm/mach-tegra/Kconfig | 7 +- arch/arm/mach-tegra/Makefile | 3 - arch/arm/mach-tegra/board-harmony-pcie.c | 89 - arch/arm/mach-tegra/board.h | 8 - arch/arm/mach-tegra/iomap.h | 3 - arch/arm/mach-tegra/pcie.c | 886 ---------- arch/arm/mach-tegra/tegra.c | 24 - drivers/pci/host/Kconfig | 4 + drivers/pci/host/Makefile | 1 + drivers/pci/host/pci-tegra.c | 1697 ++++++++++++++++++++ 21 files changed, 2112 insertions(+), 1024 deletions(-) create mode 100644 Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt delete mode 100644 arch/arm/mach-tegra/board-harmony-pcie.c delete mode 100644 arch/arm/mach-tegra/pcie.c create mode 100644 drivers/pci/host/pci-tegra.c
Signature · 1 line
1.8.3.4
PATCH v6 1/14 PCI: tegra: Move PCIe driver to drivers/pci/host
From: Thierry Reding <[email protected]>
Move the PCIe driver from arch/arm/mach-tegra into the drivers/pci/host directory. The motivation is to collect various host controller drivers in the same location in order to facilitate refactoring.
The Tegra PCIe driver has been largely rewritten, both in order to turn
it into a proper platform driver and to add MSI (based on code by
Krishna Kishore <[email protected]>) as well as device tree support.
---
Changes in v2:
- remove Harmony and TrimSlice leftovers
- use symbolic names for interrupt codes
- fix root port reset sequence
- depend on ARCH_TEGRA
- only enable configured root ports
- make regulators mandatory
- fix build with !PCI_MSI
- derive XBAR configuration from nvidia,num-lanes property
- remap configuration space on a per-bus basis
Changes in v3:
- move Tegra30 specific bits into a follow-up patch
- update DT binding to be more spec-conformant
- update for recent OF ranges parser changes
- use new MSI chip infrastructure
Changes in v4:
- update binding documentation as per Stephen's comments
Changes in v5:
- update for latest OF ranges parsing API
- use pci_common_init_dev() instead of pci_common_init()
- add hw_pci.add_bus implementation to attach MSI chip
- fixup any remaining checkpatch warnings
- use define for link active status bit
- move msi_chip structure to the beginning of struct tegra_msi to maybe save some bytes when upcasting
- refactor common code from tegra_pcie_{read,write}_conf()
- don't use potentially dangerous devm_request_irq()
- return IRQ_NONE if the MSI handler doesn't detect any pending interrupts
- don't read AFI_MSI_AXI_BAR_ST when setting up MSI messages (the same data is available in msi->pages)
- request a single page (instead of 8) for the MSI BAR
- return an error when detecting an invalid lane configuration
- remove driver's .remove() function and set .suppress_bind_attrs to prevent the driver from being unbound from the device via sysfs
- add MODULE_AUTHOR, MODULE_DESCRIPTION, MODULE_LICENSE
- export OF device table
- use symbolic constants for interrupts and clocks
Changes in v6:
- drop tegra_pcie_xclk_clamp() usage
.../bindings/pci/nvidia,tegra20-pcie.txt | 161 ++ arch/arm/boot/dts/tegra20.dtsi | 55 + arch/arm/mach-tegra/Kconfig | 7 +- arch/arm/mach-tegra/Makefile | 3 - arch/arm/mach-tegra/board-harmony-pcie.c | 89 -- arch/arm/mach-tegra/board.h | 8 - arch/arm/mach-tegra/iomap.h | 3 - arch/arm/mach-tegra/pcie.c | 886 ----------- arch/arm/mach-tegra/tegra.c | 24 - drivers/pci/host/Kconfig | 4 + drivers/pci/host/Makefile | 1 + drivers/pci/host/pci-tegra.c | 1535 ++++++++++++++++++++ 12 files changed, 1758 insertions(+), 1018 deletions(-) create mode 100644 Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt delete mode 100644 arch/arm/mach-tegra/board-harmony-pcie.c delete mode 100644 arch/arm/mach-tegra/pcie.c create mode 100644 drivers/pci/host/pci-tegra.c
Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt new file +161 -0
@@ -0,0 +1,161 @@ +NVIDIA Tegra PCIe controller + +Required properties: +- compatible: "nvidia,tegra20-pcie" +- device_type: Must be "pci" +- reg: A list of physical base address and length for each set of controller + registers. Must contain an entry for each entry in the reg-names property. +- reg-names: Must include the following entries: + "pads": PADS registers + "afi": AFI registers + "cs": configuration space region +- interrupts: A list of interrupt outputs of the controller. Must contain an + entry for each entry in the interrupt-names property. +- interrupt-names: Must include the following entries: + "intr": The Tegra interrupt that is asserted for controller interrupts + "msi": The Tegra interrupt that is asserted when an MSI is received +- pex-clk-supply: Supply voltage for internal reference clock +- vdd-supply: Power supply for controller (1.05V) +- bus-range: Range of bus numbers associated with this controller +- #address-cells: Address representation for root ports (must be 3) + - cell 0 specifies the bus and device numbers of the root port: + [23:16]: bus number + [15:11]: device number + - cell 1 denotes the upper 32 address bits and should be 0 + - cell 2 contains the lower 32 address bits and is used to translate to the + CPU address space +- #size-cells: Size representation for root ports (must be 2) +- ranges: Describes the translation of addresses for root ports and standard + PCI regions. The entries must be 6 cells each, where the first three cells + correspond to the address as described for the #address-cells property + above, the fourth cell is the physical CPU address to translate to and the + fifth and six cells are as described for the #size-cells property above. + - The first two entries are expected to translate the addresses for the root + port registers, which are referenced by the assigned-addresses property of + the root port nodes (see below). + - The remaining entries setup the mapping for the standard I/O, memory and + prefetchable PCI regions. The first cell determines the type of region + that is setup: + - 0x81000000: I/O memory region + - 0x82000000: non-prefetchable memory region + - 0xc2000000: prefetchable memory region + Please refer to the standard PCI bus binding document for a more detailed + explanation. +- clocks: List of clock inputs of the controller. Must contain an entry for + each entry in the clock-names property. +- clock-names: Must include the following entries: + "pex": The Tegra clock of that name + "afi": The Tegra clock of that name + "pcie_xclk": The Tegra clock of that name + "pll_e": The Tegra clock of that name + +Root ports are defined as subnodes of the PCIe controller node. + +Required properties: +- device_type: Must be "pci" +- assigned-addresses: Address and size of the port configuration registers +- reg: PCI bus address of the root port +- #address-cells: Must be 3 +- #size-cells: Must be 2 +- ranges: Sub-ranges distributed from the PCIe controller node. An empty + property is sufficient. +- nvidia,num-lanes: Number of lanes to use for this port. Valid combinations + are: + - Root port 0 uses 4 lanes, root port 1 is unused. + - Both root ports use 2 lanes. + +Example: + +SoC DTSI: + + pcie-controller { + compatible = "nvidia,tegra20-pcie"; + device_type = "pci"; + reg = <0x80003000 0x00000800 /* PADS registers */ + 0x80003800 0x00000200 /* AFI registers */ + 0x90000000 0x10000000>; /* configuration space */ + reg-names = "pads", "afi", "cs"; + interrupts = <0 98 0x04 /* controller interrupt */ + 0 99 0x04>; /* MSI interrupt */ + interrupt-names = "intr", "msi"; + + bus-range = <0x00 0xff>; + #address-cells = <3>; + #size-cells = <2>; + + ranges = <0x82000000 0 0x80000000 0x80000000 0 0x00001000 /* port 0 registers */ + 0x82000000 0 0x80001000 0x80001000 0 0x00001000 /* port 1 registers */ + 0x81000000 0 0 0x82000000 0 0x00010000 /* downstream I/O */ + 0x82000000 0 0xa0000000 0xa0000000 0 0x10000000 /* non-prefetchable memory */ + 0xc2000000 0 0xb0000000 0xb0000000 0 0x10000000>; /* prefetchable memory */ + + clocks = <&tegra_car 70>, <&tegra_car 72>, <&tegra_car 74>, + <&tegra_car 118>; + clock-names = "pex", "afi", "pcie_xclk", "pll_e"; + status = "disabled"; + + pci@1,0 { + device_type = "pci"; + assigned-addresses = <0x82000800 0 0x80000000 0 0x1000>; + reg = <0x000800 0 0 0 0>; + status = "disabled"; + + #address-cells = <3>; + #size-cells = <2>; + + ranges; + + nvidia,num-lanes = <2>; + }; + + pci@2,0 { + device_type = "pci"; + assigned-addresses = <0x82001000 0 0x80001000 0 0x1000>; + reg = <0x001000 0 0 0 0>; + status = "disabled"; + + #address-cells = <3>; + #size-cells = <2>; + + ranges; + + nvidia,num-lanes = <2>; + }; + }; + + +Board DTS: + + pcie-controller { + status = "okay"; + + vdd-supply = <&pci_vdd_reg>; + pex-clk-supply = <&pci_clk_reg>; + + /* root port 00:01.0 */ + pci@1,0 { + status = "okay"; + + /* bridge 01:00.0 (optional) */ + pci@0,0 { + reg = <0x010000 0 0 0 0>; + + #address-cells = <3>; + #size-cells = <2>; + + device_type = "pci"; + + /* endpoint 02:00.0 */ + pci@0,0 { + reg = <0x020000 0 0 0 0>; + }; + }; + }; + }; + +Note that devices on the PCI bus are dynamically discovered using PCI's bus +enumeration and therefore don't need corresponding device nodes in DT. However +if a device on the PCI bus provides a non-probeable bus such as I2C or SPI, +device nodes need to be added in order to allow the bus' children to be +instantiated at the proper location in the operating system's device tree (as +illustrated by the optional nodes in the example above).
arch/arm/boot/dts/tegra20.dtsi +55 -0
61 lines not on this page · raw message
arch/arm/mach-tegra/Kconfig +2 -5
@@ -21,6 +21,8 @@ config ARCH_TEGRA select USB_ULPI if USB_PHY select USB_ULPI_VIEWPORT if USB_PHY select USE_OF + select MIGHT_HAVE_PCI + select ARCH_SUPPORTS_MSI help This enables support for NVIDIA Tegra based systems.
@@ -60,11 +62,6 @@ config ARCH_TEGRA_114_SOC Support for NVIDIA Tegra T114 processor family, based on the ARM CortexA15MP CPU -config TEGRA_PCI - bool "PCI Express support" - depends on ARCH_TEGRA_2x_SOC - select PCI - config TEGRA_AHB bool "Enable AHB driver for NVIDIA Tegra SoCs" default y
arch/arm/mach-tegra/Makefile +0 -3
@@ -27,7 +27,6 @@ obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += cpuidle-tegra30.o endif obj-$(CONFIG_SMP) += platsmp.o headsmp.o obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o -obj-$(CONFIG_TEGRA_PCI) += pcie.o obj-$(CONFIG_ARCH_TEGRA_114_SOC) += tegra114_speedo.o obj-$(CONFIG_ARCH_TEGRA_114_SOC) += sleep-tegra30.o
@@ -35,6 +34,4 @@ ifeq ($(CONFIG_CPU_IDLE),y) obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o endif -obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-harmony-pcie.o - obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-paz00.o
arch/arm/mach-tegra/board-harmony-pcie.c deleted +0 -89
89 lines not on this page · raw message
arch/arm/mach-tegra/board.h +0 -8
@@ -31,7 +31,6 @@ void __init tegra_init_early(void);void __init tegra_map_common_io (void );void __init tegra_init_irq (void );void __init tegra_dt_init_irq (void ); -int __init tegra_pcie_init (bool init_port0,bool init_port1);void tegra_init_late (void );
@@ -48,13 +47,6 @@ int __init tegra_powergate_debugfs_init(void);static inline int tegra_powergate_debugfs_init (void ) {return 0 ; }#endif -int __init harmony_regulator_init (void ); -#ifdef CONFIG_TEGRA_PCI -int __init harmony_pcie_init (void ); -#else -static inline int harmony_pcie_init (void ) {return 0 ; } -#endif -void __init tegra_paz00_wifikill_init (void );#endif
arch/arm/mach-tegra/iomap.h +0 -3
@@ -278,9 +278,6 @@#define IO_APB_VIRT IOMEM(0xFE300000)#define IO_APB_SIZE SZ_1M -#define TEGRA_PCIE_BASE 0x80000000 -#define TEGRA_PCIE_IO_BASE (TEGRA_PCIE_BASE + SZ_4M) -#define IO_TO_VIRT_BETWEEN (p, st, sz) ((p) >= (st) && (p) < ((st) + (sz)))#define IO_TO_VIRT_XLATE (p, pst, vst) (((p) - (pst) + (vst)))
arch/arm/mach-tegra/pcie.c deleted +0 -886
886 lines not on this page · raw message
arch/arm/mach-tegra/tegra.c +0 -24
@@ -80,28 +80,6 @@ out:of_platform_populate (NULL , of_default_bus_match_table,NULL , parent); } -static void __init trimslice_init (void ) -{ -#ifdef CONFIG_TEGRA_PCI -int ret; - - ret =tegra_pcie_init (true, true); -if (ret) -pr_err ("tegra_pci_init() failed: %d\n" , ret); -#endif -} - -static void __init harmony_init (void ) -{ -#ifdef CONFIG_TEGRA_PCI -int ret; - - ret =harmony_pcie_init (); -if (ret) -pr_err ("harmony_pcie_init() failed: %d\n" , ret); -#endif -} -static void __init paz00_init (void ) {if (IS_ENABLED (CONFIG_ARCH_TEGRA_2x_SOC))
@@ -112,8 +90,6 @@ static struct {char *machine;void (*init)(void ); } board_init_funcs[] = { - { "compulab,trimslice", trimslice_init }, - { "nvidia,harmony", harmony_init }, { "compal,paz00", paz00_init }, };
drivers/pci/host/Kconfig +4 -0
@@ -14,4 +14,8 @@ config PCI_EXYNOS select PCIEPORTBUS select PCIE_DW +config PCI_TEGRA + bool "NVIDIA Tegra PCIe controller" + depends on ARCH_TEGRA + endmenu
drivers/pci/host/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o obj-$(CONFIG_PCIE_DW) += pcie-designware.o +obj-$(CONFIG_PCI_TEGRA) += pci-tegra.o
drivers/pci/host/pci-tegra.c new file +1535 -0
1,535 lines not on this page · raw message
Signature · 1 line
1.8.3.4
PATCH v6 2/14 ARM: tegra: tamonten: Add PCIe support
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Add properties common to all Tamonten-derived boards to the Tamonten DTSI and add the fixed 1.05 V regulator.
---
Changes in v2:
- add properties common to all Tamonten boards
- add fixed 1.05 V regulator
arch/arm/boot/dts/tegra20-tamonten.dtsi | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
arch/arm/boot/dts/tegra20-tamonten.dtsi +16 -1
@@ -366,7 +366,7 @@ regulator-always-on; }; - ldo0 { + pci_clk_reg: ldo0 { regulator-name = "vdd_ldo0,vddio_pex_clk"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>;
@@ -467,6 +467,11 @@ nvidia,sys-clock-req-active-high; }; + pcie-controller { + pex-clk-supply = <&pci_clk_reg>; + vdd-supply = <&pci_vdd_reg>; + }; + usb@c5008000 { status = "okay"; };
@@ -509,5 +514,15 @@ regulator-max-microvolt = <5000000>; regulator-always-on; }; + + pci_vdd_reg: regulator@1 { + compatible = "regulator-fixed"; + reg = <1>; + regulator-name = "vdd_1v05"; + regulator-min-microvolt = <1050000>; + regulator-max-microvolt = <1050000>; + gpio = <&pmic 2 0>; + enable-active-high; + }; }; };
Signature · 1 line
1.8.3.4
PATCH v6 3/14 ARM: tegra: tec: Add PCIe support
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Enable the first PCIe root port which is connected to an FPGA on the Tamonten Evaluation Carrier and add device nodes for each of the PCI endpoints available in the standard configuration.
---
Changes in v2:
- remove duplicate nodes and properties defined in tegra20-tamonten.dtsi
Changes in v3:
- remove PCIe endpoint device tree nodes, all devices can be discovered via standard PCI enumeration
arch/arm/boot/dts/tegra20-tec.dts | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/tegra20-tec.dts +8 -0
@@ -32,6 +32,14 @@ }; }; + pcie-controller { + status = "okay"; + + pci@1,0 { + status = "okay"; + }; + }; + sound { compatible = "ad,tegra-audio-wm8903-tec", "nvidia,tegra-audio-wm8903";
Signature · 1 line
1.8.3.4
PATCH v6 4/14 ARM: tegra: harmony: Initialize PCIe from DT
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
With the device tree support in place, probe the PCIe controller from the device tree and remove the corresponding workaround in the board file.
--- arch/arm/boot/dts/tegra20-harmony.dts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
arch/arm/boot/dts/tegra20-harmony.dts +16 -4
@@ -335,7 +335,7 @@ regulator-always-on; }; - ldo0 { + pci_clk_reg: ldo0 { regulator-name = "vdd_ldo0,vddio_pex_clk"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>;
@@ -425,6 +425,20 @@ nvidia,sys-clock-req-active-high; }; + pcie-controller { + pex-clk-supply = <&pci_clk_reg>; + vdd-supply = <&pci_vdd_reg>; + status = "okay"; + + pci@1,0 { + status = "okay"; + }; + + pci@2,0 { + status = "okay"; + }; + }; + usb@c5000000 { status = "okay"; };
@@ -643,7 +657,7 @@ enable-active-high; }; - regulator@3 { + pci_vdd_reg: regulator@3 { compatible = "regulator-fixed"; reg = <3>; regulator-name = "vdd_1v05";
@@ -651,8 +665,6 @@ regulator-max-microvolt = <1050000>; gpio = <&pmic 2 GPIO_ACTIVE_HIGH>; enable-active-high; - /* Hack until board-harmony-pcie.c is removed */ - status = "disabled"; }; regulator@4 {
Signature · 1 line
1.8.3.4
PATCH v6 5/14 ARM: tegra: trimslice: Initialize PCIe from DT
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
With the device tree support in place, probe the PCIe controller from the device tree and remove the corresponding workaround in the board file.
---
Changes in v2:
- add missing dummy regulator nodes by Stephen Warren
- rename port 0 DT node and disable unused port 1
arch/arm/boot/dts/tegra20-trimslice.dts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
arch/arm/boot/dts/tegra20-trimslice.dts +28 -0
@@ -310,6 +310,16 @@ nvidia,sys-clock-req-active-high; }; + pcie-controller { + status = "okay"; + pex-clk-supply = <&pci_clk_reg>; + vdd-supply = <&pci_vdd_reg>; + + pci@1,0 { + status = "okay"; + }; + }; + usb@c5000000 { status = "okay"; };
@@ -412,6 +422,24 @@ enable-active-high; gpio = <&gpio TEGRA_GPIO(V, 2) 0>; }; + + pci_clk_reg: regulator@3 { + compatible = "regulator-fixed"; + reg = <3>; + regulator-name = "pci_clk"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + pci_vdd_reg: regulator@4 { + compatible = "regulator-fixed"; + reg = <4>; + regulator-name = "pci_vdd"; + regulator-min-microvolt = <1050000>; + regulator-max-microvolt = <1050000>; + regulator-always-on; + }; }; sound {
Signature · 1 line
1.8.3.4
PATCH v6 6/14 PCI: tegra: Add Tegra 30 PCIe support
In reply to Thierry RedingFrom: Jay Agarwal <[email protected]>
Introduce a data structure to parameterize the driver according to SoC generation, add Tegra30 specific code and update the device tree binding document for Tegra30 support.
--- .../bindings/pci/nvidia,tegra20-pcie.txt | 4 +- drivers/pci/host/pci-tegra.c | 209 +++++++++++++++++---- 2 files changed, 179 insertions(+), 34 deletions(-)
Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt +3 -1
@@ -1,7 +1,7 @@ NVIDIA Tegra PCIe controller Required properties: -- compatible: "nvidia,tegra20-pcie" +- compatible: "nvidia,tegra20-pcie" or "nvidia,tegra30-pcie" - device_type: Must be "pci" - reg: A list of physical base address and length for each set of controller registers. Must contain an entry for each entry in the reg-names property.
@@ -16,6 +16,7 @@ Required properties: "msi": The Tegra interrupt that is asserted when an MSI is received - pex-clk-supply: Supply voltage for internal reference clock - vdd-supply: Power supply for controller (1.05V) +- avdd-supply: Power supply for controller (1.05V) (not required for Tegra20) - bus-range: Range of bus numbers associated with this controller - #address-cells: Address representation for root ports (must be 3) - cell 0 specifies the bus and device numbers of the root port:
@@ -48,6 +49,7 @@ Required properties: "afi": The Tegra clock of that name "pcie_xclk": The Tegra clock of that name "pll_e": The Tegra clock of that name + "cml": The Tegra clock of that name (not required for Tegra20) Root ports are defined as subnodes of the PCIe controller node.
drivers/pci/host/pci-tegra.c +176 -33
434 lines not on this page · raw message
Signature · 1 line
1.8.3.4
PATCH v6 7/14 PCI: tegra: set up PADS_REFCLK_CFG1
In reply to Thierry RedingFrom: Stephen Warren <[email protected]>
The registers PADS_REFCLK_CFG are an array of 16-bit data, one entry per PCIe root port. For Tegra30, we therefore need to write a 3rd entry in this array. Doing so mays the mini-PCIe slot on Beaver operate correctly.
While we're at it, add some #defines to partially document the fields within these 16-bit values.
--- drivers/pci/host/pci-tegra.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/pci/host/pci-tegra.c +24 -5
@@ -195,6 +195,25 @@#define PADS_REFCLK_CFG0 0x000000C8#define PADS_REFCLK_CFG1 0x000000CC +/* +* Fields in PADS_REFCLK_CFG*. Those registers form an array of 16-bit +* entries, one entry per PCIe port. These field definitions and desired +* values aren't in the TRM, but do come from NVIDIA. +*/ +#define PADS_REFCLK_CFG_TERM_SHIFT 2/* 6:2 */ +#define PADS_REFCLK_CFG_E_TERM_SHIFT 7 +#define PADS_REFCLK_CFG_PREDI_SHIFT 8/* 11:8 */ +#define PADS_REFCLK_CFG_DRVI_SHIFT 12/* 15:12 */ + +/* Default value provided by HW engineering is 0xfa5c */ +#define PADS_REFCLK_CFG_VALUE \ + ( \ + (0x17 << PADS_REFCLK_CFG_TERM_SHIFT) | \ + (0 << PADS_REFCLK_CFG_E_TERM_SHIFT) | \ + (0xa << PADS_REFCLK_CFG_PREDI_SHIFT) | \ + (0xf << PADS_REFCLK_CFG_DRVI_SHIFT) \ + ) +struct tegra_msi {struct msi_chip chip; DECLARE_BITMAP(used, INT_PCI_MSI_NR);
@@ -808,11 +827,11 @@ static int tegra_pcie_enable_controller(struct tegra_pcie *pcie) value |=PADS_PLL_CTL_RST_B4SM ;pads_writel (pcie, value, soc->pads_pll_ctl); -/* -* Hack, set the clock voltage to the DEFAULT provided by hw folks. -* This doesn't exist in the documentation. -*/ -pads_writel (pcie,0xfa5cfa5c ,PADS_REFCLK_CFG0 ); +/* Configure the reference clock driver */ + value =PADS_REFCLK_CFG_VALUE | (PADS_REFCLK_CFG_VALUE <<16 ); +pads_writel (pcie, value,PADS_REFCLK_CFG0 ); +if (soc->num_ports >2 ) +pads_writel (pcie,PADS_REFCLK_CFG_VALUE ,PADS_REFCLK_CFG1 );/* wait for the PLL to lock */ timeout =300 ;
Signature · 1 line
1.8.3.4
PATCH v6 8/14 ARM: tegra: Add Tegra30 PCIe support
In reply to Thierry RedingAdd the top-level pcie-controller node for the Tegra30 SoC. Tegra30 has three root ports that can use different lane layouts.
---
Changes in v5:
- use symbolic constants for interrupts and clocks
arch/arm/boot/dts/tegra30.dtsi | 70 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
arch/arm/boot/dts/tegra30.dtsi +70 -0
@@ -16,6 +16,76 @@ serial4 = &uarte; }; + pcie-controller { + compatible = "nvidia,tegra30-pcie"; + device_type = "pci"; + reg = <0x00003000 0x00000800 /* PADS registers */ + 0x00003800 0x00000200 /* AFI registers */ + 0x10000000 0x10000000>; /* configuration space */ + reg-names = "pads", "afi", "cs"; + interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH /* controller interrupt */ + GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>; /* MSI interrupt */ + interrupt-names = "intr", "msi"; + + bus-range = <0x00 0xff>; + #address-cells = <3>; + #size-cells = <2>; + + ranges = <0x82000000 0 0x00000000 0x00000000 0 0x00001000 /* port 0 configuration space */ + 0x82000000 0 0x00001000 0x00001000 0 0x00001000 /* port 1 configuration space */ + 0x82000000 0 0x00004000 0x00004000 0 0x00001000 /* port 2 configuration space */ + 0x81000000 0 0 0x02000000 0 0x00010000 /* downstream I/O */ + 0x82000000 0 0x20000000 0x20000000 0 0x10000000 /* non-prefetchable memory */ + 0xc2000000 0 0x30000000 0x30000000 0 0x10000000>; /* prefetchable memory */ + + clocks = <&tegra_car TEGRA30_CLK_PCIE>, + <&tegra_car TEGRA30_CLK_AFI>, + <&tegra_car TEGRA30_CLK_PCIEX>, + <&tegra_car TEGRA30_CLK_PLL_E>, + <&tegra_car TEGRA30_CLK_CML0>; + clock-names = "pex", "afi", "pcie_xclk", "pll_e", "cml"; + status = "disabled"; + + pci@1,0 { + device_type = "pci"; + assigned-addresses = <0x82000800 0 0x00000000 0 0x1000>; + reg = <0x000800 0 0 0 0>; + status = "disabled"; + + #address-cells = <3>; + #size-cells = <2>; + ranges; + + nvidia,num-lanes = <2>; + }; + + pci@2,0 { + device_type = "pci"; + assigned-addresses = <0x82001000 0 0x00001000 0 0x1000>; + reg = <0x001000 0 0 0 0>; + status = "disabled"; + + #address-cells = <3>; + #size-cells = <2>; + ranges; + + nvidia,num-lanes = <2>; + }; + + pci@3,0 { + device_type = "pci"; + assigned-addresses = <0x82001800 0 0x00004000 0 0x1000>; + reg = <0x001800 0 0 0 0>; + status = "disabled"; + + #address-cells = <3>; + #size-cells = <2>; + ranges; + + nvidia,num-lanes = <2>; + }; + }; + host1x { compatible = "nvidia,tegra30-host1x", "simple-bus"; reg = <0x50000000 0x00024000>;
Signature · 1 line
1.8.3.4
PATCH v6 9/14 ARM: tegra: Enable PCIe controller on Cardhu
In reply to Thierry RedingFrom: Jay Agarwal <[email protected]>
Root port 2 is routed to the bottom connector on Cardhu and is used by the development dock to provide gigabit ethernet and USB functionality.
--- arch/arm/boot/dts/tegra30-cardhu.dtsi | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
arch/arm/boot/dts/tegra30-cardhu.dtsi +20 -0
@@ -31,6 +31,26 @@ reg = <0x80000000 0x40000000>; }; + pcie-controller { + status = "okay"; + pex-clk-supply = <&pex_hvdd_3v3_reg>; + vdd-supply = <&ldo1_reg>; + avdd-supply = <&ldo2_reg>; + + pci@1,0 { + nvidia,num-lanes = <4>; + }; + + pci@2,0 { + nvidia,num-lanes = <1>; + }; + + pci@3,0 { + status = "okay"; + nvidia,num-lanes = <1>; + }; + }; + pinmux { pinctrl-names = "default"; pinctrl-0 = <&state_default>;
Signature · 1 line
1.8.3.4
PATCH v6 10/14 ARM: tegra: Enable PCIe controller on Beaver
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
PCIe lane 0 is connected to an onboard Gigabit Ethernet (RTL8168evl) and lane 4 is routed to the board's miniPCIe slot.
--- arch/arm/boot/dts/tegra30-beaver.dts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
arch/arm/boot/dts/tegra30-beaver.dts +21 -0
@@ -10,6 +10,27 @@ reg = <0x80000000 0x7ff00000>; }; + pcie-controller { + status = "okay"; + pex-clk-supply = <&sys_3v3_pexs_reg>; + vdd-supply = <&ldo1_reg>; + avdd-supply = <&ldo2_reg>; + + pci@1,0 { + status = "okay"; + nvidia,num-lanes = <4>; + }; + + pci@2,0 { + status = "okay"; + nvidia,num-lanes = <1>; + }; + + pci@3,0 { + nvidia,num-lanes = <1>; + }; + }; + pinmux { pinctrl-names = "default"; pinctrl-0 = <&state_default>;
Signature · 1 line
1.8.3.4
PATCH v6 11/14 ARM: tegra: Fix Beaver's PCIe lane configuration
In reply to Thierry RedingFrom: Stephen Warren <[email protected]>
Beaver's PCIe lane configuration most closely matches x2 x2 x2 rather than x4 x1 x1, since clocks 0 and 2 are used, and lanes 0 and 5 are used, and the only way those align is with a x2 x2 x2 configuration.
Also, disable root port 1; there's nothing connected to it. Root port 0 is the on-board PCIe Ethernet, and port 2 is the mini-PCIe slot.
--- arch/arm/boot/dts/tegra30-beaver.dts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/tegra30-beaver.dts +4 -4
@@ -18,16 +18,16 @@ pci@1,0 { status = "okay"; - nvidia,num-lanes = <4>; + nvidia,num-lanes = <2>; }; pci@2,0 { - status = "okay"; - nvidia,num-lanes = <1>; + nvidia,num-lanes = <2>; }; pci@3,0 { - nvidia,num-lanes = <1>; + status = "okay"; + nvidia,num-lanes = <2>; }; };
Signature · 1 line
1.8.3.4
PATCH v6 12/14 ARM: tegra: Update default configuration (PCIe)
In reply to Thierry RedingEnable PCI and MSI support as well as the new Tegra PCIe controller driver.
---
Changes in v5:
- enable PCI Express support (CONFIG_PCIEPORTBUS)
arch/arm/configs/tegra_defconfig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/configs/tegra_defconfig +4 -1
@@ -27,8 +27,11 @@ CONFIG_ARCH_TEGRA=y CONFIG_ARCH_TEGRA_2x_SOC=y CONFIG_ARCH_TEGRA_3x_SOC=y CONFIG_ARCH_TEGRA_114_SOC=y -CONFIG_TEGRA_PCI=y CONFIG_TEGRA_EMC_SCALING_ENABLE=y +CONFIG_PCI=y +CONFIG_PCI_MSI=y +CONFIG_PCI_TEGRA=y +CONFIG_PCIEPORTBUS=y CONFIG_SMP=y CONFIG_PREEMPT=y CONFIG_AEABI=y
Signature · 1 line
1.8.3.4
PATCH v6 13/14 ARM: dts: tegra: Increase prefetchable PCI memory space
In reply to Thierry RedingFrom: Jay Agarwal <[email protected]>
Instead of evenly splitting the 512 MiB area between prefetchable and non-prefetchable memory spaces, increase the prefetchable memory space to 384 MiB while at the same time decreasing the non-prefetchable memory space to 128 MiB. This is a more useful default as most PCIe devices require more prefetchable than non-prefetchable memory.
--- arch/arm/boot/dts/tegra20.dtsi | 4 ++-- arch/arm/boot/dts/tegra30.dtsi | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/tegra20.dtsi +2 -2
@@ -473,8 +473,8 @@ ranges = <0x82000000 0 0x80000000 0x80000000 0 0x00001000 /* port 0 registers */ 0x82000000 0 0x80001000 0x80001000 0 0x00001000 /* port 1 registers */ 0x81000000 0 0 0x82000000 0 0x00010000 /* downstream I/O */ - 0x82000000 0 0xa0000000 0xa0000000 0 0x10000000 /* non-prefetchable memory */ - 0xc2000000 0 0xb0000000 0xb0000000 0 0x10000000>; /* prefetchable memory */ + 0x82000000 0 0xa0000000 0xa0000000 0 0x08000000 /* non-prefetchable memory */ + 0xc2000000 0 0xa8000000 0xa8000000 0 0x18000000>; /* prefetchable memory */ clocks = <&tegra_car TEGRA20_CLK_PEX>, <&tegra_car TEGRA20_CLK_AFI>,
arch/arm/boot/dts/tegra30.dtsi +2 -2
@@ -35,8 +35,8 @@ 0x82000000 0 0x00001000 0x00001000 0 0x00001000 /* port 1 configuration space */ 0x82000000 0 0x00004000 0x00004000 0 0x00001000 /* port 2 configuration space */ 0x81000000 0 0 0x02000000 0 0x00010000 /* downstream I/O */ - 0x82000000 0 0x20000000 0x20000000 0 0x10000000 /* non-prefetchable memory */ - 0xc2000000 0 0x30000000 0x30000000 0 0x10000000>; /* prefetchable memory */ + 0x82000000 0 0x20000000 0x20000000 0 0x08000000 /* non-prefetchable memory */ + 0xc2000000 0 0x28000000 0x28000000 0 0x18000000>; /* prefetchable memory */ clocks = <&tegra_car TEGRA30_CLK_PCIE>, <&tegra_car TEGRA30_CLK_AFI>,
Signature · 1 line
1.8.3.4
PATCH v6 14/14 MAINTAINERS: Add myself as Tegra PCIe maintainer
In reply to Thierry RedingI'll be taking on maintainership of the Tegra PCIe driver since it's now moved out of arch/arm/mach-tegra.
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -6287,6 +6287,13 @@ F: Documentation/PCI/ F: drivers/pci/ F: include/linux/pci* +PCI DRIVER FOR NVIDIA TEGRA +M: Thierry Reding <[email protected]> +L: [email protected] +S: Supported +F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt +F: drivers/pci/host/pci-tegra.c + PCMCIA SUBSYSTEM P: Linux PCMCIA Team L: [email protected]
Signature · 1 line
1.8.3.4
Re: [PATCH v6 14/14] MAINTAINERS: Add myself as Tegra PCIe maintainer
Quoted 4 lines · Thierry Reding
I'll be taking on maintainership of the Tegra PCIe driver since it's now moved out of
arch/arm/mach-tegra.Signed-off-by Thierry Reding <[email protected]>
Quoted 25 lines
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)MAINTAINERS +7
-1@@ -6287,6 +6287,13 @@ F: Documentation/PCI/ F: drivers/pci/ F: include/linux/pci* +PCI DRIVER FOR NVIDIA TEGRA +M: Thierry Reding <[email protected]> +L: [email protected] +S: Supported +F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt +F: drivers/pci/host/pci-tegra.c + PCMCIA SUBSYSTEM P: Linux PCMCIA Team L: [email protected] --1.8.3.4
Quoted 8 lines · Thierry Reding
Hi Stephen,
This is the latest version of the Tegra PCIe driver patch series. I've dropped the PCI xclk clamping code as discussed and successfully tested on Beaver. The patches that touch the PCI subsystem have Bjorn's Acked-by and I've tested this on top of next-20130809, which has Jason's common branch. Once he's comfortable with making the branch stable you should be able to merge that branch and apply these patches on top.
Just an FYI, I'm mostly happy with what we have now, except that I'd like to confirm that the build failure Randy discovered isn't caused by us:
Randy wrote some time later:
Quoted 9 lines · Stephen Rothwell
Quoted 4 lines
Hi all,
Changes since 20130807:
on i386 and
x86_64:
whenCONFIG_PCI_MSIis not enabled:
Quoted 6 lines
There are many of these errors:
include/linux/msi.h:65:6: error: expected identifier or '(' before 'void'include/linux/msi.h:65:6: error: expected ')' before numeric constantbecause
arch/x86/include/asm/pci.hdefines:
#definedefault_teardown_msi_irqsNULL
I'm having a helluva time reproducing it :(
The next run of linux-next isn't until Sunday evening (AUS Monday morning), so we have some time to figure it out.
Also, I've renamed the branch mvebu/msi_pci to more accurately describe the changes it contains.
thx,
Jason.
Quoted 31 lines · Jason Cooper
Quoted 8 lines · Thierry Reding
Hi Stephen,
This is the latest version of the Tegra PCIe driver patch series. I've dropped the PCI xclk clamping code as discussed and successfully tested on Beaver. The patches that touch the PCI subsystem have Bjorn's Acked-by and I've tested this on top of next-20130809, which has Jason's common branch. Once he's comfortable with making the branch stable you should be able to merge that branch and apply these patches on top.
Just an FYI, I'm mostly happy with what we have now, except that I'd like to confirm that the build failure Randy discovered isn't caused by us:
Randy wrote some time later:
Quoted 9 lines · Stephen Rothwell
Quoted 4 lines
Hi all,
Changes since 20130807:
on i386 and
x86_64:
whenCONFIG_PCI_MSIis not enabled:Quoted 6 lines
There are many of these errors:
include/linux/msi.h:65:6: error: expected identifier or '(' before 'void'include/linux/msi.h:65:6: error: expected ')' before numeric constantbecause
arch/x86/include/asm/pci.hdefines:
#definedefault_teardown_msi_irqsNULL
Quoted 7 lines
I'm having a helluva time reproducing it :(
The next run of linux-next isn't until Sunday evening (AUS Monday morning), so we have some time to figure it out.
Also, I've renamed the branch mvebu/msi_pci to more accurately describe the changes it contains.
Has there been any progress on this? If not I'll take a look at it tomorrow.
Thierry
Quoted 34 lines · Thierry Reding
Quoted 33 lines · Jason Cooper
Quoted 8 lines · Thierry Reding
Hi Stephen,
This is the latest version of the Tegra PCIe driver patch series. I've dropped the PCI xclk clamping code as discussed and successfully tested on Beaver. The patches that touch the PCI subsystem have Bjorn's Acked-by and I've tested this on top of next-20130809, which has Jason's common branch. Once he's comfortable with making the branch stable you should be able to merge that branch and apply these patches on top.
Just an FYI, I'm mostly happy with what we have now, except that I'd like to confirm that the build failure Randy discovered isn't caused by us:
Randy wrote some time later:
Quoted 9 lines · Stephen Rothwell
Quoted 4 lines
Hi all,
Changes since 20130807:
on i386 and
x86_64:
whenCONFIG_PCI_MSIis not enabled:Quoted 6 lines
There are many of these errors:
include/linux/msi.h:65:6: error: expected identifier or '(' before 'void'include/linux/msi.h:65:6: error: expected ')' before numeric constantbecause
arch/x86/include/asm/pci.hdefines:
#definedefault_teardown_msi_irqsNULLI'm having a helluva time reproducing it :(
Quoted 8 lines
Quoted 5 lines
The next run of linux-next isn't until Sunday evening (AUS Monday morning), so we have some time to figure it out.
Also, I've renamed the branch mvebu/msi_pci to more accurately describe the changes it contains.
Has there been any progress on this? If not I'll take a look at it tomorrow.
Yes, Thomas fixed it by properly implementing weak across the archs. I got wrapped around the axle yesterday, so I'm working on it today. Should have a stable branch for you in an hour or so.
thx,
Jason.
Quoted 8 lines · Thierry Reding
Hi Stephen,
This is the latest version of the Tegra PCIe driver patch series. I've dropped the PCI xclk clamping code as discussed and successfully tested on Beaver. The patches that touch the PCI subsystem have Bjorn's Acked-by and I've tested this on top of next-20130809, which has Jason's common branch. Once he's comfortable with making the branch stable you should be able to merge that branch and apply these patches on top.
I have applied this series, as follows:
* All code changes to Tegra's for-3.12/soc branch.
* All *.dts* changes to Tegra's for-3.12/dt branch.
* All defconfig changes to Tegra's for-3.12/defconfig branch.
I split patch 1/14 into separate code and DT changes in order to achieve the split above. I hope you don't mind. It shouldn't affect bisectability, since (a) PCIe support wasn't really useful before this series anyway, and (b) the board *.dts changes were separate patches anyway, so it wasn't quite fully bisectable in the first place.
Thanks.