From patchwork Fri Feb 16 22:32:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13560758 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 DC423C48BF7 for ; Fri, 16 Feb 2024 22:33: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: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=uDakiVi1HogCK7FYWY2ahvd6FwQ7AJslW8RUFgRFoNE=; b=Y8F/DpU72mcV7q XdpJydyfY64rVommFPHK+IyN0eFsMGppoZVRFJtOZAF4SO9dFdOpMPZrLOSiz/JBhsEridDnLeuI0 HR/rTTBFRC6Mn0FUkqK+8FsnBDTrv91tFmWkS5vHo9fJq9ovyX41VSWdoWutptFHALggVAEwjq1kz trxzsdPmJapxdybuVh/1tq3zj3XrK/YsFFcDPRxzss8YwgKKSVkIeUa9sUX7DtEN8WkAGgVD1t0Xw QHhqlcWPfMCfWsei3D2Om2Sb6e24K1a0cFzBCGe+q/OczNWiFTHfPJJvRm8XSOVwwi+avJpUxrLXe 21hUz3n4/W+EW+mmHUIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rb6lH-00000003vbg-06KF; Fri, 16 Feb 2024 22:32:51 +0000 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rb6lE-00000003vaA-09wO for linux-arm-kernel@lists.infradead.org; Fri, 16 Feb 2024 22:32:49 +0000 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3c0449eaadaso2323171b6e.1 for ; Fri, 16 Feb 2024 14:32:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708122766; x=1708727566; 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=kHTYIdNR7kys2A/utNtL/i8pf8YMUUwp1NermvOPClE=; b=P9G7q17HBY56KBwr4QxsQPwdsYefa41d8HHZfHIN6dbkCYfTUutt8Gd5APVgT+1QHQ 5WzbEyEi7p79CrxDXO4c45NlCZznQhgm9jvCGT0KE5KR/7M+Iaitg2amJPw7rKUcq9wJ EqAbMLNNduQcqXgXn2AENOz16GMYrBsSdjftoZwEgFBZ61ydYxlkSk+abxi3mIfhbHfO PDvrtp8B6hIZEFbFq8EQvNlK/vgWm3J+gdc/tDLNzsw5p/HGOnJYRdpdzsugsm//FW5t 6GHjxwQAw39SdS2vi5+9c0FVJKFQjUJNa0WXgAt53tqcL90CcouS2sLucFd1kNbLJRFn FYyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708122766; x=1708727566; 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=kHTYIdNR7kys2A/utNtL/i8pf8YMUUwp1NermvOPClE=; b=BglfahoYXI2MlwrDrBY/SPeYS2f26HdwEuGJXqUWxAybWZ0RLIgoF12kewYm6k/pLE uVijzd6gfApGHx0iCJyuIkSfdXVEwyIp/ym5F+bfRsPBwcqP9nPOGI9sVAmRCfGQY6CA Hy5ZNHT783EH7mUm5rIU+Dh0DDk1vYzqQvS58JXSSG9TIs5E+42oxaT2wQ4d/1qU+Q40 bH+jEMoV11cW1mDHk0pCqPS+/k+Ikx/qRopdABcHpODbjIpecP20ZFpMhePVp3jy5iAf ZtM2DXoC5HpYbRNJWukX8IH7H5HEsN6MlxJmoy7407RjHZR9BPhy80Qdv34e7QvCGPdm o13A== X-Forwarded-Encrypted: i=1; AJvYcCXpOPAoPztqv9cCLLhknpV9QeLXL1uZGkcEbrF0EB0yLsr0GY824MfU285QSrffyj5L07s7RWuLX7fB5ufTfHgwFzs4vWGjNylzihrtrIYZLXjg45w= X-Gm-Message-State: AOJu0YzHFYzxJfdWfuIK8gyn4omcAyGMX1GeqkPkj5gpzwEOf3R7JlQQ 3LdWoUjzQR2Z6wa9VLm4oP/IWPNFYpSbZCzN3Uuj4FFusc+T0Y3N3EyUOcXw1fc= X-Google-Smtp-Source: AGHT+IFZ5qApavg7upJPRo6/wr5ec1xuG8yUN72eSx6NMpyH+uoGXiQImeQDOsCtto82hbvFIjqikA== X-Received: by 2002:a05:6808:238f:b0:3c0:35a1:742c with SMTP id bp15-20020a056808238f00b003c035a1742cmr7615895oib.41.1708122765783; Fri, 16 Feb 2024 14:32:45 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id s9-20020a0568080b0900b003c0408e5b06sm126274oij.55.2024.02.16.14.32.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 14:32:45 -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 00/16] clk: samsung: Add CPU clocks for Exynos850 Date: Fri, 16 Feb 2024 16:32:29 -0600 Message-Id: <20240216223245.12273-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-20240216_143248_115811_88788B7C X-CRM114-Status: GOOD ( 16.25 ) 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. The breakup by patch: * Patch 01: Add bindings * Patches 02..12: Prepare clk-cpu.c for Exynos850 support * Patch 13: Add Exynos850 support * Patch 14: Init PLLs to be in manual mode * Patch 15: Add CPU CMUs in Exynos850 clock driver * Patch 16: Add CPU CMUs and clocks in Exynos850 dtsi If possible, all patches should go through Krzysztof's tree. As inter-series dependencies go: * All driver changes (patch 02..15) must be taken together following the order established in this series * Patch 16 (dts changes) depends on patch 01 (bindings additions) * Patch 15 (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 Sam Protsenko (16): 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 clock controller base address to CPU_CLK() clk: samsung: Use clk.h as a single header for Samsung CCF 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 .../clock/samsung,exynos850-clock.yaml | 42 ++ arch/arm64/boot/dts/exynos/exynos850.dtsi | 26 + drivers/clk/samsung/clk-cpu.c | 565 +++++++++++++----- drivers/clk/samsung/clk-cpu.h | 53 +- drivers/clk/samsung/clk-exynos-arm64.c | 44 +- drivers/clk/samsung/clk-exynos3250.c | 4 +- drivers/clk/samsung/clk-exynos4.c | 10 +- drivers/clk/samsung/clk-exynos5250.c | 6 +- drivers/clk/samsung/clk-exynos5260.c | 1 - drivers/clk/samsung/clk-exynos5420.c | 17 +- drivers/clk/samsung/clk-exynos5433.c | 12 +- drivers/clk/samsung/clk-exynos850.c | 440 +++++++++++++- drivers/clk/samsung/clk-pll.c | 2 +- drivers/clk/samsung/clk-s3c64xx.c | 1 - drivers/clk/samsung/clk-s5pv210.c | 1 - drivers/clk/samsung/clk.h | 9 +- include/dt-bindings/clock/exynos850.h | 54 ++ 17 files changed, 1042 insertions(+), 245 deletions(-)