linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/11] Improvements to the Qcom PCIe Endpoint driver
@ 2022-08-30 16:58 Manivannan Sadhasivam
  2022-08-30 16:58 ` [PATCH v2 01/11] PCI: qcom-ep: Add kernel-doc for qcom_pcie_ep structure Manivannan Sadhasivam
                   ` (10 more replies)
  0 siblings, 11 replies; 18+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 16:58 UTC (permalink / raw)
  To: lpieralisi, robh, andersson
  Cc: kw, bhelgaas, linux-pci, linux-arm-msm, linux-kernel,
	konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, devicetree,
	dmitry.baryshkov, Manivannan Sadhasivam

Hello,

This series contains improvements to the Qualcomm PCIe Endpoint controller
driver. The major improvements are the addition of SM8450 SoC support and
debugfs interface for exposing link transition counts.

This series has been tested on SM8450 based dev board.

Thanks,
Mani

Changes in v2:

* Fixed the comments on bindings patches
* Added Ack from Krzysztof

Manivannan Sadhasivam (11):
  PCI: qcom-ep: Add kernel-doc for qcom_pcie_ep structure
  PCI: qcom-ep: Do not use hardcoded clks in driver
  PCI: qcom-ep: Make use of the cached dev pointer
  PCI: qcom-ep: Add eDMA support
  PCI: qcom-ep: Disable IRQs during driver remove
  PCI: qcom-ep: Add debugfs support for expose link transition counts
  dt-bindings: PCI: qcom-ep: Make PERST separation optional
  PCI: qcom-ep: Make PERST separation optional
  dt-bindings: PCI: qcom-ep: Define clocks per platform
  dt-bindings: PCI: qcom-ep: Add support for SM8450 SoC
  PCI: qcom-ep: Add support for SM8450 SoC

 .../devicetree/bindings/pci/qcom,pcie-ep.yaml |  88 ++++++++---
 drivers/pci/controller/dwc/pcie-qcom-ep.c     | 140 ++++++++++++++----
 2 files changed, 176 insertions(+), 52 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 01/11] PCI: qcom-ep: Add kernel-doc for qcom_pcie_ep structure
  2022-08-30 16:58 [PATCH v2 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
@ 2022-08-30 16:58 ` Manivannan Sadhasivam
  2022-08-30 16:58 ` [PATCH v2 02/11] PCI: qcom-ep: Do not use hardcoded clks in driver Manivannan Sadhasivam
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 16:58 UTC (permalink / raw)
  To: lpieralisi, robh, andersson
  Cc: kw, bhelgaas, linux-pci, linux-arm-msm, linux-kernel,
	konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, devicetree,
	dmitry.baryshkov, Manivannan Sadhasivam

Add kernel-doc for qcom_pcie_ep structure.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom-ep.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 9f92d53da81a..27b7c9710b5f 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -140,6 +140,23 @@ static struct clk_bulk_data qcom_pcie_ep_clks[] = {
 	{ .id = "slave_q2a" },
 };
 
+/**
+ * struct qcom_pcie_ep - Qualcomm PCIe Endpoint Controller
+ * @pci: Designware PCIe controller struct
+ * @parf: Qualcomm PCIe specific PARF register base
+ * @elbi: Designware PCIe specific ELBI register base
+ * @perst_map: PERST regmap
+ * @mmio_res: MMIO region resource
+ * @core_reset: PCIe Endpoint core reset
+ * @reset: PERST# GPIO
+ * @wake: WAKE# GPIO
+ * @phy: PHY controller block
+ * @perst_en: Flag for PERST enable
+ * @perst_sep_en: Flag for PERST separation enable
+ * @link_status: PCIe Link status
+ * @global_irq: Qualcomm PCIe specific Global IRQ
+ * @perst_irq: PERST# IRQ
+ */
 struct qcom_pcie_ep {
 	struct dw_pcie pci;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 02/11] PCI: qcom-ep: Do not use hardcoded clks in driver
  2022-08-30 16:58 [PATCH v2 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
  2022-08-30 16:58 ` [PATCH v2 01/11] PCI: qcom-ep: Add kernel-doc for qcom_pcie_ep structure Manivannan Sadhasivam
@ 2022-08-30 16:58 ` Manivannan Sadhasivam
  2022-08-30 16:58 ` [PATCH v2 03/11] PCI: qcom-ep: Make use of the cached dev pointer Manivannan Sadhasivam
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 16:58 UTC (permalink / raw)
  To: lpieralisi, robh, andersson
  Cc: kw, bhelgaas, linux-pci, linux-arm-msm, linux-kernel,
	konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, devicetree,
	dmitry.baryshkov, Manivannan Sadhasivam

Generally, device drivers should just rely on the platform data like
devicetree to supply the clocks required for the functioning of the
peripheral. There is no need to hardcode the clk info in the driver.
So get rid of the static clk info and obtain the platform supplied
clks.

The total number of clocks supplied is obtained using the
devm_clk_bulk_get_all() API and used for the rest of the clk_bulk_ APIs.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom-ep.c | 33 +++++++++--------------
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 27b7c9710b5f..34c498d581de 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -130,16 +130,6 @@ enum qcom_pcie_ep_link_status {
 	QCOM_PCIE_EP_LINK_DOWN,
 };
 
-static struct clk_bulk_data qcom_pcie_ep_clks[] = {
-	{ .id = "cfg" },
-	{ .id = "aux" },
-	{ .id = "bus_master" },
-	{ .id = "bus_slave" },
-	{ .id = "ref" },
-	{ .id = "sleep" },
-	{ .id = "slave_q2a" },
-};
-
 /**
  * struct qcom_pcie_ep - Qualcomm PCIe Endpoint Controller
  * @pci: Designware PCIe controller struct
@@ -151,6 +141,8 @@ static struct clk_bulk_data qcom_pcie_ep_clks[] = {
  * @reset: PERST# GPIO
  * @wake: WAKE# GPIO
  * @phy: PHY controller block
+ * @clks: PCIe clocks
+ * @num_clks: PCIe clocks count
  * @perst_en: Flag for PERST enable
  * @perst_sep_en: Flag for PERST separation enable
  * @link_status: PCIe Link status
@@ -170,6 +162,9 @@ struct qcom_pcie_ep {
 	struct gpio_desc *wake;
 	struct phy *phy;
 
+	struct clk_bulk_data *clks;
+	int num_clks;
+
 	u32 perst_en;
 	u32 perst_sep_en;
 
@@ -244,8 +239,7 @@ static int qcom_pcie_enable_resources(struct qcom_pcie_ep *pcie_ep)
 {
 	int ret;
 
-	ret = clk_bulk_prepare_enable(ARRAY_SIZE(qcom_pcie_ep_clks),
-				      qcom_pcie_ep_clks);
+	ret = clk_bulk_prepare_enable(pcie_ep->num_clks, pcie_ep->clks);
 	if (ret)
 		return ret;
 
@@ -266,8 +260,7 @@ static int qcom_pcie_enable_resources(struct qcom_pcie_ep *pcie_ep)
 err_phy_exit:
 	phy_exit(pcie_ep->phy);
 err_disable_clk:
-	clk_bulk_disable_unprepare(ARRAY_SIZE(qcom_pcie_ep_clks),
-				   qcom_pcie_ep_clks);
+	clk_bulk_disable_unprepare(pcie_ep->num_clks, pcie_ep->clks);
 
 	return ret;
 }
@@ -276,8 +269,7 @@ static void qcom_pcie_disable_resources(struct qcom_pcie_ep *pcie_ep)
 {
 	phy_power_off(pcie_ep->phy);
 	phy_exit(pcie_ep->phy);
-	clk_bulk_disable_unprepare(ARRAY_SIZE(qcom_pcie_ep_clks),
-				   qcom_pcie_ep_clks);
+	clk_bulk_disable_unprepare(pcie_ep->num_clks, pcie_ep->clks);
 }
 
 static int qcom_pcie_perst_deassert(struct dw_pcie *pci)
@@ -495,10 +487,11 @@ static int qcom_pcie_ep_get_resources(struct platform_device *pdev,
 		return ret;
 	}
 
-	ret = devm_clk_bulk_get(dev, ARRAY_SIZE(qcom_pcie_ep_clks),
-				qcom_pcie_ep_clks);
-	if (ret)
-		return ret;
+	pcie_ep->num_clks = devm_clk_bulk_get_all(dev, &pcie_ep->clks);
+	if (pcie_ep->num_clks < 0) {
+		dev_err(dev, "Failed to get clocks\n");
+		return pcie_ep->num_clks;
+	}
 
 	pcie_ep->core_reset = devm_reset_control_get_exclusive(dev, "core");
 	if (IS_ERR(pcie_ep->core_reset))
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 03/11] PCI: qcom-ep: Make use of the cached dev pointer
  2022-08-30 16:58 [PATCH v2 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
  2022-08-30 16:58 ` [PATCH v2 01/11] PCI: qcom-ep: Add kernel-doc for qcom_pcie_ep structure Manivannan Sadhasivam
  2022-08-30 16:58 ` [PATCH v2 02/11] PCI: qcom-ep: Do not use hardcoded clks in driver Manivannan Sadhasivam
@ 2022-08-30 16:58 ` Manivannan Sadhasivam
  2022-08-30 16:58 ` [PATCH v2 04/11] PCI: qcom-ep: Add eDMA support Manivannan Sadhasivam
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 16:58 UTC (permalink / raw)
  To: lpieralisi, robh, andersson
  Cc: kw, bhelgaas, linux-pci, linux-arm-msm, linux-kernel,
	konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, devicetree,
	dmitry.baryshkov, Manivannan Sadhasivam

In the qcom_pcie_ep_get_resources() function, dev pointer is already
cached in a local variable. So let's make use of it instead of getting
the dev pointer again from pdev struct.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom-ep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 34c498d581de..1e09eca5b3b2 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -483,7 +483,7 @@ static int qcom_pcie_ep_get_resources(struct platform_device *pdev,
 
 	ret = qcom_pcie_ep_get_io_resources(pdev, pcie_ep);
 	if (ret) {
-		dev_err(&pdev->dev, "Failed to get io resources %d\n", ret);
+		dev_err(dev, "Failed to get io resources %d\n", ret);
 		return ret;
 	}
 
@@ -505,7 +505,7 @@ static int qcom_pcie_ep_get_resources(struct platform_device *pdev,
 	if (IS_ERR(pcie_ep->wake))
 		return PTR_ERR(pcie_ep->wake);
 
-	pcie_ep->phy = devm_phy_optional_get(&pdev->dev, "pciephy");
+	pcie_ep->phy = devm_phy_optional_get(dev, "pciephy");
 	if (IS_ERR(pcie_ep->phy))
 		ret = PTR_ERR(pcie_ep->phy);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 04/11] PCI: qcom-ep: Add eDMA support
  2022-08-30 16:58 [PATCH v2 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (2 preceding siblings ...)
  2022-08-30 16:58 ` [PATCH v2 03/11] PCI: qcom-ep: Make use of the cached dev pointer Manivannan Sadhasivam
@ 2022-08-30 16:58 ` Manivannan Sadhasivam
  2022-09-03  2:36   ` kernel test robot
  2022-08-30 16:58 ` [PATCH v2 05/11] PCI: qcom-ep: Disable IRQs during driver remove Manivannan Sadhasivam
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 18+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 16:58 UTC (permalink / raw)
  To: lpieralisi, robh, andersson
  Cc: kw, bhelgaas, linux-pci, linux-arm-msm, linux-kernel,
	konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, devicetree,
	dmitry.baryshkov, Manivannan Sadhasivam

Qualcomm PCIe Endpoint controllers have the in-built Embedded DMA (eDMA)
peripheral for offloading the data transfer between PCIe bus and memory.

Let's add the support for it by enabling the eDMA IRQ in the driver.
Rest of the functionality will be handled by the eDMA DMA Engine driver.

Since the eDMA on Qualcomm platforms only uses a single IRQ for all
channels, use 1 for edma.nr_irqs.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom-ep.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 1e09eca5b3b2..54b927adf60a 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -66,6 +66,7 @@
 #define PARF_INT_ALL_PLS_ERR			BIT(15)
 #define PARF_INT_ALL_PME_LEGACY			BIT(16)
 #define PARF_INT_ALL_PLS_PME			BIT(17)
+#define PARF_INT_ALL_EDMA			BIT(22)
 
 /* PARF_BDF_TO_SID_CFG register fields */
 #define PARF_BDF_TO_SID_BYPASS			BIT(0)
@@ -367,7 +368,7 @@ static int qcom_pcie_perst_deassert(struct dw_pcie *pci)
 	writel_relaxed(0, pcie_ep->parf + PARF_INT_ALL_MASK);
 	val = PARF_INT_ALL_LINK_DOWN | PARF_INT_ALL_BME |
 	      PARF_INT_ALL_PM_TURNOFF | PARF_INT_ALL_DSTATE_CHANGE |
-	      PARF_INT_ALL_LINK_UP;
+	      PARF_INT_ALL_LINK_UP | PARF_INT_ALL_EDMA;
 	writel_relaxed(val, pcie_ep->parf + PARF_INT_ALL_MASK);
 
 	ret = dw_pcie_ep_init_complete(&pcie_ep->pci.ep);
@@ -670,6 +671,7 @@ static int qcom_pcie_ep_probe(struct platform_device *pdev)
 	pcie_ep->pci.dev = dev;
 	pcie_ep->pci.ops = &pci_ops;
 	pcie_ep->pci.ep.ops = &pci_ep_ops;
+	pcie_ep->pci.edma.nr_irqs = 1;
 	platform_set_drvdata(pdev, pcie_ep);
 
 	ret = qcom_pcie_ep_get_resources(pdev, pcie_ep);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 05/11] PCI: qcom-ep: Disable IRQs during driver remove
  2022-08-30 16:58 [PATCH v2 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (3 preceding siblings ...)
  2022-08-30 16:58 ` [PATCH v2 04/11] PCI: qcom-ep: Add eDMA support Manivannan Sadhasivam
@ 2022-08-30 16:58 ` Manivannan Sadhasivam
  2022-08-30 16:58 ` [PATCH v2 06/11] PCI: qcom-ep: Add debugfs support for expose link transition counts Manivannan Sadhasivam
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 16:58 UTC (permalink / raw)
  To: lpieralisi, robh, andersson
  Cc: kw, bhelgaas, linux-pci, linux-arm-msm, linux-kernel,
	konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, devicetree,
	dmitry.baryshkov, Manivannan Sadhasivam

Disable the Global and PERST IRQs during driver remove to avoid getting
spurious IRQs after resource deallocation.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom-ep.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 54b927adf60a..98ef36e3a94d 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -586,11 +586,11 @@ static int qcom_pcie_ep_enable_irq_resources(struct platform_device *pdev,
 {
 	int irq, ret;
 
-	irq = platform_get_irq_byname(pdev, "global");
-	if (irq < 0)
-		return irq;
+	pcie_ep->global_irq = platform_get_irq_byname(pdev, "global");
+	if (pcie_ep->global_irq < 0)
+		return pcie_ep->global_irq;
 
-	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
+	ret = devm_request_threaded_irq(&pdev->dev, pcie_ep->global_irq, NULL,
 					qcom_pcie_ep_global_irq_thread,
 					IRQF_ONESHOT,
 					"global_irq", pcie_ep);
@@ -700,6 +700,9 @@ static int qcom_pcie_ep_remove(struct platform_device *pdev)
 {
 	struct qcom_pcie_ep *pcie_ep = platform_get_drvdata(pdev);
 
+	disable_irq(pcie_ep->global_irq);
+	disable_irq(pcie_ep->perst_irq);
+
 	if (pcie_ep->link_status == QCOM_PCIE_EP_LINK_DISABLED)
 		return 0;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 06/11] PCI: qcom-ep: Add debugfs support for expose link transition counts
  2022-08-30 16:58 [PATCH v2 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (4 preceding siblings ...)
  2022-08-30 16:58 ` [PATCH v2 05/11] PCI: qcom-ep: Disable IRQs during driver remove Manivannan Sadhasivam
@ 2022-08-30 16:58 ` Manivannan Sadhasivam
  2022-08-30 19:51   ` Bjorn Helgaas
  2022-08-30 16:58 ` [PATCH v2 07/11] dt-bindings: PCI: qcom-ep: Make PERST separation optional Manivannan Sadhasivam
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 18+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 16:58 UTC (permalink / raw)
  To: lpieralisi, robh, andersson
  Cc: kw, bhelgaas, linux-pci, linux-arm-msm, linux-kernel,
	konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, devicetree,
	dmitry.baryshkov, Manivannan Sadhasivam

Qualcomm PCIe controllers have the debug registers in the MMIO region
that counts the PCIe link transitions. Let's expose them over debugfs to
userspace to help debugging the low power issues.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom-ep.c | 60 +++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 98ef36e3a94d..54ac2fef8b88 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -10,6 +10,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/debugfs.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/mfd/syscon.h>
@@ -45,6 +46,11 @@
 #define PARF_ATU_BASE_ADDR			0x634
 #define PARF_ATU_BASE_ADDR_HI			0x638
 #define PARF_SRIS_MODE				0x644
+#define PARF_DEBUG_CNT_PM_LINKST_IN_L2		0xc04
+#define PARF_DEBUG_CNT_PM_LINKST_IN_L1		0xc0c
+#define PARF_DEBUG_CNT_PM_LINKST_IN_L0S		0xc10
+#define PARF_DEBUG_CNT_AUX_CLK_IN_L1SUB_L1	0xc84
+#define PARF_DEBUG_CNT_AUX_CLK_IN_L1SUB_L2	0xc88
 #define PARF_DEVICE_TYPE			0x1000
 #define PARF_BDF_TO_SID_CFG			0x2c00
 
@@ -136,12 +142,14 @@ enum qcom_pcie_ep_link_status {
  * @pci: Designware PCIe controller struct
  * @parf: Qualcomm PCIe specific PARF register base
  * @elbi: Designware PCIe specific ELBI register base
+ * @mmio: MMIO register base
  * @perst_map: PERST regmap
  * @mmio_res: MMIO region resource
  * @core_reset: PCIe Endpoint core reset
  * @reset: PERST# GPIO
  * @wake: WAKE# GPIO
  * @phy: PHY controller block
+ * @debugfs: PCIe Endpoint Debugfs directory
  * @clks: PCIe clocks
  * @num_clks: PCIe clocks count
  * @perst_en: Flag for PERST enable
@@ -155,6 +163,7 @@ struct qcom_pcie_ep {
 
 	void __iomem *parf;
 	void __iomem *elbi;
+	void __iomem *mmio;
 	struct regmap *perst_map;
 	struct resource *mmio_res;
 
@@ -162,6 +171,7 @@ struct qcom_pcie_ep {
 	struct gpio_desc *reset;
 	struct gpio_desc *wake;
 	struct phy *phy;
+	struct dentry *debugfs;
 
 	struct clk_bulk_data *clks;
 	int num_clks;
@@ -447,6 +457,9 @@ static int qcom_pcie_ep_get_io_resources(struct platform_device *pdev,
 
 	pcie_ep->mmio_res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
 							 "mmio");
+	pcie_ep->mmio = devm_pci_remap_cfg_resource(dev, pcie_ep->mmio_res);
+	if (IS_ERR(pcie_ep->mmio))
+		return PTR_ERR(pcie_ep->mmio);
 
 	syscon = of_parse_phandle(dev->of_node, "qcom,perst-regs", 0);
 	if (!syscon) {
@@ -630,6 +643,37 @@ static int qcom_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
 	}
 }
 
+static int qcom_pcie_ep_link_transition_count(struct seq_file *s, void *data)
+{
+	struct qcom_pcie_ep *pcie_ep = (struct qcom_pcie_ep *)
+				     dev_get_drvdata(s->private);
+
+	seq_printf(s, "L0s transition count: %u\n",
+		   readl_relaxed(pcie_ep->mmio + PARF_DEBUG_CNT_PM_LINKST_IN_L0S));
+
+	seq_printf(s, "L1 transition count: %u\n",
+		   readl_relaxed(pcie_ep->mmio + PARF_DEBUG_CNT_PM_LINKST_IN_L1));
+
+	seq_printf(s, "L1.1 transition count: %u\n",
+		   readl_relaxed(pcie_ep->mmio + PARF_DEBUG_CNT_AUX_CLK_IN_L1SUB_L1));
+
+	seq_printf(s, "L1.2 transition count: %u\n",
+		   readl_relaxed(pcie_ep->mmio + PARF_DEBUG_CNT_AUX_CLK_IN_L1SUB_L2));
+
+	seq_printf(s, "L2 transition count: %u\n",
+		   readl_relaxed(pcie_ep->mmio + PARF_DEBUG_CNT_PM_LINKST_IN_L2));
+
+	return 0;
+}
+
+static void qcom_pcie_ep_init_debugfs(struct qcom_pcie_ep *pcie_ep)
+{
+	struct dw_pcie *pci = &pcie_ep->pci;
+
+	debugfs_create_devm_seqfile(pci->dev, "link_transition_count", pcie_ep->debugfs,
+				    qcom_pcie_ep_link_transition_count);
+}
+
 static const struct pci_epc_features qcom_pcie_epc_features = {
 	.linkup_notifier = true,
 	.core_init_notifier = true,
@@ -662,6 +706,7 @@ static int qcom_pcie_ep_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct qcom_pcie_ep *pcie_ep;
+	char *name;
 	int ret;
 
 	pcie_ep = devm_kzalloc(dev, sizeof(*pcie_ep), GFP_KERNEL);
@@ -688,8 +733,21 @@ static int qcom_pcie_ep_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_disable_resources;
 
+	name = devm_kasprintf(dev, GFP_KERNEL, "%pOFP", dev->of_node);
+	if (!name) {
+		ret = -ENOMEM;
+		goto err_disable_irqs;
+	}
+
+	pcie_ep->debugfs = debugfs_create_dir(name, NULL);
+	qcom_pcie_ep_init_debugfs(pcie_ep);
+
 	return 0;
 
+err_disable_irqs:
+	disable_irq(pcie_ep->global_irq);
+	disable_irq(pcie_ep->perst_irq);
+
 err_disable_resources:
 	qcom_pcie_disable_resources(pcie_ep);
 
@@ -703,6 +761,8 @@ static int qcom_pcie_ep_remove(struct platform_device *pdev)
 	disable_irq(pcie_ep->global_irq);
 	disable_irq(pcie_ep->perst_irq);
 
+	debugfs_remove_recursive(pcie_ep->debugfs);
+
 	if (pcie_ep->link_status == QCOM_PCIE_EP_LINK_DISABLED)
 		return 0;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 07/11] dt-bindings: PCI: qcom-ep: Make PERST separation optional
  2022-08-30 16:58 [PATCH v2 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (5 preceding siblings ...)
  2022-08-30 16:58 ` [PATCH v2 06/11] PCI: qcom-ep: Add debugfs support for expose link transition counts Manivannan Sadhasivam
@ 2022-08-30 16:58 ` Manivannan Sadhasivam
  2022-08-30 16:58 ` [PATCH v2 08/11] " Manivannan Sadhasivam
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 16:58 UTC (permalink / raw)
  To: lpieralisi, robh, andersson
  Cc: kw, bhelgaas, linux-pci, linux-arm-msm, linux-kernel,
	konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, devicetree,
	dmitry.baryshkov, Manivannan Sadhasivam, Krzysztof Kozlowski

PERST separation is an optional debug feature used to collect the crash
dump from the PCIe endpoint devices by the PCIe host when the endpoint
crashes. This feature keeps the PCIe link up by separating the PCIe IP
block from the SoC reset logic.

So remove the corresponding property "qcom,perst-regs" from the required
properties list.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml b/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
index 3d23599e5e91..b728ede3f09f 100644
--- a/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
+++ b/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
@@ -105,7 +105,6 @@ required:
   - reg-names
   - clocks
   - clock-names
-  - qcom,perst-regs
   - interrupts
   - interrupt-names
   - reset-gpios
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 08/11] PCI: qcom-ep: Make PERST separation optional
  2022-08-30 16:58 [PATCH v2 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (6 preceding siblings ...)
  2022-08-30 16:58 ` [PATCH v2 07/11] dt-bindings: PCI: qcom-ep: Make PERST separation optional Manivannan Sadhasivam
@ 2022-08-30 16:58 ` Manivannan Sadhasivam
  2022-08-30 16:58 ` [PATCH v2 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform Manivannan Sadhasivam
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 16:58 UTC (permalink / raw)
  To: lpieralisi, robh, andersson
  Cc: kw, bhelgaas, linux-pci, linux-arm-msm, linux-kernel,
	konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, devicetree,
	dmitry.baryshkov, Manivannan Sadhasivam

PERST separation is an optional debug feature used to collect the crash
dump from the PCIe endpoint devices by the PCIe host when the endpoint
crashes. This feature keeps the PCIe link up by separating the PCIe IP
block from the SoC reset logic.

Hence, make the property optional in the driver.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom-ep.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 54ac2fef8b88..4908f08bd90b 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -216,8 +216,10 @@ static int qcom_pcie_ep_core_reset(struct qcom_pcie_ep *pcie_ep)
  */
 static void qcom_pcie_ep_configure_tcsr(struct qcom_pcie_ep *pcie_ep)
 {
-	regmap_write(pcie_ep->perst_map, pcie_ep->perst_en, 0);
-	regmap_write(pcie_ep->perst_map, pcie_ep->perst_sep_en, 0);
+	if (pcie_ep->perst_map) {
+		regmap_write(pcie_ep->perst_map, pcie_ep->perst_en, 0);
+		regmap_write(pcie_ep->perst_map, pcie_ep->perst_sep_en, 0);
+	}
 }
 
 static int qcom_pcie_dw_link_up(struct dw_pcie *pci)
@@ -463,8 +465,8 @@ static int qcom_pcie_ep_get_io_resources(struct platform_device *pdev,
 
 	syscon = of_parse_phandle(dev->of_node, "qcom,perst-regs", 0);
 	if (!syscon) {
-		dev_err(dev, "Failed to parse qcom,perst-regs\n");
-		return -EINVAL;
+		dev_dbg(dev, "PERST separation not available\n");
+		return 0;
 	}
 
 	pcie_ep->perst_map = syscon_node_to_regmap(syscon);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform
  2022-08-30 16:58 [PATCH v2 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (7 preceding siblings ...)
  2022-08-30 16:58 ` [PATCH v2 08/11] " Manivannan Sadhasivam
@ 2022-08-30 16:58 ` Manivannan Sadhasivam
  2022-08-30 18:40   ` Krzysztof Kozlowski
  2022-08-31 11:39   ` Rob Herring
  2022-08-30 16:58 ` [PATCH v2 10/11] dt-bindings: PCI: qcom-ep: Add support for SM8450 SoC Manivannan Sadhasivam
  2022-08-30 16:58 ` [PATCH v2 11/11] " Manivannan Sadhasivam
  10 siblings, 2 replies; 18+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 16:58 UTC (permalink / raw)
  To: lpieralisi, robh, andersson
  Cc: kw, bhelgaas, linux-pci, linux-arm-msm, linux-kernel,
	konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, devicetree,
	dmitry.baryshkov, Manivannan Sadhasivam

In preparation of adding the bindings for future SoCs, let's define the
clocks per platform.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 .../devicetree/bindings/pci/qcom,pcie-ep.yaml | 51 ++++++++++++-------
 1 file changed, 32 insertions(+), 19 deletions(-)

diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml b/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
index b728ede3f09f..a15e71491722 100644
--- a/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
+++ b/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
@@ -9,9 +9,6 @@ title: Qualcomm PCIe Endpoint Controller binding
 maintainers:
   - Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
 
-allOf:
-  - $ref: "pci-ep.yaml#"
-
 properties:
   compatible:
     const: qcom,sdx55-pcie-ep
@@ -35,24 +32,10 @@ properties:
       - const: mmio
 
   clocks:
-    items:
-      - description: PCIe Auxiliary clock
-      - description: PCIe CFG AHB clock
-      - description: PCIe Master AXI clock
-      - description: PCIe Slave AXI clock
-      - description: PCIe Slave Q2A AXI clock
-      - description: PCIe Sleep clock
-      - description: PCIe Reference clock
+    maxItems: 7
 
   clock-names:
-    items:
-      - const: aux
-      - const: cfg
-      - const: bus_master
-      - const: bus_slave
-      - const: slave_q2a
-      - const: sleep
-      - const: ref
+    maxItems: 7
 
   qcom,perst-regs:
     description: Reference to a syscon representing TCSR followed by the two
@@ -112,6 +95,36 @@ required:
   - reset-names
   - power-domains
 
+allOf:
+  - $ref: pci-ep.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - qcom,sdx55-pcie-ep
+    then:
+      properties:
+        clocks:
+          maxItems: 7
+          items:
+            - description: PCIe Auxiliary clock
+            - description: PCIe CFG AHB clock
+            - description: PCIe Master AXI clock
+            - description: PCIe Slave AXI clock
+            - description: PCIe Slave Q2A AXI clock
+            - description: PCIe Sleep clock
+            - description: PCIe Reference clock
+        clock-names:
+          items:
+            - const: aux
+            - const: cfg
+            - const: bus_master
+            - const: bus_slave
+            - const: slave_q2a
+            - const: sleep
+            - const: ref
+
 unevaluatedProperties: false
 
 examples:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 10/11] dt-bindings: PCI: qcom-ep: Add support for SM8450 SoC
  2022-08-30 16:58 [PATCH v2 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (8 preceding siblings ...)
  2022-08-30 16:58 ` [PATCH v2 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform Manivannan Sadhasivam
@ 2022-08-30 16:58 ` Manivannan Sadhasivam
  2022-08-30 18:41   ` Krzysztof Kozlowski
  2022-08-30 16:58 ` [PATCH v2 11/11] " Manivannan Sadhasivam
  10 siblings, 1 reply; 18+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 16:58 UTC (permalink / raw)
  To: lpieralisi, robh, andersson
  Cc: kw, bhelgaas, linux-pci, linux-arm-msm, linux-kernel,
	konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, devicetree,
	dmitry.baryshkov, Manivannan Sadhasivam

Add devicetree bindings support for SM8450 SoC. Only the clocks are
different on this platform, rest is same as SDX55.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 .../devicetree/bindings/pci/qcom,pcie-ep.yaml | 40 +++++++++++++++++--
 1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml b/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
index a15e71491722..5902b45620ed 100644
--- a/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
+++ b/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
@@ -11,7 +11,9 @@ maintainers:
 
 properties:
   compatible:
-    const: qcom,sdx55-pcie-ep
+    enum:
+      - qcom,sdx55-pcie-ep
+      - qcom,sm8450-pcie-ep
 
   reg:
     items:
@@ -32,10 +34,12 @@ properties:
       - const: mmio
 
   clocks:
-    maxItems: 7
+    minItems: 7
+    maxItems: 8
 
   clock-names:
-    maxItems: 7
+    minItems: 7
+    maxItems: 8
 
   qcom,perst-regs:
     description: Reference to a syscon representing TCSR followed by the two
@@ -125,6 +129,36 @@ allOf:
             - const: sleep
             - const: ref
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - qcom,sm8450-pcie-ep
+    then:
+      properties:
+        clocks:
+          maxItems: 8
+          items:
+            - description: PCIe Auxiliary clock
+            - description: PCIe CFG AHB clock
+            - description: PCIe Master AXI clock
+            - description: PCIe Slave AXI clock
+            - description: PCIe Slave Q2A AXI clock
+            - description: PCIe Reference clock
+            - description: PCIe DDRSS SF TBU clock
+            - description: PCIe AGGRE NOC AXI clock
+        clock-names:
+          items:
+            - const: aux
+            - const: cfg
+            - const: bus_master
+            - const: bus_slave
+            - const: slave_q2a
+            - const: ref
+            - const: ddrss_sf_tbu
+            - const: aggre_noc_axi
+
 unevaluatedProperties: false
 
 examples:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 11/11] PCI: qcom-ep: Add support for SM8450 SoC
  2022-08-30 16:58 [PATCH v2 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (9 preceding siblings ...)
  2022-08-30 16:58 ` [PATCH v2 10/11] dt-bindings: PCI: qcom-ep: Add support for SM8450 SoC Manivannan Sadhasivam
@ 2022-08-30 16:58 ` Manivannan Sadhasivam
  10 siblings, 0 replies; 18+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 16:58 UTC (permalink / raw)
  To: lpieralisi, robh, andersson
  Cc: kw, bhelgaas, linux-pci, linux-arm-msm, linux-kernel,
	konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, devicetree,
	dmitry.baryshkov, Manivannan Sadhasivam

Add support for SM8450 SoC to the Qualcomm PCIe Endpoint Controller
driver. The driver uses the same config as of the existing SDX55 chipset.
So additional settings are not required.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom-ep.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 4908f08bd90b..fa1819c9f667 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -775,6 +775,7 @@ static int qcom_pcie_ep_remove(struct platform_device *pdev)
 
 static const struct of_device_id qcom_pcie_ep_match[] = {
 	{ .compatible = "qcom,sdx55-pcie-ep", },
+	{ .compatible = "qcom,sm8450-pcie-ep", },
 	{ }
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform
  2022-08-30 16:58 ` [PATCH v2 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform Manivannan Sadhasivam
@ 2022-08-30 18:40   ` Krzysztof Kozlowski
  2022-08-31 11:39   ` Rob Herring
  1 sibling, 0 replies; 18+ messages in thread
From: Krzysztof Kozlowski @ 2022-08-30 18:40 UTC (permalink / raw)
  To: Manivannan Sadhasivam, lpieralisi, robh, andersson
  Cc: kw, bhelgaas, linux-pci, linux-arm-msm, linux-kernel,
	konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, devicetree,
	dmitry.baryshkov

On 30/08/2022 19:58, Manivannan Sadhasivam wrote:
> In preparation of adding the bindings for future SoCs, let's define the
> clocks per platform.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Thank you for your patch. There is something to discuss/improve.

(....)

>  
>    qcom,perst-regs:
>      description: Reference to a syscon representing TCSR followed by the two
> @@ -112,6 +95,36 @@ required:
>    - reset-names
>    - power-domains
>  
> +allOf:
> +  - $ref: pci-ep.yaml#
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - qcom,sdx55-pcie-ep
> +    then:
> +      properties:
> +        clocks:
> +          maxItems: 7

maxItems is not needed now.


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 10/11] dt-bindings: PCI: qcom-ep: Add support for SM8450 SoC
  2022-08-30 16:58 ` [PATCH v2 10/11] dt-bindings: PCI: qcom-ep: Add support for SM8450 SoC Manivannan Sadhasivam
@ 2022-08-30 18:41   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 18+ messages in thread
From: Krzysztof Kozlowski @ 2022-08-30 18:41 UTC (permalink / raw)
  To: Manivannan Sadhasivam, lpieralisi, robh, andersson
  Cc: kw, bhelgaas, linux-pci, linux-arm-msm, linux-kernel,
	konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, devicetree,
	dmitry.baryshkov

On 30/08/2022 19:58, Manivannan Sadhasivam wrote:
>    clock-names:
> -    maxItems: 7
> +    minItems: 7
> +    maxItems: 8
>  
>    qcom,perst-regs:
>      description: Reference to a syscon representing TCSR followed by the two
> @@ -125,6 +129,36 @@ allOf:
>              - const: sleep
>              - const: ref
>  
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - qcom,sm8450-pcie-ep
> +    then:
> +      properties:
> +        clocks:
> +          maxItems: 8

Same as in previous patch - maxItems is not needed now.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 06/11] PCI: qcom-ep: Add debugfs support for expose link transition counts
  2022-08-30 16:58 ` [PATCH v2 06/11] PCI: qcom-ep: Add debugfs support for expose link transition counts Manivannan Sadhasivam
@ 2022-08-30 19:51   ` Bjorn Helgaas
  0 siblings, 0 replies; 18+ messages in thread
From: Bjorn Helgaas @ 2022-08-30 19:51 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: lpieralisi, robh, andersson, kw, bhelgaas, linux-pci,
	linux-arm-msm, linux-kernel, konrad.dybcio, robh+dt,
	krzysztof.kozlowski+dt, devicetree, dmitry.baryshkov

In subject:

  PCI: qcom-ep: Expose link transition counts via debugfs

On Tue, Aug 30, 2022 at 10:28:12PM +0530, Manivannan Sadhasivam wrote:
> Qualcomm PCIe controllers have the debug registers in the MMIO region
> that counts the PCIe link transitions. Let's expose them over debugfs to
> userspace to help debugging the low power issues.

s/have the debug/have debug/
s/that counts the/that count/
s/Let's expose/Expose/
s/to help debugging the/to help debug/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform
  2022-08-30 16:58 ` [PATCH v2 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform Manivannan Sadhasivam
  2022-08-30 18:40   ` Krzysztof Kozlowski
@ 2022-08-31 11:39   ` Rob Herring
  1 sibling, 0 replies; 18+ messages in thread
From: Rob Herring @ 2022-08-31 11:39 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: kw, andersson, linux-kernel, lpieralisi, dmitry.baryshkov,
	robh+dt, linux-arm-msm, konrad.dybcio, linux-pci,
	krzysztof.kozlowski+dt, devicetree, bhelgaas

On Tue, 30 Aug 2022 22:28:15 +0530, Manivannan Sadhasivam wrote:
> In preparation of adding the bindings for future SoCs, let's define the
> clocks per platform.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>  .../devicetree/bindings/pci/qcom,pcie-ep.yaml | 51 ++++++++++++-------
>  1 file changed, 32 insertions(+), 19 deletions(-)
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml: allOf:1:then:properties:clocks: {'maxItems': 7, 'items': [{'description': 'PCIe Auxiliary clock'}, {'description': 'PCIe CFG AHB clock'}, {'description': 'PCIe Master AXI clock'}, {'description': 'PCIe Slave AXI clock'}, {'description': 'PCIe Slave Q2A AXI clock'}, {'description': 'PCIe Sleep clock'}, {'description': 'PCIe Reference clock'}]} should not be valid under {'required': ['maxItems']}
	hint: "maxItems" is not needed with an "items" list
	from schema $id: http://devicetree.org/meta-schemas/items.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml: ignoring, error in schema: allOf: 1: then: properties: clocks
Documentation/devicetree/bindings/pci/qcom,pcie-ep.example.dtb:0:0: /example-0/pcie-ep@40000000: failed to match any schema with compatible: ['qcom,sdx55-pcie-ep']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 04/11] PCI: qcom-ep: Add eDMA support
  2022-08-30 16:58 ` [PATCH v2 04/11] PCI: qcom-ep: Add eDMA support Manivannan Sadhasivam
@ 2022-09-03  2:36   ` kernel test robot
  2022-09-10  5:32     ` Manivannan Sadhasivam
  0 siblings, 1 reply; 18+ messages in thread
From: kernel test robot @ 2022-09-03  2:36 UTC (permalink / raw)
  To: Manivannan Sadhasivam, lpieralisi, robh, andersson
  Cc: kbuild-all, kw, bhelgaas, linux-pci, linux-arm-msm, linux-kernel,
	konrad.dybcio, robh+dt, krzysztof.kozlowski+dt, devicetree,
	dmitry.baryshkov, Manivannan Sadhasivam

Hi Manivannan,

I love your patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on linus/master v6.0-rc3 next-20220901]
[cannot apply to helgaas-pci/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Manivannan-Sadhasivam/Improvements-to-the-Qcom-PCIe-Endpoint-driver/20220831-010315
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20220903/202209031046.rOZKOVqT-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/dec4c93b2077408cecddd53950905bf2411019b0
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Manivannan-Sadhasivam/Improvements-to-the-Qcom-PCIe-Endpoint-driver/20220831-010315
        git checkout dec4c93b2077408cecddd53950905bf2411019b0
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/pci/controller/dwc/pcie-qcom-ep.c: In function 'qcom_pcie_ep_probe':
>> drivers/pci/controller/dwc/pcie-qcom-ep.c:672:21: error: 'struct dw_pcie' has no member named 'edma'
     672 |         pcie_ep->pci.edma.nr_irqs = 1;
         |                     ^


vim +672 drivers/pci/controller/dwc/pcie-qcom-ep.c

   658	
   659	static int qcom_pcie_ep_probe(struct platform_device *pdev)
   660	{
   661		struct device *dev = &pdev->dev;
   662		struct qcom_pcie_ep *pcie_ep;
   663		int ret;
   664	
   665		pcie_ep = devm_kzalloc(dev, sizeof(*pcie_ep), GFP_KERNEL);
   666		if (!pcie_ep)
   667			return -ENOMEM;
   668	
   669		pcie_ep->pci.dev = dev;
   670		pcie_ep->pci.ops = &pci_ops;
   671		pcie_ep->pci.ep.ops = &pci_ep_ops;
 > 672		pcie_ep->pci.edma.nr_irqs = 1;
   673		platform_set_drvdata(pdev, pcie_ep);
   674	
   675		ret = qcom_pcie_ep_get_resources(pdev, pcie_ep);
   676		if (ret)
   677			return ret;
   678	
   679		ret = qcom_pcie_enable_resources(pcie_ep);
   680		if (ret) {
   681			dev_err(dev, "Failed to enable resources: %d\n", ret);
   682			return ret;
   683		}
   684	
   685		ret = dw_pcie_ep_init(&pcie_ep->pci.ep);
   686		if (ret) {
   687			dev_err(dev, "Failed to initialize endpoint: %d\n", ret);
   688			goto err_disable_resources;
   689		}
   690	
   691		ret = qcom_pcie_ep_enable_irq_resources(pdev, pcie_ep);
   692		if (ret)
   693			goto err_disable_resources;
   694	
   695		return 0;
   696	
   697	err_disable_resources:
   698		qcom_pcie_disable_resources(pcie_ep);
   699	
   700		return ret;
   701	}
   702	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 04/11] PCI: qcom-ep: Add eDMA support
  2022-09-03  2:36   ` kernel test robot
@ 2022-09-10  5:32     ` Manivannan Sadhasivam
  0 siblings, 0 replies; 18+ messages in thread
From: Manivannan Sadhasivam @ 2022-09-10  5:32 UTC (permalink / raw)
  To: kernel test robot
  Cc: lpieralisi, robh, andersson, kbuild-all, kw, bhelgaas, linux-pci,
	linux-arm-msm, linux-kernel, konrad.dybcio, robh+dt,
	krzysztof.kozlowski+dt, devicetree, dmitry.baryshkov

On Sat, Sep 03, 2022 at 10:36:53AM +0800, kernel test robot wrote:
> Hi Manivannan,
> 
> I love your patch! Yet something to improve:
> 
> [auto build test ERROR on robh/for-next]
> [also build test ERROR on linus/master v6.0-rc3 next-20220901]
> [cannot apply to helgaas-pci/next]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Manivannan-Sadhasivam/Improvements-to-the-Qcom-PCIe-Endpoint-driver/20220831-010315
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
> config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20220903/202209031046.rOZKOVqT-lkp@intel.com/config)
> compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://github.com/intel-lab-lkp/linux/commit/dec4c93b2077408cecddd53950905bf2411019b0
>         git remote add linux-review https://github.com/intel-lab-lkp/linux
>         git fetch --no-tags linux-review Manivannan-Sadhasivam/Improvements-to-the-Qcom-PCIe-Endpoint-driver/20220831-010315
>         git checkout dec4c93b2077408cecddd53950905bf2411019b0
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    drivers/pci/controller/dwc/pcie-qcom-ep.c: In function 'qcom_pcie_ep_probe':
> >> drivers/pci/controller/dwc/pcie-qcom-ep.c:672:21: error: 'struct dw_pcie' has no member named 'edma'
>      672 |         pcie_ep->pci.edma.nr_irqs = 1;

This patch depends on the eDMA series from Sergey (Sorry, I forgot to mention
this in cover letter):
[PATCH RESEND v5 00/24] dmaengine: dw-edma: Add RP/EP local DMA controllers support

But the eDMA series is still getting reviews and I don't hear any news about
respin. So in the next revision I'm gonna drop this patch.

Thanks,
Mani

>          |                     ^
> 
> 
> vim +672 drivers/pci/controller/dwc/pcie-qcom-ep.c
> 
>    658	
>    659	static int qcom_pcie_ep_probe(struct platform_device *pdev)
>    660	{
>    661		struct device *dev = &pdev->dev;
>    662		struct qcom_pcie_ep *pcie_ep;
>    663		int ret;
>    664	
>    665		pcie_ep = devm_kzalloc(dev, sizeof(*pcie_ep), GFP_KERNEL);
>    666		if (!pcie_ep)
>    667			return -ENOMEM;
>    668	
>    669		pcie_ep->pci.dev = dev;
>    670		pcie_ep->pci.ops = &pci_ops;
>    671		pcie_ep->pci.ep.ops = &pci_ep_ops;
>  > 672		pcie_ep->pci.edma.nr_irqs = 1;
>    673		platform_set_drvdata(pdev, pcie_ep);
>    674	
>    675		ret = qcom_pcie_ep_get_resources(pdev, pcie_ep);
>    676		if (ret)
>    677			return ret;
>    678	
>    679		ret = qcom_pcie_enable_resources(pcie_ep);
>    680		if (ret) {
>    681			dev_err(dev, "Failed to enable resources: %d\n", ret);
>    682			return ret;
>    683		}
>    684	
>    685		ret = dw_pcie_ep_init(&pcie_ep->pci.ep);
>    686		if (ret) {
>    687			dev_err(dev, "Failed to initialize endpoint: %d\n", ret);
>    688			goto err_disable_resources;
>    689		}
>    690	
>    691		ret = qcom_pcie_ep_enable_irq_resources(pdev, pcie_ep);
>    692		if (ret)
>    693			goto err_disable_resources;
>    694	
>    695		return 0;
>    696	
>    697	err_disable_resources:
>    698		qcom_pcie_disable_resources(pcie_ep);
>    699	
>    700		return ret;
>    701	}
>    702	
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://01.org/lkp

-- 
மணிவண்ணன் சதாசிவம்

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2022-09-10  5:32 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-30 16:58 [PATCH v2 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
2022-08-30 16:58 ` [PATCH v2 01/11] PCI: qcom-ep: Add kernel-doc for qcom_pcie_ep structure Manivannan Sadhasivam
2022-08-30 16:58 ` [PATCH v2 02/11] PCI: qcom-ep: Do not use hardcoded clks in driver Manivannan Sadhasivam
2022-08-30 16:58 ` [PATCH v2 03/11] PCI: qcom-ep: Make use of the cached dev pointer Manivannan Sadhasivam
2022-08-30 16:58 ` [PATCH v2 04/11] PCI: qcom-ep: Add eDMA support Manivannan Sadhasivam
2022-09-03  2:36   ` kernel test robot
2022-09-10  5:32     ` Manivannan Sadhasivam
2022-08-30 16:58 ` [PATCH v2 05/11] PCI: qcom-ep: Disable IRQs during driver remove Manivannan Sadhasivam
2022-08-30 16:58 ` [PATCH v2 06/11] PCI: qcom-ep: Add debugfs support for expose link transition counts Manivannan Sadhasivam
2022-08-30 19:51   ` Bjorn Helgaas
2022-08-30 16:58 ` [PATCH v2 07/11] dt-bindings: PCI: qcom-ep: Make PERST separation optional Manivannan Sadhasivam
2022-08-30 16:58 ` [PATCH v2 08/11] " Manivannan Sadhasivam
2022-08-30 16:58 ` [PATCH v2 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform Manivannan Sadhasivam
2022-08-30 18:40   ` Krzysztof Kozlowski
2022-08-31 11:39   ` Rob Herring
2022-08-30 16:58 ` [PATCH v2 10/11] dt-bindings: PCI: qcom-ep: Add support for SM8450 SoC Manivannan Sadhasivam
2022-08-30 18:41   ` Krzysztof Kozlowski
2022-08-30 16:58 ` [PATCH v2 11/11] " Manivannan Sadhasivam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).