Skip to contentSkip to conversation

Add support for PCIe endpoint mode in Tegra194

PATCH Applied Vidya Sagar 6 participants 16 messages Mar 3, 2020 – Mar 31, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v5 cover Add support for PCIe endpoint mode in Tegra194

Tegra194 has three (C0, C4 & C5) dual mode PCIe controllers that can operate either in root port mode or in end point mode but only in one mode at a time. Platform P2972-0000 supports enabling endpoint mode for C5 controller. This patch series adds support for PCIe endpoint mode in both the driver as well as in DT.
This patch series depends on the changes made for Synopsys DesignWare endpoint mode subsystem that are recently accepted.
@ https://patchwork.kernel.org/project/linux-pci/list/?series=202211
which in turn depends on the patch made by Kishon
@ https://patchwork.kernel.org/patch/10975123/
which is also under review.

V5:
* Rebased patch-2 on top of Lorenzo's pci/endpoint branch
* Removed unwanted header files inclusion in patch-5

V4:
* Started using threaded irqs instead of kthreads

V3:
* Re-ordered patches in the series to make the driver change as the last patch
* Took care of Thierry's review comments

V2:
* Addressed Thierry & Bjorn's review comments
* Added EP mode specific binding documentation to already existing binding documentation file
* Removed patch that enables GPIO controller nodes explicitly as they are enabled already

Vidya Sagar (5):
soc/tegra: bpmp: Update ABI header
dt-bindings: PCI: tegra: Add DT support for PCIe EP nodes in Tegra194
arm64: tegra: Add PCIe endpoint controllers nodes for Tegra194
arm64: tegra: Add support for PCIe endpoint mode in P2972-0000
platform
PCI: tegra: Add support for PCIe endpoint mode in Tegra194

 .../bindings/pci/nvidia,tegra194-pcie.txt     | 125 +++-
 .../boot/dts/nvidia/tegra194-p2972-0000.dts   |  18 +
 arch/arm64/boot/dts/nvidia/tegra194.dtsi      |  99 +++
 drivers/pci/controller/dwc/Kconfig            |  30 +-
 drivers/pci/controller/dwc/pcie-tegra194.c    | 679 +++++++++++++++++-
 include/soc/tegra/bpmp-abi.h                  |  10 +-
 6 files changed, 916 insertions(+), 45 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v5 1/5 soc/tegra: bpmp: Update ABI header

Update the firmware header to support uninitialization of UPHY PLL when the PCIe controller is operating in endpoint mode and host cuts the PCIe reference clock.

---
V5:
* None

V4:
* None

V3:
* Added Acked-by: Thierry Reding <[email protected]>

V2:
* Changed Copyright year from 2019 to 2020

 include/soc/tegra/bpmp-abi.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
include/soc/tegra/bpmp-abi.h +9 -1
index cac6f610b3fe..8f8e73e5cd45 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2014-2018, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2014-2020, NVIDIA CORPORATION.  All rights reserved.
  */
 
 #ifndef _ABI_BPMP_ABI_H_
@@ -2119,6 +2119,7 @@ enum {
 	CMD_UPHY_PCIE_LANE_MARGIN_STATUS = 2,
 	CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT = 3,
 	CMD_UPHY_PCIE_CONTROLLER_STATE = 4,
+	CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF = 5,
 	CMD_UPHY_MAX,
 };
 
@@ -2151,6 +2152,11 @@ struct cmd_uphy_pcie_controller_state_request {
 	uint8_t enable;
 } __ABI_PACKED;
 
+struct cmd_uphy_ep_controller_pll_off_request {
+	/** @brief EP controller number, valid: 0, 4, 5 */
+	uint8_t ep_controller;
+} __ABI_PACKED;
+
 /**
  * @ingroup UPHY
  * @brief Request with #MRQ_UPHY
@@ -2165,6 +2171,7 @@ struct cmd_uphy_pcie_controller_state_request {
  * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS     |                                        |
  * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT |cmd_uphy_ep_controller_pll_init_request |
  * |CMD_UPHY_PCIE_CONTROLLER_STATE       |cmd_uphy_pcie_controller_state_request  |
+ * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF  |cmd_uphy_ep_controller_pll_off_request  |
  *
  */
 
@@ -2178,6 +2185,7 @@ struct mrq_uphy_request {
 		struct cmd_uphy_margin_control_request uphy_set_margin_control;
 		struct cmd_uphy_ep_controller_pll_init_request ep_ctrlr_pll_init;
 		struct cmd_uphy_pcie_controller_state_request controller_state;
+		struct cmd_uphy_ep_controller_pll_off_request ep_ctrlr_pll_off;
 	} __UNION_ANON;
 } __ABI_PACKED;
 
Signature · 1 line
2.17.1
#2 lore raw

PATCH v5 2/5 dt-bindings: PCI: tegra: Add DT support for PCIe EP nodes in Tegra194

In reply to Vidya Sagar

Add support for PCIe controllers that can operate in endpoint mode in Tegra194.

---
V5:
* Added Acked-by: Thierry Reding <[email protected]>
* Rebased on top of Lorenzo's pci/endpoint branch

V4:
* None

V3:
* Added Reviewed-by: Rob Herring <[email protected]>

V2:
* Addressed Thierry's review comments
* Merged EP specific information from tegra194-pcie-ep.txt to tegra194-pcie.txt itself
* Started using the standard 'reset-gpios' for PERST GPIO
* Added 'nvidia,refclk-select-gpios' to enable REFCLK signals

 .../bindings/pci/nvidia,tegra194-pcie.txt     | 125 ++++++++++++++----
 1 file changed, 99 insertions(+), 26 deletions(-)
Documentation/devicetree/bindings/pci/nvidia,tegra194-pcie.txt +99 -26
index b739f92da58e..faa3ef5adfbb 100644
@@ -1,11 +1,11 @@
 NVIDIA Tegra PCIe controller (Synopsys DesignWare Core based)
 
