Re: [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sep 24, 2024 at 07:15:44 -0500, Nishanth Menon wrote:
> On 15:20-20240924, Dhruva Gole wrote:
> [...]
> > 
> > I am sorry that this breaks compatibility with older AM625 devicetree.
> > However, the old devicetree was marking the entire wkup_conf as "syscon",
> > "simple-mfd" which was wrong and needed to be fixed.
> > 
> > This series finally tries to bring order to DT and the driver.
> > 
> > However, if there is still any way to maintain the backward
> > compatibility, then I am open to suggestions. Please try
> > and understand here that the ask for backward compatibility here
> > is to ask the driver to support a case where the register offset itself
> > was to be picked from a different node. I am not sure if there's any
> > cleaner way to do this.
> 
> 
> Have you tried to handle this with quirks? I am not in favor of breaking
> backward compatibility.

I was thinking of something on those lines, but quirks makes sense for
the case that there's a quirky behaviour in the SoC itself. Here it
seems to me that we are adding a quirk to handle quirk in some old devicetree.

There's no way to detect the devicetree version or somehow distinguish
within the driver if it's an old or a new DT. One way I could think of
is on these lines:

8<---------------------------------------------------------------------------
diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
index 870ab0b376c1..e1b22c5d4ab8 100644
--- a/drivers/cpufreq/ti-cpufreq.c
+++ b/drivers/cpufreq/ti-cpufreq.c
@@ -93,6 +93,7 @@ struct ti_cpufreq_soc_data {
        bool multi_regulator;
 /* Backward compatibility hack: Might have missing syscon */
 #define TI_QUIRK_SYSCON_MAY_BE_MISSING 0x1
+#define TI_QUIRK_SYSCON_MAY_BE_INCORRECT       0x2
        u8 quirks;
 };

@@ -317,6 +318,7 @@ static struct ti_cpufreq_soc_data am625_soc_data = {
        .efuse_mask = 0x07c0,
        .efuse_shift = 0x6,
        .multi_regulator = false,
+       .quirks = TI_QUIRK_SYSCON_MAY_BE_INCORRECT,
 };

 static struct ti_cpufreq_soc_data am62a7_soc_data = {
@@ -349,6 +351,9 @@ static int ti_cpufreq_get_efuse(struct
ti_cpufreq_data *opp_data,
        u32 efuse;
        int ret;

+       if (opp_data->soc_data->quirks & TI_QUIRK_SYSCON_MAY_BE_INCORRECT )
+               opp_data->soc_data->efuse_offset = 0x0018;
+
        ret = regmap_read(opp_data->syscon,
opp_data->soc_data->efuse_offset,
                          &efuse);
        if (opp_data->soc_data->quirks & TI_QUIRK_SYSCON_MAY_BE_MISSING
&& ret == -EIO) {

---------------------------------------------------------------------------->8

Then, additionally read the soc_data->syscon value, compare it against
some hard coded value to check if the address needs the 0x0018 offset or
not... All this feels extremely hackish and hence I was against doing
this.

Am I missing some other obvious way to distinguish between old/new DT? I
don't suppose we can just go ahead and create a new binding just for
this.

-- 
Best regards,
Dhruva Gole
Texas Instruments Incorporated




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux