From patchwork Sat Feb 24 20:20:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13570573 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 AC3E4C48BF6 for ; Sat, 24 Feb 2024 20:21:15 +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=wWCd1cznSxlCNbUQvJzU2SVc4O1Vsc/OaeoGW2euuvo=; b=uulZZdujGc1z6c nvSqnjin+3GISI9omBcEqMMr903Fq6apcJ2Qv7NVSBQvOYLH1qNcQq/W+c69rNYi7kEyrXcvNC6De fYo/AtlDTwtERALEZejMYnuCaNIQWg6dK/CasD48zFmxRdRwxdpYc8SL0V24ydsWT626/G5GbSUoT TltOSfSp4j7bY7zPyh5gfIEi9dI/fhE2UOIcd1h1j2KDDX897CHKFK0BpqKiIwZN+spM94Dwk8PEm SlacrATjtWWAVgv6j8eWQLjcXQ+L836ZiPBtSWlfLcoapZmllW0NupOA3exGU3cRGWMQn0olmn+b9 iwgKsHwxbFLlEzuUNMZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdyW2-0000000DaNt-1cGb; Sat, 24 Feb 2024 20:20:58 +0000 Received: from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdyVz-0000000DaMg-3FIh for linux-arm-kernel@lists.infradead.org; Sat, 24 Feb 2024 20:20:57 +0000 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-21eea6aab5eso1153097fac.0 for ; Sat, 24 Feb 2024 12:20:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708806054; x=1709410854; 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=nGannrirxDLyEcw4QNj/PlGVunpR8oUL3gw2gn1CCdI=; b=XEU78YFiy6UbNy7XGvWxqj1HQ4bd+wlnzYKTe783WEUXNoJb2DkmnZ35ZuY9Yv9UXQ Z0jeDwr1tWhrjsgLSaP9MtxD/epUTvnrF4vigdkWuGXWRiOSrEbcbCFJM/xrmDBBstkS ew6/jRoNCUPk0D0AQSjPD8avyudyMMfxztVaG/+I8Uv9STgMqnsJ9eiD/S0+7gFBgMQK iHdT11XXMOw1xtsZXjCtyTCTfFdwpp2Sfcep2Ot+poXX//e4Zq+YTy5/AtiYJ81OeggE y9eCl7mtv+/P1s7aSo9zYnQDu7koTG38c4Dsals5OTgES0tzXzL9KFlcHICqXZzy+hXH pBMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806054; x=1709410854; 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=nGannrirxDLyEcw4QNj/PlGVunpR8oUL3gw2gn1CCdI=; b=BGsn/HY46BgFaSZ6cu4JRkrw8Fuoie/scAejukjb2+AU2hZP5pipBktvA4lnnvD1az 7GWTTc8/V/gqFvnbKSBn/xB3nFP+4WTSWfPR400YaY4vXX35XSoASO/TPeyeaJcOv5Tc anctnV5aWCxYuqIHM1sR6NGzfr1KMn4j+qKxa7ZyEME6soIsf3k53r+0MwaoOLEgPNhI JZofLuyTyWm37p9IfSKqzC+Spx7RXlNWMouvEoDNTIfRk9g2tKxerxMqf/W+dDcjM/o7 7piZga+6qPhALlhMWHvwBGiiQSkfgR5DAZ4qY7Q3hKic2sLByAifLWEqTRi9WovLG48X JvWQ== X-Forwarded-Encrypted: i=1; AJvYcCVzVl93P08rhFJ/FnA8wB47gWmPdaLquusI0yNKV8hRehMNUDyNYEswrm+pcydW5iha7aIxgrag6vq1urfVwGFnV8oudat9xjXKWlCAg8neYjjjD+M= X-Gm-Message-State: AOJu0Yys4//cRl3yez0VXChVib4+W0zivOzBRQSqesdbkm41fo9/D8kG NWuOBZuFcCfUc/LkLFDVYxTKhkAd2d0gwkebHfG8F3fbxCDjHKN+PUa1mPb/svE= X-Google-Smtp-Source: AGHT+IE2dY97kRAepcW5IQOAJvCI6fuBC0RU49Fd8Ug20+7FPGijjsTJfx0+d2Ygnyzbi+gveHFkmw== X-Received: by 2002:a05:6871:5287:b0:21e:e97:a4cb with SMTP id hu7-20020a056871528700b0021e0e97a4cbmr4296920oac.1.1708806054416; Sat, 24 Feb 2024 12:20:54 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id hu15-20020a056871528f00b0021ec89a1a2asm585542oac.32.2024.02.24.12.20.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 12:20:54 -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 v3 00/15] clk: samsung: Add CPU clocks for Exynos850 Date: Sat, 24 Feb 2024 14:20:38 -0600 Message-Id: <20240224202053.25313-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-20240224_122055_855491_DEB36B19 X-CRM114-Status: GOOD ( 15.71 ) 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 v3: - Merged struct exynos850_cpuclk_regs fields into struct exynos_cpuclk_regs ("one-size-fits-all" approach) 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 - See per-patch changes in each patch's changelog 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 | 556 +++++++++++++----- 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, 1034 insertions(+), 232 deletions(-)