* [PATCH 1/5] i3c: mipi-i3c-hci: Add MIPI0100 ACPI ID to the I3C Support List
2024-07-23 17:35 [PATCH 0/5] Introduce initial AMD I3C HCI driver support Shyam Sundar S K
@ 2024-07-23 17:35 ` Shyam Sundar S K
2024-07-23 17:35 ` [PATCH 2/5] i3c: mipi-i3c-hci: Add a quirk to set PIO mode Shyam Sundar S K
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Shyam Sundar S K @ 2024-07-23 17:35 UTC (permalink / raw)
To: Alexandre Belloni, Jarkko Nikula
Cc: Guruvendra Punugupati, Krishnamoorthi M, linux-i3c, linux-kernel,
Shyam Sundar S K
The current driver code lacks the necessary plumbing for ACPI IDs,
preventing the mipi-i3c-hci driver from being loaded on x86
platforms that advertise I3C ACPI support.
This update adds the MIPI0100 ACPI ID to the list of supported IDs.
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
MIPI0100 is the ACPI ID as defined in the MIPI I3C DisCo specification.
drivers/i3c/master/mipi-i3c-hci/core.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
index d7e966a25583..dbc8c38bd962 100644
--- a/drivers/i3c/master/mipi-i3c-hci/core.c
+++ b/drivers/i3c/master/mipi-i3c-hci/core.c
@@ -826,12 +826,18 @@ static const __maybe_unused struct of_device_id i3c_hci_of_match[] = {
};
MODULE_DEVICE_TABLE(of, i3c_hci_of_match);
+static const struct acpi_device_id i3c_hci_acpi_match[] = {
+ {"MIPI0100"},
+ {}
+};
+
static struct platform_driver i3c_hci_driver = {
.probe = i3c_hci_probe,
.remove_new = i3c_hci_remove,
.driver = {
.name = "mipi-i3c-hci",
.of_match_table = of_match_ptr(i3c_hci_of_match),
+ .acpi_match_table = i3c_hci_acpi_match,
},
};
module_platform_driver(i3c_hci_driver);
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/5] i3c: mipi-i3c-hci: Add a quirk to set PIO mode
2024-07-23 17:35 [PATCH 0/5] Introduce initial AMD I3C HCI driver support Shyam Sundar S K
2024-07-23 17:35 ` [PATCH 1/5] i3c: mipi-i3c-hci: Add MIPI0100 ACPI ID to the I3C Support List Shyam Sundar S K
@ 2024-07-23 17:35 ` Shyam Sundar S K
2024-07-23 17:35 ` [PATCH 3/5] i3c: mipi-i3c-hci: Relocate helper macros to HCI header file Shyam Sundar S K
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Shyam Sundar S K @ 2024-07-23 17:35 UTC (permalink / raw)
To: Alexandre Belloni, Jarkko Nikula
Cc: Guruvendra Punugupati, Krishnamoorthi M, linux-i3c, linux-kernel,
Shyam Sundar S K
The AMD HCI controller currently only supports PIO mode but exposes DMA
rings to the OS, which leads to the controller being configured in DMA
mode. To address this, add a quirk to avoid configuring the controller in
DMA mode and default to PIO mode.
Additionally, introduce a generic quirk infrastructure to the mipi-i3c-hci
driver to facilitate seamless future quirk additions.
Co-developed-by: Krishnamoorthi M <krishnamoorthi.m@amd.com>
Signed-off-by: Krishnamoorthi M <krishnamoorthi.m@amd.com>
Co-developed-by: Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>
Signed-off-by: Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
drivers/i3c/master/mipi-i3c-hci/Makefile | 3 ++-
drivers/i3c/master/mipi-i3c-hci/core.c | 15 ++++++++++++++-
drivers/i3c/master/mipi-i3c-hci/hci.h | 3 +++
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/i3c/master/mipi-i3c-hci/Makefile b/drivers/i3c/master/mipi-i3c-hci/Makefile
index a658e7b8262c..1f8cd5c48fde 100644
--- a/drivers/i3c/master/mipi-i3c-hci/Makefile
+++ b/drivers/i3c/master/mipi-i3c-hci/Makefile
@@ -3,4 +3,5 @@
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
+ dat_v1.o dct_v1.o \
+ hci_quirks.o
diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
index dbc8c38bd962..8bb422ab1d01 100644
--- a/drivers/i3c/master/mipi-i3c-hci/core.c
+++ b/drivers/i3c/master/mipi-i3c-hci/core.c
@@ -33,6 +33,7 @@
#define reg_clear(r, v) reg_write(r, reg_read(r) & ~(v))
#define HCI_VERSION 0x00 /* HCI Version (in BCD) */
+#define HCI_VERSION_V1 0x100 /* MIPI HCI Version number V1.0 */
#define HC_CONTROL 0x04
#define HC_CONTROL_BUS_ENABLE BIT(31)
@@ -745,6 +746,14 @@ static int i3c_hci_init(struct i3c_hci *hci)
return -EINVAL;
}
+ /* Initialize quirks for AMD platforms */
+ amd_i3c_hci_quirks_init(hci);
+
+ regval = reg_read(HCI_VERSION);
+
+ if (hci->quirks & HCI_QUIRK_AMD_PIO_MODE)
+ hci->RHS_regs = NULL;
+
/* Try activating DMA operations first */
if (hci->RHS_regs) {
reg_clear(HC_CONTROL, HC_CONTROL_PIO_MODE);
@@ -760,7 +769,11 @@ static int i3c_hci_init(struct i3c_hci *hci)
/* If no DMA, try PIO */
if (!hci->io && hci->PIO_regs) {
reg_set(HC_CONTROL, HC_CONTROL_PIO_MODE);
- if (!(reg_read(HC_CONTROL) & HC_CONTROL_PIO_MODE)) {
+ /*
+ * HC_CONTROL_PIO_MODE bit not present in HC_CONTROL register w.r.t V1.0
+ * specification. So skip checking PIO_MODE bit status
+ */
+ if (regval != HCI_VERSION_V1 && !(reg_read(HC_CONTROL) & HC_CONTROL_PIO_MODE)) {
dev_err(&hci->master.dev, "DMA mode is stuck\n");
ret = -EIO;
} else {
diff --git a/drivers/i3c/master/mipi-i3c-hci/hci.h b/drivers/i3c/master/mipi-i3c-hci/hci.h
index f94d95e024be..046b65d43e63 100644
--- a/drivers/i3c/master/mipi-i3c-hci/hci.h
+++ b/drivers/i3c/master/mipi-i3c-hci/hci.h
@@ -135,6 +135,7 @@ struct i3c_hci_dev_data {
/* list of quirks */
#define HCI_QUIRK_RAW_CCC BIT(1) /* CCC framing must be explicit */
+#define HCI_QUIRK_AMD_PIO_MODE BIT(2) /* Set PIO mode for AMD platforms */
/* global functions */
@@ -142,4 +143,6 @@ void mipi_i3c_hci_resume(struct i3c_hci *hci);
void mipi_i3c_hci_pio_reset(struct i3c_hci *hci);
void mipi_i3c_hci_dct_index_reset(struct i3c_hci *hci);
+void amd_i3c_hci_quirks_init(struct i3c_hci *hci);
+
#endif
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 3/5] i3c: mipi-i3c-hci: Relocate helper macros to HCI header file
2024-07-23 17:35 [PATCH 0/5] Introduce initial AMD I3C HCI driver support Shyam Sundar S K
2024-07-23 17:35 ` [PATCH 1/5] i3c: mipi-i3c-hci: Add MIPI0100 ACPI ID to the I3C Support List Shyam Sundar S K
2024-07-23 17:35 ` [PATCH 2/5] i3c: mipi-i3c-hci: Add a quirk to set PIO mode Shyam Sundar S K
@ 2024-07-23 17:35 ` Shyam Sundar S K
2024-07-23 17:35 ` [PATCH 4/5] i3c: mipi-i3c-hci: Add a quirk to set timing parameters Shyam Sundar S K
2024-07-23 17:35 ` [PATCH 5/5] i3c: mipi-i3c-hci: Add a quirk to set Response buffer threshold Shyam Sundar S K
4 siblings, 0 replies; 8+ messages in thread
From: Shyam Sundar S K @ 2024-07-23 17:35 UTC (permalink / raw)
To: Alexandre Belloni, Jarkko Nikula
Cc: Guruvendra Punugupati, Krishnamoorthi M, linux-i3c, linux-kernel,
Shyam Sundar S K
The reg_* helper macros are currently limited to core.c. Moving them to
hci.h will allow their functionality to be utilized in other files outside
of core.c.
Co-developed-by: Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>
Signed-off-by: Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
drivers/i3c/master/mipi-i3c-hci/core.c | 5 -----
drivers/i3c/master/mipi-i3c-hci/hci.h | 4 ++++
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
index 8bb422ab1d01..ae5b1a144506 100644
--- a/drivers/i3c/master/mipi-i3c-hci/core.c
+++ b/drivers/i3c/master/mipi-i3c-hci/core.c
@@ -27,11 +27,6 @@
* Host Controller Capabilities and Operation Registers
*/
-#define reg_read(r) readl(hci->base_regs + (r))
-#define reg_write(r, v) writel(v, hci->base_regs + (r))
-#define reg_set(r, v) reg_write(r, reg_read(r) | (v))
-#define reg_clear(r, v) reg_write(r, reg_read(r) & ~(v))
-
#define HCI_VERSION 0x00 /* HCI Version (in BCD) */
#define HCI_VERSION_V1 0x100 /* MIPI HCI Version number V1.0 */
diff --git a/drivers/i3c/master/mipi-i3c-hci/hci.h b/drivers/i3c/master/mipi-i3c-hci/hci.h
index 046b65d43e63..56361adbcc14 100644
--- a/drivers/i3c/master/mipi-i3c-hci/hci.h
+++ b/drivers/i3c/master/mipi-i3c-hci/hci.h
@@ -26,6 +26,10 @@
#define W2_BIT_(x) BIT((x) - 64)
#define W3_BIT_(x) BIT((x) - 96)
+#define reg_read(r) readl(hci->base_regs + (r))
+#define reg_write(r, v) writel(v, hci->base_regs + (r))
+#define reg_set(r, v) reg_write(r, reg_read(r) | (v))
+#define reg_clear(r, v) reg_write(r, reg_read(r) & ~(v))
struct hci_cmd_ops;
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/5] i3c: mipi-i3c-hci: Add a quirk to set timing parameters
2024-07-23 17:35 [PATCH 0/5] Introduce initial AMD I3C HCI driver support Shyam Sundar S K
` (2 preceding siblings ...)
2024-07-23 17:35 ` [PATCH 3/5] i3c: mipi-i3c-hci: Relocate helper macros to HCI header file Shyam Sundar S K
@ 2024-07-23 17:35 ` Shyam Sundar S K
2024-07-24 2:18 ` kernel test robot
2024-07-24 2:41 ` kernel test robot
2024-07-23 17:35 ` [PATCH 5/5] i3c: mipi-i3c-hci: Add a quirk to set Response buffer threshold Shyam Sundar S K
4 siblings, 2 replies; 8+ messages in thread
From: Shyam Sundar S K @ 2024-07-23 17:35 UTC (permalink / raw)
To: Alexandre Belloni, Jarkko Nikula
Cc: Guruvendra Punugupati, Krishnamoorthi M, linux-i3c, linux-kernel,
Shyam Sundar S K
The AMD HCI controller is currently unstable at 12.5 MHz. To address this,
a quirk is added to configure the clock rate to 9 MHz as a workaround,
with proportional adjustments to the Open-Drain (OD) and Push-Pull (PP)
values.
Co-developed-by: Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>
Signed-off-by: Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
drivers/i3c/master/mipi-i3c-hci/core.c | 4 ++
drivers/i3c/master/mipi-i3c-hci/hci.h | 2 +
drivers/i3c/master/mipi-i3c-hci/hci_quirks.c | 41 ++++++++++++++++++++
3 files changed, 47 insertions(+)
create mode 100644 drivers/i3c/master/mipi-i3c-hci/hci_quirks.c
diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
index ae5b1a144506..9fc142ca7532 100644
--- a/drivers/i3c/master/mipi-i3c-hci/core.c
+++ b/drivers/i3c/master/mipi-i3c-hci/core.c
@@ -784,6 +784,10 @@ static int i3c_hci_init(struct i3c_hci *hci)
return ret;
}
+ /* Configure OD and PP timings for AMD platforms */
+ if (hci->quirks & HCI_QUIRK_AMD_OD_PP_TIMING)
+ amd_set_od_pp_timing(hci);
+
return 0;
}
diff --git a/drivers/i3c/master/mipi-i3c-hci/hci.h b/drivers/i3c/master/mipi-i3c-hci/hci.h
index 56361adbcc14..f4ec6dcb2ecf 100644
--- a/drivers/i3c/master/mipi-i3c-hci/hci.h
+++ b/drivers/i3c/master/mipi-i3c-hci/hci.h
@@ -140,6 +140,7 @@ struct i3c_hci_dev_data {
/* list of quirks */
#define HCI_QUIRK_RAW_CCC BIT(1) /* CCC framing must be explicit */
#define HCI_QUIRK_AMD_PIO_MODE BIT(2) /* Set PIO mode for AMD platforms */
+#define HCI_QUIRK_AMD_OD_PP_TIMING BIT(3) /* Set OD and PP timings for AMD platforms */
/* global functions */
@@ -148,5 +149,6 @@ void mipi_i3c_hci_pio_reset(struct i3c_hci *hci);
void mipi_i3c_hci_dct_index_reset(struct i3c_hci *hci);
void amd_i3c_hci_quirks_init(struct i3c_hci *hci);
+void amd_set_od_pp_timing(struct i3c_hci *hci);
#endif
diff --git a/drivers/i3c/master/mipi-i3c-hci/hci_quirks.c b/drivers/i3c/master/mipi-i3c-hci/hci_quirks.c
new file mode 100644
index 000000000000..9d8c5eedc8cc
--- /dev/null
+++ b/drivers/i3c/master/mipi-i3c-hci/hci_quirks.c
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * AMD SOC I3C HCI quirks
+ *
+ * Copyright 2024 Advanced Micro Devices, Inc.
+ *
+ * Authors: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
+ * Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>
+ */
+
+#include <linux/i3c/master.h>
+#include "hci.h"
+
+/* Timing registers */
+#define HCI_SCL_I3C_OD_TIMING 0x214
+#define HCI_SCL_I3C_PP_TIMING 0x218
+#define HCI_SDA_HOLD_SWITCH_DLY_TIMING 0x230
+
+/* Timing values to configure 9MHz frequency */
+#define AMD_SCL_I3C_OD_TIMING 0x00cf00cf
+#define AMD_SCL_I3C_PP_TIMING 0x00160016
+
+void amd_i3c_hci_quirks_init(struct i3c_hci *hci)
+{
+ if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
+ hci->quirks |= HCI_QUIRK_AMD_PIO_MODE;
+ hci->quirks |= HCI_QUIRK_AMD_OD_PP_TIMING;
+ }
+}
+
+void amd_set_od_pp_timing(struct i3c_hci *hci)
+{
+ u32 data;
+
+ reg_write(HCI_SCL_I3C_OD_TIMING, AMD_SCL_I3C_OD_TIMING);
+ reg_write(HCI_SCL_I3C_PP_TIMING, AMD_SCL_I3C_PP_TIMING);
+ data = reg_read(HCI_SDA_HOLD_SWITCH_DLY_TIMING);
+ /* Configure maximum TX hold time */
+ data |= W0_MASK(18, 16);
+ reg_write(HCI_SDA_HOLD_SWITCH_DLY_TIMING, data);
+}
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 4/5] i3c: mipi-i3c-hci: Add a quirk to set timing parameters
2024-07-23 17:35 ` [PATCH 4/5] i3c: mipi-i3c-hci: Add a quirk to set timing parameters Shyam Sundar S K
@ 2024-07-24 2:18 ` kernel test robot
2024-07-24 2:41 ` kernel test robot
1 sibling, 0 replies; 8+ messages in thread
From: kernel test robot @ 2024-07-24 2:18 UTC (permalink / raw)
To: Shyam Sundar S K, Alexandre Belloni, Jarkko Nikula
Cc: llvm, oe-kbuild-all, Guruvendra Punugupati, Krishnamoorthi M,
linux-i3c, linux-kernel, Shyam Sundar S K
Hi Shyam,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.10 next-20240723]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Shyam-Sundar-S-K/i3c-mipi-i3c-hci-Add-MIPI0100-ACPI-ID-to-the-I3C-Support-List/20240724-013958
base: linus/master
patch link: https://lore.kernel.org/r/20240723173538.3493935-5-Shyam-sundar.S-k%40amd.com
patch subject: [PATCH 4/5] i3c: mipi-i3c-hci: Add a quirk to set timing parameters
config: x86_64-buildonly-randconfig-004-20240724 (https://download.01.org/0day-ci/archive/20240724/202407240917.PpEicOHG-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240724/202407240917.PpEicOHG-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407240917.PpEicOHG-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/i3c/master/mipi-i3c-hci/hci_quirks.c:35:2: error: call to undeclared function 'writel'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
35 | reg_write(HCI_SCL_I3C_OD_TIMING, AMD_SCL_I3C_OD_TIMING);
| ^
drivers/i3c/master/mipi-i3c-hci/hci.h:30:26: note: expanded from macro 'reg_write'
30 | #define reg_write(r, v) writel(v, hci->base_regs + (r))
| ^
>> drivers/i3c/master/mipi-i3c-hci/hci_quirks.c:37:9: error: call to undeclared function 'readl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
37 | data = reg_read(HCI_SDA_HOLD_SWITCH_DLY_TIMING);
| ^
drivers/i3c/master/mipi-i3c-hci/hci.h:29:22: note: expanded from macro 'reg_read'
29 | #define reg_read(r) readl(hci->base_regs + (r))
| ^
2 errors generated.
vim +/writel +35 drivers/i3c/master/mipi-i3c-hci/hci_quirks.c
30
31 void amd_set_od_pp_timing(struct i3c_hci *hci)
32 {
33 u32 data;
34
> 35 reg_write(HCI_SCL_I3C_OD_TIMING, AMD_SCL_I3C_OD_TIMING);
36 reg_write(HCI_SCL_I3C_PP_TIMING, AMD_SCL_I3C_PP_TIMING);
> 37 data = reg_read(HCI_SDA_HOLD_SWITCH_DLY_TIMING);
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 4/5] i3c: mipi-i3c-hci: Add a quirk to set timing parameters
2024-07-23 17:35 ` [PATCH 4/5] i3c: mipi-i3c-hci: Add a quirk to set timing parameters Shyam Sundar S K
2024-07-24 2:18 ` kernel test robot
@ 2024-07-24 2:41 ` kernel test robot
1 sibling, 0 replies; 8+ messages in thread
From: kernel test robot @ 2024-07-24 2:41 UTC (permalink / raw)
To: Shyam Sundar S K, Alexandre Belloni, Jarkko Nikula
Cc: oe-kbuild-all, Guruvendra Punugupati, Krishnamoorthi M, linux-i3c,
linux-kernel, Shyam Sundar S K
Hi Shyam,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.10 next-20240723]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Shyam-Sundar-S-K/i3c-mipi-i3c-hci-Add-MIPI0100-ACPI-ID-to-the-I3C-Support-List/20240724-013958
base: linus/master
patch link: https://lore.kernel.org/r/20240723173538.3493935-5-Shyam-sundar.S-k%40amd.com
patch subject: [PATCH 4/5] i3c: mipi-i3c-hci: Add a quirk to set timing parameters
config: arm-randconfig-004-20240724 (https://download.01.org/0day-ci/archive/20240724/202407241020.dsJauFym-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240724/202407241020.dsJauFym-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407241020.dsJauFym-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/i3c/master/mipi-i3c-hci/hci_quirks.c: In function 'amd_i3c_hci_quirks_init':
>> drivers/i3c/master/mipi-i3c-hci/hci_quirks.c:25:13: error: 'boot_cpu_data' undeclared (first use in this function)
25 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
| ^~~~~~~~~~~~~
drivers/i3c/master/mipi-i3c-hci/hci_quirks.c:25:13: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/i3c/master/mipi-i3c-hci/hci_quirks.c:25:41: error: 'X86_VENDOR_AMD' undeclared (first use in this function); did you mean 'X86_VENDOR_ANY'?
25 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
| ^~~~~~~~~~~~~~
| X86_VENDOR_ANY
vim +/boot_cpu_data +25 drivers/i3c/master/mipi-i3c-hci/hci_quirks.c
22
23 void amd_i3c_hci_quirks_init(struct i3c_hci *hci)
24 {
> 25 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
26 hci->quirks |= HCI_QUIRK_AMD_PIO_MODE;
27 hci->quirks |= HCI_QUIRK_AMD_OD_PP_TIMING;
28 }
29 }
30
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 5/5] i3c: mipi-i3c-hci: Add a quirk to set Response buffer threshold
2024-07-23 17:35 [PATCH 0/5] Introduce initial AMD I3C HCI driver support Shyam Sundar S K
` (3 preceding siblings ...)
2024-07-23 17:35 ` [PATCH 4/5] i3c: mipi-i3c-hci: Add a quirk to set timing parameters Shyam Sundar S K
@ 2024-07-23 17:35 ` Shyam Sundar S K
4 siblings, 0 replies; 8+ messages in thread
From: Shyam Sundar S K @ 2024-07-23 17:35 UTC (permalink / raw)
To: Alexandre Belloni, Jarkko Nikula
Cc: Guruvendra Punugupati, Krishnamoorthi M, linux-i3c, linux-kernel,
Shyam Sundar S K
The current driver sets the response buffer threshold value to 1
(N+1, 2 DWORDS) in the QUEUE THRESHOLD register. However, the AMD
I3C controller only generates interrupts when the response buffer
threshold value is set to 0 (1 DWORD).
Therefore, a quirk is added to set the response buffer threshold value
to 0.
Co-developed-by: Krishnamoorthi M <krishnamoorthi.m@amd.com>
Signed-off-by: Krishnamoorthi M <krishnamoorthi.m@amd.com>
Co-developed-by: Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>
Signed-off-by: Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
drivers/i3c/master/mipi-i3c-hci/core.c | 4 ++++
drivers/i3c/master/mipi-i3c-hci/hci.h | 2 ++
drivers/i3c/master/mipi-i3c-hci/hci_quirks.c | 12 ++++++++++++
3 files changed, 18 insertions(+)
diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
index 9fc142ca7532..2da00a5b590b 100644
--- a/drivers/i3c/master/mipi-i3c-hci/core.c
+++ b/drivers/i3c/master/mipi-i3c-hci/core.c
@@ -148,6 +148,10 @@ static int i3c_hci_bus_init(struct i3c_master_controller *m)
if (ret)
return ret;
+ /* Set RESP_BUF_THLD to 0(n) to get 1(n+1) response */
+ if (hci->quirks & HCI_QUIRK_AMD_RESP_BUF_THLD)
+ amd_set_resp_buf_thld(hci);
+
reg_set(HC_CONTROL, HC_CONTROL_BUS_ENABLE);
DBG("HC_CONTROL = %#x", reg_read(HC_CONTROL));
diff --git a/drivers/i3c/master/mipi-i3c-hci/hci.h b/drivers/i3c/master/mipi-i3c-hci/hci.h
index f4ec6dcb2ecf..07b90a68ec5e 100644
--- a/drivers/i3c/master/mipi-i3c-hci/hci.h
+++ b/drivers/i3c/master/mipi-i3c-hci/hci.h
@@ -141,6 +141,7 @@ struct i3c_hci_dev_data {
#define HCI_QUIRK_RAW_CCC BIT(1) /* CCC framing must be explicit */
#define HCI_QUIRK_AMD_PIO_MODE BIT(2) /* Set PIO mode for AMD platforms */
#define HCI_QUIRK_AMD_OD_PP_TIMING BIT(3) /* Set OD and PP timings for AMD platforms */
+#define HCI_QUIRK_AMD_RESP_BUF_THLD BIT(4) /* Set resp buf thld to 0 for AMD platforms */
/* global functions */
@@ -150,5 +151,6 @@ void mipi_i3c_hci_dct_index_reset(struct i3c_hci *hci);
void amd_i3c_hci_quirks_init(struct i3c_hci *hci);
void amd_set_od_pp_timing(struct i3c_hci *hci);
+void amd_set_resp_buf_thld(struct i3c_hci *hci);
#endif
diff --git a/drivers/i3c/master/mipi-i3c-hci/hci_quirks.c b/drivers/i3c/master/mipi-i3c-hci/hci_quirks.c
index 9d8c5eedc8cc..503c81c504f1 100644
--- a/drivers/i3c/master/mipi-i3c-hci/hci_quirks.c
+++ b/drivers/i3c/master/mipi-i3c-hci/hci_quirks.c
@@ -20,11 +20,14 @@
#define AMD_SCL_I3C_OD_TIMING 0x00cf00cf
#define AMD_SCL_I3C_PP_TIMING 0x00160016
+#define QUEUE_THLD_CTRL 0xD0
+
void amd_i3c_hci_quirks_init(struct i3c_hci *hci)
{
if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
hci->quirks |= HCI_QUIRK_AMD_PIO_MODE;
hci->quirks |= HCI_QUIRK_AMD_OD_PP_TIMING;
+ hci->quirks |= HCI_QUIRK_AMD_RESP_BUF_THLD;
}
}
@@ -39,3 +42,12 @@ void amd_set_od_pp_timing(struct i3c_hci *hci)
data |= W0_MASK(18, 16);
reg_write(HCI_SDA_HOLD_SWITCH_DLY_TIMING, data);
}
+
+void amd_set_resp_buf_thld(struct i3c_hci *hci)
+{
+ u32 data;
+
+ data = reg_read(QUEUE_THLD_CTRL);
+ data = data & ~W0_MASK(15, 8);
+ reg_write(QUEUE_THLD_CTRL, data);
+}
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread