public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Introduce initial support for the AMD I3C (non-HCI) to DW driver
@ 2024-11-14 11:02 Shyam Sundar S K
  2024-11-14 11:02 ` [PATCH v2 1/2] i3c: dw: Add support for AMDI0015 ACPI ID Shyam Sundar S K
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Shyam Sundar S K @ 2024-11-14 11:02 UTC (permalink / raw)
  To: Alexandre Belloni, Jarkko Nikula
  Cc: Sanket.Goswami, linux-i3c, linux-kernel, Shyam Sundar S K

In this series, support for following features has been added.
- Add dw-i3c-master driver with ACPI bindings
- Workaround for AMD hardware

v4:
----
 - Split the series into two
 - add Jarkko tags

v3:
----
 - Address feedback from Jarkko
 - Drop using SHARED_IRQ flags during interrupt registration
 - Update commit message to mention about SETAASA
 - Use bits [6:0] as the static address

v2:
----
 - Address LKP reports issues

Shyam Sundar S K (2):
  i3c: dw: Add support for AMDI0015 ACPI ID
  i3c: dw: Add quirk to address OD/PP timing issue on AMD platform

 drivers/i3c/master/dw-i3c-master.c | 34 ++++++++++++++++++++++++++++++
 drivers/i3c/master/dw-i3c-master.h |  1 +
 2 files changed, 35 insertions(+)

-- 
2.34.1


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

* [PATCH v2 1/2] i3c: dw: Add support for AMDI0015 ACPI ID
  2024-11-14 11:02 [PATCH v2 0/2] Introduce initial support for the AMD I3C (non-HCI) to DW driver Shyam Sundar S K
@ 2024-11-14 11:02 ` Shyam Sundar S K
  2024-11-14 11:02 ` [PATCH v2 2/2] i3c: dw: Add quirk to address OD/PP timing issue on AMD platform Shyam Sundar S K
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Shyam Sundar S K @ 2024-11-14 11:02 UTC (permalink / raw)
  To: Alexandre Belloni, Jarkko Nikula
  Cc: Sanket.Goswami, linux-i3c, linux-kernel, Shyam Sundar S K

Add AMDI0015 _HID for Designware I3C driver so that the dw-i3c-master
driver can be probed on AMD platforms.

Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
 drivers/i3c/master/dw-i3c-master.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 8d694672c110..1a7c300b6d45 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -1748,12 +1748,19 @@ static const struct of_device_id dw_i3c_master_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, dw_i3c_master_of_match);
 
+static const struct acpi_device_id amd_i3c_device_match[] = {
+	{ "AMDI0015" },
+	{ }
+};
+MODULE_DEVICE_TABLE(acpi, amd_i3c_device_match);
+
 static struct platform_driver dw_i3c_driver = {
 	.probe = dw_i3c_probe,
 	.remove_new = dw_i3c_remove,
 	.driver = {
 		.name = "dw-i3c-master",
 		.of_match_table = dw_i3c_master_of_match,
+		.acpi_match_table = amd_i3c_device_match,
 		.pm = &dw_i3c_pm_ops,
 	},
 };
-- 
2.34.1


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

* [PATCH v2 2/2] i3c: dw: Add quirk to address OD/PP timing issue on AMD platform
  2024-11-14 11:02 [PATCH v2 0/2] Introduce initial support for the AMD I3C (non-HCI) to DW driver Shyam Sundar S K
  2024-11-14 11:02 ` [PATCH v2 1/2] i3c: dw: Add support for AMDI0015 ACPI ID Shyam Sundar S K
