Re: [PATCH v2 1/2] soc: samsung: exynos-pmu: Add regmap support for SoCs that protect PMU regs

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

 



On 01/02/2024 12:29, Peter Griffin wrote:
>>>       int ret;
>>>
>>>       pmu_base_addr = devm_platform_ioremap_resource(pdev, 0);
>>> @@ -137,6 +333,35 @@ static int exynos_pmu_probe(struct platform_device *pdev)
>>>                       GFP_KERNEL);
>>>       if (!pmu_context)
>>>               return -ENOMEM;
>>> +
>>> +     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> +     if (!res)
>>> +             return -ENODEV;
>>> +
>>> +     pmuregmap_config.max_register = resource_size(res) -
>>> +                                  pmuregmap_config.reg_stride;
>>> +
>>> +     if (of_device_is_compatible(np, "google,gs101-pmu")) {
>>
>> No compatibles inside the probe. Use driver match data. This applies to
>> all drivers in all subsystems.
> 
> Noted, will fix in v3.
> 
>>
>>> +             pmuregmap_config.reg_read = tensor_sec_reg_read;
>>> +             pmuregmap_config.reg_write = tensor_sec_reg_write;
>>> +             pmuregmap_config.reg_update_bits = tensor_sec_update_bits;
>>
>> No, regmap_config should be const and please use match data.
> 
> Are you sure you want the regmap_config struct const?
> 
> In my draft v3 I have implemented it so far having a regmap_smccfg
> struct which sets all the configuration apart from max_register field
> (used by gs101) and a regmap_mmiocfg struct (used by all other
> exynos-pmu SoCs). The choice over which regmap_config to register is
> made via match data exynos_pmu_data flag 'pmu_secure' which is set
> only for gs101. That avoids having to define exynos_pmu_data structs
> for the other exynos SoCs that currently don't really need them
> (exynos7, exynos850, exynos5443, exyno5410 etc).
> 
> But I still wish to set at runtime the regmap_config.max_register
> field based on the resource size coming from DT. Having the structs
> const would prohibit that and mean we need to specify many more
> regmap_config structs where the only difference is the max_register
> field.
> 
> Is the above approach acceptable for you?

Having it non-const is one more step of supporting only one instance of
PMU device, but we already rely on such design choice, so I guess it is
fine. If ever needed, this can be easily converted to devm_kmemdup...


Best regards,
Krzysztof





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux