From patchwork Sat Dec 18 21:11:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 12696777 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 78951C433F5 for ; Sat, 18 Dec 2021 21:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Cmv492yA1xvMd0d7NvoA03lISfYOqYTGqFSOqjN4RpI=; b=Y86qw9enEqAW0M VpqfVzzvzGKCOvU33m9EWBBdgpOi15utjKZ5ddTQa/XHSjwEnrFOAdrPPLYlzC7LviVerj0voYDKa Q7jyYdUn4rn+gxOazkto0t8las/VsJSGj2jvb+FlKp/jpJjUthAduXXz2WcALnIOh/oyhOIVocXyj BbmlHXwvRM/OWrJVC15QzgwjC/4aZl4+MLPAJTJZf/Keun/h3KvbB3hh4jdPQC1Tvbm1Z8Wdd0hk5 Q/0YmueL97Ww5ttoCFS3A4r7Ncs92PN+Cn2yinLMi+bCXCItqJjexSdhY+ycSN5JKU0V72QjqzGmt zSbxW4JuqjTnnjV1WqZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1myh10-00Ehff-I8; Sat, 18 Dec 2021 21:13:14 +0000 Received: from st43p00im-zteg10062001.me.com ([17.58.63.166]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1myh0c-00Ehb7-E9 for linux-arm-kernel@lists.infradead.org; Sat, 18 Dec 2021 21:12:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1639861969; bh=v0/e1LR3GG6zYqcCoBHl7uIVUQ4dGVk6xV1W5S/bfJc=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=RF17Z9+pzbKvz0uZtf8HS8CPwLe3cazlZ0DIf8jVcvVr6bUEzA5IdZox8wjT1wZUJ owcMoxR/zFzbakpqtZvYQI10zEVr5PcEoWczBt9fD1IAUtYDoIiCWLcS8oWL/2vMdZ K6f2fd5Iaznic5iEwk1rROuMi6gWJxnmhfH4clOUYt8yc01ruN9hBiOcaGe7KKCuTV Zfqkqw6NlHmFM/YcJ8Qv6KZmpzPYtR+o/NCAtPVSJcTN54TAKJ0UBnsIA8JFDcOzeF xesu/yBMob4aQE3/1KpuOb9wfDyfJ4D2WlOx99m9iMRvVRZwsJhJc9hfI4r4f8aVK/ VYax2WosbHuBA== Received: from localhost (101.220.150.77.rev.sfr.net [77.150.220.101]) by st43p00im-zteg10062001.me.com (Postfix) with ESMTPSA id 779D080077C; Sat, 18 Dec 2021 21:12:48 +0000 (UTC) From: Alain Volmat To: Michael Turquette , Stephen Boyd , Rob Herring , Patrice Chotard Cc: Lee Jones , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Alain Volmat Subject: [PATCH v2 2/2] clk: st: clkgen-mux: search reg within node or parent Date: Sat, 18 Dec 2021 22:11:57 +0100 Message-Id: <20211218211157.188214-3-avolmat@me.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211218211157.188214-1-avolmat@me.com> References: <20211218211157.188214-1-avolmat@me.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.425, 18.0.790 definitions=2021-12-18_08:2021-12-15, 2021-12-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2009150000 definitions=main-2112180129 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211218_131250_571515_F02809D8 X-CRM114-Status: GOOD ( 16.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In order to avoid having duplicated addresses within the DT, only have one unit-address per clockgen and each driver within the clockgen should look at the parent node (overall clockgen) to figure out the reg property. Such behavior is already in place in other STi platform clock drivers such as clk-flexgen and clkgen-pll. Keep backward compatibility by first looking at reg within the node before looking into the parent node. Signed-off-by: Alain Volmat Reviewed-by: Patrice Chotard --- v2: identical to v1 drivers/clk/st/clkgen-mux.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/clk/st/clkgen-mux.c b/drivers/clk/st/clkgen-mux.c index ce583ded968a..ee39af7a0b72 100644 --- a/drivers/clk/st/clkgen-mux.c +++ b/drivers/clk/st/clkgen-mux.c @@ -57,10 +57,17 @@ static void __init st_of_clkgen_mux_setup(struct device_node *np, const char **parents; int num_parents = 0; + /* + * First check for reg property within the node to keep backward + * compatibility, then if reg doesn't exist look at the parent node + */ reg = of_iomap(np, 0); if (!reg) { - pr_err("%s: Failed to get base address\n", __func__); - return; + reg = of_iomap(of_get_parent(np), 0); + if (!reg) { + pr_err("%s: Failed to get base address\n", __func__); + return; + } } parents = clkgen_mux_get_parents(np, &num_parents);