Received: from mail-m19731109.qiye.163.com (mail-m19731109.qiye.163.com [220.197.31.109]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3C0D27381E for ; Tue, 13 Jan 2026 01:19:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.109 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768267157; cv=none; b=onKer13L3gqk9buYq9z2e5WPhTias+u531M1pVNs3UJc/7Vy6ogla5apBTOTEseLFwcOOj43KD/0TgjdueFWL3plno/gDvN1g7NHCEBfqL5MAEHCBjN8cUo+4HxSpdHFLNzeIbNqDmGTUEBvZBs2hTLN52xKE//iQ439hWO9x0k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768267157; c=relaxed/simple; bh=xiY3LP9zIYCTAkZy/9vKlMN4UPSSAycGr8pJXD+ANHQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=VZ5y5X0kxnMYtmEZxK8PVmGVbws5zaMHg1qNP1wfAX437NeTC+El11g134wGKTwYpLzWXNR9M3n5mCwcLJGYRA1XL29ljBSHPPKwfSaEQEmaeli5SFAo0VlHu5t1Yb20XZYSrAj28vt8vwW9SBnuwTJSjonk71HnvwdHs+t6BHo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com; spf=pass smtp.mailfrom=rock-chips.com; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b=QaxowZPa; arc=none smtp.client-ip=220.197.31.109 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b="QaxowZPa" Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.qiye.163.com (Hmail) with ESMTP id 306510fa3; Tue, 13 Jan 2026 09:19:02 +0800 (GMT+08:00) From: Shawn Lin To: Heiko Stuebner Cc: linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, FUKAUMI Naoki , Marco Schirrmeister , John Clark , Tianling Shen , Detlev Casanova , Shawn Lin Subject: [PATCH v2 2/3] soc: rockchip: grf: Support multiple grf to be handled Date: Tue, 13 Jan 2026 09:18:24 +0800 Message-Id: <1768267105-127385-3-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1768267105-127385-1-git-send-email-shawn.lin@rock-chips.com> References: <1768267105-127385-1-git-send-email-shawn.lin@rock-chips.com> X-HM-Tid: 0a9bb4ef564c09cckunm57b018bc34029f X-HM-MType: 1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFDSUNOT01LS0k3V1ktWUFJV1kPCRoVCBIfWUFZQx9OTFZPHkNOGUwaTE9KTB9WFRQJFh oXVRMBExYaEhckFA4PWVdZGBILWUFZTkNVSUlVTFVKSk9ZV1kWGg8SFR0UWUFZT0tIVUpLSU9PT0 hVSktLVUpCS0tZBg++ DKIM-Signature: a=rsa-sha256; b=QaxowZPaExZtETZDYZDXKoY5upq2t35H1ao8ZOEyNFK5R0lmajD3Wn8P7UphtrUgy57kSxOJs2zs9KaWqqa4QODaZYJz8zZUpOXcYXriYh2W0XtfQp8A2uZuZqgDzOwHbzdIYdE05EliNYPgWR2bJncN1hzV5rlIv5GG2U/RlCs=; s=default; c=relaxed/relaxed; d=rock-chips.com; v=1; bh=JwZQtH4LefQ9Hf367Kwy3o6RlgY6X9MovDb2pUJQktg=; h=date:mime-version:subject:message-id:from; Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Currently, only the first matched node will be handled. This leads to jtag switching broken for RK3576, as rk3576-sys-grf is found before rk3576-ioc-grf. Change the code to scan all the possible nodes to fix the problem. Fixes: e1aaecacfa13 ("soc: rockchip: grf: Add rk3576 default GRF values") Cc: Detlev Casanova Signed-off-by: Shawn Lin --- Changes in v2: - use for_each_matching_node_and_match(Heiko) drivers/soc/rockchip/grf.c | 54 +++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/soc/rockchip/grf.c b/drivers/soc/rockchip/grf.c index 8974d1c..9b36390 100644 --- a/drivers/soc/rockchip/grf.c +++ b/drivers/soc/rockchip/grf.c @@ -217,34 +217,34 @@ static int __init rockchip_grf_init(void) struct regmap *grf; int ret, i; - np = of_find_matching_node_and_match(NULL, rockchip_grf_dt_match, - &match); - if (!np) - return -ENODEV; - if (!match || !match->data) { - pr_err("%s: missing grf data\n", __func__); + for_each_matching_node_and_match(np, rockchip_grf_dt_match, &match) { + if (!of_device_is_available(np)) + continue; + if (!match || !match->data) { + pr_err("%s: missing grf data\n", __func__); + of_node_put(np); + return -EINVAL; + } + + grf_info = match->data; + + grf = syscon_node_to_regmap(np); of_node_put(np); - return -EINVAL; - } - - grf_info = match->data; - - grf = syscon_node_to_regmap(np); - of_node_put(np); - if (IS_ERR(grf)) { - pr_err("%s: could not get grf syscon\n", __func__); - return PTR_ERR(grf); - } - - for (i = 0; i < grf_info->num_values; i++) { - const struct rockchip_grf_value *val = &grf_info->values[i]; - - pr_debug("%s: adjusting %s in %#6x to %#10x\n", __func__, - val->desc, val->reg, val->val); - ret = regmap_write(grf, val->reg, val->val); - if (ret < 0) - pr_err("%s: write to %#6x failed with %d\n", - __func__, val->reg, ret); + if (IS_ERR(grf)) { + pr_err("%s: could not get grf syscon\n", __func__); + return PTR_ERR(grf); + } + + for (i = 0; i < grf_info->num_values; i++) { + const struct rockchip_grf_value *val = &grf_info->values[i]; + + pr_debug("%s: adjusting %s in %#6x to %#10x\n", __func__, + val->desc, val->reg, val->val); + ret = regmap_write(grf, val->reg, val->val); + if (ret < 0) + pr_err("%s: write to %#6x failed with %d\n", + __func__, val->reg, ret); + } } return 0; -- 2.7.4