From patchwork Fri Jun 9 18:13:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13274271 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 BEB39C7EE45 for ; Fri, 9 Jun 2023 18:15:02 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gGGuVfn3j4LY2Tq1ZWhnc3xga/SUJZDMjMzBMiRL4Ug=; b=NpqPiT4Qe0VHRl nwM1uldBkZXm1OK9jXHoHRZXU1s8mK6+WfcZrsFAI+GCOREGDymivPYC9WjDcHZI0/ZZsBqEfbmwS WvJNpUMMC+j/uN2Q83AMBI58LVIR1b8EALyA0SYPyWFV5tf1J/+1Cid0OXuGQ8U6w0EPeV96nmhze yWbavaKrEMOywodU/VDgogYs4vtDau6b3/C8mNMQiSH2LvJzHcG2LVONEcdOgpAGywO9bGChtkL/6 5Xx339l9UNH8DKGfeProsjuafeCRLWo3YjyCyf6ut1/o6jojnmZotZtcrBL+zMJpHgsn3vno/bV1U IEckWIrAfa+bkliOt+jQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q7gd7-00Dp2J-2a; Fri, 09 Jun 2023 18:14:33 +0000 Received: from mail-io1-f45.google.com ([209.85.166.45]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q7gd0-00Doxv-0j for linux-arm-kernel@lists.infradead.org; Fri, 09 Jun 2023 18:14:27 +0000 Received: by mail-io1-f45.google.com with SMTP id ca18e2360f4ac-77acb944bdfso91470739f.0 for ; Fri, 09 Jun 2023 11:14:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686334464; x=1688926464; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W+YPUEMI65QN7DU7S8/VjzArfzenyEsCNlHNh4xFonc=; b=XkHMPYbHP1h3Jo6om4HmIyFuD5M01LsuR912UnEZydtSFKgriWzJuen+Eig49vgIFL u+Y7fRbroz7DcEylAme/M6DLmrR1uh/chEsJlg9Qh+xokBkmlXDjckgoXhNWwD9+nThl Ckl1oJqr9lHu05rd+nnBfEmnXH1gAAA/kug6Goh7rAnSrUzsmzWMgdxQmkGrEoVrbp5+ g5egDczGWx31uxvfNYcogla9/89G+lhdysdv+2ElammsU5Ja/nZ1GbHwTJFGcKHjqhvq kUVefv6JMbyXgaNxVnlBk24wDt/jlg+mceoko0dMcnglLezMJlC+4w/08NrHQqqfoIDv hnmQ== X-Gm-Message-State: AC+VfDx32zLajF76n/dd1JOPVntTrMtSDiMp847w/J3u5T8umCzZSM5C bOy6bnfw5Rq17pKWTquWlQ== X-Google-Smtp-Source: ACHHUZ4C+IBXDQp4zLtR7Kw9J1XTAY9/7wVyOEfDxyKbxhtoAD7TsbOxGxnTy5ECj4+2dLIaDXCTig== X-Received: by 2002:a05:6602:184b:b0:76c:898c:9b10 with SMTP id d11-20020a056602184b00b0076c898c9b10mr2485982ioi.0.1686334464556; Fri, 09 Jun 2023 11:14:24 -0700 (PDT) Received: from robh_at_kernel.org ([64.188.179.250]) by smtp.gmail.com with ESMTPSA id x5-20020a6bda05000000b0077024f8772esm1216735iob.51.2023.06.09.11.14.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 11:14:23 -0700 (PDT) Received: (nullmailer pid 1681131 invoked by uid 1000); Fri, 09 Jun 2023 18:14:15 -0000 From: Rob Herring Date: Fri, 09 Jun 2023 12:13:46 -0600 Subject: [PATCH v2 2/4] clk: mvebu: Use of_get_cpu_hwid() to read CPU ID MIME-Version: 1.0 Message-Id: <20230327-mvebu-clk-fixes-v2-2-8333729ee45d@kernel.org> References: <20230327-mvebu-clk-fixes-v2-0-8333729ee45d@kernel.org> In-Reply-To: <20230327-mvebu-clk-fixes-v2-0-8333729ee45d@kernel.org> To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Michael Turquette , Stephen Boyd Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org X-Mailer: b4 0.13-dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230609_111426_264685_162197B4 X-CRM114-Status: GOOD ( 18.32 ) 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 Use of_get_cpu_hwid() rather than the open coded reading of the CPU nodes "reg" property. The existing code is in fact wrong as the "reg" address cells size is 2 cells for arm64. The existing code happens to work because the DTS files are wrong as well. Signed-off-by: Rob Herring --- If the DTS files are fixed, then they will not work with the existing code. This change should work for both existing and fixed DTS files. Therefore, this should be marked for stable so that if/when the DTS files are fixed, then at least stable kernels will work. This is untested, so I didn't mark for stable. --- drivers/clk/mvebu/ap-cpu-clk.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/clk/mvebu/ap-cpu-clk.c b/drivers/clk/mvebu/ap-cpu-clk.c index 71bdd7c3ff03..d8a7a4c90d54 100644 --- a/drivers/clk/mvebu/ap-cpu-clk.c +++ b/drivers/clk/mvebu/ap-cpu-clk.c @@ -253,12 +253,12 @@ static int ap_cpu_clock_probe(struct platform_device *pdev) */ nclusters = 1; for_each_of_cpu_node(dn) { - int cpu, err; + u64 cpu; - err = of_property_read_u32(dn, "reg", &cpu); - if (WARN_ON(err)) { + cpu = of_get_cpu_hwid(dn, 0); + if (WARN_ON(cpu == OF_BAD_ADDR)) { of_node_put(dn); - return err; + return -EINVAL; } /* If cpu2 or cpu3 is enabled */ @@ -288,12 +288,12 @@ static int ap_cpu_clock_probe(struct platform_device *pdev) struct clk_init_data init; const char *parent_name; struct clk *parent; - int cpu, err; + u64 cpu; - err = of_property_read_u32(dn, "reg", &cpu); - if (WARN_ON(err)) { + cpu = of_get_cpu_hwid(dn, 0); + if (WARN_ON(cpu == OF_BAD_ADDR)) { of_node_put(dn); - return err; + return -EINVAL; } cluster_index = cpu & APN806_CLUSTER_NUM_MASK;