Skip to contentSkip to conversation

Add microchip sama7d65 SoC I3C support

PATCH In review Durai Manickam KR 5 participants 11 messages Sep 18, 2025 – Sep 25, 2025

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

cover Add microchip sama7d65 SoC I3C support

Add support for microchip sama7d65 SoC I3C master only IP which is based on mipi-i3c-hci from synopsys implementing version 1.0 specification. The platform specific changes are integrated in the existing mipi-i3c-hci driver by introducing a quirk and SoC specific config option.

I3C in master mode supports up to 12.5MHz, SDR mode data transfer in mixed bus mode (I2C and I3C target devices on same i3c bus).

Testing done:
With this patch we are able to fully configure the lsm6dso I3C slave device. Unlike I2C, I hope there is no linux utility to check the various transactions supported in the host controller. These features will be tested later probably with I3C analyser KIT.

Durai Manickam KR (4):
clk: at91: sama7d65: add peripheral clock for I3C
i3c: mipi-i3c-hci: add microchip sama7d65 SoC
ARM: configs: at91: sama7: add sama7d65 i3c-hci
ARM: dts: microchip: add I3C controller

 arch/arm/boot/dts/microchip/sama7d65.dtsi     | 12 ++++++
 arch/arm/configs/sama7_defconfig              |  2 +
 drivers/clk/at91/sama7d65.c                   |  5 ++-
 drivers/i3c/master/mipi-i3c-hci/Makefile      |  3 +-
 drivers/i3c/master/mipi-i3c-hci/core.c        | 28 ++++++++++++
 drivers/i3c/master/mipi-i3c-hci/hci.h         | 12 ++++++
 .../i3c/master/mipi-i3c-hci/hci_quirks_mchp.c | 43 +++++++++++++++++++
 7 files changed, 102 insertions(+), 3 deletions(-)
 create mode 100644 drivers/i3c/master/mipi-i3c-hci/hci_quirks_mchp.c
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/4 clk: at91: sama7d65: add peripheral clock for I3C

Add peripheral clock description for I3C.

---
 drivers/clk/at91/sama7d65.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/at91/sama7d65.c +3 -2
index a5d40df8b2f2..84c6bbe20873 100644
@@ -671,8 +671,9 @@ static struct {
 	{ .n = "udphsa_clk",	.p = PCK_PARENT_HW_MCK5, .id = 99, },
 	{ .n = "udphsb_clk",	.p = PCK_PARENT_HW_MCK5, .id = 100, },
 	{ .n = "uhphs_clk",	.p = PCK_PARENT_HW_MCK5, .id = 101, },
-	{ .n = "dsi_clk",	.p = PCK_PARENT_HW_MCK3, .id = 103, },
-	{ .n = "lvdsc_clk",	.p = PCK_PARENT_HW_MCK3, .id = 104, },
+	{ .n = "dsi_clk",       .p = PCK_PARENT_HW_MCK3, .id = 103, },
+	{ .n = "lvdsc_clk",     .p = PCK_PARENT_HW_MCK3, .id = 104, },
+	{ .n = "i3cc_clk",      .p = PCK_PARENT_HW_MCK8, .id = 105, },
 };
 
 /*
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/4 i3c: mipi-i3c-hci: add microchip sama7d65 SoC

In reply to Durai Manickam KR

Add support for microchip sama7d65 SoC I3C HCI master only IP. Features tested and supported :
Standard CCC commands.
I3C SDR mode private transfers in PIO mode. I2C transfers in PIO mode.
Pure bus mode and mixed bus mode.

---
 drivers/i3c/master/mipi-i3c-hci/Makefile      |  3 +-
 drivers/i3c/master/mipi-i3c-hci/core.c        | 28 ++++++++++++
 drivers/i3c/master/mipi-i3c-hci/hci.h         | 12 ++++++
 .../i3c/master/mipi-i3c-hci/hci_quirks_mchp.c | 43 +++++++++++++++++++
 4 files changed, 85 insertions(+), 1 deletion(-)
 create mode 100644 drivers/i3c/master/mipi-i3c-hci/hci_quirks_mchp.c
drivers/i3c/master/mipi-i3c-hci/Makefile +2 -1
index e3d3ef757035..f463afc4566a 100644
@@ -4,5 +4,6 @@ obj-$(CONFIG_MIPI_I3C_HCI)		+= mipi-i3c-hci.o
 mipi-i3c-hci-y				:= core.o ext_caps.o pio.o dma.o \
 					   cmd_v1.o cmd_v2.o \
 					   dat_v1.o dct_v1.o \
-					   hci_quirks.o
+					   hci_quirks.o \
+					   hci_quirks_mchp.o
 obj-$(CONFIG_MIPI_I3C_HCI_PCI)		+= mipi-i3c-hci-pci.o
drivers/i3c/master/mipi-i3c-hci/core.c +28 -0
index 60f1175f1f37..cb0673d62c03 100644
@@ -8,6 +8,7 @@
  */
 
 #include <linux/bitfield.h>
