From patchwork Thu Dec 21 10:10:11 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: 13501568 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 99BA8C35274 for ; Thu, 21 Dec 2023 10:11:24 +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=s5WFfJTK0pyeZqbY5rW74o1J0r2RXrArfbpf/fhY9MU=; b=EE+u4o7DZfGNaR tMQLWNJx4hUzlpVyzapk7LmoRPvcvBSowLkjnhndjavavTdj19z8KI3NZK2Gic9fq4JOja6gNnzJd T8J/f8TJsCnyyJ9o06aazt+D4gU5MTj9PG/u7fc4w0LcCgzYC4vvVTexd4MTFB2QPABKV1+GG+KYh HU4kUlMX2YDYpoYp2NLgR0QOX3kzAsRY9AHZ6qTpsjU6Hh4i7Rl3OS50hw8cphB4Ja5aL9ZB+Nm1Y a0GYRroXRyNaIwYOUEBN8nluifdyyJsDAuISgrT7RU0DkwHadioULSNFDhFe1r9Sp55FKT6Owqq8m nmco8H8lAwqWGOAmtfHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGG0z-002NpT-1D; Thu, 21 Dec 2023 10:10:53 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGG0r-002Nlr-2E; Thu, 21 Dec 2023 10:10:47 +0000 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a236d77dceeso69936266b.2; Thu, 21 Dec 2023 02:10:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703153442; x=1703758242; 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=+QMQp28PVkuOsPBKyVgYS5Ymf4YAkrOuT5kryWvtFrk=; b=IAspYxXZehkY04QWVi1AMfGRZYi5JYqZ7LKGWWNmn4FgDT1qeHjCIBB/2eWzQAogjK iRadfrAN4AQSLJf7VsvRLfEqxlCeIYl5R5cB1nbXozmGsZ2wzAzci/cvmRYORQ+8Z9In dTnBQkZmJPuR2iCL0zz886SWyqdEMvO7PuDvMkF70Fjl1OtgbChzOwyu2BiHrK5IVhfW 2Zu2tBUijOiOiZX6zdm8pjfuvq6Gc3gdgiKccA1kb4tme2q2qm72qMM+SnReQAgQJtat oiPWHAMTPStAChTI85nCLF5ZfA0U81P1K4caa0VC4WC0exSq6xIZw+gIeVg9Nfmc7a28 iz3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703153442; x=1703758242; 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=+QMQp28PVkuOsPBKyVgYS5Ymf4YAkrOuT5kryWvtFrk=; b=MOJ7LEB17Pjl2ovsfSO1h7jcEUx4II7G30RU+3uMXWhDaXBqwAdez8XiFPva8KIKbw SZyM8KXeLK4SIalhHrLHPuJSh3HwyR7iVqFWwLBlI8K6htzuWjcsR3L3n2New8Vn+e8O +MdHJm+Ymo5ijti+V1YvXuJ41/BH5WnY2iBr1QqjZ7hLYiq54/hiOiX1Jbf27WlJbsL7 s3l1vOfSXdxxV5FX4xvRwAzoWlcQfdwszec7CYzCA0gltheY+6u+sMI5A3td8FSUM+kE sQfx3GOb22h6datLz5GAadcX/Mwo0GpEmMddzMcemmWZAX8O6xgImPZNmUyd0LuLj/IQ 0+Yg== X-Gm-Message-State: AOJu0YypPdunaDdO02Sc4D6uPRjpJ0HcRRpJGbHzzduAbbfB7miOv8GG f4jFVHv2OGAJTiuxByGbis0sTaIXuQzH4Q== X-Google-Smtp-Source: AGHT+IGXjrE90/2KzHJgTFiU2ndSeAIZdngOEf0GUcN28R/bVeQcO0PAgHNRNaNMWci22btJbMGnsQ== X-Received: by 2002:a17:906:5306:b0:a26:9fa0:5b4b with SMTP id h6-20020a170906530600b00a269fa05b4bmr363273ejo.226.1703153442340; Thu, 21 Dec 2023 02:10:42 -0800 (PST) Received: from localhost.localdomain ([154.72.163.204]) by smtp.gmail.com with ESMTPSA id x7-20020a170906b08700b00a25f5dba09dsm784928ejy.145.2023.12.21.02.10.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 02:10:41 -0800 (PST) From: Brandon Cheo Fusi To: 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 v2 1/3] cpufreq: sun50i: Refactor speed bin decoding Date: Thu, 21 Dec 2023 11:10:11 +0100 Message-Id: <20231221101013.67204-2-fusibrandon13@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231221101013.67204-1-fusibrandon13@gmail.com> References: <20231221101013.67204-1-fusibrandon13@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231221_021045_729462_1C974F77 X-CRM114-Status: GOOD ( 16.66 ) 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 | 55 ++++++++++++++++++-------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50i-cpufreq-nvmem.c index 32a9c88f8..fc509fc49 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, size_t len); +}; + +static u32 sun50i_efuse_xlate(u32 *speedbin, size_t len) +{ + u32 efuse_value = 0; + + 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; +} + +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,10 @@ 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; + const struct of_device_id *match; + const struct sunxi_cpufreq_data *opp_data; + u32 *speedbin; size_t len; - int ret; cpu_dev = get_cpu_device(0); if (!cpu_dev) @@ -48,12 +81,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); @@ -66,17 +99,7 @@ static int sun50i_cpufreq_get_efuse(u32 *versions) 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, len); kfree(speedbin); return 0; From patchwork Thu Dec 21 10:10:12 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: 13501569 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 F356CC35274 for ; Thu, 21 Dec 2023 10:11:30 +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=mWOeCGwF38jeDFaX4wLBV5BnDjW1i01JBLCVhPjAb8A=; b=3Ofr4hQpBP8kx5 qk7+jm7AdV5C4B3TiYI38GAHO0mem6DRqQGQdPt/cVneIDozyJ1/X5HmZZxx2HFkpzdV7Supiby55 2K2NI0nmWeYNGCKORpq04907Wj1XFXrbdaMHea1B1Hf3rDidugPd8XEoQydBE1WozCbSWjNnoIQe5 WwAU2C8+bIQRncR96kL9eIcIuyV+FpJeG2lpNeVUORm8uT1FOn1gvV5oZYL6Vw1eDb4yEBvlph80u DoNWIuF0oggZNL95S3+Q0HNU/+oqA++VvIaXgyNJ5wBwBihIySiA4ZorWnNCCaSXC/YDqjT1VrEGe rfOwqdj1Z7pn6y7lV8QA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGG17-002Nsw-1Y; Thu, 21 Dec 2023 10:11:01 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGG10-002NoB-2f; Thu, 21 Dec 2023 10:10:56 +0000 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-553a65b6ad4so782512a12.0; Thu, 21 Dec 2023 02:10:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703153450; x=1703758250; 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=GF5s6M+Wn1BIKkAOEW/8xBSTlKtmOm9F7gA3mT6ZChs=; b=jhMWjqosglXOJCOx/Ablg3sbMRfJVH1Q/3hEi9uRn2Ed/xLwCvR0DTAiiJJbmfe6cF b6D/5qdM2pv353cCp6XbJPxn1Q++UPzCJN5hEPT72PGo8nPJ6qIt5xbmkM2Px+skVqtG dodupz8LcknafU5UdfpaZsrbqDFOkoYly0K+fbZN4IjIiKzpsIuTWqE43WhIp63sYrfj VMPyCaYk3X2YyM0128QGj8jibjaqlsszOua8KIyJKTy2vpPlqkgIwgT+qkBkQwKhcBhw 5bLdIQPLBEiIJe8LbrN+0JGttqyb4UXni1JCR2ombOvAqRymGnqtY3sOaXsSRjbmHuUM jAgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703153450; x=1703758250; 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=GF5s6M+Wn1BIKkAOEW/8xBSTlKtmOm9F7gA3mT6ZChs=; b=sYFxt6v4VW2mpXYapoBeJ0gIIe0VTKnCXW65kTIAA9+g9CafRdWeSfIL+wJ2y0yEwP EDb/Oo0l4ReK9m5lPRPeESDoBYUQMvNsGLY4Ve+UZ5pYLI6PzNJFwTsUuJKU9UiPJohq 9bjTCWq/jQgmVi1Qc1CAeNR28tUW3oypIfYIMNa+ExrxLNXXdn6+LPTqdncV/ThP9H50 G/Y3DBfmKrdwZj+a+U8+d0Cf7bB+LvcTERaGP/NKrGbP6v1HjUPUg9j2WNzemw7PEX90 5WIO4+zQPoAs+kT82+KsR7H+z4Qk5O0jJYf2ujyw6oZPBgOhMcHIGmOa8Sko+KtPhTF1 SXkQ== X-Gm-Message-State: AOJu0Ywz8T/YjWHFk4/ovL1AtYRibUv8panRG89KF+Wsj8n/VHXNL9Ok n3ME1b/ahbOq4JPbrVbQfOI= X-Google-Smtp-Source: AGHT+IHL1Ma08mPb9cC1GlQdvGSlGcloQ/GpQp0NxOsffwhypNZRsAeFEGADJz/75DK6viyXViInjg== X-Received: by 2002:a17:907:3f9f:b0:a26:a1a7:a67d with SMTP id hr31-20020a1709073f9f00b00a26a1a7a67dmr675031ejc.46.1703153450118; Thu, 21 Dec 2023 02:10:50 -0800 (PST) Received: from localhost.localdomain ([154.72.163.204]) by smtp.gmail.com with ESMTPSA id x7-20020a170906b08700b00a25f5dba09dsm784928ejy.145.2023.12.21.02.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 02:10:49 -0800 (PST) From: Brandon Cheo Fusi To: 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 v2 2/3] cpufreq: sun50i: Add support for D1's speed bin decoding Date: Thu, 21 Dec 2023 11:10:12 +0100 Message-Id: <20231221101013.67204-3-fusibrandon13@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231221101013.67204-1-fusibrandon13@gmail.com> References: <20231221101013.67204-1-fusibrandon13@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231221_021054_863835_1C06206D X-CRM114-Status: GOOD ( 14.68 ) 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 | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50i-cpufreq-nvmem.c index fc509fc49..b1cb95308 100644 --- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c +++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c @@ -29,6 +29,33 @@ struct sunxi_cpufreq_data { u32 (*efuse_xlate)(u32 *speedbin, size_t len); }; +static u32 sun20i_efuse_xlate(u32 *speedbin, size_t len) +{ + u32 ret, efuse_value = 0; + int i; + + for (i = 0; i < len; i++) + efuse_value |= ((u32)speedbin[i] << (i * 8)); + + switch (efuse_value) { + 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, size_t len) { u32 efuse_value = 0; @@ -46,6 +73,10 @@ static u32 sun50i_efuse_xlate(u32 *speedbin, size_t len) return 0; } +struct sunxi_cpufreq_data sun20i_cpufreq_data = { + .efuse_xlate = sun20i_efuse_xlate, +}; + struct sunxi_cpufreq_data sun50i_cpufreq_data = { .efuse_xlate = sun50i_efuse_xlate, }; @@ -54,6 +85,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, + }, {} }; From patchwork Thu Dec 21 10:10:13 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: 13501570 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 11599C35274 for ; Thu, 21 Dec 2023 10:11:38 +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=A/7wJVDpq7vVF+KsTy1RV/okMV9goDLIQ7T8jazxquM=; b=nxpZr0VCE9/5HI wYvea9G9ABAQ+0iBD2vJBZ4pambffTwi0VJOtFpzNC0QVtKRpurqP3eEyYEGtdUbO7WQBMAtvLotR rO4wG5GSKZi45VO/ijceuHPg1J9n/OPDHyv+LZdf0tFQHwvnXnIsnlWuD4UL500vU+1q4KFY+0RRX FPv1izK3hufwkPRjw4JztLx+ai8FjCyVVMIpMNQqyob7bQNWBMsCgCC9pwKZhw9DfjHGE7rZ+dt5b hgSBrO7DzV20zAWxhNj3ey4gdgTyxwrtFyp6vIEQhkxi+jTygq8wgIZDCvfZEdZ7yy84HW3MGP3C7 L+8ABAoMZ7KMIiJdyCxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGG1G-002Ny8-0M; Thu, 21 Dec 2023 10:11:10 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGG16-002Nrx-0d; Thu, 21 Dec 2023 10:11:01 +0000 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a2699ee30d1so48272666b.2; Thu, 21 Dec 2023 02:10:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703153458; x=1703758258; 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=DFf3Xy2cMnTXIbMlXJLnwk2HDFYZqTaJR84g5dBGsLI=; b=I6L/VSDCVIdQBMGXGOXbYyGSXdl7WcIbNoN8ww3Y+/7eCorZm9279hXsCRBT1S69Ki Dt85YyYtWN4fMjsqtxrwp7Bskpe770ssSlJ+yqtscoxljrYKRnhp2dNuKqs2tfn/qODY 0Gu/4rCrB2jiSsqg/6M2Q+0eumyh3bhK6Ta3ZvA8IJmzYAxzk7DqSCmDwuESiJtedy4K KV6wCWTs8p6A0tXRCqz3emL9LpyYgZh2EJh4FjNu6sF6ezQusjsJOuELdF4hL7dzFX4V QjJzPrqanMh51EPm/+XaG7/orRryrm1A1IjXlnbWh9KRrce2afVoP/8nKrulwcg/Dgyk JaAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703153458; x=1703758258; 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=DFf3Xy2cMnTXIbMlXJLnwk2HDFYZqTaJR84g5dBGsLI=; b=qej+eoF7WhCWLLNHZcsWuygKzYH5Dw5wEJvLcbxKEgzo5je39dWGIGIyfJIe3C+40W azwCdqP8XRF1GU1bl+eOaPM0fNYfEE+X7hdLnZadSywXJAYm6tnqgScmc/Ee0iwcT2vJ BGp46eJkGT2hqftfspL7NqgWaDAdlkXTl8/FTu3a8jkJ0gx2DV0k9hF6w1JZJ6Q98u7+ F4w8R4VYZNPAa4lodtV08ytJy98T0ooBioBinaPlQzwVF/I9F54PL6PWCBECKWq7sWsB AAST9jZIb9vNgvo/ZlD+RcjomLiaJeTFcxEdHGfac1tsj9kM7+bywujdALgm6e3sRO/D c5BA== X-Gm-Message-State: AOJu0YxsNgcSpDYO1aH7THwSMalWaXIF+/M78UiEwdBkIxfwnRyEj0BU jW8rpGnUdHw1YM7Yg5g0U7o= X-Google-Smtp-Source: AGHT+IHdyV4OQDmEi6Na15vJj61uqzNpkif4Hepo9TNBl7sFfbA0b7Ola/s2/GZQujvgdIcyNME+FA== X-Received: by 2002:a17:906:159:b0:a22:eae6:1657 with SMTP id 25-20020a170906015900b00a22eae61657mr8537126ejh.33.1703153458485; Thu, 21 Dec 2023 02:10:58 -0800 (PST) Received: from localhost.localdomain ([154.72.163.204]) by smtp.gmail.com with ESMTPSA id x7-20020a170906b08700b00a25f5dba09dsm784928ejy.145.2023.12.21.02.10.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 02:10:57 -0800 (PST) From: Brandon Cheo Fusi To: 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 v2 3/3] riscv: dts: allwinner: Fill in OPPs Date: Thu, 21 Dec 2023 11:10:13 +0100 Message-Id: <20231221101013.67204-4-fusibrandon13@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231221101013.67204-1-fusibrandon13@gmail.com> References: <20231221101013.67204-1-fusibrandon13@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231221_021100_242565_4861E22C X-CRM114-Status: UNSURE ( 9.49 ) 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. 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>; + }; +};