public inbox for linux-i3c@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers
@ 2025-11-28  6:40 Adrian Hunter
  2025-11-28  6:40 ` [PATCH V5 01/12] i3c: mipi-i3c-hci-pci: Set 64-bit DMA mask " Adrian Hunter
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Adrian Hunter @ 2025-11-28  6:40 UTC (permalink / raw)
  To: alexandre.belloni; +Cc: Frank.Li, linux-i3c

Hi

Here are V5 patches primarily to add support for Latency Tolerance
Reporting (LTR) for Intel controllers.  Most patches are small tidy-ups or
preparation for the main change.  All patches have Frank's Rev'd-by.


Changes in V5:

      i3c: mipi-i3c-hci-pci: Factor out private registers ioremapping
	Add Frank's Rev'd-by

      i3c: mipi-i3c-hci-pci: Add exit callback
	Add missing call to ->exit() on error path

      i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers
	Add Frank's Rev'd-by
	Rename intel_exit to intel_i3c_exit to match intel_i3c_init


Changes in V4:

      i3c: mipi-i3c-hci-pci: Set 64-bit DMA mask for Intel controllers
      i3c: mipi-i3c-hci-pci: Move all Intel-related definitions together
      i3c: mipi-i3c-hci-pci: Change callback parameter
      i3c: mipi-i3c-hci-pci: Add exit callback
	Add Frank's Rev'd-by

      i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers
	Drop intel_actualize_debugfs_root() that created 'intel-i3c'
	debugfs directory.


Changes in V3:
      i3c: mipi-i3c-hci-pci: Set 64-bit DMA mask for Intel controllers
	Omit mention of IOMMU in commit message.

      i3c: mipi-i3c-hci-pci: Rename some Intel-related identifiers
	Add Frank's Rev'd-by

      i3c: mipi-i3c-hci-pci: Use readl_poll_timeout()
	Add Frank's Rev'd-by

      i3c: mipi-i3c-hci-pci: Factor out intel_reset()
	Add Frank's Rev'd-by

      i3c: mipi-i3c-hci-pci: Change callback parameter
	Improve commit message.

      i3c: mipi-i3c-hci-pci: Add exit callback
	Improve commit message.

      i3c: mipi-i3c-hci-pci: Allocate a structure for Intel controller information
	Squash into "Add LTR support for Intel controllers" patch

      i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers
	Squash "Allocate a structure for Intel controller information" patch
	into this patch

      i3c: mipi-i3c-hci-pci: Set d3cold_delay to 0 for Intel controllers
	Add Frank's Rev'd-by


Changes in V2:
      i3c: mipi-i3c-hci-pci: Set 64-bit DMA mask for Intel controllers
	No need to check error from dma_set_mask_and_coherent() with a
	64-bit mask

      i3c: mipi-i3c-hci-pci: Rename some Intel-related identifiers
	Rename 'intel_init' to 'intel_i3c_init'
	More explanation in commit message

      i3c: mipi-i3c-hci-pci: Use readl_poll_timeout()
	Change 10000 to (10 * USEC_PER_MSEC)

      i3c: mipi-i3c-hci-pci: Constify driver data
	Add Frank's Rev'd-by

      i3c: mipi-i3c-hci-pci: Factor out intel_reset()
	Move location of intel_reset() to get a prettier diff

      i3c: mipi-i3c-hci-pci: Allocate a structure for mipi_i3c_hci_pci device information
	Add Frank's Rev'd-by

      i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers
	Make use of FIELD_PREP()
	Improve handling of values that exceed the maximum


Adrian Hunter (12):
      i3c: mipi-i3c-hci-pci: Set 64-bit DMA mask for Intel controllers
      i3c: mipi-i3c-hci-pci: Move all Intel-related definitions together
      i3c: mipi-i3c-hci-pci: Rename some Intel-related identifiers
      i3c: mipi-i3c-hci-pci: Use readl_poll_timeout()
      i3c: mipi-i3c-hci-pci: Constify driver data
      i3c: mipi-i3c-hci-pci: Factor out private registers ioremapping
      i3c: mipi-i3c-hci-pci: Factor out intel_reset()
      i3c: mipi-i3c-hci-pci: Allocate a structure for mipi_i3c_hci_pci device information
      i3c: mipi-i3c-hci-pci: Change callback parameter
      i3c: mipi-i3c-hci-pci: Add exit callback
      i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers
      i3c: mipi-i3c-hci-pci: Set d3cold_delay to 0 for Intel controllers

 drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 220 +++++++++++++++++----
 1 file changed, 181 insertions(+), 39 deletions(-)


Regards
Adrian

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* [PATCH V5 01/12] i3c: mipi-i3c-hci-pci: Set 64-bit DMA mask for Intel controllers
  2025-11-28  6:40 [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
@ 2025-11-28  6:40 ` Adrian Hunter
  2025-11-28  6:40 ` [PATCH V5 02/12] i3c: mipi-i3c-hci-pci: Move all Intel-related definitions together Adrian Hunter
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Adrian Hunter @ 2025-11-28  6:40 UTC (permalink / raw)
  To: alexandre.belloni; +Cc: Frank.Li, linux-i3c

All Intel controllers support 64-bit DMA.  Set the DMA mask accordingly.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---


Changes in V5:

	None

Changes in V4:

	Add Frank's Rev'd-by

Changes in V3:

	Omit mention of IOMMU in commit message.

Changes in V2:

	No need to check error from dma_set_mask_and_coherent() with a
	64-bit mask

 drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
index dd4484eff2f0..3cd15ca7d391 100644
--- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
+++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
@@ -36,6 +36,8 @@ static int mipi_i3c_hci_pci_intel_init(struct pci_dev *pci)
 	if (!priv)
 		return -ENOMEM;
 
+	dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(64));
+
 	/* Assert reset, wait for completion and release reset */
 	writel(0, priv + INTEL_PRIV_RESETS);
 	timeout = jiffies + msecs_to_jiffies(10);
-- 
2.51.0


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* [PATCH V5 02/12] i3c: mipi-i3c-hci-pci: Move all Intel-related definitions together
  2025-11-28  6:40 [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
  2025-11-28  6:40 ` [PATCH V5 01/12] i3c: mipi-i3c-hci-pci: Set 64-bit DMA mask " Adrian Hunter
