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)