linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/11] Improvements to the Qcom PCIe Endpoint driver
@ 2022-08-26 18:19 Manivannan Sadhasivam
  2022-08-26 18:19 ` [PATCH 01/11] PCI: qcom-ep: Add kernel-doc for qcom_pcie_ep structure Manivannan Sadhasivam
                   ` (10 more replies)
  0 siblings, 11 replies; 19+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-26 18:19 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

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 |  70 ++++++---
 drivers/pci/controller/dwc/pcie-qcom-ep.c     | 140 ++++++++++++++----
 2 files changed, 159 insertions(+), 51 deletions(-)

-- 
2.25.1


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

* [PATCH 01/11] PCI: qcom-ep: Add kernel-doc for qcom_pcie_ep structure
  2022-08-26 18:19 [PATCH 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
@ 2022-08-26 18:19 ` Manivannan Sadhasivam
  2022-08-26 18:19 ` [PATCH 02/11] PCI: qcom-ep: Do not use hardcoded clks in driver Manivannan Sadhasivam
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-26 18:19 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] 19+ messages in thread

* [PATCH 02/11] PCI: qcom-ep: Do not use hardcoded clks in driver
  2022-08-26 18:19 [PATCH 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
  2022-08-26 18:19 ` [PATCH 01/11] PCI: qcom-ep: Add kernel-doc for qcom_pcie_ep structure Manivannan Sadhasivam
@ 2022-08-26 18:19 ` Manivannan Sadhasivam
  2022-08-26 18:19 ` [PATCH 03/11] PCI: qcom-ep: Make use of the cached dev pointer Manivannan Sadhasivam
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-26 18:19 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] 19+ messages in thread

* [PATCH 03/11] PCI: qcom-ep: Make use of the cached dev pointer
  2022-08-26 18:19 [PATCH 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
  2022-08-26 18:19 ` [PATCH 01/11] PCI: qcom-ep: Add kernel-doc for qcom_pcie_ep structure Manivannan Sadhasivam
  2022-08-26 18:19 ` [PATCH 02/11] PCI: qcom-ep: Do not use hardcoded clks in driver Manivannan Sadhasivam
@ 2022-08-26 18:19 ` Manivannan Sadhasivam
  2022-08-26 18:19 ` [PATCH 04/11] PCI: qcom-ep: Add eDMA support Manivannan Sadhasivam
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-26 18:19 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] 19+ messages in thread

* [PATCH 04/11] PCI: qcom-ep: Add eDMA support
  2022-08-26 18:19 [PATCH 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (2 preceding siblings ...)
  2022-08-26 18:19 ` [PATCH 03/11] PCI: qcom-ep: Make use of the cached dev pointer Manivannan Sadhasivam
@ 2022-08-26 18:19 ` Manivannan Sadhasivam
  2022-08-26 18:19 ` [PATCH 05/11] PCI: qcom-ep: Disable IRQs during driver remove Manivannan Sadhasivam
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-26 18:19 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] 19+ messages in thread

* [PATCH 05/11] PCI: qcom-ep: Disable IRQs during driver remove
  2022-08-26 18:19 [PATCH 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (3 preceding siblings ...)
  2022-08-26 18:19 ` [PATCH 04/11] PCI: qcom-ep: Add eDMA support Manivannan Sadhasivam
@ 2022-08-26 18:19 ` Manivannan Sadhasivam
  2022-08-26 18:19 ` [PATCH 06/11] PCI: qcom-ep: Add debugfs support for expose link transition counts Manivannan Sadhasivam
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-26 18:19 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] 19+ messages in thread

* [PATCH 06/11] PCI: qcom-ep: Add debugfs support for expose link transition counts
  2022-08-26 18:19 [PATCH 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (4 preceding siblings ...)
  2022-08-26 18:19 ` [PATCH 05/11] PCI: qcom-ep: Disable IRQs during driver remove Manivannan Sadhasivam
@ 2022-08-26 18:19 ` Manivannan Sadhasivam
  2022-08-26 18:19 ` [PATCH 07/11] dt-bindings: PCI: qcom-ep: Make PERST separation optional Manivannan Sadhasivam
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-26 18:19 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] 19+ messages in thread