@ 2024-11-14 11:02 ` Shyam Sundar S K
  2024-11-14 11:11 ` [PATCH v2 0/2] Introduce initial support for the AMD I3C (non-HCI) to DW driver Shyam Sundar S K
  2024-11-18 13:30 ` Alexandre Belloni
  3 siblings, 0 replies; 5+ messages in thread
From: Shyam Sundar S K @ 2024-11-14 11:02 UTC (permalink / raw)
  To: Alexandre Belloni, Jarkko Nikula
  Cc: Sanket.Goswami, linux-i3c, linux-kernel, Shyam Sundar S K

The AMD Legacy I3C is having a problem with its IP, specifically with the
push-pull and open-drain pull-up registers. These registers need to be
manually programmed for every CCC submission to align with the duty cycle.
Therefore, add a quirk to address this issue.

Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
 drivers/i3c/master/dw-i3c-master.c | 29 ++++++++++++++++++++++++++++-
 drivers/i3c/master/dw-i3c-master.h |  1 +
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 1a7c300b6d45..5b5c2e4bdc51 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -220,6 +220,14 @@
 
 #define XFER_TIMEOUT (msecs_to_jiffies(1000))
 #define RPM_AUTOSUSPEND_TIMEOUT 1000 /* ms */
+
+/* Timing values to configure 12.5MHz frequency */
+#define AMD_I3C_OD_TIMING          0x4C007C
+#define AMD_I3C_PP_TIMING          0x8001A
+
+/* List of quirks */
+#define AMD_I3C_OD_PP_TIMING		BIT(1)
+
 struct dw_i3c_cmd {
 	u32 cmd_lo;
 	u32 cmd_hi;
@@ -794,6 +802,12 @@ static int dw_i3c_ccc_get(struct dw_i3c_master *master, struct i3c_ccc_cmd *ccc)
 	return ret;
 }
 
+static void amd_configure_od_pp_quirk(struct dw_i3c_master *master)
+{
+	master->i3c_od_timing = AMD_I3C_OD_TIMING;
+	master->i3c_pp_timing = AMD_I3C_PP_TIMING;
+}
+
 static int dw_i3c_master_send_ccc_cmd(struct i3c_master_controller *m,
 				      struct i3c_ccc_cmd *ccc)
 {
@@ -803,6 +817,13 @@ static int dw_i3c_master_send_ccc_cmd(struct i3c_master_controller *m,
 	if (ccc->id == I3C_CCC_ENTDAA)
 		return -EINVAL;
 
+	/* AMD platform specific OD and PP timings */
+	if (master->quirks & AMD_I3C_OD_PP_TIMING) {
+		amd_configure_od_pp_quirk(master);
+		writel(master->i3c_pp_timing, master->regs + SCL_I3C_PP_TIMING);
+		writel(master->i3c_od_timing, master->regs + SCL_I3C_OD_TIMING);
+	}
+
 	ret = pm_runtime_resume_and_get(master->dev);
 	if (ret < 0) {
 		dev_err(master->dev,
@@ -1602,6 +1623,8 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,
 	master->maxdevs = ret >> 16;
 	master->free_pos = GENMASK(master->maxdevs - 1, 0);
 
+	master->quirks = (unsigned long)device_get_match_data(&pdev->dev);
+
 	INIT_WORK(&master->hj_work, dw_i3c_hj_work);
 	ret = i3c_master_register(&master->base, &pdev->dev,
 				  &dw_mipi_i3c_ops, false);
@@ -1675,6 +1698,10 @@ static void dw_i3c_master_restore_addrs(struct dw_i3c_master *master)
 
 static void dw_i3c_master_restore_timing_regs(struct dw_i3c_master *master)
 {
+	/* AMD platform specific OD and PP timings */
+	if (master->quirks & AMD_I3C_OD_PP_TIMING)
+		amd_configure_od_pp_quirk(master);
+
 	writel(master->i3c_pp_timing, master->regs + SCL_I3C_PP_TIMING);
 	writel(master->bus_free_timing, master->regs + BUS_FREE_TIMING);
 	writel(master->i3c_od_timing, master->regs + SCL_I3C_OD_TIMING);
@@ -1749,7 +1776,7 @@ static const struct of_device_id dw_i3c_master_of_match[] = {
 MODULE_DEVICE_TABLE(of, dw_i3c_master_of_match);
 
 static const struct acpi_device_id amd_i3c_device_match[] = {
-	{ "AMDI0015" },
+	{ "AMDI0015", AMD_I3C_OD_PP_TIMING },
 	{ }
 };
 MODULE_DEVICE_TABLE(acpi, amd_i3c_device_match);
diff --git a/drivers/i3c/master/dw-i3c-master.h b/drivers/i3c/master/dw-i3c-master.h
index 219ff815d3a7..c5cb695c16ab 100644
--- a/drivers/i3c/master/dw-i3c-master.h
+++ b/drivers/i3c/master/dw-i3c-master.h
@@ -50,6 +50,7 @@ struct dw_i3c_master {
 	u32 bus_free_timing;
 	u32 i2c_fm_timing;
 	u32 i2c_fmp_timing;
+	u32 quirks;
 	/*
 	 * Per-device hardware data, used to manage the device address table
 	 * (DAT)
-- 
2.34.1


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

* Re: [PATCH v2 0/2] Introduce initial support for the AMD I3C (non-HCI) to DW driver
  2024-11-14 11:02 [PATCH v2 0/2] Introduce initial support for the AMD I3C (non-HCI) to DW driver Shyam Sundar S K
  2024-11-14 11:02 ` [PATCH v2 1/2] i3c: dw: Add support for AMDI0015 ACPI ID Shyam Sundar S K
  2024-11-14 11:02 ` [PATCH v2 2/2] i3c: dw: Add quirk to address OD/PP timing issue on AMD platform Shyam Sundar S K
@ 2024-11-14 11:11 ` Shyam Sundar S K
  2024-11-18 13:30 ` Alexandre Belloni
  3 siblings, 0 replies; 5+ messages in thread
From: Shyam Sundar S K @ 2024-11-14 11:11 UTC (permalink / raw)
  To: Alexandre Belloni, Jarkko Nikula; +Cc: Sanket.Goswami, linux-i3c, linux-kernel

Apologies. Ignore the version prefix, it should be v4, instead of v2.

On 11/14/2024 16:32, Shyam Sundar S K wrote:
> In this series, support for following features has been added.
> - Add dw-i3c-master driver with ACPI bindings
> - Workaround for AMD hardware
> 
> v4:
> ----
>  - Split the series into two
>  - add Jarkko tags
> 
> v3:
> ----
>  - Address feedback from Jarkko
>  - Drop using SHARED_IRQ flags during interrupt registration
>  - Update commit message to mention about SETAASA
>  - Use bits [6:0] as the static address
> 
> v2:
> ----
>  - Address LKP reports issues
> 
> Shyam Sundar S K (2):
>   i3c: dw: Add support for AMDI0015 ACPI ID
>   i3c: dw: Add quirk to address OD/PP timing issue on AMD platform
> 
>  drivers/i3c/master/dw-i3c-master.c | 34 ++++++++++++++++++++++++++++++
>  drivers/i3c/master/dw-i3c-master.h |  1 +
>  2 files changed, 35 insertions(+)
> 

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

* Re: [PATCH v2 0/2] Introduce initial support for the AMD I3C (non-HCI) to DW driver
  2024-11-14 11:02 [PATCH v2 0/2] Introduce initial support for the AMD I3C (non-HCI) to DW driver Shyam Sundar S K
                   ` (2 preceding siblings ...)
  2024-11-14 11:11 ` [PATCH v2 0/2] Introduce initial support for the AMD I3C (non-HCI) to DW driver Shyam Sundar S K
@ 2024-11-18 13:30 ` Alexandre Belloni
  3 siblings, 0 replies; 5+ messages in thread
