Re: [PATCH v12 2/2] memory: mtk-smi: mt8188: Add SMI reset and clamp
From: Yong Wu (吴勇) <Yong.Wu@mediatek.com>
Date: 2026-02-13 07:38:16
Also in:
linux-arm-kernel, linux-mediatek, lkml
On Mon, 2026-01-19 at 20:05 +0800, Friday Yang wrote:
To prevent handling glitch signals during MTCMOS on/off transitions, SMI requires clamp and reset operations. Parse the reset settings for SMI LARBs and the clamp settings for the SMI Sub-Common. Register genpd callback for the SMI LARBs located in image, camera and IPE subsystems, and apply reset and clamp operations within the callback. The 'mtk_smi_device_link_common' already parses the 'mediatek,smi' property. A similar step is required to obtain the SMI Common regmap from the 'mediatek,smi' property for the clamp function. To centralize this process and avoid redundant parsing, we achieve it together. Signed-off-by: Friday Yang <redacted> --- drivers/memory/mtk-smi.c | 177 ++++++++++++++++++++++++++++++++++++- -- 1 file changed, 167 insertions(+), 10 deletions(-)
[snip]
quoted hunk ↗ jump to hunk
smi_com_dev = &smi_com_pdev->dev;@@ -611,13 +688,36 @@ static int mtk_smi_device_link_common(structdevice *dev, struct device **com_de DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS); if (!link) { dev_err(dev, "Unable to link smi-common dev\n"); - put_device(&smi_com_pdev->dev); - return -ENODEV; + ret = -ENODEV; + goto err_put_device; } *com_dev = smi_com_dev; + if (require_clamp) { + larb = dev_get_drvdata(dev); + larb_gen = larb->larb_gen; + larbid = larb->larbid; + larb->smi_comm_in_port_id = larb_gen-quoted
clamp_port[larbid];+ larb->smi_comm_syscon = syscon_node_to_regmap(smi_com_node); + if (IS_ERR(larb->smi_comm_syscon)) { + dev_err(dev, "Failed to get smi syscon for larb %d\n", larbid); + ret = PTR_ERR(larb->smi_comm_syscon); + larb->smi_comm_syscon = NULL; + goto err_remove_link; + } + }
sorry for the late reply. It looks strange to put this part in this device_link function. If we want to avoid re-parse the "mediatek,smi" phandle, save the "smi_com_node" to a variable, then move this part into the below mtk_smi_larb_parse_reset. Thanks.