-This PCIe host controller is based on the Synopsis Designware PCIe IP
+This PCIe controller is based on the Synopsis Designware PCIe IP
 and thus inherits all the common properties defined in designware-pcie.txt.
+Some of the controller instances are dual mode where in they can work either
+in root port mode or endpoint mode but one at a time.
 
 Required properties:
-- compatible: For Tegra19x, must contain "nvidia,tegra194-pcie".
-- device_type: Must be "pci"
 - power-domains: A phandle to the node that controls power to the respective
   PCIe controller and a specifier name for the PCIe controller. Following are
   the specifiers for the different PCIe controllers
@@ -32,6 +32,32 @@ Required properties:
   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
+- clocks: Must contain an entry for each entry in clock-names.
+  See ../clocks/clock-bindings.txt for details.
+- clock-names: Must include the following entries:
+  - core
+- resets: Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names: Must include the following entries:
+  - apb
+  - core
+- phys: Must contain a phandle to P2U PHY for each entry in phy-names.
+- phy-names: Must include an entry for each active lane.
+  "p2u-N": where N ranges from 0 to one less than the total number of lanes
+- nvidia,bpmp: Must contain a pair of phandle to BPMP controller node followed
+  by controller-id. Following are the controller ids for each controller.
+    0: C0
+    1: C1
+    2: C2
+    3: C3
+    4: C4
+    5: C5
+- vddio-pex-ctl-supply: Regulator supply for PCIe side band signals
+
+RC mode:
+- compatible: Tegra19x must contain  "nvidia,tegra194-pcie"
+- device_type: Must be "pci" for RC mode
+- interrupt-names: Must include the following entries:
   "msi": The Tegra interrupt that is asserted when an MSI is received
 - bus-range: Range of bus numbers associated with this controller
 - #address-cells: Address representation for root ports (must be 3)
@@ -60,27 +86,15 @@ Required properties:
 - interrupt-map-mask and interrupt-map: Standard PCI IRQ mapping properties
   Please refer to the standard PCI bus binding document for a more detailed
   explanation.
-- clocks: Must contain an entry for each entry in clock-names.
-  See ../clocks/clock-bindings.txt for details.
-- clock-names: Must include the following entries:
-  - core
-- resets: Must contain an entry for each entry in reset-names.
-  See ../reset/reset.txt for details.
-- reset-names: Must include the following entries:
-  - apb
-  - core
-- phys: Must contain a phandle to P2U PHY for each entry in phy-names.
-- phy-names: Must include an entry for each active lane.
-  "p2u-N": where N ranges from 0 to one less than the total number of lanes
-- nvidia,bpmp: Must contain a pair of phandle to BPMP controller node followed
-  by controller-id. Following are the controller ids for each controller.
-    0: C0
-    1: C1
-    2: C2
-    3: C3
-    4: C4
-    5: C5
-- vddio-pex-ctl-supply: Regulator supply for PCIe side band signals
+
+EP mode:
+In Tegra194, Only controllers C0, C4 & C5 support EP mode.
+- compatible: Tegra19x must contain "nvidia,tegra194-pcie-ep"
+- reg-names: Must include the following entries:
+  "addr_space": Used to map remote RC address space
+- reset-gpios: Must contain a phandle to a GPIO controller followed by
+  GPIO that is being used as PERST input signal. Please refer to pci.txt
+  document.
 
 Optional properties:
 - pinctrl-names: A list of pinctrl state names.
@@ -104,6 +118,8 @@ Optional properties:
    specified in microseconds
 - nvidia,aspm-l0s-entrance-latency-us: ASPM L0s entrance latency to be
    specified in microseconds
+
+RC mode:
 - vpcie3v3-supply: A phandle to the regulator node that supplies 3.3V to the slot
   if the platform has one such slot. (Ex:- x16 slot owned by C5 controller
   in p2972-0000 platform).
@@ -111,11 +127,18 @@ Optional properties:
   if the platform has one such slot. (Ex:- x16 slot owned by C5 controller
   in p2972-0000 platform).
 
+EP mode:
+- nvidia,refclk-select-gpios: Must contain a phandle to a GPIO controller
+  followed by GPIO that is being used to enable REFCLK to controller from host
+
+NOTE:- On Tegra194's P2972-0000 platform, only C5 controller can be enabled to
+operate in the endpoint mode because of the way the platform is designed.
+
 Examples:
 =========
 
-Tegra194:
---------
+Tegra194 RC mode:
+-----------------
 
 	pcie@14180000 {
 		compatible = "nvidia,tegra194-pcie", "snps,dw-pcie";
@@ -169,3 +192,53 @@ Tegra194:
 		       <&p2u_hsio_5>;
 		phy-names = "p2u-0", "p2u-1", "p2u-2", "p2u-3";
 	};
