From patchwork Sat Dec 18 21:11:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 12696776 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 4CCE0C433F5 for ; Sat, 18 Dec 2021 21:14:29 +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=8jQfrC6z98GO8NQrCmS6E1ABx9cBrD4sKvhvi+7wU9Y=; b=iXIH9O0UqYpyiL 8HpN8m5SSD2kqoxcDMXMk9kkyTPGtzVZMkTDwkF+ZAPoqaxz8ymZRt0R9B7uQ0V1PVg4vKP2yGU/X L2y3RluSNqGf1B1Cj3KNqgd+uX25+2qliVBkFcrIyQPMZnm0afJeDOb1r4vllF0t7a0baypy4U5+h uxR2osOw4LL/bxBGa31pXvaVCqgIihS1NG4dZc9JND+V/Tr8eOGuQ3Pu5QhwpAkBN+Yqpy54R5LaX 1qPcIDXQ8Ip7ZRbV+OxD2Llw6Bf6iD4E37YR3sIo7zYKW4YNH0NTBEJmxyhozUirzJFY7aiavYLMd FKwvO3IwKknj47kG5uXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1myh0q-00EhdT-Sp; Sat, 18 Dec 2021 21:13:05 +0000 Received: from st43p00im-zteg10073401.me.com ([17.58.63.181]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1myh0Y-00EhaK-88 for linux-arm-kernel@lists.infradead.org; Sat, 18 Dec 2021 21:12:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1639861965; bh=+YMWyQxZRZQ4V22bDB1Agjy3ewz23mq9HAIfzWu7EnI=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=D8Nf3KegojRDRiKXLOGYu+SUfgOICJRzWclDGyVJ2V+VSEoZGsqlPuAG4CZeABjqP 9sX/I5wJGeW2AjZ/eUYcI3uOWklTDPHhmJtIxx8fQb9cfsabLDgjDiSN/LvbjWsgsu +2774kweJZsYgzBqug1N80YgMyhUeAnLD6kiSA62CfzQaIOVCTGliaXmj7SGLXDE0V R8aYn127n2S2OcodYkYEACWxwVn5xZ3k1AN23GDMZ2aVqEgcjQ2lZPzG5dxPz+y2+p wmFeJlOAsJEOlcaZrq1PZLhGbqfbcRQotwmD2IIsLsXOaKkJKBYteSqEEkbpNduah6 iLGnB0Jg//3Cg== Received: from localhost (101.220.150.77.rev.sfr.net [77.150.220.101]) by st43p00im-zteg10073401.me.com (Postfix) with ESMTPSA id 52E035E08E8; Sat, 18 Dec 2021 21:12:44 +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 1/2] clk: st: clkgen-fsyn: search reg within node or parent Date: Sat, 18 Dec 2021 22:11:56 +0100 Message-Id: <20211218211157.188214-2-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: =?utf-8?q?vendor=3Dfsecure_engine=3D1=2E1=2E170-?= =?utf-8?q?22c6f66c430a71ce266a39bfe25bc2903e8d5c8f=3A6=2E0=2E425=2C18=2E0?= =?utf-8?q?=2E790=2C17=2E0=2E607=2E475=2E0000000_definitions=3D2021-12-18=5F?= =?utf-8?q?07=3A2021-12-16=5F01=2C2021-12-18=5F07=2C2020-04-07=5F01_signatur?= =?utf-8?q?es=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 spamscore=0 clxscore=1015 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2112180129 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211218_131246_389197_C8B795DD X-CRM114-Status: GOOD ( 14.60 ) 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: add pr_err message when failing to get reg information drivers/clk/st/clkgen-fsyn.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c index 164285d6be97..582a22c04919 100644 --- a/drivers/clk/st/clkgen-fsyn.c +++ b/drivers/clk/st/clkgen-fsyn.c @@ -988,9 +988,18 @@ static void __init st_of_quadfs_setup(struct device_node *np, void __iomem *reg; spinlock_t *lock; + /* + * 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) - return; + if (!reg) { + reg = of_iomap(of_get_parent(np), 0); + if (!reg) { + pr_err("%s: Failed to get base address\n", __func__); + return; + } + } clk_parent_name = of_clk_get_parent_name(np, 0); if (!clk_parent_name) 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);