From patchwork Sun Jan 2 16:57:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12702314 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 EF3C7C433FE for ; Sun, 2 Jan 2022 16:59: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=NX/KOkR6fzz5Q3piP5PygM9rSC7vELKZhE47roDVGOU=; b=jjW6O3PzDjpnSF XRNVzhROm4keRhz68gDV+IQbFPkK8gJhYxljYeUkepMbSvP/6EIfbkMZVhaZ7NN+8wRzmWl9kSAnc 6ClM2NHASbxbbVAiiX3ZotqYoFUW5sVetX/EVA27C5KXFL1R7GzjwjJgKY2xf20w1pRNX+B72r4RX tJwBzzqsThmW7wlWi/umngtq3fH6v3erkVoAmVZ0CwQF/vzx/DgrGGa3XMfRWm/ALug2My1t7WWD0 Lc/37vDEKsFBVTY5NrPhADDEWrnDnNzsqSt5uEeumKcq+7YTpcl0iza+TC6FWOjwk/skuqj+vDqm7 WvABVwCR4NHukFh2XWMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44B3-007yrT-Mp; Sun, 02 Jan 2022 16:57:49 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44Ar-007ymc-5j for linux-arm-kernel@lists.infradead.org; Sun, 02 Jan 2022 16:57:38 +0000 Received: by mail-wr1-x436.google.com with SMTP id d9so65770653wrb.0 for ; Sun, 02 Jan 2022 08:57:36 -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=xY5sdN/MjZvpkzIVHRkalM0h2jmAhubj3ucgmZy/xLE=; b=i8OYmVcfHjMRcYo9XYExn4e2LNHOqCu1kTC+mLNyb1O47gYyzhvVI3sN2L7M8JFbvL qr5ahmw45IF7mWqD/M12tFe3IfZDoor+Jry72WbiuC1IzkXFrA2SS1uP1IygNh6NwInG cKzxx3gu0Any4MqLizbuaAL7Q7DlWh7mdjrQYsXpLEE7F5XXbKvEyndvSIZsir4xFqqk JuMD1OPQFzRbNiIqqbEvWGscH1wDS+sdXf2snHWc/It7j0+RplOnCyTVftHHhC90cEa4 bdP2Sh+pUK6cuSFcyrdeubEUH6mwkq8K3BmTKxEbvP0Xh6uFPpE0pc7QRFCZ5mZ0gXBJ cNfw== 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=xY5sdN/MjZvpkzIVHRkalM0h2jmAhubj3ucgmZy/xLE=; b=Lh+xYRobxg7VEgrtHNwLjQcAvQCgQCmvg0gDR4xxBsOeNC8eYvqYEyn0a6Q7pg1o7q 5bu4FmMko4F9SZwfGuU8+I3MncmEsK4B+DkcdaPjjnbdntg7sWxBVZgHgxvN2GOWSvY3 LEW283nRJw4okBYC2tqTX5Un9HojtSzh0K+JLVySD0YOK2yQdLw3ZKScxEZm4mRvfoeB HKUJvOd/tzagFfwkilLs25P8pFwZST4wQFEfkstwIlSm3zuFV/IRRSsJYZXwF8SQcE31 ISfud1iBL5Wdm40jKDHG3kPbrenhyvKuqquIsxhTs7J6BV/IKvhcAxzBiwwbsBL1gLoG Qlow== X-Gm-Message-State: AOAM531N615uB/UgB4V4n42tKyep8rs0guZrInmiRFbU1+l0t5+u3aQS wwKV/Nr+OHVoSn0864eMb7s= X-Google-Smtp-Source: ABdhPJzdOuDFcSB38KIyoLrnqkve6qQFfKNS1W+N8l0uI2s/gbI4hx/9N/M6aAIWfb3msaI4TUvdGg== X-Received: by 2002:a05:6000:188c:: with SMTP id a12mr38138519wri.45.1641142655727; Sun, 02 Jan 2022 08:57:35 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id bg12sm40620846wmb.5.2022.01.02.08.57.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jan 2022 08:57:35 -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 v2 1/9] dt-bindings: clk: mstar msc313 cpupll binding description Date: Sun, 2 Jan 2022 17:57:22 +0100 Message-Id: <20220102165730.50190-2-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102165730.50190-1-romain.perier@gmail.com> References: <20220102165730.50190-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-20220102_085737_242015_15E36B29 X-CRM114-Status: GOOD ( 15.30 ) 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 Sun Jan 2 16:57:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12702315 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 A6C21C433EF for ; Sun, 2 Jan 2022 16:59:28 +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=UivA+W3Sbk1j+sff1jjn6/XJkmfwolqmnBYfPw2uJ1M=; b=oAUXJPH1TbkhpP nKKYH9uth1byVcwh5I4Eo1TTuLjaa/ln4Qkpo7JoK47mYmuWdV5uQCJeSwKh/Cog8axjdwDq8FXO/ yHiVBJCf7s9gmpclHkuIIHJ1OhtwfGHAWXV770bunJrX7Y8zh2dGqJMcYY986qr/rrh2R+nYGxrrZ 3u6NGioJ80eRv8dGDAADvTSXyZitgkaEYkcz36zb8yud8llcXnEK3oFyoNibMi7do4MlX8BSrcHN1 QRaVDljr1J6FEgTEZ7y3ceh0UCoSgRuiqLL2b6EELewQkIYsWpoXGCFpihtnDdRZf4KCz50bljrJe YWNXBajTATjyFajsZt1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44BC-007yuo-QG; Sun, 02 Jan 2022 16:57:58 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44As-007ynC-1J for linux-arm-kernel@lists.infradead.org; Sun, 02 Jan 2022 16:57:40 +0000 Received: by mail-wr1-x432.google.com with SMTP id s1so65781077wrg.1 for ; Sun, 02 Jan 2022 08:57:37 -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=99BhoIF0QsN7W+XiT4N4CxnrOHTqsGHcxK8UH/KZtro=; b=KOCIaEpm6tDeeo+B3T5cmjoKL3Bp9mqtD8XEwbpDj3cEgII7DlQyr+k8jQU7P2Y5eP dntEqXwFmilgB7IXS1YkgFUzx6mm//HWpjqvxezqhs+N90CZ6+Iz44rhfiiZNNtw9umC uHhMdiy0lKf1VNuHKQ93MPpu6XL/0LngHEUO8qPP6qRgph6vj3GTlL7P0jC8se7UnyTW aPY5fehD1PDiVwXUAfJkixhwqZcFwyHbJrEDAGp5Z4TeA3G48oT8dWrVzN3YlGxgMN1w 1Mx7CaRYCw2+5C2ToTju5E062yYGTDuXPuhQrF2ZvhTi+PjOaqt58QBVDk1Lw+Z5AhVI 1OnQ== 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=99BhoIF0QsN7W+XiT4N4CxnrOHTqsGHcxK8UH/KZtro=; b=w0JN3isqyOv9GMZ9aZqriEAFPRTuLKWyz5mv98AAJwMz2Cjx6OxxymPvQXvvQmJmd3 K/8raBdrgtL+rcDGqt4M2zOIcWsgx/JTtfDr7eq6xT8SKqs+UdH9vEE2mkd2tm1KiULV tewZzPO7lUANLvB4tZhsFOk7HBgvUsfXTe9xrum67LgCbSMb+7IgxGOp7GPj1IQZIj8H /4meks0kxeZPZ0Nux+MXT1TcU+8SKofcit0b7IF2P6NCY4vPT8qRJeYQIw76D0WILbz1 k8A4LDfT66OBbXo06/REhnVfJukSLsmxniMMnNNxKt0MmCLjmjIsE4DdzBjQ23V2AiLJ K7/w== X-Gm-Message-State: AOAM532CTqXqESGIRELq9OLdl/oPHIFymcITQlYAfWJKBJEUe4Q/iZdw j92W8FXYatwdAYXQcSCh13k= X-Google-Smtp-Source: ABdhPJxZrIuZ8nYgJgBvNM3coNHMtx4YqOjsLdm514ouixXAU2jO9pHfR9M5MCRnmUy3TqGbnW0UFg== X-Received: by 2002:a5d:588f:: with SMTP id n15mr36520972wrf.159.1641142656878; Sun, 02 Jan 2022 08:57:36 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id w6sm32567801wrs.52.2022.01.02.08.57.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jan 2022 08:57:36 -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 v2 2/9] clk: mstar: msc313 cpupll clk driver Date: Sun, 2 Jan 2022 17:57:23 +0100 Message-Id: <20220102165730.50190-3-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102165730.50190-1-romain.perier@gmail.com> References: <20220102165730.50190-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-20220102_085738_124725_28FE6CA0 X-CRM114-Status: GOOD ( 31.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 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 | 7 + drivers/clk/mstar/Makefile | 1 + drivers/clk/mstar/clk-msc313-cpupll.c | 227 ++++++++++++++++++++++++++ 3 files changed, 235 insertions(+) create mode 100644 drivers/clk/mstar/clk-msc313-cpupll.c diff --git a/drivers/clk/mstar/Kconfig b/drivers/clk/mstar/Kconfig index de37e1bce2d2..a44ca2b180ff 100644 --- a/drivers/clk/mstar/Kconfig +++ b/drivers/clk/mstar/Kconfig @@ -7,3 +7,10 @@ config MSTAR_MSC313_MPLL help Support for the MPLL PLL and dividers block present on MStar/Sigmastar SoCs. + +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. diff --git a/drivers/clk/mstar/Makefile b/drivers/clk/mstar/Makefile index f8dcd25ede1d..9f05b73a0619 100644 --- a/drivers/clk/mstar/Makefile +++ b/drivers/clk/mstar/Makefile @@ -4,3 +4,4 @@ # obj-$(CONFIG_MSTAR_MSC313_MPLL) += clk-msc313-mpll.o +obj-$(CONFIG_MSTAR_MSC313_CPUPLL) += clk-msc313-cpupll.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..2229b16475eb --- /dev/null +++ b/drivers/clk/mstar/clk-msc313-cpupll.c @@ -0,0 +1,227 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2019 Daniel Palmer + */ + +#include +#include +#include +#include +#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 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) +{ + 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); + + while (!(ioread16(cpupll->base + REG_LPF_LOCK))) + 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; + unsigned long long scaled; + + if (prescaled == 0 || reg == 0) + return 0; + scaled = DIV_ROUND_DOWN_ULL(prescaled, reg); + + return scaled; +} + +static u32 msc313_cpupll_regforfrequecy(unsigned long rate, unsigned long parent_rate) +{ + unsigned long long prescaled = ((unsigned long long)parent_rate) * MULTIPLIER; + unsigned long long scaled; + u32 reg; + + if (prescaled == 0 || rate == 0) + return 0; + + scaled = DIV_ROUND_UP_ULL(prescaled, rate); + reg = scaled; + + return reg; +} + +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.flags = CLK_IS_CRITICAL; + 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 Sun Jan 2 16:57:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12702313 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 50807C433EF for ; Sun, 2 Jan 2022 16:59: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=meVABJ/uluQOF8Je/1uEng7j6iGQwwNQVoYs1oEND3k=; b=oCKZOurLBSubxC xTy+pFkGBimm1LIjvLQIzr2ZV5PEoL3b0Ayet96pN2bV03s7iw1XXIrOC7froamiJBIOWpo4n0wDM l92Ioa4I4t7ZCa0y3DYgIBL4sG4kadUPKwTw1sbPWp4Kx1r9G7BMNjQl0HdN4bxQh3SxT6PHBs+/p V25Ybxf/VBypY3BxArWtVgGYwqaPyk7RzplwboCJKuuukQTGbUsoLlZWqYzcZdySLoeTcR3yOmnbr eH8UxkpSdCJkDmRu+CvjbPsbVf/JyFW/zDwAh0tQV1oXhzS+HYuEvCA2KP0EkxGImmuQZ9B7kpZgC 0qDqcJC8fTipN0B3kijg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44BL-007ywn-Vc; Sun, 02 Jan 2022 16:58:08 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44At-007ynV-As for linux-arm-kernel@lists.infradead.org; Sun, 02 Jan 2022 16:57:40 +0000 Received: by mail-wm1-x333.google.com with SMTP id g132so20223966wmg.2 for ; Sun, 02 Jan 2022 08:57:38 -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=gYiQJr9qOZfUgO3rCKc+/aCbfxKPV3OS+qhOj4d7Tj12PBcldY8C4aO+PoW9K4p935 0TQgy/b+/02G6cDsLdsUjrPF2F0KrhxEfT2hgAsfPCX8WV+h4A7UJEgdW3yRL/vShFpv LWogpGjXC5OxxAOW5oYKVd+/jaicjL61SaqgtqEZ12qNBBfCRvvL8sIyaSnPw6y6O5fN d5LLtQlPmGl04LPPDPurbTm+kJ3pyWJOjrwDkrF4AElYTdeV/59BckqGDdTcGP5fRUxH YWH1Nb8/7qca/V185BJCBFCUSRkIp+uFAd0yytDmzPqEW49wmXi0/PEQ5pUDDZatdSdP sLbA== 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=Ld1OdraEgmfs9AImf9iTDLWWnnQhzlQbOUFrKS60PjO2SHtsZqJHpA2+LX/8sOEXBg sJhSAflWfsfh9JC/YQihn+NMmQypSpofZWpEbGorX1r01hLI7R0pgfPcWqe1FeEK14m8 uHK6ZXHpSboQNf8SGA1lDRtp5TsFM9C86C9RDd+f8/NBiyIPpMWcFwlZnMMlsmdKoMUH Z+AmcB2IY0EnBFJ/MNsC7B7wvthy9OpjMs28/YJHB0xTlLd/mJyXRoAKyR2+XWq62vKl xyG68DJSQ4dKd680396vSVmPlmkaWSIix2Bf0ICPopSqvU7pdw2Bvd2uJYjddEQpMHyU AgCQ== X-Gm-Message-State: AOAM533L+NDEu1VFFek+ODF6Zd0jPfeLF0+UoOqG1y1csIlsAwo7s4zb AdFqR7OeEC1QYx/Faz6g1/0= X-Google-Smtp-Source: ABdhPJytsMoKEXSNH/cIPbIMvFJtaeNzmKn21Hbr+6f0Cy8+YgR+2GlCQxMZo7+dn35Jsadqow94sQ== X-Received: by 2002:a05:600c:296:: with SMTP id 22mr36751205wmk.11.1641142657899; Sun, 02 Jan 2022 08:57:37 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id y11sm32899848wrp.86.2022.01.02.08.57.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jan 2022 08:57:37 -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 v2 3/9] ARM: mstar: Add cpupll to base dtsi Date: Sun, 2 Jan 2022 17:57:24 +0100 Message-Id: <20220102165730.50190-4-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102165730.50190-1-romain.perier@gmail.com> References: <20220102165730.50190-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-20220102_085739_398734_F750EAFC X-CRM114-Status: GOOD ( 11.78 ) 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 Sun Jan 2 16:57:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12702316 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 5D843C433EF for ; Sun, 2 Jan 2022 16:59:33 +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=pFhjyr7GQMZd4l uGcwx9jDz2MNuLbAovL7sOA5DTUu91wFzQKKKPzqTH7ZddvRtxLjh62GiHr0c9nID906WswBSulI1 bDsuoHwu8fWABO10lGzPyINnjK0P09jVhruODz6JpQ6V3ApCwiqkoBcwwhC74S+/HPHshzF3wxcRB 0zlwSX2rLuLjrYS/2H+lihTUAqnMmuMLVgb5x9E6KuK4G/2ebC/LZkdm1m7EQMB5H/IYIQ1mLwP/x vGMk8WmkvyDlI0TdNgI2mdXBNBNkQMLSii3FlM9RtL8b8D5jzfNzk3UlVahrY2BNW2tHqXH8jOKGt bJgRO7HNgtgEKzOk2/fg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44BW-007yyJ-Df; Sun, 02 Jan 2022 16:58:18 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44Au-007yni-BB for linux-arm-kernel@lists.infradead.org; Sun, 02 Jan 2022 16:57:41 +0000 Received: by mail-wr1-x435.google.com with SMTP id s1so65680936wra.6 for ; Sun, 02 Jan 2022 08:57:39 -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=VOQd0Ow+1WrNgYoFwglIyEDD6eh0BYvqxp/o+V8B/ljFwgxQTOEv6OJej9Mm5R+oYR hkhJn924zrQiLQcJnGGw3JAdk3VOqMJwJkpkOvmlDEjNQ9hU+kQ52Ftz1a4TKcUJNrUa 7Ozk7l+nDnMIdRpuzunuEk28K5nHqv3kP+A1i5CiKF6V6WSNN848CrI8bs1omgDwEv4V ERNaMlDYKH8a4Jrd9vug/k4Fy7od9oHsSA9alNkU50hWXcUwFZRz4/96ke0ewxaIol8+ wVJt6r+O7Yh/X2+qAXheK37OiawrgLjj3R3NxZKPGn/xstgbIaeGGFecPDFaDkmdSrm4 0cRw== 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=XA7UnlvRqiME1IdjKkPFlF8yruMJyZhQpT4fNuuLu8IJ7e8/JUQQgWEQy3fruLR/s3 5StFjm//x5h8m4fFzI8nWzqXUGsyN6HnJsOLn8p/GoVEpKtka0WTDFMsiA8RyyawOXRq ApxF6Zju9K9bycGydWp+asiPHaRbmfWy4Lj/+JTFSzFtjKeFC+0KPYDpsTxE4phbotbi zwDDphNstmaTECNll8hPUJ5shokp6C5dLI93x945NOaiB2lKZyEK4sLmHYj3Sd8wten5 zQWV+ZhKZr4NUUPClaszCJM8xlrLbfzv+8T5Qp1603niWBhXhsx04tWYLnd7myYS37aH 7POQ== X-Gm-Message-State: AOAM533d8/jA+Ys6KlIg/5pzDlgwhehqJmPaaa3TMgn4GtGgFluUAmbi LjbFjBPqaRgwUjn1ABEC4xo= X-Google-Smtp-Source: ABdhPJz7QrYuQYvDwF8GFlCqsOZUggIWRhwsYrBN7X2EcIR/k/YLBCU5wE1SdWo+1XMV6CkNH71Jkg== X-Received: by 2002:a5d:6d0e:: with SMTP id e14mr37348800wrq.407.1641142658912; Sun, 02 Jan 2022 08:57:38 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id p13sm25786857wrs.54.2022.01.02.08.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jan 2022 08:57:38 -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 v2 4/9] ARM: mstar: Link cpupll to cpu Date: Sun, 2 Jan 2022 17:57:25 +0100 Message-Id: <20220102165730.50190-5-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102165730.50190-1-romain.perier@gmail.com> References: <20220102165730.50190-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-20220102_085740_411618_8926CA97 X-CRM114-Status: GOOD ( 12.01 ) 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 Sun Jan 2 16:57:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12702317 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 16619C433F5 for ; Sun, 2 Jan 2022 16:59:45 +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=eGDNrZ1Jzckdao BVPwLm6fDb/EzT1T4TptxX7KdXwNKs0E8kGCcqorR/qV4b2awy5LdxMFV61/iyIIcDwgG2vjYd09Q dyCeu1tP6BGf+anv9HJ9N3alID8706BH15c+mrAIrS3uE/rgRIWcpdgTedXKKPWLDpP236yuNGNOc gprQzeGdi8MdpD2c76GNCCONzT28hS7+KbVb6wkeJ61U0s8s+lBU4wRPm2Q46yOwVDhJCNSZNsT1d WlO96qgmefjf2iVx88h42wUvzOYTAD9FKdDZumVqKkOTa2YspXerwYVovjrBk0PA3d4mmvFduumQb w/4/bepxBYVNEOXH9sxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44Bh-007z1S-0I; Sun, 02 Jan 2022 16:58:29 +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 1n44Av-007yoK-HG for linux-arm-kernel@lists.infradead.org; Sun, 02 Jan 2022 16:57:42 +0000 Received: by mail-wm1-x331.google.com with SMTP id a203-20020a1c7fd4000000b003457874263aso20029621wmd.2 for ; Sun, 02 Jan 2022 08:57:41 -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=LQBHp/l45t4z5YWuB+Sfk5u3i5X3BIZqx5z++W8Ku9PElU7/04F4dE/eehHuLMTzSb V8XyxS7Rj0+oj3XyE87KYyBfl2ajEuI/zRAdW+TD6IwWJIyC20iFGwQWc4ZWAo+6dNY8 ChqJv17YWllfBsa1Xjn9YeDDteYs1NDz7zVlym056KI8WNnNuBJ7JziJ/03ioUKemzC1 piVuGhP6gGolCqk6Ur562fdyOw4Ok6xCkTsQKWV8mxoygFmpkbUe+GHAwknk5e+aGV3o N9h0bW11D1nKyj/1M3JKqWhYWy5lvHvm3a5YUnwHeLRxbzqquT3nNv01WxFC+H9ILpW4 njUQ== 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=FQtvVeqnjYJZLEFf20Kqkp/sCvCRqEPXdbESMinb69O25xyaWs/i8GDBgS89i5dzS8 8fTuWneH67Z6snqde93CgPtD9Bei3fq8tObWonCMbWOKlsGweWHfllicuJJxw/omrz+w 6QAj/DtuCueuBIcf+7bJFMnJ1iYDmBDkZy9hJmYLNcYuR9U3PmZCOXC3Piu5wZrp0nQN E5sWfXJY7IXEG/GWGxKDlD1NCzh1WW7WbAxm4LWKHW6EdEw6jyNwmYh5OyW86lPhZz01 JXbvcBv6cuQa/E6lq2KxDwDnwYdkUcnjMQKIEHsOQnYzDFPoPTkcrNbft71pNivcEK4l fGpQ== X-Gm-Message-State: AOAM531u81KSJNCNBuZ9ShrhkeHqKooGerC2tPmWMvEgZX8OTJwnomBq J3MBjRkPTDgfm5uQxeTAYx0= X-Google-Smtp-Source: ABdhPJzVe5xaHtg300FhtGj31yzAxDEi2z1lt44/jfQJTXEGYErXbNN3jAWTUoQFGm3g/hxzve5JoQ== X-Received: by 2002:a05:600c:510f:: with SMTP id o15mr35759659wms.104.1641142660072; Sun, 02 Jan 2022 08:57:40 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id l6sm42247234wry.18.2022.01.02.08.57.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jan 2022 08:57:39 -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 v2 5/9] ARM: mstar: Link cpupll to second core Date: Sun, 2 Jan 2022 17:57:26 +0100 Message-Id: <20220102165730.50190-6-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102165730.50190-1-romain.perier@gmail.com> References: <20220102165730.50190-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-20220102_085741_601107_524F6F28 X-CRM114-Status: GOOD ( 11.90 ) 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 Sun Jan 2 16:57:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12702318 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 1736CC433F5 for ; Sun, 2 Jan 2022 17:00:04 +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=IzCv633qHWGRbo 7NMBLtrsoENYZiicYqciGeh/gi1nLSVNvGfZXB4PFd4HgeDGd3adbuGXsswtV30L6Qe+MDMs0lN+o 40FC28LeSQxuj2/fE0ePtTTC48ospiZh/APJdEAWc5gTakUcfV9g79xfcnmSSFh9tRUEkLFOgZoTT 7H2jF8OXnKpOE29epQh+MZEx3W+xKxehFQV/OyBKbhq/8MsC7pJ2viGkXMbooiMSNJzVBxq1P66h0 yatgFzYOq0OBk3DhejwJ06RiMULUnoionA6gqLi2nJN83vVwXhNRgtsqjhmu3SKAebnJN22x7TW0a Fm3d9JXFZ2FfvdzJXfuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44Bt-007z6j-T4; Sun, 02 Jan 2022 16:58:42 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44Aw-007yoQ-Fh for linux-arm-kernel@lists.infradead.org; Sun, 02 Jan 2022 16:57:43 +0000 Received: by mail-wm1-x32e.google.com with SMTP id v10-20020a05600c214a00b00345e59928eeso13476740wml.0 for ; Sun, 02 Jan 2022 08:57:42 -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=JA3YqBV0dBer5Kp4K4W0e1lBP6bSyY186oVs0gUMBG/kXP0OX78v3XYHCJ8PBQo8uB cWYW3Ib/cvCCIONWmyVw2+E+GgSZcxO2vGZb/TfXDSSBwbGOMG3jyFm5lSp6vPaHVZjZ UTwdWVwx3kmBJ1Pg0LaVcHw08IXN5jizUIdEpH9boncaqtN00PdeOm6rXJ8hHBdFY3m9 gat0WYf7GEIKTchc+6r6l82+dwKBz6Cg3lIGIw+ysX/c42L78vNXfh5YfnYIVdRVtH1D uFREgLOjlIlUNtIqIAi6MVwAAPFskIl2qINRBUvLxueBlWP7msm3PeSrIq0OmAsRb+yQ 8M9Q== 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=Gr8UElKDKhp4LET1AAXvzDv224YXzbhl8Ivkk1HFXWUocHJmUCeE4oBU8r1ROvsndb 15d7DPZ15QWrOt5tTAK6b+yOUp1TkRwY2rXqornDTp6brWQem5ChvwerzZNdBJzrZ3Va XhK+cU8XVa2K8jCH9Oi6omxhGOy6WhecaXAHcBQijdAmBt7WKP3EXy51Cc1EvNzQhTUC fKyeSQLB21WkzZ5q9sAIkArFXk54m6cr/vnqIkpOEscOJUp3Tg339kntXRnhjRm8MEXH 3G0ThgVWwZ8aMX6jYRVVA4FdJ09ab/AE5cMz2rcoN6bZOZQp5+56Ti+yRLuiRKy8gD1+ HNWQ== X-Gm-Message-State: AOAM532S11logLhoeYbTH+CUh2loi6tdC8zvBWCjBymVWDwGJfP9/5sU ijpw9cNq2zMdqffHYbUcr3Y= X-Google-Smtp-Source: ABdhPJw+T+7Kva7Grqslf4Ard+f+I0ns0p4qkTopFlTEorvQ7OO+iaZQtaZdCphuRJ7GAg2DLWSmcA== X-Received: by 2002:a7b:c745:: with SMTP id w5mr36644779wmk.96.1641142661060; Sun, 02 Jan 2022 08:57:41 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id o15sm26163717wri.106.2022.01.02.08.57.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jan 2022 08:57:40 -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 v2 6/9] ARM: mstar: Add OPP table for infinity Date: Sun, 2 Jan 2022 17:57:27 +0100 Message-Id: <20220102165730.50190-7-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102165730.50190-1-romain.perier@gmail.com> References: <20220102165730.50190-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-20220102_085742_569140_227793E6 X-CRM114-Status: GOOD ( 12.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 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 Sun Jan 2 16:57:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12702319 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 3CD33C433F5 for ; Sun, 2 Jan 2022 17:00:25 +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=FATFTu7bHWRfHJ I9ph83HrTrxyW8qRAVWkBuyS1iCPZOl2lwAwXIeRhC46qiIAqZs00FIW3XL23nLu7n9vdbV2NQQRb bxw2Ym11yBiE9QotBK2Bt/1Mw16+MrtMENmRz5P3204A4XUAanaTXSpGJ5cUYjcOHkkf9TD2ZO5eO q+wxTZS3q+WU3Cugf8GfPuDHQKGQzUZk06MFiuOT04BeuNPeHjYxYCrNk4DfLXQ6KB4AhBeZTQeHc IIufF5y8FmnXYFpG+HNlGwPxT81Xl8Ls/TpWdg/7T7gjqxwFKSjZdexlQtbzd4/MuiAclw29CvDYu xt9QNFYSwGfk9zJ9XzqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44CF-007zJP-Tr; Sun, 02 Jan 2022 16:59:04 +0000 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44Ax-007yow-Ey for linux-arm-kernel@lists.infradead.org; Sun, 02 Jan 2022 16:57:44 +0000 Received: by mail-wr1-x42a.google.com with SMTP id w20so56682993wra.9 for ; Sun, 02 Jan 2022 08:57:43 -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=ElGGNSCD9QRK7+dw5nfGGhnn8BxEqs9+Jm/XI0ZtwxDwdeI7y6hp/nKKzi8OmmkTfd DfesxdRQQk9RqiyI/gy8nV7M1JGKw5EXwm1V8ZsxS4++cNwA9Y9cvcGFKl3yJ4TYDFJR PdQo3mBGXpTYUy6CjffI3IEKAMAs0z/QXgFssHDMe0orAfv10vB6jROWsQZ3td7PZ/Cd L9axkJZxSYMmyaxtnUMJ6UL9CFqC7S8Zsv4AXyzVbkF6LBpcxF/KA/W4R0WmoM6CWEYp Rd2Zt7f2YKdTAI+W8rAJkk5EKgtHHmQ2E9c8rt/nJgcbaTcrXFkVN5W0pZaqji6gTMJD E99w== 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=d2BgZKy0KUzHCD+kaRP+zUoXgDEJW1uqjU7F8GWp0u1omGh+rY9Px2n8rKC55Ef06e Ul//5l2vXD4WJ5hUJ2u9Y0dcVK1sXwdo85raSh/OjbXFlHI882SmnVN8tHOTRqds5gN9 wtsDgGXWqdbiIKOSlDyMzrEcVVJOWxHzktSnT1WJal9GHxnZFEV1dFTS2jiH+1w/BSXY J4HV6cYcMSkv4ai01scqF02BgX9ln1Ig91etLi/28atx8dLN+DkVKdH0cM6/pk9MvwQg Gr9UwRfTLDvnpU5XkOk+qnqNR7X11NM7kw+se97VdI0IQk2I0TyzPWGOyN70GVkOCDkV iKEw== X-Gm-Message-State: AOAM531y2fVch9HLRng6sgFS337YXb5/6Yly4dy6d9Dyx7BYtbMVQldY HTznriXZeDTqTvRVgpM+lcc= X-Google-Smtp-Source: ABdhPJwJOhTLzvSn3l0lO6PPzb+/Xo7IVWWa+kzDE8rxBggDHlIZdM774Ruhx9LE0tOuEbvyX2a6LA== X-Received: by 2002:a5d:440e:: with SMTP id z14mr14054757wrq.611.1641142661995; Sun, 02 Jan 2022 08:57:41 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id y1sm32261901wrm.3.2022.01.02.08.57.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jan 2022 08:57:41 -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 v2 7/9] ARM: mstar: Add OPP table for infinity3 Date: Sun, 2 Jan 2022 17:57:28 +0100 Message-Id: <20220102165730.50190-8-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102165730.50190-1-romain.perier@gmail.com> References: <20220102165730.50190-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-20220102_085743_529445_6D5C85FE X-CRM114-Status: GOOD ( 12.05 ) 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 Sun Jan 2 16:57:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12702320 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 02E03C433EF for ; Sun, 2 Jan 2022 17:00:54 +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=Y17kQyxGO8kmX8 sGqQddX4GEb38/T7f1WAK+gc4jXIDmI/iORlX9K8s+tZ4N53melwUSEWFXouQnZXhOAZWqJNDrDfR FdG2FK+90jv0QxXyOZQoBaLgH2JvYeWIXzzxG6FSRA6Lc8CyVPrqooKqhE9/P9iuqGRslbbwtgZuw pDq2Wnnh+LIkpGAxgQaZik0fAiB3r8+fdQCryG/usAtx7OW60tfZHoCIcFKugyqDWCcss3Z4XJbCM 40llh7oy9sKF5yfv9cAzEjWGQBn0igqtvhHFIAj7RiRXmHqRpeKMMlQtTgeIjpwtgicJPB0NKjm5X djZRiBEKlQSHv+zEOYGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44Cm-007zbI-2S; Sun, 02 Jan 2022 16:59:36 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44Ay-007yq9-20 for linux-arm-kernel@lists.infradead.org; Sun, 02 Jan 2022 16:57:45 +0000 Received: by mail-wr1-x436.google.com with SMTP id t26so65655027wrb.4 for ; Sun, 02 Jan 2022 08:57:43 -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=j2xcZ3VS6TFIJjYJ+vmRZezy9qn60VUnG3E/ECjUl4HCPj0rBPuLzDzMwAufGOjAKy Oc9fg2uOo+kWqurnFvUrgF26zLYYowfHO3ANqzWXX80wan7+eMy5pqMsOqkVRRPwPzdi XdVqBYXHiOcxHy45XTI1f2dIu738oghcXKciM3thU+SRfmrDsc+LJGWCiC2VD/ljdQmt e0nEOtz4zLqOcHEyGCOrqkgPaaJh1e9wAqF2j16kVREALD44gYROXkYmCmtk0wyVyx21 K/+IJnM5CcXakBi+Q4J4VB4gesigSf+DFXkLOVmT92RIHvk7bPWah40RihYdXsnCSfHA kwBw== 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=7jLD2kxVHm+C6gJQQEaajt54Z9jy08YcnGeCR3cJntZrl3cw6Mxh1bfOnpHLbJvyXj qlDcLlZZDy+RjxQk+vsWpjwqfnEh5ma9n8lXrb4lOW5PvORE9f1ralC7ZXIdh5pYk6Gc mSSotFiydk6wbi7YWFtB8kZ6CrJ9aZqDlpLgcKmZfokJUGJUy5oVOd6b4KRWOFEBxm09 eOkEypBhMcaP0Bybo61hycL63m1pSmV4v6UQyEl4jeQ4qCmu84d/8vmw8JRuq7/aJxW2 L3jRLfNSGGneKHKTT7s6dYf9/RZ7cPmY8fe1VevqJnD5bqI03yNG/a5X+J8vkGBrWAPO kfbQ== X-Gm-Message-State: AOAM5317nUtmJPDzUt2MOP7IsSNdNwnv5W/ZhU8RazclCcBGNhQLAD82 ckWp0IygJqC+owM10z+Khc8= X-Google-Smtp-Source: ABdhPJx4Dxr2RaztEoTqjlm4Ao926l9evgTdBBN+vsLJtkzj0doTCeZAZdeT9CKRktC4SnKfnHmUYQ== X-Received: by 2002:adf:dc12:: with SMTP id t18mr36990100wri.566.1641142662958; Sun, 02 Jan 2022 08:57:42 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id p13sm25787035wrs.54.2022.01.02.08.57.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jan 2022 08:57:42 -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 v2 8/9] ARM: mstar: Add OPP table for mercury5 Date: Sun, 2 Jan 2022 17:57:29 +0100 Message-Id: <20220102165730.50190-9-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102165730.50190-1-romain.perier@gmail.com> References: <20220102165730.50190-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-20220102_085744_129177_5BF0E1D7 X-CRM114-Status: GOOD ( 11.92 ) 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 Sun Jan 2 16:57:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12702321 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 E62D4C433EF for ; Sun, 2 Jan 2022 17:01: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=+KPLgMNLE3kyidgHKPdaCpSihJ+LgUir0V+EEgo4Fsc=; b=YjGlbgWYt02yBL 88GRUcpkHxYntq3CjdH4EWr3yR4ZpbINCfGuRbd3J7b3Ymi5RpslumPDBS4meiW1lEEHGAtX3zgnG MFaQJy1cenN3gQDHhhMfYwDvPn1QOxd38vymFsD5iF/dHYO3RUIRW59ZryH2xaWnBNntiBQukO2w8 zF4dV3B/Yn4iY7tbMDnpK22VCMRkyIFOp4cqxLyKeZLHfdcuEZcTDEDM/ZIAzTVbicXa5Y7A6m2q9 nZ1NF8jnil3rMCFcICxXoTt+tkjRQfH3bnjysptDRuYl25/RIysdt2yRN3e7odSn5kII0gw3fer8D /nfEP9R5QKqoX5sKesVw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44DI-007zw0-0R; Sun, 02 Jan 2022 17:00:08 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n44Az-007yqi-42 for linux-arm-kernel@lists.infradead.org; Sun, 02 Jan 2022 16:57:46 +0000 Received: by mail-wr1-x432.google.com with SMTP id w20so56683087wra.9 for ; Sun, 02 Jan 2022 08:57:45 -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=KrQgZJjucRqLWk+uOuwmX5KyeIny71EXNyuDW5ReDsZDQxPfLsy3zaKJYjLQzayvdK DJBbN3/N8uKBoiET37O5zrKeQbO4oD1UFT+tIleBFO1GoaPkFTFciqkwhrMctHecf1XZ Q93NH8X+a8Vm3ZAL95VYsrR1Aqf5p9yBBj5AUGa+fGNgtmzohz1Me4NUhIrVVruAIYYQ c0nF3nxZjgMwaugVzcNcQCmf/+38sJMikHYG5D7O7LIKcWGxkYffWTZVibveR8cGx18q NRRti0YYARTQxsyca/tWjZY9dJtwdp2qoGGumBL5yU3PNTbORCeo8ecKekeyfyTF9D9u TaNQ== 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=xVXQMoxbEnPB87laht3PoU8EYMSQLaldRKp9JHCk16Lk3UUAhmiavYK5AUJrkgTazE 80pQpFsGrSx4Y25XaVmg/62Wi7+KIA0K4/nCJtdIVsrk3cFgmMibEtR42bjnPjVsStbV 6N9iI7vKDnyq0pIBJPM7ebllJPfc/Z1OOzfXkCXpYjf5PE5kaAIcgPGqYfyTuaqq8ht5 oBL9tYEi+mD/76sgu6zmcGhl4D7paRyJXiKPvrS6YSVO3g5HGiCQsL8U0dtYLXAMbV+B PVVZBDpnU+Vzua3L7GRqRIlq/ug6ijSUS1Fs9KEq3nlDVO/ZCv71DI9SfcVzQVRB2Jkm bRVQ== X-Gm-Message-State: AOAM530VvGrCO4AjIPmjilk/3MiEqJHIg2VMHR7GQI7/pAH4SAMsrZX9 ZiG/edLcguEeAg83qztHqMs= X-Google-Smtp-Source: ABdhPJx779LWBPXjfsrLOgJIV4ApKAEJ67RdpJ7OhOntFNmIMbXueBJBbQk7NNU/oCrZOuXcDHQV7w== X-Received: by 2002:adf:f384:: with SMTP id m4mr14509211wro.524.1641142663994; Sun, 02 Jan 2022 08:57:43 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id bk17sm2095664wrb.105.2022.01.02.08.57.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jan 2022 08:57:43 -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 v2 9/9] ARM: mstar: Extend opp_table for infinity2m Date: Sun, 2 Jan 2022 17:57:30 +0100 Message-Id: <20220102165730.50190-10-romain.perier@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102165730.50190-1-romain.perier@gmail.com> References: <20220102165730.50190-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-20220102_085745_187230_57AF1102 X-CRM114-Status: GOOD ( 10.95 ) 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";