@ 2025-11-28  6:40 ` Adrian Hunter
  2025-11-28  6:40 ` [PATCH V5 03/12] i3c: mipi-i3c-hci-pci: Rename some Intel-related identifiers Adrian Hunter
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Adrian Hunter @ 2025-11-28  6:40 UTC (permalink / raw)
  To: alexandre.belloni; +Cc: Frank.Li, linux-i3c

Move all Intel-related definitions together, to tidy the code slightly.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---


Changes in V5:

	None

Changes in V4:

	Add Frank's Rev'd-by

Changes in V2 and V3:

	None


 drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
index 3cd15ca7d391..3d854cee05df 100644
--- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
+++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
@@ -17,14 +17,14 @@ struct mipi_i3c_hci_pci_info {
 	int (*init)(struct pci_dev *pci);
 };
 
+static DEFINE_IDA(mipi_i3c_hci_pci_ida);
+
 #define INTEL_PRIV_OFFSET		0x2b0
 #define INTEL_PRIV_SIZE			0x28
 #define INTEL_PRIV_RESETS		0x04
 #define INTEL_PRIV_RESETS_RESET		BIT(0)
 #define INTEL_PRIV_RESETS_RESET_DONE	BIT(1)
 
-static DEFINE_IDA(mipi_i3c_hci_pci_ida);
-
 static int mipi_i3c_hci_pci_intel_init(struct pci_dev *pci)
 {
 	unsigned long timeout;
-- 
2.51.0


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* [PATCH V5 03/12] i3c: mipi-i3c-hci-pci: Rename some Intel-related identifiers
  2025-11-28  6:40 [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
  2025-11-28  6:40 ` [PATCH V5 01/12] i3c: mipi-i3c-hci-pci: Set 64-bit DMA mask " Adrian Hunter
  2025-11-28  6:40 ` [PATCH V5 02/12] i3c: mipi-i3c-hci-pci: Move all Intel-related definitions together Adrian Hunter
@ 2025-11-28  6:40 ` Adrian Hunter
  2025-11-28  6:40 ` [PATCH V5 04/12] i3c: mipi-i3c-hci-pci: Use readl_poll_timeout() Adrian Hunter
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Adrian Hunter @ 2025-11-28  6:40 UTC (permalink / raw)
  To: alexandre.belloni; +Cc: Frank.Li, linux-i3c

Rename some Intel-related identifiers to ensure Intel-related identifiers
begin "intel_" or INTEL_, and for brevity removing purposeless "PRIV" in
preparation to add more register definitions.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---


Changes in V4 and V5:

	None

Changes in V3:

	Add Frank's Rev'd-by

Changes in V2:

	Rename 'intel_init' to 'intel_i3c_init'
	More explanation in commit message


 .../i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
index 3d854cee05df..d434e2962740 100644
--- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
+++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
@@ -21,11 +21,11 @@ static DEFINE_IDA(mipi_i3c_hci_pci_ida);
 
 #define INTEL_PRIV_OFFSET		0x2b0
 #define INTEL_PRIV_SIZE			0x28
-#define INTEL_PRIV_RESETS		0x04
-#define INTEL_PRIV_RESETS_RESET		BIT(0)
-#define INTEL_PRIV_RESETS_RESET_DONE	BIT(1)
+#define INTEL_RESETS			0x04
+#define INTEL_RESETS_RESET		BIT(0)
+#define INTEL_RESETS_RESET_DONE		BIT(1)
 
-static int mipi_i3c_hci_pci_intel_init(struct pci_dev *pci)
+static int intel_i3c_init(struct pci_dev *pci)
 {
 	unsigned long timeout;
 	void __iomem *priv;
@@ -39,21 +39,21 @@ static int mipi_i3c_hci_pci_intel_init(struct pci_dev *pci)
 	dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(64));
 
 	/* Assert reset, wait for completion and release reset */
-	writel(0, priv + INTEL_PRIV_RESETS);
+	writel(0, priv + INTEL_RESETS);
 	timeout = jiffies + msecs_to_jiffies(10);
-	while (!(readl(priv + INTEL_PRIV_RESETS) &
-		 INTEL_PRIV_RESETS_RESET_DONE)) {
+	while (!(readl(priv + INTEL_RESETS) &
+		 INTEL_RESETS_RESET_DONE)) {
 		if (time_after(jiffies, timeout))
 			break;
 		cpu_relax();
 	}
-	writel(INTEL_PRIV_RESETS_RESET, priv + INTEL_PRIV_RESETS);
+	writel(INTEL_RESETS_RESET, priv + INTEL_RESETS);
 
 	return 0;
 }
 
 static struct mipi_i3c_hci_pci_info intel_info = {
-	.init = mipi_i3c_hci_pci_intel_init,
+	.init = intel_i3c_init,
 };
 
 static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
-- 
2.51.0


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* [PATCH V5 04/12] i3c: mipi-i3c-hci-pci: Use readl_poll_timeout()
  2025-11-28  6:40 [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
                   ` (2 preceding siblings ...)
  2025-11-28  6:40 ` [PATCH V5 03/12] i3c: mipi-i3c-hci-pci: Rename some Intel-related identifiers Adrian Hunter
@ 2025-11-28  6:40 ` Adrian Hunter
  2025-11-28  6:40 ` [PATCH V5 05/12] i3c: mipi-i3c-hci-pci: Constify driver data Adrian Hunter
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Adrian Hunter @ 2025-11-28  6:40 UTC (permalink / raw)
  To: alexandre.belloni; +Cc: Frank.Li, linux-i3c

Use readl_poll_timeout() instead of open-coding the polling loop.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---


Changes in V4 and V5:

	None

Changes in V3:

	Add Frank's Rev'd-by

Changes in V2:

	Change 10000 to (10 * USEC_PER_MSEC)


 drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
index d434e2962740..30915d78045e 100644
--- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
+++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
@@ -8,6 +8,7 @@
  */
 #include <linux/acpi.h>
 #include <linux/idr.h>
+#include <linux/iopoll.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pci.h>
@@ -24,11 +25,12 @@ static DEFINE_IDA(mipi_i3c_hci_pci_ida);
 #define INTEL_RESETS			0x04
 #define INTEL_RESETS_RESET		BIT(0)
 #define INTEL_RESETS_RESET_DONE		BIT(1)
+#define INTEL_RESETS_TIMEOUT_US		(10 * USEC_PER_MSEC)
 
 static int intel_i3c_init(struct pci_dev *pci)
 {
-	unsigned long timeout;
 	void __iomem *priv;
+	u32 reg;
 
 	priv = devm_ioremap(&pci->dev,
 			    pci_resource_start(pci, 0) + INTEL_PRIV_OFFSET,
@@ -40,13 +42,9 @@ static int intel_i3c_init(struct pci_dev *pci)
 
 	/* Assert reset, wait for completion and release reset */
 	writel(0, priv + INTEL_RESETS);
-	timeout = jiffies + msecs_to_jiffies(10);
-	while (!(readl(priv + INTEL_RESETS) &
-		 INTEL_RESETS_RESET_DONE)) {
-		if (time_after(jiffies, timeout))
-			break;
-		cpu_relax();
-	}
+	readl_poll_timeout(priv + INTEL_RESETS, reg,
+			   reg & INTEL_RESETS_RESET_DONE, 0,
+			   INTEL_RESETS_TIMEOUT_US);
 	writel(INTEL_RESETS_RESET, priv + INTEL_RESETS);
 
 	return 0;
-- 
2.51.0


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* [PATCH V5 05/12] i3c: mipi-i3c-hci-pci: Constify driver data
  2025-11-28  6:40 [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
                   ` (3 preceding siblings ...)
  2025-11-28  6:40 ` [PATCH V5 04/12] i3c: mipi-i3c-hci-pci: Use readl_poll_timeout() Adrian Hunter
@ 2025-11-28  6:40 ` Adrian Hunter
  2025-11-28  6:40 ` [PATCH V5 06/12] i3c: mipi-i3c-hci-pci: Factor out private registers ioremapping Adrian Hunter
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Adrian Hunter @ 2025-11-28  6:40 UTC (permalink / raw)
  To: alexandre.belloni; +Cc: Frank.Li, linux-i3c

Add const qualifier to driver data because it is constant.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---


Changes in V3, V4 and V5:

	None

Changes in V2:

	Add Frank's Rev'd-by


 drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
index 30915d78045e..abc7bad5e069 100644
--- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
+++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
@@ -50,14 +50,14 @@ static int intel_i3c_init(struct pci_dev *pci)
 	return 0;
 }
 
-static struct mipi_i3c_hci_pci_info intel_info = {
+static const struct mipi_i3c_hci_pci_info intel_info = {
 	.init = intel_i3c_init,
 };
 
 static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
 				  const struct pci_device_id *id)
 {
-	struct mipi_i3c_hci_pci_info *info;
+	const struct mipi_i3c_hci_pci_info *info;
 	struct platform_device *pdev;
 	struct resource res[2];
 	int dev_id, ret;
@@ -93,7 +93,7 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
 	if (ret)
 		goto err;
 
-	info = (struct mipi_i3c_hci_pci_info *)id->driver_data;
+	info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
 	if (info && info->init) {
 		ret = info->init(pci);
 		if (ret)
-- 
2.51.0


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* [PATCH V5 06/12] i3c: mipi-i3c-hci-pci: Factor out private registers ioremapping
  2025-11-28  6:40 [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
                   ` (4 preceding siblings ...)
  2025-11-28  6:40 ` [PATCH V5 05/12] i3c: mipi-i3c-hci-pci: Constify driver data Adrian Hunter
@ 2025-11-28  6:40 ` Adrian Hunter
  2025-11-28  6:40 ` [PATCH V5 07/12] i3c: mipi-i3c-hci-pci: Factor out intel_reset() Adrian Hunter
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Adrian Hunter @ 2025-11-28  6:40 UTC (permalink / raw)
  To: alexandre.belloni; +Cc: Frank.Li, linux-i3c

For neatness, factor out private registers ioremapping.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---


Changes in V5:

	Add Frank's Rev'd-by

Changes in V3 and V4:

	None

Changes in V2:

	Re-based


 drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
index abc7bad5e069..1e1f2c42bd74 100644
--- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
+++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
@@ -27,14 +27,18 @@ static DEFINE_IDA(mipi_i3c_hci_pci_ida);
 #define INTEL_RESETS_RESET_DONE		BIT(1)
 #define INTEL_RESETS_TIMEOUT_US		(10 * USEC_PER_MSEC)
 
+static void __iomem *intel_priv(struct pci_dev *pci)
+{
+	resource_size_t base = pci_resource_start(pci, 0);
+
+	return devm_ioremap(&pci->dev, base + INTEL_PRIV_OFFSET, INTEL_PRIV_SIZE);
+}
+
 static int intel_i3c_init(struct pci_dev *pci)
 {
-	void __iomem *priv;
+	void __iomem *priv = intel_priv(pci);
 	u32 reg;
 
-	priv = devm_ioremap(&pci->dev,
-			    pci_resource_start(pci, 0) + INTEL_PRIV_OFFSET,
-			    INTEL_PRIV_SIZE);
 	if (!priv)
 		return -ENOMEM;
 
-- 
2.51.0


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* [PATCH V5 07/12] i3c: mipi-i3c-hci-pci: Factor out intel_reset()
  2025-11-28  6:40 [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
                   ` (5 preceding siblings ...)
  2025-11-28  6:40 ` [PATCH V5 06/12] i3c: mipi-i3c-hci-pci: Factor out private registers ioremapping Adrian Hunter
@ 2025-11-28  6:40 ` Adrian Hunter
  2025-11-28  6:40 ` [PATCH V5 08/12] i3c: mipi-i3c-hci-pci: Allocate a structure for mipi_i3c_hci_pci device information Adrian Hunter
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Adrian Hunter @ 2025-11-28  6:40 UTC (permalink / raw)
  To: alexandre.belloni; +Cc: Frank.Li, linux-i3c

For neatness, factor out intel_reset().

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---


Changes in V4 and V5:

	None

Changes in V3:

	Add Frank's Rev'd-by

Changes in V2:

	Move location of intel_reset() to get a prettier diff


 .../master/mipi-i3c-hci/mipi-i3c-hci-pci.c    | 20 ++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
index 1e1f2c42bd74..b9794212b2fb 100644
--- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
+++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
@@ -27,6 +27,18 @@ static DEFINE_IDA(mipi_i3c_hci_pci_ida);
 #define INTEL_RESETS_RESET_DONE		BIT(1)
 #define INTEL_RESETS_TIMEOUT_US		(10 * USEC_PER_MSEC)
 
+static void intel_reset(void __iomem *priv)
+{
+	u32 reg;
+
+	/* Assert reset, wait for completion and release reset */
+	writel(0, priv + INTEL_RESETS);
+	readl_poll_timeout(priv + INTEL_RESETS, reg,
+			   reg & INTEL_RESETS_RESET_DONE, 0,
+			   INTEL_RESETS_TIMEOUT_US);
+	writel(INTEL_RESETS_RESET, priv + INTEL_RESETS);
+}
+
 static void __iomem *intel_priv(struct pci_dev *pci)
 {
 	resource_size_t base = pci_resource_start(pci, 0);
@@ -37,19 +49,13 @@ static void __iomem *intel_priv(struct pci_dev *pci)
 static int intel_i3c_init(struct pci_dev *pci)
 {
 	void __iomem *priv = intel_priv(pci);
-	u32 reg;
 
 	if (!priv)
 		return -ENOMEM;
 
 	dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(64));
 
-	/* Assert reset, wait for completion and release reset */
-	writel(0, priv + INTEL_RESETS);
-	readl_poll_timeout(priv + INTEL_RESETS, reg,
-			   reg & INTEL_RESETS_RESET_DONE, 0,
-			   INTEL_RESETS_TIMEOUT_US);
-	writel(INTEL_RESETS_RESET, priv + INTEL_RESETS);
+	intel_reset(priv);
 
 	return 0;
 }
-- 
2.51.0


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* [PATCH V5 08/12] i3c: mipi-i3c-hci-pci: Allocate a structure for mipi_i3c_hci_pci device information
  2025-11-28  6:40 [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
                   ` (6 preceding siblings ...)
  2025-11-28  6:40 ` [PATCH V5 07/12] i3c: mipi-i3c-hci-pci: Factor out intel_reset() Adrian Hunter
@ 2025-11-28  6:40 ` Adrian Hunter
  2025-11-28  6:40 ` [PATCH V5 09/12] i3c: mipi-i3c-hci-pci: Change callback parameter Adrian Hunter
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Adrian Hunter @ 2025-11-28  6:40 UTC (permalink / raw)
  To: alexandre.belloni; +Cc: Frank.Li, linux-i3c

Allocate a structure for mipi_i3c_hci_pci device information, in
preparation for additional changes that need to store mipi_i3c_hci_pci
device-specific information.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---


Changes in V3, V4 and V5:

	None

Changes in V2:

	Add Frank's Rev'd-by


 .../master/mipi-i3c-hci/mipi-i3c-hci-pci.c    | 29 ++++++++++++-------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
index b9794212b2fb..8936e50eddf7 100644
--- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
+++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
@@ -14,6 +14,10 @@
 #include <linux/pci.h>
 #include <linux/platform_device.h>
 
+struct mipi_i3c_hci_pci {
+	struct platform_device *pdev;
+};
+
 struct mipi_i3c_hci_pci_info {
 	int (*init)(struct pci_dev *pci);
 };
@@ -68,10 +72,14 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
 				  const struct pci_device_id *id)
 {
 	const struct mipi_i3c_hci_pci_info *info;
-	struct platform_device *pdev;
+	struct mipi_i3c_hci_pci *hci;
 	struct resource res[2];
 	int dev_id, ret;
 
+	hci = devm_kzalloc(&pci->dev, sizeof(*hci), GFP_KERNEL);
+	if (!hci)
+		return -ENOMEM;
+
 	ret = pcim_enable_device(pci);
 	if (ret)
 		return ret;
@@ -92,14 +100,14 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
 	if (dev_id < 0)
 		return dev_id;
 
-	pdev = platform_device_alloc("mipi-i3c-hci", dev_id);
-	if (!pdev)
+	hci->pdev = platform_device_alloc("mipi-i3c-hci", dev_id);
+	if (!hci->pdev)
 		return -ENOMEM;
 
-	pdev->dev.parent = &pci->dev;
-	device_set_node(&pdev->dev, dev_fwnode(&pci->dev));
+	hci->pdev->dev.parent = &pci->dev;
+	device_set_node(&hci->pdev->dev, dev_fwnode(&pci->dev));
 
-	ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
+	ret = platform_device_add_resources(hci->pdev, res, ARRAY_SIZE(res));
 	if (ret)
 		goto err;
 
@@ -110,23 +118,24 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
 			goto err;
 	}
 
-	ret = platform_device_add(pdev);
+	ret = platform_device_add(hci->pdev);
 	if (ret)
 		goto err;
 
-	pci_set_drvdata(pci, pdev);
+	pci_set_drvdata(pci, hci);
 
 	return 0;
 
 err:
-	platform_device_put(pdev);
+	platform_device_put(hci->pdev);
 	ida_free(&mipi_i3c_hci_pci_ida, dev_id);
 	return ret;
 }
 
 static void mipi_i3c_hci_pci_remove(struct pci_dev *pci)
 {
-	struct platform_device *pdev = pci_get_drvdata(pci);
+	struct mipi_i3c_hci_pci *hci = pci_get_drvdata(pci);
+	struct platform_device *pdev = hci->pdev;
 	int dev_id = pdev->id;
 
 	platform_device_unregister(pdev);
-- 
2.51.0


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* [PATCH V5 09/12] i3c: mipi-i3c-hci-pci: Change callback parameter
  2025-11-28  6:40 [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
                   ` (7 preceding siblings ...)
  2025-11-28  6:40 ` [PATCH V5 08/12] i3c: mipi-i3c-hci-pci: Allocate a structure for mipi_i3c_hci_pci device information Adrian Hunter
@ 2025-11-28  6:40 ` Adrian Hunter
  2025-11-28  6:40 ` [PATCH V5 10/12] i3c: mipi-i3c-hci-pci: Add exit callback Adrian Hunter
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Adrian Hunter @ 2025-11-28  6:40 UTC (permalink / raw)
  To: alexandre.belloni; +Cc: Frank.Li, linux-i3c

Prepare to add more callbacks in mipi_i3c_hci_pci_info.  Change ->init()
callback parameter from PCI device pointer to mipi_i3c_hci_pci_info device
pointer.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---


Changes in V5:

	None

Changes in V4:

	Add Frank's Rev'd-by

Changes in V3:

	Improve commit message.

Changes in V2:

	Re-based


 drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
index 8936e50eddf7..7bfb9fe337b6 100644
--- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
+++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
@@ -15,11 +15,12 @@
 #include <linux/platform_device.h>
 
 struct mipi_i3c_hci_pci {
+	struct pci_dev *pci;
 	struct platform_device *pdev;
 };
 
 struct mipi_i3c_hci_pci_info {
-	int (*init)(struct pci_dev *pci);
+	int (*init)(struct mipi_i3c_hci_pci *hci);
 };
 
 static DEFINE_IDA(mipi_i3c_hci_pci_ida);
@@ -50,14 +51,14 @@ static void __iomem *intel_priv(struct pci_dev *pci)
 	return devm_ioremap(&pci->dev, base + INTEL_PRIV_OFFSET, INTEL_PRIV_SIZE);
 }
 
-static int intel_i3c_init(struct pci_dev *pci)
+static int intel_i3c_init(struct mipi_i3c_hci_pci *hci)
 {
-	void __iomem *priv = intel_priv(pci);
+	void __iomem *priv = intel_priv(hci->pci);
 
 	if (!priv)
 		return -ENOMEM;
 
-	dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(64));
+	dma_set_mask_and_coherent(&hci->pci->dev, DMA_BIT_MASK(64));
 
 	intel_reset(priv);
 
@@ -80,6 +81,8 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
 	if (!hci)
 		return -ENOMEM;
 
+	hci->pci = pci;
+
 	ret = pcim_enable_device(pci);
 	if (ret)
 		return ret;
@@ -113,7 +116,7 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
 
 	info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
 	if (info && info->init) {
-		ret = info->init(pci);
+		ret = info->init(hci);
 		if (ret)
 			goto err;
 	}
-- 
2.51.0


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* [PATCH V5 10/12] i3c: mipi-i3c-hci-pci: Add exit callback
  2025-11-28  6:40 [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
                   ` (8 preceding siblings ...)
  2025-11-28  6:40 ` [PATCH V5 09/12] i3c: mipi-i3c-hci-pci: Change callback parameter Adrian Hunter
@ 2025-11-28  6:40 ` Adrian Hunter
  2025-11-28  6:40 ` [PATCH V5 11/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Adrian Hunter @ 2025-11-28  6:40 UTC (permalink / raw)
  To: alexandre.belloni; +Cc: Frank.Li, linux-i3c

Prepare to add device-specific features that require cleanup
upon driver removal.  Add ->exit() callback as a counterpart to ->init().

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---


Changes in V5:

	Add missing call to ->exit() on error path

Changes in V4:

	Add Frank's Rev'd-by

Changes in V3:

	Improve commit message.

Changes in V2:

	Re-based


 .../i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c  | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
index 7bfb9fe337b6..7a91efbd3e54 100644
--- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
+++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
@@ -17,10 +17,12 @@
 struct mipi_i3c_hci_pci {
 	struct pci_dev *pci;
 	struct platform_device *pdev;
+	const struct mipi_i3c_hci_pci_info *info;
 };
 
 struct mipi_i3c_hci_pci_info {
 	int (*init)(struct mipi_i3c_hci_pci *hci);
+	void (*exit)(struct mipi_i3c_hci_pci *hci);
 };
 
 static DEFINE_IDA(mipi_i3c_hci_pci_ida);
@@ -72,7 +74,6 @@ static const struct mipi_i3c_hci_pci_info intel_info = {
 static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
 				  const struct pci_device_id *id)
 {
-	const struct mipi_i3c_hci_pci_info *info;
 	struct mipi_i3c_hci_pci *hci;
 	struct resource res[2];
 	int dev_id, ret;
@@ -114,21 +115,24 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
 	if (ret)
 		goto err;
 
-	info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
-	if (info && info->init) {
-		ret = info->init(hci);
+	hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
+	if (hci->info && hci->info->init) {
+		ret = hci->info->init(hci);
 		if (ret)
 			goto err;
 	}
 
 	ret = platform_device_add(hci->pdev);
 	if (ret)
-		goto err;
+		goto err_exit;
 
 	pci_set_drvdata(pci, hci);
 
 	return 0;
 
+err_exit:
+	if (hci->info && hci->info->exit)
+		hci->info->exit(hci);
 err:
 	platform_device_put(hci->pdev);
 	ida_free(&mipi_i3c_hci_pci_ida, dev_id);
@@ -141,6 +145,9 @@ static void mipi_i3c_hci_pci_remove(struct pci_dev *pci)
 	struct platform_device *pdev = hci->pdev;
 	int dev_id = pdev->id;
 
+	if (hci->info && hci->info->exit)
+		hci->info->exit(hci);
+
 	platform_device_unregister(pdev);
 	ida_free(&mipi_i3c_hci_pci_ida, dev_id);
 }
-- 
2.51.0


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* [PATCH V5 11/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers
  2025-11-28  6:40 [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
                   ` (9 preceding siblings ...)
  2025-11-28  6:40 ` [PATCH V5 10/12] i3c: mipi-i3c-hci-pci: Add exit callback Adrian Hunter
@ 2025-11-28  6:40 ` Adrian Hunter
  2025-11-28  6:40 ` [PATCH V5 12/12] i3c: mipi-i3c-hci-pci: Set d3cold_delay to 0 " Adrian Hunter
  2025-11-28 23:17 ` [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support " Alexandre Belloni
  12 siblings, 0 replies; 14+ messages in thread
From: Adrian Hunter @ 2025-11-28  6:40 UTC (permalink / raw)
  To: alexandre.belloni; +Cc: Frank.Li, linux-i3c

Add support for Latency Tolerance Reporting (LTR) for Intel controllers.

Implement PM ->set_latency_tolerance() callback to set LTR register values.
Also expose LTR register values via debugfs.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---


Changes in V5:

	Add Frank's Rev'd-by
	Rename intel_exit to intel_i3c_exit to match intel_i3c_init

Changes in V4:

	Drop intel_actualize_debugfs_root() that created 'intel-i3c'
	debugfs directory.

Changes in V3:

	Squash previous patch into this one

Changes in V2:

	Make use of FIELD_PREP()
	Improve handling of values that exceed the maximum


 .../master/mipi-i3c-hci/mipi-i3c-hci-pci.c    | 113 +++++++++++++++++-
 1 file changed, 112 insertions(+), 1 deletion(-)

diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
index 7a91efbd3e54..25c129a856d6 100644
--- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
+++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
@@ -7,17 +7,21 @@
  * Author: Jarkko Nikula <jarkko.nikula@linux.intel.com>
  */
 #include <linux/acpi.h>
+#include <linux/bitfield.h>
+#include <linux/debugfs.h>
 #include <linux/idr.h>
 #include <linux/iopoll.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/platform_device.h>
+#include <linux/pm_qos.h>
 
 struct mipi_i3c_hci_pci {
 	struct pci_dev *pci;
 	struct platform_device *pdev;
 	const struct mipi_i3c_hci_pci_info *info;
+	void *private;
 };
 
 struct mipi_i3c_hci_pci_info {
@@ -34,6 +38,99 @@ static DEFINE_IDA(mipi_i3c_hci_pci_ida);
 #define INTEL_RESETS_RESET_DONE		BIT(1)
 #define INTEL_RESETS_TIMEOUT_US		(10 * USEC_PER_MSEC)
 
+#define INTEL_ACTIVELTR			0x0c
+#define INTEL_IDLELTR			0x10
+
+#define INTEL_LTR_REQ			BIT(15)
+#define INTEL_LTR_SCALE_MASK		GENMASK(11, 10)
+#define INTEL_LTR_SCALE_1US		FIELD_PREP(INTEL_LTR_SCALE_MASK, 2)
+#define INTEL_LTR_SCALE_32US		FIELD_PREP(INTEL_LTR_SCALE_MASK, 3)
+#define INTEL_LTR_VALUE_MASK		GENMASK(9, 0)
+
+struct intel_host {
+	void __iomem	*priv;
+	u32		active_ltr;
+	u32		idle_ltr;
+	struct dentry	*debugfs_root;
+};
+
+static void intel_cache_ltr(struct intel_host *host)
+{
+	host->active_ltr = readl(host->priv + INTEL_ACTIVELTR);
+	host->idle_ltr = readl(host->priv + INTEL_IDLELTR);
+}
+
+static void intel_ltr_set(struct device *dev, s32 val)
+{
+	struct mipi_i3c_hci_pci *hci = dev_get_drvdata(dev);
+	struct intel_host *host = hci->private;
+	u32 ltr;
+
+	/*
+	 * Program latency tolerance (LTR) accordingly what has been asked
+	 * by the PM QoS layer or disable it in case we were passed
+	 * negative value or PM_QOS_LATENCY_ANY.
+	 */
+	ltr = readl(host->priv + INTEL_ACTIVELTR);
+
+	if (val == PM_QOS_LATENCY_ANY || val < 0) {
+		ltr &= ~INTEL_LTR_REQ;
+	} else {
+		ltr |= INTEL_LTR_REQ;
+		ltr &= ~INTEL_LTR_SCALE_MASK;
+		ltr &= ~INTEL_LTR_VALUE_MASK;
+
+		if (val > INTEL_LTR_VALUE_MASK) {
+			val >>= 5;
+			if (val > INTEL_LTR_VALUE_MASK)
+				val = INTEL_LTR_VALUE_MASK;
+			ltr |= INTEL_LTR_SCALE_32US | val;
+		} else {
+			ltr |= INTEL_LTR_SCALE_1US | val;
+		}
+	}
+
+	if (ltr == host->active_ltr)
+		return;
+
+	writel(ltr, host->priv + INTEL_ACTIVELTR);
+	writel(ltr, host->priv + INTEL_IDLELTR);
+
+	/* Cache the values into intel_host structure */
+	intel_cache_ltr(host);
+}
+
+static void intel_ltr_expose(struct device *dev)
+{
+	dev->power.set_latency_tolerance = intel_ltr_set;
+	dev_pm_qos_expose_latency_tolerance(dev);
+}
+
+static void intel_ltr_hide(struct device *dev)
+{
+	dev_pm_qos_hide_latency_tolerance(dev);
+	dev->power.set_latency_tolerance = NULL;
+}
+
+static void intel_add_debugfs(struct mipi_i3c_hci_pci *hci)
+{
+	struct dentry *dir = debugfs_create_dir(dev_name(&hci->pci->dev), NULL);
+	struct intel_host *host = hci->private;
+
+	intel_cache_ltr(host);
+
+	host->debugfs_root = dir;
+	debugfs_create_x32("active_ltr", 0444, dir, &host->active_ltr);
+	debugfs_create_x32("idle_ltr", 0444, dir, &host->idle_ltr);
+}
+
+static void intel_remove_debugfs(struct mipi_i3c_hci_pci *hci)
+{
+	struct intel_host *host = hci->private;
+
+	debugfs_remove_recursive(host->debugfs_root);
+}
+
 static void intel_reset(void __iomem *priv)
 {
 	u32 reg;
@@ -55,20 +152,34 @@ static void __iomem *intel_priv(struct pci_dev *pci)
 
 static int intel_i3c_init(struct mipi_i3c_hci_pci *hci)
 {
+	struct intel_host *host = devm_kzalloc(&hci->pci->dev, sizeof(*host), GFP_KERNEL);
 	void __iomem *priv = intel_priv(hci->pci);
 
-	if (!priv)
+	if (!host || !priv)
 		return -ENOMEM;
 
 	dma_set_mask_and_coherent(&hci->pci->dev, DMA_BIT_MASK(64));
 
+	hci->private = host;
+	host->priv = priv;
+
 	intel_reset(priv);
 
+	intel_ltr_expose(&hci->pci->dev);
+	intel_add_debugfs(hci);
+
 	return 0;
 }
 
+static void intel_i3c_exit(struct mipi_i3c_hci_pci *hci)
+{
+	intel_remove_debugfs(hci);
+	intel_ltr_hide(&hci->pci->dev);
+}
+
 static const struct mipi_i3c_hci_pci_info intel_info = {
 	.init = intel_i3c_init,
+	.exit = intel_i3c_exit,
 };
 
 static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
-- 
2.51.0


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* [PATCH V5 12/12] i3c: mipi-i3c-hci-pci: Set d3cold_delay to 0 for Intel controllers
  2025-11-28  6:40 [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
                   ` (10 preceding siblings ...)
  2025-11-28  6:40 ` [PATCH V5 11/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
@ 2025-11-28  6:40 ` Adrian Hunter
  2025-11-28 23:17 ` [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support " Alexandre Belloni
  12 siblings, 0 replies; 14+ messages in thread
From: Adrian Hunter @ 2025-11-28  6:40 UTC (permalink / raw)
  To: alexandre.belloni; +Cc: Frank.Li, linux-i3c

Set d3cold_delay to 0 for Intel controllers because a delay is not needed.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---


Changes in V4 and V5:

	None

Changes in V3:

	Add Frank's Rev'd-by

Changes in V2:

	Re-based


 drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
index 25c129a856d6..dc8ede0f8ad8 100644
--- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
+++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
@@ -160,6 +160,8 @@ static int intel_i3c_init(struct mipi_i3c_hci_pci *hci)
 
 	dma_set_mask_and_coherent(&hci->pci->dev, DMA_BIT_MASK(64));
 
+	hci->pci->d3cold_delay = 0;
+
 	hci->private = host;
 	host->priv = priv;
 
-- 
2.51.0


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* Re: [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers
  2025-11-28  6:40 [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
                   ` (11 preceding siblings ...)
  2025-11-28  6:40 ` [PATCH V5 12/12] i3c: mipi-i3c-hci-pci: Set d3cold_delay to 0 " Adrian Hunter
@ 2025-11-28 23:17 ` Alexandre Belloni
  12 siblings, 0 replies; 14+ messages in thread
From: Alexandre Belloni @ 2025-11-28 23:17 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: Frank.Li, linux-i3c

On Fri, 28 Nov 2025 08:40:26 +0200, Adrian Hunter wrote:
> Here are V5 patches primarily to add support for Latency Tolerance
> Reporting (LTR) for Intel controllers.  Most patches are small tidy-ups or
> preparation for the main change.  All patches have Frank's Rev'd-by.
> 
> 
> Changes in V5:
> 
> [...]

Applied, thanks!

[01/12] i3c: mipi-i3c-hci-pci: Set 64-bit DMA mask for Intel controllers
        https://git.kernel.org/abelloni/c/8c0522993925
[02/12] i3c: mipi-i3c-hci-pci: Move all Intel-related definitions together
        https://git.kernel.org/abelloni/c/f4fe6e708495
[03/12] i3c: mipi-i3c-hci-pci: Rename some Intel-related identifiers
        https://git.kernel.org/abelloni/c/58a9ae637112
[04/12] i3c: mipi-i3c-hci-pci: Use readl_poll_timeout()
        https://git.kernel.org/abelloni/c/36f18ae15cfd
[05/12] i3c: mipi-i3c-hci-pci: Constify driver data
        https://git.kernel.org/abelloni/c/fc6152dc777d
[06/12] i3c: mipi-i3c-hci-pci: Factor out private registers ioremapping
        https://git.kernel.org/abelloni/c/9dfa23c41510
[07/12] i3c: mipi-i3c-hci-pci: Factor out intel_reset()
        https://git.kernel.org/abelloni/c/6f6efdd15c67
[08/12] i3c: mipi-i3c-hci-pci: Allocate a structure for mipi_i3c_hci_pci device information
        https://git.kernel.org/abelloni/c/da8116a9be9b
[09/12] i3c: mipi-i3c-hci-pci: Change callback parameter
        https://git.kernel.org/abelloni/c/0f9ef14b3fb8
[10/12] i3c: mipi-i3c-hci-pci: Add exit callback
        https://git.kernel.org/abelloni/c/040dcd762d60
[11/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers
        https://git.kernel.org/abelloni/c/884a33131f2a
[12/12] i3c: mipi-i3c-hci-pci: Set d3cold_delay to 0 for Intel controllers
        https://git.kernel.org/abelloni/c/a54b1aeb61de

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

end of thread, other threads:[~2025-11-28 23:17 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-28  6:40 [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
2025-11-28  6:40 ` [PATCH V5 01/12] i3c: mipi-i3c-hci-pci: Set 64-bit DMA mask " Adrian Hunter
2025-11-28  6:40 ` [PATCH V5 02/12] i3c: mipi-i3c-hci-pci: Move all Intel-related definitions together Adrian Hunter
2025-11-28  6:40 ` [PATCH V5 03/12] i3c: mipi-i3c-hci-pci: Rename some Intel-related identifiers Adrian Hunter
2025-11-28  6:40 ` [PATCH V5 04/12] i3c: mipi-i3c-hci-pci: Use readl_poll_timeout() Adrian Hunter
2025-11-28  6:40 ` [PATCH V5 05/12] i3c: mipi-i3c-hci-pci: Constify driver data Adrian Hunter
2025-11-28  6:40 ` [PATCH V5 06/12] i3c: mipi-i3c-hci-pci: Factor out private registers ioremapping Adrian Hunter
2025-11-28  6:40 ` [PATCH V5 07/12] i3c: mipi-i3c-hci-pci: Factor out intel_reset() Adrian Hunter
2025-11-28  6:40 ` [PATCH V5 08/12] i3c: mipi-i3c-hci-pci: Allocate a structure for mipi_i3c_hci_pci device information Adrian Hunter
2025-11-28  6:40 ` [PATCH V5 09/12] i3c: mipi-i3c-hci-pci: Change callback parameter Adrian Hunter
2025-11-28  6:40 ` [PATCH V5 10/12] i3c: mipi-i3c-hci-pci: Add exit callback Adrian Hunter
2025-11-28  6:40 ` [PATCH V5 11/12] i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers Adrian Hunter
2025-11-28  6:40 ` [PATCH V5 12/12] i3c: mipi-i3c-hci-pci: Set d3cold_delay to 0 " Adrian Hunter
2025-11-28 23:17 ` [PATCH V5 00/12] i3c: mipi-i3c-hci-pci: Add LTR support " Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox