[PATCH v2 2/2] memory: mtk-smi: mt8188: Add SMI clamp function

Krzysztof Kozlowski krzk at kernel.org
Fri Nov 22 01:59:27 PST 2024


On 22/11/2024 10:41, Friday Yang (杨阳) wrote:
> On Wed, 2024-11-20 at 08:49 +0100, Krzysztof Kozlowski wrote:
>> External email : Please do not click links or open attachments until
>> you have verified the sender or the content.
>>
>>
>> On 20/11/2024 07:36, Friday Yang wrote:
>>> In order to avoid handling glitch signal when MTCMOS on/off, SMI
>>> need
>>> clamp and reset operation. Parse power reset settings for LARBs
>>> which
>>> need to reset. Register genpd callback for SMI LARBs and apply
>>> reset
>>> operations in the callback.
>>>
>>> Signed-off-by: Friday Yang <friday.yang at mediatek.com>
>>> ---
>>>  drivers/memory/mtk-smi.c | 175
>>> ++++++++++++++++++++++++++++++++++++++-
>>>  1 file changed, 171 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
>>> index 2bc034dff691..c7119f655350 100644
>>> --- a/drivers/memory/mtk-smi.c
>>> +++ b/drivers/memory/mtk-smi.c
>>> @@ -10,15 +10,21 @@
>>>  #include <linux/err.h>
>>>  #include <linux/io.h>
>>>  #include <linux/iopoll.h>
>>> +#include <linux/mfd/syscon.h>
>>
>> Where do you use it?
> 
> device_node_to_regmap need this header file.

Ah, indeed, but then I wonder why you parse phandle instead of using
standard syscon API: syscon_regmap_lookup_by_phandle().


> 
>>
>>>  #include <linux/module.h>
>>>  #include <linux/of.h>
>>>  #include <linux/of_platform.h>
>>>  #include <linux/platform_device.h>
>>> +#include <linux/pm_domain.h>
>>
>> Where do you use it?
> 
> dev_pm_genpd_add_notifier need this header file.

ack

> 
>>
>>>  #include <linux/pm_runtime.h>
>>> +#include <linux/regmap.h>
>>
>> Where do you use it?
> 
> regmap_write need this header file.

ack

> 
>>
>>> +#include <linux/reset.h>
>>> +#include <linux/reset-controller.h>
>>>  #include <linux/soc/mediatek/mtk_sip_svc.h>
>>>  #include <soc/mediatek/smi.h>
>>>  #include <dt-bindings/memory/mt2701-larb-port.h>
>>>  #include <dt-bindings/memory/mtk-memory-port.h>
>>> +#include <dt-bindings/reset/mt8188-resets.h>
>>>
>>
>> ...
> 
> reset_control_reset/devm_reset_control_get need reset.h
> But reset-controller.h could be removed.
> MT8188_SMI_RST_LARB10 and other index need mt8188-resets.h 
> 
>>
>>>
>>> +static int mtk_smi_larb_parse_clamp_info(struct mtk_smi_larb
>>> *larb)
>>> +{
>>> +     struct device *dev = larb->dev;
>>> +     const struct mtk_smi_larb_gen *larb_gen = larb->larb_gen;
>>> +     struct device_node *smi_node;
>>> +     struct of_phandle_args args;
>>> +     int ret, index;
>>> +
>>> +     /* Only SMI LARBs located in camera and image subsys need to
>>
>> Use Linux coding style.
> 
> Sorry for the mistake, I will fix it.
> 
>>
>>> +      * apply clamp and reset operation, others can be skipped.
>>> +      */
>>> +     ret = of_parse_phandle_with_fixed_args(dev->of_node,
>>> +                                            "resets", 1, 0,
>>> &args);
>>
>> NAK
>>
>>> +     if (ret)
>>> +             return 0;
>>> +
>>> +     smi_node = of_parse_phandle(dev->of_node, "mediatek,smi", 0);
>>> +     if (!smi_node)
>>> +             return -EINVAL;
>>> +
>>> +     index = args.args[0];
>>
>> That's reset, not clamp port. NAK.
> 
> I could change from 'clamp_port' to 'reset_port'.
> This index is used for getting the port id from the array
> 'mtk_smi_larb_clamp_port_mt8188 ' in SMI driver.

Index is for reset, not for port ID.

> It could also be used for getting the reset signal in
> SMI reset controller driver.
> 

Look at my comments from previous version - they were not under reset
property. The argument for reset is for reset provider, not this reset
consumer.

BTW, when you link to previous versions of patchset, link to lore, not
patchwork. Or just use b4.

Best regards,
Krzysztof



More information about the Linux-mediatek mailing list