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

From: Manikandan.M

Date: Mon Mar 16 2026 - 02:36:32 EST


On 12/03/26 11:22 pm, Conor Dooley wrote:
> On Thu, Mar 12, 2026 at 11:29:25AM +0200, Adrian Hunter wrote:
>> On 12/03/2026 06:20, 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.
>>> Introduce MCHP_I3C_CLK_IDX to define the maximum peripheral
>>> clock index
>>>
>>> Signed-off-by: Manikandan Muralidharan <manikandan.m@xxxxxxxxxxxxx>
>>> ---
>>> 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 | 4 ++++
>>> 2 files changed, 16 insertions(+)
>>>
>>> diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
>>> index 5879bba78164..6b7716bd517e 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>
>>> @@ -918,6 +919,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);
>>> @@ -946,6 +948,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);
>>> + if (ret < MCHP_I3C_CLK_IDX)
>>
>> Is MCHP_I3C_CLK_IDX really needed? Why not just:
>>
>> if (ret <= 0)
>>
>> i.e. don't you anyway have to assume DT has the clocks defined
>> correctly.
>
> Ye, I think this is kinda silly. Trust dtbs_check to have the correct
> number for your platform set, and let this be specific.

Thank you Adrian and Conor
I will drop MCHP_I3C_CLK_IDX in the next version.

--
Thanks and Regards,
Manikandan M.