From patchwork Thu Dec 2 07:28:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 12694447 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 58F22C433F5 for ; Thu, 2 Dec 2021 07:31:06 +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=wX9D2ZTDRVSwdzlpWvMQZp415pTEGeliriAQ77gVEIU=; b=4IYU3JHmVjW3iZ PfWIXPYiaaRYyWjbzRKCLDEoblszyaRDyaxAD8992ejBfVzDSSzy9Rwz1fhYEBQGM0/sZKurT+qR4 Ob+D9O63uWVaf9DTetoySI7QTWvZd140gPI0gbrMaeGpmh5tdaHCoBUF6UzYxYgx910uYwN1O5gS6 7uwl2GO2VJfQOTWXIKlsKveaWWu0y1IfOiqTRN81N1+lc63h1PKNmgwmFJUF7kLtSprm9syvIODvy 1CPJi/gfAFFKjMGseSlogeYr9a5xl2aZBa66hUrCMUCNwfrE9t+zaf5AxyUwd/kdHZmumF/y0fz3Z zc0S5/BreyncSY2US/Xg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1msgX1-00BBWn-To; Thu, 02 Dec 2021 07:29:28 +0000 Received: from st43p00im-ztbu10063701.me.com ([17.58.63.178]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1msgWq-00BBUA-6j for linux-arm-kernel@lists.infradead.org; Thu, 02 Dec 2021 07:29:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1638430154; bh=0DrK59zmZ/s+Xx7NIv/Tj8gNBGopWg8sxyxeNU5Pn9U=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=JTog/7yQj4Ro+JmTU4BIzoE1xy6I3J4pIpQqTW1Rkv9gHIrAO1oB4Cw4Bw8EGkx9T DuRicDpZQ/5d82LXUJDHv/wCQrJls4RuOnuSzy7zoXuWc6670BqhIhJc4xS2NCQHfD 5kiIUre/ZTm43zRgP9XBPtPdAi4Sdv6HU4+0/k4tCqSyvX01dIyJb11uU8+LsFPudD Ygkqz70aaY0uRos0GKiKE1A9N0RAilbLDdeJ4eCq9k2vFZC0qNRIY74+bhoVqWGIDr JFJRBnyAk9jRCcBkAHk4x3EW4Bvhc9N039y6XYJzZ0e1GP7y0SN8Rqcfrr/loNArU+ BeM8Lj/4mWSuA== Received: from localhost (101.220.150.77.rev.sfr.net [77.150.220.101]) by st43p00im-ztbu10063701.me.com (Postfix) with ESMTPSA id ED4A99A07FE; Thu, 2 Dec 2021 07:29:13 +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 1/2] clk: st: clkgen-fsyn: search reg within node or parent Date: Thu, 2 Dec 2021 08:28:49 +0100 Message-Id: <20211202072850.194314-2-avolmat@me.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211202072850.194314-1-avolmat@me.com> References: <20211202072850.194314-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-01_01:2021-11-30, 2021-11-30 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2009150000 definitions=main-2112020043 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211201_232916_346303_C5D61083 X-CRM114-Status: GOOD ( 15.94 ) 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 --- drivers/clk/st/clkgen-fsyn.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c index 164285d6be97..0d41164f2c7f 100644 --- a/drivers/clk/st/clkgen-fsyn.c +++ b/drivers/clk/st/clkgen-fsyn.c @@ -988,9 +988,16 @@ 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) + return; + } clk_parent_name = of_clk_get_parent_name(np, 0); if (!clk_parent_name) From patchwork Thu Dec 2 07:28:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 12694448 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 82165C433EF for ; Thu, 2 Dec 2021 07:31:06 +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=Npbed3Rkt85fjWN7fspkI24UUjm1gM+t5QoadHteRoQ=; b=hOdK8Pghz4hVcc LpqE8Sz9h+P1rYcJtClvgitKr4jEeou4cTNo3nOOpNq4pL37PO+iTvFLzj6eTBwG7o+LFFcQ3h6Zb fNhYD+pH8xopdLBSDsLYYhCeo9etz3lD8X4sODiQdycprtwdEUt2DY/ntEmbdtVn6UzJAhN9GgBIC 0qgoCMSSvOaTT3mH9G31+2ubRJNOHBNRVPv03P31xwbWvDNdmOhnHMmq9HjJJrBCbfQseddKqKjju hZU7sMmWn4eQKzrjcHz/43D42ZDwIeA8Xgygu0f007zRohY2aDy56CXswYN3wqHBihuD/TsWkzpiu mmCOKgAWjSR2sYjcCkbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1msgXD-00BBZZ-Ml; Thu, 02 Dec 2021 07:29:39 +0000 Received: from st43p00im-ztbu10063601.me.com ([17.58.63.174]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1msgWu-00BBV7-4l for linux-arm-kernel@lists.infradead.org; Thu, 02 Dec 2021 07:29:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1638430158; bh=iKqXzBHkuZ5q5N8jiYDPWRjrVq7onkutlEoCQ2xoOx0=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=B9IPnYfVcR5cgvQEh0v2R5BbH9ctVwFQQG3bBI1XFNX/2jmg3poDroVMkL1GTSFRy Atg+I8puq5skbqNynhGyTWNKFjEQcrHOcBoPtOKKit7N97zE3u3WGIql9XW8leriDS p0NmmIQIihmMBeIDfA2td16WShujO6JMHeVh5ciobrX7BS+Rx52RSVGnY88TkTJA8A 7qAIkaXRGfCrSJ0dtVM1QzWOd9EBx7Db1corAVjR0A2JhRQL00WYszGGhxNWuF60D/ rJ7TvT9mSrlgt0W3QYIl/zgI9Ww25HzIflui4+cDs5XnsGkj/w7xP2m0kDB75MJcOC B6+REANjsUWEg== Received: from localhost (101.220.150.77.rev.sfr.net [77.150.220.101]) by st43p00im-ztbu10063601.me.com (Postfix) with ESMTPSA id D6EF77006D1; Thu, 2 Dec 2021 07:29:17 +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 2/2] clk: st: clkgen-mux: search reg within node or parent Date: Thu, 2 Dec 2021 08:28:50 +0100 Message-Id: <20211202072850.194314-3-avolmat@me.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211202072850.194314-1-avolmat@me.com> References: <20211202072850.194314-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-01=5F?= =?utf-8?q?01=3A2021-12-01=5F01=2C2021-11-30=5F09=2C2020-04-07=5F01_signatur?= =?utf-8?q?es=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=0 suspectscore=0 malwarescore=0 clxscore=1015 bulkscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2112020042 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211201_232920_277976_B300418F X-CRM114-Status: GOOD ( 15.12 ) 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 --- 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);