+
+Tegra194 EP mode:
+-----------------
+
+	pcie_ep@141a0000 {
+		compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep";
+		power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8A>;
+		reg = <0x00 0x141a0000 0x0 0x00020000   /* appl registers (128K)      */
+		       0x00 0x3a040000 0x0 0x00040000   /* iATU_DMA reg space (256K)  */
+		       0x00 0x3a080000 0x0 0x00040000   /* DBI reg space (256K)       */
+		       0x1c 0x00000000 0x4 0x00000000>; /* Address Space (16G)        */
+		reg-names = "appl", "atu_dma", "dbi", "addr_space";
+
+		num-lanes = <8>;
+		num-ib-windows = <2>;
+		num-ob-windows = <8>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&clkreq_c5_bi_dir_state>;
+
+		clocks = <&bpmp TEGRA194_CLK_PEX1_CORE_5>;
+		clock-names = "core";
+
+		resets = <&bpmp TEGRA194_RESET_PEX1_CORE_5_APB>,
+			 <&bpmp TEGRA194_RESET_PEX1_CORE_5>;
+		reset-names = "apb", "core";
+
+		interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;	/* controller interrupt */
+		interrupt-names = "intr";
+
+		nvidia,bpmp = <&bpmp 5>;
+
+		nvidia,aspm-cmrt-us = <60>;
+		nvidia,aspm-pwr-on-t-us = <20>;
+		nvidia,aspm-l0s-entrance-latency-us = <3>;
+
+		vddio-pex-ctl-supply = <&vdd_1v8ao>;
+
+		reset-gpios = <&gpio TEGRA194_MAIN_GPIO(GG, 1) GPIO_ACTIVE_LOW>;
+
+		nvidia,refclk-select-gpios = <&gpio_aon TEGRA194_AON_GPIO(AA, 5)
+					      GPIO_ACTIVE_HIGH>;
+
+		phys = <&p2u_nvhs_0>, <&p2u_nvhs_1>, <&p2u_nvhs_2>,
+		       <&p2u_nvhs_3>, <&p2u_nvhs_4>, <&p2u_nvhs_5>,
+		       <&p2u_nvhs_6>, <&p2u_nvhs_7>;
+
+		phy-names = "p2u-0", "p2u-1", "p2u-2", "p2u-3", "p2u-4",
+			    "p2u-5", "p2u-6", "p2u-7";
+	};
Signature · 1 line
2.17.1
#3 lore raw

PATCH v5 3/5 arm64: tegra: Add PCIe endpoint controllers nodes for Tegra194

In reply to Vidya Sagar

Add endpoint mode controllers nodes for the dual mode PCIe controllers present in Tegra194 SoC.

---
V5:
* None

V4:
* None

V3:
* None

V2:
* None

 arch/arm64/boot/dts/nvidia/tegra194.dtsi | 99 ++++++++++++++++++++++++
 1 file changed, 99 insertions(+)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +99 -0
index ccac43be12ac..844e7fac30c5 100644
@@ -1481,6 +1481,105 @@
 			  0x82000000 0x0  0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */
 	};
 
+	pcie_ep@14160000 {
+		compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep";
+		power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX4A>;
+		reg = <0x00 0x14160000 0x0 0x00020000   /* appl registers (128K)      */
+		       0x00 0x36040000 0x0 0x00040000   /* iATU_DMA reg space (256K)  */
+		       0x00 0x36080000 0x0 0x00040000   /* DBI reg space (256K)       */
+		       0x14 0x00000000 0x4 0x00000000>; /* Address Space (16G)        */
+		reg-names = "appl", "atu_dma", "dbi", "addr_space";
+
+		status = "disabled";
+
+		num-lanes = <4>;
+		num-ib-windows = <2>;
+		num-ob-windows = <8>;
+
+		clocks = <&bpmp TEGRA194_CLK_PEX0_CORE_4>;
+		clock-names = "core";
+
+		resets = <&bpmp TEGRA194_RESET_PEX0_CORE_4_APB>,
+			 <&bpmp TEGRA194_RESET_PEX0_CORE_4>;
+		reset-names = "apb", "core";
+
+		interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>;	/* controller interrupt */
+		interrupt-names = "intr";
+
+		nvidia,bpmp = <&bpmp 4>;
+
+		nvidia,aspm-cmrt-us = <60>;
+		nvidia,aspm-pwr-on-t-us = <20>;
+		nvidia,aspm-l0s-entrance-latency-us = <3>;
+	};
+
+	pcie_ep@14180000 {
+		compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep";
+		power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8B>;
+		reg = <0x00 0x14180000 0x0 0x00020000   /* appl registers (128K)      */
+		       0x00 0x38040000 0x0 0x00040000   /* iATU_DMA reg space (256K)  */
+		       0x00 0x38080000 0x0 0x00040000   /* DBI reg space (256K)       */
+		       0x18 0x00000000 0x4 0x00000000>; /* Address Space (16G)        */
+		reg-names = "appl", "atu_dma", "dbi", "addr_space";
+
+		status = "disabled";
+
+		num-lanes = <8>;
+		num-ib-windows = <2>;
+		num-ob-windows = <8>;
+
+		clocks = <&bpmp TEGRA194_CLK_PEX0_CORE_0>;
+		clock-names = "core";
+
+		resets = <&bpmp TEGRA194_RESET_PEX0_CORE_0_APB>,
+			 <&bpmp TEGRA194_RESET_PEX0_CORE_0>;
+		reset-names = "apb", "core";
+
+		interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;	/* controller interrupt */
+		interrupt-names = "intr";
+
+		nvidia,bpmp = <&bpmp 0>;
+
+		nvidia,aspm-cmrt-us = <60>;
+		nvidia,aspm-pwr-on-t-us = <20>;
+		nvidia,aspm-l0s-entrance-latency-us = <3>;
+	};
+
+	pcie_ep@141a0000 {
+		compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep";
+		power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8A>;
+		reg = <0x00 0x141a0000 0x0 0x00020000   /* appl registers (128K)      */
+		       0x00 0x3a040000 0x0 0x00040000   /* iATU_DMA reg space (256K)  */
+		       0x00 0x3a080000 0x0 0x00040000   /* DBI reg space (256K)       */
+		       0x1c 0x00000000 0x4 0x00000000>; /* Address Space (16G)        */
+		reg-names = "appl", "atu_dma", "dbi", "addr_space";
+
+		status = "disabled";
+
+		num-lanes = <8>;
+		num-ib-windows = <2>;
+		num-ob-windows = <8>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&clkreq_c5_bi_dir_state>;
+
+		clocks = <&bpmp TEGRA194_CLK_PEX1_CORE_5>;
+		clock-names = "core";
+
+		resets = <&bpmp TEGRA194_RESET_PEX1_CORE_5_APB>,
+			 <&bpmp TEGRA194_RESET_PEX1_CORE_5>;
+		reset-names = "apb", "core";
+
+		interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;	/* controller interrupt */
+		interrupt-names = "intr";
+
+		nvidia,bpmp = <&bpmp 5>;
+
+		nvidia,aspm-cmrt-us = <60>;
+		nvidia,aspm-pwr-on-t-us = <20>;
+		nvidia,aspm-l0s-entrance-latency-us = <3>;
+	};
+
 	sysram@40000000 {
 		compatible = "nvidia,tegra194-sysram", "mmio-sram";
 		reg = <0x0 0x40000000 0x0 0x50000>;
Signature · 1 line
2.17.1
#4 lore raw

PATCH v5 4/5 arm64: tegra: Add support for PCIe endpoint mode in P2972-0000 platform

In reply to Vidya Sagar

Add endpoint mode support for PCIe C5 controller in P2972-0000 platform with information about supplies, PHY, PERST GPIO and GPIO that controls PCIe reference clock coming from the host system.

---
V5:
* None

V4:
* None

V3:
* None

V2:
* Addressed Thierry's review comments
* Changed 'nvidia,pex-rst-gpio' to 'reset-gpios'
* Added 'nvidia,refclk-select-gpios'

 .../boot/dts/nvidia/tegra194-p2972-0000.dts    | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts +18 -0
index 985e7d84f161..734eb294d1e6 100644
@@ -136,6 +136,24 @@
 			    "p2u-5", "p2u-6", "p2u-7";
 	};
 