* [PATCH 07/11] dt-bindings: PCI: qcom-ep: Make PERST separation optional
  2022-08-26 18:19 [PATCH 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (5 preceding siblings ...)
  2022-08-26 18:19 ` [PATCH 06/11] PCI: qcom-ep: Add debugfs support for expose link transition counts Manivannan Sadhasivam
@ 2022-08-26 18:19 ` Manivannan Sadhasivam
  2022-08-28 15:12   ` Krzysztof Kozlowski
  2022-08-26 18:19 ` [PATCH 08/11] " Manivannan Sadhasivam
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 19+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-26 18:19 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.

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

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] 19+ messages in thread

* [PATCH 08/11] PCI: qcom-ep: Make PERST separation optional
  2022-08-26 18:19 [PATCH 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (6 preceding siblings ...)
  2022-08-26 18:19 ` [PATCH 07/11] dt-bindings: PCI: qcom-ep: Make PERST separation optional Manivannan Sadhasivam
@ 2022-08-26 18:19 ` Manivannan Sadhasivam
  2022-08-26 18:19 ` [PATCH 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform Manivannan Sadhasivam
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-26 18:19 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] 19+ messages in thread

* [PATCH 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform
  2022-08-26 18:19 [PATCH 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (7 preceding siblings ...)
  2022-08-26 18:19 ` [PATCH 08/11] " Manivannan Sadhasivam
@ 2022-08-26 18:19 ` Manivannan Sadhasivam
  2022-08-28 15:14   ` Krzysztof Kozlowski
  2022-08-28 15:20   ` Krzysztof Kozlowski
  2022-08-26 18:19 ` [PATCH 10/11] dt-bindings: PCI: qcom-ep: Add support for SM8450 SoC Manivannan Sadhasivam
  2022-08-26 18:19 ` [PATCH 11/11] " Manivannan Sadhasivam
  10 siblings, 2 replies; 19+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-26 18:19 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 | 46 +++++++++++--------
 1 file changed, 27 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..83a2cfc63bc1 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,12 @@ 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
+    minItems: 7
+    maxItems: 7
 
   clock-names:
-    items:
-      - const: aux
-      - const: cfg
-      - const: bus_master
-      - const: bus_slave
-      - const: slave_q2a
-      - const: sleep
-      - const: ref
+    minItems: 7
+    maxItems: 7
 
   qcom,perst-regs:
     description: Reference to a syscon representing TCSR followed by the two
@@ -112,6 +97,29 @@ required:
   - reset-names
   - power-domains
 
+allOf:
+  - $ref: "pci-ep.yaml#"
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - qcom,sdx55-pcie-ep
+    then:
+      properties:
+        clocks:
+          minItems: 7
+          maxItems: 7
+        clock-names:
+          items:
+            - const: aux # PCIe Auxiliary clock
+            - const: cfg # PCIe CFG AHB clock
+            - const: bus_master # PCIe Master AXI clock
+            - const: bus_slave # PCIe Slave AXI clock
+            - const: slave_q2a # PCIe Slave Q2A AXI clock
+            - const: sleep # PCIe Sleep clock
+            - const: ref # PCIe Reference clock
+
 unevaluatedProperties: false
 
 examples:
-- 
2.25.1


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

* [PATCH 10/11] dt-bindings: PCI: qcom-ep: Add support for SM8450 SoC
  2022-08-26 18:19 [PATCH 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (8 preceding siblings ...)
  2022-08-26 18:19 ` [PATCH 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform Manivannan Sadhasivam
@ 2022-08-26 18:19 ` Manivannan Sadhasivam
  2022-08-28 14:21   ` Rob Herring
  2022-08-28 15:17   ` Krzysztof Kozlowski
  2022-08-26 18:19 ` [PATCH 11/11] " Manivannan Sadhasivam
  10 siblings, 2 replies; 19+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-26 18:19 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 | 27 +++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

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


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

* [PATCH 11/11] PCI: qcom-ep: Add support for SM8450 SoC
  2022-08-26 18:19 [PATCH 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
                   ` (9 preceding siblings ...)
  2022-08-26 18:19 ` [PATCH 10/11] dt-bindings: PCI: qcom-ep: Add support for SM8450 SoC Manivannan Sadhasivam
@ 2022-08-26 18:19 ` Manivannan Sadhasivam
  10 siblings, 0 replies; 19+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-26 18:19 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] 19+ messages in thread

* Re: [PATCH 10/11] dt-bindings: PCI: qcom-ep: Add support for SM8450 SoC
  2022-08-26 18:19 ` [PATCH 10/11] dt-bindings: PCI: qcom-ep: Add support for SM8450 SoC Manivannan Sadhasivam
@ 2022-08-28 14:21   ` Rob Herring
  2022-08-28 15:17   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 19+ messages in thread
From: Rob Herring @ 2022-08-28 14:21 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: devicetree, kw, bhelgaas, andersson, linux-kernel, konrad.dybcio,
	krzysztof.kozlowski+dt, linux-pci, lpieralisi, dmitry.baryshkov,
	linux-arm-msm, robh+dt

On Fri, 26 Aug 2022 23:49:22 +0530, Manivannan Sadhasivam wrote:
> 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 | 27 +++++++++++++++++--
>  1 file changed, 25 insertions(+), 2 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:
./Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml:15:5: [error] duplication of key "const" in mapping (key-duplicates)

dtschema/dtc warnings/errors:
make[1]: *** Deleting file 'Documentation/devicetree/bindings/pci/qcom,pcie-ep.example.dts'
Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml:15:5: found duplicate key "const" with value "qcom,sm8450-pcie-ep" (original value: "qcom,sdx55-pcie-ep")
make[1]: *** [Documentation/devicetree/bindings/Makefile:26: Documentation/devicetree/bindings/pci/qcom,pcie-ep.example.dts] Error 1
make[1]: *** Waiting for unfinished jobs....
./Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml:15:5: found duplicate key "const" with value "qcom,sm8450-pcie-ep" (original value: "qcom,sdx55-pcie-ep")
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml: ignoring, error parsing file
make: *** [Makefile:1420: dt_binding_check] Error 2

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] 19+ messages in thread

* Re: [PATCH 07/11] dt-bindings: PCI: qcom-ep: Make PERST separation optional
  2022-08-26 18:19 ` [PATCH 07/11] dt-bindings: PCI: qcom-ep: Make PERST separation optional Manivannan Sadhasivam
@ 2022-08-28 15:12   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2022-08-28 15:12 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 26/08/2022 21:19, Manivannan Sadhasivam wrote:
> 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.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>


Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof

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

* Re: [PATCH 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform
  2022-08-26 18:19 ` [PATCH 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform Manivannan Sadhasivam
@ 2022-08-28 15:14   ` Krzysztof Kozlowski
  2022-08-28 15:20   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2022-08-28 15:14 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 26/08/2022 21:19, 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 | 46 +++++++++++--------
>  1 file changed, 27 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..83a2cfc63bc1 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,12 @@ 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
> +    minItems: 7

MinItems is not needed. They should be added in your next patch.

> +    maxItems: 7
>  
>    clock-names:
> -    items:
> -      - const: aux
> -      - const: cfg
> -      - const: bus_master
> -      - const: bus_slave
> -      - const: slave_q2a
> -      - const: sleep
> -      - const: ref
> +    minItems: 7

MinItems is not needed. They should be added in your next patch.


> +    maxItems: 7
>  
>    qcom,perst-regs:
>      description: Reference to a syscon representing TCSR followed by the two
> @@ -112,6 +97,29 @@ required:
>    - reset-names
>    - power-domains
>  
> +allOf:
> +  - $ref: "pci-ep.yaml#"

While moving this line around, drop the quotes.

> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - qcom,sdx55-pcie-ep
> +    then:
> +      properties:
> +        clocks:
> +          minItems: 7

minItems is not needed

> +          maxItems: 7

Best regards,
Krzysztof

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

* Re: [PATCH 10/11] dt-bindings: PCI: qcom-ep: Add support for SM8450 SoC
  2022-08-26 18:19 ` [PATCH 10/11] dt-bindings: PCI: qcom-ep: Add support for SM8450 SoC Manivannan Sadhasivam
  2022-08-28 14:21   ` Rob Herring
@ 2022-08-28 15:17   ` Krzysztof Kozlowski
  2022-08-30 11:57     ` Manivannan Sadhasivam
  1 sibling, 1 reply; 19+ messages in thread
From: Krzysztof Kozlowski @ 2022-08-28 15:17 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 26/08/2022 21:19, Manivannan Sadhasivam wrote:
> 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 | 27 +++++++++++++++++--
>  1 file changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml b/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
> index 83a2cfc63bc1..9914d575ec41 100644
> --- a/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
> +++ b/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
> @@ -12,6 +12,7 @@ maintainers:
>  properties:
>    compatible:
>      const: qcom,sdx55-pcie-ep
> +    const: qcom,sm8450-pcie-ep

You need to test the bindings with `make dt_binding_check`. This
requires an enum instead of two consts.


Best regards,
Krzysztof

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

* Re: [PATCH 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform
  2022-08-26 18:19 ` [PATCH 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform Manivannan Sadhasivam
  2022-08-28 15:14   ` Krzysztof Kozlowski
@ 2022-08-28 15:20   ` Krzysztof Kozlowski
  2022-08-30 11:56     ` Manivannan Sadhasivam
  1 sibling, 1 reply; 19+ messages in thread
From: Krzysztof Kozlowski @ 2022-08-28 15:20 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 26/08/2022 21:19, 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 | 46 +++++++++++--------
>  1 file changed, 27 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..83a2cfc63bc1 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,12 @@ 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
> +    minItems: 7
> +    maxItems: 7
>  
>    clock-names:
> -    items:
> -      - const: aux
> -      - const: cfg
> -      - const: bus_master
> -      - const: bus_slave
> -      - const: slave_q2a
> -      - const: sleep
> -      - const: ref
> +    minItems: 7
> +    maxItems: 7
>  
>    qcom,perst-regs:
>      description: Reference to a syscon representing TCSR followed by the two
> @@ -112,6 +97,29 @@ required:
>    - reset-names
>    - power-domains
>  
> +allOf:
> +  - $ref: "pci-ep.yaml#"
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - qcom,sdx55-pcie-ep
> +    then:
> +      properties:
> +        clocks:
> +          minItems: 7
> +          maxItems: 7

One more thing - the previous way of describing items is more readable
instead of names followed by a comment, so I propose to keep it. This
applies also to patch 10.

Best regards,
Krzysztof

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

* Re: [PATCH 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform
  2022-08-28 15:20   ` Krzysztof Kozlowski
@ 2022-08-30 11:56     ` Manivannan Sadhasivam
  0 siblings, 0 replies; 19+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30 11:56 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: lpieralisi, robh, andersson, kw, bhelgaas, linux-pci,
	linux-arm-msm, linux-kernel, konrad.dybcio, robh+dt,
	krzysztof.kozlowski+dt, devicetree, dmitry.baryshkov

On Sun, Aug 28, 2022 at 06:20:21PM +0300, Krzysztof Kozlowski wrote:
> On 26/08/2022 21:19, 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 | 46 +++++++++++--------
> >  1 file changed, 27 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..83a2cfc63bc1 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,12 @@ 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
> > +    minItems: 7
> > +    maxItems: 7
> >  
> >    clock-names:
> > -    items:
> > -      - const: aux
> > -      - const: cfg
> > -      - const: bus_master
> > -      - const: bus_slave
> > -      - const: slave_q2a
> > -      - const: sleep
> > -      - const: ref
> > +    minItems: 7
> > +    maxItems: 7
> >  
> >    qcom,perst-regs:
> >      description: Reference to a syscon representing TCSR followed by the two
> > @@ -112,6 +97,29 @@ required:
> >    - reset-names
> >    - power-domains
> >  
> > +allOf:
> > +  - $ref: "pci-ep.yaml#"
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            enum:
> > +              - qcom,sdx55-pcie-ep
> > +    then:
> > +      properties:
> > +        clocks:
> > +          minItems: 7
> > +          maxItems: 7
> 
> One more thing - the previous way of describing items is more readable
> instead of names followed by a comment, so I propose to keep it. This
> applies also to patch 10.
> 

Okay.

Thanks,
Mani

> Best regards,
> Krzysztof

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

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

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

On Sun, Aug 28, 2022 at 06:17:43PM +0300, Krzysztof Kozlowski wrote:
> On 26/08/2022 21:19, Manivannan Sadhasivam wrote:
> > 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 | 27 +++++++++++++++++--
> >  1 file changed, 25 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml b/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
> > index 83a2cfc63bc1..9914d575ec41 100644
> > --- a/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
> > +++ b/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
> > @@ -12,6 +12,7 @@ maintainers:
> >  properties:
> >    compatible:
> >      const: qcom,sdx55-pcie-ep
> > +    const: qcom,sm8450-pcie-ep
> 
> You need to test the bindings with `make dt_binding_check`. This
> requires an enum instead of two consts.

Sorry! Usually I do but somehow missed on this series.

Thanks,
Mani

> 
> 
> Best regards,
> Krzysztof

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

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

end of thread, other threads:[~2022-08-30 11:57 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26 18:19 [PATCH 00/11] Improvements to the Qcom PCIe Endpoint driver Manivannan Sadhasivam
2022-08-26 18:19 ` [PATCH 01/11] PCI: qcom-ep: Add kernel-doc for qcom_pcie_ep structure Manivannan Sadhasivam
2022-08-26 18:19 ` [PATCH 02/11] PCI: qcom-ep: Do not use hardcoded clks in driver Manivannan Sadhasivam
2022-08-26 18:19 ` [PATCH 03/11] PCI: qcom-ep: Make use of the cached dev pointer Manivannan Sadhasivam
2022-08-26 18:19 ` [PATCH 04/11] PCI: qcom-ep: Add eDMA support Manivannan Sadhasivam
2022-08-26 18:19 ` [PATCH 05/11] PCI: qcom-ep: Disable IRQs during driver remove Manivannan Sadhasivam
2022-08-26 18:19 ` [PATCH 06/11] PCI: qcom-ep: Add debugfs support for expose link transition counts Manivannan Sadhasivam
2022-08-26 18:19 ` [PATCH 07/11] dt-bindings: PCI: qcom-ep: Make PERST separation optional Manivannan Sadhasivam
2022-08-28 15:12   ` Krzysztof Kozlowski
2022-08-26 18:19 ` [PATCH 08/11] " Manivannan Sadhasivam
2022-08-26 18:19 ` [PATCH 09/11] dt-bindings: PCI: qcom-ep: Define clocks per platform Manivannan Sadhasivam
2022-08-28 15:14   ` Krzysztof Kozlowski
2022-08-28 15:20   ` Krzysztof Kozlowski
2022-08-30 11:56     ` Manivannan Sadhasivam
2022-08-26 18:19 ` [PATCH 10/11] dt-bindings: PCI: qcom-ep: Add support for SM8450 SoC Manivannan Sadhasivam
2022-08-28 14:21   ` Rob Herring
2022-08-28 15:17   ` Krzysztof Kozlowski
2022-08-30 11:57     ` Manivannan Sadhasivam
2022-08-26 18:19 ` [PATCH 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).