From: Alexandre Belloni @ 2024-11-18 13:30 UTC (permalink / raw)
  To: Jarkko Nikula, Shyam Sundar S K; +Cc: Sanket.Goswami, linux-i3c, linux-kernel

On Thu, 14 Nov 2024 16:32:37 +0530, Shyam Sundar S K wrote:
> In this series, support for following features has been added.
> - Add dw-i3c-master driver with ACPI bindings
> - Workaround for AMD hardware
> 
> v4:
> ----
>  - Split the series into two
>  - add Jarkko tags
> 
> [...]

Applied, thanks!

[1/2] i3c: dw: Add support for AMDI0015 ACPI ID
      https://git.kernel.org/abelloni/c/0a0d851ce1bc
[2/2] i3c: dw: Add quirk to address OD/PP timing issue on AMD platform
      https://git.kernel.org/abelloni/c/473d0cb48587

Best regards,

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

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

end of thread, other threads:[~2024-11-18 13:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-14 11:02 [PATCH v2 0/2] Introduce initial support for the AMD I3C (non-HCI) to DW driver Shyam Sundar S K
2024-11-14 11:02 ` [PATCH v2 1/2] i3c: dw: Add support for AMDI0015 ACPI ID Shyam Sundar S K
2024-11-14 11:02 ` [PATCH v2 2/2] i3c: dw: Add quirk to address OD/PP timing issue on AMD platform Shyam Sundar S K
2024-11-14 11:11 ` [PATCH v2 0/2] Introduce initial support for the AMD I3C (non-HCI) to DW driver Shyam Sundar S K
2024-11-18 13:30 ` Alexandre Belloni

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