From patchwork Tue Feb 6 14:57:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 13547419 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 C4780C4829B for ; Tue, 6 Feb 2024 14:57:51 +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=Th6uekNRT5P1WumMeZSksJ/soBanwN6oqPwGW/YtACQ=; b=gDwhkY7hLfBOkq 2Eh4YPL2ryfoOIaxmwZ+NwImU/vwlzkyVQ60Q3fL0iLZGV3hyzaF69zFKsOPizF+g+Cc9MIizxMxx uk/MFj/b5WYnai7Sv0yVpdkOUBBwNL04n7pzL9sOyPooC43R0KXlUh7JtQwLqLD+5K8ac0CBRyvzL H5up7MmvhiGe56Sawrwd3O2rfD3WXbuQwhxG8MjunotLu3jF3Fx6b18JeN7QnnZEMJQxVp1WdHszG h/OTKgBcdES97aJTfM422XEfEn8Trg6o12yh/MXIgz/tDtRHrkPsI8xw6TqqNNTvN93JMdMLuxKV4 F53OBKThjl0yJ2hK0gtg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXMtK-00000007xZa-46r8; Tue, 06 Feb 2024 14:57:42 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXMtG-00000007xWz-3rkn for linux-arm-kernel@lists.infradead.org; Tue, 06 Feb 2024 14:57:40 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40fe2744e5cso4311545e9.1 for ; Tue, 06 Feb 2024 06:57:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1707231455; x=1707836255; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eDuw9+ziqpp2LTPkuprkw43SW7UlWl5m+opLAnRrync=; b=rpF+grXkUO7iHRM4YEVFNomtXxSogK/B97+JMA+CZ/WQWM3bHkCqtecTYodNF+Y24+ v8EVet2XE3igpL69jDOg1m6GddyUwgt+9f0KLaiB0hZrNReX9RyYPWZER5JSSejwdkB1 M9+wSgcLD+qNxcpWDFDteBJnVxcQHWrh5Fzg52ronF7HPhIAR9WgIL0OEcsdm5cTTFZ/ yTf6FUNF1WF2Td1evGGQ+ZZXcKGyJM+3fPdb+piLft0zLP41PS+cPGbHhsl+Wzv698Sk nmilaLFFurxLPxgHKfNwcj5PTovgL0ZrfxEHvsjlQ4PPA33P+0uRcSC1HHWvgyqjXigR EbFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707231455; x=1707836255; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eDuw9+ziqpp2LTPkuprkw43SW7UlWl5m+opLAnRrync=; b=gVDRX/XhCu4fEU5qhuOI8FHf3fHLJdCsaUonU4iCHClWkYlhyXEBrIvbxLLuCx2DYa SG9E1Q6fJLGJ0IcW/b2gbOkNg4N3QOwagsrGK1GJX9SWSX89LE7b0VNSrgRVT5CPexPO SIrtgKppGhM40qZKxGyUv3L0/ImnHkkoQtY/2wRbGoVZCCmqf+2Js6grXHPP8hIYpGIz xBr+kjA8ohNwz6SmdGQeWTkXRP+TybyCRk5Nzt+HY4a2kRxJy1T7jJKckBm3gFM5bPvO oGc7pfsGExml0ior7QASTA3dGlUjHREBF1MXCyXP/8t/LC2z/yA4XD8WxZ8rIQiT4nKO lo5A== X-Gm-Message-State: AOJu0YyqHzqEI/VYE8XUStI3Bbi8ejyeuXwZIMLwyQSeC/00FUn8HqNf YABtV39XU/8IdY7LWxaA9dWqN2stdfPPlRIdq5YOixRu8A0G1bEdzyHVZdCCN4Y= X-Google-Smtp-Source: AGHT+IFWUZhvu1Op3ONCs8HKFh7ZnxQTqJbptHCczEPX0pwjlbH/88Vtvj3qlhtauOBQnzW/yDQfnQ== X-Received: by 2002:a05:600c:4f04:b0:40f:d242:a2d2 with SMTP id l4-20020a05600c4f0400b0040fd242a2d2mr2128630wmq.12.1707231455728; Tue, 06 Feb 2024 06:57:35 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVKwo1WacIy9JzhNBPozyAsTwJu42VbiXVrShxEmsJ+b1dtuf5ptoyQ6WNCuGK9OSuUIdQwZf7mgkn40vCCv7+mDIH7y010+gQUAsPFthaYQAW9bya+1AeY+zfQC4HCkEM2Cz4p0PXA/buzoPlMlhI/6ghVIw/53ddMH9CtqxSXBYe2B3fqh0fVtpnCrc/E8suY0fdZBko1Ikz7wk8TuK8v+Celc+q+JMyQkBGb0aq3F0iHMECbtnsdm85SWUI222v8vS7j8iorWTFKyqDVtzx+SlvArOaX2CFmJXgW2wB9cRKiMRbp5bJ0IiSEzsGX2MkNp3+RdWXe9UxqPubsQdP5NyMpp16q2HmAdbd4kFTlXIgh+Rc+q996g3NuG2Vt+NPl7mqY/K1yCfEuG6zTw5UQuOQG+QmDB43zMnXu7OQ+WqoBkfKREbpPutmma3UyEzW8Z6MJPXdYggJj5f5ctJ1j3wEniQ9MziAi Received: from blmsp.fritz.box ([2001:4091:a246:821e:6f3b:6b50:4762:8343]) by smtp.gmail.com with ESMTPSA id l14-20020a05600c4f0e00b0040fc56712e8sm2257896wmq.17.2024.02.06.06.57.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 06:57:35 -0800 (PST) From: Markus Schneider-Pargmann To: Viresh Kumar , Nishanth Menon , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Vignesh Raghavendra , Tero Kristo , "Rafael J . Wysocki" Cc: Andrew Davis , Dhruva Gole , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Markus Schneider-Pargmann Subject: [PATCH 1/3] dt-bindings: cpufreq: Add nvmem-cells for chip information Date: Tue, 6 Feb 2024 15:57:19 +0100 Message-ID: <20240206145721.2418893-2-msp@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206145721.2418893-1-msp@baylibre.com> References: <20240206145721.2418893-1-msp@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240206_065738_990340_7BE364D4 X-CRM114-Status: GOOD ( 10.89 ) 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 Add nvmem-cells to describe chip information like chipvariant and chipspeed. If nvmem-cells are used, the syscon property is not necessary anymore. Signed-off-by: Markus Schneider-Pargmann Acked-by: Andrew Davis Reviewed-by: Krzysztof Kozlowski Reviewed-by: Dhruva Gole Nacked-by: Krzysztof Kozlowski --- .../bindings/opp/operating-points-v2-ti-cpu.yaml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/opp/operating-points-v2-ti-cpu.yaml b/Documentation/devicetree/bindings/opp/operating-points-v2-ti-cpu.yaml index 02d1d2c17129..b1881a0834fe 100644 --- a/Documentation/devicetree/bindings/opp/operating-points-v2-ti-cpu.yaml +++ b/Documentation/devicetree/bindings/opp/operating-points-v2-ti-cpu.yaml @@ -34,6 +34,14 @@ properties: points to syscon node representing the control module register space of the SoC. + nvmem-cells: + $ref: /schemas/types.yaml#/definitions/phandle-array + + nvmem-cell-names: + items: + - const: chipvariant + - const: chipspeed + opp-shared: true patternProperties: @@ -55,7 +63,13 @@ patternProperties: required: - compatible - - syscon + +oneOf: + - required: + - syscon + - required: + - nvmem-cells + - nvmem-cell-names additionalProperties: false From patchwork Tue Feb 6 14:57:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 13547420 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 15AF1C48297 for ; Tue, 6 Feb 2024 14:57:55 +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=Evc3hICDegBCm864jrFVf+YR/418kJmvyQhsOd1jZ3Q=; b=NsfsRO5pb2dR2w Fp0qbhCpkN4RpJd17K1uQF/XTDweaT4foHmr6hx0HhcYAH7rPurHK1hRDwrKQkGaOg/uzEvYQHQ16 qI782w4xMsDzLA68K2+siLdtcfUJ/HugiJnYJ/TgefjnBNrPJIj58YNmpSp5D+ZoQmqF05QWgAUxx Z5rA8ANI7ER4b1EcVoQY7+C2Zkfdx8UFpuCgOoTj8GbvLHzyjLUCnWlp3hoeAlW0t50GsuNewvEQo 0zCMhJkXYwvhdaVFTNg9xskEd+iUY4ffBI5cESHnYLX4JhSY52T7MWNIBF0V3wI+Hhn8c5raxIz9X 4u3d2WTCdsSenp5XqWsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXMtL-00000007xZw-35qB; Tue, 06 Feb 2024 14:57:43 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXMtG-00000007xXC-3tIX for linux-arm-kernel@lists.infradead.org; Tue, 06 Feb 2024 14:57:40 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40ff940b456so753025e9.2 for ; Tue, 06 Feb 2024 06:57:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1707231457; x=1707836257; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XdH/MMRBTUfqayVAnmhejns1JtGutpHRzA8LTWcgILQ=; b=pY2Wzr0TarCqcCu2O9asxfZ/tN4BvphBq5m76sbHyHG+FdOyuxRdKfhaVdHoqBS0lV 8yzJSTy8mkFlsKm/bSo9VvTEIdV9sCYqxsesf7QvyJqZuZu3GWCXx6hwrZuLdmwlwJBB IcG1ZD6hpXTBdx6uTdv9LKoIJ2ocKTord0jI0T8Oj8lq8pS6P9ki3mus/hy8noitaB2V R36uUS7mOmUJFY0bvcygwPJ+R89JnX7bgQbTC6tzw5GU7iPQSUyFpHdsx9LM/cWgN43n n7TadE4ukr4nJiz3y1//rCaVPn4WHoA7sxrGNAZi7tIKMkcaq7qcD8gvsbCJO2G0v7M4 r3NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707231457; x=1707836257; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XdH/MMRBTUfqayVAnmhejns1JtGutpHRzA8LTWcgILQ=; b=gPQY9ZbatEv69ncAkinZznvU19bxQvD9HFLxWyLGuLOM0zQfp2jzQuD9epsVvKpqja NfWuZlI0qdCWZcDtk7vckIdiDyYO+3gBuQuEVWDZoZUkcQXEVqNK+gu/WBr/caUoWmUC w4UMVknpIL9mU4bl22Uxl0WBHlWGJX8pz9ACgiDtdWip4eQLlihz26q11N0lImMHxnXj sACb6VCwucDCY6ycm4GcVkSdmMY2QNmINxDLqyil4N2XSEc/faW7HLIjlvZ4eOhAJxtS qjkHTZRICbcLar9ABaRST2m5JCFsUVSq0qJbDwH4oMKAUKcSiEXcHQTU9HW6kmkDKn5g 9Yfg== X-Gm-Message-State: AOJu0YyW/+y9QN6XavpoQQsVcDC75zh3EZV6PRGjoh+waae2M32dp7qq tz+U15kzHo7w5MbNyLRDSZiXR8bEZBLlnKcGArS/46nfhmHKsKTtrWg5ldDHYlo= X-Google-Smtp-Source: AGHT+IEANI1IHeJsecUK707xmJF7E4tpQM8iIUO3QCbVIvB3uiEIfJf5lxl8quWa7bhmLD1KFJ0Gpg== X-Received: by 2002:a05:600c:46ce:b0:40f:f4e0:c2c6 with SMTP id q14-20020a05600c46ce00b0040ff4e0c2c6mr402014wmo.12.1707231456795; Tue, 06 Feb 2024 06:57:36 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVtBTsv+GjvgKmDiMh00jYW5nzyq5ivozfUkLVr71EUPRNMJwVsYPPrGe4+GmTAMNtbTLLLgzfqETgNFMq4IlEupzzva2xnI3fo1Ulg14Xzn+dPTOHlxLjJEPhj0LcA83m28CFlabDX47m+DM6TiEZAEnwN4B6OPHDwR3tvbffao96CM648BE0gj9C+7JKzTTpCGpPz9523uYe42JQXyLl0q/CGTgkQupU3E2Gikxz78F7d8FsHYNvFvJ/Ob+ahn36iLomPVR1aG3ovKaca1Ayeal7LJbGJ3uo+s5bNr6xD18Z0s68SzbdcpCdX0cs3kTQLggIKeVC6Eu+17BQtZT4UNy4LUaO12FJ3n8cdlc+A/X52vPZ/cGGIx2nZcjywV00iCJZtaQRHY2KWeqLP1eLDq32bEjZeoVeUDxJE0vubBZ1XSv+eJ3yFH3vvikF4tuG2Vgyc4fVMueTg7N2XqrD07MU96qbmcEtc Received: from blmsp.fritz.box ([2001:4091:a246:821e:6f3b:6b50:4762:8343]) by smtp.gmail.com with ESMTPSA id l14-20020a05600c4f0e00b0040fc56712e8sm2257896wmq.17.2024.02.06.06.57.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 06:57:36 -0800 (PST) From: Markus Schneider-Pargmann To: Viresh Kumar , Nishanth Menon , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Vignesh Raghavendra , Tero Kristo , "Rafael J . Wysocki" Cc: Andrew Davis , Dhruva Gole , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Markus Schneider-Pargmann Subject: [PATCH 2/3] cpufreq: ti-cpufreq: Support nvmem for chip version Date: Tue, 6 Feb 2024 15:57:20 +0100 Message-ID: <20240206145721.2418893-3-msp@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206145721.2418893-1-msp@baylibre.com> References: <20240206145721.2418893-1-msp@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240206_065739_002865_65B047E6 X-CRM114-Status: GOOD ( 20.87 ) 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 Support using nvmem-cells 'chipvariant' and 'chipspeed' instead of syscon. This makes it more flexible and moves more configuration into the devicetree. If nvmem-cells are present, probing will fail if the configuration of these cells is broken. If nvmem-cells is not present syscon will be used. Signed-off-by: Markus Schneider-Pargmann Reviewed-by: Dhruva Gole --- drivers/cpufreq/ti-cpufreq.c | 105 ++++++++++++++++++++++------------- 1 file changed, 66 insertions(+), 39 deletions(-) diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c index 46c41e2ca727..3ee72b1309f0 100644 --- a/drivers/cpufreq/ti-cpufreq.c +++ b/drivers/cpufreq/ti-cpufreq.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -65,6 +66,7 @@ struct ti_cpufreq_soc_data { struct ti_cpufreq_data { struct device *cpu_dev; + struct device *dev; struct device_node *opp_node; struct regmap *syscon; const struct ti_cpufreq_soc_data *soc_data; @@ -244,31 +246,40 @@ static struct ti_cpufreq_soc_data am625_soc_data = { static int ti_cpufreq_get_efuse(struct ti_cpufreq_data *opp_data, u32 *efuse_value) { + struct device_node *np = opp_data->opp_node; struct device *dev = opp_data->cpu_dev; u32 efuse; int ret; - ret = regmap_read(opp_data->syscon, opp_data->soc_data->efuse_offset, - &efuse); - if (ret == -EIO) { - /* not a syscon register! */ - void __iomem *regs = ioremap(OMAP3_SYSCON_BASE + - opp_data->soc_data->efuse_offset, 4); - - if (!regs) - return -ENOMEM; - efuse = readl(regs); - iounmap(regs); + ret = nvmem_cell_read_u32(opp_data->dev, "chipspeed", &efuse); + if (ret && (ret != -ENOENT || !opp_data->syscon)) + return dev_err_probe(dev, ret, + "Failed to read nvmem cell 'chipspeed': %pe", + ERR_PTR(ret)); + + if (ret) { + ret = regmap_read(opp_data->syscon, opp_data->soc_data->efuse_offset, + &efuse); + if (ret == -EIO) { + /* not a syscon register! */ + void __iomem *regs = ioremap(OMAP3_SYSCON_BASE + + opp_data->soc_data->efuse_offset, 4); + + if (!regs) + return -ENOMEM; + efuse = readl(regs); + iounmap(regs); + } + else if (ret) { + dev_err(dev, + "Failed to read the efuse value from syscon: %d\n", + ret); + return ret; } - else if (ret) { - dev_err(dev, - "Failed to read the efuse value from syscon: %d\n", - ret); - return ret; - } - efuse = (efuse & opp_data->soc_data->efuse_mask); - efuse >>= opp_data->soc_data->efuse_shift; + efuse = (efuse & opp_data->soc_data->efuse_mask); + efuse >>= opp_data->soc_data->efuse_shift; + } *efuse_value = opp_data->soc_data->efuse_xlate(opp_data, efuse); @@ -285,30 +296,41 @@ static int ti_cpufreq_get_efuse(struct ti_cpufreq_data *opp_data, static int ti_cpufreq_get_rev(struct ti_cpufreq_data *opp_data, u32 *revision_value) { + struct device_node *np = opp_data->opp_node; struct device *dev = opp_data->cpu_dev; u32 revision; int ret; - ret = regmap_read(opp_data->syscon, opp_data->soc_data->rev_offset, - &revision); - if (ret == -EIO) { - /* not a syscon register! */ - void __iomem *regs = ioremap(OMAP3_SYSCON_BASE + - opp_data->soc_data->rev_offset, 4); - - if (!regs) - return -ENOMEM; - revision = readl(regs); - iounmap(regs); + ret = nvmem_cell_read_u32(opp_data->dev, "chipvariant", &revision); + if (ret && (ret != -ENOENT || !opp_data->syscon)) + return dev_err_probe(dev, ret, + "Failed to read nvmem cell 'chipvariant': %pe", + ERR_PTR(ret)); + + if (ret) { + ret = regmap_read(opp_data->syscon, opp_data->soc_data->rev_offset, + &revision); + if (ret == -EIO) { + /* not a syscon register! */ + void __iomem *regs = ioremap(OMAP3_SYSCON_BASE + + opp_data->soc_data->rev_offset, 4); + + if (!regs) + return -ENOMEM; + revision = readl(regs); + iounmap(regs); + } + else if (ret) { + dev_err(dev, + "Failed to read the revision number from syscon: %d\n", + ret); + return ret; } - else if (ret) { - dev_err(dev, - "Failed to read the revision number from syscon: %d\n", - ret); - return ret; + + revision = (revision >> REVISION_SHIFT) & REVISION_MASK; } - *revision_value = BIT((revision >> REVISION_SHIFT) & REVISION_MASK); + *revision_value = BIT(revision); return 0; } @@ -392,9 +414,14 @@ static int ti_cpufreq_probe(struct platform_device *pdev) goto register_cpufreq_dt; } - ret = ti_cpufreq_setup_syscon_register(opp_data); - if (ret) - goto fail_put_node; + opp_data->dev = &pdev->dev; + opp_data->dev->of_node = opp_data->opp_node; + + if (!of_property_read_bool(opp_data->opp_node, "nvmem-cells")) { + ret = ti_cpufreq_setup_syscon_register(opp_data); + if (ret) + goto fail_put_node; + } /* * OPPs determine whether or not they are supported based on From patchwork Tue Feb 6 14:57:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 13547421 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 54F5DC4828D for ; Tue, 6 Feb 2024 14:57:57 +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=YQsBJt2dsW5FPdmMOC507VpkcPW448qYhxh6r9fo6YA=; b=ynijNLgstIA6xo a9o/sTcLI8mZ1SK7d7oS6ah4K/TjDyInJIlS80/5qGWvZQCOlx4Q/UxrrssX4kZhNlKmz+7jcabAw GI794Z8SwRWW6hY8sIp0K32pPqpzngzmlWHODf/SAbb4HysZzUGbjEKFC2v46Si4+sXGXhq0IJGZW 73cTQPWELoqt42KEzgbuisJVDm3nZIUs9Qvop7W0O52hI/p8LwQ4j/NwetttqqYke5rUPvuog46Wn vVzwlkqvZRY77k7EUmxthqFMs47ppNFQyY9vGJMguXHJwwA4XLs8yrLyd/CG0T7GanoOSAmm0uY/0 ZZ/Lj9gM4EqXIDR5G/5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXMtQ-00000007xcU-1oHm; Tue, 06 Feb 2024 14:57:48 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXMtM-00000007xXS-2GcK for linux-arm-kernel@lists.infradead.org; Tue, 06 Feb 2024 14:57:45 +0000 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-33b436dbdcfso956651f8f.0 for ; Tue, 06 Feb 2024 06:57:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1707231458; x=1707836258; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gASO78qnd+QKC6Tryaqp/xMfAhHvhZxuVEnU1FHt3IQ=; b=xglgMrLlrEM5M+6mcOjVdXoKrIDGkkmbuPlW+uhdjipYvDsIhqg+JLyoBwtB/xyMAR aBZSZKqypUonfkd+rTacSAHBeh/24/0tzEUdO+8rcorVNSB8Pb+kxcq2fs+zWSVDadEb FHlDOYvjNQF0rPnKlyiV/g2A90dgpHC2tlLTgnqvzaujQBHaXCKly7ORrTFr3bkc2tK4 UrfpJQS4KsEPuf4gTh23usA4miHAiTnnVETi1/B5D1XDzEv/muWzYMyNi5rrpruCzEsE znyMQNimd9xqVxntydvkjc9u7Cv3KfaV3grCGxvJnFKoPxeAAydU6STNMkMM8Ts+czKc mCOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707231458; x=1707836258; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gASO78qnd+QKC6Tryaqp/xMfAhHvhZxuVEnU1FHt3IQ=; b=VUMpfamjwsudZiWEp57WZfXE9ZVm09KQfrMyYSoK48nWJTCI5JX/BbPVpzKgHw/K6u jOI6Ny8Lm2R7s9La2ZakMjXPloPmI1Ah/VYM4WWqFtW9HR2N7Gpmyz8KroffzNwel8v9 bRkds2d+fE4QEQ2DRvDK1cqoeG4iBwKMSU2t46i8PoMnIeLkuIldRjmHhw0g6t7Cydcr QsCh98tocoIbFX+w/S7VY33tiSgFTM01UV7p1teyL+vbHb3Wk/SDFj+xyR23qhBvWUXb GmLhWPX7k8DV33c36X5z76hIE0wHH5soaoFG6+GHcn51a7VbUpp6T64zPVMHxUBZNZMj nXlA== X-Gm-Message-State: AOJu0Ywes+mLxkcsoCKuzhvrLBWM5f1t7VoYcUTnmMbIRa/ng87BgmpW UPziAc2XDa+0bp1OCfRqwX2dS9PC942jeukRJZ69YTjzKQjazlbTwm+M3ciHz10= X-Google-Smtp-Source: AGHT+IHeUAmaOBGgpivKhM4wX2IuW13WEvwte78xoboY3NHwL6YsIiphL2GESDSDG6g+c8QiLXAkAQ== X-Received: by 2002:adf:ed06:0:b0:33b:2658:cb3f with SMTP id a6-20020adfed06000000b0033b2658cb3fmr1379548wro.64.1707231457878; Tue, 06 Feb 2024 06:57:37 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCW+e3f5uvLGpr7flmrRvo7g/ZKUCh94rCar9aQ2aSwAPj/XhZOEv5Lhb2DES8a71KjQJwvfWXUMUYDSTajwyx8IisYphxcpVwURtlN8y+wGHywkjUR7SFw0DxyjGKvx86titt9zgHSb5CSpKKu6ObesGMlybdi8rmzkL1RHLwAnOQxULy7MwMWVmSjr5WtwWNO6rwpgbx8r0XLUUXBzRoNZL4pRtaimUBJ6GOPz2w61B2/KbajRd9z/vlUxMj0UCDhcj447yw44xT5xiAbrl51P6I6w8yfDJn9NB1BnkjsxL7/mH8D/v+HEUu9OPkzwI7y3w6hQL0LI82jEo1amSFpaFlOh5fmdBujRB086J6Vq2DI1QdO2XOZwpbxWhH+bByLavXAVp0gnqyXYqAPT5DB+CYGxIpUyIcQDKfRK/TlJhS9HNRPVlwFOEsxuVb15xFojA7FDoAlBOeQgDbJUFh8yatRIJs4QDNBC Received: from blmsp.fritz.box ([2001:4091:a246:821e:6f3b:6b50:4762:8343]) by smtp.gmail.com with ESMTPSA id l14-20020a05600c4f0e00b0040fc56712e8sm2257896wmq.17.2024.02.06.06.57.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 06:57:37 -0800 (PST) From: Markus Schneider-Pargmann To: Viresh Kumar , Nishanth Menon , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Vignesh Raghavendra , Tero Kristo , "Rafael J . Wysocki" Cc: Andrew Davis , Dhruva Gole , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Markus Schneider-Pargmann Subject: [PATCH 3/3] arm64: dts: ti: k3-am625: Use nvmem-cells for opp Date: Tue, 6 Feb 2024 15:57:21 +0100 Message-ID: <20240206145721.2418893-4-msp@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206145721.2418893-1-msp@baylibre.com> References: <20240206145721.2418893-1-msp@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240206_065744_613765_E8DCA37E X-CRM114-Status: GOOD ( 10.22 ) 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 nvmem cells referring to chip variant and speed grade for the operating points. Signed-off-by: Markus Schneider-Pargmann --- arch/arm64/boot/dts/ti/k3-am625.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/ti/k3-am625.dtsi b/arch/arm64/boot/dts/ti/k3-am625.dtsi index 4193c2b3eed6..d60e1be9eb89 100644 --- a/arch/arm64/boot/dts/ti/k3-am625.dtsi +++ b/arch/arm64/boot/dts/ti/k3-am625.dtsi @@ -105,6 +105,8 @@ a53_opp_table: opp-table { compatible = "operating-points-v2-ti-cpu"; opp-shared; syscon = <&wkup_conf>; + nvmem-cells = <&chip_variant>, <&chip_speed>; + nvmem-cell-names = "chipvariant", "chipspeed"; opp-200000000 { opp-hz = /bits/ 64 <200000000>;