+	pcie_ep@141a0000 {
+		status = "disabled";
+
+		vddio-pex-ctl-supply = <&vdd_1v8ao>;
+
+		reset-gpios = <&gpio TEGRA194_MAIN_GPIO(GG, 1) GPIO_ACTIVE_LOW>;
+
+		nvidia,refclk-select-gpios = <&gpio_aon TEGRA194_AON_GPIO(AA, 5)
+					      GPIO_ACTIVE_HIGH>;
+
+		phys = <&p2u_nvhs_0>, <&p2u_nvhs_1>, <&p2u_nvhs_2>,
+		       <&p2u_nvhs_3>, <&p2u_nvhs_4>, <&p2u_nvhs_5>,
+		       <&p2u_nvhs_6>, <&p2u_nvhs_7>;
+
+		phy-names = "p2u-0", "p2u-1", "p2u-2", "p2u-3", "p2u-4",
+			    "p2u-5", "p2u-6", "p2u-7";
+	};
+
 	fan: fan {
 		compatible = "pwm-fan";
 		pwms = <&pwm4 0 45334>;
Signature · 1 line
2.17.1
#5 lore raw

PATCH v5 5/5 PCI: tegra: Add support for PCIe endpoint mode in Tegra194

In reply to Vidya Sagar

Add support for the endpoint mode of Synopsys DesignWare core based dual mode PCIe controllers present in Tegra194 SoC.

---
V5:
* Added Acked-by: Thierry Reding <[email protected]>
* Removed unwanted header file inclusion

V4:
* Addressed Lorenzo's review comments
* Started using threaded irqs instead of kthreads

V3:
* Addressed Thierry's review comments

V2:
* Addressed Bjorn's review comments
* Made changes as part of addressing review comments for other patches

 drivers/pci/controller/dwc/Kconfig         |  30 +-
 drivers/pci/controller/dwc/pcie-tegra194.c | 679 ++++++++++++++++++++-
 2 files changed, 691 insertions(+), 18 deletions(-)
drivers/pci/controller/dwc/Kconfig +27 -3
index 0830dfcfa43a..169cde58dd92 100644
@@ -248,14 +248,38 @@ config PCI_MESON
 	  implement the driver.
 
 config PCIE_TEGRA194
-	tristate "NVIDIA Tegra194 (and later) PCIe controller"
+	tristate
+
+config PCIE_TEGRA194_HOST
+	tristate "NVIDIA Tegra194 (and later) PCIe controller - Host Mode"
 	depends on ARCH_TEGRA_194_SOC || COMPILE_TEST
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIE_DW_HOST
 	select PHY_TEGRA194_P2U
+	select PCIE_TEGRA194
+	default y
+	help
+	  Enables support for the PCIe controller in the NVIDIA Tegra194 SoC to
+	  work in host mode. There are two instances of PCIe controllers in
+	  Tegra194. This controller can work either as EP or RC. In order to
+	  enable host-specific features PCIE_TEGRA194_HOST must be selected and
+	  in order to enable device-specific features PCIE_TEGRA194_EP must be
+	  selected. This uses the DesignWare core.
+
+config PCIE_TEGRA194_EP
+	tristate "NVIDIA Tegra194 (and later) PCIe controller - Endpoint Mode"
+	depends on ARCH_TEGRA_194_SOC || COMPILE_TEST
+	depends on PCI_ENDPOINT
+	select PCIE_DW_EP
+	select PHY_TEGRA194_P2U
+	select PCIE_TEGRA194
 	help
-	  Say Y here if you want support for DesignWare core based PCIe host
-	  controller found in NVIDIA Tegra194 SoC.
+	  Enables support for the PCIe controller in the NVIDIA Tegra194 SoC to
+	  work in host mode. There are two instances of PCIe controllers in
+	  Tegra194. This controller can work either as EP or RC. In order to
+	  enable host-specific features PCIE_TEGRA194_HOST must be selected and
+	  in order to enable device-specific features PCIE_TEGRA194_EP must be
+	  selected. This uses the DesignWare core.
 
 config PCIE_UNIPHIER
 	bool "Socionext UniPhier PCIe controllers"
drivers/pci/controller/dwc/pcie-tegra194.c +664 -15

825 lines not on this page · raw message

Signature · 1 line
2.17.1
#6 lore raw

Re: [PATCH V5 5/5] PCI: tegra: Add support for PCIe endpoint mode in Tegra194

Quoted 5 lines · Vidya Sagar

Add support for the endpoint mode of Synopsys DesignWare core based dual mode PCIe controllers present in Tegra194 SoC.

ERROR: modpost: "dw_pcie_ep_init" [drivers/pci/controller/dwc/pcie-tegra194.ko] undefined!
ERROR: modpost: "dw_pcie_ep_linkup" [drivers/pci/controller/dwc/pcie-tegra194.ko] undefined!
ERROR: modpost: "dw_pcie_ep_init_notify" [drivers/pci/controller/dwc/pcie-tegra194.ko] undefined!
ERROR: modpost: "dw_pcie_ep_init_complete" [drivers/pci/controller/dwc/pcie-tegra194.ko] undefined!

Either the symbols must be exported, or the driver's Kconfig entry must be bool, not tristate.

Guenter

#7 lore raw

Re: [PATCH V5 5/5] PCI: tegra: Add support for PCIe endpoint mode in Tegra194

Quoted 10 lines · Guenter Roeck

External email: Use caution opening links or attachments

Quoted 5 lines · Vidya Sagar

Add support for the endpoint mode of Synopsys DesignWare core based dual mode PCIe controllers present in Tegra194 SoC.

Quoted 7 lines

ERROR: modpost: "dw_pcie_ep_init" [drivers/pci/controller/dwc/pcie-tegra194.ko] undefined!
ERROR: modpost: "dw_pcie_ep_linkup" [drivers/pci/controller/dwc/pcie-tegra194.ko] undefined!
ERROR: modpost: "dw_pcie_ep_init_notify" [drivers/pci/controller/dwc/pcie-tegra194.ko] undefined!
ERROR: modpost: "dw_pcie_ep_init_complete" [drivers/pci/controller/dwc/pcie-tegra194.ko] undefined!

Either the symbols must be exported, or the driver's Kconfig entry must be bool, not tristate.

Qiujun has already posted a patch to fix it @ http://patchwork.ozlabs.org/patch/1258659/

Thanks,
Vidya Sagar

Quoted 3 lines

Guenter

#8 lore raw

Re: [PATCH V5 5/5] PCI: tegra: Add support for PCIe endpoint mode in Tegra194

In reply to Vidya Sagar
Quoted 34 lines · Vidya Sagar

Add support for the endpoint mode of Synopsys DesignWare core based dual mode PCIe controllers present in Tegra194 SoC.

---
V5:
* Added Acked-by: Thierry Reding <[email protected]>
* Removed unwanted header file inclusion

V4:
* Addressed Lorenzo's review comments
* Started using threaded irqs instead of kthreads

V3:
* Addressed Thierry's review comments

V2:
* Addressed Bjorn's review comments
* Made changes as part of addressing review comments for other patches

 drivers/pci/controller/dwc/Kconfig         |  30 +-
 drivers/pci/controller/dwc/pcie-tegra194.c | 679 ++++++++++++++++++++-
 2 files changed, 691 insertions(+), 18 deletions(-)
drivers/pci/controller/dwc/Kconfig +0 -1
index 0830dfcfa43a..169cde58dd92 100644
@@ -248,14 +248,38 @@ config PCI_MESON
 	  implement the driver.
 
 config PCIE_TEGRA194
-	tristate "NVIDIA Tegra194 (and later) PCIe controller"

drivers/pci/controller/dwc/Kconfig config PCI_MESON · line 260

Quoted 10 lines
drivers/pci/controller/dwc/Kconfig +6 -0
+	tristate
+
+config PCIE_TEGRA194_HOST
+	tristate "NVIDIA Tegra194 (and later) PCIe controller - Host Mode"
 	depends on ARCH_TEGRA_194_SOC || COMPILE_TEST
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIE_DW_HOST
 	select PHY_TEGRA194_P2U
+	select PCIE_TEGRA194
+	default y

Sorry I missed this before, but why is this "default y"? From Documentation/kbuild/kconfig-language.rst:

The default value deliberately defaults to 'n' in order to avoid bloating the build. With few exceptions, new config options should not change this. The intent is for "make oldconfig" to add as little as possible to the config from release to release.

I do see that several other things in other drivers/pci/ Kconfig files are also "default y", and we should probably change some of them. But I don't want to add even more unless there's a good reason.

I'm not looking for more reactions like these:

https://lore.kernel.org/r/CAHk-=wiZ24JuVehJ5sEC0UG1Gk2nvB363wO02RRsR1oEht6R9Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
https://lore.kernel.org/r/CA+55aFzPpuHU1Nqd595SEQS=F+kXMzPs0Rba9FUgTodGxmXsgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

Can you please update this patch to either remove the "default y" or add the rationale for keeping it?

Quoted 7 lines
drivers/pci/controller/dwc/Kconfig +7 -0
+	help
+	  Enables support for the PCIe controller in the NVIDIA Tegra194 SoC to
+	  work in host mode. There are two instances of PCIe controllers in
+	  Tegra194. This controller can work either as EP or RC. In order to
+	  enable host-specific features PCIE_TEGRA194_HOST must be selected and
+	  in order to enable device-specific features PCIE_TEGRA194_EP must be
+	  selected. This uses the DesignWare core.
#9 lore raw

Re: [PATCH V5 5/5] PCI: tegra: Add support for PCIe endpoint mode in Tegra194

Quoted 61 lines · Bjorn Helgaas

External email: Use caution opening links or attachments

Quoted 34 lines · Vidya Sagar

Add support for the endpoint mode of Synopsys DesignWare core based dual mode PCIe controllers present in Tegra194 SoC.

---
V5:
* Added Acked-by: Thierry Reding <[email protected]>
* Removed unwanted header file inclusion

V4:
* Addressed Lorenzo's review comments
* Started using threaded irqs instead of kthreads

V3:
* Addressed Thierry's review comments

V2:
* Addressed Bjorn's review comments
* Made changes as part of addressing review comments for other patches

  drivers/pci/controller/dwc/Kconfig         |  30 +-
  drivers/pci/controller/dwc/pcie-tegra194.c | 679 ++++++++++++++++++++-
  2 files changed, 691 insertions(+), 18 deletions(-)
drivers/pci/controller/dwc/Kconfig +0 -1
index 0830dfcfa43a..169cde58dd92 100644
@@ -248,14 +248,38 @@ config PCI_MESON
         implement the driver.
 
  config PCIE_TEGRA194
-     tristate "NVIDIA Tegra194 (and later) PCIe controller"

drivers/pci/controller/dwc/Kconfig config PCI_MESON · line 260

Quoted 10 lines
drivers/pci/controller/dwc/Kconfig +6 -0
+     tristate
+
+config PCIE_TEGRA194_HOST
+     tristate "NVIDIA Tegra194 (and later) PCIe controller - Host Mode"
       depends on ARCH_TEGRA_194_SOC || COMPILE_TEST
       depends on PCI_MSI_IRQ_DOMAIN
       select PCIE_DW_HOST
       select PHY_TEGRA194_P2U
+     select PCIE_TEGRA194
+     default y

Sorry I missed this before, but why is this "default y"? From Documentation/kbuild/kconfig-language.rst:

The default value deliberately defaults to 'n' in order to avoid bloating the build. With few exceptions, new config options should not change this. The intent is for "make oldconfig" to add as little as possible to the config from release to release.

I do see that several other things in other drivers/pci/ Kconfig files are also "default y", and we should probably change some of them. But I don't want to add even more unless there's a good reason.

Quoted 7 lines

I'm not looking for more reactions like these:

https://lore.kernel.org/r/CAHk-=wiZ24JuVehJ5sEC0UG1Gk2nvB363wO02RRsR1oEht6R9Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
https://lore.kernel.org/r/CA+55aFzPpuHU1Nqd595SEQS=F+kXMzPs0Rba9FUgTodGxmXsgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

Can you please update this patch to either remove the "default y" or add the rationale for keeping it?

I'm fine with removing 'default y' line.
Should I send a patch only with this change?

Thanks,
Vidya Sagar

Quoted 8 lines
Quoted 8 lines
drivers/pci/controller/dwc/Kconfig +7 -0
+     help
+       Enables support for the PCIe controller in the NVIDIA Tegra194 SoC to
+       work in host mode. There are two instances of PCIe controllers in
+       Tegra194. This controller can work either as EP or RC. In order to
+       enable host-specific features PCIE_TEGRA194_HOST must be selected and
+       in order to enable device-specific features PCIE_TEGRA194_EP must be
+       selected. This uses the DesignWare core.
#10 lore raw

Re: [PATCH V5 5/5] PCI: tegra: Add support for PCIe endpoint mode in Tegra194

Quoted 67 lines · Vidya Sagar
Quoted 63 lines · Bjorn Helgaas

External email: Use caution opening links or attachments

Quoted 34 lines · Vidya Sagar

Add support for the endpoint mode of Synopsys DesignWare core based dual mode PCIe controllers present in Tegra194 SoC.

---
V5:
* Added Acked-by: Thierry Reding <[email protected]>
* Removed unwanted header file inclusion

V4:
* Addressed Lorenzo's review comments
* Started using threaded irqs instead of kthreads

V3:
* Addressed Thierry's review comments

V2:
* Addressed Bjorn's review comments
* Made changes as part of addressing review comments for other patches

  drivers/pci/controller/dwc/Kconfig         |  30 +-
  drivers/pci/controller/dwc/pcie-tegra194.c | 679 ++++++++++++++++++++-
  2 files changed, 691 insertions(+), 18 deletions(-)
drivers/pci/controller/dwc/Kconfig +0 -1
index 0830dfcfa43a..169cde58dd92 100644
@@ -248,14 +248,38 @@ config PCI_MESON
         implement the driver.
 
  config PCIE_TEGRA194
-     tristate "NVIDIA Tegra194 (and later) PCIe controller"

drivers/pci/controller/dwc/Kconfig config PCI_MESON · line 260

Quoted 10 lines
drivers/pci/controller/dwc/Kconfig +6 -0
+     tristate
+
+config PCIE_TEGRA194_HOST
+     tristate "NVIDIA Tegra194 (and later) PCIe controller - Host Mode"
       depends on ARCH_TEGRA_194_SOC || COMPILE_TEST
       depends on PCI_MSI_IRQ_DOMAIN
       select PCIE_DW_HOST
       select PHY_TEGRA194_P2U
+     select PCIE_TEGRA194
+     default y

Sorry I missed this before, but why is this "default y"? From Documentation/kbuild/kconfig-language.rst:

The default value deliberately defaults to 'n' in order to avoid bloating the build. With few exceptions, new config options should not change this. The intent is for "make oldconfig" to add as little as possible to the config from release to release.

I do see that several other things in other drivers/pci/ Kconfig files are also "default y", and we should probably change some of them. But I don't want to add even more unless there's a good reason.

I'm not looking for more reactions like these:

Quoted 7 lines
Quoted 5 lines

https://lore.kernel.org/r/CAHk-=wiZ24JuVehJ5sEC0UG1Gk2nvB363wO02RRsR1oEht6R9Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
https://lore.kernel.org/r/CA+55aFzPpuHU1Nqd595SEQS=F+kXMzPs0Rba9FUgTodGxmXsgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

Can you please update this patch to either remove the "default y" or add the rationale for keeping it?

I'm fine with removing 'default y' line.
Should I send a patch only with this change?

I think it's probably just as easy for Lorenzo to delete that line on his branch. If not, I'll cherry-pick the patches on that branch and do it locally.

Bjorn

#11 lore raw

Re: [PATCH V5 5/5] PCI: tegra: Add support for PCIe endpoint mode in Tegra194

Quoted 71 lines · Bjorn Helgaas
Quoted 70 lines · Vidya Sagar
Quoted 66 lines · Bjorn Helgaas

External email: Use caution opening links or attachments

Quoted 34 lines · Vidya Sagar

Add support for the endpoint mode of Synopsys DesignWare core based dual mode PCIe controllers present in Tegra194 SoC.

---
V5:
* Added Acked-by: Thierry Reding <[email protected]>
* Removed unwanted header file inclusion

V4:
* Addressed Lorenzo's review comments
* Started using threaded irqs instead of kthreads

V3:
* Addressed Thierry's review comments

V2:
* Addressed Bjorn's review comments
* Made changes as part of addressing review comments for other patches

  drivers/pci/controller/dwc/Kconfig         |  30 +-
  drivers/pci/controller/dwc/pcie-tegra194.c | 679 ++++++++++++++++++++-
  2 files changed, 691 insertions(+), 18 deletions(-)
drivers/pci/controller/dwc/Kconfig +0 -1
index 0830dfcfa43a..169cde58dd92 100644
@@ -248,14 +248,38 @@ config PCI_MESON
         implement the driver.
 
  config PCIE_TEGRA194
-     tristate "NVIDIA Tegra194 (and later) PCIe controller"

drivers/pci/controller/dwc/Kconfig config PCI_MESON · line 260

Quoted 10 lines
drivers/pci/controller/dwc/Kconfig +6 -0
+     tristate
+
+config PCIE_TEGRA194_HOST
+     tristate "NVIDIA Tegra194 (and later) PCIe controller - Host Mode"
       depends on ARCH_TEGRA_194_SOC || COMPILE_TEST
       depends on PCI_MSI_IRQ_DOMAIN
       select PCIE_DW_HOST
       select PHY_TEGRA194_P2U
+     select PCIE_TEGRA194
+     default y

Sorry I missed this before, but why is this "default y"? From Documentation/kbuild/kconfig-language.rst:

The default value deliberately defaults to 'n' in order to avoid bloating the build. With few exceptions, new config options should not change this. The intent is for "make oldconfig" to add as little as possible to the config from release to release.

I do see that several other things in other drivers/pci/ Kconfig files are also "default y", and we should probably change some of them. But I don't want to add even more unless there's a good reason.

I'm not looking for more reactions like these:

https://lore.kernel.org/r/CAHk-=wiZ24JuVehJ5sEC0UG1Gk2nvB363wO02RRsR1oEht6R9Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
https://lore.kernel.org/r/CA+55aFzPpuHU1Nqd595SEQS=F+kXMzPs0Rba9FUgTodGxmXsgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Can you please update this patch to either remove the "default y" or add the rationale for keeping it?

I'm fine with removing 'default y' line.
Should I send a patch only with this change?

I think it's probably just as easy for Lorenzo to delete that line on his branch. If not, I'll cherry-pick the patches on that branch and do it locally.

Done, pushed out. It is a guideline that it is worth keeping in mind while I review the code, sorry for missing it.

Lorenzo

#12 lore raw

Re: [PATCH V5 5/5] PCI: tegra: Add support for PCIe endpoint mode in Tegra194

Quoted 74 lines · Lorenzo Pieralisi
Quoted 73 lines · Bjorn Helgaas
Quoted 71 lines · Vidya Sagar
Quoted 61 lines · Bjorn Helgaas

External email: Use caution opening links or attachments

Quoted 34 lines · Vidya Sagar

Add support for the endpoint mode of Synopsys DesignWare core based dual mode PCIe controllers present in Tegra194 SoC.

---
V5:
* Added Acked-by: Thierry Reding <[email protected]>
* Removed unwanted header file inclusion

V4:
* Addressed Lorenzo's review comments
* Started using threaded irqs instead of kthreads

V3:
* Addressed Thierry's review comments

V2:
* Addressed Bjorn's review comments
* Made changes as part of addressing review comments for other patches

  drivers/pci/controller/dwc/Kconfig         |  30 +-
  drivers/pci/controller/dwc/pcie-tegra194.c | 679 ++++++++++++++++++++-
  2 files changed, 691 insertions(+), 18 deletions(-)
drivers/pci/controller/dwc/Kconfig +0 -1
index 0830dfcfa43a..169cde58dd92 100644
@@ -248,14 +248,38 @@ config PCI_MESON
         implement the driver.
 
  config PCIE_TEGRA194
-     tristate "NVIDIA Tegra194 (and later) PCIe controller"

drivers/pci/controller/dwc/Kconfig config PCI_MESON · line 260

Quoted 10 lines
drivers/pci/controller/dwc/Kconfig +6 -0
+     tristate
+
+config PCIE_TEGRA194_HOST
+     tristate "NVIDIA Tegra194 (and later) PCIe controller - Host Mode"
       depends on ARCH_TEGRA_194_SOC || COMPILE_TEST
       depends on PCI_MSI_IRQ_DOMAIN
       select PCIE_DW_HOST
       select PHY_TEGRA194_P2U
+     select PCIE_TEGRA194
+     default y

Sorry I missed this before, but why is this "default y"? From Documentation/kbuild/kconfig-language.rst:

The default value deliberately defaults to 'n' in order to avoid bloating the build. With few exceptions, new config options should not change this. The intent is for "make oldconfig" to add as little as possible to the config from release to release.

I do see that several other things in other drivers/pci/ Kconfig files are also "default y", and we should probably change some of them. But I don't want to add even more unless there's a good reason.

Quoted 7 lines

I'm not looking for more reactions like these:

https://lore.kernel.org/r/CAHk-=wiZ24JuVehJ5sEC0UG1Gk2nvB363wO02RRsR1oEht6R9Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
https://lore.kernel.org/r/CA+55aFzPpuHU1Nqd595SEQS=F+kXMzPs0Rba9FUgTodGxmXsgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

Can you please update this patch to either remove the "default y" or add the rationale for keeping it?

I'm fine with removing 'default y' line.
Should I send a patch only with this change?

Quoted 6 lines
Quoted 3 lines

I think it's probably just as easy for Lorenzo to delete that line on his branch. If not, I'll cherry-pick the patches on that branch and do it locally.

Done, pushed out. It is a guideline that it is worth keeping in mind while I review the code, sorry for missing it.

Got it, thanks! No worries, easy to fix.

Bjorn

#13 lore raw
In reply to Vidya Sagar
Quoted 12 lines · Vidya Sagar

Tegra194 has three (C0, C4 & C5) dual mode PCIe controllers that can operate either in root port mode or in end point mode but only in one mode at a time. Platform P2972-0000 supports enabling endpoint mode for C5 controller. This patch series adds support for PCIe endpoint mode in both the driver as well as in DT.
This patch series depends on the changes made for Synopsys DesignWare endpoint mode subsystem that are recently accepted.
@ https://patchwork.kernel.org/project/linux-pci/list/?series=202211
which in turn depends on the patch made by Kishon
@ https://patchwork.kernel.org/patch/10975123/
which is also under review.

Quoted 3 lines

V5:
* Rebased patch-2 on top of Lorenzo's pci/endpoint branch
* Removed unwanted header files inclusion in patch-5

Applied patches 1,2,5 to pci/endpoint for v5.7, please let me know if something is missing.

Thanks,
Lorenzo

Quoted 31 lines

V4:
* Started using threaded irqs instead of kthreads

V3:
* Re-ordered patches in the series to make the driver change as the last patch
* Took care of Thierry's review comments

V2:
* Addressed Thierry & Bjorn's review comments
* Added EP mode specific binding documentation to already existing binding documentation file
* Removed patch that enables GPIO controller nodes explicitly as they are enabled already

Vidya Sagar (5):
soc/tegra: bpmp: Update ABI header
dt-bindings: PCI: tegra: Add DT support for PCIe EP nodes in Tegra194
arm64: tegra: Add PCIe endpoint controllers nodes for Tegra194
arm64: tegra: Add support for PCIe endpoint mode in P2972-0000
platform
PCI: tegra: Add support for PCIe endpoint mode in Tegra194

 .../bindings/pci/nvidia,tegra194-pcie.txt     | 125 +++-
 .../boot/dts/nvidia/tegra194-p2972-0000.dts   |  18 +
 arch/arm64/boot/dts/nvidia/tegra194.dtsi      |  99 +++
 drivers/pci/controller/dwc/Kconfig            |  30 +-
 drivers/pci/controller/dwc/pcie-tegra194.c    | 679 +++++++++++++++++-
 include/soc/tegra/bpmp-abi.h                  |  10 +-
 6 files changed, 916 insertions(+), 45 deletions(-)
Signature · 1 line
2.17.1
#14 lore raw
Quoted 13 lines · Lorenzo Pieralisi
Quoted 12 lines · Vidya Sagar

Tegra194 has three (C0, C4 & C5) dual mode PCIe controllers that can operate either in root port mode or in end point mode but only in one mode at a time. Platform P2972-0000 supports enabling endpoint mode for C5 controller. This patch series adds support for PCIe endpoint mode in both the driver as well as in DT.
This patch series depends on the changes made for Synopsys DesignWare endpoint mode subsystem that are recently accepted.
@ https://patchwork.kernel.org/project/linux-pci/list/?series=202211
which in turn depends on the patch made by Kishon
@ https://patchwork.kernel.org/patch/10975123/
which is also under review.

Quoted 6 lines
Quoted 3 lines

V5:
* Rebased patch-2 on top of Lorenzo's pci/endpoint branch
* Removed unwanted header files inclusion in patch-5

Applied patches 1,2,5 to pci/endpoint for v5.7, please let me know if something is missing.

Great, thanks! I've picked up patches 3 and 4 into the Tegra tree for v5.7.

Thierry

#15 lore raw
In reply to Lorenzo Pieralisi
Quoted 16 lines · Lorenzo Pieralisi

External email: Use caution opening links or attachments

Quoted 12 lines · Vidya Sagar

Tegra194 has three (C0, C4 & C5) dual mode PCIe controllers that can operate either in root port mode or in end point mode but only in one mode at a time. Platform P2972-0000 supports enabling endpoint mode for C5 controller. This patch series adds support for PCIe endpoint mode in both the driver as well as in DT.
This patch series depends on the changes made for Synopsys DesignWare endpoint mode subsystem that are recently accepted.
@ https://patchwork.kernel.org/project/linux-pci/list/?series=202211
which in turn depends on the patch made by Kishon
@ https://patchwork.kernel.org/patch/10975123/
which is also under review.

Quoted 6 lines
Quoted 3 lines

V5:
* Rebased patch-2 on top of Lorenzo's pci/endpoint branch
* Removed unwanted header files inclusion in patch-5

Applied patches 1,2,5 to pci/endpoint for v5.7, please let me know if something is missing.

Thanks Lorenzo and Thierry.

Thanks,
Vidya Sagar

Quoted 35 lines

Thanks,
Lorenzo

Quoted 31 lines

V4:
* Started using threaded irqs instead of kthreads

V3:
* Re-ordered patches in the series to make the driver change as the last patch
* Took care of Thierry's review comments

V2:
* Addressed Thierry & Bjorn's review comments
* Added EP mode specific binding documentation to already existing binding documentation file
* Removed patch that enables GPIO controller nodes explicitly as they are enabled already

Vidya Sagar (5):
soc/tegra: bpmp: Update ABI header
dt-bindings: PCI: tegra: Add DT support for PCIe EP nodes in Tegra194
arm64: tegra: Add PCIe endpoint controllers nodes for Tegra194
arm64: tegra: Add support for PCIe endpoint mode in P2972-0000
platform
PCI: tegra: Add support for PCIe endpoint mode in Tegra194

  .../bindings/pci/nvidia,tegra194-pcie.txt     | 125 +++-
  .../boot/dts/nvidia/tegra194-p2972-0000.dts   |  18 +
  arch/arm64/boot/dts/nvidia/tegra194.dtsi      |  99 +++
  drivers/pci/controller/dwc/Kconfig            |  30 +-
  drivers/pci/controller/dwc/pcie-tegra194.c    | 679 +++++++++++++++++-
  include/soc/tegra/bpmp-abi.h                  |  10 +-
  6 files changed, 916 insertions(+), 45 deletions(-)

--
2.17.1