From patchwork Fri Jan 21 19:35:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12720160 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 E23DEC433EF for ; Fri, 21 Jan 2022 19:37:39 +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=ysneKJnSmhlhc5iUEKk6+e9TngmFxlRDlmzfBqmURB0=; b=xu6Sx6j0lI2Xbd 4hNMVelbfariO59+A1hBlHJRI2MNuSt9JjSoe9/8XGBjmX2vymlVl0O2da5+/vuymewymNJVEqx3i wj1dyM/w4K6MUsbtQULJhLltFMPdAY5j9MUNvZlJjleduhoyscLLniEXaMXMgqy0QNziGyZgMmZ4w OtXsxGnZAj3ZHwtzGqpejQ60N/fyl9SPfhBKUiBi3VRopyhp9V2nBzNdGOX9VgyveHSnz2qLXEtfW 7WoVUvPvIHkhtFNAQjypmSdvPoaGCccyeUjTEY9cGvn52xO2mpsjxLMCH2rRt4U2Xb/ymyDj4ilcj G5p19dS5tq9pXoofY5Aw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzhf-00Fw6I-6E; Fri, 21 Jan 2022 19:36:07 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzhS-00Fw18-2w for linux-arm-kernel@lists.infradead.org; Fri, 21 Jan 2022 19:35:55 +0000 Received: by mail-wm1-x331.google.com with SMTP id n8so18803850wmk.3 for ; Fri, 21 Jan 2022 11:35:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JQsJN7pJU0BMJyEgmIQu4kyCp2vR66DlJR8TnVMAcyQ=; b=q44HUq6w2KiYoMvHttu5w86WGdLVEIS0Ai7y8an10oGs3eaMf86rF9MbcxY7Gpy/f0 ZfsOC6HI0O7ZIK9/sB0stqNjrC2oH7h10PkQnfYIOUGvvGmg8ofXDI/iR4jiyoq4oygn FfAtrXGB8sLS7QGi+oVm5M1xaX67WORdIfvrNMfVvl+oZz8X0PS3rIE3yjUXMJxel8K8 Zlbbtefde24UKEEab0ncyT88YogLhQ8vxJuJcmgSxpBXs377ynfUfBZaUqrnBfq3wXuk 6qrgsJ8i6SjEA0L1UxAqRtChUsV0xAojzgQoIraHMpzBGPdZzuPhsFrpmbzIRbH4IgoH ZoTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JQsJN7pJU0BMJyEgmIQu4kyCp2vR66DlJR8TnVMAcyQ=; b=20Vb9QSFE78LeOtRZDfLZlnsd0Hr8fYnA6cqWbla+x1zjnn/FV6hEUFdaeYThHOf06 PYoKl083X5MI8AsQsj0cpBiCafplXeimOKL/2xpgm55aCig3Xeler7gR1M5GQk8OZVB1 47OtAhjAGLS2VKG7bSJ9upRXKD0RCmI9CUnrp3KqcdqyiOj4NU6igwBGsBhiA10CtXUY SdV0y/YEzeHTs7eWQIuya+kEGU+WHr6xogTze6Asrjnu59Zt1G1QTzaAUaH5I3Cqsnm7 5KMG9GpXf+iQhpsIuvZnkpYtjqlIqpsCy0zsJbpWYHz6G9myh/EsUBEk/zGKOBNlGzHE SL4Q== X-Gm-Message-State: AOAM533iXPT1NeAOm1DbaWGcr9iNoG4svb7dKpv4QwiAdzUQKNl5lkn5 zV63QvFvZduGSjvoFC8ZH/kH15PDjwl6tw== X-Google-Smtp-Source: ABdhPJy74/M/l9l60yzDFsAdVmnA+Bxt582Pt24ra8TkTCnRoeglEPeKLr6FE1ypAg5zoVb6hpA0aA== X-Received: by 2002:a1c:984a:: with SMTP id a71mr2004193wme.115.1642793750322; Fri, 21 Jan 2022 11:35:50 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id a18sm6944790wrw.5.2022.01.21.11.35.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 11:35:49 -0800 (PST) From: Romain Perier To: Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Arnd Bergmann , Daniel Palmer , Romain Perier , Rob Herring Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rob Herring Subject: [PATCH v3 1/9] dt-bindings: clk: mstar msc313 cpupll binding description Date: Fri, 21 Jan 2022 20:35:36 +0100 Message-Id: <20220121193544.23231-2-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220121193544.23231-1-romain.perier@gmail.com> References: <20220121193544.23231-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220121_113554_153802_C99F600B X-CRM114-Status: GOOD ( 14.65 ) 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 From: Daniel Palmer Add a binding description for the MStar/SigmaStar CPU PLL block. Signed-off-by: Daniel Palmer Reviewed-by: Rob Herring --- .../bindings/clock/mstar,msc313-cpupll.yaml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/mstar,msc313-cpupll.yaml diff --git a/Documentation/devicetree/bindings/clock/mstar,msc313-cpupll.yaml b/Documentation/devicetree/bindings/clock/mstar,msc313-cpupll.yaml new file mode 100644 index 000000000000..a9ad7ab5230c --- /dev/null +++ b/Documentation/devicetree/bindings/clock/mstar,msc313-cpupll.yaml @@ -0,0 +1,45 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/mstar,msc313-cpupll.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MStar/Sigmastar MSC313 CPU PLL + +maintainers: + - Daniel Palmer + +description: | + The MStar/SigmaStar MSC313 and later ARMv7 chips have a scalable + PLL that can be used as the clock source for the CPU(s). + +properties: + compatible: + const: mstar,msc313-cpupll + + "#clock-cells": + const: 1 + + clocks: + maxItems: 1 + + reg: + maxItems: 1 + +required: + - compatible + - "#clock-cells" + - clocks + - reg + +additionalProperties: false + +examples: + - | + #include + cpupll: cpupll@206400 { + compatible = "mstar,msc313-cpupll"; + reg = <0x206400 0x200>; + #clock-cells = <1>; + clocks = <&mpll MSTAR_MSC313_MPLL_DIV2>; + }; From patchwork Fri Jan 21 19:35:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12720162 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 F3C8FC433F5 for ; Fri, 21 Jan 2022 19:38:11 +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=AJ+lrbeD8DjsO0Ik/RSQ+upB46pJeZhH2W0/a7Y8Qko=; b=jknQ/802ADOHrO a+pFaN8OodX8KvfwbZMXt6Yg7paVoixJi2ki2vYhNIjw9g1VYvpe/jPc9l2FETp63Pj6z/Ztn1Fkb Qf0/LbZ2Cqenep42UCPxMDQ+n201DGq0GaxkJ8n5hebYIKXMjL5Gr+NmN0r95ihMJRVQ3/1v8HCmQ i2FSdfriqXNw3pOoFpzBaocNiLQE2H9eXA0dTRe9ydt4GYxxmTQsjMa2gmjHC4gKD/oR/s6xIjY2r zHqrN/Lqsgly6ui2gtpCjGbOHnt+O34O9UrrIkvPu2qqlD4OVWP+p3oj6u31JsPXZFWqfdcW6gE5s fHhjgSiE5KmCaPmltm+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAziK-00FwFy-Tu; Fri, 21 Jan 2022 19:36:49 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzhS-00Fw19-9i for linux-arm-kernel@lists.infradead.org; Fri, 21 Jan 2022 19:35:57 +0000 Received: by mail-wr1-x42e.google.com with SMTP id az25so1508331wrb.6 for ; Fri, 21 Jan 2022 11:35:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d4sAbydBa6W6M0KWJr4NJNHgDhBapvpROJ25McC5A7M=; b=p2ncYGphnqAoSSSZZD8XPCS74x1UwF5/KwTSVYNvJFVM+ws7tw6BC5HUBVeNN8TmWh R1+my8gky0wyBVFTZOvrzlIiQTmBVdyUoSBJQ6jE+X4JK1cS6OrS3K7WJxgEeV4qxd+Q I0Yn07KKP5ZXzzfGLWKSO9Zge6xKAhNTPwwPoFn4bWEMWHp6oL1BIw+oB6HkL3XK1JIR 0ZEMLpisSFx3da6htr0P3luaueykWCkQrva3S0fYJehIDI3oAxNyyLs/0wdAzWlqzD4K jf+2hYGD81ucf0B19yMCHr3o7Ul0PU6JUObnOXi0wiV+w+743FiDYZMYa0Qx/ZTfqgKU HkBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d4sAbydBa6W6M0KWJr4NJNHgDhBapvpROJ25McC5A7M=; b=e22waq3vDJ9JanfYRBPwGon/2JDlsl/OS8BHKqQoPFY7B+1RYskmFtwIVyiLAtmhrT yQ37YRlZTBlxQwjPxeho5LujD/4DeYQfLC6ZziPKLHF+KokTC9/7q/f0K8j8GIl+Z/0B mJnKHa4OLtuW7Uj91qKiHYmCKzcGQfUsh5zXSKIlDKkmYakK2++ySpjuM13XI7/rU3kA eeRI6AFqJzGApEHjTsLeWimKlwVSM8LHJddzJE68J2eKynL3OsICg8bnL1eI1+43NAfk yDYJIdq4Dy7TPfIEci25mwXjDxH9dAHg0QK9TQ9vSu8GPq5TglUhVaUhmQxXF0s0sCL3 /5jg== X-Gm-Message-State: AOAM530vfGM7Y2AtdGZmOgUCMcU7JMhMg9T5RpKQNlqOW/TmTKDJox+b KMXT7P4YHaF2+9QKql5L51k= X-Google-Smtp-Source: ABdhPJyoMa6h+QV3U9ZJKFFXeM6EmKvKJmLP8k1S4h05psxRryYiGDIt6Kq4q71VB29rfUh9Ifq0Og== X-Received: by 2002:adf:f80a:: with SMTP id s10mr4908198wrp.416.1642793751428; Fri, 21 Jan 2022 11:35:51 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id h127sm13318635wmh.27.2022.01.21.11.35.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 11:35:51 -0800 (PST) From: Romain Perier To: Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Arnd Bergmann , Daniel Palmer , Romain Perier , Rob Herring Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Willy Tarreau Subject: [PATCH v3 2/9] clk: mstar: msc313 cpupll clk driver Date: Fri, 21 Jan 2022 20:35:37 +0100 Message-Id: <20220121193544.23231-3-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220121193544.23231-1-romain.perier@gmail.com> References: <20220121193544.23231-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220121_113554_377883_9F8F43B6 X-CRM114-Status: GOOD ( 33.19 ) 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 From: Daniel Palmer Add a driver for the CPU pll/ARM pll/MIPS pll that is present in MStar SoCs. Currently there is no documentation for this block so it's possible this driver isn't entirely correct. Only tested on the version of this IP in the MStar/SigmaStar ARMv7 SoCs. Co-authored-by: Willy Tarreau Signed-off-by: Daniel Palmer --- drivers/clk/mstar/Kconfig | 8 + drivers/clk/mstar/Makefile | 2 +- drivers/clk/mstar/clk-msc313-cpupll.c | 221 ++++++++++++++++++++++++++ 3 files changed, 230 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/mstar/clk-msc313-cpupll.c diff --git a/drivers/clk/mstar/Kconfig b/drivers/clk/mstar/Kconfig index de37e1bce2d2..146eeb637318 100644 --- a/drivers/clk/mstar/Kconfig +++ b/drivers/clk/mstar/Kconfig @@ -1,4 +1,11 @@ # SPDX-License-Identifier: GPL-2.0-only +config MSTAR_MSC313_CPUPLL + bool "MStar CPUPLL driver" + depends on ARCH_MSTARV7 || COMPILE_TEST + default ARCH_MSTARV7 + help + Support for the CPU PLL present on MStar/Sigmastar SoCs. + config MSTAR_MSC313_MPLL bool "MStar MPLL driver" depends on ARCH_MSTARV7 || COMPILE_TEST @@ -7,3 +14,4 @@ config MSTAR_MSC313_MPLL help Support for the MPLL PLL and dividers block present on MStar/Sigmastar SoCs. + diff --git a/drivers/clk/mstar/Makefile b/drivers/clk/mstar/Makefile index f8dcd25ede1d..21296a04e65a 100644 --- a/drivers/clk/mstar/Makefile +++ b/drivers/clk/mstar/Makefile @@ -2,5 +2,5 @@ # # Makefile for mstar specific clk # - +obj-$(CONFIG_MSTAR_MSC313_CPUPLL) += clk-msc313-cpupll.o obj-$(CONFIG_MSTAR_MSC313_MPLL) += clk-msc313-mpll.o diff --git a/drivers/clk/mstar/clk-msc313-cpupll.c b/drivers/clk/mstar/clk-msc313-cpupll.c new file mode 100644 index 000000000000..c57b509e8c20 --- /dev/null +++ b/drivers/clk/mstar/clk-msc313-cpupll.c @@ -0,0 +1,221 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2019 Daniel Palmer + */ + +#include +#include +#include + +/* + * This IP is not documented outside of the messy vendor driver. + * Below is what we think the registers look like based on looking at + * the vendor code and poking at the hardware: + * + * 0x140 -- LPF low. Seems to store one half of the clock transition + * 0x144 / + * 0x148 -- LPF high. Seems to store one half of the clock transition + * 0x14c / + * 0x150 -- vendor code says "toggle lpf enable" + * 0x154 -- mu? + * 0x15c -- lpf_update_count? + * 0x160 -- vendor code says "switch to LPF". Clock source config? Register bank? + * 0x164 -- vendor code says "from low to high" which seems to mean transition from LPF low to + * LPF high. + * 0x174 -- Seems to be the PLL lock status bit + * 0x180 -- Seems to be the current frequency, this might need to be populated by software? + * 0x184 / The vendor driver uses these to set the initial value of LPF low + * + * Frequency seems to be calculated like this: + * (parent clock (432mhz) / register_magic_value) * 16 * 524288 + * Only the lower 24 bits of the resulting value will be used. In addition, the + * PLL doesn't seem to be able to lock on frequencies lower than 220 MHz, as + * divisor 0xfb586f (220 MHz) works but 0xfb7fff locks up. + * + * Vendor values: + * frequency - register value + * + * 400000000 - 0x0067AE14 + * 600000000 - 0x00451EB8, + * 800000000 - 0x0033D70A, + * 1000000000 - 0x002978d4, + */ + +#define REG_LPF_LOW_L 0x140 +#define REG_LPF_LOW_H 0x144 +#define REG_LPF_HIGH_BOTTOM 0x148 +#define REG_LPF_HIGH_TOP 0x14c +#define REG_LPF_TOGGLE 0x150 +#define REG_LPF_MYSTERYTWO 0x154 +#define REG_LPF_UPDATE_COUNT 0x15c +#define REG_LPF_MYSTERYONE 0x160 +#define REG_LPF_TRANSITIONCTRL 0x164 +#define REG_LPF_LOCK 0x174 +#define REG_CURRENT 0x180 + +#define LPF_LOCK_TIMEOUT 100000000 + +#define MULTIPLIER_1 16 +#define MULTIPLIER_2 524288 +#define MULTIPLIER (MULTIPLIER_1 * MULTIPLIER_2) + +struct msc313_cpupll { + void __iomem *base; + struct clk_hw clk_hw; +}; + +#define to_cpupll(_hw) container_of(_hw, struct msc313_cpupll, clk_hw) + +static u32 msc313_cpupll_reg_read32(struct msc313_cpupll *cpupll, unsigned int reg) +{ + u32 value; + + value = ioread16(cpupll->base + reg + 4) << 16; + value |= ioread16(cpupll->base + reg); + + return value; +} + +static void msc313_cpupll_reg_write32(struct msc313_cpupll *cpupll, unsigned int reg, u32 value) +{ + u16 l = value & 0xffff, h = (value >> 16) & 0xffff; + + iowrite16(l, cpupll->base + reg); + iowrite16(h, cpupll->base + reg + 4); +} + +static void msc313_cpupll_setfreq(struct msc313_cpupll *cpupll, u32 regvalue) +{ + ktime_t timeout; + + msc313_cpupll_reg_write32(cpupll, REG_LPF_HIGH_BOTTOM, regvalue); + + iowrite16(0x1, cpupll->base + REG_LPF_MYSTERYONE); + iowrite16(0x6, cpupll->base + REG_LPF_MYSTERYTWO); + iowrite16(0x8, cpupll->base + REG_LPF_UPDATE_COUNT); + iowrite16(BIT(12), cpupll->base + REG_LPF_TRANSITIONCTRL); + + iowrite16(0, cpupll->base + REG_LPF_TOGGLE); + iowrite16(1, cpupll->base + REG_LPF_TOGGLE); + + timeout = ktime_add_ns(ktime_get(), LPF_LOCK_TIMEOUT); + while (!(ioread16(cpupll->base + REG_LPF_LOCK))) { + if (ktime_after(ktime_get(), timeout)) { + pr_err("timeout waiting for LPF_LOCK\n"); + return; + } + cpu_relax(); + } + + iowrite16(0, cpupll->base + REG_LPF_TOGGLE); + + msc313_cpupll_reg_write32(cpupll, REG_LPF_LOW_L, regvalue); +} + +static unsigned long msc313_cpupll_frequencyforreg(u32 reg, unsigned long parent_rate) +{ + unsigned long long prescaled = ((unsigned long long)parent_rate) * MULTIPLIER; + + if (prescaled == 0 || reg == 0) + return 0; + return DIV_ROUND_DOWN_ULL(prescaled, reg); +} + +static u32 msc313_cpupll_regforfrequecy(unsigned long rate, unsigned long parent_rate) +{ + unsigned long long prescaled = ((unsigned long long)parent_rate) * MULTIPLIER; + + if (prescaled == 0 || rate == 0) + return 0; + return DIV_ROUND_UP_ULL(prescaled, rate); +} + +static unsigned long msc313_cpupll_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) +{ + struct msc313_cpupll *cpupll = to_cpupll(hw); + + return msc313_cpupll_frequencyforreg(msc313_cpupll_reg_read32(cpupll, REG_LPF_LOW_L), + parent_rate); +} + +static long msc313_cpupll_round_rate(struct clk_hw *hw, unsigned long rate, + unsigned long *parent_rate) +{ + u32 reg = msc313_cpupll_regforfrequecy(rate, *parent_rate); + long rounded = msc313_cpupll_frequencyforreg(reg, *parent_rate); + + /* + * This is my poor attempt at making sure the resulting + * rate doesn't overshoot the requested rate. + */ + for (; rounded >= rate && reg > 0; reg--) + rounded = msc313_cpupll_frequencyforreg(reg, *parent_rate); + + return rounded; +} + +static int msc313_cpupll_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) +{ + struct msc313_cpupll *cpupll = to_cpupll(hw); + u32 reg = msc313_cpupll_regforfrequecy(rate, parent_rate); + + msc313_cpupll_setfreq(cpupll, reg); + + return 0; +} + +static const struct clk_ops msc313_cpupll_ops = { + .recalc_rate = msc313_cpupll_recalc_rate, + .round_rate = msc313_cpupll_round_rate, + .set_rate = msc313_cpupll_set_rate, +}; + +static const struct of_device_id msc313_cpupll_of_match[] = { + { .compatible = "mstar,msc313-cpupll" }, + {} +}; + +static const struct clk_parent_data cpupll_parent = { + .index = 0, +}; + +static int msc313_cpupll_probe(struct platform_device *pdev) +{ + struct clk_init_data clk_init = {}; + struct device *dev = &pdev->dev; + struct msc313_cpupll *cpupll; + int ret; + + cpupll = devm_kzalloc(&pdev->dev, sizeof(*cpupll), GFP_KERNEL); + if (!cpupll) + return -ENOMEM; + + cpupll->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(cpupll->base)) + return PTR_ERR(cpupll->base); + + /* LPF might not contain the current frequency so fix that up */ + msc313_cpupll_reg_write32(cpupll, REG_LPF_LOW_L, + msc313_cpupll_reg_read32(cpupll, REG_CURRENT)); + + clk_init.name = dev_name(dev); + clk_init.ops = &msc313_cpupll_ops; + clk_init.parent_data = &cpupll_parent; + clk_init.num_parents = 1; + cpupll->clk_hw.init = &clk_init; + + ret = devm_clk_hw_register(dev, &cpupll->clk_hw); + if (ret) + return ret; + + return of_clk_add_hw_provider(pdev->dev.of_node, of_clk_hw_simple_get, &cpupll->clk_hw); +} + +static struct platform_driver msc313_cpupll_driver = { + .driver = { + .name = "mstar-msc313-cpupll", + .of_match_table = msc313_cpupll_of_match, + }, + .probe = msc313_cpupll_probe, +}; +builtin_platform_driver(msc313_cpupll_driver); From patchwork Fri Jan 21 19:35:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12720157 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 CDB0FC433EF for ; Fri, 21 Jan 2022 19:37: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=meVABJ/uluQOF8Je/1uEng7j6iGQwwNQVoYs1oEND3k=; b=on4Y8MdhqQXs8h c0Rk3Ewz1x6IJa/vXxdPWb7+nhksFAtazDFSleDFZ0N1Q8y3+gC4sojRR23Oab3klyYmTFY3uoDHG Nn+rdE5NxGIrp/JVWzRAkGpiue/nUl2RyF+EqezMd2Yt4u+UBf0mcaye/LIu1QT19lKQrq6SFHSWT XD5cGJXajSpTwXADwxO9a5O78Wh6w1NFZm68h4kn/DR259cOxKyzwIi6jZ0qafMGL9U03TgoOeS1R py77/i9EdDs4m+fe+4svaXnPV3m+9F5+txcSYCyDU4l7MuOniCtDU2L5wWwEq51Q8K6N+3c0unVc7 TpUcZ59jI1jXB1XTRR9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzho-00Fw7M-Gd; Fri, 21 Jan 2022 19:36:16 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzhS-00Fw1E-9W for linux-arm-kernel@lists.infradead.org; Fri, 21 Jan 2022 19:35:56 +0000 Received: by mail-wr1-x42e.google.com with SMTP id r14so1505072wrp.2 for ; Fri, 21 Jan 2022 11:35:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0JpeJi0yBD942AUCHxsREdLSnIblSWTMYzLY8RDVTEU=; b=g89/RYLsr7FhFgcDDsXD99vhKX5uqRjLhBcwrrLR83njKs5S/mdvoQuwrTKkpynicL 2CIIZwXJgrN2gpBu36IB7mrmXmE3LRSIcFPclowEwuNpiPrXXRAEW1bVfrgwdHqn95vQ J4AHIrGpgjxhZ3IMS0LwolLgm+B6UbiCPij5hYg1lmyx5XFxfbD9it8cUeDvoa4aJDze Il5fuhEXqArrzA3s7gw3I49JyQWzEYmNpUh/XD0kszWZ1yZrPlDj0SuP9t8hXa/bJPNH 2VqPDlo29ZrIKdJYgYCpBGycHUMG8pm2RP9IzVjVbEOFAvPJOj2rvP+g2IMK/wpArgtx Ho5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0JpeJi0yBD942AUCHxsREdLSnIblSWTMYzLY8RDVTEU=; b=4uLZE9NA6p0xoC7pNhSNYmNCX4qgbUxIY+9AWSiPsJ1AlsW4jab13GHmV4xIcXdNng KXDuhfrvouOlEu7U38wcd8kAy20Wnk3AeuLNwQdtPOgwhGYQYIjB5GsQSGDezdzUgfVy hpjBpxWJA9XR18/M1LPXW4GigQn1cstdZosl+j0/IKSFNod6o/pk92D4yzY68kGHQgY1 JT/FCsCtFrK/MmI+4rrXs63oLIVkeA7N6tiQlAHtu85xWT9fe7XiDTOaKRPIHuLaOxjU qZTGMPyRCc9dRztpbgWIBTVxc2f6r6E02Nkax88O0HRPT30F1n8T4lfbahEmg4zxGe84 A7LA== X-Gm-Message-State: AOAM5329IyCeAjNyCuBhvRV4Po6AggeaBsVn2m8j5BJFEgGrMd/Z2zfo qAQLFCacDLYxhcVwKYxun1M= X-Google-Smtp-Source: ABdhPJyAxIZmmPjhGkJnYRvDD5xzZYz10q6HKrGo8VBRZwYaIehVpahipvtp6YOM03iYduGtKcdWmg== X-Received: by 2002:adf:e806:: with SMTP id o6mr5370065wrm.331.1642793752502; Fri, 21 Jan 2022 11:35:52 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id v124sm11517940wme.30.2022.01.21.11.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 11:35:52 -0800 (PST) From: Romain Perier To: Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Arnd Bergmann , Daniel Palmer , Romain Perier , Rob Herring Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/9] ARM: mstar: Add cpupll to base dtsi Date: Fri, 21 Jan 2022 20:35:38 +0100 Message-Id: <20220121193544.23231-4-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220121193544.23231-1-romain.perier@gmail.com> References: <20220121193544.23231-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220121_113554_362472_33898E22 X-CRM114-Status: GOOD ( 11.47 ) 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 From: Daniel Palmer All MStar/SigmaStar ARMv7 SoCs have the CPU PLL at the same place so add it to the base dtsi. Signed-off-by: Daniel Palmer --- arch/arm/boot/dts/mstar-v7.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/mstar-v7.dtsi b/arch/arm/boot/dts/mstar-v7.dtsi index 89ebfe4f29da..2249faaa3aa7 100644 --- a/arch/arm/boot/dts/mstar-v7.dtsi +++ b/arch/arm/boot/dts/mstar-v7.dtsi @@ -155,6 +155,13 @@ mpll: mpll@206000 { clocks = <&xtal>; }; + cpupll: cpupll@206400 { + compatible = "mstar,msc313-cpupll"; + reg = <0x206400 0x200>; + #clock-cells = <0>; + clocks = <&mpll MSTAR_MSC313_MPLL_DIV2>; + }; + gpio: gpio@207800 { #gpio-cells = <2>; reg = <0x207800 0x200>; From patchwork Fri Jan 21 19:35:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12720159 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 6E2FFC433F5 for ; Fri, 21 Jan 2022 19:37:39 +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=4L//94/KQ+BFzxzha0MqyQNIZZiLvYbFczZoEnneUVU=; b=4x2R/ezFSsc/RX qSrCbXLZ11Qaw5knogQAdQm0Qar/BcMAJ61xvAfWGYRZ2zY4Z11UbGumnsYQ+x0n57S8xFhJgLRaK OPtCdRDgP0h9li7LwLMSUqNcnRqQ0nUUthuRxekI2J+cAZagXtQwPnCBQ3GwYoWVQ1IO5Zst3hQ8m De7Z9oUbeH1adPctmkS9STPqMcCPN2pos+nbpKCJWylRfFpksoTw3JQu5Tx6tJbFbczPfER2pXMF0 dwcd4jJybCplMeMdDdpupKny9vVHCVj4ZgZFUGSANeHTgRPif1F9GWxFT7RdD/LhqGsIR6BRt15gU Cx5xe6Ps0/vPt24IlUQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzhy-00Fw9A-F4; Fri, 21 Jan 2022 19:36:26 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzhT-00Fw1H-1f for linux-arm-kernel@lists.infradead.org; Fri, 21 Jan 2022 19:35:56 +0000 Received: by mail-wr1-x42f.google.com with SMTP id i2so1511017wrb.12 for ; Fri, 21 Jan 2022 11:35:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PSLPG0MzXHr2sBAsU44qorgJ49GZ8FzI0+68Kp64Drs=; b=Zb3yvV8MVsbfeX2uJTVV0mDC/k2FVo5eUqOEa/6+RsmzqRnVdxDKLBqIORddIF8P4a SJ82SjXJm/LnU/+KgeyRnVoAu2/AZkEFyEBIKuz66YRdjjNYdCsX2m0JJ8OZB3XrSLXd ma7fKE0aXjWBMNCiQVaNYvAyW1beQeV8prUT0UgMdyS3jU+RoFRqvqAMuFMG8+CuUgp3 LcTV1BU09Px/X4sw9YXA1Fyqi+lDmy/tpGN67mn+sGsmeecCtRIfITVlICunM7HYfG4W 8niX6RdzqQy1Y/R1CdwVynDw7IQb2r7+ENcHd/UbzKs3yeqRHehoYJQTbJw34SlSsHZy O1MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PSLPG0MzXHr2sBAsU44qorgJ49GZ8FzI0+68Kp64Drs=; b=51IBgQk88jW6tQdtL9TBT3k7dUUtU3+PYYP89BvTgWj0+mPtWLbmMq7mq/Nnj1YdKW t03X98QkMedcYCbbO3h3fCdWzCLD3LxfjKRuK+2FDN9/udyjpf6Nzxxvi0GGt5ZNhIPK JNYcYcrs3FDoaLbn2SPnbInZF2f9urp1DUxZg1uqz0Cv7AgJDehBgse3SR1hgfXF7g0q F20reKAyZsSZapNwc+ULYcCedYBEDqruSXfv3wDBoFbhpo3qSWtpqNg5wfHsSw1uSdgU wX+wW1s6wTRAnzHn1i9C4LCZl/KecuvvVDQujVA2B403TdRhfrheoDsTEUx4I1YsRo6x yZ1Q== X-Gm-Message-State: AOAM530lWpn6it0cwmpACyuW9ttQvgKFcG02WJpuS84KWEVOkIkQcDMx qvsq+XRdG9Wh8g+Dr4jR+Hc= X-Google-Smtp-Source: ABdhPJz/yyKTop0c1yy7w6Te13IbfsihUpUUoHk/+QjEOJh7+CLMLP5HY4zH5iMxPZBPv9M8ghdBYA== X-Received: by 2002:a05:6000:1092:: with SMTP id y18mr5111916wrw.668.1642793753680; Fri, 21 Jan 2022 11:35:53 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id 16sm5739222wmj.12.2022.01.21.11.35.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 11:35:53 -0800 (PST) From: Romain Perier To: Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Arnd Bergmann , Daniel Palmer , Romain Perier , Rob Herring Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/9] ARM: mstar: Link cpupll to cpu Date: Fri, 21 Jan 2022 20:35:39 +0100 Message-Id: <20220121193544.23231-5-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220121193544.23231-1-romain.perier@gmail.com> References: <20220121193544.23231-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220121_113555_111699_D731E8A3 X-CRM114-Status: GOOD ( 11.58 ) 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 From: Daniel Palmer The CPU clock is sourced from the CPU PLL. Link cpupll to the cpu so that frequency scaling can happen. Signed-off-by: Daniel Palmer --- arch/arm/boot/dts/mstar-v7.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/mstar-v7.dtsi b/arch/arm/boot/dts/mstar-v7.dtsi index 2249faaa3aa7..c26ba9b7b6dd 100644 --- a/arch/arm/boot/dts/mstar-v7.dtsi +++ b/arch/arm/boot/dts/mstar-v7.dtsi @@ -21,6 +21,8 @@ cpu0: cpu@0 { device_type = "cpu"; compatible = "arm,cortex-a7"; reg = <0x0>; + clocks = <&cpupll>; + clock-names = "cpuclk"; }; }; From patchwork Fri Jan 21 19:35:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12720161 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 21AEFC433F5 for ; Fri, 21 Jan 2022 19:37:50 +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=/Ejxc9QtOI3dZo1Q6wjz6L7kEQGgTBzGbghjj4mZwWM=; b=SCeDBOWqD0bQtX CzpoSuz43jLERI0ifhW5vH8LOkfGpBnO45gMYFpYEpruTcezBLST7w+8Ngttos/6kAQCAmIfG6w5t VzfwNj2dl9ntAJC4jUq1rIIIJcOTC51CvEUfZju4Yek8fX+aFqcUQx3ikR9Cm+8d8fidJV2p9IFmx k2g0ttWwmvpXoDOSfd4llEoUDllwsGNLYvRT1QdBSPsFa2qD0F8+I/ziQwMhJuJT+O2EocX6lnX/0 qok2u9E5ilVNVHWwNxJ48is7B7R2sS+f56fYDJ1ZNr8fQevnAcYXqToaHVYhjp3sgt2nOWGGS1Up/ puQJQupFT8hQVUHzjfPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzi9-00FwC9-IZ; Fri, 21 Jan 2022 19:36:37 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzhU-00Fw2d-4l for linux-arm-kernel@lists.infradead.org; Fri, 21 Jan 2022 19:35:57 +0000 Received: by mail-wr1-x42c.google.com with SMTP id s4so595758wrb.0 for ; Fri, 21 Jan 2022 11:35:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XBkuRgwe6wjN8B0dWdq4qTtmz/vmICR+ObQMfngMweY=; b=O9JyzuHxsKOFunpzLm1NYXhbGQa+ChfNsd5JWvOX1nyic3o+BdNjoHrCWDNqYzAl4M LfFFoWvm8LKZyZjppzTfSytupqohwTAayMTqzC4cve5IFWjCIO5HJoCdLEMkokywfa1O 8qpUdG/AxUgcjnNP0zCUHuTujGd6LEbTHwJT103aAiH0AX/ukX6aKls9RFzu06E2x5LE QuA2rSsoUYLcwm2eHwZgZDwua9K76EeFKhMgqJTorQE2AG5LJIXdQtfb3px9dwtdZOI/ 3UvDUkkogf/rprv5ZC4TzGqJpswbE9mcwlozOyzsuwmf/rM84Kfp3E8QGXicgkQw3M0R Hc/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XBkuRgwe6wjN8B0dWdq4qTtmz/vmICR+ObQMfngMweY=; b=Z0318bf4imxLLBaPMEgXcmHtwBF9VPjmXmSc4laekXGYM8ZBMiv3FherAsW3YOkFv+ rSudiDm3gPEoyCUFegUbG7LQe5vm5CUEkB9NiAztoda3xM1rPLDfVjUpi9mZkiwbJ2Q4 2KZcktrVxMoNGMKhuE78oqbGj1DTS8H/lFgVG3kUFxFYftcyk3OsVufZjahWvQABRjid uDEHYyPerAJorbzsuKZvdLqWbjK4Tdt2vRH4DBGF+g06HrWmWJHfVweblWr9mwDWgS4o mc822lgS0dFtAwj63IIRePHTDkE7W22ldr/53vZWf71Mkpt9zzWSeW/wO3fmxi8rrCks nfJA== X-Gm-Message-State: AOAM533GNLvQ42BxlahGZbpgLgwwxRSHk+UnEM3pRSYkBHJ2zHlb7F1P YENkD1Rw2SvlLJ6zkMiCwTE= X-Google-Smtp-Source: ABdhPJy1LaVeyY+Ot8O5P3cv87hxYyzBFU4XK/HMU1KkSa+tiFmuEgPZ54IgF+1VaedIe+Ar6XVxfw== X-Received: by 2002:a5d:6481:: with SMTP id o1mr4770121wri.682.1642793754716; Fri, 21 Jan 2022 11:35:54 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id l6sm8685539wry.75.2022.01.21.11.35.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 11:35:54 -0800 (PST) From: Romain Perier To: Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Arnd Bergmann , Daniel Palmer , Romain Perier , Rob Herring Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/9] ARM: mstar: Link cpupll to second core Date: Fri, 21 Jan 2022 20:35:40 +0100 Message-Id: <20220121193544.23231-6-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220121193544.23231-1-romain.perier@gmail.com> References: <20220121193544.23231-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220121_113556_211706_093624B8 X-CRM114-Status: GOOD ( 11.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 From: Daniel Palmer The second core also sources it's clock from the CPU PLL. Signed-off-by: Daniel Palmer --- arch/arm/boot/dts/mstar-infinity2m.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/mstar-infinity2m.dtsi b/arch/arm/boot/dts/mstar-infinity2m.dtsi index 6d4d1d224e96..dc339cd29778 100644 --- a/arch/arm/boot/dts/mstar-infinity2m.dtsi +++ b/arch/arm/boot/dts/mstar-infinity2m.dtsi @@ -11,6 +11,8 @@ cpu1: cpu@1 { device_type = "cpu"; compatible = "arm,cortex-a7"; reg = <0x1>; + clocks = <&cpupll>; + clock-names = "cpuclk"; }; }; From patchwork Fri Jan 21 19:35:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12720163 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 53526C433F5 for ; Fri, 21 Jan 2022 19:38:19 +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=zuAVxITnDGuI7CCCRczLlewiE8ZbkDOxszaB3cD5llw=; b=0AS7H2H9PZoPTa FafRwuwbXmkuDcxkM2+FlgtkRtNc8HkzEXkSBJlf39xOgqmA4MVOuAafUQd2OLsozPhxGow/w76cB FBpw5+5+Wwui0eYj8yYe6WyeRKDhCrLcf0HQTnUALoZAEpxiCHjKSk0jumoTrkLDa7KbW20/KieJr 9cwQFODN24WewrQ5GuW1mtyeHA2tGx0+7MeoeqhfeHpQa2w1qJni0D0EAJezRGWNiHejKmV0ZJajg 8V/H9iGo3+mu4ZSvV98maE81KDDQMQ3a+47wVu+cJ9tvXxUXpvHR4dQziVvFLhTrwhCkdGeKU4KiF Cg8/5bl5BDXu0FMILlfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAziX-00FwLV-CU; Fri, 21 Jan 2022 19:37:01 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzhV-00Fw39-CO for linux-arm-kernel@lists.infradead.org; Fri, 21 Jan 2022 19:35:58 +0000 Received: by mail-wm1-x32d.google.com with SMTP id o1-20020a1c4d01000000b0034d95625e1fso15478159wmh.4 for ; Fri, 21 Jan 2022 11:35:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MwkPi3zTHNX/WgU468/COGljzbksLucVcX9Vresnwgs=; b=LwnDHY743c6eDbeipZdlM8nn4Dgac96JeYrvbzh6fJdwrL35SIQ9aku/vaFiTegm3I SNuL3Bmz+M78HJHbi5s+cuiave4A7a7zlOwklF+Ggc2cKwnOg7hZtijbV5aktMdXKxIo ZV3JLYW58W+KMvDySOGlYyUR4xsnAzon4tiyrlqVSmukDZvgm0nJgh7KHyLFqc315M0q hcpykVuCISlRUuGHZZ9DPKRtkgpR7AIa33NfxCVz2vFwOajBy3HpgqGtzF3cZ7jHh0+t X5k9KT1C4bmll5y4l+VUQ1uzleNv7KLOfA+Pre0ejloffDRu3Lxr60VqSLRbKha1pA+9 xdDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MwkPi3zTHNX/WgU468/COGljzbksLucVcX9Vresnwgs=; b=GKL68VccEfFTeU0LOIIjVac7/JRmKrM+LGX3B+8C1QQ5lB/WBf4tessSPw7Xx6yixi /QWkHcsBNLJtA/9WM37cbzKadAF1qwBSBVRaFlPNK2ZdGohrAZ+k981qwqL0o9zneptr OTRefQ+QU59dQPF3L9oQxbi7LZIHeZv07J5RPvuLKw23xEi/kvN6U31o9oNzb6z5cl4r vEZKDEfUy7oVNYwKx52tcAy40rrBb5do+cRzfhNO7DPRmUI5imt0zu6oDmmQvkskFP4J JmZ9dBnuwyENDz9YwudHV2M+0g/9rcrq5lqkQ3r7CdYKZ2wUM8AuUwQUIHmRAGdO3pik h55w== X-Gm-Message-State: AOAM531pfmBa0Ox5ISPCktj15Q5Tsqe0Da74ChLwU1KgP/hH6+DbtP7X UNsjekMDGSQnf9NeHguka/U= X-Google-Smtp-Source: ABdhPJyFsQthU3A6b+uTqQqhxIKQGXmdPyc/ikXDfHK3s6P81y5blSPkoLY8ftvYXEVZEY0zDYbBpA== X-Received: by 2002:a05:600c:255:: with SMTP id 21mr2093446wmj.108.1642793755826; Fri, 21 Jan 2022 11:35:55 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id n16sm6151123wms.13.2022.01.21.11.35.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 11:35:55 -0800 (PST) From: Romain Perier To: Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Arnd Bergmann , Daniel Palmer , Romain Perier , Rob Herring Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Willy Tarreau Subject: [PATCH v3 6/9] ARM: mstar: Add OPP table for infinity Date: Fri, 21 Jan 2022 20:35:41 +0100 Message-Id: <20220121193544.23231-7-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220121193544.23231-1-romain.perier@gmail.com> References: <20220121193544.23231-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220121_113557_514195_F0C68E9A X-CRM114-Status: GOOD ( 11.62 ) 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 From: Daniel Palmer Add an OPP table for the inifinity chips so that cpu frequency scaling can happen. Co-authored-by: Willy Tarreau Signed-off-by: Daniel Palmer --- arch/arm/boot/dts/mstar-infinity.dtsi | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/arch/arm/boot/dts/mstar-infinity.dtsi b/arch/arm/boot/dts/mstar-infinity.dtsi index 0bee517797f4..441a917b88ba 100644 --- a/arch/arm/boot/dts/mstar-infinity.dtsi +++ b/arch/arm/boot/dts/mstar-infinity.dtsi @@ -8,6 +8,40 @@ #include +/ { + cpu0_opp_table: opp_table0 { + compatible = "operating-points-v2"; + opp-shared; + + opp-240000000 { + opp-hz = /bits/ 64 <240000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <300000>; + }; + + opp-400000000 { + opp-hz = /bits/ 64 <400000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <300000>; + }; + opp-600000000 { + opp-hz = /bits/ 64 <600000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <300000>; + }; + + opp-800000000 { + opp-hz = /bits/ 64 <800000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <300000>; + }; + }; +}; + +&cpu0 { + operating-points-v2 = <&cpu0_opp_table>; +}; + &imi { reg = <0xa0000000 0x16000>; }; From patchwork Fri Jan 21 19:35:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12720174 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 6B743C433EF for ; Fri, 21 Jan 2022 19:38:46 +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=6vD39w+51XSMPo3Ewt2sTEqNG6g1NMJdpfqFKyShc/0=; b=2/lWtX2KuF3JWJ Qc4Oat4KqiqZYE+XQKS2bafw1vEnZjUWbvhGiir51HO0IPHyF5Of1DyA7IDabgDDVrSaBQnpQhgPL pwcUuZInjetc0e6oJBE8AYyHaNVfGlXjj/ALfECGj2t8ERRxLre/P5EGRbfJ6UvSEWs5M+CNQmIQ7 Jypa4PO5GvYHPvCPgrqVmbrGhbGv9ldsaHyStxthL9taLwcZyT/v+mHraIJAfPc93RUhyWIf+h+kA a6TpjCeBPtr/Rlcm700gbPUFQ/4GM7/dTA6SBompdVQyS1BzhsNe6kZRuzC5kdms3jfKLbEhogIKL sqLbIWWB4b4QnUYInEXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzit-00FwWa-LJ; Fri, 21 Jan 2022 19:37:23 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzhW-00Fw3U-4O for linux-arm-kernel@lists.infradead.org; Fri, 21 Jan 2022 19:35:59 +0000 Received: by mail-wm1-x331.google.com with SMTP id j5-20020a05600c1c0500b0034d2e956aadso23373748wms.4 for ; Fri, 21 Jan 2022 11:35:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=21h9f/ui8ZIqSSrHzJ4KrN8YACvdlcc8m+OIu8z6NvM=; b=ChJ5C4kaaPI5FOo+yQV886VnzSu4zGeWDBiucW3jXXe/7bjC7nwsfRhhl4bKytkqKY 4+GOSQf6Rcb6PtJ9fpTMvGwk758DhPWsP+f3UhkZV3/i9jc7BUiEwYn58oDY/WzXyD0b EkGKdXAxxgFJ7ST/ZPZh8yvgwy+5h5fv6/aY0B8O+Kc9xlNMmmVHI/bAid4E5cZ9BQQt TLhFGobrz/vTKhFU2XOygjqhSwBQ5pSgdWRpY5BuP84uqlYtn2BJeVJd+0d56vpYVXaa +KsRwxhGYZEOGXsryPxJ/fk0J6f260RmmQFw0X1rik8zDcRhccTR7J8LzeE47h1Alqty cRuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=21h9f/ui8ZIqSSrHzJ4KrN8YACvdlcc8m+OIu8z6NvM=; b=hLfCaIkj5glYwP6YGSc8yKAZsp1Ly0yUXlsiqCbPF/o++07Nty91geNZG3IPt2LUnV OtDQ9Z2YgIk5/+SZv2el9xRQsZfzP/uvO4/Q4stJRKJSBJ4KFN0SrGgw7FOQPw5SKXXz BnaxC9Jqtifw1+89Y029GUiW8qrK/xV3ogMmuY0XBIpd38S0bn+rrSLx5eaDIg2LMr18 gPcoW0EWIVdBWrG9GLqsSE23aAngdnIicwYP44ygQErPKZ7E7nNDNV/MfQBUNWhgILUv p9NBv5IRTRg4wi0DrvkQiaXRCNT+0vFkVP7yyV2MNGmKPN0mWlTBhs0eR9JnXnVPcwgn a+qQ== X-Gm-Message-State: AOAM533q9M2gNrK6YnqZohsRdPDmkuect6gjApxtTtidAYg+IuozSuqF 6M+zqfcWHfcN99VFSD2rckA= X-Google-Smtp-Source: ABdhPJyF6mhUKvyKvBtUdyPCx+PCcxt329Pk0xVJAVdoo7pJZUxMrUv2vevCHFg3ydT1rwgY2vKS/Q== X-Received: by 2002:a05:600c:1da2:: with SMTP id p34mr1987262wms.97.1642793756985; Fri, 21 Jan 2022 11:35:56 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id p19sm6213407wmq.19.2022.01.21.11.35.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 11:35:56 -0800 (PST) From: Romain Perier To: Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Arnd Bergmann , Daniel Palmer , Romain Perier , Rob Herring Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Willy Tarreau Subject: [PATCH v3 7/9] ARM: mstar: Add OPP table for infinity3 Date: Fri, 21 Jan 2022 20:35:42 +0100 Message-Id: <20220121193544.23231-8-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220121193544.23231-1-romain.perier@gmail.com> References: <20220121193544.23231-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220121_113558_201032_0227E1BC X-CRM114-Status: GOOD ( 11.58 ) 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 From: Daniel Palmer The infinity3 has a slightly higher max frequency compared to the infinity so extend the OPP table. Co-authored-by: Willy Tarreau Signed-off-by: Daniel Palmer --- arch/arm/boot/dts/mstar-infinity3.dtsi | 58 ++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/arch/arm/boot/dts/mstar-infinity3.dtsi b/arch/arm/boot/dts/mstar-infinity3.dtsi index 9857e2a9934d..a56cf29e5d82 100644 --- a/arch/arm/boot/dts/mstar-infinity3.dtsi +++ b/arch/arm/boot/dts/mstar-infinity3.dtsi @@ -6,6 +6,64 @@ #include "mstar-infinity.dtsi" +&cpu0_opp_table { + opp-1008000000 { + opp-hz = /bits/ 64 <1008000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <300000>; + }; + + // overclock frequencies below, shown to work fine up to 1.3 GHz + opp-108000000 { + opp-hz = /bits/ 64 <1080000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <300000>; + turbo-mode; + }; + + opp-1188000000 { + opp-hz = /bits/ 64 <1188000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <300000>; + turbo-mode; + }; + + opp-1296000000 { + opp-hz = /bits/ 64 <1296000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <300000>; + turbo-mode; + }; + + opp-1350000000 { + opp-hz = /bits/ 64 <1350000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <300000>; + turbo-mode; + }; + + opp-1404000000 { + opp-hz = /bits/ 64 <1404000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <300000>; + turbo-mode; + }; + + opp-1458000000 { + opp-hz = /bits/ 64 <1458000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <300000>; + turbo-mode; + }; + + opp-1512000000 { + opp-hz = /bits/ 64 <1512000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <300000>; + turbo-mode; + }; +}; + &imi { reg = <0xa0000000 0x20000>; }; From patchwork Fri Jan 21 19:35:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12720175 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 E100AC433EF for ; Fri, 21 Jan 2022 19:39:09 +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=/Qtp1GKKH/9zuuM2JRBsoUBi//21cFNCa/V2LXtn2tE=; b=n/UXX5N8TDGA9+ ZjJ4srR4lpmcYPCyTCbm7GwY35Kg3ZcurZLbKH3zo3mVpjXEPuHI3osC9GywTFFqizSohrycos+Gj d5cVKD9UkbBgzdyzPiOrcm6IGzcE8C5eICm0hh/OenGo8Kwqr/6h6MoWMcA+B30k9AFhnbJbwSykS lkO8t1BBemLT3ULqX+N+0BtKdjdE4iJiNApGwgJRU5Vsby0+BrNVEsZEzarhdKDmWWkhDMAsbPq0q NABAJsJAQIVQ5IJRRcky1bqzRvax+wADSP6sJEdCAkiB51iRTYfiyVv6VWVPrbbbd/GXoC77LwroE iFq+cYaaMQK8JDLuKOFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzjD-00Fwh5-58; Fri, 21 Jan 2022 19:37:43 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzhX-00Fw4Q-Dk for linux-arm-kernel@lists.infradead.org; Fri, 21 Jan 2022 19:36:00 +0000 Received: by mail-wr1-x42d.google.com with SMTP id q22so1506481wrc.5 for ; Fri, 21 Jan 2022 11:35:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=StcZHqzmvLp6v5k+mwDmcDs/ahnsoFhEqrHgEMI6OjQ=; b=NdscIRvh8fAAFXuKFaXuFzMMpmCBhWr3gQzI2sudRnqcA4FoFC60bzcV0qDFs05El7 w0RQOojsRJGakOew/tA761yJATOkkJoQ4KP8URJQDCmpcCSyAP5GfFdklfJyraWI8Clj gw8ffadp2BQ2hciyvG5bemoNmwKMYEmwnrbZCerGot8+SFeJrCOBEaHNVbXvgjd7Itl8 HW1CnMvw7Uwu8GiVGwS0WF4MN6UHse+xOgCnjR/A+w6pAFWYr5xXgaf6NbujkO2s5A6V PFqbytNQtIZHQISsTB8RUiFs30XvypU5MSah3sRZnwP393N3vCcrBb7+VeDOY5tfADot pqBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=StcZHqzmvLp6v5k+mwDmcDs/ahnsoFhEqrHgEMI6OjQ=; b=irzv4wvHuhi1GOqU9zObcygLokcUdl5+mb9LT/yI5H8tb/L/X1rCDWx6Q9xbZYl3tG XE6ncS3lr8W2rxjlYR05K8ntX8QoYDapWJo3oSRp0mBOg7X+fs0SW3GucwGow4BpcL60 uEWPnkUSNAinKcboJjPXW200xIqWrfp1o5Uls/BN/ACuH0qQ48Ln4N4qQNVPh1jFFUNG 0/r3OkEjr/t4W8Or0Xj2UvhHdRyUFQPyPAeos063PFyqyf8xjE6gWSynHYfJ4F04yJp/ iiwKr26wjfdSIOOVirBYQv/WkFWqAfA/pUKjIeo9M8DMTpmOu//KAl3kGhEYyDT2t26O 4IdQ== X-Gm-Message-State: AOAM533KBcKHV6L2pR0jUlz5+5Ww4BKkTDSTRZUdhKKRwFtXAD5WHEIh nyKblp9F7+4P1akOaUeAMQE= X-Google-Smtp-Source: ABdhPJwE9vP9ZtU3zbsjE3UwgozenBF5PKt1srh15GTFxRwhjzhtsuQQ5sU8utey1E5qVE8U9UJNeA== X-Received: by 2002:a5d:59ae:: with SMTP id p14mr4877325wrr.559.1642793758047; Fri, 21 Jan 2022 11:35:58 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id f13sm7201114wri.49.2022.01.21.11.35.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 11:35:57 -0800 (PST) From: Romain Perier To: Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Arnd Bergmann , Daniel Palmer , Romain Perier , Rob Herring Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 8/9] ARM: mstar: Add OPP table for mercury5 Date: Fri, 21 Jan 2022 20:35:43 +0100 Message-Id: <20220121193544.23231-9-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220121193544.23231-1-romain.perier@gmail.com> References: <20220121193544.23231-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220121_113559_501942_C3D06E4E X-CRM114-Status: GOOD ( 11.44 ) 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 From: Daniel Palmer Add an OPP table for mercury5 so that cpu frequency scaling can happen. Signed-off-by: Daniel Palmer --- arch/arm/boot/dts/mstar-mercury5.dtsi | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/arch/arm/boot/dts/mstar-mercury5.dtsi b/arch/arm/boot/dts/mstar-mercury5.dtsi index a7d0dd9d6132..80a19bd23c9c 100644 --- a/arch/arm/boot/dts/mstar-mercury5.dtsi +++ b/arch/arm/boot/dts/mstar-mercury5.dtsi @@ -6,6 +6,42 @@ #include "mstar-v7.dtsi" +/ { + cpu0_opp_table: opp_table0 { + compatible = "operating-points-v2"; + opp-shared; + + opp-100000000 { + opp-hz = /bits/ 64 <100000000>; + opp-microvolt = <800000 800000 850000>; + clock-latency-ns = <300000>; + }; + + opp-200000000 { + opp-hz = /bits/ 64 <200000000>; + opp-microvolt = <850000 850000 880000>; + clock-latency-ns = <300000>; + }; + + opp-400000000 { + opp-hz = /bits/ 64 <400000000>; + opp-microvolt = <880000 880000 890000>; + clock-latency-ns = <300000>; + }; + opp-600000000 { + opp-hz = /bits/ 64 <600000000>; + opp-microvolt = <900000 900000 1000000>; + clock-latency-ns = <300000>; + }; + + opp-800000000 { + opp-hz = /bits/ 64 <800000000>; + opp-microvolt = <900000 900000 1000000>; + clock-latency-ns = <300000>; + }; + }; +}; + &imi { reg = <0xa0000000 0x20000>; }; From patchwork Fri Jan 21 19:35:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12720176 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 C4D3FC433EF for ; Fri, 21 Jan 2022 19:41:58 +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=+KPLgMNLE3kyidgHKPdaCpSihJ+LgUir0V+EEgo4Fsc=; b=4Q0Gd49TjFGJjI obviHnbCy5PxwCTPCJwI1AZVMA7VqubmtuWac0gTYK/U6vYn/FGvTAB5LLTcLI0qZ5kRj1a3tJhYA DqNU8bkEbHxuJFpDuBh/wEIoN8UD/2kRS1Ly1YkIvhAS3ohm9NwtqA2vanSRF/XfZu+ReI/93LdQZ k98Ue1Yf3dGCQ3prf1wSmiTTak6dCoUeJc5A9RYXVAxcwgJc/20AwPNTiCXriK87TVfyDi2nlB3Xl 72eN/Eys238D5bFC0HUTMy1BtkGp2x2usKpBnBxwALJrc/w7cppoJ1XhKK7LYk2YlDbLmHKUAy547 MfLxyGIJ5Tg1R3eP6JMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzji-00Fwyt-Op; Fri, 21 Jan 2022 19:38:15 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nAzhY-00Fw4r-P0 for linux-arm-kernel@lists.infradead.org; Fri, 21 Jan 2022 19:36:02 +0000 Received: by mail-wr1-x429.google.com with SMTP id u15so1494840wrt.3 for ; Fri, 21 Jan 2022 11:36:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iD/CADMJmjE6Wqsta+zyCvYv9Ey28eqoIb5w5xoLVEA=; b=pT1Wq/aAIl8THxDwAu4WsHnCXwPt44I62OEbx4xZhMzz2zo+cVyAmgxsaQt3T3X1U9 JyAcHpk0XTuT+syn8/rkM0A2joco1O+Y5elE3iQ3DULT2eNvJ/FwBoQ0XVRWh2U9a5vt JB6BO+SDq5LbD5Ftb0ZIIEwKCzDjdr8XLg6SUXF9sFzHGe/mj2RzrXuuZVVdfxcvzIhh +IL83B0uQprKTsi9yyyQ88Nhn8HbJjbFAQU2KNVu/vGPu5sfbaeypfPReJpFRPERHn11 eG7uWF6RHgPTqXspVOFmmjRQ1Iyx9I3tI7tFy6Coh7BgCoaZRk2z0IbjqU0fyuzmgRRl VOCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iD/CADMJmjE6Wqsta+zyCvYv9Ey28eqoIb5w5xoLVEA=; b=yFOhckdV3ZVrO4WnSxCyzqiy2yTkWWMA7fkV3VoMDEft3mhJ6rF+KHxkQm88zekDwd SpQW9QvcKRc9QVwt3N/kcPIYe7cgG2L4sTqIrwQNHnth6qE0BgT77auR1fh8rY5ISCHt yy8LvmjkVJ5YDNrhFUt2rsKb58EFH2+TvdeBT894lPMJ4hC4jkGxYgPSmjrLQjzUGZiw iTXN1w/qseCrn7dIxlBfypllbYzMW18wBK7OQ7OfOchOrK6XR4dZT2qqFkdci7Ijvq42 ShdCsTRTOXatFQbScWcwVXmEhulFslA5y/lyvW4tzcj7oS2Y/XDFxZLugGfkar+AjTIA FR2w== X-Gm-Message-State: AOAM533Wrq7aqHuS8hW0oG4jF7dpyiMyfek7RTqEl+gjIpgjruj92C+L 8Th6kJJnxUzM3mql7LHcqHU= X-Google-Smtp-Source: ABdhPJwVJyHJrYnB/nAOd95Z2o0Y1FG3/+VVs+HRs4c0yfdCd4kS22114ki82+YNAOZzUPZxqsjJkA== X-Received: by 2002:adf:ebd2:: with SMTP id v18mr5154671wrn.502.1642793759362; Fri, 21 Jan 2022 11:35:59 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id h4sm7803309wre.0.2022.01.21.11.35.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 11:35:58 -0800 (PST) From: Romain Perier To: Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Arnd Bergmann , Daniel Palmer , Romain Perier , Rob Herring Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 9/9] ARM: mstar: Extend opp_table for infinity2m Date: Fri, 21 Jan 2022 20:35:44 +0100 Message-Id: <20220121193544.23231-10-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220121193544.23231-1-romain.perier@gmail.com> References: <20220121193544.23231-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220121_113600_856563_AF05C39F X-CRM114-Status: GOOD ( 10.56 ) 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 infinity2m are running up to 1.2Ghz, this extends opp_table with the corresponding frequencies and enable operating-points table for cpu1 Signed-off-by: Romain Perier --- arch/arm/boot/dts/mstar-infinity2m.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/arm/boot/dts/mstar-infinity2m.dtsi b/arch/arm/boot/dts/mstar-infinity2m.dtsi index dc339cd29778..1b485efd7156 100644 --- a/arch/arm/boot/dts/mstar-infinity2m.dtsi +++ b/arch/arm/boot/dts/mstar-infinity2m.dtsi @@ -6,10 +6,25 @@ #include "mstar-infinity.dtsi" +&cpu0_opp_table { + opp-1000000000 { + opp-hz = /bits/ 64 <1000000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <300000>; + }; + + opp-1200000000 { + opp-hz = /bits/ 64 <1200000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <300000>; + }; +}; + &cpus { cpu1: cpu@1 { device_type = "cpu"; compatible = "arm,cortex-a7"; + operating-points-v2 = <&cpu0_opp_table>; reg = <0x1>; clocks = <&cpupll>; clock-names = "cpuclk";