devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Friday Yang (杨阳)" <Friday.Yang@mediatek.com>
To: "robh@kernel.org" <robh@kernel.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"krzk@kernel.org" <krzk@kernel.org>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>
Cc: "p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Yong Wu (吴勇)" <Yong.Wu@mediatek.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 3/4] memory: mtk-smi: mt8188: Add SMI clamp function
Date: Thu, 24 Oct 2024 01:29:13 +0000	[thread overview]
Message-ID: <cdbac20d7a49ff2fbd3e6d4f24ae441ffbe87f05.camel@mediatek.com> (raw)
In-Reply-To: <25b487b7-63e0-402d-a0a2-ed9d03e82630@kernel.org>

On Wed, 2024-08-21 at 11:00 +0200, Krzysztof Kozlowski wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  On 21/08/2024 10:26, 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@mediatek.com>
> > ---
> >  drivers/memory/mtk-smi.c | 148
> ++++++++++++++++++++++++++++++++++++++-
> >  1 file changed, 146 insertions(+), 2 deletions(-)
> > 
> 
> ...
> 
> > +
> > +static int mtk_smi_larb_parse_reset_info(struct mtk_smi_larb
> *larb)
> > +{
> > +struct device_node *reset_node;
> > +struct device *dev = larb->dev;
> > +int ret;
> > +
> > +/* only larb with "resets" need to get reset setting */
> > +reset_node = of_parse_phandle(dev->of_node, "resets", 0);
> 
> Nope, you do not parse rasets.

1.If I need to use the Linux reset control framework, 'resets' is the
required property.
2.'reset-names' give the list of reset signal name strings sorted in
the same order as the 'resets' property. SMI driver will use 'reset-
names' to match reset signal names with reset specifiers.
3.Not all SMI larbs need to apply reset operations, only SMI larbs
which may have bus glitch issues need this. Just to confirm if this
larb support reset function.

> 
> > +if (!reset_node)
> > +return 0;
> > +of_node_put(reset_node);
> > +
> > +larb->rst_con = devm_reset_control_get(dev, "larb_rst");
> 
> Where are the bindings? Why do you add undocumented properties? How
> possible this passes dtbs_check???
> 

This is not the new added property in SMI larb DT node.
It is the reset signal name which is inclued in 'reset-names'.
Just like this:

resets = <&imgsys1_dip_nr_rst MT8188_SIM_RST_LARB15>;
reset-name = 'larb_rst';

Maybe I can add this name to the 'reset-name' property binding
description, like this, is this clear for you?

reset-name:
    const: larb_rst
    description: the name of reset signal. SMI driver need to obtain 		
 the reset controller based on this.

> 
> > +if (IS_ERR(larb->rst_con))
> > +return dev_err_probe(dev, PTR_ERR(larb->rst_con),
> > +     "cannot get larb reset controller\n");
> > +
> > +larb->nb.notifier_call = mtk_smi_genpd_callback;
> > +ret = dev_pm_genpd_add_notifier(dev, &larb->nb);
> > +if (ret) {
> > +dev_err(dev, "Failed to add genpd callback %d\n", ret);
> > +return -EINVAL;
> > +}
> > +
> > +return 0;
> > +}
> > +
> >  static int mtk_smi_larb_probe(struct platform_device *pdev)
> >  {
> >  struct mtk_smi_larb *larb;
> > @@ -538,6 +662,7 @@ static int mtk_smi_larb_probe(struct
> platform_device *pdev)
> >  if (!larb)
> >  return -ENOMEM;
> >  
> > +larb->dev = dev;
> >  larb->larb_gen = of_device_get_match_data(dev);
> >  larb->base = devm_platform_ioremap_resource(pdev, 0);
> >  if (IS_ERR(larb->base))
> > @@ -554,15 +679,29 @@ static int mtk_smi_larb_probe(struct
> platform_device *pdev)
> >  if (ret < 0)
> >  return ret;
> >  
> > -pm_runtime_enable(dev);
> > +/* find sub common to clamp larb for ISP software reset */
> > +ret = mtk_smi_larb_parse_clamp_info(larb);
> > +if (ret) {
> > +dev_err(dev, "Failed to get clamp setting for larb\n");
> > +goto err_pm_disable;
> > +}
> > +
> > +ret = mtk_smi_larb_parse_reset_info(larb);
> > +if (ret) {
> > +dev_err(dev, "Failed to get power setting for larb\n");
> > +goto err_pm_disable;
> > +}
> > +
> >  platform_set_drvdata(pdev, larb);
> >  ret = component_add(dev, &mtk_smi_larb_component_ops);
> >  if (ret)
> >  goto err_pm_disable;
> > +
> > +pm_runtime_enable(dev);
> > +
> >  return 0;
> >  
> >  err_pm_disable:
> > -pm_runtime_disable(dev);
> >  device_link_remove(dev, larb->smi_common_dev);
> 
> Label asls pm disable. Where is the pm disable?
> 

Thanks, I will fix it to 'err_link_remove'.

> >  return ret;
> >  }
> > @@ -686,6 +825,10 @@ static const struct mtk_smi_common_plat
> mtk_smi_common_mt8188_vpp = {
> >  .init     = mtk_smi_common_mt8195_init,
> >  };
> 
> Best regards,
> Krzysztof
> 

  reply	other threads:[~2024-10-24  1:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21  8:26 [PATCH 0/4] Add SMI clamp and reset friday.yang
2024-08-21  8:26 ` [PATCH 1/4] dt-bindings: memory: mediatek: Add mt8188 SMI reset control binding friday.yang
2024-08-21  8:54   ` Krzysztof Kozlowski
2024-10-24  1:28     ` Friday Yang (杨阳)
2024-08-21  9:28   ` Krzysztof Kozlowski
2024-08-22  8:05     ` Krzysztof Kozlowski
2024-08-21  8:26 ` [PATCH 2/4] dt-bindings: memory: mediatek: Add smi-sub-common property for reset friday.yang
2024-08-21  8:55   ` Krzysztof Kozlowski
2024-10-24  1:28     ` Friday Yang (杨阳)
2024-10-24  6:38       ` Krzysztof Kozlowski
2024-10-25  9:32         ` Friday Yang (杨阳)
2024-10-24 11:59       ` AngeloGioacchino Del Regno
2024-10-25  9:33         ` Friday Yang (杨阳)
2024-08-21  8:26 ` [PATCH 3/4] memory: mtk-smi: mt8188: Add SMI clamp function friday.yang
2024-08-21  9:00   ` Krzysztof Kozlowski
2024-10-24  1:29     ` Friday Yang (杨阳) [this message]
2024-10-24 11:56       ` AngeloGioacchino Del Regno
2024-10-25  9:33         ` Friday Yang (杨阳)
2024-10-29  6:32       ` Krzysztof Kozlowski
2024-08-21  8:26 ` [PATCH 4/4] reset: mediatek: Add reset control driver for SMI friday.yang
2024-08-21  8:58   ` Krzysztof Kozlowski
2024-10-24  1:29     ` Friday Yang (杨阳)
2024-10-29  6:35       ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cdbac20d7a49ff2fbd3e6d4f24ae441ffbe87f05.camel@mediatek.com \
    --to=friday.yang@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=Yong.Wu@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).