* [PATCH V3 01/11] i3c: mipi-i3c-hci: Remove duplicate blank lines
2025-12-16 16:56 [PATCH V3 00/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus Instances for Intel controllers Adrian Hunter
@ 2025-12-16 16:56 ` Adrian Hunter
2025-12-16 16:56 ` [PATCH V3 02/11] i3c: mipi-i3c-hci: Stop reading Extended Capabilities if capability ID is 0 Adrian Hunter
` (9 subsequent siblings)
10 siblings, 0 replies; 21+ messages in thread
From: Adrian Hunter @ 2025-12-16 16:56 UTC (permalink / raw)
To: alexandre.belloni; +Cc: Frank.Li, linux-i3c
Remove duplicate blank lines from mipi-i3c-hci code.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
Changes in V3:
None
Changes in V2:
Add Frank's Rev'd-by
drivers/i3c/master/mipi-i3c-hci/cmd_v1.c | 2 --
drivers/i3c/master/mipi-i3c-hci/cmd_v2.c | 2 --
drivers/i3c/master/mipi-i3c-hci/core.c | 2 --
drivers/i3c/master/mipi-i3c-hci/dat_v1.c | 1 -
drivers/i3c/master/mipi-i3c-hci/dma.c | 2 --
drivers/i3c/master/mipi-i3c-hci/ext_caps.c | 1 -
drivers/i3c/master/mipi-i3c-hci/ext_caps.h | 1 -
drivers/i3c/master/mipi-i3c-hci/hci.h | 5 -----
drivers/i3c/master/mipi-i3c-hci/pio.c | 1 -
9 files changed, 17 deletions(-)
diff --git a/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c b/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c
index eb8a3ae2990d..fe260461e7e6 100644
--- a/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c
+++ b/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c
@@ -15,7 +15,6 @@
#include "dat.h"
#include "dct.h"
-
/*
* Address Assignment Command
*/
@@ -100,7 +99,6 @@
#define CMD_M0_VENDOR_INFO_PRESENT W0_BIT_( 7)
#define CMD_M0_TID(v) FIELD_PREP(W0_MASK( 6, 3), v)
-
/* Data Transfer Speed and Mode */
enum hci_cmd_mode {
MODE_I3C_SDR0 = 0x0,
diff --git a/drivers/i3c/master/mipi-i3c-hci/cmd_v2.c b/drivers/i3c/master/mipi-i3c-hci/cmd_v2.c
index efb4326a25b7..3729e6419581 100644
--- a/drivers/i3c/master/mipi-i3c-hci/cmd_v2.c
+++ b/drivers/i3c/master/mipi-i3c-hci/cmd_v2.c
@@ -16,7 +16,6 @@
#include "cmd.h"
#include "xfer_mode_rate.h"
-
/*
* Unified Data Transfer Command
*/
@@ -62,7 +61,6 @@
#define CMD_A0_ASSIGN_ADDRESS(v) FIELD_PREP(W0_MASK( 14, 8), v)
#define CMD_A0_TID(v) FIELD_PREP(W0_MASK( 6, 3), v)
-
static unsigned int get_i3c_rate_idx(struct i3c_hci *hci)
{
struct i3c_bus *bus = i3c_master_get_bus(&hci->master);
diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
index 607d77ab0e54..211321f73e02 100644
--- a/drivers/i3c/master/mipi-i3c-hci/core.c
+++ b/drivers/i3c/master/mipi-i3c-hci/core.c
@@ -21,7 +21,6 @@
#include "cmd.h"
#include "dat.h"
-
/*
* Host Controller Capabilities and Operation Registers
*/
@@ -109,7 +108,6 @@
#define DEV_CTX_BASE_LO 0x60
#define DEV_CTX_BASE_HI 0x64
-
static inline struct i3c_hci *to_i3c_hci(struct i3c_master_controller *m)
{
return container_of(m, struct i3c_hci, master);
diff --git a/drivers/i3c/master/mipi-i3c-hci/dat_v1.c b/drivers/i3c/master/mipi-i3c-hci/dat_v1.c
index 85c4916972e4..cc5d2deb23ab 100644
--- a/drivers/i3c/master/mipi-i3c-hci/dat_v1.c
+++ b/drivers/i3c/master/mipi-i3c-hci/dat_v1.c
@@ -15,7 +15,6 @@
#include "hci.h"
#include "dat.h"
-
/*
* Device Address Table Structure
*/
diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c
index 951abfea5a6f..3eb67e29b706 100644
--- a/drivers/i3c/master/mipi-i3c-hci/dma.c
+++ b/drivers/i3c/master/mipi-i3c-hci/dma.c
@@ -20,7 +20,6 @@
#include "cmd.h"
#include "ibi.h"
-
/*
* Software Parameter Values (somewhat arb itrary for now).
* Some of them could be determined at run time eventually.
@@ -124,7 +123,6 @@
#define DATA_BUF_IOC BIT(30) /* Interrupt on Completion */
#define DATA_BUF_BLOCK_SIZE GENMASK(15, 0)
-
struct hci_rh_data {
void __iomem *regs;
void *xfer, *resp, *ibi_status, *ibi_data;
diff --git a/drivers/i3c/master/mipi-i3c-hci/ext_caps.c b/drivers/i3c/master/mipi-i3c-hci/ext_caps.c
index 7714f00ea9cc..40939af0b0e3 100644
--- a/drivers/i3c/master/mipi-i3c-hci/ext_caps.c
+++ b/drivers/i3c/master/mipi-i3c-hci/ext_caps.c
@@ -16,7 +16,6 @@
#include "ext_caps.h"
#include "xfer_mode_rate.h"
-
/* Extended Capability Header */
#define CAP_HEADER_LENGTH GENMASK(23, 8)
#define CAP_HEADER_ID GENMASK(7, 0)
diff --git a/drivers/i3c/master/mipi-i3c-hci/ext_caps.h b/drivers/i3c/master/mipi-i3c-hci/ext_caps.h
index 9df17822fdb4..b15e629951f0 100644
--- a/drivers/i3c/master/mipi-i3c-hci/ext_caps.h
+++ b/drivers/i3c/master/mipi-i3c-hci/ext_caps.h
@@ -13,7 +13,6 @@
/* MIPI vendor IDs */
#define MIPI_VENDOR_NXP 0x11b
-
int i3c_hci_parse_ext_caps(struct i3c_hci *hci);
#endif
diff --git a/drivers/i3c/master/mipi-i3c-hci/hci.h b/drivers/i3c/master/mipi-i3c-hci/hci.h
index 249ccb13c909..3f88b67bc5cc 100644
--- a/drivers/i3c/master/mipi-i3c-hci/hci.h
+++ b/drivers/i3c/master/mipi-i3c-hci/hci.h
@@ -62,7 +62,6 @@ struct i3c_hci {
void *vendor_data;
};
-
/*
* Structure to represent a master initiated transfer.
* The rnw, data and data_len fields must be initialized before calling any
@@ -108,7 +107,6 @@ static inline void hci_free_xfer(struct hci_xfer *xfer, unsigned int n)
kfree(xfer);
}
-
/* This abstracts PIO vs DMA operations */
struct hci_io_ops {
bool (*irq_handler)(struct i3c_hci *hci);
@@ -126,21 +124,18 @@ struct hci_io_ops {
extern const struct hci_io_ops mipi_i3c_hci_pio;
extern const struct hci_io_ops mipi_i3c_hci_dma;
-
/* Our per device master private data */
struct i3c_hci_dev_data {
int dat_idx;
void *ibi_data;
};
-
/* list of quirks */
#define HCI_QUIRK_RAW_CCC BIT(1) /* CCC framing must be explicit */
#define HCI_QUIRK_PIO_MODE BIT(2) /* Set PIO mode for AMD platforms */
#define HCI_QUIRK_OD_PP_TIMING BIT(3) /* Set OD and PP timings for AMD platforms */
#define HCI_QUIRK_RESP_BUF_THLD BIT(4) /* Set resp buf thld to 0 for AMD platforms */
-
/* global functions */
void mipi_i3c_hci_resume(struct i3c_hci *hci);
void mipi_i3c_hci_pio_reset(struct i3c_hci *hci);
diff --git a/drivers/i3c/master/mipi-i3c-hci/pio.c b/drivers/i3c/master/mipi-i3c-hci/pio.c
index 710faa46a00f..142f3f79415b 100644
--- a/drivers/i3c/master/mipi-i3c-hci/pio.c
+++ b/drivers/i3c/master/mipi-i3c-hci/pio.c
@@ -15,7 +15,6 @@
#include "cmd.h"
#include "ibi.h"
-
/*
* PIO Access Area
*/
--
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] 21+ messages in thread* [PATCH V3 02/11] i3c: mipi-i3c-hci: Stop reading Extended Capabilities if capability ID is 0
2025-12-16 16:56 [PATCH V3 00/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus Instances for Intel controllers Adrian Hunter
2025-12-16 16:56 ` [PATCH V3 01/11] i3c: mipi-i3c-hci: Remove duplicate blank lines Adrian Hunter
@ 2025-12-16 16:56 ` Adrian Hunter
2025-12-16 16:56 ` [PATCH V3 03/11] i3c: mipi-i3c-hci: Quieten initialization messages Adrian Hunter
` (8 subsequent siblings)
10 siblings, 0 replies; 21+ messages in thread
From: Adrian Hunter @ 2025-12-16 16:56 UTC (permalink / raw)
To: alexandre.belloni; +Cc: Frank.Li, linux-i3c
Extended Capability ID value 0 is special. It signifies the end of the
list. Stop reading Extended Capabilities if capability ID is 0.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
Changes in V3:
None
Changes in V2:
Add Frank's Rev'd-by
drivers/i3c/master/mipi-i3c-hci/ext_caps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i3c/master/mipi-i3c-hci/ext_caps.c b/drivers/i3c/master/mipi-i3c-hci/ext_caps.c
index 40939af0b0e3..024bccf23fd0 100644
--- a/drivers/i3c/master/mipi-i3c-hci/ext_caps.c
+++ b/drivers/i3c/master/mipi-i3c-hci/ext_caps.c
@@ -271,7 +271,7 @@ int i3c_hci_parse_ext_caps(struct i3c_hci *hci)
cap_length = FIELD_GET(CAP_HEADER_LENGTH, cap_header);
dev_dbg(&hci->master.dev, "id=0x%02x length=%d",
cap_id, cap_length);
- if (!cap_length)
+ if (!cap_id || !cap_length)
break;
if (curr_cap + cap_length * 4 >= end) {
dev_err(&hci->master.dev,
--
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] 21+ messages in thread* [PATCH V3 03/11] i3c: mipi-i3c-hci: Quieten initialization messages
2025-12-16 16:56 [PATCH V3 00/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus Instances for Intel controllers Adrian Hunter
2025-12-16 16:56 ` [PATCH V3 01/11] i3c: mipi-i3c-hci: Remove duplicate blank lines Adrian Hunter
2025-12-16 16:56 ` [PATCH V3 02/11] i3c: mipi-i3c-hci: Stop reading Extended Capabilities if capability ID is 0 Adrian Hunter
@ 2025-12-16 16:56 ` Adrian Hunter
2025-12-16 16:56 ` [PATCH V3 04/11] i3c: mipi-i3c-hci-pci: Do not repeatedly check for NULL driver_data Adrian Hunter
` (7 subsequent siblings)
10 siblings, 0 replies; 21+ messages in thread
From: Adrian Hunter @ 2025-12-16 16:56 UTC (permalink / raw)
To: alexandre.belloni; +Cc: Frank.Li, linux-i3c
The copious initialization messages are at most useful only for debugging.
Change them from dev_info() or dev_notice() to dev_dbg().
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
Changes in V3:
Minor white space tweaks to fix alignment
Changes in V2:
Add Frank's Rev'd-by
drivers/i3c/master/mipi-i3c-hci/core.c | 18 +++----
drivers/i3c/master/mipi-i3c-hci/dma.c | 4 +-
drivers/i3c/master/mipi-i3c-hci/ext_caps.c | 55 ++++++++++------------
drivers/i3c/master/mipi-i3c-hci/pio.c | 16 +++----
4 files changed, 45 insertions(+), 48 deletions(-)
diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
index 211321f73e02..07fb91a12593 100644
--- a/drivers/i3c/master/mipi-i3c-hci/core.c
+++ b/drivers/i3c/master/mipi-i3c-hci/core.c
@@ -597,8 +597,8 @@ static int i3c_hci_init(struct i3c_hci *hci)
hci->DAT_entry_size = FIELD_GET(DAT_ENTRY_SIZE, regval) ? 0 : 8;
if (size_in_dwords)
hci->DAT_entries = 4 * hci->DAT_entries / hci->DAT_entry_size;
- dev_info(&hci->master.dev, "DAT: %u %u-bytes entries at offset %#x\n",
- hci->DAT_entries, hci->DAT_entry_size, offset);
+ dev_dbg(&hci->master.dev, "DAT: %u %u-bytes entries at offset %#x\n",
+ hci->DAT_entries, hci->DAT_entry_size, offset);
regval = reg_read(DCT_SECTION);
offset = FIELD_GET(DCT_TABLE_OFFSET, regval);
@@ -607,23 +607,23 @@ static int i3c_hci_init(struct i3c_hci *hci)
hci->DCT_entry_size = FIELD_GET(DCT_ENTRY_SIZE, regval) ? 0 : 16;
if (size_in_dwords)
hci->DCT_entries = 4 * hci->DCT_entries / hci->DCT_entry_size;
- dev_info(&hci->master.dev, "DCT: %u %u-bytes entries at offset %#x\n",
- hci->DCT_entries, hci->DCT_entry_size, offset);
+ dev_dbg(&hci->master.dev, "DCT: %u %u-bytes entries at offset %#x\n",
+ hci->DCT_entries, hci->DCT_entry_size, offset);
regval = reg_read(RING_HEADERS_SECTION);
offset = FIELD_GET(RING_HEADERS_OFFSET, regval);
hci->RHS_regs = offset ? hci->base_regs + offset : NULL;
- dev_info(&hci->master.dev, "Ring Headers at offset %#x\n", offset);
+ dev_dbg(&hci->master.dev, "Ring Headers at offset %#x\n", offset);
regval = reg_read(PIO_SECTION);
offset = FIELD_GET(PIO_REGS_OFFSET, regval);
hci->PIO_regs = offset ? hci->base_regs + offset : NULL;
- dev_info(&hci->master.dev, "PIO section at offset %#x\n", offset);
+ dev_dbg(&hci->master.dev, "PIO section at offset %#x\n", offset);
regval = reg_read(EXT_CAPS_SECTION);
offset = FIELD_GET(EXT_CAPS_OFFSET, regval);
hci->EXTCAPS_regs = offset ? hci->base_regs + offset : NULL;
- dev_info(&hci->master.dev, "Extended Caps at offset %#x\n", offset);
+ dev_dbg(&hci->master.dev, "Extended Caps at offset %#x\n", offset);
ret = i3c_hci_parse_ext_caps(hci);
if (ret)
@@ -705,7 +705,7 @@ static int i3c_hci_init(struct i3c_hci *hci)
ret = -EIO;
} else {
hci->io = &mipi_i3c_hci_dma;
- dev_info(&hci->master.dev, "Using DMA\n");
+ dev_dbg(&hci->master.dev, "Using DMA\n");
}
}
@@ -717,7 +717,7 @@ static int i3c_hci_init(struct i3c_hci *hci)
ret = -EIO;
} else {
hci->io = &mipi_i3c_hci_pio;
- dev_info(&hci->master.dev, "Using PIO\n");
+ dev_dbg(&hci->master.dev, "Using PIO\n");
}
}
diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c
index 3eb67e29b706..5515ed740ca4 100644
--- a/drivers/i3c/master/mipi-i3c-hci/dma.c
+++ b/drivers/i3c/master/mipi-i3c-hci/dma.c
@@ -212,7 +212,7 @@ static int hci_dma_init(struct i3c_hci *hci)
regval = rhs_reg_read(CONTROL);
nr_rings = FIELD_GET(MAX_HEADER_COUNT_CAP, regval);
- dev_info(&hci->master.dev, "%d DMA rings available\n", nr_rings);
+ dev_dbg(&hci->master.dev, "%d DMA rings available\n", nr_rings);
if (unlikely(nr_rings > 8)) {
dev_err(&hci->master.dev, "number of rings should be <= 8\n");
nr_rings = 8;
@@ -232,7 +232,7 @@ static int hci_dma_init(struct i3c_hci *hci)
for (i = 0; i < rings->total; i++) {
u32 offset = rhs_reg_read(RHn_OFFSET(i));
- dev_info(&hci->master.dev, "Ring %d at offset %#x\n", i, offset);
+ dev_dbg(&hci->master.dev, "Ring %d at offset %#x\n", i, offset);
ret = -EINVAL;
if (!offset)
goto err_out;
diff --git a/drivers/i3c/master/mipi-i3c-hci/ext_caps.c b/drivers/i3c/master/mipi-i3c-hci/ext_caps.c
index 024bccf23fd0..77840fd4aa51 100644
--- a/drivers/i3c/master/mipi-i3c-hci/ext_caps.c
+++ b/drivers/i3c/master/mipi-i3c-hci/ext_caps.c
@@ -26,9 +26,9 @@ static int hci_extcap_hardware_id(struct i3c_hci *hci, void __iomem *base)
hci->vendor_version_id = readl(base + 0x08);
hci->vendor_product_id = readl(base + 0x0c);
- dev_info(&hci->master.dev, "vendor MIPI ID: %#x\n", hci->vendor_mipi_id);
- dev_info(&hci->master.dev, "vendor version ID: %#x\n", hci->vendor_version_id);
- dev_info(&hci->master.dev, "vendor product ID: %#x\n", hci->vendor_product_id);
+ dev_dbg(&hci->master.dev, "vendor MIPI ID: %#x\n", hci->vendor_mipi_id);
+ dev_dbg(&hci->master.dev, "vendor version ID: %#x\n", hci->vendor_version_id);
+ dev_dbg(&hci->master.dev, "vendor product ID: %#x\n", hci->vendor_product_id);
/* ought to go in a table if this grows too much */
switch (hci->vendor_mipi_id) {
@@ -48,7 +48,7 @@ static int hci_extcap_master_config(struct i3c_hci *hci, void __iomem *base)
static const char * const functionality[] = {
"(unknown)", "master only", "target only",
"primary/secondary master" };
- dev_info(&hci->master.dev, "operation mode: %s\n", functionality[operation_mode]);
+ dev_dbg(&hci->master.dev, "operation mode: %s\n", functionality[operation_mode]);
if (operation_mode & 0x1)
return 0;
dev_err(&hci->master.dev, "only master mode is currently supported\n");
@@ -60,7 +60,7 @@ static int hci_extcap_multi_bus(struct i3c_hci *hci, void __iomem *base)
u32 bus_instance = readl(base + 0x04);
unsigned int count = FIELD_GET(GENMASK(3, 0), bus_instance);
- dev_info(&hci->master.dev, "%d bus instances\n", count);
+ dev_dbg(&hci->master.dev, "%d bus instances\n", count);
return 0;
}
@@ -70,8 +70,7 @@ static int hci_extcap_xfer_modes(struct i3c_hci *hci, void __iomem *base)
u32 entries = FIELD_GET(CAP_HEADER_LENGTH, header) - 1;
unsigned int index;
- dev_info(&hci->master.dev, "transfer mode table has %d entries\n",
- entries);
+ dev_dbg(&hci->master.dev, "transfer mode table has %d entries\n", entries);
base += 4; /* skip header */
for (index = 0; index < entries; index++) {
u32 mode_entry = readl(base);
@@ -94,7 +93,7 @@ static int hci_extcap_xfer_rates(struct i3c_hci *hci, void __iomem *base)
base += 4; /* skip header */
- dev_info(&hci->master.dev, "available data rates:\n");
+ dev_dbg(&hci->master.dev, "available data rates:\n");
for (index = 0; index < entries; index++) {
rate_entry = readl(base);
dev_dbg(&hci->master.dev, "entry %d: 0x%08x",
@@ -102,12 +101,12 @@ static int hci_extcap_xfer_rates(struct i3c_hci *hci, void __iomem *base)
rate = FIELD_GET(XFERRATE_ACTUAL_RATE_KHZ, rate_entry);
rate_id = FIELD_GET(XFERRATE_RATE_ID, rate_entry);
mode_id = FIELD_GET(XFERRATE_MODE_ID, rate_entry);
- dev_info(&hci->master.dev, "rate %d for %s = %d kHz\n",
- rate_id,
- mode_id == XFERRATE_MODE_I3C ? "I3C" :
- mode_id == XFERRATE_MODE_I2C ? "I2C" :
- "unknown mode",
- rate);
+ dev_dbg(&hci->master.dev, "rate %d for %s = %d kHz\n",
+ rate_id,
+ mode_id == XFERRATE_MODE_I3C ? "I3C" :
+ mode_id == XFERRATE_MODE_I2C ? "I2C" :
+ "unknown mode",
+ rate);
base += 4;
}
@@ -121,8 +120,8 @@ static int hci_extcap_auto_command(struct i3c_hci *hci, void __iomem *base)
u32 autocmd_ext_config = readl(base + 0x08);
unsigned int count = FIELD_GET(GENMASK(3, 0), autocmd_ext_config);
- dev_info(&hci->master.dev, "%d/%d active auto-command entries\n",
- count, max_count);
+ dev_dbg(&hci->master.dev, "%d/%d active auto-command entries\n",
+ count, max_count);
/* remember auto-command register location for later use */
hci->AUTOCMD_regs = base;
return 0;
@@ -130,46 +129,46 @@ static int hci_extcap_auto_command(struct i3c_hci *hci, void __iomem *base)
static int hci_extcap_debug(struct i3c_hci *hci, void __iomem *base)
{
- dev_info(&hci->master.dev, "debug registers present\n");
+ dev_dbg(&hci->master.dev, "debug registers present\n");
hci->DEBUG_regs = base;
return 0;
}
static int hci_extcap_scheduled_cmd(struct i3c_hci *hci, void __iomem *base)
{
- dev_info(&hci->master.dev, "scheduled commands available\n");
+ dev_dbg(&hci->master.dev, "scheduled commands available\n");
/* hci->schedcmd_regs = base; */
return 0;
}
static int hci_extcap_non_curr_master(struct i3c_hci *hci, void __iomem *base)
{
- dev_info(&hci->master.dev, "Non-Current Master support available\n");
+ dev_dbg(&hci->master.dev, "Non-Current Master support available\n");
/* hci->NCM_regs = base; */
return 0;
}
static int hci_extcap_ccc_resp_conf(struct i3c_hci *hci, void __iomem *base)
{
- dev_info(&hci->master.dev, "CCC Response Configuration available\n");
+ dev_dbg(&hci->master.dev, "CCC Response Configuration available\n");
return 0;
}
static int hci_extcap_global_DAT(struct i3c_hci *hci, void __iomem *base)
{
- dev_info(&hci->master.dev, "Global DAT available\n");
+ dev_dbg(&hci->master.dev, "Global DAT available\n");
return 0;
}
static int hci_extcap_multilane(struct i3c_hci *hci, void __iomem *base)
{
- dev_info(&hci->master.dev, "Master Multi-Lane support available\n");
+ dev_dbg(&hci->master.dev, "Master Multi-Lane support available\n");
return 0;
}
static int hci_extcap_ncm_multilane(struct i3c_hci *hci, void __iomem *base)
{
- dev_info(&hci->master.dev, "NCM Multi-Lane support available\n");
+ dev_dbg(&hci->master.dev, "NCM Multi-Lane support available\n");
return 0;
}
@@ -202,7 +201,7 @@ static const struct hci_ext_caps ext_capabilities[] = {
static int hci_extcap_vendor_NXP(struct i3c_hci *hci, void __iomem *base)
{
hci->vendor_data = (__force void *)base;
- dev_info(&hci->master.dev, "Build Date Info = %#x\n", readl(base + 1*4));
+ dev_dbg(&hci->master.dev, "Build Date Info = %#x\n", readl(base + 1 * 4));
/* reset the FPGA */
writel(0xdeadbeef, base + 1*4);
return 0;
@@ -240,9 +239,8 @@ static int hci_extcap_vendor_specific(struct i3c_hci *hci, void __iomem *base,
}
if (!vendor_cap_entry) {
- dev_notice(&hci->master.dev,
- "unknown ext_cap 0x%02x for vendor 0x%02x\n",
- cap_id, hci->vendor_mipi_id);
+ dev_dbg(&hci->master.dev, "unknown ext_cap 0x%02x for vendor 0x%02x\n",
+ cap_id, hci->vendor_mipi_id);
return 0;
}
if (cap_length < vendor_cap_entry->min_length) {
@@ -295,8 +293,7 @@ int i3c_hci_parse_ext_caps(struct i3c_hci *hci)
}
}
if (!cap_entry) {
- dev_notice(&hci->master.dev,
- "unknown ext_cap 0x%02x\n", cap_id);
+ dev_dbg(&hci->master.dev, "unknown ext_cap 0x%02x\n", cap_id);
} else if (cap_length < cap_entry->min_length) {
dev_err(&hci->master.dev,
"ext_cap 0x%02x has size %d (expecting >= %d)\n",
diff --git a/drivers/i3c/master/mipi-i3c-hci/pio.c b/drivers/i3c/master/mipi-i3c-hci/pio.c
index 142f3f79415b..109c6c5d83d6 100644
--- a/drivers/i3c/master/mipi-i3c-hci/pio.c
+++ b/drivers/i3c/master/mipi-i3c-hci/pio.c
@@ -148,14 +148,14 @@ static int hci_pio_init(struct i3c_hci *hci)
spin_lock_init(&pio->lock);
size_val = pio_reg_read(QUEUE_SIZE);
- dev_info(&hci->master.dev, "CMD/RESP FIFO = %ld entries\n",
- FIELD_GET(CR_QUEUE_SIZE, size_val));
- dev_info(&hci->master.dev, "IBI FIFO = %ld bytes\n",
- 4 * FIELD_GET(IBI_STATUS_SIZE, size_val));
- dev_info(&hci->master.dev, "RX data FIFO = %d bytes\n",
- 4 * (2 << FIELD_GET(RX_DATA_BUFFER_SIZE, size_val)));
- dev_info(&hci->master.dev, "TX data FIFO = %d bytes\n",
- 4 * (2 << FIELD_GET(TX_DATA_BUFFER_SIZE, size_val)));
+ dev_dbg(&hci->master.dev, "CMD/RESP FIFO = %ld entries\n",
+ FIELD_GET(CR_QUEUE_SIZE, size_val));
+ dev_dbg(&hci->master.dev, "IBI FIFO = %ld bytes\n",
+ 4 * FIELD_GET(IBI_STATUS_SIZE, size_val));
+ dev_dbg(&hci->master.dev, "RX data FIFO = %d bytes\n",
+ 4 * (2 << FIELD_GET(RX_DATA_BUFFER_SIZE, size_val)));
+ dev_dbg(&hci->master.dev, "TX data FIFO = %d bytes\n",
+ 4 * (2 << FIELD_GET(TX_DATA_BUFFER_SIZE, size_val)));
/*
* Let's initialize data thresholds to half of the actual FIFO size.
--
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] 21+ messages in thread* [PATCH V3 04/11] i3c: mipi-i3c-hci-pci: Do not repeatedly check for NULL driver_data
2025-12-16 16:56 [PATCH V3 00/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus Instances for Intel controllers Adrian Hunter
` (2 preceding siblings ...)
2025-12-16 16:56 ` [PATCH V3 03/11] i3c: mipi-i3c-hci: Quieten initialization messages Adrian Hunter
@ 2025-12-16 16:56 ` Adrian Hunter
2025-12-16 16:56 ` [PATCH V3 05/11] i3c: mipi-i3c-hci-pci: Enable MSI support Adrian Hunter
` (6 subsequent siblings)
10 siblings, 0 replies; 21+ messages in thread
From: Adrian Hunter @ 2025-12-16 16:56 UTC (permalink / raw)
To: alexandre.belloni; +Cc: Frank.Li, linux-i3c
All entries in the id_table have driver_data. Do not repeatedly check for
NULL driver_data.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
Changes in V3:
Add Frank's Rev'd-by
Changes in V2:
Drop default driver data
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 dc8ede0f8ad8..8ade911e3835 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
@@ -229,7 +229,7 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
goto err;
hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
- if (hci->info && hci->info->init) {
+ if (hci->info->init) {
ret = hci->info->init(hci);
if (ret)
goto err;
@@ -244,7 +244,7 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
return 0;
err_exit:
- if (hci->info && hci->info->exit)
+ if (hci->info->exit)
hci->info->exit(hci);
err:
platform_device_put(hci->pdev);
@@ -258,7 +258,7 @@ 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)
+ if (hci->info->exit)
hci->info->exit(hci);
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] 21+ messages in thread* [PATCH V3 05/11] i3c: mipi-i3c-hci-pci: Enable MSI support
2025-12-16 16:56 [PATCH V3 00/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus Instances for Intel controllers Adrian Hunter
` (3 preceding siblings ...)
2025-12-16 16:56 ` [PATCH V3 04/11] i3c: mipi-i3c-hci-pci: Do not repeatedly check for NULL driver_data Adrian Hunter
@ 2025-12-16 16:56 ` Adrian Hunter
2025-12-16 17:03 ` Frank Li
2025-12-16 16:56 ` [PATCH V3 06/11] i3c: mipi-i3c-hci-pci: Assign unique device names and IDs for Intel LPSS I3C Adrian Hunter
` (5 subsequent siblings)
10 siblings, 1 reply; 21+ messages in thread
From: Adrian Hunter @ 2025-12-16 16:56 UTC (permalink / raw)
To: alexandre.belloni; +Cc: Frank.Li, linux-i3c
Enable MSI support by using pci_alloc_irq_vectors() to request all
supported IRQ types. Do not call pci_free_irq_vectors() because for
resource-managed devices (those initialized with pcim_enable_device()),
IRQ vector allocation is automatically managed. See
pci_setup_msi_context() and pcim_setup_msi_release() for details.
Note: The current documentation for pci_alloc_irq_vectors() does not
mention this behavior.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
Changes in V3:
Enhance commit message
Changes in V2:
New patch split from "i3c: mipi-i3c-hci-pci: Add support for
Multi-Bus Instances"
drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 8 ++++++--
1 file changed, 6 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 8ade911e3835..0fd3587671e1 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
@@ -203,6 +203,10 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
pci_set_master(pci);
+ ret = pci_alloc_irq_vectors(pci, 1, 1, PCI_IRQ_ALL_TYPES);
+ if (ret < 0)
+ return ret;
+
memset(&res, 0, sizeof(res));
res[0].flags = IORESOURCE_MEM;
@@ -210,8 +214,8 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
res[0].end = pci_resource_end(pci, 0);
res[1].flags = IORESOURCE_IRQ;
- res[1].start = pci->irq;
- res[1].end = pci->irq;
+ res[1].start = pci_irq_vector(hci->pci, 0);
+ res[1].end = res[1].start;
dev_id = ida_alloc(&mipi_i3c_hci_pci_ida, GFP_KERNEL);
if (dev_id < 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] 21+ messages in thread* Re: [PATCH V3 05/11] i3c: mipi-i3c-hci-pci: Enable MSI support
2025-12-16 16:56 ` [PATCH V3 05/11] i3c: mipi-i3c-hci-pci: Enable MSI support Adrian Hunter
@ 2025-12-16 17:03 ` Frank Li
0 siblings, 0 replies; 21+ messages in thread
From: Frank Li @ 2025-12-16 17:03 UTC (permalink / raw)
To: Adrian Hunter; +Cc: alexandre.belloni, linux-i3c
On Tue, Dec 16, 2025 at 06:56:36PM +0200, Adrian Hunter wrote:
> Enable MSI support by using pci_alloc_irq_vectors() to request all
> supported IRQ types. Do not call pci_free_irq_vectors() because for
> resource-managed devices (those initialized with pcim_enable_device()),
> IRQ vector allocation is automatically managed. See
> pci_setup_msi_context() and pcim_setup_msi_release() for details.
>
> Note: The current documentation for pci_alloc_irq_vectors() does not
> mention this behavior.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
>
> Changes in V3:
>
> Enhance commit message
>
> Changes in V2:
> New patch split from "i3c: mipi-i3c-hci-pci: Add support for
> Multi-Bus Instances"
>
>
> drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 8 ++++++--
> 1 file changed, 6 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 8ade911e3835..0fd3587671e1 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
> @@ -203,6 +203,10 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>
> pci_set_master(pci);
>
> + ret = pci_alloc_irq_vectors(pci, 1, 1, PCI_IRQ_ALL_TYPES);
> + if (ret < 0)
> + return ret;
> +
> memset(&res, 0, sizeof(res));
>
> res[0].flags = IORESOURCE_MEM;
> @@ -210,8 +214,8 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
> res[0].end = pci_resource_end(pci, 0);
>
> res[1].flags = IORESOURCE_IRQ;
> - res[1].start = pci->irq;
> - res[1].end = pci->irq;
> + res[1].start = pci_irq_vector(hci->pci, 0);
> + res[1].end = res[1].start;
>
> dev_id = ida_alloc(&mipi_i3c_hci_pci_ida, GFP_KERNEL);
> if (dev_id < 0)
> --
> 2.51.0
>
>
> --
> linux-i3c mailing list
> linux-i3c@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH V3 06/11] i3c: mipi-i3c-hci-pci: Assign unique device names and IDs for Intel LPSS I3C
2025-12-16 16:56 [PATCH V3 00/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus Instances for Intel controllers Adrian Hunter
` (4 preceding siblings ...)
2025-12-16 16:56 ` [PATCH V3 05/11] i3c: mipi-i3c-hci-pci: Enable MSI support Adrian Hunter
@ 2025-12-16 16:56 ` Adrian Hunter
2025-12-16 17:08 ` Frank Li
2025-12-16 16:56 ` [PATCH V3 07/11] i3c: mipi-i3c-hci: Allow for Multi-Bus Instances Adrian Hunter
` (4 subsequent siblings)
10 siblings, 1 reply; 21+ messages in thread
From: Adrian Hunter @ 2025-12-16 16:56 UTC (permalink / raw)
To: alexandre.belloni; +Cc: Frank.Li, linux-i3c
Simplify the code and ensure names and IDs align with device documentation.
Use explicit device names and IDs for Intel LPSS I3C controllers instead of
dynamically allocated values.
Add "intel-lpss-i3c" to the platform_device_id table in the mipi-i3c-hci
driver and use the same name for Intel I3C controllers in the
mipi_i3c_hci_pci driver. Assign hard-coded IDs to reflect the hardware
layout.
Intel SoCs include two I3C PCI devices in the Low Power Subsystem (LPSS),
each supporting up to two I3C buses. The second PCI device is assigned ID 2
(not 1) to match this topology. Additional IDs will be introduced when
Multi-Bus Instance support is implemented.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
Change in V3:
New patch
drivers/i3c/master/mipi-i3c-hci/core.c | 7 +++
.../master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 43 ++++++++++---------
2 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
index 07fb91a12593..3d6544a64188 100644
--- a/drivers/i3c/master/mipi-i3c-hci/core.c
+++ b/drivers/i3c/master/mipi-i3c-hci/core.c
@@ -790,9 +790,16 @@ static const struct acpi_device_id i3c_hci_acpi_match[] = {
};
MODULE_DEVICE_TABLE(acpi, i3c_hci_acpi_match);
+static const struct platform_device_id i3c_hci_driver_ids[] = {
+ { .name = "intel-lpss-i3c" },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, i3c_hci_driver_ids);
+
static struct platform_driver i3c_hci_driver = {
.probe = i3c_hci_probe,
.remove = i3c_hci_remove,
+ .id_table = i3c_hci_driver_ids,
.driver = {
.name = "mipi-i3c-hci",
.of_match_table = of_match_ptr(i3c_hci_of_match),
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 0fd3587671e1..3b319fbf18ce 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,10 +27,10 @@ struct mipi_i3c_hci_pci {
struct mipi_i3c_hci_pci_info {
int (*init)(struct mipi_i3c_hci_pci *hci);
void (*exit)(struct mipi_i3c_hci_pci *hci);
+ const char *name;
+ int id;
};
-static DEFINE_IDA(mipi_i3c_hci_pci_ida);
-
#define INTEL_PRIV_OFFSET 0x2b0
#define INTEL_PRIV_SIZE 0x28
#define INTEL_RESETS 0x04
@@ -179,9 +179,18 @@ static void intel_i3c_exit(struct mipi_i3c_hci_pci *hci)
intel_ltr_hide(&hci->pci->dev);
}
-static const struct mipi_i3c_hci_pci_info intel_info = {
+static const struct mipi_i3c_hci_pci_info intel_1_info = {
.init = intel_i3c_init,
.exit = intel_i3c_exit,
+ .name = "intel-lpss-i3c",
+ .id = 0,
+};
+
+static const struct mipi_i3c_hci_pci_info intel_2_info = {
+ .init = intel_i3c_init,
+ .exit = intel_i3c_exit,
+ .name = "intel-lpss-i3c",
+ .id = 2,
};
static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
@@ -189,7 +198,7 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
{
struct mipi_i3c_hci_pci *hci;
struct resource res[2];
- int dev_id, ret;
+ int ret;
hci = devm_kzalloc(&pci->dev, sizeof(*hci), GFP_KERNEL);
if (!hci)
@@ -217,11 +226,9 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
res[1].start = pci_irq_vector(hci->pci, 0);
res[1].end = res[1].start;
- dev_id = ida_alloc(&mipi_i3c_hci_pci_ida, GFP_KERNEL);
- if (dev_id < 0)
- return dev_id;
+ hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
- hci->pdev = platform_device_alloc("mipi-i3c-hci", dev_id);
+ hci->pdev = platform_device_alloc(hci->info->name, hci->info->id);
if (!hci->pdev)
return -ENOMEM;
@@ -232,7 +239,6 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
if (ret)
goto err;
- hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
if (hci->info->init) {
ret = hci->info->init(hci);
if (ret)
@@ -252,7 +258,6 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
hci->info->exit(hci);
err:
platform_device_put(hci->pdev);
- ida_free(&mipi_i3c_hci_pci_ida, dev_id);
return ret;
}
@@ -260,28 +265,26 @@ static void mipi_i3c_hci_pci_remove(struct pci_dev *pci)
{
struct mipi_i3c_hci_pci *hci = pci_get_drvdata(pci);
struct platform_device *pdev = hci->pdev;
- int dev_id = pdev->id;
if (hci->info->exit)
hci->info->exit(hci);
platform_device_unregister(pdev);
- ida_free(&mipi_i3c_hci_pci_ida, dev_id);
}
static const struct pci_device_id mipi_i3c_hci_pci_devices[] = {
/* Wildcat Lake-U */
- { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_info},
- { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_info},
+ { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_1_info},
+ { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_2_info},
/* Panther Lake-H */
- { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_info},
- { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_info},
+ { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_1_info},
+ { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_2_info},
/* Panther Lake-P */
- { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_info},
- { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_info},
+ { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_1_info},
+ { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_2_info},
/* Nova Lake-S */
- { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_info},
- { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_info},
+ { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_1_info},
+ { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_2_info},
{ },
};
MODULE_DEVICE_TABLE(pci, mipi_i3c_hci_pci_devices);
--
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] 21+ messages in thread* Re: [PATCH V3 06/11] i3c: mipi-i3c-hci-pci: Assign unique device names and IDs for Intel LPSS I3C
2025-12-16 16:56 ` [PATCH V3 06/11] i3c: mipi-i3c-hci-pci: Assign unique device names and IDs for Intel LPSS I3C Adrian Hunter
@ 2025-12-16 17:08 ` Frank Li
2025-12-16 17:14 ` Adrian Hunter
0 siblings, 1 reply; 21+ messages in thread
From: Frank Li @ 2025-12-16 17:08 UTC (permalink / raw)
To: Adrian Hunter; +Cc: alexandre.belloni, linux-i3c
On Tue, Dec 16, 2025 at 06:56:37PM +0200, Adrian Hunter wrote:
> Simplify the code and ensure names and IDs align with device documentation.
> Use explicit device names and IDs for Intel LPSS I3C controllers instead of
> dynamically allocated values.
>
> Add "intel-lpss-i3c" to the platform_device_id table in the mipi-i3c-hci
> driver and use the same name for Intel I3C controllers in the
> mipi_i3c_hci_pci driver. Assign hard-coded IDs to reflect the hardware
> layout.
>
> Intel SoCs include two I3C PCI devices in the Low Power Subsystem (LPSS),
> each supporting up to two I3C buses. The second PCI device is assigned ID 2
> (not 1) to match this topology. Additional IDs will be introduced when
> Multi-Bus Instance support is implemented.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>
>
> Change in V3:
>
> New patch
>
>
> drivers/i3c/master/mipi-i3c-hci/core.c | 7 +++
> .../master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 43 ++++++++++---------
> 2 files changed, 30 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
> index 07fb91a12593..3d6544a64188 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/core.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/core.c
> @@ -790,9 +790,16 @@ static const struct acpi_device_id i3c_hci_acpi_match[] = {
> };
> MODULE_DEVICE_TABLE(acpi, i3c_hci_acpi_match);
>
> +static const struct platform_device_id i3c_hci_driver_ids[] = {
> + { .name = "intel-lpss-i3c" },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(platform, i3c_hci_driver_ids);
> +
> static struct platform_driver i3c_hci_driver = {
> .probe = i3c_hci_probe,
> .remove = i3c_hci_remove,
> + .id_table = i3c_hci_driver_ids,
> .driver = {
> .name = "mipi-i3c-hci",
> .of_match_table = of_match_ptr(i3c_hci_of_match),
> 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 0fd3587671e1..3b319fbf18ce 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,10 +27,10 @@ struct mipi_i3c_hci_pci {
> struct mipi_i3c_hci_pci_info {
> int (*init)(struct mipi_i3c_hci_pci *hci);
> void (*exit)(struct mipi_i3c_hci_pci *hci);
> + const char *name;
> + int id;
> };
>
> -static DEFINE_IDA(mipi_i3c_hci_pci_ida);
> -
> #define INTEL_PRIV_OFFSET 0x2b0
> #define INTEL_PRIV_SIZE 0x28
> #define INTEL_RESETS 0x04
> @@ -179,9 +179,18 @@ static void intel_i3c_exit(struct mipi_i3c_hci_pci *hci)
> intel_ltr_hide(&hci->pci->dev);
> }
>
> -static const struct mipi_i3c_hci_pci_info intel_info = {
> +static const struct mipi_i3c_hci_pci_info intel_1_info = {
> .init = intel_i3c_init,
> .exit = intel_i3c_exit,
> + .name = "intel-lpss-i3c",
> + .id = 0,
> +};
> +
> +static const struct mipi_i3c_hci_pci_info intel_2_info = {
> + .init = intel_i3c_init,
> + .exit = intel_i3c_exit,
> + .name = "intel-lpss-i3c",
> + .id = 2,
> };
>
> static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
> @@ -189,7 +198,7 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
> {
> struct mipi_i3c_hci_pci *hci;
> struct resource res[2];
> - int dev_id, ret;
> + int ret;
>
> hci = devm_kzalloc(&pci->dev, sizeof(*hci), GFP_KERNEL);
> if (!hci)
> @@ -217,11 +226,9 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
> res[1].start = pci_irq_vector(hci->pci, 0);
> res[1].end = res[1].start;
>
> - dev_id = ida_alloc(&mipi_i3c_hci_pci_ida, GFP_KERNEL);
> - if (dev_id < 0)
> - return dev_id;
> + hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
>
> - hci->pdev = platform_device_alloc("mipi-i3c-hci", dev_id);
> + hci->pdev = platform_device_alloc(hci->info->name, hci->info->id);
> if (!hci->pdev)
> return -ENOMEM;
>
> @@ -232,7 +239,6 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
> if (ret)
> goto err;
>
> - hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
> if (hci->info->init) {
> ret = hci->info->init(hci);
> if (ret)
> @@ -252,7 +258,6 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
> hci->info->exit(hci);
> err:
> platform_device_put(hci->pdev);
> - ida_free(&mipi_i3c_hci_pci_ida, dev_id);
> return ret;
> }
>
> @@ -260,28 +265,26 @@ static void mipi_i3c_hci_pci_remove(struct pci_dev *pci)
> {
> struct mipi_i3c_hci_pci *hci = pci_get_drvdata(pci);
> struct platform_device *pdev = hci->pdev;
> - int dev_id = pdev->id;
>
> if (hci->info->exit)
> hci->info->exit(hci);
>
> platform_device_unregister(pdev);
> - ida_free(&mipi_i3c_hci_pci_ida, dev_id);
> }
>
> static const struct pci_device_id mipi_i3c_hci_pci_devices[] = {
> /* Wildcat Lake-U */
> - { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_info},
> - { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_info},
> + { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_1_info},
If there there are two 0x4d7c pcie cards in system, id will be the same.
Is it okay?
Frank
> + { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_2_info},
> /* Panther Lake-H */
> - { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_info},
> - { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_info},
> + { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_1_info},
> + { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_2_info},
> /* Panther Lake-P */
> - { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_info},
> - { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_info},
> + { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_1_info},
> + { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_2_info},
> /* Nova Lake-S */
> - { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_info},
> - { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_info},
> + { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_1_info},
> + { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_2_info},
> { },
> };
> MODULE_DEVICE_TABLE(pci, mipi_i3c_hci_pci_devices);
> --
> 2.51.0
>
>
> --
> linux-i3c mailing list
> linux-i3c@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH V3 06/11] i3c: mipi-i3c-hci-pci: Assign unique device names and IDs for Intel LPSS I3C
2025-12-16 17:08 ` Frank Li
@ 2025-12-16 17:14 ` Adrian Hunter
2025-12-16 18:56 ` Adrian Hunter
0 siblings, 1 reply; 21+ messages in thread
From: Adrian Hunter @ 2025-12-16 17:14 UTC (permalink / raw)
To: Frank Li; +Cc: alexandre.belloni, linux-i3c
On 16/12/2025 19:08, Frank Li wrote:
> On Tue, Dec 16, 2025 at 06:56:37PM +0200, Adrian Hunter wrote:
>> Simplify the code and ensure names and IDs align with device documentation.
>> Use explicit device names and IDs for Intel LPSS I3C controllers instead of
>> dynamically allocated values.
>>
>> Add "intel-lpss-i3c" to the platform_device_id table in the mipi-i3c-hci
>> driver and use the same name for Intel I3C controllers in the
>> mipi_i3c_hci_pci driver. Assign hard-coded IDs to reflect the hardware
>> layout.
>>
>> Intel SoCs include two I3C PCI devices in the Low Power Subsystem (LPSS),
>> each supporting up to two I3C buses. The second PCI device is assigned ID 2
>> (not 1) to match this topology. Additional IDs will be introduced when
>> Multi-Bus Instance support is implemented.
>>
>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>> ---
>>
>>
>> Change in V3:
>>
>> New patch
>>
>>
>> drivers/i3c/master/mipi-i3c-hci/core.c | 7 +++
>> .../master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 43 ++++++++++---------
>> 2 files changed, 30 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
>> index 07fb91a12593..3d6544a64188 100644
>> --- a/drivers/i3c/master/mipi-i3c-hci/core.c
>> +++ b/drivers/i3c/master/mipi-i3c-hci/core.c
>> @@ -790,9 +790,16 @@ static const struct acpi_device_id i3c_hci_acpi_match[] = {
>> };
>> MODULE_DEVICE_TABLE(acpi, i3c_hci_acpi_match);
>>
>> +static const struct platform_device_id i3c_hci_driver_ids[] = {
>> + { .name = "intel-lpss-i3c" },
>> + { /* sentinel */ }
>> +};
>> +MODULE_DEVICE_TABLE(platform, i3c_hci_driver_ids);
>> +
>> static struct platform_driver i3c_hci_driver = {
>> .probe = i3c_hci_probe,
>> .remove = i3c_hci_remove,
>> + .id_table = i3c_hci_driver_ids,
>> .driver = {
>> .name = "mipi-i3c-hci",
>> .of_match_table = of_match_ptr(i3c_hci_of_match),
>> 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 0fd3587671e1..3b319fbf18ce 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,10 +27,10 @@ struct mipi_i3c_hci_pci {
>> struct mipi_i3c_hci_pci_info {
>> int (*init)(struct mipi_i3c_hci_pci *hci);
>> void (*exit)(struct mipi_i3c_hci_pci *hci);
>> + const char *name;
>> + int id;
>> };
>>
>> -static DEFINE_IDA(mipi_i3c_hci_pci_ida);
>> -
>> #define INTEL_PRIV_OFFSET 0x2b0
>> #define INTEL_PRIV_SIZE 0x28
>> #define INTEL_RESETS 0x04
>> @@ -179,9 +179,18 @@ static void intel_i3c_exit(struct mipi_i3c_hci_pci *hci)
>> intel_ltr_hide(&hci->pci->dev);
>> }
>>
>> -static const struct mipi_i3c_hci_pci_info intel_info = {
>> +static const struct mipi_i3c_hci_pci_info intel_1_info = {
>> .init = intel_i3c_init,
>> .exit = intel_i3c_exit,
>> + .name = "intel-lpss-i3c",
>> + .id = 0,
>> +};
>> +
>> +static const struct mipi_i3c_hci_pci_info intel_2_info = {
>> + .init = intel_i3c_init,
>> + .exit = intel_i3c_exit,
>> + .name = "intel-lpss-i3c",
>> + .id = 2,
>> };
>>
>> static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>> @@ -189,7 +198,7 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>> {
>> struct mipi_i3c_hci_pci *hci;
>> struct resource res[2];
>> - int dev_id, ret;
>> + int ret;
>>
>> hci = devm_kzalloc(&pci->dev, sizeof(*hci), GFP_KERNEL);
>> if (!hci)
>> @@ -217,11 +226,9 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>> res[1].start = pci_irq_vector(hci->pci, 0);
>> res[1].end = res[1].start;
>>
>> - dev_id = ida_alloc(&mipi_i3c_hci_pci_ida, GFP_KERNEL);
>> - if (dev_id < 0)
>> - return dev_id;
>> + hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
>>
>> - hci->pdev = platform_device_alloc("mipi-i3c-hci", dev_id);
>> + hci->pdev = platform_device_alloc(hci->info->name, hci->info->id);
>> if (!hci->pdev)
>> return -ENOMEM;
>>
>> @@ -232,7 +239,6 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>> if (ret)
>> goto err;
>>
>> - hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
>> if (hci->info->init) {
>> ret = hci->info->init(hci);
>> if (ret)
>> @@ -252,7 +258,6 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>> hci->info->exit(hci);
>> err:
>> platform_device_put(hci->pdev);
>> - ida_free(&mipi_i3c_hci_pci_ida, dev_id);
>> return ret;
>> }
>>
>> @@ -260,28 +265,26 @@ static void mipi_i3c_hci_pci_remove(struct pci_dev *pci)
>> {
>> struct mipi_i3c_hci_pci *hci = pci_get_drvdata(pci);
>> struct platform_device *pdev = hci->pdev;
>> - int dev_id = pdev->id;
>>
>> if (hci->info->exit)
>> hci->info->exit(hci);
>>
>> platform_device_unregister(pdev);
>> - ida_free(&mipi_i3c_hci_pci_ida, dev_id);
>> }
>>
>> static const struct pci_device_id mipi_i3c_hci_pci_devices[] = {
>> /* Wildcat Lake-U */
>> - { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_info},
>> - { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_info},
>> + { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_1_info},
>
> If there there are two 0x4d7c pcie cards in system, id will be the same.
> Is it okay?
These are not cards. These PCI device IDs are unique to each device
in the SoC, so duplicate IDs would never happen.
>
> Frank
>
>> + { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_2_info},
>> /* Panther Lake-H */
>> - { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_info},
>> - { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_info},
>> + { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_1_info},
>> + { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_2_info},
>> /* Panther Lake-P */
>> - { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_info},
>> - { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_info},
>> + { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_1_info},
>> + { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_2_info},
>> /* Nova Lake-S */
>> - { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_info},
>> - { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_info},
>> + { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_1_info},
>> + { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_2_info},
>> { },
>> };
>> MODULE_DEVICE_TABLE(pci, mipi_i3c_hci_pci_devices);
>> --
>> 2.51.0
>>
>>
>> --
>> linux-i3c mailing list
>> linux-i3c@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-i3c
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH V3 06/11] i3c: mipi-i3c-hci-pci: Assign unique device names and IDs for Intel LPSS I3C
2025-12-16 17:14 ` Adrian Hunter
@ 2025-12-16 18:56 ` Adrian Hunter
2025-12-17 19:24 ` Frank Li
0 siblings, 1 reply; 21+ messages in thread
From: Adrian Hunter @ 2025-12-16 18:56 UTC (permalink / raw)
To: Frank Li; +Cc: alexandre.belloni, linux-i3c
On 16/12/2025 19:14, Adrian Hunter wrote:
> On 16/12/2025 19:08, Frank Li wrote:
>> On Tue, Dec 16, 2025 at 06:56:37PM +0200, Adrian Hunter wrote:
>>> Simplify the code and ensure names and IDs align with device documentation.
>>> Use explicit device names and IDs for Intel LPSS I3C controllers instead of
>>> dynamically allocated values.
>>>
>>> Add "intel-lpss-i3c" to the platform_device_id table in the mipi-i3c-hci
>>> driver and use the same name for Intel I3C controllers in the
>>> mipi_i3c_hci_pci driver. Assign hard-coded IDs to reflect the hardware
>>> layout.
>>>
>>> Intel SoCs include two I3C PCI devices in the Low Power Subsystem (LPSS),
>>> each supporting up to two I3C buses. The second PCI device is assigned ID 2
>>> (not 1) to match this topology. Additional IDs will be introduced when
>>> Multi-Bus Instance support is implemented.
>>>
>>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>>> ---
>>>
>>>
>>> Change in V3:
>>>
>>> New patch
>>>
>>>
>>> drivers/i3c/master/mipi-i3c-hci/core.c | 7 +++
>>> .../master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 43 ++++++++++---------
>>> 2 files changed, 30 insertions(+), 20 deletions(-)
>>>
>>> diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
>>> index 07fb91a12593..3d6544a64188 100644
>>> --- a/drivers/i3c/master/mipi-i3c-hci/core.c
>>> +++ b/drivers/i3c/master/mipi-i3c-hci/core.c
>>> @@ -790,9 +790,16 @@ static const struct acpi_device_id i3c_hci_acpi_match[] = {
>>> };
>>> MODULE_DEVICE_TABLE(acpi, i3c_hci_acpi_match);
>>>
>>> +static const struct platform_device_id i3c_hci_driver_ids[] = {
>>> + { .name = "intel-lpss-i3c" },
>>> + { /* sentinel */ }
>>> +};
>>> +MODULE_DEVICE_TABLE(platform, i3c_hci_driver_ids);
>>> +
>>> static struct platform_driver i3c_hci_driver = {
>>> .probe = i3c_hci_probe,
>>> .remove = i3c_hci_remove,
>>> + .id_table = i3c_hci_driver_ids,
>>> .driver = {
>>> .name = "mipi-i3c-hci",
>>> .of_match_table = of_match_ptr(i3c_hci_of_match),
>>> 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 0fd3587671e1..3b319fbf18ce 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,10 +27,10 @@ struct mipi_i3c_hci_pci {
>>> struct mipi_i3c_hci_pci_info {
>>> int (*init)(struct mipi_i3c_hci_pci *hci);
>>> void (*exit)(struct mipi_i3c_hci_pci *hci);
>>> + const char *name;
>>> + int id;
>>> };
>>>
>>> -static DEFINE_IDA(mipi_i3c_hci_pci_ida);
>>> -
>>> #define INTEL_PRIV_OFFSET 0x2b0
>>> #define INTEL_PRIV_SIZE 0x28
>>> #define INTEL_RESETS 0x04
>>> @@ -179,9 +179,18 @@ static void intel_i3c_exit(struct mipi_i3c_hci_pci *hci)
>>> intel_ltr_hide(&hci->pci->dev);
>>> }
>>>
>>> -static const struct mipi_i3c_hci_pci_info intel_info = {
>>> +static const struct mipi_i3c_hci_pci_info intel_1_info = {
>>> .init = intel_i3c_init,
>>> .exit = intel_i3c_exit,
>>> + .name = "intel-lpss-i3c",
>>> + .id = 0,
>>> +};
>>> +
>>> +static const struct mipi_i3c_hci_pci_info intel_2_info = {
>>> + .init = intel_i3c_init,
>>> + .exit = intel_i3c_exit,
>>> + .name = "intel-lpss-i3c",
>>> + .id = 2,
>>> };
>>>
>>> static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>>> @@ -189,7 +198,7 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>>> {
>>> struct mipi_i3c_hci_pci *hci;
>>> struct resource res[2];
>>> - int dev_id, ret;
>>> + int ret;
>>>
>>> hci = devm_kzalloc(&pci->dev, sizeof(*hci), GFP_KERNEL);
>>> if (!hci)
>>> @@ -217,11 +226,9 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>>> res[1].start = pci_irq_vector(hci->pci, 0);
>>> res[1].end = res[1].start;
>>>
>>> - dev_id = ida_alloc(&mipi_i3c_hci_pci_ida, GFP_KERNEL);
>>> - if (dev_id < 0)
>>> - return dev_id;
>>> + hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
>>>
>>> - hci->pdev = platform_device_alloc("mipi-i3c-hci", dev_id);
>>> + hci->pdev = platform_device_alloc(hci->info->name, hci->info->id);
>>> if (!hci->pdev)
>>> return -ENOMEM;
>>>
>>> @@ -232,7 +239,6 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>>> if (ret)
>>> goto err;
>>>
>>> - hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
>>> if (hci->info->init) {
>>> ret = hci->info->init(hci);
>>> if (ret)
>>> @@ -252,7 +258,6 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>>> hci->info->exit(hci);
>>> err:
>>> platform_device_put(hci->pdev);
>>> - ida_free(&mipi_i3c_hci_pci_ida, dev_id);
>>> return ret;
>>> }
>>>
>>> @@ -260,28 +265,26 @@ static void mipi_i3c_hci_pci_remove(struct pci_dev *pci)
>>> {
>>> struct mipi_i3c_hci_pci *hci = pci_get_drvdata(pci);
>>> struct platform_device *pdev = hci->pdev;
>>> - int dev_id = pdev->id;
>>>
>>> if (hci->info->exit)
>>> hci->info->exit(hci);
>>>
>>> platform_device_unregister(pdev);
>>> - ida_free(&mipi_i3c_hci_pci_ida, dev_id);
>>> }
>>>
>>> static const struct pci_device_id mipi_i3c_hci_pci_devices[] = {
>>> /* Wildcat Lake-U */
>>> - { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_info},
>>> - { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_info},
>>> + { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_1_info},
>>
>> If there there are two 0x4d7c pcie cards in system, id will be the same.
>> Is it okay?
>
> These are not cards. These PCI device IDs are unique to each device
> in the SoC, so duplicate IDs would never happen.
Note, that an id value can also be PLATFORM_DEVID_AUTO or
PLATFORM_DEVID_NONE, so there is still flexibility.
>
>>
>> Frank
>>
>>> + { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_2_info},
>>> /* Panther Lake-H */
>>> - { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_info},
>>> - { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_info},
>>> + { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_1_info},
>>> + { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_2_info},
>>> /* Panther Lake-P */
>>> - { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_info},
>>> - { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_info},
>>> + { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_1_info},
>>> + { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_2_info},
>>> /* Nova Lake-S */
>>> - { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_info},
>>> - { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_info},
>>> + { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_1_info},
>>> + { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_2_info},
>>> { },
>>> };
>>> MODULE_DEVICE_TABLE(pci, mipi_i3c_hci_pci_devices);
>>> --
>>> 2.51.0
>>>
>>>
>>> --
>>> linux-i3c mailing list
>>> linux-i3c@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/linux-i3c
>
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH V3 06/11] i3c: mipi-i3c-hci-pci: Assign unique device names and IDs for Intel LPSS I3C
2025-12-16 18:56 ` Adrian Hunter
@ 2025-12-17 19:24 ` Frank Li
0 siblings, 0 replies; 21+ messages in thread
From: Frank Li @ 2025-12-17 19:24 UTC (permalink / raw)
To: Adrian Hunter; +Cc: alexandre.belloni, linux-i3c
On Tue, Dec 16, 2025 at 08:56:05PM +0200, Adrian Hunter wrote:
> On 16/12/2025 19:14, Adrian Hunter wrote:
> > On 16/12/2025 19:08, Frank Li wrote:
> >> On Tue, Dec 16, 2025 at 06:56:37PM +0200, Adrian Hunter wrote:
> >>> Simplify the code and ensure names and IDs align with device documentation.
> >>> Use explicit device names and IDs for Intel LPSS I3C controllers instead of
> >>> dynamically allocated values.
> >>>
> >>> Add "intel-lpss-i3c" to the platform_device_id table in the mipi-i3c-hci
> >>> driver and use the same name for Intel I3C controllers in the
> >>> mipi_i3c_hci_pci driver. Assign hard-coded IDs to reflect the hardware
> >>> layout.
> >>>
> >>> Intel SoCs include two I3C PCI devices in the Low Power Subsystem (LPSS),
> >>> each supporting up to two I3C buses. The second PCI device is assigned ID 2
> >>> (not 1) to match this topology. Additional IDs will be introduced when
> >>> Multi-Bus Instance support is implemented.
> >>>
> >>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> >>> ---
> >>>
> >>>
> >>> Change in V3:
> >>>
> >>> New patch
> >>>
> >>>
> >>> drivers/i3c/master/mipi-i3c-hci/core.c | 7 +++
> >>> .../master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 43 ++++++++++---------
> >>> 2 files changed, 30 insertions(+), 20 deletions(-)
> >>>
> >>> diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
> >>> index 07fb91a12593..3d6544a64188 100644
> >>> --- a/drivers/i3c/master/mipi-i3c-hci/core.c
> >>> +++ b/drivers/i3c/master/mipi-i3c-hci/core.c
> >>> @@ -790,9 +790,16 @@ static const struct acpi_device_id i3c_hci_acpi_match[] = {
> >>> };
> >>> MODULE_DEVICE_TABLE(acpi, i3c_hci_acpi_match);
> >>>
> >>> +static const struct platform_device_id i3c_hci_driver_ids[] = {
> >>> + { .name = "intel-lpss-i3c" },
> >>> + { /* sentinel */ }
> >>> +};
> >>> +MODULE_DEVICE_TABLE(platform, i3c_hci_driver_ids);
> >>> +
> >>> static struct platform_driver i3c_hci_driver = {
> >>> .probe = i3c_hci_probe,
> >>> .remove = i3c_hci_remove,
> >>> + .id_table = i3c_hci_driver_ids,
> >>> .driver = {
> >>> .name = "mipi-i3c-hci",
> >>> .of_match_table = of_match_ptr(i3c_hci_of_match),
> >>> 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 0fd3587671e1..3b319fbf18ce 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,10 +27,10 @@ struct mipi_i3c_hci_pci {
> >>> struct mipi_i3c_hci_pci_info {
> >>> int (*init)(struct mipi_i3c_hci_pci *hci);
> >>> void (*exit)(struct mipi_i3c_hci_pci *hci);
> >>> + const char *name;
> >>> + int id;
> >>> };
> >>>
> >>> -static DEFINE_IDA(mipi_i3c_hci_pci_ida);
> >>> -
> >>> #define INTEL_PRIV_OFFSET 0x2b0
> >>> #define INTEL_PRIV_SIZE 0x28
> >>> #define INTEL_RESETS 0x04
> >>> @@ -179,9 +179,18 @@ static void intel_i3c_exit(struct mipi_i3c_hci_pci *hci)
> >>> intel_ltr_hide(&hci->pci->dev);
> >>> }
> >>>
> >>> -static const struct mipi_i3c_hci_pci_info intel_info = {
> >>> +static const struct mipi_i3c_hci_pci_info intel_1_info = {
> >>> .init = intel_i3c_init,
> >>> .exit = intel_i3c_exit,
> >>> + .name = "intel-lpss-i3c",
> >>> + .id = 0,
> >>> +};
> >>> +
> >>> +static const struct mipi_i3c_hci_pci_info intel_2_info = {
> >>> + .init = intel_i3c_init,
> >>> + .exit = intel_i3c_exit,
> >>> + .name = "intel-lpss-i3c",
> >>> + .id = 2,
> >>> };
> >>>
> >>> static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
> >>> @@ -189,7 +198,7 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
> >>> {
> >>> struct mipi_i3c_hci_pci *hci;
> >>> struct resource res[2];
> >>> - int dev_id, ret;
> >>> + int ret;
> >>>
> >>> hci = devm_kzalloc(&pci->dev, sizeof(*hci), GFP_KERNEL);
> >>> if (!hci)
> >>> @@ -217,11 +226,9 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
> >>> res[1].start = pci_irq_vector(hci->pci, 0);
> >>> res[1].end = res[1].start;
> >>>
> >>> - dev_id = ida_alloc(&mipi_i3c_hci_pci_ida, GFP_KERNEL);
> >>> - if (dev_id < 0)
> >>> - return dev_id;
> >>> + hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
> >>>
> >>> - hci->pdev = platform_device_alloc("mipi-i3c-hci", dev_id);
> >>> + hci->pdev = platform_device_alloc(hci->info->name, hci->info->id);
> >>> if (!hci->pdev)
> >>> return -ENOMEM;
> >>>
> >>> @@ -232,7 +239,6 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
> >>> if (ret)
> >>> goto err;
> >>>
> >>> - hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
> >>> if (hci->info->init) {
> >>> ret = hci->info->init(hci);
> >>> if (ret)
> >>> @@ -252,7 +258,6 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
> >>> hci->info->exit(hci);
> >>> err:
> >>> platform_device_put(hci->pdev);
> >>> - ida_free(&mipi_i3c_hci_pci_ida, dev_id);
> >>> return ret;
> >>> }
> >>>
> >>> @@ -260,28 +265,26 @@ static void mipi_i3c_hci_pci_remove(struct pci_dev *pci)
> >>> {
> >>> struct mipi_i3c_hci_pci *hci = pci_get_drvdata(pci);
> >>> struct platform_device *pdev = hci->pdev;
> >>> - int dev_id = pdev->id;
> >>>
> >>> if (hci->info->exit)
> >>> hci->info->exit(hci);
> >>>
> >>> platform_device_unregister(pdev);
> >>> - ida_free(&mipi_i3c_hci_pci_ida, dev_id);
> >>> }
> >>>
> >>> static const struct pci_device_id mipi_i3c_hci_pci_devices[] = {
> >>> /* Wildcat Lake-U */
> >>> - { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_info},
> >>> - { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_info},
> >>> + { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_1_info},
> >>
> >> If there there are two 0x4d7c pcie cards in system, id will be the same.
> >> Is it okay?
> >
> > These are not cards. These PCI device IDs are unique to each device
> > in the SoC, so duplicate IDs would never happen.
>
> Note, that an id value can also be PLATFORM_DEVID_AUTO or
> PLATFORM_DEVID_NONE, so there is still flexibility.
Thanks
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
> >
> >>
> >> Frank
> >>
> >>> + { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_2_info},
> >>> /* Panther Lake-H */
> >>> - { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_info},
> >>> - { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_info},
> >>> + { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_1_info},
> >>> + { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_2_info},
> >>> /* Panther Lake-P */
> >>> - { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_info},
> >>> - { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_info},
> >>> + { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_1_info},
> >>> + { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_2_info},
> >>> /* Nova Lake-S */
> >>> - { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_info},
> >>> - { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_info},
> >>> + { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_1_info},
> >>> + { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_2_info},
> >>> { },
> >>> };
> >>> MODULE_DEVICE_TABLE(pci, mipi_i3c_hci_pci_devices);
> >>> --
> >>> 2.51.0
> >>>
> >>>
> >>> --
> >>> linux-i3c mailing list
> >>> linux-i3c@lists.infradead.org
> >>> http://lists.infradead.org/mailman/listinfo/linux-i3c
> >
>
>
> --
> linux-i3c mailing list
> linux-i3c@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH V3 07/11] i3c: mipi-i3c-hci: Allow for Multi-Bus Instances
2025-12-16 16:56 [PATCH V3 00/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus Instances for Intel controllers Adrian Hunter
` (5 preceding siblings ...)
2025-12-16 16:56 ` [PATCH V3 06/11] i3c: mipi-i3c-hci-pci: Assign unique device names and IDs for Intel LPSS I3C Adrian Hunter
@ 2025-12-16 16:56 ` Adrian Hunter
2025-12-16 17:10 ` Frank Li
2025-12-16 16:56 ` [PATCH V3 08/11] i3c: mipi-i3c-hci-pci: Pass base regs as platform data to i3c core device Adrian Hunter
` (3 subsequent siblings)
10 siblings, 1 reply; 21+ messages in thread
From: Adrian Hunter @ 2025-12-16 16:56 UTC (permalink / raw)
To: alexandre.belloni; +Cc: Frank.Li, linux-i3c
Add support for MIPI I3C Host Controllers with the Multi-Bus Instance
capability. These controllers can host multiple I3C buses (up to 15)
within a single hardware function (e.g., PCIe B/D/F), providing one
indepedent HCI register set and corresponding I3C bus controller logic
per bus.
A separate platform device will represent each instance, but it is
necessary to allow for shared resources.
Multi-bus instances share the same MMIO address space, but the ranges are
not guaranteed to be contiguous. To avoid overlapping mappings, pass
base_regs from the parent mapping to child devices.
Allow the IRQ to be shared among instances.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
Changes in V3:
Enhance commit message
Changes in V2:
None
drivers/i3c/master/mipi-i3c-hci/core.c | 21 +++++++++++++++++----
include/linux/platform_data/mipi-i3c-hci.h | 15 +++++++++++++++
2 files changed, 32 insertions(+), 4 deletions(-)
create mode 100644 include/linux/platform_data/mipi-i3c-hci.h
diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
index 3d6544a64188..6da5daf18166 100644
--- a/drivers/i3c/master/mipi-i3c-hci/core.c
+++ b/drivers/i3c/master/mipi-i3c-hci/core.c
@@ -14,6 +14,7 @@
#include <linux/interrupt.h>
#include <linux/iopoll.h>
#include <linux/module.h>
+#include <linux/platform_data/mipi-i3c-hci.h>
#include <linux/platform_device.h>
#include "hci.h"
@@ -737,15 +738,27 @@ static int i3c_hci_init(struct i3c_hci *hci)
static int i3c_hci_probe(struct platform_device *pdev)
{
+ const struct mipi_i3c_hci_platform_data *pdata = pdev->dev.platform_data;
struct i3c_hci *hci;
int irq, ret;
hci = devm_kzalloc(&pdev->dev, sizeof(*hci), GFP_KERNEL);
if (!hci)
return -ENOMEM;
- hci->base_regs = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(hci->base_regs))
- return PTR_ERR(hci->base_regs);
+
+ /*
+ * Multi-bus instances share the same MMIO address range, but not
+ * necessarily in separate contiguous sub-ranges. To avoid overlapping
+ * mappings, provide base_regs from the parent mapping.
+ */
+ if (pdata)
+ hci->base_regs = pdata->base_regs;
+
+ if (!hci->base_regs) {
+ hci->base_regs = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(hci->base_regs))
+ return PTR_ERR(hci->base_regs);
+ }
platform_set_drvdata(pdev, hci);
/* temporary for dev_printk's, to be replaced in i3c_master_register */
@@ -759,7 +772,7 @@ static int i3c_hci_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0);
ret = devm_request_irq(&pdev->dev, irq, i3c_hci_irq_handler,
- 0, NULL, hci);
+ IRQF_SHARED, NULL, hci);
if (ret)
return ret;
diff --git a/include/linux/platform_data/mipi-i3c-hci.h b/include/linux/platform_data/mipi-i3c-hci.h
new file mode 100644
index 000000000000..ab7395f455f9
--- /dev/null
+++ b/include/linux/platform_data/mipi-i3c-hci.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef INCLUDE_PLATFORM_DATA_MIPI_I3C_HCI_H
+#define INCLUDE_PLATFORM_DATA_MIPI_I3C_HCI_H
+
+#include <linux/compiler_types.h>
+
+/**
+ * struct mipi_i3c_hci_platform_data - Platform-dependent data for mipi_i3c_hci
+ * @base_regs: Register set base address (to support multi-bus instances)
+ */
+struct mipi_i3c_hci_platform_data {
+ void __iomem *base_regs;
+};
+
+#endif
--
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] 21+ messages in thread* Re: [PATCH V3 07/11] i3c: mipi-i3c-hci: Allow for Multi-Bus Instances
2025-12-16 16:56 ` [PATCH V3 07/11] i3c: mipi-i3c-hci: Allow for Multi-Bus Instances Adrian Hunter
@ 2025-12-16 17:10 ` Frank Li
0 siblings, 0 replies; 21+ messages in thread
From: Frank Li @ 2025-12-16 17:10 UTC (permalink / raw)
To: Adrian Hunter; +Cc: alexandre.belloni, linux-i3c
On Tue, Dec 16, 2025 at 06:56:38PM +0200, Adrian Hunter wrote:
> Add support for MIPI I3C Host Controllers with the Multi-Bus Instance
> capability. These controllers can host multiple I3C buses (up to 15)
> within a single hardware function (e.g., PCIe B/D/F), providing one
> indepedent HCI register set and corresponding I3C bus controller logic
> per bus.
>
> A separate platform device will represent each instance, but it is
> necessary to allow for shared resources.
>
> Multi-bus instances share the same MMIO address space, but the ranges are
> not guaranteed to be contiguous. To avoid overlapping mappings, pass
> base_regs from the parent mapping to child devices.
>
> Allow the IRQ to be shared among instances.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
>
> Changes in V3:
>
> Enhance commit message
>
> Changes in V2:
>
> None
>
>
> drivers/i3c/master/mipi-i3c-hci/core.c | 21 +++++++++++++++++----
> include/linux/platform_data/mipi-i3c-hci.h | 15 +++++++++++++++
> 2 files changed, 32 insertions(+), 4 deletions(-)
> create mode 100644 include/linux/platform_data/mipi-i3c-hci.h
>
> diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
> index 3d6544a64188..6da5daf18166 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/core.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/core.c
> @@ -14,6 +14,7 @@
> #include <linux/interrupt.h>
> #include <linux/iopoll.h>
> #include <linux/module.h>
> +#include <linux/platform_data/mipi-i3c-hci.h>
> #include <linux/platform_device.h>
>
> #include "hci.h"
> @@ -737,15 +738,27 @@ static int i3c_hci_init(struct i3c_hci *hci)
>
> static int i3c_hci_probe(struct platform_device *pdev)
> {
> + const struct mipi_i3c_hci_platform_data *pdata = pdev->dev.platform_data;
> struct i3c_hci *hci;
> int irq, ret;
>
> hci = devm_kzalloc(&pdev->dev, sizeof(*hci), GFP_KERNEL);
> if (!hci)
> return -ENOMEM;
> - hci->base_regs = devm_platform_ioremap_resource(pdev, 0);
> - if (IS_ERR(hci->base_regs))
> - return PTR_ERR(hci->base_regs);
> +
> + /*
> + * Multi-bus instances share the same MMIO address range, but not
> + * necessarily in separate contiguous sub-ranges. To avoid overlapping
> + * mappings, provide base_regs from the parent mapping.
> + */
> + if (pdata)
> + hci->base_regs = pdata->base_regs;
> +
> + if (!hci->base_regs) {
> + hci->base_regs = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(hci->base_regs))
> + return PTR_ERR(hci->base_regs);
> + }
>
> platform_set_drvdata(pdev, hci);
> /* temporary for dev_printk's, to be replaced in i3c_master_register */
> @@ -759,7 +772,7 @@ static int i3c_hci_probe(struct platform_device *pdev)
>
> irq = platform_get_irq(pdev, 0);
> ret = devm_request_irq(&pdev->dev, irq, i3c_hci_irq_handler,
> - 0, NULL, hci);
> + IRQF_SHARED, NULL, hci);
> if (ret)
> return ret;
>
> diff --git a/include/linux/platform_data/mipi-i3c-hci.h b/include/linux/platform_data/mipi-i3c-hci.h
> new file mode 100644
> index 000000000000..ab7395f455f9
> --- /dev/null
> +++ b/include/linux/platform_data/mipi-i3c-hci.h
> @@ -0,0 +1,15 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef INCLUDE_PLATFORM_DATA_MIPI_I3C_HCI_H
> +#define INCLUDE_PLATFORM_DATA_MIPI_I3C_HCI_H
> +
> +#include <linux/compiler_types.h>
> +
> +/**
> + * struct mipi_i3c_hci_platform_data - Platform-dependent data for mipi_i3c_hci
> + * @base_regs: Register set base address (to support multi-bus instances)
> + */
> +struct mipi_i3c_hci_platform_data {
> + void __iomem *base_regs;
> +};
> +
> +#endif
> --
> 2.51.0
>
>
> --
> linux-i3c mailing list
> linux-i3c@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH V3 08/11] i3c: mipi-i3c-hci-pci: Pass base regs as platform data to i3c core device
2025-12-16 16:56 [PATCH V3 00/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus Instances for Intel controllers Adrian Hunter
` (6 preceding siblings ...)
2025-12-16 16:56 ` [PATCH V3 07/11] i3c: mipi-i3c-hci: Allow for Multi-Bus Instances Adrian Hunter
@ 2025-12-16 16:56 ` Adrian Hunter
2025-12-16 17:12 ` Frank Li
2025-12-16 16:56 ` [PATCH V3 09/11] i3c: mipi-i3c-hci-pci: Convert to MFD driver Adrian Hunter
` (2 subsequent siblings)
10 siblings, 1 reply; 21+ messages in thread
From: Adrian Hunter @ 2025-12-16 16:56 UTC (permalink / raw)
To: alexandre.belloni; +Cc: Frank.Li, linux-i3c
Use the parent's MMIO mapping for multi-bus instances to avoid overlapping
regions. These instances share the same MMIO address space, but the ranges
are not guaranteed to be contiguous. By passing base_regs from the parent
mapping, child devices can access their registers without creating
conflicting mappings.
Prepare for multi-bus instance support by passing base_regs to child
devices.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
Changes in V3:
Enhance commit message
Changes in V2:
New patch split from "i3c: mipi-i3c-hci-pci: Add support for
Multi-Bus Instances"
.../master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 39 ++++++++++---------
1 file changed, 20 insertions(+), 19 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 3b319fbf18ce..ca562a5634e8 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,12 +14,14 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
+#include <linux/platform_data/mipi-i3c-hci.h>
#include <linux/platform_device.h>
#include <linux/pm_qos.h>
struct mipi_i3c_hci_pci {
struct pci_dev *pci;
struct platform_device *pdev;
+ void __iomem *base;
const struct mipi_i3c_hci_pci_info *info;
void *private;
};
@@ -32,7 +34,6 @@ struct mipi_i3c_hci_pci_info {
};
#define INTEL_PRIV_OFFSET 0x2b0
-#define INTEL_PRIV_SIZE 0x28
#define INTEL_RESETS 0x04
#define INTEL_RESETS_RESET BIT(0)
#define INTEL_RESETS_RESET_DONE BIT(1)
@@ -143,19 +144,12 @@ static void intel_reset(void __iomem *priv)
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);
-
- return devm_ioremap(&pci->dev, base + INTEL_PRIV_OFFSET, INTEL_PRIV_SIZE);
-}
-
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);
+ void __iomem *priv = hci->base + INTEL_PRIV_OFFSET;
- if (!host || !priv)
+ if (!host)
return -ENOMEM;
dma_set_mask_and_coherent(&hci->pci->dev, DMA_BIT_MASK(64));
@@ -196,8 +190,9 @@ static const struct mipi_i3c_hci_pci_info intel_2_info = {
static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
+ struct mipi_i3c_hci_platform_data pdata = {};
struct mipi_i3c_hci_pci *hci;
- struct resource res[2];
+ struct resource res;
int ret;
hci = devm_kzalloc(&pci->dev, sizeof(*hci), GFP_KERNEL);
@@ -212,19 +207,19 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
pci_set_master(pci);
+ hci->base = pcim_iomap_region(pci, 0, pci_name(pci));
+ if (IS_ERR(hci->base))
+ return PTR_ERR(hci->base);
+
ret = pci_alloc_irq_vectors(pci, 1, 1, PCI_IRQ_ALL_TYPES);
if (ret < 0)
return ret;
memset(&res, 0, sizeof(res));
- res[0].flags = IORESOURCE_MEM;
- res[0].start = pci_resource_start(pci, 0);
- res[0].end = pci_resource_end(pci, 0);
-
- res[1].flags = IORESOURCE_IRQ;
- res[1].start = pci_irq_vector(hci->pci, 0);
- res[1].end = res[1].start;
+ res.flags = IORESOURCE_IRQ;
+ res.start = pci_irq_vector(hci->pci, 0);
+ res.end = res.start;
hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
@@ -235,7 +230,13 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
hci->pdev->dev.parent = &pci->dev;
device_set_node(&hci->pdev->dev, dev_fwnode(&pci->dev));
- ret = platform_device_add_resources(hci->pdev, res, ARRAY_SIZE(res));
+ ret = platform_device_add_resources(hci->pdev, &res, 1);
+ if (ret)
+ goto err;
+
+ pdata.base_regs = hci->base;
+
+ ret = platform_device_add_data(hci->pdev, &pdata, sizeof(pdata));
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] 21+ messages in thread* Re: [PATCH V3 08/11] i3c: mipi-i3c-hci-pci: Pass base regs as platform data to i3c core device
2025-12-16 16:56 ` [PATCH V3 08/11] i3c: mipi-i3c-hci-pci: Pass base regs as platform data to i3c core device Adrian Hunter
@ 2025-12-16 17:12 ` Frank Li
0 siblings, 0 replies; 21+ messages in thread
From: Frank Li @ 2025-12-16 17:12 UTC (permalink / raw)
To: Adrian Hunter; +Cc: alexandre.belloni, linux-i3c
On Tue, Dec 16, 2025 at 06:56:39PM +0200, Adrian Hunter wrote:
> Use the parent's MMIO mapping for multi-bus instances to avoid overlapping
> regions. These instances share the same MMIO address space, but the ranges
> are not guaranteed to be contiguous. By passing base_regs from the parent
> mapping, child devices can access their registers without creating
> conflicting mappings.
>
> Prepare for multi-bus instance support by passing base_regs to child
> devices.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
>
> Changes in V3:
>
> Enhance commit message
>
> Changes in V2:
> New patch split from "i3c: mipi-i3c-hci-pci: Add support for
> Multi-Bus Instances"
>
>
> .../master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 39 ++++++++++---------
> 1 file changed, 20 insertions(+), 19 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 3b319fbf18ce..ca562a5634e8 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,12 +14,14 @@
> #include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/pci.h>
> +#include <linux/platform_data/mipi-i3c-hci.h>
> #include <linux/platform_device.h>
> #include <linux/pm_qos.h>
>
> struct mipi_i3c_hci_pci {
> struct pci_dev *pci;
> struct platform_device *pdev;
> + void __iomem *base;
> const struct mipi_i3c_hci_pci_info *info;
> void *private;
> };
> @@ -32,7 +34,6 @@ struct mipi_i3c_hci_pci_info {
> };
>
> #define INTEL_PRIV_OFFSET 0x2b0
> -#define INTEL_PRIV_SIZE 0x28
> #define INTEL_RESETS 0x04
> #define INTEL_RESETS_RESET BIT(0)
> #define INTEL_RESETS_RESET_DONE BIT(1)
> @@ -143,19 +144,12 @@ static void intel_reset(void __iomem *priv)
> 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);
> -
> - return devm_ioremap(&pci->dev, base + INTEL_PRIV_OFFSET, INTEL_PRIV_SIZE);
> -}
> -
> 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);
> + void __iomem *priv = hci->base + INTEL_PRIV_OFFSET;
>
> - if (!host || !priv)
> + if (!host)
> return -ENOMEM;
>
> dma_set_mask_and_coherent(&hci->pci->dev, DMA_BIT_MASK(64));
> @@ -196,8 +190,9 @@ static const struct mipi_i3c_hci_pci_info intel_2_info = {
> static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
> const struct pci_device_id *id)
> {
> + struct mipi_i3c_hci_platform_data pdata = {};
> struct mipi_i3c_hci_pci *hci;
> - struct resource res[2];
> + struct resource res;
> int ret;
>
> hci = devm_kzalloc(&pci->dev, sizeof(*hci), GFP_KERNEL);
> @@ -212,19 +207,19 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>
> pci_set_master(pci);
>
> + hci->base = pcim_iomap_region(pci, 0, pci_name(pci));
> + if (IS_ERR(hci->base))
> + return PTR_ERR(hci->base);
> +
> ret = pci_alloc_irq_vectors(pci, 1, 1, PCI_IRQ_ALL_TYPES);
> if (ret < 0)
> return ret;
>
> memset(&res, 0, sizeof(res));
>
> - res[0].flags = IORESOURCE_MEM;
> - res[0].start = pci_resource_start(pci, 0);
> - res[0].end = pci_resource_end(pci, 0);
> -
> - res[1].flags = IORESOURCE_IRQ;
> - res[1].start = pci_irq_vector(hci->pci, 0);
> - res[1].end = res[1].start;
> + res.flags = IORESOURCE_IRQ;
> + res.start = pci_irq_vector(hci->pci, 0);
> + res.end = res.start;
>
> hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
>
> @@ -235,7 +230,13 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
> hci->pdev->dev.parent = &pci->dev;
> device_set_node(&hci->pdev->dev, dev_fwnode(&pci->dev));
>
> - ret = platform_device_add_resources(hci->pdev, res, ARRAY_SIZE(res));
> + ret = platform_device_add_resources(hci->pdev, &res, 1);
> + if (ret)
> + goto err;
> +
> + pdata.base_regs = hci->base;
> +
> + ret = platform_device_add_data(hci->pdev, &pdata, sizeof(pdata));
> if (ret)
> goto err;
>
> --
> 2.51.0
>
>
> --
> linux-i3c mailing list
> linux-i3c@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH V3 09/11] i3c: mipi-i3c-hci-pci: Convert to MFD driver
2025-12-16 16:56 [PATCH V3 00/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus Instances for Intel controllers Adrian Hunter
` (7 preceding siblings ...)
2025-12-16 16:56 ` [PATCH V3 08/11] i3c: mipi-i3c-hci-pci: Pass base regs as platform data to i3c core device Adrian Hunter
@ 2025-12-16 16:56 ` Adrian Hunter
2025-12-16 16:56 ` [PATCH V3 10/11] i3c: mipi-i3c-hci-pci: Add support for Multi-Bus Instances Adrian Hunter
2025-12-16 16:56 ` [PATCH V3 11/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus instances for supported controllers Adrian Hunter
10 siblings, 0 replies; 21+ messages in thread
From: Adrian Hunter @ 2025-12-16 16:56 UTC (permalink / raw)
To: alexandre.belloni; +Cc: Frank.Li, linux-i3c
Prepare for Multi-Bus instance support. Convert to MFD driver but still
support only 1 instance.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
Changes in V3:
Add Frank's Rev'd-by
Adjust for doing away with dynamic devid allocation
Changes in V2:
New patch split from "i3c: mipi-i3c-hci-pci: Add support for
Multi-Bus Instances"
drivers/i3c/master/Kconfig | 1 +
.../master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 75 ++++++++++---------
2 files changed, 41 insertions(+), 35 deletions(-)
diff --git a/drivers/i3c/master/Kconfig b/drivers/i3c/master/Kconfig
index 82cf330778d5..2609f2b18e0a 100644
--- a/drivers/i3c/master/Kconfig
+++ b/drivers/i3c/master/Kconfig
@@ -69,6 +69,7 @@ config MIPI_I3C_HCI_PCI
tristate "MIPI I3C Host Controller Interface PCI support"
depends on MIPI_I3C_HCI
depends on PCI
+ select MFD_CORE
help
Support for MIPI I3C Host Controller Interface compatible hardware
on the PCI bus.
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 ca562a5634e8..7ef17255c312 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
@@ -12,6 +12,7 @@
#include <linux/idr.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
+#include <linux/mfd/core.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/platform_data/mipi-i3c-hci.h>
@@ -20,7 +21,6 @@
struct mipi_i3c_hci_pci {
struct pci_dev *pci;
- struct platform_device *pdev;
void __iomem *base;
const struct mipi_i3c_hci_pci_info *info;
void *private;
@@ -187,12 +187,45 @@ static const struct mipi_i3c_hci_pci_info intel_2_info = {
.id = 2,
};
+struct mipi_i3c_hci_pci_cell_data {
+ struct mipi_i3c_hci_platform_data pdata;
+ struct resource res;
+};
+
+static void mipi_i3c_hci_pci_setup_cell(struct mipi_i3c_hci_pci *hci,
+ struct mipi_i3c_hci_pci_cell_data *data,
+ struct mfd_cell *cell)
+{
+ data->pdata.base_regs = hci->base;
+
+ data->res = DEFINE_RES_IRQ(0);
+
+ cell->name = hci->info->name;
+ cell->id = hci->info->id;
+ cell->platform_data = &data->pdata;
+ cell->pdata_size = sizeof(data->pdata);
+ cell->num_resources = 1;
+ cell->resources = &data->res;
+}
+
+static int mipi_i3c_hci_pci_add_instances(struct mipi_i3c_hci_pci *hci)
+{
+ struct mipi_i3c_hci_pci_cell_data *data __free(kfree) = kzalloc(sizeof(*data), GFP_KERNEL);
+ struct mfd_cell *cells __free(kfree) = kzalloc(sizeof(*cells), GFP_KERNEL);
+ int irq = pci_irq_vector(hci->pci, 0);
+
+ if (!cells || !data)
+ return -ENOMEM;
+
+ mipi_i3c_hci_pci_setup_cell(hci, data, cells);
+
+ return mfd_add_devices(&hci->pci->dev, 0, cells, 1, NULL, irq, NULL);
+}
+
static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- struct mipi_i3c_hci_platform_data pdata = {};
struct mipi_i3c_hci_pci *hci;
- struct resource res;
int ret;
hci = devm_kzalloc(&pci->dev, sizeof(*hci), GFP_KERNEL);
@@ -215,38 +248,13 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
if (ret < 0)
return ret;
- memset(&res, 0, sizeof(res));
-
- res.flags = IORESOURCE_IRQ;
- res.start = pci_irq_vector(hci->pci, 0);
- res.end = res.start;
-
hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
- hci->pdev = platform_device_alloc(hci->info->name, hci->info->id);
- if (!hci->pdev)
- return -ENOMEM;
-
- hci->pdev->dev.parent = &pci->dev;
- device_set_node(&hci->pdev->dev, dev_fwnode(&pci->dev));
-
- ret = platform_device_add_resources(hci->pdev, &res, 1);
+ ret = hci->info->init ? hci->info->init(hci) : 0;
if (ret)
- goto err;
-
- pdata.base_regs = hci->base;
-
- ret = platform_device_add_data(hci->pdev, &pdata, sizeof(pdata));
- if (ret)
- goto err;
-
- if (hci->info->init) {
- ret = hci->info->init(hci);
- if (ret)
- goto err;
- }
+ return ret;
- ret = platform_device_add(hci->pdev);
+ ret = mipi_i3c_hci_pci_add_instances(hci);
if (ret)
goto err_exit;
@@ -257,20 +265,17 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
err_exit:
if (hci->info->exit)
hci->info->exit(hci);
-err:
- platform_device_put(hci->pdev);
return ret;
}
static void mipi_i3c_hci_pci_remove(struct pci_dev *pci)
{
struct mipi_i3c_hci_pci *hci = pci_get_drvdata(pci);
- struct platform_device *pdev = hci->pdev;
if (hci->info->exit)
hci->info->exit(hci);
- platform_device_unregister(pdev);
+ mfd_remove_devices(&pci->dev);
}
static const struct pci_device_id mipi_i3c_hci_pci_devices[] = {
--
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] 21+ messages in thread* [PATCH V3 10/11] i3c: mipi-i3c-hci-pci: Add support for Multi-Bus Instances
2025-12-16 16:56 [PATCH V3 00/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus Instances for Intel controllers Adrian Hunter
` (8 preceding siblings ...)
2025-12-16 16:56 ` [PATCH V3 09/11] i3c: mipi-i3c-hci-pci: Convert to MFD driver Adrian Hunter
@ 2025-12-16 16:56 ` Adrian Hunter
2025-12-16 17:16 ` Frank Li
2025-12-16 16:56 ` [PATCH V3 11/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus instances for supported controllers Adrian Hunter
10 siblings, 1 reply; 21+ messages in thread
From: Adrian Hunter @ 2025-12-16 16:56 UTC (permalink / raw)
To: alexandre.belloni; +Cc: Frank.Li, linux-i3c
Add support for MIPI I3C Host Controllers with the Multi-Bus Instance
capability. These controllers can host multiple I3C buses (up to 15)
within a single hardware function (e.g., PCIe B/D/F), providing one
indepedent HCI register set and corresponding I3C bus controller logic
per bus.
Create an MFD cell for each instance and use platform_data to pass the
starting address of the instance's register set.
The MIPI I3C HCI specification defines an Extended Capability that holds
the offset of each instance register set. Parsing this information is
relatively complex, so include the offsets in driver data for now.
Driver data for additional instances beyond instance 0 will be added in a
subsequent patch.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
Changes in V3:
Make hci a parameter of mipi_i3c_hci_pci_alloc()
Adjust for doing away with dynamic devid allocation
Enhance commit message
Changes in V2:
Conversion to MFD split into separate patch
Simplify ID allocation / free
Correct use of __free()
Also define instance 0 in driver_data
.../master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 36 +++++++++++++------
1 file changed, 26 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 7ef17255c312..782f46989423 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
@@ -19,6 +19,12 @@
#include <linux/platform_device.h>
#include <linux/pm_qos.h>
+/*
+ * There can up to 15 instances, but implementations have at most 2 at this
+ * time.
+ */
+#define INST_MAX 2
+
struct mipi_i3c_hci_pci {
struct pci_dev *pci;
void __iomem *base;
@@ -30,7 +36,9 @@ struct mipi_i3c_hci_pci_info {
int (*init)(struct mipi_i3c_hci_pci *hci);
void (*exit)(struct mipi_i3c_hci_pci *hci);
const char *name;
- int id;
+ int id[INST_MAX];
+ u32 instance_offset[INST_MAX];
+ int instance_count;
};
#define INTEL_PRIV_OFFSET 0x2b0
@@ -177,14 +185,18 @@ static const struct mipi_i3c_hci_pci_info intel_1_info = {
.init = intel_i3c_init,
.exit = intel_i3c_exit,
.name = "intel-lpss-i3c",
- .id = 0,
+ .id = {0},
+ .instance_offset = {0},
+ .instance_count = 1,
};
static const struct mipi_i3c_hci_pci_info intel_2_info = {
.init = intel_i3c_init,
.exit = intel_i3c_exit,
.name = "intel-lpss-i3c",
- .id = 2,
+ .id = {2},
+ .instance_offset = {0},
+ .instance_count = 1,
};
struct mipi_i3c_hci_pci_cell_data {
@@ -192,34 +204,38 @@ struct mipi_i3c_hci_pci_cell_data {
struct resource res;
};
-static void mipi_i3c_hci_pci_setup_cell(struct mipi_i3c_hci_pci *hci,
+static void mipi_i3c_hci_pci_setup_cell(struct mipi_i3c_hci_pci *hci, int idx,
struct mipi_i3c_hci_pci_cell_data *data,
struct mfd_cell *cell)
{
- data->pdata.base_regs = hci->base;
+ data->pdata.base_regs = hci->base + hci->info->instance_offset[idx];
data->res = DEFINE_RES_IRQ(0);
cell->name = hci->info->name;
- cell->id = hci->info->id;
+ cell->id = hci->info->id[idx];
cell->platform_data = &data->pdata;
cell->pdata_size = sizeof(data->pdata);
cell->num_resources = 1;
cell->resources = &data->res;
}
+#define mipi_i3c_hci_pci_alloc(h, x) kcalloc((h)->info->instance_count, sizeof(*(x)), GFP_KERNEL)
+
static int mipi_i3c_hci_pci_add_instances(struct mipi_i3c_hci_pci *hci)
{
- struct mipi_i3c_hci_pci_cell_data *data __free(kfree) = kzalloc(sizeof(*data), GFP_KERNEL);
- struct mfd_cell *cells __free(kfree) = kzalloc(sizeof(*cells), GFP_KERNEL);
+ struct mipi_i3c_hci_pci_cell_data *data __free(kfree) = mipi_i3c_hci_pci_alloc(hci, data);
+ struct mfd_cell *cells __free(kfree) = mipi_i3c_hci_pci_alloc(hci, cells);
int irq = pci_irq_vector(hci->pci, 0);
+ int nr = hci->info->instance_count;
if (!cells || !data)
return -ENOMEM;
- mipi_i3c_hci_pci_setup_cell(hci, data, cells);
+ for (int i = 0; i < nr; i++)
+ mipi_i3c_hci_pci_setup_cell(hci, i, data + i, cells + i);
- return mfd_add_devices(&hci->pci->dev, 0, cells, 1, NULL, irq, NULL);
+ return mfd_add_devices(&hci->pci->dev, 0, cells, nr, NULL, irq, NULL);
}
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] 21+ messages in thread* Re: [PATCH V3 10/11] i3c: mipi-i3c-hci-pci: Add support for Multi-Bus Instances
2025-12-16 16:56 ` [PATCH V3 10/11] i3c: mipi-i3c-hci-pci: Add support for Multi-Bus Instances Adrian Hunter
@ 2025-12-16 17:16 ` Frank Li
0 siblings, 0 replies; 21+ messages in thread
From: Frank Li @ 2025-12-16 17:16 UTC (permalink / raw)
To: Adrian Hunter; +Cc: alexandre.belloni, linux-i3c
On Tue, Dec 16, 2025 at 06:56:41PM +0200, Adrian Hunter wrote:
> Add support for MIPI I3C Host Controllers with the Multi-Bus Instance
> capability. These controllers can host multiple I3C buses (up to 15)
> within a single hardware function (e.g., PCIe B/D/F), providing one
> indepedent HCI register set and corresponding I3C bus controller logic
> per bus.
>
> Create an MFD cell for each instance and use platform_data to pass the
> starting address of the instance's register set.
>
> The MIPI I3C HCI specification defines an Extended Capability that holds
> the offset of each instance register set. Parsing this information is
> relatively complex, so include the offsets in driver data for now.
>
> Driver data for additional instances beyond instance 0 will be added in a
> subsequent patch.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
>
> Changes in V3:
>
> Make hci a parameter of mipi_i3c_hci_pci_alloc()
> Adjust for doing away with dynamic devid allocation
> Enhance commit message
>
> Changes in V2:
> Conversion to MFD split into separate patch
> Simplify ID allocation / free
> Correct use of __free()
> Also define instance 0 in driver_data
>
>
> .../master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 36 +++++++++++++------
> 1 file changed, 26 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 7ef17255c312..782f46989423 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
> @@ -19,6 +19,12 @@
> #include <linux/platform_device.h>
> #include <linux/pm_qos.h>
>
> +/*
> + * There can up to 15 instances, but implementations have at most 2 at this
> + * time.
> + */
> +#define INST_MAX 2
> +
> struct mipi_i3c_hci_pci {
> struct pci_dev *pci;
> void __iomem *base;
> @@ -30,7 +36,9 @@ struct mipi_i3c_hci_pci_info {
> int (*init)(struct mipi_i3c_hci_pci *hci);
> void (*exit)(struct mipi_i3c_hci_pci *hci);
> const char *name;
> - int id;
> + int id[INST_MAX];
> + u32 instance_offset[INST_MAX];
> + int instance_count;
> };
>
> #define INTEL_PRIV_OFFSET 0x2b0
> @@ -177,14 +185,18 @@ static const struct mipi_i3c_hci_pci_info intel_1_info = {
> .init = intel_i3c_init,
> .exit = intel_i3c_exit,
> .name = "intel-lpss-i3c",
> - .id = 0,
> + .id = {0},
> + .instance_offset = {0},
> + .instance_count = 1,
> };
>
> static const struct mipi_i3c_hci_pci_info intel_2_info = {
> .init = intel_i3c_init,
> .exit = intel_i3c_exit,
> .name = "intel-lpss-i3c",
> - .id = 2,
> + .id = {2},
> + .instance_offset = {0},
> + .instance_count = 1,
> };
>
> struct mipi_i3c_hci_pci_cell_data {
> @@ -192,34 +204,38 @@ struct mipi_i3c_hci_pci_cell_data {
> struct resource res;
> };
>
> -static void mipi_i3c_hci_pci_setup_cell(struct mipi_i3c_hci_pci *hci,
> +static void mipi_i3c_hci_pci_setup_cell(struct mipi_i3c_hci_pci *hci, int idx,
> struct mipi_i3c_hci_pci_cell_data *data,
> struct mfd_cell *cell)
> {
> - data->pdata.base_regs = hci->base;
> + data->pdata.base_regs = hci->base + hci->info->instance_offset[idx];
>
> data->res = DEFINE_RES_IRQ(0);
>
> cell->name = hci->info->name;
> - cell->id = hci->info->id;
> + cell->id = hci->info->id[idx];
> cell->platform_data = &data->pdata;
> cell->pdata_size = sizeof(data->pdata);
> cell->num_resources = 1;
> cell->resources = &data->res;
> }
>
> +#define mipi_i3c_hci_pci_alloc(h, x) kcalloc((h)->info->instance_count, sizeof(*(x)), GFP_KERNEL)
> +
> static int mipi_i3c_hci_pci_add_instances(struct mipi_i3c_hci_pci *hci)
> {
> - struct mipi_i3c_hci_pci_cell_data *data __free(kfree) = kzalloc(sizeof(*data), GFP_KERNEL);
> - struct mfd_cell *cells __free(kfree) = kzalloc(sizeof(*cells), GFP_KERNEL);
> + struct mipi_i3c_hci_pci_cell_data *data __free(kfree) = mipi_i3c_hci_pci_alloc(hci, data);
> + struct mfd_cell *cells __free(kfree) = mipi_i3c_hci_pci_alloc(hci, cells);
> int irq = pci_irq_vector(hci->pci, 0);
> + int nr = hci->info->instance_count;
>
> if (!cells || !data)
> return -ENOMEM;
>
> - mipi_i3c_hci_pci_setup_cell(hci, data, cells);
> + for (int i = 0; i < nr; i++)
> + mipi_i3c_hci_pci_setup_cell(hci, i, data + i, cells + i);
>
> - return mfd_add_devices(&hci->pci->dev, 0, cells, 1, NULL, irq, NULL);
> + return mfd_add_devices(&hci->pci->dev, 0, cells, nr, NULL, irq, NULL);
> }
>
> 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
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH V3 11/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus instances for supported controllers
2025-12-16 16:56 [PATCH V3 00/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus Instances for Intel controllers Adrian Hunter
` (9 preceding siblings ...)
2025-12-16 16:56 ` [PATCH V3 10/11] i3c: mipi-i3c-hci-pci: Add support for Multi-Bus Instances Adrian Hunter
@ 2025-12-16 16:56 ` Adrian Hunter
2025-12-16 17:18 ` Frank Li
10 siblings, 1 reply; 21+ messages in thread
From: Adrian Hunter @ 2025-12-16 16:56 UTC (permalink / raw)
To: alexandre.belloni; +Cc: Frank.Li, linux-i3c
Define Multi-Bus Instances at offset 0x400 for Intel controllers.
Intel SoCs include two I3C PCI devices in the Low Power Subsystem (LPSS),
each capable of hosting two I3C buses. Panther Lake and Wildcat Lake
support three buses in total (IDs 0–2), while Nova Lake supports four
(IDs 0–3).
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
Changes in V3:
Adjust for doing away with dynamic devid allocation
Changes in V2:
Also define instance 0 in driver_data
.../master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 35 ++++++++++++-------
1 file changed, 22 insertions(+), 13 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 782f46989423..458f871a2e61 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
@@ -181,16 +181,25 @@ static void intel_i3c_exit(struct mipi_i3c_hci_pci *hci)
intel_ltr_hide(&hci->pci->dev);
}
-static const struct mipi_i3c_hci_pci_info intel_1_info = {
+static const struct mipi_i3c_hci_pci_info intel_mi_1_info = {
.init = intel_i3c_init,
.exit = intel_i3c_exit,
.name = "intel-lpss-i3c",
- .id = {0},
- .instance_offset = {0},
- .instance_count = 1,
+ .id = {0, 1},
+ .instance_offset = {0, 0x400},
+ .instance_count = 2,
+};
+
+static const struct mipi_i3c_hci_pci_info intel_mi_2_info = {
+ .init = intel_i3c_init,
+ .exit = intel_i3c_exit,
+ .name = "intel-lpss-i3c",
+ .id = {2, 3},
+ .instance_offset = {0, 0x400},
+ .instance_count = 2,
};
-static const struct mipi_i3c_hci_pci_info intel_2_info = {
+static const struct mipi_i3c_hci_pci_info intel_si_2_info = {
.init = intel_i3c_init,
.exit = intel_i3c_exit,
.name = "intel-lpss-i3c",
@@ -296,17 +305,17 @@ static void mipi_i3c_hci_pci_remove(struct pci_dev *pci)
static const struct pci_device_id mipi_i3c_hci_pci_devices[] = {
/* Wildcat Lake-U */
- { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_1_info},
- { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_2_info},
+ { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_mi_1_info},
+ { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_si_2_info},
/* Panther Lake-H */
- { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_1_info},
- { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_2_info},
+ { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_mi_1_info},
+ { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_si_2_info},
/* Panther Lake-P */
- { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_1_info},
- { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_2_info},
+ { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_mi_1_info},
+ { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_si_2_info},
/* Nova Lake-S */
- { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_1_info},
- { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_2_info},
+ { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_mi_1_info},
+ { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_mi_2_info},
{ },
};
MODULE_DEVICE_TABLE(pci, mipi_i3c_hci_pci_devices);
--
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] 21+ messages in thread* Re: [PATCH V3 11/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus instances for supported controllers
2025-12-16 16:56 ` [PATCH V3 11/11] i3c: mipi-i3c-hci-pci: Define Multi-Bus instances for supported controllers Adrian Hunter
@ 2025-12-16 17:18 ` Frank Li
0 siblings, 0 replies; 21+ messages in thread
From: Frank Li @ 2025-12-16 17:18 UTC (permalink / raw)
To: Adrian Hunter; +Cc: alexandre.belloni, linux-i3c
On Tue, Dec 16, 2025 at 06:56:42PM +0200, Adrian Hunter wrote:
> Define Multi-Bus Instances at offset 0x400 for Intel controllers.
>
> Intel SoCs include two I3C PCI devices in the Low Power Subsystem (LPSS),
> each capable of hosting two I3C buses. Panther Lake and Wildcat Lake
> support three buses in total (IDs 0–2), while Nova Lake supports four
> (IDs 0–3).
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
>
> Changes in V3:
>
> Adjust for doing away with dynamic devid allocation
>
> Changes in V2:
>
> Also define instance 0 in driver_data
>
>
> .../master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 35 ++++++++++++-------
> 1 file changed, 22 insertions(+), 13 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 782f46989423..458f871a2e61 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
> @@ -181,16 +181,25 @@ static void intel_i3c_exit(struct mipi_i3c_hci_pci *hci)
> intel_ltr_hide(&hci->pci->dev);
> }
>
> -static const struct mipi_i3c_hci_pci_info intel_1_info = {
> +static const struct mipi_i3c_hci_pci_info intel_mi_1_info = {
> .init = intel_i3c_init,
> .exit = intel_i3c_exit,
> .name = "intel-lpss-i3c",
> - .id = {0},
> - .instance_offset = {0},
> - .instance_count = 1,
> + .id = {0, 1},
> + .instance_offset = {0, 0x400},
> + .instance_count = 2,
> +};
> +
> +static const struct mipi_i3c_hci_pci_info intel_mi_2_info = {
> + .init = intel_i3c_init,
> + .exit = intel_i3c_exit,
> + .name = "intel-lpss-i3c",
> + .id = {2, 3},
> + .instance_offset = {0, 0x400},
> + .instance_count = 2,
> };
>
> -static const struct mipi_i3c_hci_pci_info intel_2_info = {
> +static const struct mipi_i3c_hci_pci_info intel_si_2_info = {
> .init = intel_i3c_init,
> .exit = intel_i3c_exit,
> .name = "intel-lpss-i3c",
> @@ -296,17 +305,17 @@ static void mipi_i3c_hci_pci_remove(struct pci_dev *pci)
>
> static const struct pci_device_id mipi_i3c_hci_pci_devices[] = {
> /* Wildcat Lake-U */
> - { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_1_info},
> - { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_2_info},
> + { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_mi_1_info},
> + { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_si_2_info},
> /* Panther Lake-H */
> - { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_1_info},
> - { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_2_info},
> + { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_mi_1_info},
> + { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_si_2_info},
> /* Panther Lake-P */
> - { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_1_info},
> - { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_2_info},
> + { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_mi_1_info},
> + { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_si_2_info},
> /* Nova Lake-S */
> - { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_1_info},
> - { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_2_info},
> + { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_mi_1_info},
> + { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_mi_2_info},
> { },
> };
> MODULE_DEVICE_TABLE(pci, mipi_i3c_hci_pci_devices);
> --
> 2.51.0
>
>
> --
> linux-i3c mailing list
> linux-i3c@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 21+ messages in thread