From patchwork Wed Aug 3 02:58:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12935138 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 4A00EC00140 for ; Wed, 3 Aug 2022 03:00:12 +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: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:In-Reply-To:References: List-Owner; bh=I4jFw0nCjPpP2ylAi+zd4hWygnH9P1o4ykQM4REnYbQ=; b=LJ+fgRCGdQrNz7 EWWR4NaF7rk06M+Zt1uQ/8muBcMi3+5Ap8O/Pkz23/4zKolcQ0YDonpJSeCsfoHkbbaozAenuxMAx fzaTHtvBcxLVMcQ6MvW3P2I6TvKc6DuffoOgFGdPivlfaNJt2shjcrkaCWD3HU9Mclx918f4fY1SU wfaRIYhu2fLCRy/FmEQxgwNKlXm/1aeeds1/Z9Ejqb4LzkPPN98KUuUOdyPDiPQ1UGo00ho6zHRJx Ac31dhDng9FSvnk6ufHGHvEPDTj58rUxMtpCYqv9q3JGxBosQnQQn6rd3DqLJ7NvmNGeJ6rskurmk LYzRw8atxA6NJ+I+TZUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJ4b6-001oQ7-Sa; Wed, 03 Aug 2022 02:59:01 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJ4b3-001oNl-Oj for linux-arm-kernel@lists.infradead.org; Wed, 03 Aug 2022 02:58:59 +0000 Received: by mail-pf1-x434.google.com with SMTP id z187so5383087pfb.12 for ; Tue, 02 Aug 2022 19:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=NkV3OzYi4AyJ1Ks2Na+Cpx7tYi6xJjC1EGQ4Lxx986g=; b=iPoOBpqGez2XdRMxsM0RUtmTarTEndBr1O0ftlGpWhKVXL0DASQM9iAVJXRH7eaOLa qzHyjAgAgESZq+xSqh2fM2c6dwTt4QEfx5lBFDo3Y6Xbf4WAeSw9E7j7h/f8sEK5BBqF 4Kf3S+5vEIYFp9E2wyCfIIyxWQbtLMRvVC3pAPlRjNev1xiSbTAUtxB7g/ebNrM67Z7Z J/iKcV7o5FPY662mVDyb6jWvyFRkHzYDjyMSY1iG8qe+CwYHz5bW6D6OPbJK662AmYnt AIU5cMJA+i/z7OLfB9GwpTZSr6AycPtG2E7jX+ilbpeXvvrjcXtQwk4W2LmC6J09KChh Wz8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=NkV3OzYi4AyJ1Ks2Na+Cpx7tYi6xJjC1EGQ4Lxx986g=; b=7WoiNY2qPZ9l734y5geIbSJsFcjYsLA85cTSp2YOBWkQ9dAtvsnfco5gpb9Fj7W88T LZI71J+lspo2R3at+EhipL3W1eNpOlQokq76loQXYDnrsFuu6Glk9w9K+Ciyeeo5sI6T wpte1mQ/5IfaTfXN/HiM6QUNQfNIDzT4ysI7o7oyZqhSpridJedwZPSqe6brPlbZ9RmJ tUv16XXhmMkMU/nK0xSs3xhruvzaoJQCoqTpC/xvJJ3fFz02wi3iR570MIixM4H71YWn XScv1XwsbvHxB0nvgH77z4HW1vpQfoMimCzKT0p0NZQnknGoNMyIzSw85dltfusobp2W 9OyQ== X-Gm-Message-State: AJIora86f44YC5968ln9nB/IjNlXPXKgqsRNZSHxxKQ7c52her6UjdFp L5c7c4TI4N4DNqWXYHbwyu4= X-Google-Smtp-Source: AA6agR573v0yHmoXGweA78VvVsbkfA9igmH4jeVqrosgwZyN3y4JAUA+PjzFaYSBRhugAnR3fJOYwg== X-Received: by 2002:a05:6a00:a93:b0:528:77d6:f660 with SMTP id b19-20020a056a000a9300b0052877d6f660mr24005567pfl.50.1659495534060; Tue, 02 Aug 2022 19:58:54 -0700 (PDT) Received: from localhost.localdomain (ip72-194-116-95.oc.oc.cox.net. [72.194.116.95]) by smtp.gmail.com with ESMTPSA id a13-20020aa78e8d000000b0052d90521d02sm4803725pfr.126.2022.08.02.19.58.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 19:58:53 -0700 (PDT) From: Florian Fainelli To: linux-clk@vger.kernel.org Cc: rafal@milecki.pl, Florian Fainelli , Michael Turquette , Stephen Boyd , Ray Jui , Scott Branden , Broadcom internal kernel review list , linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM IPROC ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] clk: iproc: Do not rely on node name for correct PLL setup Date: Tue, 2 Aug 2022 19:58:34 -0700 Message-Id: <20220803025836.107886-1-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220802_195857_850411_B99AB466 X-CRM114-Status: GOOD ( 14.67 ) 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 After commit 31fd9b79dc58 ("ARM: dts: BCM5301X: update CRU block description") a warning from clk-iproc-pll.c was generated due to a duplicate PLL name as well as the console stopped working. Upon closer inspection it became clear that iproc_pll_clk_setup() used the Device Tree node unit name as an unique identifier as well as a parent name to parent all clocks under the PLL. BCM5301X was the first platform on which that got noticed because of the DT node unit name renaming but the same assumptions hold true for any user of the iproc_pll_clk_setup() function. The first 'clock-output-names' property is always guaranteed to be unique as well as providing the actual desired PLL clock name, so we utilize that to register the PLL and as a parent name of all children clock. Fixes: 5fe225c105fd ("clk: iproc: add initial common clock support") Signed-off-by: Florian Fainelli Acked-by: Rafał Miłecki --- Rafal, This is a replacement for this patch that you checked into OpenWrt: https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/bcm53xx/patches-5.15/320-ARM-dts-BCM5301X-Switch-back-to-old-clock-nodes-name.patch;h=cee37732ab9e2ac8bc2a399a53d01b9ead756cb8;hb=HEAD drivers/clk/bcm/clk-iproc-pll.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c index 33da30f99c79..92be88eb1d11 100644 --- a/drivers/clk/bcm/clk-iproc-pll.c +++ b/drivers/clk/bcm/clk-iproc-pll.c @@ -736,6 +736,7 @@ void iproc_pll_clk_setup(struct device_node *node, const char *parent_name; struct iproc_clk *iclk_array; struct clk_hw_onecell_data *clk_data; + const char *clk_name; if (WARN_ON(!pll_ctrl) || WARN_ON(!clk_ctrl)) return; @@ -783,7 +784,12 @@ void iproc_pll_clk_setup(struct device_node *node, iclk = &iclk_array[0]; iclk->pll = pll; - init.name = node->name; + ret = of_property_read_string_index(node, "clock-output-names", + 0, &clk_name); + if (WARN_ON(ret)) + goto err_pll_register; + + init.name = clk_name; init.ops = &iproc_pll_ops; init.flags = 0; parent_name = of_clk_get_parent_name(node, 0); @@ -803,13 +809,12 @@ void iproc_pll_clk_setup(struct device_node *node, goto err_pll_register; clk_data->hws[0] = &iclk->hw; + parent_name = clk_name; /* now initialize and register all leaf clocks */ for (i = 1; i < num_clks; i++) { - const char *clk_name; memset(&init, 0, sizeof(init)); - parent_name = node->name; ret = of_property_read_string_index(node, "clock-output-names", i, &clk_name);