Re: [PATCH v4 3/5] i3c: mipi-i3c-hci: add microchip sama7d65 SoC compatible with the appropriate quirk

From: Adrian Hunter

Date: Fri Mar 20 2026 - 07:43:37 EST


On 18/03/2026 07:52, Manikandan Muralidharan wrote:
> Add support for microchip sama7d65 SoC I3C HCI master only IP
> with additional clock support to enable bulk clock acquisition
> for Microchip platforms using HCI_QUIRK_CLK_SUPPORT quirk.
>
> Signed-off-by: Manikandan Muralidharan <manikandan.m@xxxxxxxxxxxxx>
> ---
> Changes in v4:
> - Remove the clock index variable MCHP_I3C_CLK_IDX
>
> Changes in v3:
> - Make use of existing HCI_QUIRK_* code base
> - Introduce HCI_QUIRK_CLK_SUPPORT to handle/enable the required Peripheral
> and system generic clk in bulk
>
> Changes in v2:
> - Platform specific changes are integrated in the existing mipi-i3c-hci
> driver by introducing separate MCHP_HCI_QUIRK_* quirks and vendor
> specific quirk files
> ---
> drivers/i3c/master/mipi-i3c-hci/core.c | 12 ++++++++++++
> drivers/i3c/master/mipi-i3c-hci/hci.h | 1 +
> 2 files changed, 13 insertions(+)
>
> diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
> index 284f3ed7af8c..41b7737d22ac 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/core.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/core.c
> @@ -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>
> @@ -950,6 +951,7 @@ 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;
> + struct clk_bulk_data *clks;
> int irq, ret;
>
> hci = devm_kzalloc(&pdev->dev, sizeof(*hci), GFP_KERNEL);
> @@ -981,6 +983,13 @@ static int i3c_hci_probe(struct platform_device *pdev)
> if (!hci->quirks && platform_get_device_id(pdev))
> hci->quirks = platform_get_device_id(pdev)->driver_data;
>
> + if (hci->quirks & HCI_QUIRK_CLK_SUPPORT) {
> + ret = devm_clk_bulk_get_all_enabled(&pdev->dev, &clks);

AFAICT, devm_clk_bulk_get_all_enabled() could be called
unconditionally since it returns 0 if there are no clocks.
That would save introducing the quirk at all.

> + if (ret < 0)
> + return dev_err_probe(&pdev->dev, ret,
> + "Failed to get clocks\n");
> + }
> +
> ret = i3c_hci_init(hci);
> if (ret)
> return ret;
> @@ -1008,6 +1017,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 = "microchip,sama7d65-i3c-hci",
> + .data = (void *)(HCI_QUIRK_PIO_MODE | HCI_QUIRK_OD_PP_TIMING |
> + HCI_QUIRK_RESP_BUF_THLD | HCI_QUIRK_CLK_SUPPORT) },
> {},
> };
> MODULE_DEVICE_TABLE(of, i3c_hci_of_match);
> diff --git a/drivers/i3c/master/mipi-i3c-hci/hci.h b/drivers/i3c/master/mipi-i3c-hci/hci.h
> index 9ac9d0e342f4..f01b959a28d9 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/hci.h
> +++ b/drivers/i3c/master/mipi-i3c-hci/hci.h
> @@ -150,6 +150,7 @@ 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 */
> #define HCI_QUIRK_RPM_ALLOWED BIT(5) /* Runtime PM allowed */
> +#define HCI_QUIRK_CLK_SUPPORT BIT(6) /* Enable Clocks for Microchip platforms*/
>
> /* global functions */
> void mipi_i3c_hci_resume(struct i3c_hci *hci);