+#include <linux/clk.h>
 #include <linux/device.h>
 #include <linux/errno.h>
 #include <linux/i3c/master.h>
@@ -651,6 +652,9 @@ static int i3c_hci_init(struct i3c_hci *hci)
 	hci->DAT_regs = offset ? hci->base_regs + offset : NULL;
 	hci->DAT_entries = FIELD_GET(DAT_TABLE_SIZE, regval);
 	hci->DAT_entry_size = FIELD_GET(DAT_ENTRY_SIZE, regval) ? 0 : 8;
+	/* Microchip SAMA7D65 SoC doesnot support DAT entry size bits in the DAT section offset register */
+	if (hci->quirks & MCHP_HCI_QUIRK_SAMA7D65)
+		hci->DAT_entry_size = 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",
@@ -661,6 +665,9 @@ static int i3c_hci_init(struct i3c_hci *hci)
 	hci->DCT_regs = offset ? hci->base_regs + offset : NULL;
 	hci->DCT_entries = FIELD_GET(DCT_TABLE_SIZE, regval);
 	hci->DCT_entry_size = FIELD_GET(DCT_ENTRY_SIZE, regval) ? 0 : 16;
+	/* Microchip SAMA7D65 SoC doesnot support DCT entry size bits in the DCT section offset register */
+	if (hci->quirks & MCHP_HCI_QUIRK_SAMA7D65)
+		hci->DCT_entry_size = 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",
@@ -753,6 +760,10 @@ static int i3c_hci_init(struct i3c_hci *hci)
 	if (hci->quirks & HCI_QUIRK_PIO_MODE)
 		hci->RHS_regs = NULL;
 
+	/* Microchip SAMA7d65 SoC supports only PIO mode */
+	if (hci->quirks & MCHP_HCI_QUIRK_PIO_MODE)
+		hci->RHS_regs = NULL;
+
 	/* Try activating DMA operations first */
 	if (hci->RHS_regs) {
 		reg_clear(HC_CONTROL, HC_CONTROL_PIO_MODE);
@@ -788,6 +799,10 @@ static int i3c_hci_init(struct i3c_hci *hci)
 	if (hci->quirks & HCI_QUIRK_OD_PP_TIMING)
 		amd_set_od_pp_timing(hci);
 
+	/* Configure OD and PP timings for Microchip platforms */
+	if (hci->quirks & MCHP_HCI_QUIRK_OD_PP_TIMING)
+		mchp_set_od_pp_timing(hci);
+
 	return 0;
 }
 
@@ -803,6 +818,16 @@ static int i3c_hci_probe(struct platform_device *pdev)
 	if (IS_ERR(hci->base_regs))
 		return PTR_ERR(hci->base_regs);
 
+#if defined(CONFIG_SOC_SAMA7D65)
+	hci->gclk = devm_clk_get_enabled(&pdev->dev, "gclk");
+	if (IS_ERR(hci->gclk))
+		return PTR_ERR(hci->gclk);
+
+	hci->pclk = devm_clk_get_enabled(&pdev->dev, "pclk");
+	if (IS_ERR(hci->pclk))
+		return PTR_ERR(hci->pclk);
+#endif
+
 	platform_set_drvdata(pdev, hci);
 	/* temporary for dev_printk's, to be replaced in i3c_master_register */
 	hci->master.dev.init_name = dev_name(&pdev->dev);
@@ -836,6 +861,9 @@ static void i3c_hci_remove(struct platform_device *pdev)
 
 static const __maybe_unused struct of_device_id i3c_hci_of_match[] = {
 	{ .compatible = "mipi-i3c-hci", },
+	{ .compatible = "mchp,sama7d65-i3c-hci",
+	  .data = (void *)(MCHP_HCI_QUIRK_PIO_MODE | MCHP_HCI_QUIRK_OD_PP_TIMING |
+			   MCHP_HCI_QUIRK_RESP_BUF_THLD | MCHP_HCI_QUIRK_SAMA7D65) },
 	{},
 };
 MODULE_DEVICE_TABLE(of, i3c_hci_of_match);
drivers/i3c/master/mipi-i3c-hci/hci.h +12 -0
index 69ea1d10414b..e57f8d85402c 100644
@@ -37,6 +37,10 @@ struct hci_cmd_ops;
 /* Our main structure */
 struct i3c_hci {
 	struct i3c_master_controller master;
+#if defined(CONFIG_SOC_SAMA7D65)
+	struct clk *gclk;
+	struct clk *pclk;
+#endif
 	void __iomem *base_regs;
 	void __iomem *DAT_regs;
 	void __iomem *DCT_regs;
@@ -144,6 +148,12 @@ struct i3c_hci_dev_data {
 #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 */
 
+/* list of quirks for Microchip platforms */
+#define MCHP_HCI_QUIRK_PIO_MODE		BIT(2)  /* Set PIO mode */
+#define MCHP_HCI_QUIRK_OD_PP_TIMING	BIT(3)  /* Set OD and PP timings */
+#define MCHP_HCI_QUIRK_RESP_BUF_THLD	BIT(4)  /* Set resp buf thld to 0 */
+#define MCHP_HCI_QUIRK_SAMA7D65		BIT(5)  /* Set SAMA7D65 SoC specific features */
+
 
 /* global functions */
 void mipi_i3c_hci_resume(struct i3c_hci *hci);
@@ -151,5 +161,7 @@ void mipi_i3c_hci_pio_reset(struct i3c_hci *hci);
 void mipi_i3c_hci_dct_index_reset(struct i3c_hci *hci);
 void amd_set_od_pp_timing(struct i3c_hci *hci);
 void amd_set_resp_buf_thld(struct i3c_hci *hci);
+void mchp_set_od_pp_timing(struct i3c_hci *hci);
+void mchp_set_resp_buf_thld(struct i3c_hci *hci);
 
 #endif
drivers/i3c/master/mipi-i3c-hci/hci_quirks_mchp.c new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
2.34.1
reviewer
#3 lore raw

Re: [PATCH 2/4] i3c: mipi-i3c-hci: add microchip sama7d65 SoC

Quoted 41 lines · Durai Manickam KR

Add support for microchip sama7d65 SoC I3C HCI master only IP. Features tested and supported :
Standard CCC commands.
I3C SDR mode private transfers in PIO mode. I2C transfers in PIO mode.
Pure bus mode and mixed bus mode.

---
 drivers/i3c/master/mipi-i3c-hci/Makefile      |  3 +-
 drivers/i3c/master/mipi-i3c-hci/core.c        | 28 ++++++++++++
 drivers/i3c/master/mipi-i3c-hci/hci.h         | 12 ++++++
 .../i3c/master/mipi-i3c-hci/hci_quirks_mchp.c | 43 +++++++++++++++++++
 4 files changed, 85 insertions(+), 1 deletion(-)
 create mode 100644 drivers/i3c/master/mipi-i3c-hci/hci_quirks_mchp.c
drivers/i3c/master/mipi-i3c-hci/Makefile +2 -1
index e3d3ef757035..f463afc4566a 100644
@@ -4,5 +4,6 @@ obj-$(CONFIG_MIPI_I3C_HCI)		+= mipi-i3c-hci.o
 mipi-i3c-hci-y				:= core.o ext_caps.o pio.o dma.o \
 					   cmd_v1.o cmd_v2.o \
 					   dat_v1.o dct_v1.o \
-					   hci_quirks.o
+					   hci_quirks.o \
+					   hci_quirks_mchp.o
 obj-$(CONFIG_MIPI_I3C_HCI_PCI)		+= mipi-i3c-hci-pci.o
drivers/i3c/master/mipi-i3c-hci/core.c +1 -0
index 60f1175f1f37..cb0673d62c03 100644
@@ -8,6 +8,7 @@
  */
 
 #include <linux/bitfield.h>
+#include <linux/clk.h>
 #include <linux/device.h>
 #include <linux/errno.h>
 #include <linux/i3c/master.h>

drivers/i3c/master/mipi-i3c-hci/core.c static int i3c_hci_init(struct i3c_hci *hci) · line 657

Quoted 6 lines
drivers/i3c/master/mipi-i3c-hci/core.c +3 -0
@@ -651,6 +652,9 @@ static int i3c_hci_init(struct i3c_hci *hci)
 	hci->DAT_regs = offset ? hci->base_regs + offset : NULL;
 	hci->DAT_entries = FIELD_GET(DAT_TABLE_SIZE, regval);
 	hci->DAT_entry_size = FIELD_GET(DAT_ENTRY_SIZE, regval) ? 0 : 8;
+	/* Microchip SAMA7D65 SoC doesnot support DAT entry size bits in the DAT section offset register */
+	if (hci->quirks & MCHP_HCI_QUIRK_SAMA7D65)
+		hci->DAT_entry_size = 8;

#define MCHP_HCI_QUIRK_FIX_DATA_ENTRY_SIZE_8

	if (hci->quirks & MCHP_HCI_QUIRK_FIX_DATA_ENTRY_SIZE_8)
		hci->DAT_entry_size = 8;
	else
		hci->DAT_entry_size = FIELD_GET(DAT_ENTRY_SIZE, regval) ? 0 : 8;

in case other vendor have similar problem.

drivers/i3c/master/mipi-i3c-hci/core.c static int i3c_hci_init(struct i3c_hci *hci) · line 670

Quoted 10 lines
drivers/i3c/master/mipi-i3c-hci/core.c +3 -0
 	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",
@@ -661,6 +665,9 @@ static int i3c_hci_init(struct i3c_hci *hci)
 	hci->DCT_regs = offset ? hci->base_regs + offset : NULL;
 	hci->DCT_entries = FIELD_GET(DCT_TABLE_SIZE, regval);
 	hci->DCT_entry_size = FIELD_GET(DCT_ENTRY_SIZE, regval) ? 0 : 16;
+	/* Microchip SAMA7D65 SoC doesnot support DCT entry size bits in the DCT section offset register */
+	if (hci->quirks & MCHP_HCI_QUIRK_SAMA7D65)
+		hci->DCT_entry_size = 16;

The same here.

Quoted 15 lines
drivers/i3c/master/mipi-i3c-hci/core.c +4 -0
 	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",
@@ -753,6 +760,10 @@ static int i3c_hci_init(struct i3c_hci *hci)
 	if (hci->quirks & HCI_QUIRK_PIO_MODE)
 		hci->RHS_regs = NULL;
 
+	/* Microchip SAMA7d65 SoC supports only PIO mode */
+	if (hci->quirks & MCHP_HCI_QUIRK_PIO_MODE)
+		hci->RHS_regs = NULL;
+
 	/* Try activating DMA operations first */
 	if (hci->RHS_regs) {
 		reg_clear(HC_CONTROL, HC_CONTROL_PIO_MODE);

drivers/i3c/master/mipi-i3c-hci/core.c static int i3c_hci_init(struct i3c_hci *hci) · line 800

Quoted 2 lines
drivers/i3c/master/mipi-i3c-hci/core.c +0 -0
@@ -788,6 +799,10 @@ static int i3c_hci_init(struct i3c_hci *hci)
 	if (hci->quirks & HCI_QUIRK_OD_PP_TIMING)
 		amd_set_od_pp_timing(hci);

It is worth to add a callback set_od_pp_timing() instead of use quirks.

You can create patch change existed amd one, then add mchp one.

Quoted 11 lines
drivers/i3c/master/mipi-i3c-hci/core.c +4 -0
+	/* Configure OD and PP timings for Microchip platforms */
+	if (hci->quirks & MCHP_HCI_QUIRK_OD_PP_TIMING)
+		mchp_set_od_pp_timing(hci);
+
 	return 0;
 }
 
@@ -803,6 +818,16 @@ static int i3c_hci_probe(struct platform_device *pdev)
 	if (IS_ERR(hci->base_regs))
 		return PTR_ERR(hci->base_regs);
 

drivers/i3c/master/mipi-i3c-hci/core.c static int i3c_hci_probe(struct platform_device *pdev) · line 830

Quoted 10 lines
drivers/i3c/master/mipi-i3c-hci/core.c +10 -0
+#if defined(CONFIG_SOC_SAMA7D65)
+	hci->gclk = devm_clk_get_enabled(&pdev->dev, "gclk");
+	if (IS_ERR(hci->gclk))
+		return PTR_ERR(hci->gclk);
+
+	hci->pclk = devm_clk_get_enabled(&pdev->dev, "pclk");
+	if (IS_ERR(hci->pclk))
+		return PTR_ERR(hci->pclk);
+#endif
+

Use devm_clk_bulk_get_all_enabled() can be comaptible other platform.

drivers/i3c/master/mipi-i3c-hci/core.c static void i3c_hci_remove(struct platform_device *pdev) · line 866

Quoted 10 lines
drivers/i3c/master/mipi-i3c-hci/core.c +3 -0
 	platform_set_drvdata(pdev, hci);
 	/* temporary for dev_printk's, to be replaced in i3c_master_register */
 	hci->master.dev.init_name = dev_name(&pdev->dev);
@@ -836,6 +861,9 @@ static void i3c_hci_remove(struct platform_device *pdev)
 
 static const __maybe_unused struct of_device_id i3c_hci_of_match[] = {
 	{ .compatible = "mipi-i3c-hci", },
+	{ .compatible = "mchp,sama7d65-i3c-hci",
+	  .data = (void *)(MCHP_HCI_QUIRK_PIO_MODE | MCHP_HCI_QUIRK_OD_PP_TIMING |
+			   MCHP_HCI_QUIRK_RESP_BUF_THLD | MCHP_HCI_QUIRK_SAMA7D65) },

don't suggest use cast this to pointer. You can define struct

struct mipi_csi_drvdata

{
	void (*set_op_pp_timing)();
	void **set_resp_buf_thld)();
	u32 flags;
};
static const mipi_csi_drvdata sama7d64_data = {
	.set_op_pp_timing = mchp_set_od_pp_timing;
	...
	.flags = MCHP_HCI_QUIRK_PIO_MODE;
}

.compatible = "mchp,sama7d65-i3c-hci", .data = &sama7d64_data

Quoted 8 lines
drivers/i3c/master/mipi-i3c-hci/core.c +0 -0
 	{},
 };
 MODULE_DEVICE_TABLE(of, i3c_hci_of_match);
drivers/i3c/master/mipi-i3c-hci/hci.h +0 -0
index 69ea1d10414b..e57f8d85402c 100644

drivers/i3c/master/mipi-i3c-hci/hci.h struct hci_cmd_ops; · line 43

Quoted 7 lines
drivers/i3c/master/mipi-i3c-hci/hci.h +4 -0
@@ -37,6 +37,10 @@ struct hci_cmd_ops;
 /* Our main structure */
 struct i3c_hci {
 	struct i3c_master_controller master;
+#if defined(CONFIG_SOC_SAMA7D65)
+	struct clk *gclk;
+	struct clk *pclk;
+#endif

Needn't it because both are only used at probe funciton.

Frank

Quoted 81 lines
drivers/i3c/master/mipi-i3c-hci/hci.h +8 -0
 	void __iomem *base_regs;
 	void __iomem *DAT_regs;
 	void __iomem *DCT_regs;
@@ -144,6 +148,12 @@ struct i3c_hci_dev_data {
 #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 */
 
+/* list of quirks for Microchip platforms */
+#define MCHP_HCI_QUIRK_PIO_MODE		BIT(2)  /* Set PIO mode */
+#define MCHP_HCI_QUIRK_OD_PP_TIMING	BIT(3)  /* Set OD and PP timings */
+#define MCHP_HCI_QUIRK_RESP_BUF_THLD	BIT(4)  /* Set resp buf thld to 0 */
+#define MCHP_HCI_QUIRK_SAMA7D65		BIT(5)  /* Set SAMA7D65 SoC specific features */
+
 
 /* global functions */
 void mipi_i3c_hci_resume(struct i3c_hci *hci);
@@ -151,5 +161,7 @@ void mipi_i3c_hci_pio_reset(struct i3c_hci *hci);
 void mipi_i3c_hci_dct_index_reset(struct i3c_hci *hci);
 void amd_set_od_pp_timing(struct i3c_hci *hci);
 void amd_set_resp_buf_thld(struct i3c_hci *hci);
+void mchp_set_od_pp_timing(struct i3c_hci *hci);
+void mchp_set_resp_buf_thld(struct i3c_hci *hci);
 
 #endif
drivers/i3c/master/mipi-i3c-hci/hci_quirks_mchp.c new file +43 -1
new file mode 100644
index 000000000000..f2e54e6643c0
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2025 Microchip Technology Inc. and its subsidiaries
+ *
+ * Authors: Durai Manickam KR <[email protected]>
+ *
+ * Microchip I3C HCI Quirks
+ */
+
+#include <linux/i3c/master.h>
+#include "hci.h"
+
+/* Timing registers */
+#define MCHP_HCI_SCL_I3C_OD_TIMING          0x214
+#define MCHP_HCI_SCL_I3C_PP_TIMING          0x218
+#define MCHP_HCI_SDA_HOLD_SWITCH_DLY_TIMING 0x230
+
+/* Timing values to configure 9MHz frequency */
+#define MCHP_SCL_I3C_OD_TIMING          0x00cf00cf
+#define MCHP_SCL_I3C_PP_TIMING          0x00160016
+
+#define MCHP_QUEUE_THLD_CTRL                0xD0
+
+void mchp_set_od_pp_timing(struct i3c_hci *hci)
+{
+	u32 data;
+
+	reg_write(MCHP_HCI_SCL_I3C_OD_TIMING, MCHP_SCL_I3C_OD_TIMING);
+	reg_write(MCHP_HCI_SCL_I3C_PP_TIMING, MCHP_SCL_I3C_PP_TIMING);
+	data = reg_read(MCHP_HCI_SDA_HOLD_SWITCH_DLY_TIMING);
+	/* Configure maximum TX hold time */
+	data |= W0_MASK(18, 16);
+	reg_write(MCHP_HCI_SDA_HOLD_SWITCH_DLY_TIMING, data);
+}
+
+void mchp_set_resp_buf_thld(struct i3c_hci *hci)
+{
+	u32 data;
+
+	data = reg_read(MCHP_QUEUE_THLD_CTRL);
+	data = data & ~W0_MASK(15, 8);
+	reg_write(MCHP_QUEUE_THLD_CTRL, data);
+}
--

2.34.1

--
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c

#4 lore raw

Re: [PATCH 2/4] i3c: mipi-i3c-hci: add microchip sama7d65 SoC

Hi

Quoted 51 lines · Frank Li
Quoted 41 lines · Durai Manickam KR

Add support for microchip sama7d65 SoC I3C HCI master only IP. Features tested and supported :
Standard CCC commands.
I3C SDR mode private transfers in PIO mode. I2C transfers in PIO mode.
Pure bus mode and mixed bus mode.

---
  drivers/i3c/master/mipi-i3c-hci/Makefile      |  3 +-
  drivers/i3c/master/mipi-i3c-hci/core.c        | 28 ++++++++++++
  drivers/i3c/master/mipi-i3c-hci/hci.h         | 12 ++++++
  .../i3c/master/mipi-i3c-hci/hci_quirks_mchp.c | 43 +++++++++++++++++++
  4 files changed, 85 insertions(+), 1 deletion(-)

create mode 100644 drivers/i3c/master/mipi-i3c-hci/hci_quirks_mchp.c

drivers/i3c/master/mipi-i3c-hci/Makefile +2 -1
index e3d3ef757035..f463afc4566a 100644
@@ -4,5 +4,6 @@ obj-$(CONFIG_MIPI_I3C_HCI)		+= mipi-i3c-hci.o
  mipi-i3c-hci-y				:= core.o ext_caps.o pio.o dma.o \
  					   cmd_v1.o cmd_v2.o \
  					   dat_v1.o dct_v1.o \
-					   hci_quirks.o
+					   hci_quirks.o \
+					   hci_quirks_mchp.o
  obj-$(CONFIG_MIPI_I3C_HCI_PCI)		+= mipi-i3c-hci-pci.o
drivers/i3c/master/mipi-i3c-hci/core.c +1 -0
index 60f1175f1f37..cb0673d62c03 100644
@@ -8,6 +8,7 @@
   */
 
  #include <linux/bitfield.h>
+#include <linux/clk.h>
  #include <linux/device.h>
  #include <linux/errno.h>
  #include <linux/i3c/master.h>

drivers/i3c/master/mipi-i3c-hci/core.c static int i3c_hci_init(struct i3c_hci *hci) · line 657

Quoted 6 lines
drivers/i3c/master/mipi-i3c-hci/core.c +3 -0
@@ -651,6 +652,9 @@ static int i3c_hci_init(struct i3c_hci *hci)
  	hci->DAT_regs = offset ? hci->base_regs + offset : NULL;
  	hci->DAT_entries = FIELD_GET(DAT_TABLE_SIZE, regval);
  	hci->DAT_entry_size = FIELD_GET(DAT_ENTRY_SIZE, regval) ? 0 : 8;
+	/* Microchip SAMA7D65 SoC doesnot support DAT entry size bits in the DAT section offset register */
+	if (hci->quirks & MCHP_HCI_QUIRK_SAMA7D65)
+		hci->DAT_entry_size = 8;

#define MCHP_HCI_QUIRK_FIX_DATA_ENTRY_SIZE_8

Quoted 7 lines
	if (hci->quirks & MCHP_HCI_QUIRK_FIX_DATA_ENTRY_SIZE_8)
		hci->DAT_entry_size = 8;
	else
		hci->DAT_entry_size = FIELD_GET(DAT_ENTRY_SIZE, regval) ? 0 : 8;

in case other vendor have similar problem.

Are DAT_entry_size and DCT_entry_size quirks even needed? Does your HW read nonzero values and you need the quirk?

Quoted 4 lines

drivers/i3c/master/mipi-i3c-hci/core.c static int i3c_hci_init(struct i3c_hci *hci) · line 766

Quoted 4 lines
drivers/i3c/master/mipi-i3c-hci/core.c +4 -0
+	/* Microchip SAMA7d65 SoC supports only PIO mode */
+	if (hci->quirks & MCHP_HCI_QUIRK_PIO_MODE)
+		hci->RHS_regs = NULL;
+

Please use existing HCI_QUIRK_PIO_MODE quirk and then you don't need this added code.

#5 lore raw

PATCH 3/4 ARM: configs: at91: sama7: add sama7d65 i3c-hci

In reply to Durai Manickam KR

Enable the configs needed for I3C framework and microchip sama7d65 i3c-hci driver.

---
 arch/arm/configs/sama7_defconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/configs/sama7_defconfig +2 -0
index e14720a9a5ac..6a7455d5b7f5 100644
@@ -115,6 +115,8 @@ CONFIG_HW_RANDOM=y
 CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_AT91=y
+CONFIG_I3C=y
+CONFIG_MIPI_I3C_HCI=y
 CONFIG_SPI=y
 CONFIG_SPI_ATMEL=y
 CONFIG_SPI_ATMEL_QUADSPI=y
Signature · 1 line
2.34.1
#6 lore raw

PATCH 4/4 ARM: dts: microchip: add I3C controller

In reply to Durai Manickam KR

Add I3C controller for sama7d65 SoC.

---
 arch/arm/boot/dts/microchip/sama7d65.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/microchip/sama7d65.dtsi +12 -0
index c191acc2c89f..3a5da27f7d83 100644
@@ -721,5 +721,17 @@ gic: interrupt-controller@e8c11000 {
 			#address-cells = <0>;
 			interrupt-controller;
 		};
+
+		i3c: i3c@e9000000 {
+			compatible = "mchp,sama7d65-i3c-hci";
+			reg = <0xe9000000 0x300>;
+			interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&pmc PMC_TYPE_PERIPHERAL 105>, <&pmc PMC_TYPE_GCK 105>;
+			clock-names = "pclk", "gclk";
+			assigned-clocks = <&pmc PMC_TYPE_GCK 105>;
+			assigned-clock-parents = <&pmc PMC_TYPE_CORE PMC_ETHPLL>;
+			assigned-clock-rates = <125000000>;
+			status = "disabled";
+		};
 	};
 };
Signature · 1 line
2.34.1
reviewer
#7 lore raw

Re: [PATCH 4/4] ARM: dts: microchip: add I3C controller

Quoted 12 lines · Durai Manickam KR

Add I3C controller for sama7d65 SoC.

---
 arch/arm/boot/dts/microchip/sama7d65.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/microchip/sama7d65.dtsi +0 -0
index c191acc2c89f..3a5da27f7d83 100644

arch/arm/boot/dts/microchip/sama7d65.dtsi gic: interrupt-controller@e8c11000 { · line 726

Quoted 6 lines
arch/arm/boot/dts/microchip/sama7d65.dtsi +3 -0
@@ -721,5 +721,17 @@ gic: interrupt-controller@e8c11000 {
 			#address-cells = <0>;
 			interrupt-controller;
 		};
+
+		i3c: i3c@e9000000 {
+			compatible = "mchp,sama7d65-i3c-hci";

Need update binding doc for "mchp,sama7d65-i3c-hci"

Frank

Quoted 14 lines
arch/arm/boot/dts/microchip/sama7d65.dtsi +9 -1
+			reg = <0xe9000000 0x300>;
+			interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&pmc PMC_TYPE_PERIPHERAL 105>, <&pmc PMC_TYPE_GCK 105>;
+			clock-names = "pclk", "gclk";
+			assigned-clocks = <&pmc PMC_TYPE_GCK 105>;
+			assigned-clock-parents = <&pmc PMC_TYPE_CORE PMC_ETHPLL>;
+			assigned-clock-rates = <125000000>;
+			status = "disabled";
+		};
 	};
 };
--

2.34.1

#8 lore raw

Re: [PATCH 4/4] ARM: dts: microchip: add I3C controller

Quoted 8 lines · Frank Li
Quoted 7 lines · Durai Manickam KR

Add I3C controller for sama7d65 SoC.

---
 arch/arm/boot/dts/microchip/sama7d65.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Quoted 13 lines

arch/arm/boot/dts/microchip/sama7d65.dtsi gic: interrupt-controller@e8c11000 { · line 726

Quoted 11 lines
arch/arm/boot/dts/microchip/sama7d65.dtsi +3 -0
index c191acc2c89f..3a5da27f7d83 100644
@@ -721,5 +721,17 @@ gic: interrupt-controller@e8c11000 {
 			#address-cells = <0>;
 			interrupt-controller;
 		};
+
+		i3c: i3c@e9000000 {
+			compatible = "mchp,sama7d65-i3c-hci";

Need update binding doc for "mchp,sama7d65-i3c-hci"

"mchp" isn't even a valid vendor prefix. It's not acceptable for a v2 to be like this after the feedback on v1.

#9 lore raw
In reply to Durai Manickam KR
Quoted 30 lines · Durai Manickam KR

Add support for microchip sama7d65 SoC I3C master only IP which is based on mipi-i3c-hci from synopsys implementing version 1.0 specification. The platform specific changes are integrated in the existing mipi-i3c-hci driver by introducing a quirk and SoC specific config option.

I3C in master mode supports up to 12.5MHz, SDR mode data transfer in mixed bus mode (I2C and I3C target devices on same i3c bus).

Testing done:
With this patch we are able to fully configure the lsm6dso I3C slave device. Unlike I2C, I hope there is no linux utility to check the various transactions supported in the host controller. These features will be tested later probably with I3C analyser KIT.

Durai Manickam KR (4):
clk: at91: sama7d65: add peripheral clock for I3C
i3c: mipi-i3c-hci: add microchip sama7d65 SoC
ARM: configs: at91: sama7: add sama7d65 i3c-hci
ARM: dts: microchip: add I3C controller

 arch/arm/boot/dts/microchip/sama7d65.dtsi     | 12 ++++++
 arch/arm/configs/sama7_defconfig              |  2 +
 drivers/clk/at91/sama7d65.c                   |  5 ++-
 drivers/i3c/master/mipi-i3c-hci/Makefile      |  3 +-
 drivers/i3c/master/mipi-i3c-hci/core.c        | 28 ++++++++++++
 drivers/i3c/master/mipi-i3c-hci/hci.h         | 12 ++++++
 .../i3c/master/mipi-i3c-hci/hci_quirks_mchp.c | 43 +++++++++++++++++++
 7 files changed, 102 insertions(+), 3 deletions(-)
 create mode 100644 drivers/i3c/master/mipi-i3c-hci/hci_quirks_mchp.c
Quoted 5 lines

--
2.34.1

My bot found new DTB warnings on the .dts files added or changed in this series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:

  pip3 install dtschema --upgrade

This patch series was applied (using b4) to base:
Base: attempting to guess base-commit...
Base: tags/v6.17-rc1-3-g0b9dcd02ea93 (exact match)

If this is not the correct base, please add 'base-commit' tag (or use b4 which does this automatically)

New warnings running 'make CHECK_DTBS=y for arch/arm/boot/dts/microchip/' for [email protected]:

arch/arm/boot/dts/microchip/at91-sama7d65_curiosity.dtb: /soc/i3c@e9000000: failed to match any schema with compatible: ['mchp,sama7d65-i3c-hci']

#10 lore raw
In reply to Durai Manickam KR
Quoted 20 lines · Durai Manickam KR

Add support for microchip sama7d65 SoC I3C master only IP which is based on mipi-i3c-hci from synopsys implementing version 1.0 specification. The platform specific changes are integrated in the existing mipi-i3c-hci driver by introducing a quirk and SoC specific config option.

I3C in master mode supports up to 12.5MHz, SDR mode data transfer in mixed bus mode (I2C and I3C target devices on same i3c bus).

Testing done:
With this patch we are able to fully configure the lsm6dso I3C slave device. Unlike I2C, I hope there is no linux utility to check the various transactions supported in the host controller. These features will be tested later probably with I3C analyser KIT.

Durai Manickam KR (4):
clk: at91: sama7d65: add peripheral clock for I3C
i3c: mipi-i3c-hci: add microchip sama7d65 SoC
ARM: configs: at91: sama7: add sama7d65 i3c-hci
ARM: dts: microchip: add I3C controller

Quoted 9 lines
 arch/arm/boot/dts/microchip/sama7d65.dtsi     | 12 ++++++
 arch/arm/configs/sama7_defconfig              |  2 +
 drivers/clk/at91/sama7d65.c                   |  5 ++-
 drivers/i3c/master/mipi-i3c-hci/Makefile      |  3 +-
 drivers/i3c/master/mipi-i3c-hci/core.c        | 28 ++++++++++++
 drivers/i3c/master/mipi-i3c-hci/hci.h         | 12 ++++++
 .../i3c/master/mipi-i3c-hci/hci_quirks_mchp.c | 43 +++++++++++++++++++
 7 files changed, 102 insertions(+), 3 deletions(-)
 create mode 100644 drivers/i3c/master/mipi-i3c-hci/hci_quirks_mchp.c

This is actually v2 right? v1 was here:
https://lore.kernel.org/all/20250910-magician-retold-a6835179f71d@spud/

Where is the dt-binding that you also omitted there?