From patchwork Thu Feb 22 03:02:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13566678 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 28D18C48BF6 for ; Thu, 22 Feb 2024 03:02:59 +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: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:In-Reply-To:References: List-Owner; bh=LSUkAksZ+9x370ML9kwYDoqkH1QDDVnsuxLh9/Ifnuk=; b=4D80nfAaj2+jat g80x4zBcpgl9iFWUAZ6M7cu3jY4B6DkuR+cLIg3a9lC62TiiYp3LyUULy2mpIX3r9PdxZXmTo04og yzzzVWJY89eA9pZzzI7S+tATencqeydeK4rpr5IA6IsvBRZZRW8XH3HAkgNNuBZ/dJGvf2vrkxm/m OEysjd0brDi2y8GCiyLACCPn6RmBvjA/L9xkr8fGhkRCTIwZ2lsguizuhGa1vBeFE8XjMLQm74Lh2 i7Z4q34uTqboVDn3DMX7oI3HWs3g/X7bYqITIALC8nxlTrisEiLYHwJ98OD3wRny20k8fJ9aK1lfR BXsFu7baHFIM1s1FfOvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rczM8-00000003IfH-47Rz; Thu, 22 Feb 2024 03:02:40 +0000 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rczM5-00000003IdQ-2blO for linux-arm-kernel@lists.infradead.org; Thu, 22 Feb 2024 03:02:39 +0000 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3bbbc6e51d0so4524882b6e.3 for ; Wed, 21 Feb 2024 19:02:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708570956; x=1709175756; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=F77N/bJd/ArmxmRc/lfS9FL/QYcTZED/SCdkWs1Ud9Q=; b=DtlO0a8w6AnxsHL+9SIX1aIkBtDfzmNvYoJYYQ8aVSBtfMO3SK/q+3ciCp/i5uxWdD oHHVxeHra2KiaXzvwqJ7ZaH2XKaSdVndNnI1/3EBe5EPUz8HwnWaRsf2xpj/Dqb78uvO 5DQ1mCCdXpQxk/G9XMGEilBczM36D/z8EwYCcf4mSTbxoJSXKPVT51SCHF1+SGk5NVut pYfZlJq9rGmGQd15piNvBIVbN4lL3nu7Ucf7k63yT+7T/PgMrjXeNg3teqkkqf3Q5r1f 0eLRrBAcwH8DTZkDNeAIHygF7B7UYUG2fOGJ84hJANvON4gDqKA5izCNUYkBt7OF8CyE TC8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708570956; x=1709175756; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=F77N/bJd/ArmxmRc/lfS9FL/QYcTZED/SCdkWs1Ud9Q=; b=LF9Y5n7vGLHa27sJYiZ+HX9AZ2meKsjxGnWmswHUR2fMNQL1bMK5cYWmDARf4mObff ZM+UptSEKT9ZS9NLpDpzqt3NvybGLusykYkspNzgkpNt2hfdw93YauUrlNTxubq2qEZh kb7WFXojl6zyFGoaghwR7vzwQqvTctQfL9Ubs3We+fcSrlRvX3yICeedyb5VzkwJ7REb LUn6dQJo6du2O9wEdKfmhQFk/fvrWknHhuWEtng9xQ1JqRq5SSks6eUSPz7gLleRdJhK WGRj7txawc8V0ebNARzHWPoaMvCo1jHx1Zx5ID5mrys/2f0cj+APzRl7bvLwJ9NZJS+N Zmsg== X-Forwarded-Encrypted: i=1; AJvYcCX2ZKSAAJJphs1jb0Wkqy3L4zXUPgZCHjVgkiLqhaK1Yc09U6s389kcqWx3C6iRrJ+1fl1eMIpBeh8BNRyrGSZwIxL5EQE+LAethKxvY4xNlR0YfwQ= X-Gm-Message-State: AOJu0Yx8L3eERpqpPQ+coNthMCIDYkQZqrKS+b3CP4PCuVvNIPj+n334 AGIe2uIaimwlwV8TQgtdsHGiDgLeunD+TGiaXs6WRmUvry/VRoZ3x2CNEZXl7eI= X-Google-Smtp-Source: AGHT+IEXZInhvB5ALK1v8rtCTrCqJYCB4UW3CTVtZPB1h3AluZ/4MefuxPgZx95IQFYdJsixH0MKEA== X-Received: by 2002:a05:6808:23d4:b0:3c1:578a:9a17 with SMTP id bq20-20020a05680823d400b003c1578a9a17mr12392977oib.4.1708570956219; Wed, 21 Feb 2024 19:02:36 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id eh10-20020a056808274a00b003c13787306asm1800443oib.56.2024.02.21.19.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 19:02:35 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Sylwester Nawrocki , Chanwoo Choi Cc: Alim Akhtar , Michael Turquette , Stephen Boyd , Rob Herring , Conor Dooley , Tomasz Figa , linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 00/15] clk: samsung: Add CPU clocks for Exynos850 Date: Wed, 21 Feb 2024 21:02:20 -0600 Message-Id: <20240222030235.27815-1-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240221_190237_694107_E53355C7 X-CRM114-Status: GOOD ( 16.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 The series implements CPU clock support for Exynos850, adds CPU CMUs to the clock driver and enables those in dts. This is the first step towards cpufreq implementation. If possible, all patches should go through Krzysztof's tree. As inter-series dependencies go: * All driver changes (patch 02..14) must be taken together following the order established in this series * Patch 15 (dts changes) depends on patch 01 (bindings additions) * Patch 14 (driver changes) depends on patch 01 (bindings additions) The series was tested on E850-96 board, via DebugFS with CLOCK_ALLOW_WRITE_DEBUGFS enabled, by setting different CPU clock rates, like this: # cd /sys/kernel/debug/clk/cluster0_clk/ # cat clk_rate 1053000000 # echo 10000000 > clk_rate # cat clk_rate 130000000 Of course, DVFS/cpufreq is not implemented yet, so the CPU can't be overclocked too much right now, and the cpufreq interface is not available too. As per the TRM, the CPU operates at a voltage level of 0.65 V, 0.75 V, 0.85 V and 1.05 V. When the voltage is 0.85 V, A55 quad-core operates at 1.6 GHz and CoreSight at 200 MHz. To check the actual frequency, the "perf" tool was used: # perf stat sleep 1 And to check that on a particular CPU core: # taskset -c 4 perf stat sleep 1 Some takeaways: * Max functional frequency right now is 1.586 GHz * 1.742 GHz or more leads to the system freeze, as it requires more voltage to be operational * Max possible frequency: 2.210 GHz * The lowest possible frequency: 130 MHz * Default boot up frequency: 1.053 GHz Changes in v2: - Removed confusing "breakup by patch" list from patch #0 commit message - Dropped the patch for making clk.h a single included header - Rebased the series on top of the latest linux-next Sam Protsenko (15): dt-bindings: clock: exynos850: Add CMU_CPUCLK0 and CMU_CPUCL1 clk: samsung: Improve clk-cpu.c style clk: samsung: Pull struct exynos_cpuclk into clk-cpu.c clk: samsung: Reduce params count in exynos_register_cpu_clock() clk: samsung: Use single CPU clock notifier callback for all chips clk: samsung: Group CPU clock functions by chip clk: samsung: Pass actual CPU clock registers base to CPU_CLK() clk: samsung: Pass register layout type explicitly to CLK_CPU() clk: samsung: Keep CPU clock chip specific data in a dedicated struct clk: samsung: Keep register offsets in chip specific structure clk: samsung: Pass mask to wait_until_mux_stable() clk: samsung: Add CPU clock support for Exynos850 clk: samsung: Implement manual PLL control for ARM64 SoCs clk: samsung: exynos850: Add CMU_CPUCL0 and CMU_CPUCL1 arm64: dts: exynos: Add CPU clocks for Exynos850 .../clock/samsung,exynos850-clock.yaml | 42 ++ arch/arm64/boot/dts/exynos/exynos850.dtsi | 26 + drivers/clk/samsung/clk-cpu.c | 562 +++++++++++++----- drivers/clk/samsung/clk-cpu.h | 53 +- drivers/clk/samsung/clk-exynos-arm64.c | 44 +- drivers/clk/samsung/clk-exynos3250.c | 2 +- drivers/clk/samsung/clk-exynos4.c | 9 +- drivers/clk/samsung/clk-exynos5250.c | 5 +- drivers/clk/samsung/clk-exynos5420.c | 16 +- drivers/clk/samsung/clk-exynos5433.c | 10 +- drivers/clk/samsung/clk-exynos850.c | 440 +++++++++++++- drivers/clk/samsung/clk.h | 9 +- include/dt-bindings/clock/exynos850.h | 54 ++ 13 files changed, 1040 insertions(+), 232 deletions(-)