From patchwork Fri Dec 22 11:14:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Cheo Fusi X-Patchwork-Id: 13503220 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 3F264C46CD8 for ; Fri, 22 Dec 2023 11:15:17 +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=KWxhZ3X6Bihd0UBB8hbCIUOfyJLBXxF781kPb4jqfIw=; b=ArL0yU1dWkXfBo xZEsqOmS9GfhvXJbgUBWoOiJdSGaij4u1XYQlwtafc3vY7mtc5TAIMHnECKp6rgodrS8OdiqliWQm I8pCx5Rw06VMQmMqYw9i8kb0UX+/2g8+BwoKyLDwmf1tY9e7EAToI+C2j1lWnKk/8n/37hlEWr/qZ 7W+17+lzMFGGOpaankSEy/t58TuRs2SPJl5HMIPhF8WAo7bhlSLUOWezGRN3lx2xpFgIPYR3Q153+ v5TgETNqnPJKJPjoVOYOnAQpvUyYko6cUbUkj2XeT/BvRhged8MjoX+y9Efqb1wndQzrSmyXEVPx3 RejOadUMjipbiYQwAcRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGdUS-005dRW-0t; Fri, 22 Dec 2023 11:14:52 +0000 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGdUO-005dPM-0Z; Fri, 22 Dec 2023 11:14:50 +0000 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2cca5e7b390so13081031fa.3; Fri, 22 Dec 2023 03:14:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703243684; x=1703848484; 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=g7DGrzlVlvs9gxszkU6Ibjz+3jgxk5y/rrrR3fSlR9s=; b=ACPCFLL+E0fHr7zggvwszw8yWTo3nQhFre+ky0EPu7uj4f+gP0SRKOzVthKTgEpunt 3gsGF45aca6Wx5aSQyr0crWCIWPxIlGIW+QFj1JHSN46LIHm0/Hx2WgMyDTHURn9Ino2 RGdb7cYTmlP+Ow6oT41WDBE/IuH1phitS53GhfI+1CQM5lJ9nMxyMeWXLRioRauQ7rDp L/1oWdsWRcy7CI4x3yvbTOdXj41GCusoJJltaz3eQmIOutFzZh7yINoXeQgK8EHjZpYT 4jh7i1yB1/TfcR5rgfxty+fVOGf45XKc8vR75lzTgSFoXpNt3pMxLP1egopv9f9PFABR zVTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703243684; x=1703848484; 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=g7DGrzlVlvs9gxszkU6Ibjz+3jgxk5y/rrrR3fSlR9s=; b=TM/QwJKmqTGQ6UAJ/YQukL5m7e82ytuwZ2f8Q4PSUiq5NNWblJn87PY3I+crteGUc6 kHy7JLXLlvd1REfmwqDNx1WDO11/MtsGAj2sQ7IX/zIjZVfi+Dh1HLgBeKH5V6niTEAf grUV6qvOIhq0MCpgwfJigdSFhy2cghgmThSkOg0kFNwMwJ7ava9Lb3euujAfJmz7PkVC iyfDl+isERpbuRpeylGa7QYeGbsdlonUbt3wTxsTB/wnnt6Q6eBVQkGLXLiJU160mXQU rXyrFW4ViKAUTM82ZYRar6mMAPom+gLEhJ6cp+JIMMeLjfzxEzRbitARksu52Fm2KHC7 4Y/Q== X-Gm-Message-State: AOJu0YzfahqL6CC5SKs+N3pss+W3cSk3HhJqCcGSQDnVWhrFySFx2NyG Iag8aqUeRINjJdNrrWehi7g= X-Google-Smtp-Source: AGHT+IHg0MuEsdR3YNmYjR54tmAi0CP4dEHlQyIUYDid2LMDCv5m0mmnyatup9/AcekOKefeZufagg== X-Received: by 2002:a2e:2ac2:0:b0:2cc:5dc2:3f09 with SMTP id q185-20020a2e2ac2000000b002cc5dc23f09mr542885ljq.44.1703243684017; Fri, 22 Dec 2023 03:14:44 -0800 (PST) Received: from localhost.localdomain ([154.72.162.91]) by smtp.gmail.com with ESMTPSA id es15-20020a056402380f00b0055267663784sm2420469edb.11.2023.12.22.03.14.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 03:14:43 -0800 (PST) From: Brandon Cheo Fusi To: Andre Przywara , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Yangtao Li , "Rafael J . Wysocki" , Viresh Kumar , Stephen Rothwell Cc: devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Brandon Cheo Fusi Subject: [RFC PATCH v3 1/3] cpufreq: sun50i: Refactor speed bin decoding Date: Fri, 22 Dec 2023 12:14:05 +0100 Message-Id: <20231222111407.104270-2-fusibrandon13@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231222111407.104270-1-fusibrandon13@gmail.com> References: <20231222111407.104270-1-fusibrandon13@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231222_031448_216323_4A62C2F7 X-CRM114-Status: GOOD ( 16.37 ) 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 Make converting the speed bin value into a speed grade generic and determined by a platform specific callback. Signed-off-by: Brandon Cheo Fusi --- drivers/cpufreq/sun50i-cpufreq-nvmem.c | 58 ++++++++++++++++++-------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50i-cpufreq-nvmem.c index 32a9c88f8..e8c2a1dc3 100644 --- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c +++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c @@ -25,6 +25,38 @@ static struct platform_device *cpufreq_dt_pdev, *sun50i_cpufreq_pdev; +struct sunxi_cpufreq_data { + u32 (*efuse_xlate)(u32 speedbin); +}; + +static u32 sun50i_efuse_xlate(u32 speedbin) +{ + u32 efuse_value; + + efuse_value = (speedbin >> NVMEM_SHIFT) & NVMEM_MASK; + + /* + * We treat unexpected efuse values as if the SoC was from + * the slowest bin. Expected efuse values are 1-3, slowest + * to fastest. + */ + if (efuse_value >= 1 && efuse_value <= 3) + return efuse_value - 1; + else + return 0; +} + +static struct sunxi_cpufreq_data sun50i_cpufreq_data = { + .efuse_xlate = sun50i_efuse_xlate, +}; + +static const struct of_device_id cpu_opp_match_list[] = { + { .compatible = "allwinner,sun50i-h6-operating-points", + .data = &sun50i_cpufreq_data, + }, + {} +}; + /** * sun50i_cpufreq_get_efuse() - Determine speed grade from efuse value * @versions: Set to the value parsed from efuse @@ -36,9 +68,9 @@ static int sun50i_cpufreq_get_efuse(u32 *versions) struct nvmem_cell *speedbin_nvmem; struct device_node *np; struct device *cpu_dev; - u32 *speedbin, efuse_value; - size_t len; - int ret; + const struct of_device_id *match; + const struct sunxi_cpufreq_data *opp_data; + u32 *speedbin; cpu_dev = get_cpu_device(0); if (!cpu_dev) @@ -48,12 +80,12 @@ static int sun50i_cpufreq_get_efuse(u32 *versions) if (!np) return -ENOENT; - ret = of_device_is_compatible(np, - "allwinner,sun50i-h6-operating-points"); - if (!ret) { + match = of_match_node(cpu_opp_match_list, np); + if (!match) { of_node_put(np); return -ENOENT; } + opp_data = match->data; speedbin_nvmem = of_nvmem_cell_get(np, NULL); of_node_put(np); @@ -61,22 +93,12 @@ static int sun50i_cpufreq_get_efuse(u32 *versions) return dev_err_probe(cpu_dev, PTR_ERR(speedbin_nvmem), "Could not get nvmem cell\n"); - speedbin = nvmem_cell_read(speedbin_nvmem, &len); + speedbin = nvmem_cell_read(speedbin_nvmem, NULL); nvmem_cell_put(speedbin_nvmem); if (IS_ERR(speedbin)) return PTR_ERR(speedbin); - efuse_value = (*speedbin >> NVMEM_SHIFT) & NVMEM_MASK; - - /* - * We treat unexpected efuse values as if the SoC was from - * the slowest bin. Expected efuse values are 1-3, slowest - * to fastest. - */ - if (efuse_value >= 1 && efuse_value <= 3) - *versions = efuse_value - 1; - else - *versions = 0; + *versions = opp_data->efuse_xlate(*speedbin); kfree(speedbin); return 0; From patchwork Fri Dec 22 11:14:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Cheo Fusi X-Patchwork-Id: 13503221 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 12962C41535 for ; Fri, 22 Dec 2023 11:15:26 +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=7sDtIn4XJR2ek+DbIBA/tympyEuShB8GjLB0ruxiFlY=; b=Vu3jtKgo83T/jz 89YBfM/jXRxRfL6MWeW3clECK1wivSk+vOYCw1gss++uheHr0vM/nGIvsiqoag6HHyMGZORH/cQMy v9yGj6dpj+Ro2Z5JlVluoEXoN97rO5H7YiDqJNB4idkHkN4oeyfCSJvDRBriaVP+z7M1PRSDoMfPC nb/QDDoRE2wSsPeH8KbZNvETCJ8KBeW/0I3FY8LwJpFW0opXOPM2NFsuI9fdLN/1d6y5SqYU3KH76 WnfGz6AaGCvzw+jT+7V5IJXpuyBh4i3Bjmd2SqBAdEzfjdhI+9GUoHUuDRjcyUuDDilEI6Drgc3We hq7YtIE6MyVZ1GhRSXQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGdUc-005dXm-2H; Fri, 22 Dec 2023 11:15:02 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGdUY-005dSh-35; Fri, 22 Dec 2023 11:15:00 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-50e6a806e4aso379427e87.1; Fri, 22 Dec 2023 03:14:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703243693; x=1703848493; 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=422E8D0hJIO/x9qlN5M/YDPeDy51iO5eXq4u7UbXCT8=; b=lhb79QMWNwh161y/sP1yHhnAcUZryMZw0tVWcw25DMwRq8X2IJOWYFKoF/PNi0ZxeN 7ijdd2uv1cOwPC01SQl50DP1cDlkrbFDh5v8gpC50OvV90rq7fsQFHYySgN8n1yosG2/ dGQF1SmEhmNjmX2GE8zpG9Ro69dTQvgxGXFHYdzryTuUjuVxFctDZvtjAhDgkEBdof1o On9y5hZEIDzA4U26WC/D2mReU5t/sJte+dChaG3Erd3gg3iL82OvdbqC2cy40fm3Tayh zJnoWvRJnsSRLas1jEc80E3AUNDPG4swZQlOx/zyNk/Ul87GEni+XSz890tHkJbYaAJO K6EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703243693; x=1703848493; 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=422E8D0hJIO/x9qlN5M/YDPeDy51iO5eXq4u7UbXCT8=; b=X2IR2p49VsNcBh8DmQtW4KvoNSrP6rF/1tfNvTjKgH0s7YuHdNYcv+B/dXFqOvF3qY ls5s9Ie+QjeVCO5rUau6I4sdKYizH7+NTQht0ZwWJoXq/Xt1FhXyAEHzdRHu/QRPAcHj WO9itZvaBd+xS0rl3pAKo6NZJ3O3Vet+oanDwb92nVcKoFrRYgcui1ItciB8wY8h3yGu 00qtJm7KbJRUBbC6CbBSHW7SC+edt3ig5lSTBdGbDhCgRFTquC+f7N7WU6pbVoPePtX2 qKuYmU3a4uC7wmy9DQjtBo7vepAjo+6xlkJop8hpaNdBE7sRINEeUjJXGLVJev63zjMp eN1w== X-Gm-Message-State: AOJu0YyaTVd/1eiVoRzDOkRovYOO+Z7gJ0fA8wTAm5chmbppJ9UT1xot k91u88a2Ar31+NfWwJHuaxc= X-Google-Smtp-Source: AGHT+IHvAdtVCOCM0VreRerqB83H12IHnADRmj9a8fDFQRtDWT3/nlvul6XbQlcen4QGsNI+A1vNAA== X-Received: by 2002:ac2:4db0:0:b0:50e:375e:735f with SMTP id h16-20020ac24db0000000b0050e375e735fmr494437lfe.74.1703243693363; Fri, 22 Dec 2023 03:14:53 -0800 (PST) Received: from localhost.localdomain ([154.72.162.91]) by smtp.gmail.com with ESMTPSA id es15-20020a056402380f00b0055267663784sm2420469edb.11.2023.12.22.03.14.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 03:14:52 -0800 (PST) From: Brandon Cheo Fusi To: Andre Przywara , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Yangtao Li , "Rafael J . Wysocki" , Viresh Kumar , Stephen Rothwell Cc: devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Brandon Cheo Fusi Subject: [RFC PATCH v3 2/3] cpufreq: sun50i: Add support for D1's speed bin decoding Date: Fri, 22 Dec 2023 12:14:06 +0100 Message-Id: <20231222111407.104270-3-fusibrandon13@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231222111407.104270-1-fusibrandon13@gmail.com> References: <20231222111407.104270-1-fusibrandon13@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231222_031459_010026_94F92860 X-CRM114-Status: GOOD ( 13.63 ) 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 Adds support for decoding the efuse value read from D1 efuse speed bins, and factors out equivalent code for sun50i. The algorithm is gotten from https://github.com/Tina-Linux/linux-5.4/blob/master/drivers/cpufreq/sun50i-cpufreq-nvmem.c#L293-L338 and maps an efuse value to either 0 or 1, with 1 meaning stable at a lower supply voltage for the same clock frequency. Signed-off-by: Brandon Cheo Fusi --- drivers/cpufreq/sun50i-cpufreq-nvmem.c | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50i-cpufreq-nvmem.c index e8c2a1dc3..26bb5217b 100644 --- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c +++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c @@ -29,6 +29,29 @@ struct sunxi_cpufreq_data { u32 (*efuse_xlate)(u32 speedbin); }; +static u32 sun20i_efuse_xlate(u32 speedbin) +{ + u32 ret; + + switch (speedbin & 0xffff) { + case 0x5e00: + /* QFN package */ + ret = 0; + break; + case 0x5c00: + case 0x7400: + /* QFN package */ + ret = 1; + break; + case 0x5000: + default: + /* BGA package */ + ret = 0; + } + + return ret; +} + static u32 sun50i_efuse_xlate(u32 speedbin) { u32 efuse_value; @@ -46,6 +69,10 @@ static u32 sun50i_efuse_xlate(u32 speedbin) return 0; } +struct sunxi_cpufreq_data sun20i_cpufreq_data = { + .efuse_xlate = sun20i_efuse_xlate, +}; + static struct sunxi_cpufreq_data sun50i_cpufreq_data = { .efuse_xlate = sun50i_efuse_xlate, }; @@ -54,6 +81,9 @@ static const struct of_device_id cpu_opp_match_list[] = { { .compatible = "allwinner,sun50i-h6-operating-points", .data = &sun50i_cpufreq_data, }, + { .compatible = "allwinner,sun20i-d1-operating-points", + .data = &sun20i_cpufreq_data, + }, {} }; @@ -182,6 +212,7 @@ static struct platform_driver sun50i_cpufreq_driver = { static const struct of_device_id sun50i_cpufreq_match_list[] = { { .compatible = "allwinner,sun50i-h6" }, + { .compatible = "allwinner,sun20i-d1" }, {} }; MODULE_DEVICE_TABLE(of, sun50i_cpufreq_match_list); From patchwork Fri Dec 22 11:14:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Cheo Fusi X-Patchwork-Id: 13503222 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 A6FEBC46CD8 for ; Fri, 22 Dec 2023 11:15:35 +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=E3+UmUobuspkckqmn+GI4Zu4CyplB+gYkKqZGg1hles=; b=ZVbgBT4IXV15Rt BgQ7Fbbga4/wXkuYFnwpHkt39YfwR8gbjcawb6G94UQ72OawjfJGHCJWSZZOUxORx2jukFe5g451v kVE/7D7K7Jvues91Q8Nni4lW8mFpQoiUSTWtOo7l3YWVp+3mOq91rAwpNqfhIZzGUTSLWRASc/OWO v3lGYIAxn9w38igd278ZLyK69c0cQJLNEF5Egct/mD64FKYQrk54Xv9HqbffcdIDCWr04Eo5vtFRv oo3V+K06NM62/rv/ea8EKBhGcENOIQKDoYKYNQa2XlvfAzFiePeZkLxvQFJMEba/FnFGSoCyHm+fy 5jIrQWz/BrLynfq3C4ag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGdUm-005ddu-1n; Fri, 22 Dec 2023 11:15:12 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGdUi-005dYx-2M; Fri, 22 Dec 2023 11:15:10 +0000 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-54c77e0835bso2197312a12.2; Fri, 22 Dec 2023 03:15:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703243705; x=1703848505; 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=7BvelMzmtyu1Sqb0MGaQ3BVDecc44IV/AoEGKsA1SR0=; b=OPBOXZynX6vrlYNdVYXxdA/FDb8ya+17PPSlIRiIG5fdrFHKu2LnVceJNnEPuT8V2A bCF/VzmNFb9X3j9AC+hyzAtCzew4xTy+YPHIoiGwWEVQXYtWij5IwkYBhN735ZCLUQ1K aKo3NDOYqdvbNYWQUFhBpkDGICURX7BLANCBFu1pxW9YIlYnjP3Rq1MDUgmJtxOpl0jP pS8vhY9lhjZy0mHZSKSa2nZeKxHC9KdQms2+VJNh6ktKHbv1XaZiX6boLuA7vZLIVGtt 3Nq/hUiTcdTwXhuu/6O7A8m2/EBi8a8fiyxmpzVgtcvI7+Gb7he87KPYqP1DwM3peaSL 5AiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703243705; x=1703848505; 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=7BvelMzmtyu1Sqb0MGaQ3BVDecc44IV/AoEGKsA1SR0=; b=DobO36mcfQjHmWYI8Q76KqQkOBOP83nLRhFZIBvqJlneFHVhY9YyMoUFsbnJ9tQ25V 7FzvjPs644ZT9DgHhXrhhrvSnSMxfnLnw+LVbQLS+FUVMzTG7tBCTO+JrA8HNUtt5Lvm /XSX56HZKGHqIzUv6fGlwocfPelShBNc+EXLy0Dw8zZKE0lHv7fZvr+TuJ3+pa46sNp8 0ZAZf8jJ9ypjjU9jiY2i7AY6rNxndLKWWX8GZgBrJ/uRRw1VBDeoEmPRGNvbVvR8PONv wBkw9SWSoSs54SJKdKRwh6OFUcqAeVXQpg2l4P+dd12b57kVQiNYr/92TTX+1w+3Pkwp rN2w== X-Gm-Message-State: AOJu0YyVBw5SibygWBz6PnFktApO2ihd5i/8SShfzqdavu1p8HO4D9L8 6JtW6NAUZkFAIfnmUMleU6w= X-Google-Smtp-Source: AGHT+IGWir11b4gGwRl3NO7lj7pMTMBbWgNmeSbRuM9TWOJnnwaniRMrtaZLnxpLWHffPO330BSmbA== X-Received: by 2002:a05:6402:124b:b0:551:ab9e:53c6 with SMTP id l11-20020a056402124b00b00551ab9e53c6mr575373edw.52.1703243704565; Fri, 22 Dec 2023 03:15:04 -0800 (PST) Received: from localhost.localdomain ([154.72.162.91]) by smtp.gmail.com with ESMTPSA id es15-20020a056402380f00b0055267663784sm2420469edb.11.2023.12.22.03.14.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 03:15:03 -0800 (PST) From: Brandon Cheo Fusi To: Andre Przywara , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Yangtao Li , "Rafael J . Wysocki" , Viresh Kumar , Stephen Rothwell Cc: devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Brandon Cheo Fusi Subject: [RFC PATCH v3 3/3] riscv: dts: allwinner: Fill in OPPs Date: Fri, 22 Dec 2023 12:14:07 +0100 Message-Id: <20231222111407.104270-4-fusibrandon13@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231222111407.104270-1-fusibrandon13@gmail.com> References: <20231222111407.104270-1-fusibrandon13@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231222_031508_767812_4D2B42E5 X-CRM114-Status: UNSURE ( 9.56 ) X-CRM114-Notice: Please train this message. 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 Specify two voltage ranges, in order of increasing stability, for each OPP. Also define an nvmem cpu speed grade cell of length 2. Link: https://github.com/Tina-Linux/linux-5.4/blob/master/arch/riscv/boot/dts/sunxi/sun20iw1p1.dtsi#L118-L133 Link: https://github.com/mangopi-sbc/tina-linux-5.4/blob/0d4903ebd9d2194ad914686d5b0fc1ddacf11a9d/arch/riscv/boot/dts/sunxi/sun20iw1p1.dtsi#L118-L182 Signed-off-by: Brandon Cheo Fusi --- arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi index 64c3c2e6c..7e2e015e0 100644 --- a/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi @@ -39,16 +39,23 @@ cpu0_intc: interrupt-controller { }; opp_table_cpu: opp-table-cpu { - compatible = "operating-points-v2"; + compatible = "allwinner,sun20i-d1-operating-points"; + nvmem-cells = <&cpu_speed_grade>; + nvmem-cell-names = "speed"; + opp-shared; opp-408000000 { opp-hz = /bits/ 64 <408000000>; - opp-microvolt = <900000 900000 1100000>; + + opp-microvolt-speed0 = <950000 950000 1100000>; + opp-microvolt-speed1 = <900000 900000 1100000>; }; opp-1080000000 { opp-hz = /bits/ 64 <1008000000>; - opp-microvolt = <900000 900000 1100000>; + + opp-microvolt-speed0 = <1100000>; + opp-microvolt-speed1 = <950000 950000 1100000>; }; }; @@ -115,3 +122,9 @@ pmu { <0x00000000 0x0000000f 0xffffffff 0xffffffff 0x00020000>; }; }; + +&sid { + cpu_speed_grade: cpu-speed-grade@0 { + reg = <0x00 0x2>; + }; +};