From nobody Sat Feb 7 19:04:16 2026 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDD264CB41 for ; Sat, 24 Feb 2024 20:20:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806058; cv=none; b=lGvXKY4o/pBvJjWXwOkVZSy/Mb62dRSQriusUiBFheV2hW2HyCbkUOW3saKssWy7fflFkCl8FTLOq61Hp2K6eNns9doC8MkIAztW7fJIX7UM3PNLlA+Pyi6IY71C9L4s8/YkYC0aw4RpsNt7zL/+kPtPDh/UxZFA7jrG+KlgxNo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806058; c=relaxed/simple; bh=OhURSWM8+fuAVHhkszMUOwGry5e3K6VMP6vMpX968h0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Zk6wXfNhzuz2HHmR9Mfi5v1BsKucNfqFPM8sCGFwPpXPHxNXXlqMB6fLE/OdrcHsNGz6INAtsVOXNhG9V5JN3oBnurja+WMbn/rdhlB+dRmTJIuWrKosCeffSvRDi7khe4E+M4+WDe2JYR7wtQWTj5P/RE/KFQzxYZndQkAEFls= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=LXnOPI4w; arc=none smtp.client-ip=209.85.210.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LXnOPI4w" Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-6ddca59e336so1161133a34.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=1708806055; x=1709410855; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Itgu/CZdB2adz5dOihNeRA11oIiQNAIilHhTarLaGhY=; b=LXnOPI4wcHhWM0iUeHs2bGAvvsTSoMWPV00HsLUebi738YVCJHAIbdZPa27epBlW1T iycZvEqmpyGGIlaqExYN4Uol46DbTwjef3kpCZ0uEEe2hzulxN/7aYiimL5rV9oyNPyg kdAQK8qfo69VGLnCcbkdHwm5vYX75JzZoOilUblVDFFbBCcl4WCTdo4SoFbieCjGTnVe qi9LyH3ICfGtkUUh6RVuNu2YhGm8JZHGcq0Ph0BRgWHWiDLr7GiV0RoiTarYN3g4bXJS Uye3RM69rR4wcPzazDOTwL0Csb76AskY2F+O+RFpqu7CEWZzu7zsbp/hmEQu7YYkY6b4 bw+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806055; x=1709410855; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Itgu/CZdB2adz5dOihNeRA11oIiQNAIilHhTarLaGhY=; b=rSUzvcHDkTp0SC1hO1LX5j7rzjUFyVfoKhLDArtVodIE6Vad48CuRznJa7WSmaPamn 8hgliYTCfRLRMwRIldUEDw5z3ywSGLe6fTzl0A6wCZX47DN6LpHDXvMWzYr6+VqtvaeN OS0GImgJsJT185uSX6BmoKWCkl+Vn6j2wNkrkrb04EJ7eoNU3X39DMoVOjLvOVfA8gqz Q/cno7PmU5m/BySIwKA4MvnXihzrehODFCG47XsGK9mftI0fTY313AB61vwP+Im06g1W 2s6O4mXCu8y5lZTunoGzh/szTRWWh4T5irrAaz85gVNip+I5lZWxstraWcuZkQAEuJxi My0A== X-Forwarded-Encrypted: i=1; AJvYcCWqwkMuN5smhdUYvEROAHroZMk5LvnF8FOUqjH14UK6wufQi3FGAMnnZgjoDLhMxrtg2U+/E8zDVvdW+U+adnnNM4soMr1FeEptnmac X-Gm-Message-State: AOJu0YwnegywlsUdYucxDQ+CljQ5E+dujhO6ZlOE7wqSTXS3OjV+p+BP 4y4y+UezZFMnYNC9XpgQBaD2JKvWk1IfeIvMnjeXQT0w666YW4EPaNAVIb0ZPkk= X-Google-Smtp-Source: AGHT+IEaFdafQDxvOhqf7szlKBjLkGDFQh1IaD2JJ1F/oKaL+attengEbCt1ufEL8VF8J7YfxLkw5w== X-Received: by 2002:a9d:6045:0:b0:6e4:8c95:1ac9 with SMTP id v5-20020a9d6045000000b006e48c951ac9mr1050906otj.16.1708806055136; Sat, 24 Feb 2024 12:20:55 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id m24-20020a4a2418000000b005a044f901c0sm454345oof.23.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 01/15] dt-bindings: clock: exynos850: Add CMU_CPUCLK0 and CMU_CPUCL1 Date: Sat, 24 Feb 2024 14:20:39 -0600 Message-Id: <20240224202053.25313-2-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224202053.25313-1-semen.protsenko@linaro.org> References: <20240224202053.25313-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Document CPU clock management unit compatibles and add corresponding clock indices. Exynos850 has two CPU clusters (CL0 and CL1), each containing 4 Cortex-A55 cores. CPU PLLs are generating main CPU clocks for each cluster, and there are alternate ("switch") clocks that can be used temporarily while re-configuring the PLL for the new rate. ACLK, ATCLK, PCLKDBG and PERIPHCLK clocks are driving corresponding buses. CLK_CLUSTERx_SCLK are actual leaf CPU clocks and should be used to change CPU rates. Also some CoreSight clocks can be derived from DBG_USER (debug clock). Signed-off-by: Sam Protsenko --- Changes in v3: - none Changes in v2: - none .../clock/samsung,exynos850-clock.yaml | 42 +++++++++++++++ include/dt-bindings/clock/exynos850.h | 54 +++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/samsung,exynos850-cloc= k.yaml b/Documentation/devicetree/bindings/clock/samsung,exynos850-clock.ya= ml index c752c8985a53..cdc5ded59fe5 100644 --- a/Documentation/devicetree/bindings/clock/samsung,exynos850-clock.yaml +++ b/Documentation/devicetree/bindings/clock/samsung,exynos850-clock.yaml @@ -36,6 +36,8 @@ properties: - samsung,exynos850-cmu-aud - samsung,exynos850-cmu-cmgp - samsung,exynos850-cmu-core + - samsung,exynos850-cmu-cpucl0 + - samsung,exynos850-cmu-cpucl1 - samsung,exynos850-cmu-dpu - samsung,exynos850-cmu-g3d - samsung,exynos850-cmu-hsi @@ -152,6 +154,46 @@ allOf: - const: dout_core_mmc_embd - const: dout_core_sss =20 + - if: + properties: + compatible: + contains: + const: samsung,exynos850-cmu-cpucl0 + + then: + properties: + clocks: + items: + - description: External reference clock (26 MHz) + - description: CPUCL0 switch clock (from CMU_TOP) + - description: CPUCL0 debug clock (from CMU_TOP) + + clock-names: + items: + - const: oscclk + - const: dout_cpucl0_switch + - const: dout_cpucl0_dbg + + - if: + properties: + compatible: + contains: + const: samsung,exynos850-cmu-cpucl1 + + then: + properties: + clocks: + items: + - description: External reference clock (26 MHz) + - description: CPUCL1 switch clock (from CMU_TOP) + - description: CPUCL1 debug clock (from CMU_TOP) + + clock-names: + items: + - const: oscclk + - const: dout_cpucl1_switch + - const: dout_cpucl1_dbg + - if: properties: compatible: diff --git a/include/dt-bindings/clock/exynos850.h b/include/dt-bindings/cl= ock/exynos850.h index bc15108aa3c2..7666241520f8 100644 --- a/include/dt-bindings/clock/exynos850.h +++ b/include/dt-bindings/clock/exynos850.h @@ -88,6 +88,18 @@ #define CLK_MOUT_G3D_SWITCH 76 #define CLK_GOUT_G3D_SWITCH 77 #define CLK_DOUT_G3D_SWITCH 78 +#define CLK_MOUT_CPUCL0_DBG 79 +#define CLK_MOUT_CPUCL0_SWITCH 80 +#define CLK_GOUT_CPUCL0_DBG 81 +#define CLK_GOUT_CPUCL0_SWITCH 82 +#define CLK_DOUT_CPUCL0_DBG 83 +#define CLK_DOUT_CPUCL0_SWITCH 84 +#define CLK_MOUT_CPUCL1_DBG 85 +#define CLK_MOUT_CPUCL1_SWITCH 86 +#define CLK_GOUT_CPUCL1_DBG 87 +#define CLK_GOUT_CPUCL1_SWITCH 88 +#define CLK_DOUT_CPUCL1_DBG 89 +#define CLK_DOUT_CPUCL1_SWITCH 90 =20 /* CMU_APM */ #define CLK_RCO_I3C_PMIC 1 @@ -195,6 +207,48 @@ #define CLK_GOUT_CMGP_USI1_PCLK 14 #define CLK_GOUT_SYSREG_CMGP_PCLK 15 =20 +/* CMU_CPUCL0 */ +#define CLK_FOUT_CPUCL0_PLL 1 +#define CLK_MOUT_PLL_CPUCL0 2 +#define CLK_MOUT_CPUCL0_SWITCH_USER 3 +#define CLK_MOUT_CPUCL0_DBG_USER 4 +#define CLK_MOUT_CPUCL0_PLL 5 +#define CLK_DOUT_CPUCL0_CPU 6 +#define CLK_DOUT_CPUCL0_CMUREF 7 +#define CLK_DOUT_CPUCL0_PCLK 8 +#define CLK_DOUT_CLUSTER0_ACLK 9 +#define CLK_DOUT_CLUSTER0_ATCLK 10 +#define CLK_DOUT_CLUSTER0_PCLKDBG 11 +#define CLK_DOUT_CLUSTER0_PERIPHCLK 12 +#define CLK_GOUT_CLUSTER0_ATCLK 13 +#define CLK_GOUT_CLUSTER0_PCLK 14 +#define CLK_GOUT_CLUSTER0_PERIPHCLK 15 +#define CLK_GOUT_CLUSTER0_SCLK 16 +#define CLK_GOUT_CPUCL0_CMU_CPUCL0_PCLK 17 +#define CLK_GOUT_CLUSTER0_CPU 18 +#define CLK_CLUSTER0_SCLK 19 + +/* CMU_CPUCL1 */ +#define CLK_FOUT_CPUCL1_PLL 1 +#define CLK_MOUT_PLL_CPUCL1 2 +#define CLK_MOUT_CPUCL1_SWITCH_USER 3 +#define CLK_MOUT_CPUCL1_DBG_USER 4 +#define CLK_MOUT_CPUCL1_PLL 5 +#define CLK_DOUT_CPUCL1_CPU 6 +#define CLK_DOUT_CPUCL1_CMUREF 7 +#define CLK_DOUT_CPUCL1_PCLK 8 +#define CLK_DOUT_CLUSTER1_ACLK 9 +#define CLK_DOUT_CLUSTER1_ATCLK 10 +#define CLK_DOUT_CLUSTER1_PCLKDBG 11 +#define CLK_DOUT_CLUSTER1_PERIPHCLK 12 +#define CLK_GOUT_CLUSTER1_ATCLK 13 +#define CLK_GOUT_CLUSTER1_PCLK 14 +#define CLK_GOUT_CLUSTER1_PERIPHCLK 15 +#define CLK_GOUT_CLUSTER1_SCLK 16 +#define CLK_GOUT_CPUCL1_CMU_CPUCL1_PCLK 17 +#define CLK_GOUT_CLUSTER1_CPU 18 +#define CLK_CLUSTER1_SCLK 19 + /* CMU_G3D */ #define CLK_FOUT_G3D_PLL 1 #define CLK_MOUT_G3D_PLL 2 --=20 2.39.2 From nobody Sat Feb 7 19:04:16 2026 Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B68694CDEC for ; Sat, 24 Feb 2024 20:20:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806058; cv=none; b=R2KyK3zRpjCuWZbLlxDfLm9nrDx66yadYLXxknEdcsoN/gPsP7knt17oFAoUP2rtbIdeUUCFQ1HgPdw77CVeJE3xJdyRplHGlTFyzMvyQPzEGnyWBFW/G+nQnQNyyJ8zt4snO90+aXooVCsXXqspcyiO1B7cRfo6g/gzwbxOQsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806058; c=relaxed/simple; bh=wFXD7ZP3DanPG4l9RxVjK40iCe6h8FLbw1OZxGjvikQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FAuaOrUUNnhaD+qH3aLZ+MLsNuPe9FMNvntpV4oYty73AGD51a+SgL7eVTCYBB0od03Ls8a/xv23Pmgo6a8IxkroCoAQl4IaVesCzlc7zsNq0oONDLbi/P7wVi5Fx/6w8onJFZzvHW5SOuvFff6rE8pE5/PryzQ/ckwZPSZryk8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=bdKT8OVf; arc=none smtp.client-ip=209.85.167.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bdKT8OVf" Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-3c134813841so721234b6e.0 for ; Sat, 24 Feb 2024 12:20:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708806056; x=1709410856; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AxhpOYuWn8geKSVIhV09plgNQM+kCMb1DYqiFqfJ1V8=; b=bdKT8OVfEHH8+F3SGcIcMilYr7CBJpzZqH97VmfZl4l9PRqQTnGufTOZGJ9ZNoB4Hb tROW6oVGXthU57AZnrNl1+M3V6OE+vruKRElhxct6H6FGOrxpcCEFrplVa6KtEdA4sVe JCB0xFA2SDFmz6M3NFzsSfyPj4RSn5CzYn4z3oPVlyGBLDXUV8E5nrJVitYLD/6fWoko CLk981PTJb4AJ5y84ZD0sEQf0Y61W6ETj+1V3VANR5jscmn9gAlD1Wl4RfrHM5JNJaov clM6Kz+TqVPivwMFXcXFjJ2aRaCmoEc2LBKJfXAuAEngb/bHQZd/CFY58xSnOQbhVC0T EUDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806056; x=1709410856; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AxhpOYuWn8geKSVIhV09plgNQM+kCMb1DYqiFqfJ1V8=; b=oEwEtKnGOAaUmFYjAt3JWyI0MQquh/9PP20Z834BqmgENZeI3rVWHp0e2OL+RMJ+kw wz4fafFnLwKgAwI8C0cftLuA52u8Y53dc9n1a4l/dR3+Q1KRaYzbJZgKsLyjqjd2B+Uy lIyTZudiw9OTnCfbKoIvtCLBrGOKd2eykoMqsqEWggEnAlpWJyuoA1n0riQCYRgiAMsM sNLvTtbqWI+c5r/Qu9Dk/BEjB9wHuLzY2d/iJYjk9cOOz6ze0awDN1mi47Ec/5hsLn9i 3mqewqVdLoZYp6dzF6mtCXVbApaSm4uqLveR+gOrjQS5ewoJtNdp9afcuBbktoOICnch AmcA== X-Forwarded-Encrypted: i=1; AJvYcCWDMFeFGuP2ef6QTSOq5qNVUruG896nG+s51t3sEl+ynGSW40z8uoQYFaXqZlP2ZOSpfFsUdFaM9WASXTX8SwbOaU5EDCE4TLXM4O01 X-Gm-Message-State: AOJu0YysBHEPfy171e5lAGNU5tupI/Ia9aeiXaGlhxp9QK/yZlzuZgMH +3FhVWOYxqrIYA98cDr8Syy68kZWStPJgvr82dRSfyP1AA6SLqDzi5SboZOywJc= X-Google-Smtp-Source: AGHT+IFnbr8ZrOOcz5qezSHT6RS+M56iOWucSv+VIAahJRTDFUjqW1RjE9ZMAWB4VlkSp+MeSsRODA== X-Received: by 2002:a05:6808:2185:b0:3c1:57a2:21ef with SMTP id be5-20020a056808218500b003c157a221efmr1440045oib.23.1708806055877; Sat, 24 Feb 2024 12:20:55 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 3-20020aca2103000000b003c17b3175d6sm377812oiz.58.2024.02.24.12.20.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 12:20:55 -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 02/15] clk: samsung: Improve clk-cpu.c style Date: Sat, 24 Feb 2024 14:20:40 -0600 Message-Id: <20240224202053.25313-3-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224202053.25313-1-semen.protsenko@linaro.org> References: <20240224202053.25313-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" clk-cpu.c has numerous style issues reported by checkpatch and easily identified otherwise. Give it some love and fix those warnings where it makes sense. Also make stabilization time a named constant to get rid of the magic number in clk-cpu.c. No functional change. Signed-off-by: Sam Protsenko --- Changes in v3: - none Changes in v2: - none drivers/clk/samsung/clk-cpu.c | 65 ++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index 3e62ade120c5..e02730776aaa 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -16,18 +16,18 @@ * of the SoC or supplied after the SoC characterization. * * The below implementation of the CPU clock allows the rate changes of th= e CPU - * clock and the corresponding rate changes of the auxillary clocks of the= CPU + * clock and the corresponding rate changes of the auxiliary clocks of the= CPU * domain. The platform clock driver provides a clock register configurati= on * for each configurable rate which is then used to program the clock hard= ware - * registers to acheive a fast co-oridinated rate change for all the CPU d= omain + * registers to achieve a fast coordinated rate change for all the CPU dom= ain * clocks. * * On a rate change request for the CPU clock, the rate change is propagat= ed - * upto the PLL supplying the clock to the CPU domain clock blocks. While = the + * up to the PLL supplying the clock to the CPU domain clock blocks. While= the * CPU domain PLL is reconfigured, the CPU domain clocks are driven using = an * alternate clock source. If required, the alternate clock source is divi= ded * down in order to keep the output clock rate within the previous OPP lim= its. -*/ + */ =20 #include #include @@ -50,17 +50,19 @@ #define E5433_DIV_STAT_CPU0 0x500 #define E5433_DIV_STAT_CPU1 0x504 =20 -#define E4210_DIV0_RATIO0_MASK 0x7 -#define E4210_DIV1_HPM_MASK (0x7 << 4) -#define E4210_DIV1_COPY_MASK (0x7 << 0) -#define E4210_MUX_HPM_MASK (1 << 20) +#define E4210_DIV0_RATIO0_MASK GENMASK(2, 0) +#define E4210_DIV1_HPM_MASK GENMASK(6, 4) +#define E4210_DIV1_COPY_MASK GENMASK(2, 0) +#define E4210_MUX_HPM_MASK BIT(20) #define E4210_DIV0_ATB_SHIFT 16 #define E4210_DIV0_ATB_MASK (DIV_MASK << E4210_DIV0_ATB_SHIFT) =20 +/* Divider stabilization time, msec */ +#define MAX_STAB_TIME 10 #define MAX_DIV 8 -#define DIV_MASK 7 -#define DIV_MASK_ALL 0xffffffff -#define MUX_MASK 7 +#define DIV_MASK GENMASK(2, 0) +#define DIV_MASK_ALL GENMASK(31, 0) +#define MUX_MASK GENMASK(2, 0) =20 /* * Helper function to wait until divider(s) have stabilized after the divi= der @@ -68,7 +70,7 @@ */ static void wait_until_divider_stable(void __iomem *div_reg, unsigned long= mask) { - unsigned long timeout =3D jiffies + msecs_to_jiffies(10); + unsigned long timeout =3D jiffies + msecs_to_jiffies(MAX_STAB_TIME); =20 do { if (!(readl(div_reg) & mask)) @@ -86,9 +88,9 @@ static void wait_until_divider_stable(void __iomem *div_r= eg, unsigned long mask) * value was changed. */ static void wait_until_mux_stable(void __iomem *mux_reg, u32 mux_pos, - unsigned long mux_value) + unsigned long mux_value) { - unsigned long timeout =3D jiffies + msecs_to_jiffies(10); + unsigned long timeout =3D jiffies + msecs_to_jiffies(MAX_STAB_TIME); =20 do { if (((readl(mux_reg) >> mux_pos) & MUX_MASK) =3D=3D mux_value) @@ -101,18 +103,18 @@ static void wait_until_mux_stable(void __iomem *mux_r= eg, u32 mux_pos, pr_err("%s: re-parenting mux timed-out\n", __func__); } =20 -/* common round rate callback useable for all types of CPU clocks */ -static long exynos_cpuclk_round_rate(struct clk_hw *hw, - unsigned long drate, unsigned long *prate) +/* common round rate callback usable for all types of CPU clocks */ +static long exynos_cpuclk_round_rate(struct clk_hw *hw, unsigned long drat= e, + unsigned long *prate) { struct clk_hw *parent =3D clk_hw_get_parent(hw); *prate =3D clk_hw_round_rate(parent, drate); return *prate; } =20 -/* common recalc rate callback useable for all types of CPU clocks */ +/* common recalc rate callback usable for all types of CPU clocks */ static unsigned long exynos_cpuclk_recalc_rate(struct clk_hw *hw, - unsigned long parent_rate) + unsigned long parent_rate) { /* * The CPU clock output (armclk) rate is the same as its parent @@ -135,7 +137,7 @@ static const struct clk_ops exynos_cpuclk_clk_ops =3D { * dividers to be programmed. */ static void exynos_set_safe_div(void __iomem *base, unsigned long div, - unsigned long mask) + unsigned long mask) { unsigned long div0; =20 @@ -151,7 +153,6 @@ static int exynos_cpuclk_pre_rate_change(struct clk_not= ifier_data *ndata, { const struct exynos_cpuclk_cfg_data *cfg_data =3D cpuclk->cfg; unsigned long alt_prate =3D clk_hw_get_rate(cpuclk->alt_parent); - unsigned long alt_div =3D 0, alt_div_mask =3D DIV_MASK; unsigned long div0, div1 =3D 0, mux_reg; unsigned long flags; =20 @@ -187,6 +188,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_not= ifier_data *ndata, */ if (alt_prate > ndata->old_rate || ndata->old_rate > ndata->new_rate) { unsigned long tmp_rate =3D min(ndata->old_rate, ndata->new_rate); + unsigned long alt_div, alt_div_mask =3D DIV_MASK; =20 alt_div =3D DIV_ROUND_UP(alt_prate, tmp_rate) - 1; WARN_ON(alt_div >=3D MAX_DIV); @@ -215,7 +217,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_not= ifier_data *ndata, if (cpuclk->flags & CLK_CPU_HAS_DIV1) { writel(div1, base + E4210_DIV_CPU1); wait_until_divider_stable(base + E4210_DIV_STAT_CPU1, - DIV_MASK_ALL); + DIV_MASK_ALL); } =20 spin_unlock_irqrestore(cpuclk->lock, flags); @@ -263,7 +265,7 @@ static int exynos_cpuclk_post_rate_change(struct clk_no= tifier_data *ndata, * dividers to be programmed. */ static void exynos5433_set_safe_div(void __iomem *base, unsigned long div, - unsigned long mask) + unsigned long mask) { unsigned long div0; =20 @@ -279,7 +281,6 @@ static int exynos5433_cpuclk_pre_rate_change(struct clk= _notifier_data *ndata, { const struct exynos_cpuclk_cfg_data *cfg_data =3D cpuclk->cfg; unsigned long alt_prate =3D clk_hw_get_rate(cpuclk->alt_parent); - unsigned long alt_div =3D 0, alt_div_mask =3D DIV_MASK; unsigned long div0, div1 =3D 0, mux_reg; unsigned long flags; =20 @@ -309,6 +310,7 @@ static int exynos5433_cpuclk_pre_rate_change(struct clk= _notifier_data *ndata, */ if (alt_prate > ndata->old_rate || ndata->old_rate > ndata->new_rate) { unsigned long tmp_rate =3D min(ndata->old_rate, ndata->new_rate); + unsigned long alt_div, alt_div_mask =3D DIV_MASK; =20 alt_div =3D DIV_ROUND_UP(alt_prate, tmp_rate) - 1; WARN_ON(alt_div >=3D MAX_DIV); @@ -358,7 +360,7 @@ static int exynos5433_cpuclk_post_rate_change(struct cl= k_notifier_data *ndata, * notifications of the parent clock of cpuclk. */ static int exynos_cpuclk_notifier_cb(struct notifier_block *nb, - unsigned long event, void *data) + unsigned long event, void *data) { struct clk_notifier_data *ndata =3D data; struct exynos_cpuclk *cpuclk; @@ -381,7 +383,7 @@ static int exynos_cpuclk_notifier_cb(struct notifier_bl= ock *nb, * notifications of the parent clock of cpuclk. */ static int exynos5433_cpuclk_notifier_cb(struct notifier_block *nb, - unsigned long event, void *data) + unsigned long event, void *data) { struct clk_notifier_data *ndata =3D data; struct exynos_cpuclk *cpuclk; @@ -438,11 +440,10 @@ static int __init exynos_register_cpu_clock(struct sa= msung_clk_provider *ctx, else cpuclk->clk_nb.notifier_call =3D exynos_cpuclk_notifier_cb; =20 - ret =3D clk_notifier_register(parent->clk, &cpuclk->clk_nb); if (ret) { pr_err("%s: failed to register clock notifier for %s\n", - __func__, name); + __func__, name); goto free_cpuclk; } =20 @@ -454,7 +455,7 @@ static int __init exynos_register_cpu_clock(struct sams= ung_clk_provider *ctx, =20 ret =3D clk_hw_register(NULL, &cpuclk->hw); if (ret) { - pr_err("%s: could not register cpuclk %s\n", __func__, name); + pr_err("%s: could not register cpuclk %s\n", __func__, name); goto free_cpuclk_data; } =20 @@ -482,8 +483,8 @@ void __init samsung_clk_register_cpu(struct samsung_clk= _provider *ctx, for (num_cfgs =3D 0; list->cfg[num_cfgs].prate !=3D 0; ) num_cfgs++; =20 - exynos_register_cpu_clock(ctx, list->id, list->name, hws[list->parent_id= ], - hws[list->alt_parent_id], list->offset, list->cfg, num_cfgs, - list->flags); + exynos_register_cpu_clock(ctx, list->id, list->name, + hws[list->parent_id], hws[list->alt_parent_id], + list->offset, list->cfg, num_cfgs, list->flags); } } --=20 2.39.2 From nobody Sat Feb 7 19:04:16 2026 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 885884D11F for ; Sat, 24 Feb 2024 20:20:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806059; cv=none; b=HmzOpwh3Gxoogz+DcgVJ6ZRTMCrdM3QGT64Pu5gjqOtckJMNqbMiIRFLsaH0ODkI45ZV3N79TLUwwb+qCsMD8/uPjl3KazBHJcc81l6J2SL8ZGezSwDyVXP2hoqNxVzTnSPLbP2JyGpW8M/mdJ13zIJUBGRMIq0upuURHsnm3EU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806059; c=relaxed/simple; bh=fN7G3wPmBsJcgLlgsVKiAx8cGoftNtuuXTgf0LWnTHk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NeEK5UeYnNkR6QHO1cbRe3yVqS4D3CqduHWhzawNNddYDknj4p7T58WYY242Bcj3jK3pSvkmAyG4dCYWDGXmq36BlEgh7g3ug+d6pl6IAWsi+5LWg7WCI00L6JZ7j2yAkOUslXd4jR+8ni49gDWdZ7/CWGxEYeMDsNiv3ibWbWo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=dvSgK1nR; arc=none smtp.client-ip=209.85.210.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dvSgK1nR" Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-6ddca59e336so1161166a34.0 for ; Sat, 24 Feb 2024 12:20:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708806056; x=1709410856; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T4GSfJijJ5j5tZLrOHCfmxmebAz3nZFw4CYMZ7bPECs=; b=dvSgK1nRbn7WRjpSKi8ySSRSfygHhpdwrNX4OcsRg7a4QmM24ZM9WN1mjOB5nnahj1 r0MkgJJSqQ0NX1yzxS0iLsgdxmv8B0gfV3yI0WYnfRd2NHQU0Pywde1aDEkb/MHIgv1A K0IgdI1ehG8SSbyDhRJKvpaUJcbBnBK3XgfN164KYN7rVzfGkoHLF7p3E7S8J3tOboxF tigH5dQWR9dgDCBAXyv95b8pSez9lyyyk3EfR03GYdr6QXAPAuQb4kZIpgI33ltEExDd u7Yz9iv++1Ivp6kPea4TuzAYhi7JeIdy6YtyABBteo1YTb7m+lFP424IGBwhku43lsgY hhLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806056; x=1709410856; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T4GSfJijJ5j5tZLrOHCfmxmebAz3nZFw4CYMZ7bPECs=; b=u1qOR24tbMDLt8AOiFBwm5iPYlGvEj0cVfPzAjHpkRzxs5gdgiEiSVE7ECNTeMBm8q K3rGN/BMgLbEo8pgSKEvCQXpsOyMR9E0GBIIgJf6vY409VPNRX6QItPzggaw9d7DqVW1 D8+yys9UGayJxDSzBulLry+arNvmUHpxAUbHIECKlxfSquacoO8j9jDGJ9UJyZ099ArD 3TjGhfRVq9yEvnf6izEkFdbtlrj+ovfjkemhBUmG3MBlovio4xVjIZ0KwCy0qQ6klx55 lW2gjBZmLZODXus0nlQvpaVcO4Xk2p5o29XLCVmqlmUwYWOb7sgnjnwK8/zn3smP/cqi v82A== X-Forwarded-Encrypted: i=1; AJvYcCUYK/lidTO/HApTUIMeCPgBORgOl0ffb6flKR61T5ffEH99dRszGREZ60KgIXW+MdoBpAoKCMV1Bd9oFspGf3rUD/sd88KjsTsHZG7i X-Gm-Message-State: AOJu0Yzjopic6X4EbTXnxDRkWlLgXtCJ53BMYyTvKgzDCOTy3Lp+QJcQ rG6hFLNSaEs0PouC+6PV7ZBD03Ccx+Pu/YpohxBDwb+rGX73Bj7OPRqMLpgphxw= X-Google-Smtp-Source: AGHT+IFezpIvERjHD2pciFQcNjycbJTG/ZehyajyoyHMTJjZFoS0RTBxr/K78EmMg1zM64y7rVK69g== X-Received: by 2002:a9d:754b:0:b0:6e4:527c:14b with SMTP id b11-20020a9d754b000000b006e4527c014bmr1191372otl.5.1708806056671; Sat, 24 Feb 2024 12:20:56 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id t22-20020a0568301e3600b006e12266433csm407445otr.27.2024.02.24.12.20.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 12:20:56 -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 03/15] clk: samsung: Pull struct exynos_cpuclk into clk-cpu.c Date: Sat, 24 Feb 2024 14:20:41 -0600 Message-Id: <20240224202053.25313-4-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224202053.25313-1-semen.protsenko@linaro.org> References: <20240224202053.25313-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Reduce the scope of struct exynos_cpuclk, as it's only used in clk-cpu.c internally. All drivers using clk-pll.h already include clk.h as well, so this change doesn't break anything. No functional change. Signed-off-by: Sam Protsenko --- Changes in v3: - none Changes in v2: - none drivers/clk/samsung/clk-cpu.c | 29 +++++++++++++++++++++++++ drivers/clk/samsung/clk-cpu.h | 41 +++++------------------------------ 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index e02730776aaa..6412fd2580e0 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -34,6 +34,8 @@ #include #include #include + +#include "clk.h" #include "clk-cpu.h" =20 #define E4210_SRC_CPU 0x0 @@ -64,6 +66,33 @@ #define DIV_MASK_ALL GENMASK(31, 0) #define MUX_MASK GENMASK(2, 0) =20 +/** + * struct exynos_cpuclk - information about clock supplied to a CPU core + * @hw: handle between CCF and CPU clock + * @alt_parent: alternate parent clock to use when switching the speed + * of the primary parent clock + * @ctrl_base: base address of the clock controller + * @lock: cpu clock domain register access lock + * @cfg: cpu clock rate configuration data + * @num_cfgs: number of array elements in @cfg array + * @clk_nb: clock notifier registered for changes in clock speed of the + * primary parent clock + * @flags: configuration flags for the CPU clock + * + * This structure holds information required for programming the CPU clock= for + * various clock speeds. + */ +struct exynos_cpuclk { + struct clk_hw hw; + const struct clk_hw *alt_parent; + void __iomem *ctrl_base; + spinlock_t *lock; + const struct exynos_cpuclk_cfg_data *cfg; + const unsigned long num_cfgs; + struct notifier_block clk_nb; + unsigned long flags; +}; + /* * Helper function to wait until divider(s) have stabilized after the divi= der * value has changed. diff --git a/drivers/clk/samsung/clk-cpu.h b/drivers/clk/samsung/clk-cpu.h index 0164bd9ad021..ee57f3638fed 100644 --- a/drivers/clk/samsung/clk-cpu.h +++ b/drivers/clk/samsung/clk-cpu.h @@ -8,7 +8,12 @@ #ifndef __SAMSUNG_CLK_CPU_H #define __SAMSUNG_CLK_CPU_H =20 -#include "clk.h" +/* The CPU clock registers have DIV1 configuration register */ +#define CLK_CPU_HAS_DIV1 BIT(0) +/* When ALT parent is active, debug clocks need safe divider values */ +#define CLK_CPU_NEEDS_DEBUG_ALT_DIV BIT(1) +/* The CPU clock registers have Exynos5433-compatible layout */ +#define CLK_CPU_HAS_E5433_REGS_LAYOUT BIT(2) =20 /** * struct exynos_cpuclk_cfg_data - config data to setup cpu clocks @@ -28,38 +33,4 @@ struct exynos_cpuclk_cfg_data { unsigned long div1; }; =20 -/** - * struct exynos_cpuclk - information about clock supplied to a CPU core - * @hw: handle between CCF and CPU clock - * @alt_parent: alternate parent clock to use when switching the speed - * of the primary parent clock - * @ctrl_base: base address of the clock controller - * @lock: cpu clock domain register access lock - * @cfg: cpu clock rate configuration data - * @num_cfgs: number of array elements in @cfg array - * @clk_nb: clock notifier registered for changes in clock speed of the - * primary parent clock - * @flags: configuration flags for the CPU clock - * - * This structure holds information required for programming the CPU clock= for - * various clock speeds. - */ -struct exynos_cpuclk { - struct clk_hw hw; - const struct clk_hw *alt_parent; - void __iomem *ctrl_base; - spinlock_t *lock; - const struct exynos_cpuclk_cfg_data *cfg; - const unsigned long num_cfgs; - struct notifier_block clk_nb; - unsigned long flags; - -/* The CPU clock registers have DIV1 configuration register */ -#define CLK_CPU_HAS_DIV1 (1 << 0) -/* When ALT parent is active, debug clocks need safe divider values */ -#define CLK_CPU_NEEDS_DEBUG_ALT_DIV (1 << 1) -/* The CPU clock registers have Exynos5433-compatible layout */ -#define CLK_CPU_HAS_E5433_REGS_LAYOUT (1 << 2) -}; - #endif /* __SAMSUNG_CLK_CPU_H */ --=20 2.39.2 From nobody Sat Feb 7 19:04:16 2026 Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 481E74D59C for ; Sat, 24 Feb 2024 20:20:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806060; cv=none; b=R3dDfVlJeU3G2K/o5Tjwvq6keXLxCop/zxF7Ah6gBbzQSGzwTaworc2Pt0aJeD4C1vA7L3Ken3ulsZ9Y1qkdnMzjdYnsnp79uMUVDCvbeoC5vpc/4KzmsRejZRUhRz/y7IFrnXyN/z9aF6gwvCj3uSnruITt9gDtslgM33NCqyo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806060; c=relaxed/simple; bh=8vDjKv5CbmqJonhIPFV7UHvnuzTKWFqo1N9oGJJvWA0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=slUK4UZjKm91USLIEFhokPZHonxduA3Z07K7G1bW297j+zg0F5MJ1Ht9D+Y+8Yp1tW8+JdNlKvAQyDbyaJ7pMdTPeECvCqNysjgfkO5+MorvoPAsnZBDKuHwv+OkrEsuYksaToi0RWwarcL/KfoufP5OVQYOCbkQW9PMXdvTHBc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=OcndeSh3; arc=none smtp.client-ip=209.85.167.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OcndeSh3" Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3bbbc6b4ed1so1532874b6e.2 for ; Sat, 24 Feb 2024 12:20:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708806057; x=1709410857; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BIuqSD1JNGAHgvRkLpN9TD+kZKkjlKs1GB5+HEoXmSg=; b=OcndeSh3IWpYW7y/4Q9RegXYpAzSGWBUHQMLMcsn/b7Svqnc6E9C8bvQxLJHRfpceF i+aIYBKK0X3dak0jt2aygshppNW8FjA9zQ9FEJZAwne9jeCyFsqOy8n82LJnkxW5Vkim OHgHyOQqYFBcBlTZXvEyFC+dedr/ZvPqZm9n0ZgMxBOczQC0Qu9F+MZT2kltTw0HElgc J9CODEXiyCYd9a2tufKn4Yvh7vjUcFH0ZC5Clt8RrYoPH5rwXEWn/T2n8e4liyA8VF7x tQZkvs8zJoT6727F89R/F46p8A6T8uE7IFasA3v+E7Um5OqU8jmtoRgzudNNZAewp+mH tn2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806057; x=1709410857; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BIuqSD1JNGAHgvRkLpN9TD+kZKkjlKs1GB5+HEoXmSg=; b=CTYTEAq6DToAOAOzn0cAxzuzwDJIt/JYVKB/fdj0l7GArQEQZNNonQJMJSDbGs+D99 jqHf7FqrWLCiwjOng2H7gGg8YG1s/lWNd00r+Gedf78sp7stLbIlGf6UGLZQP3I7A02F sw9+2nPcqj9tc7bHO2dnyrnaJlAJ8y3va/+ITEtvTdmE9OklQW1OXoLWeKOu0Ao6CcaQ cVOIQf0cB17p3evttvNHMqcVmWyJE8CvPoPwpgONYMqQvGWVgPQ523Y/GwLbvXvODa4z qT6A5FSexC1JQnMy66JsIggba3pShT5gxcO1PYUMLcoZdZ5BdEAujbA02sPpY5JHQ0j3 dC/g== X-Forwarded-Encrypted: i=1; AJvYcCW8qfmAaD6TXFj0DDSf6uIy+aA5ljagcQJFGJAXQdC9Xd4MVulQiXHSjVLOTN067Y8h0AQwc+y2T5YHuS1CPm6YStjUVptPOTl5lJaS X-Gm-Message-State: AOJu0YwtEB5ONZe5CMIisTPJng8llyby+KbVsFb8dILHHiuhSi9aN/qw LvkLwxIhjEFYqDSn+hhRt7naQlOs43vd0Manzo0lHvl5VVqtbf3Vr5u1C9lKV1k= X-Google-Smtp-Source: AGHT+IEnJC7vVv78ANtdBQxEa92suD4hZccR3eOtEkSJdPaCxNnJgMSMtvAH9tsjy6akqaOpDaNl3g== X-Received: by 2002:a05:6808:1a13:b0:3c1:54eb:ff0a with SMTP id bk19-20020a0568081a1300b003c154ebff0amr4391713oib.7.1708806057394; Sat, 24 Feb 2024 12:20:57 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id z9-20020a056808028900b003c16a317dd4sm385305oic.53.2024.02.24.12.20.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 12:20:57 -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 04/15] clk: samsung: Reduce params count in exynos_register_cpu_clock() Date: Sat, 24 Feb 2024 14:20:42 -0600 Message-Id: <20240224202053.25313-5-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224202053.25313-1-semen.protsenko@linaro.org> References: <20240224202053.25313-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Pass CPU clock data structure to exynos_register_cpu_clock() instead of passing its fields separately there. That simplifies the signature of exynos_register_cpu_clock() and makes it easier to add more fields to struct samsung_cpu_clock later. This style follows the example of samsung_clk_register_pll(). No functional change. Signed-off-by: Sam Protsenko --- Changes in v3: - none Changes in v2: - none drivers/clk/samsung/clk-cpu.c | 46 +++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index 6412fd2580e0..7b6fd331a7ec 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -432,16 +432,19 @@ static int exynos5433_cpuclk_notifier_cb(struct notif= ier_block *nb, =20 /* helper function to register a CPU clock */ static int __init exynos_register_cpu_clock(struct samsung_clk_provider *c= tx, - unsigned int lookup_id, const char *name, - const struct clk_hw *parent, const struct clk_hw *alt_parent, - unsigned long offset, const struct exynos_cpuclk_cfg_data *cfg, - unsigned long num_cfgs, unsigned long flags) + const struct samsung_cpu_clock *clk_data) { + const struct clk_hw *parent, *alt_parent; + struct clk_hw **hws; struct exynos_cpuclk *cpuclk; struct clk_init_data init; const char *parent_name; + unsigned int num_cfgs; int ret =3D 0; =20 + hws =3D ctx->clk_data.hws; + parent =3D hws[clk_data->parent_id]; + alt_parent =3D hws[clk_data->alt_parent_id]; if (IS_ERR(parent) || IS_ERR(alt_parent)) { pr_err("%s: invalid parent clock(s)\n", __func__); return -EINVAL; @@ -453,7 +456,7 @@ static int __init exynos_register_cpu_clock(struct sams= ung_clk_provider *ctx, =20 parent_name =3D clk_hw_get_name(parent); =20 - init.name =3D name; + init.name =3D clk_data->name; init.flags =3D CLK_SET_RATE_PARENT; init.parent_names =3D &parent_name; init.num_parents =3D 1; @@ -461,10 +464,10 @@ static int __init exynos_register_cpu_clock(struct sa= msung_clk_provider *ctx, =20 cpuclk->alt_parent =3D alt_parent; cpuclk->hw.init =3D &init; - cpuclk->ctrl_base =3D ctx->reg_base + offset; + cpuclk->ctrl_base =3D ctx->reg_base + clk_data->offset; cpuclk->lock =3D &ctx->lock; - cpuclk->flags =3D flags; - if (flags & CLK_CPU_HAS_E5433_REGS_LAYOUT) + cpuclk->flags =3D clk_data->flags; + if (clk_data->flags & CLK_CPU_HAS_E5433_REGS_LAYOUT) cpuclk->clk_nb.notifier_call =3D exynos5433_cpuclk_notifier_cb; else cpuclk->clk_nb.notifier_call =3D exynos_cpuclk_notifier_cb; @@ -472,11 +475,16 @@ static int __init exynos_register_cpu_clock(struct sa= msung_clk_provider *ctx, ret =3D clk_notifier_register(parent->clk, &cpuclk->clk_nb); if (ret) { pr_err("%s: failed to register clock notifier for %s\n", - __func__, name); + __func__, clk_data->name); goto free_cpuclk; } =20 - cpuclk->cfg =3D kmemdup(cfg, sizeof(*cfg) * num_cfgs, GFP_KERNEL); + /* Find count of configuration rates in cfg */ + for (num_cfgs =3D 0; clk_data->cfg[num_cfgs].prate !=3D 0; ) + num_cfgs++; + + cpuclk->cfg =3D kmemdup(clk_data->cfg, sizeof(*clk_data->cfg) * num_cfgs, + GFP_KERNEL); if (!cpuclk->cfg) { ret =3D -ENOMEM; goto unregister_clk_nb; @@ -484,11 +492,12 @@ static int __init exynos_register_cpu_clock(struct sa= msung_clk_provider *ctx, =20 ret =3D clk_hw_register(NULL, &cpuclk->hw); if (ret) { - pr_err("%s: could not register cpuclk %s\n", __func__, name); + pr_err("%s: could not register cpuclk %s\n", __func__, + clk_data->name); goto free_cpuclk_data; } =20 - samsung_clk_add_lookup(ctx, &cpuclk->hw, lookup_id); + samsung_clk_add_lookup(ctx, &cpuclk->hw, clk_data->id); return 0; =20 free_cpuclk_data: @@ -504,16 +513,7 @@ void __init samsung_clk_register_cpu(struct samsung_cl= k_provider *ctx, const struct samsung_cpu_clock *list, unsigned int nr_clk) { unsigned int idx; - unsigned int num_cfgs; - struct clk_hw **hws =3D ctx->clk_data.hws; =20 - for (idx =3D 0; idx < nr_clk; idx++, list++) { - /* find count of configuration rates in cfg */ - for (num_cfgs =3D 0; list->cfg[num_cfgs].prate !=3D 0; ) - num_cfgs++; - - exynos_register_cpu_clock(ctx, list->id, list->name, - hws[list->parent_id], hws[list->alt_parent_id], - list->offset, list->cfg, num_cfgs, list->flags); - } + for (idx =3D 0; idx < nr_clk; idx++) + exynos_register_cpu_clock(ctx, &list[idx]); } --=20 2.39.2 From nobody Sat Feb 7 19:04:16 2026 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 135324CE05 for ; Sat, 24 Feb 2024 20:20:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806061; cv=none; b=WLXBtbWf7gf+Ql7HiWfO1vaEvI6rj05pBM+lnxLRegzLg2+IybjdGIHgk70XFRXpne2H4EeYW5zYeK+pKn/VuKKxnpVlhD66e5BViSDb/5BhSeh4yAlMlFkb7iqd8cKCqHnesr5s0pD8YUCWvvJDnlOXtYqL8pHkofpHfQre4yA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806061; c=relaxed/simple; bh=pvnFqDs1JSU1cEVxDHwI51U71SVwShMPkCS4POcJTs4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MsZfQVzlmDyMcVUBHjI5dkneg8Ri1IM1d2eyXpbDXifLXm8j/06uWvWfU2Vf8U7sKy86WtJJlTrgs03lxpM5uAer+2zI5nGBKYUq3Qm49kDk7/WBAO0nl9+gam7bL1bVYsD1htztJhdqa7jBSxtn3eELC73SkDH/wU4Ek2pmdq0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=e+OGeH4Y; arc=none smtp.client-ip=209.85.210.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="e+OGeH4Y" Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-6e4881bccc9so613164a34.2 for ; Sat, 24 Feb 2024 12:20:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708806058; x=1709410858; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bx9qLFh70CDfUDdArm+jHx7BwGkHNp7ct/rE4U3B9/k=; b=e+OGeH4Yw0D56cEfAkoFvXKXI+JokbeYfYf08e6bVg5aPTA5gUz16inWKrimeJJJoc RGT7SAUbC0DQbe/hQiy5fetnmQhbc09T2VPRxgyFcUWV0RcPWsuutL+q3xBBWWc7sim9 SUk//DmXcG9aYW4pJ5wAe1zemCjtp64DWeDLNXa1k0c5lcA8UbS/JIg/pA0j4aXhxk0v bpzV/UdzJJ9MFYwKaP8Ndq6HzEXoauFyBT+uftEoYcZKIccATjBIE8UVrWqfGIz2dV+y +Bl3kUZQlfCF01Gd+vT0vQ9aPS+pNu6kLy8x12ekZKMpFojARI6AzAmcrzw/vj2/tnXl dihw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806058; x=1709410858; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bx9qLFh70CDfUDdArm+jHx7BwGkHNp7ct/rE4U3B9/k=; b=m8bkkcoxxuRDPLoTFVxGDnV3RWjmvxXkU6IWcWXD4zuU+ogIJAWCL3OL7Uz+qtUWZH G/5yC/pSPGmo4wiCHHv/MvUPkb3unb+TR71h3t1VSj/dZdtPukzHDqvAL3gifnR577WX PulWD72MCkp8qcfWwzDBMfvzKZBSCRyDTK/+hyjzP2fLChB0nMogWBl+pCZ/7PnjlqFk j98tVrR3aej7iSXzvnfVeF9B5TUaNY0hMCpjfTYgwkqwC5DfnK8Qo4Hwjw5UwAyyQ1ll wjZ5Bkk2ulkyiO1EylkgCdq7cDbYfDC3Fdd7XLxZyIEOMdvBB6jsgFJ+vSSnAmZ0TGyx 0GCg== X-Forwarded-Encrypted: i=1; AJvYcCVXEBHxGEvQj9SVgV2tSeAtvZC9h+IszcExnnhLZQ0DPnEC2E9aJ0lxkFPD5OhjI/pMuOHrHcTuVw5sNDwnJTWCC8iLqu6mxFBH7gs5 X-Gm-Message-State: AOJu0YyBPqu4J0QVWNgQfn7bVFc0Hxejr230Awa1JdUdY6HP17Ikb0zJ LeLXe81XMb3MEtGZEx316nrixBP5YukQgAJDRDcN0mCuvrYSHh0kX5QLUzUqbwQ= X-Google-Smtp-Source: AGHT+IH2FwIcafPCKNcKZWM0pEg0g2gnbiS/4o8kp5Op6FQzlr3/IRr49wO6Hs1TcKtmZIO3obYktA== X-Received: by 2002:a05:6830:ca:b0:6e4:8f32:6863 with SMTP id x10-20020a05683000ca00b006e48f326863mr1855984oto.1.1708806058117; Sat, 24 Feb 2024 12:20:58 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id a7-20020a9d74c7000000b006e2e7cb1da2sm399737otl.66.2024.02.24.12.20.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 12:20:57 -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 05/15] clk: samsung: Use single CPU clock notifier callback for all chips Date: Sat, 24 Feb 2024 14:20:43 -0600 Message-Id: <20240224202053.25313-6-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224202053.25313-1-semen.protsenko@linaro.org> References: <20240224202053.25313-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Reduce the code duplication by making all chips use a single version of exynos_cpuclk_notifier_cb() function. That will prevent the code bloat when adding new chips support too. Also don't pass base address to pre/post rate change functions, as it can be easily derived from already passed cpuclk param. No functional change. Signed-off-by: Sam Protsenko --- Changes in v3: - none Changes in v2: - none drivers/clk/samsung/clk-cpu.c | 63 ++++++++++++++++------------------- 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index 7b6fd331a7ec..427018e8dd8c 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -66,6 +66,11 @@ #define DIV_MASK_ALL GENMASK(31, 0) #define MUX_MASK GENMASK(2, 0) =20 +struct exynos_cpuclk; + +typedef int (*exynos_rate_change_fn_t)(struct clk_notifier_data *ndata, + struct exynos_cpuclk *cpuclk); + /** * struct exynos_cpuclk - information about clock supplied to a CPU core * @hw: handle between CCF and CPU clock @@ -78,6 +83,8 @@ * @clk_nb: clock notifier registered for changes in clock speed of the * primary parent clock * @flags: configuration flags for the CPU clock + * @pre_rate_cb: callback to run before CPU clock rate change + * @post_rate_cb: callback to run after CPU clock rate change * * This structure holds information required for programming the CPU clock= for * various clock speeds. @@ -91,6 +98,9 @@ struct exynos_cpuclk { const unsigned long num_cfgs; struct notifier_block clk_nb; unsigned long flags; + + exynos_rate_change_fn_t pre_rate_cb; + exynos_rate_change_fn_t post_rate_cb; }; =20 /* @@ -178,9 +188,10 @@ static void exynos_set_safe_div(void __iomem *base, un= signed long div, =20 /* handler for pre-rate change notification from parent clock */ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata, - struct exynos_cpuclk *cpuclk, void __iomem *base) + struct exynos_cpuclk *cpuclk) { const struct exynos_cpuclk_cfg_data *cfg_data =3D cpuclk->cfg; + void __iomem *base =3D cpuclk->ctrl_base; unsigned long alt_prate =3D clk_hw_get_rate(cpuclk->alt_parent); unsigned long div0, div1 =3D 0, mux_reg; unsigned long flags; @@ -255,9 +266,10 @@ static int exynos_cpuclk_pre_rate_change(struct clk_no= tifier_data *ndata, =20 /* handler for post-rate change notification from parent clock */ static int exynos_cpuclk_post_rate_change(struct clk_notifier_data *ndata, - struct exynos_cpuclk *cpuclk, void __iomem *base) + struct exynos_cpuclk *cpuclk) { const struct exynos_cpuclk_cfg_data *cfg_data =3D cpuclk->cfg; + void __iomem *base =3D cpuclk->ctrl_base; unsigned long div =3D 0, div_mask =3D DIV_MASK; unsigned long mux_reg; unsigned long flags; @@ -306,9 +318,10 @@ static void exynos5433_set_safe_div(void __iomem *base= , unsigned long div, =20 /* handler for pre-rate change notification from parent clock */ static int exynos5433_cpuclk_pre_rate_change(struct clk_notifier_data *nda= ta, - struct exynos_cpuclk *cpuclk, void __iomem *base) + struct exynos_cpuclk *cpuclk) { const struct exynos_cpuclk_cfg_data *cfg_data =3D cpuclk->cfg; + void __iomem *base =3D cpuclk->ctrl_base; unsigned long alt_prate =3D clk_hw_get_rate(cpuclk->alt_parent); unsigned long div0, div1 =3D 0, mux_reg; unsigned long flags; @@ -366,8 +379,9 @@ static int exynos5433_cpuclk_pre_rate_change(struct clk= _notifier_data *ndata, =20 /* handler for post-rate change notification from parent clock */ static int exynos5433_cpuclk_post_rate_change(struct clk_notifier_data *nd= ata, - struct exynos_cpuclk *cpuclk, void __iomem *base) + struct exynos_cpuclk *cpuclk) { + void __iomem *base =3D cpuclk->ctrl_base; unsigned long div =3D 0, div_mask =3D DIV_MASK; unsigned long mux_reg; unsigned long flags; @@ -393,39 +407,14 @@ static int exynos_cpuclk_notifier_cb(struct notifier_= block *nb, { struct clk_notifier_data *ndata =3D data; struct exynos_cpuclk *cpuclk; - void __iomem *base; int err =3D 0; =20 cpuclk =3D container_of(nb, struct exynos_cpuclk, clk_nb); - base =3D cpuclk->ctrl_base; =20 if (event =3D=3D PRE_RATE_CHANGE) - err =3D exynos_cpuclk_pre_rate_change(ndata, cpuclk, base); + err =3D cpuclk->pre_rate_cb(ndata, cpuclk); else if (event =3D=3D POST_RATE_CHANGE) - err =3D exynos_cpuclk_post_rate_change(ndata, cpuclk, base); - - return notifier_from_errno(err); -} - -/* - * This notifier function is called for the pre-rate and post-rate change - * notifications of the parent clock of cpuclk. - */ -static int exynos5433_cpuclk_notifier_cb(struct notifier_block *nb, - unsigned long event, void *data) -{ - struct clk_notifier_data *ndata =3D data; - struct exynos_cpuclk *cpuclk; - void __iomem *base; - int err =3D 0; - - cpuclk =3D container_of(nb, struct exynos_cpuclk, clk_nb); - base =3D cpuclk->ctrl_base; - - if (event =3D=3D PRE_RATE_CHANGE) - err =3D exynos5433_cpuclk_pre_rate_change(ndata, cpuclk, base); - else if (event =3D=3D POST_RATE_CHANGE) - err =3D exynos5433_cpuclk_post_rate_change(ndata, cpuclk, base); + err =3D cpuclk->post_rate_cb(ndata, cpuclk); =20 return notifier_from_errno(err); } @@ -467,10 +456,14 @@ static int __init exynos_register_cpu_clock(struct sa= msung_clk_provider *ctx, cpuclk->ctrl_base =3D ctx->reg_base + clk_data->offset; cpuclk->lock =3D &ctx->lock; cpuclk->flags =3D clk_data->flags; - if (clk_data->flags & CLK_CPU_HAS_E5433_REGS_LAYOUT) - cpuclk->clk_nb.notifier_call =3D exynos5433_cpuclk_notifier_cb; - else - cpuclk->clk_nb.notifier_call =3D exynos_cpuclk_notifier_cb; + cpuclk->clk_nb.notifier_call =3D exynos_cpuclk_notifier_cb; + if (clk_data->flags & CLK_CPU_HAS_E5433_REGS_LAYOUT) { + cpuclk->pre_rate_cb =3D exynos5433_cpuclk_pre_rate_change; + cpuclk->post_rate_cb =3D exynos5433_cpuclk_post_rate_change; + } else { + cpuclk->pre_rate_cb =3D exynos_cpuclk_pre_rate_change; + cpuclk->post_rate_cb =3D exynos_cpuclk_post_rate_change; + } =20 ret =3D clk_notifier_register(parent->clk, &cpuclk->clk_nb); if (ret) { --=20 2.39.2 From nobody Sat Feb 7 19:04:16 2026 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EC404DA00 for ; Sat, 24 Feb 2024 20:20:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806061; cv=none; b=rxLspSlnXiskdi5N89z45jvHIzieg2uNb3PV+qN6AyyoQYRnXsmnxa0JDwVs732IJNL8KJW4Phv0OeVbC02HiUJ2mIgW31OJnuR8J5F3jfRjJklQxisVX9gfGSfA0+RkPZV46d5hcVGtwK3XDDcKe1Pf041HHK/ZltPnWAt4Pzk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806061; c=relaxed/simple; bh=o9Zqm0zN7ru0KQhZAunuI4IVxeZK+2pqeaTp3HSRgQc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=o8RUA/r2SUGiFJ66C4YHbWEo+C1bnnyylqMsVHXqIiXvx4yiO2jnxTSb5Tpgs4O1xrKHhyNX3L2Kmh2Tgihmqv7aIbclbfA0ylmT9cHmQBIIUXXNQC4CT8VebwuBMi6hDPylWPngxnmgCzkU91bQ/cu0ZayXSb1wY9mOQ2xVA0I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=SYiBpzcw; arc=none smtp.client-ip=209.85.210.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SYiBpzcw" Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-6e2d83d2568so1539645a34.3 for ; Sat, 24 Feb 2024 12:20:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708806059; x=1709410859; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KTnWrXz3JStivRTMwgchBq3jLcy8rn1qjS1DxI64urA=; b=SYiBpzcw2NSf26w7gKLXqv+pu3VMQk0LlLKshUWDepSOcvTv0VLG0G90NOwWunuzrB EIf8z/+33zV8Sh5mNiIQxaz90kVFGAsdUOpLXqfonsUHJRXWR1HOKFmFWO9iUCISHLI0 tn8h+gFb8QIQOrK9kHP/Ldpge2xRmAQAOqTicRI3V7MirEPPImOC7JJDZUtlOdwpwKPq gvXszVmFKkWTP8e5gifP2rphylbdcf8q30wQfth+spdq1VQHJpPoaZsSsIGHLcdp4TDM 6e/19sP6GYrFyaqzqFYmuqcjG+eyk+YDXckQ9/PIVcHhj0W6PAXzQgCoXZKSG91+VSga D3Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806059; x=1709410859; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KTnWrXz3JStivRTMwgchBq3jLcy8rn1qjS1DxI64urA=; b=ZdcCjIq/pHcSG5fcaVKtUh1+sZyEf4eX9MbrYGNcYRi/JFh8nWyQolXH8XB9mYed0I oWMqg8zu2DhPfGvOiX6yID9nWgliI+kYMaoyakfa4FUQCPuHxCe9SDloPYi4GSeAbXQZ M54pIN+bPWjLIx+PgqeYkKV8Mb32tvuVAkf7tQhIub3YzrCbhopjp9JmrnIqxqGl96DY TuI8oxA94xmCjOgFVGNPbt5PhuWd2VRJbLq+AGaLLKeMXgfcKGjOtYBN6gkLmQaUAMwZ RRSq1UU2KtfNeGKbEJyxCLdx7mmBoR7T86Fy4P7Hi6QKMzSPRV98sDeB0bJUH3PDN+mO Hg/w== X-Forwarded-Encrypted: i=1; AJvYcCXebA+A/m/IMud2SVPJeYHuU344GfBpQfX2m2O9LD0+QAvhPTqFK5/YT26Lkti2Y0Np5HOAZmW76g9soBm8A/Nc27ql3F0kkZZbXfVp X-Gm-Message-State: AOJu0YxftCak6bbGfIUOlf0i1eauLMt3EgN271/biG26/W/rprfuxjrf Qs30Z/8d2mhW307ZxeOb1FPRMaoi/1L86xUKvoUxl+92715Xmc53jvBPsdxZwPOovxYWvMlsAf6 Qc9MZUg== X-Google-Smtp-Source: AGHT+IHQyDwYG0Qz3gRPSUL6cqsj6KSr4ZKcxwVbzzFz3AteQUa82s3zvA1tcEd8ouz7/xjNb6SSAw== X-Received: by 2002:a05:6870:2112:b0:21d:e28a:fb14 with SMTP id f18-20020a056870211200b0021de28afb14mr3709363oae.47.1708806058911; Sat, 24 Feb 2024 12:20:58 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id h16-20020a056808015000b003c178f6a504sm393647oie.14.2024.02.24.12.20.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 12:20:58 -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 06/15] clk: samsung: Group CPU clock functions by chip Date: Sat, 24 Feb 2024 14:20:44 -0600 Message-Id: <20240224202053.25313-7-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224202053.25313-1-semen.protsenko@linaro.org> References: <20240224202053.25313-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" clk-cpu.c is going to get messy as new chips support is added. Restructure the code by pulling related functions and definitions together, grouping those by their relation to a particular chip or other categories, to simplify the code navigation. No functional change. Signed-off-by: Sam Protsenko --- Changes in v3: - none Changes in v2: - none drivers/clk/samsung/clk-cpu.c | 114 ++++++++++++++++++---------------- 1 file changed, 61 insertions(+), 53 deletions(-) diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index 427018e8dd8c..d550a4bb632f 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -38,34 +38,6 @@ #include "clk.h" #include "clk-cpu.h" =20 -#define E4210_SRC_CPU 0x0 -#define E4210_STAT_CPU 0x200 -#define E4210_DIV_CPU0 0x300 -#define E4210_DIV_CPU1 0x304 -#define E4210_DIV_STAT_CPU0 0x400 -#define E4210_DIV_STAT_CPU1 0x404 - -#define E5433_MUX_SEL2 0x008 -#define E5433_MUX_STAT2 0x208 -#define E5433_DIV_CPU0 0x400 -#define E5433_DIV_CPU1 0x404 -#define E5433_DIV_STAT_CPU0 0x500 -#define E5433_DIV_STAT_CPU1 0x504 - -#define E4210_DIV0_RATIO0_MASK GENMASK(2, 0) -#define E4210_DIV1_HPM_MASK GENMASK(6, 4) -#define E4210_DIV1_COPY_MASK GENMASK(2, 0) -#define E4210_MUX_HPM_MASK BIT(20) -#define E4210_DIV0_ATB_SHIFT 16 -#define E4210_DIV0_ATB_MASK (DIV_MASK << E4210_DIV0_ATB_SHIFT) - -/* Divider stabilization time, msec */ -#define MAX_STAB_TIME 10 -#define MAX_DIV 8 -#define DIV_MASK GENMASK(2, 0) -#define DIV_MASK_ALL GENMASK(31, 0) -#define MUX_MASK GENMASK(2, 0) - struct exynos_cpuclk; =20 typedef int (*exynos_rate_change_fn_t)(struct clk_notifier_data *ndata, @@ -103,6 +75,15 @@ struct exynos_cpuclk { exynos_rate_change_fn_t post_rate_cb; }; =20 +/* ---- Common code ------------------------------------------------------= --- */ + +/* Divider stabilization time, msec */ +#define MAX_STAB_TIME 10 +#define MAX_DIV 8 +#define DIV_MASK GENMASK(2, 0) +#define DIV_MASK_ALL GENMASK(31, 0) +#define MUX_MASK GENMASK(2, 0) + /* * Helper function to wait until divider(s) have stabilized after the divi= der * value has changed. @@ -142,33 +123,21 @@ static void wait_until_mux_stable(void __iomem *mux_r= eg, u32 mux_pos, pr_err("%s: re-parenting mux timed-out\n", __func__); } =20 -/* common round rate callback usable for all types of CPU clocks */ -static long exynos_cpuclk_round_rate(struct clk_hw *hw, unsigned long drat= e, - unsigned long *prate) -{ - struct clk_hw *parent =3D clk_hw_get_parent(hw); - *prate =3D clk_hw_round_rate(parent, drate); - return *prate; -} +/* ---- Exynos 3/4/5 -----------------------------------------------------= --- */ =20 -/* common recalc rate callback usable for all types of CPU clocks */ -static unsigned long exynos_cpuclk_recalc_rate(struct clk_hw *hw, - unsigned long parent_rate) -{ - /* - * The CPU clock output (armclk) rate is the same as its parent - * rate. Although there exist certain dividers inside the CPU - * clock block that could be used to divide the parent clock, - * the driver does not make use of them currently, except during - * frequency transitions. - */ - return parent_rate; -} +#define E4210_SRC_CPU 0x0 +#define E4210_STAT_CPU 0x200 +#define E4210_DIV_CPU0 0x300 +#define E4210_DIV_CPU1 0x304 +#define E4210_DIV_STAT_CPU0 0x400 +#define E4210_DIV_STAT_CPU1 0x404 =20 -static const struct clk_ops exynos_cpuclk_clk_ops =3D { - .recalc_rate =3D exynos_cpuclk_recalc_rate, - .round_rate =3D exynos_cpuclk_round_rate, -}; +#define E4210_DIV0_RATIO0_MASK GENMASK(2, 0) +#define E4210_DIV1_HPM_MASK GENMASK(6, 4) +#define E4210_DIV1_COPY_MASK GENMASK(2, 0) +#define E4210_MUX_HPM_MASK BIT(20) +#define E4210_DIV0_ATB_SHIFT 16 +#define E4210_DIV0_ATB_MASK (DIV_MASK << E4210_DIV0_ATB_SHIFT) =20 /* * Helper function to set the 'safe' dividers for the CPU clock. The param= eters @@ -300,6 +269,15 @@ static int exynos_cpuclk_post_rate_change(struct clk_n= otifier_data *ndata, return 0; } =20 +/* ---- Exynos5433 -------------------------------------------------------= --- */ + +#define E5433_MUX_SEL2 0x008 +#define E5433_MUX_STAT2 0x208 +#define E5433_DIV_CPU0 0x400 +#define E5433_DIV_CPU1 0x404 +#define E5433_DIV_STAT_CPU0 0x500 +#define E5433_DIV_STAT_CPU1 0x504 + /* * Helper function to set the 'safe' dividers for the CPU clock. The param= eters * div and mask contain the divider value and the register bit mask of the @@ -398,6 +376,36 @@ static int exynos5433_cpuclk_post_rate_change(struct c= lk_notifier_data *ndata, return 0; } =20 +/* -----------------------------------------------------------------------= --- */ + +/* Common round rate callback usable for all types of CPU clocks */ +static long exynos_cpuclk_round_rate(struct clk_hw *hw, unsigned long drat= e, + unsigned long *prate) +{ + struct clk_hw *parent =3D clk_hw_get_parent(hw); + *prate =3D clk_hw_round_rate(parent, drate); + return *prate; +} + +/* Common recalc rate callback usable for all types of CPU clocks */ +static unsigned long exynos_cpuclk_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + /* + * The CPU clock output (armclk) rate is the same as its parent + * rate. Although there exist certain dividers inside the CPU + * clock block that could be used to divide the parent clock, + * the driver does not make use of them currently, except during + * frequency transitions. + */ + return parent_rate; +} + +static const struct clk_ops exynos_cpuclk_clk_ops =3D { + .recalc_rate =3D exynos_cpuclk_recalc_rate, + .round_rate =3D exynos_cpuclk_round_rate, +}; + /* * This notifier function is called for the pre-rate and post-rate change * notifications of the parent clock of cpuclk. --=20 2.39.2 From nobody Sat Feb 7 19:04:16 2026 Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B90924E1CA for ; Sat, 24 Feb 2024 20:21:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806063; cv=none; b=UQBVeh9wqRze9U6kzroqsas6Ydlzs/r9g1ClknXPJ9tmQ7sf+V0x7jRB616mltuSx9Pu46TIOGUEpw76F5v8o/JthKtZSm6sbOGbS33f1U//M1soZt8vJCcdiub6CrOmGSOwWi033I/KqjZ5Jwxs+JyY7BDntiw4A4aJlTEECNc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806063; c=relaxed/simple; bh=u5e/xru5KQ8TgtFLyzjDISb/KYM+XpEMO0hxy8y7HBo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=U6T8FFl468rDgNZtpS/QUW2Oj/aj1zro7221quZWMpseTQdtf2kOfqWOODcnt3r0/6CHwR+u0JJfd3wrvKsQMZvUZ6lrWngujMa/HsDz/qcMF/oprTgD9tg34FJT+fVD1M2ux+mpQf+H71ecsfzVDaX7n+cohvuL4WJqd8wAQnk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=bmA+eXTk; arc=none smtp.client-ip=209.85.167.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bmA+eXTk" Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3bbc649c275so1179549b6e.0 for ; Sat, 24 Feb 2024 12:21:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708806059; x=1709410859; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XjHY+LeTW+KnH1y9XJoOarQqtNcWlU5y9fOQzKMZUcg=; b=bmA+eXTkH4xUXc5xzujYbs8b6oHE7hB5pphjOxtLiuLyWJOUxPgK2fnuebSzjvOy3T OZs0u2ta+n+AlW5DLV9/nwXWCAVDDlL1pqJjQ+Jpmovywt2gyzZTab/2Tpp0L/ZjZcLh /gxKlqnQW6x5x9vL/r1oNUMQ2vRR1lSoyEQKwk/tAkrMcTMeyJ/Kl4u/B5rJvDYJTP+n lQArl+n2dHoWSseV3hjSq8tmWuD0ErNwwZkFELyEJ2jwHikxawqmLMDvEtWJIG/zNFJg ruAGI1zsVPJ0aBdszOZ2wKe/tFms7JejleTZDMmrAedwEp06FlSnRwJjushW5YS4pNKp APvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806059; x=1709410859; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XjHY+LeTW+KnH1y9XJoOarQqtNcWlU5y9fOQzKMZUcg=; b=twhqIYqKfxUlnfERN503g+V50Ff1+OB89PLC6HhDhS6SsTYbLkAFoCSdgONRletWro q+CFY2cnk2E8Sq8pPApyZvYu2m8XFqbxdt+uPMgn3gCNkZnby5dPDeEA0GxxR+4UqxAj 2ro4/+xXc87nW8yxfG6uV3wRsR8kcbpy55e7Rhtehp8SiPQxBpwMMim5m6hQeal4hIWi yvUatpUBL+/kuFZKPjT2XlWVRS2vtxiSxYrD/sEN+05IVMvNFts47mnoc0lmAcqcex+4 o3KMCr6ce7oFLdv7bQ55lFtI+D9npUd0rF+rlN1szziIE1PYs8hQJiXS2DPQFTdGE1kH AIow== X-Forwarded-Encrypted: i=1; AJvYcCW9jJITwipcJkk1ny/5Z2VNudZQs6zq15IVfxvs+7oBAIoHJmMOSAbxWtRVx8j5xUXviH2x012ydf8DchfM3B/f4CDwpizJFviuFn4q X-Gm-Message-State: AOJu0YwpeWQeADX9PhZVHEdFxOrzaySlQzr0Pra+9jbO28p8xdRSGmb/ mRBNQ4LFuIoeS/ZT5g/eicZuaGZf1mxiBMJwLz4IhQgBiPVXlnB2/PYTQfXl8Pc= X-Google-Smtp-Source: AGHT+IEwI6OK8WVCS1b7MMABsfhdOvcpe0B33DhpjfkxQpBjowZA8STFgPmu1CwTM1Jct8GlKPbwTA== X-Received: by 2002:a05:6808:120a:b0:3c1:83c3:969b with SMTP id a10-20020a056808120a00b003c183c3969bmr2857773oil.53.1708806059623; Sat, 24 Feb 2024 12:20:59 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id e15-20020a056808148f00b003c18039f8bbsm377925oiw.54.2024.02.24.12.20.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 12:20:59 -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 07/15] clk: samsung: Pass actual CPU clock registers base to CPU_CLK() Date: Sat, 24 Feb 2024 14:20:45 -0600 Message-Id: <20240224202053.25313-8-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224202053.25313-1-semen.protsenko@linaro.org> References: <20240224202053.25313-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The documentation for struct exynos_cpuclk says .ctrl_base field should contain the controller base address. There are two different problems with that: 1. All Exynos clock drivers are actually passing CPU_SRC register offset via CPU_CLK() macro, which in turn gets assigned to mentioned .ctrl_base field. Because CPU_SRC register usually already has 0x200 offset from controller's base, all other register offsets in clk-cpu.c (like DIVs and MUXes) are specified as offsets from CPU_SRC offset, and not from controller's base. That makes things confusing and inconsistent with register offsets provided in Exynos clock drivers, also breaking the contract for .ctrl_base field as described in struct exynos_cpuclk doc. 2. Furthermore, some Exynos chips have an additional offset for the start of CPU clock registers block (inside of the CMU). There might be different reasons for that, e.g.: - The CMU contains clocks for two different CPUs (like in Exynos5420) - The CMU contains also non-CPU clocks as well (like in Exynos4) - The CPU CMU exists as a dedicated hardware block in the SoC layout, but is modelled as a part of bigger CMU in the driver (like in case of Exynos3250) That means the .ctrl_base field is actually not a controller's base, but instead it's a start address of the CPU clock registers inside of the CMU. Rework all register offsets in clk-cpu.c to be actual offsets from the CPU clock register block start, and fix offsets provided to CPU_CLK() macro in all Exynos clock drivers. Also clarify the .ctrl_base field documentation and rename it to just .base, because it doesn't really contain the CMU base. No functional change. Signed-off-by: Sam Protsenko --- Changes in v3: - none Changes in v2: - Renamed .ctrl_base field to .base and fixed its documentation - Fixed typo in commit message: Exynis -> Exynos - Improved the commit message: mentioned that .ctrl_base is actually a start address of the CPU clock register block, not the CMU base drivers/clk/samsung/clk-cpu.c | 38 ++++++++++++++-------------- drivers/clk/samsung/clk-exynos3250.c | 2 +- drivers/clk/samsung/clk-exynos4.c | 9 ++++--- drivers/clk/samsung/clk-exynos5250.c | 4 +-- drivers/clk/samsung/clk-exynos5420.c | 16 ++++++------ drivers/clk/samsung/clk-exynos5433.c | 10 +++----- 6 files changed, 40 insertions(+), 39 deletions(-) diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index d550a4bb632f..82d54b0c9040 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -48,7 +48,7 @@ typedef int (*exynos_rate_change_fn_t)(struct clk_notifie= r_data *ndata, * @hw: handle between CCF and CPU clock * @alt_parent: alternate parent clock to use when switching the speed * of the primary parent clock - * @ctrl_base: base address of the clock controller + * @base: start address of the CPU clock registers block * @lock: cpu clock domain register access lock * @cfg: cpu clock rate configuration data * @num_cfgs: number of array elements in @cfg array @@ -64,7 +64,7 @@ typedef int (*exynos_rate_change_fn_t)(struct clk_notifie= r_data *ndata, struct exynos_cpuclk { struct clk_hw hw; const struct clk_hw *alt_parent; - void __iomem *ctrl_base; + void __iomem *base; spinlock_t *lock; const struct exynos_cpuclk_cfg_data *cfg; const unsigned long num_cfgs; @@ -125,12 +125,12 @@ static void wait_until_mux_stable(void __iomem *mux_r= eg, u32 mux_pos, =20 /* ---- Exynos 3/4/5 -----------------------------------------------------= --- */ =20 -#define E4210_SRC_CPU 0x0 -#define E4210_STAT_CPU 0x200 -#define E4210_DIV_CPU0 0x300 -#define E4210_DIV_CPU1 0x304 -#define E4210_DIV_STAT_CPU0 0x400 -#define E4210_DIV_STAT_CPU1 0x404 +#define E4210_SRC_CPU 0x200 +#define E4210_STAT_CPU 0x400 +#define E4210_DIV_CPU0 0x500 +#define E4210_DIV_CPU1 0x504 +#define E4210_DIV_STAT_CPU0 0x600 +#define E4210_DIV_STAT_CPU1 0x604 =20 #define E4210_DIV0_RATIO0_MASK GENMASK(2, 0) #define E4210_DIV1_HPM_MASK GENMASK(6, 4) @@ -160,7 +160,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_not= ifier_data *ndata, struct exynos_cpuclk *cpuclk) { const struct exynos_cpuclk_cfg_data *cfg_data =3D cpuclk->cfg; - void __iomem *base =3D cpuclk->ctrl_base; + void __iomem *base =3D cpuclk->base; unsigned long alt_prate =3D clk_hw_get_rate(cpuclk->alt_parent); unsigned long div0, div1 =3D 0, mux_reg; unsigned long flags; @@ -238,7 +238,7 @@ static int exynos_cpuclk_post_rate_change(struct clk_no= tifier_data *ndata, struct exynos_cpuclk *cpuclk) { const struct exynos_cpuclk_cfg_data *cfg_data =3D cpuclk->cfg; - void __iomem *base =3D cpuclk->ctrl_base; + void __iomem *base =3D cpuclk->base; unsigned long div =3D 0, div_mask =3D DIV_MASK; unsigned long mux_reg; unsigned long flags; @@ -271,12 +271,12 @@ static int exynos_cpuclk_post_rate_change(struct clk_= notifier_data *ndata, =20 /* ---- Exynos5433 -------------------------------------------------------= --- */ =20 -#define E5433_MUX_SEL2 0x008 -#define E5433_MUX_STAT2 0x208 -#define E5433_DIV_CPU0 0x400 -#define E5433_DIV_CPU1 0x404 -#define E5433_DIV_STAT_CPU0 0x500 -#define E5433_DIV_STAT_CPU1 0x504 +#define E5433_MUX_SEL2 0x208 +#define E5433_MUX_STAT2 0x408 +#define E5433_DIV_CPU0 0x600 +#define E5433_DIV_CPU1 0x604 +#define E5433_DIV_STAT_CPU0 0x700 +#define E5433_DIV_STAT_CPU1 0x704 =20 /* * Helper function to set the 'safe' dividers for the CPU clock. The param= eters @@ -299,7 +299,7 @@ static int exynos5433_cpuclk_pre_rate_change(struct clk= _notifier_data *ndata, struct exynos_cpuclk *cpuclk) { const struct exynos_cpuclk_cfg_data *cfg_data =3D cpuclk->cfg; - void __iomem *base =3D cpuclk->ctrl_base; + void __iomem *base =3D cpuclk->base; unsigned long alt_prate =3D clk_hw_get_rate(cpuclk->alt_parent); unsigned long div0, div1 =3D 0, mux_reg; unsigned long flags; @@ -359,7 +359,7 @@ static int exynos5433_cpuclk_pre_rate_change(struct clk= _notifier_data *ndata, static int exynos5433_cpuclk_post_rate_change(struct clk_notifier_data *nd= ata, struct exynos_cpuclk *cpuclk) { - void __iomem *base =3D cpuclk->ctrl_base; + void __iomem *base =3D cpuclk->base; unsigned long div =3D 0, div_mask =3D DIV_MASK; unsigned long mux_reg; unsigned long flags; @@ -461,7 +461,7 @@ static int __init exynos_register_cpu_clock(struct sams= ung_clk_provider *ctx, =20 cpuclk->alt_parent =3D alt_parent; cpuclk->hw.init =3D &init; - cpuclk->ctrl_base =3D ctx->reg_base + clk_data->offset; + cpuclk->base =3D ctx->reg_base + clk_data->offset; cpuclk->lock =3D &ctx->lock; cpuclk->flags =3D clk_data->flags; cpuclk->clk_nb.notifier_call =3D exynos_cpuclk_notifier_cb; diff --git a/drivers/clk/samsung/clk-exynos3250.c b/drivers/clk/samsung/clk= -exynos3250.c index a02461667664..bf149fae04c3 100644 --- a/drivers/clk/samsung/clk-exynos3250.c +++ b/drivers/clk/samsung/clk-exynos3250.c @@ -775,7 +775,7 @@ static const struct exynos_cpuclk_cfg_data e3250_armclk= _d[] __initconst =3D { =20 static const struct samsung_cpu_clock exynos3250_cpu_clks[] __initconst = =3D { CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MPLL_USER_C, - CLK_CPU_HAS_DIV1, 0x14200, e3250_armclk_d), + CLK_CPU_HAS_DIV1, 0x14000, e3250_armclk_d), }; =20 static void __init exynos3_core_down_clock(void __iomem *reg_base) diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-ex= ynos4.c index 4ec41221e68f..d5b1e9f49d8b 100644 --- a/drivers/clk/samsung/clk-exynos4.c +++ b/drivers/clk/samsung/clk-exynos4.c @@ -1252,17 +1252,20 @@ static const struct exynos_cpuclk_cfg_data e4412_ar= mclk_d[] __initconst =3D { =20 static const struct samsung_cpu_clock exynos4210_cpu_clks[] __initconst = =3D { CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_SCLK_MPLL, - CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1, 0x14200, e4210_armclk_d= ), + CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1, 0x14000, + e4210_armclk_d), }; =20 static const struct samsung_cpu_clock exynos4212_cpu_clks[] __initconst = =3D { CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MPLL_USER_C, - CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1, 0x14200, e4212_armclk_d), + CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1, 0x14000, + e4212_armclk_d), }; =20 static const struct samsung_cpu_clock exynos4412_cpu_clks[] __initconst = =3D { CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MPLL_USER_C, - CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1, 0x14200, e4412_armclk_d= ), + CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1, 0x14000, + e4412_armclk_d), }; =20 /* register exynos4 clocks */ diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk= -exynos5250.c index 8ebe6155d8b7..58df80de52ef 100644 --- a/drivers/clk/samsung/clk-exynos5250.c +++ b/drivers/clk/samsung/clk-exynos5250.c @@ -776,8 +776,8 @@ static const struct exynos_cpuclk_cfg_data exynos5250_a= rmclk_d[] __initconst =3D { }; =20 static const struct samsung_cpu_clock exynos5250_cpu_clks[] __initconst = =3D { - CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MPLL, CLK_CPU_HAS_= DIV1, 0x200, - exynos5250_armclk_d), + CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MPLL, + CLK_CPU_HAS_DIV1, 0x0, exynos5250_armclk_d), }; =20 static const struct of_device_id ext_clk_match[] __initconst =3D { diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk= -exynos5420.c index 199843f12ae5..bd7b304d2c00 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c @@ -1555,17 +1555,17 @@ static const struct exynos_cpuclk_cfg_data exynos54= 20_kfcclk_d[] __initconst =3D { }; =20 static const struct samsung_cpu_clock exynos5420_cpu_clks[] __initconst = =3D { - CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MSPLL_CPU, 0, 0x20= 0, - exynos5420_eglclk_d), - CPU_CLK(CLK_KFC_CLK, "kfcclk", CLK_MOUT_KPLL, CLK_MOUT_MSPLL_KFC, 0, 0x28= 200, - exynos5420_kfcclk_d), + CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MSPLL_CPU, 0, + 0x0, exynos5420_eglclk_d), + CPU_CLK(CLK_KFC_CLK, "kfcclk", CLK_MOUT_KPLL, CLK_MOUT_MSPLL_KFC, 0, + 0x28000, exynos5420_kfcclk_d), }; =20 static const struct samsung_cpu_clock exynos5800_cpu_clks[] __initconst = =3D { - CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MSPLL_CPU, 0, 0x20= 0, - exynos5800_eglclk_d), - CPU_CLK(CLK_KFC_CLK, "kfcclk", CLK_MOUT_KPLL, CLK_MOUT_MSPLL_KFC, 0, 0x28= 200, - exynos5420_kfcclk_d), + CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MSPLL_CPU, 0, + 0x0, exynos5800_eglclk_d), + CPU_CLK(CLK_KFC_CLK, "kfcclk", CLK_MOUT_KPLL, CLK_MOUT_MSPLL_KFC, 0, + 0x28000, exynos5420_kfcclk_d), }; =20 static const struct of_device_id ext_clk_match[] __initconst =3D { diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk= -exynos5433.c index 6bfc5d0cd924..d3779eefb438 100644 --- a/drivers/clk/samsung/clk-exynos5433.c +++ b/drivers/clk/samsung/clk-exynos5433.c @@ -3700,9 +3700,8 @@ static const struct exynos_cpuclk_cfg_data exynos5433= _apolloclk_d[] __initconst =20 static const struct samsung_cpu_clock apollo_cpu_clks[] __initconst =3D { CPU_CLK(CLK_SCLK_APOLLO, "apolloclk", CLK_MOUT_APOLLO_PLL, - CLK_MOUT_BUS_PLL_APOLLO_USER, - CLK_CPU_HAS_E5433_REGS_LAYOUT, 0x200, - exynos5433_apolloclk_d), + CLK_MOUT_BUS_PLL_APOLLO_USER, CLK_CPU_HAS_E5433_REGS_LAYOUT, + 0x0, exynos5433_apolloclk_d), }; =20 static const struct samsung_cmu_info apollo_cmu_info __initconst =3D { @@ -3945,9 +3944,8 @@ static const struct exynos_cpuclk_cfg_data exynos5433= _atlasclk_d[] __initconst =3D =20 static const struct samsung_cpu_clock atlas_cpu_clks[] __initconst =3D { CPU_CLK(CLK_SCLK_ATLAS, "atlasclk", CLK_MOUT_ATLAS_PLL, - CLK_MOUT_BUS_PLL_ATLAS_USER, - CLK_CPU_HAS_E5433_REGS_LAYOUT, 0x200, - exynos5433_atlasclk_d), + CLK_MOUT_BUS_PLL_ATLAS_USER, CLK_CPU_HAS_E5433_REGS_LAYOUT, + 0x0, exynos5433_atlasclk_d), }; =20 static const struct samsung_cmu_info atlas_cmu_info __initconst =3D { --=20 2.39.2 From nobody Sat Feb 7 19:04:16 2026 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D85A4EB31 for ; Sat, 24 Feb 2024 20:21:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806063; cv=none; b=NKWTvzylNOf1daQkhgBf6MxJCkuhtcQxNBiyj7jaNpBBQ77fb9m79flBWckbvINn3dkxHSN6FKyzclTi3c3V5+nKfOwjcNryMgFBn6ktI5V/QsFC/rIGDvOgEr69pBVUYosWHBCAjv3oVNClm0L3ZeqvGrQIinoHd8nv0VrEws4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806063; c=relaxed/simple; bh=I96YKQZ0t11s5RcnJ7tAugdVcbAQ7md0ZCeNUli1r4I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=G6IpSxB8xdRvwucymil7iRzF20n6Z+cCT4f8YJwVHjY8P/AgoJtTeJSyxzWrU/1rdEeSlytb0wsUW8wAX4cmfOHQL8ptAkqTeA1QbhEURLs1C1beZJifuA06ctJWrqcNoayw+jHzTf2envRJNsQSeeeY3Y6UHq+43/52zpKs/Mo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=iSblJGud; arc=none smtp.client-ip=209.85.210.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="iSblJGud" Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-6ddca59e336so1161220a34.0 for ; Sat, 24 Feb 2024 12:21:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708806060; x=1709410860; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SN1Kh7lkVcTMYZwGXce81ohJ7U1I8Dudo/Chcw5aFyA=; b=iSblJGudqQLz+pr9Jid/1rLz5TCF3rlDVG0KlB3eHF0aQ1iIsWibR+HhTaWNI+sqZZ GTe2OjSWkwU8Rg9qgVyfwGvKTGSlr7Uv70JrtkoxFxATGnIb9iJqMeXRcxm/pNMoq6r0 L2DVGRkgshoWP1lWpLgCwOxzVT2VjaE+ybrRvgObHWuvqDl+3f9y5YGtPnxCxmB2AfhP qeqvvXQqAXYHzyZq4wLE8ZwqQAAoRJxFSgEnsNp4mMEWzm3rkVwjbV9wv08mpgFND6Vf tHXpen4fmD4iJtz9eYuBogJlmj2dtc2kW4j6mb7td/+wCPxxcEFsuepcjy38IS76xbKV HXow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806060; x=1709410860; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SN1Kh7lkVcTMYZwGXce81ohJ7U1I8Dudo/Chcw5aFyA=; b=DRiWO015ZZXj2siCzhyCtS211Qx9JNTd8+XEUt1dZeyOJrWPRHDHwlI6deEZKM7xki hWKhkGg/rTqYsddNTyxGncmfoo2L/hPbakY1IC1AC2Q6c/qX2AZN6f7/zZLIWTRQXG34 mofGfVBXg2ZDS1d+NzkfM04nCVll8yC9AUVgOpKJLqij7SIHg49ryjzKe3/knAZMtlGr ZJj9ZEO466f+6aZXBVwg1nmkPNsLOwavkjeTEis5L3WG6byH4S8BHv2KhlkPFC/yE5DL ysdsnFDxbeifBiXlo0EEBbn4roQSxxOez5Ou3lXQwuxzmh8dtx8vlSHYYnjdITMXyfdd ZaAg== X-Forwarded-Encrypted: i=1; AJvYcCX9TdctAgKewNPov+B9ctNYkYbnN9uN0WJWuLwrS5cXpQ/lQ1c33YUEIsic9M+9rfM7R1F573ljvNx7/ngpvTkYQqHApcROsjhAyei0 X-Gm-Message-State: AOJu0YzTtIn7+3tOrS6jTzN/P+vjX+QZTwxEERdK++v4LPh8Qjv9et7g bdbfkQFKbf1s7PdCAVc4A3D+gSIzmuFA3S+5dDaPcPeokHgTxgzLYEpUAWOaVMM= X-Google-Smtp-Source: AGHT+IEz2nKgRQ9jmPgb6eGrJTYZq8wl+MRzc4F4C82P4mDY8vrW/3HpQ7g4fCKZ2KsTzDll2O7eFw== X-Received: by 2002:a05:6830:15:b0:6e2:dc35:fd1b with SMTP id c21-20020a056830001500b006e2dc35fd1bmr1386212otp.11.1708806060372; Sat, 24 Feb 2024 12:21:00 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id s24-20020a056830149800b006e48e98c0d0sm384424otq.35.2024.02.24.12.20.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 12:21:00 -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 08/15] clk: samsung: Pass register layout type explicitly to CLK_CPU() Date: Sat, 24 Feb 2024 14:20:46 -0600 Message-Id: <20240224202053.25313-9-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224202053.25313-1-semen.protsenko@linaro.org> References: <20240224202053.25313-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use a dedicated enum field to explicitly specify which register layout should be used for the CPU clock, instead of passing it as a bit flag. This way it would be possible to keep the chip-specific data in some array, where each chip structure could be accessed by its corresponding layout index. It prepares clk-cpu.c for adding new chips support, which might have different data for different CPU clusters. No functional change. Signed-off-by: Sam Protsenko --- Changes in v3: - none Changes in v2: - Improved the commit message: explained why enum is needed for specifying the layout (vs bit flag) - Included clk-cpu.h in clk.h as it uses enum exynos_cpuclk_layout from clk-cpu.h (it's needed because preceding patch adding headers was dropped) drivers/clk/samsung/clk-cpu.c | 2 +- drivers/clk/samsung/clk-cpu.h | 12 ++++++++++-- drivers/clk/samsung/clk-exynos3250.c | 2 +- drivers/clk/samsung/clk-exynos4.c | 6 +++--- drivers/clk/samsung/clk-exynos5250.c | 3 ++- drivers/clk/samsung/clk-exynos5420.c | 8 ++++---- drivers/clk/samsung/clk-exynos5433.c | 8 ++++---- drivers/clk/samsung/clk.h | 5 ++++- 8 files changed, 29 insertions(+), 17 deletions(-) diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index 82d54b0c9040..635ab8cc54a2 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -465,7 +465,7 @@ static int __init exynos_register_cpu_clock(struct sams= ung_clk_provider *ctx, cpuclk->lock =3D &ctx->lock; cpuclk->flags =3D clk_data->flags; cpuclk->clk_nb.notifier_call =3D exynos_cpuclk_notifier_cb; - if (clk_data->flags & CLK_CPU_HAS_E5433_REGS_LAYOUT) { + if (clk_data->reg_layout =3D=3D CPUCLK_LAYOUT_E5433) { cpuclk->pre_rate_cb =3D exynos5433_cpuclk_pre_rate_change; cpuclk->post_rate_cb =3D exynos5433_cpuclk_post_rate_change; } else { diff --git a/drivers/clk/samsung/clk-cpu.h b/drivers/clk/samsung/clk-cpu.h index ee57f3638fed..4382ab005ad3 100644 --- a/drivers/clk/samsung/clk-cpu.h +++ b/drivers/clk/samsung/clk-cpu.h @@ -12,8 +12,16 @@ #define CLK_CPU_HAS_DIV1 BIT(0) /* When ALT parent is active, debug clocks need safe divider values */ #define CLK_CPU_NEEDS_DEBUG_ALT_DIV BIT(1) -/* The CPU clock registers have Exynos5433-compatible layout */ -#define CLK_CPU_HAS_E5433_REGS_LAYOUT BIT(2) + +/** + * enum exynos_cpuclk_layout - CPU clock registers layout compatibility + * @CPUCLK_LAYOUT_E4210: Exynos4210 compatible layout + * @CPUCLK_LAYOUT_E5433: Exynos5433 compatible layout + */ +enum exynos_cpuclk_layout { + CPUCLK_LAYOUT_E4210, + CPUCLK_LAYOUT_E5433, +}; =20 /** * struct exynos_cpuclk_cfg_data - config data to setup cpu clocks diff --git a/drivers/clk/samsung/clk-exynos3250.c b/drivers/clk/samsung/clk= -exynos3250.c index bf149fae04c3..cd4fec323a42 100644 --- a/drivers/clk/samsung/clk-exynos3250.c +++ b/drivers/clk/samsung/clk-exynos3250.c @@ -775,7 +775,7 @@ static const struct exynos_cpuclk_cfg_data e3250_armclk= _d[] __initconst =3D { =20 static const struct samsung_cpu_clock exynos3250_cpu_clks[] __initconst = =3D { CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MPLL_USER_C, - CLK_CPU_HAS_DIV1, 0x14000, e3250_armclk_d), + CLK_CPU_HAS_DIV1, 0x14000, CPUCLK_LAYOUT_E4210, e3250_armclk_d), }; =20 static void __init exynos3_core_down_clock(void __iomem *reg_base) diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-ex= ynos4.c index d5b1e9f49d8b..a026ccca7315 100644 --- a/drivers/clk/samsung/clk-exynos4.c +++ b/drivers/clk/samsung/clk-exynos4.c @@ -1253,19 +1253,19 @@ static const struct exynos_cpuclk_cfg_data e4412_ar= mclk_d[] __initconst =3D { static const struct samsung_cpu_clock exynos4210_cpu_clks[] __initconst = =3D { CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_SCLK_MPLL, CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1, 0x14000, - e4210_armclk_d), + CPUCLK_LAYOUT_E4210, e4210_armclk_d), }; =20 static const struct samsung_cpu_clock exynos4212_cpu_clks[] __initconst = =3D { CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MPLL_USER_C, CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1, 0x14000, - e4212_armclk_d), + CPUCLK_LAYOUT_E4210, e4212_armclk_d), }; =20 static const struct samsung_cpu_clock exynos4412_cpu_clks[] __initconst = =3D { CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MPLL_USER_C, CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1, 0x14000, - e4412_armclk_d), + CPUCLK_LAYOUT_E4210, e4412_armclk_d), }; =20 /* register exynos4 clocks */ diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk= -exynos5250.c index 58df80de52ef..e02e7c013f3d 100644 --- a/drivers/clk/samsung/clk-exynos5250.c +++ b/drivers/clk/samsung/clk-exynos5250.c @@ -777,7 +777,8 @@ static const struct exynos_cpuclk_cfg_data exynos5250_a= rmclk_d[] __initconst =3D { =20 static const struct samsung_cpu_clock exynos5250_cpu_clks[] __initconst = =3D { CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MPLL, - CLK_CPU_HAS_DIV1, 0x0, exynos5250_armclk_d), + CLK_CPU_HAS_DIV1, 0x0, CPUCLK_LAYOUT_E4210, + exynos5250_armclk_d), }; =20 static const struct of_device_id ext_clk_match[] __initconst =3D { diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk= -exynos5420.c index bd7b304d2c00..c630135c686b 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c @@ -1556,16 +1556,16 @@ static const struct exynos_cpuclk_cfg_data exynos54= 20_kfcclk_d[] __initconst =3D { =20 static const struct samsung_cpu_clock exynos5420_cpu_clks[] __initconst = =3D { CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MSPLL_CPU, 0, - 0x0, exynos5420_eglclk_d), + 0x0, CPUCLK_LAYOUT_E4210, exynos5420_eglclk_d), CPU_CLK(CLK_KFC_CLK, "kfcclk", CLK_MOUT_KPLL, CLK_MOUT_MSPLL_KFC, 0, - 0x28000, exynos5420_kfcclk_d), + 0x28000, CPUCLK_LAYOUT_E4210, exynos5420_kfcclk_d), }; =20 static const struct samsung_cpu_clock exynos5800_cpu_clks[] __initconst = =3D { CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MSPLL_CPU, 0, - 0x0, exynos5800_eglclk_d), + 0x0, CPUCLK_LAYOUT_E4210, exynos5800_eglclk_d), CPU_CLK(CLK_KFC_CLK, "kfcclk", CLK_MOUT_KPLL, CLK_MOUT_MSPLL_KFC, 0, - 0x28000, exynos5420_kfcclk_d), + 0x28000, CPUCLK_LAYOUT_E4210, exynos5420_kfcclk_d), }; =20 static const struct of_device_id ext_clk_match[] __initconst =3D { diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk= -exynos5433.c index d3779eefb438..609d31a7aa52 100644 --- a/drivers/clk/samsung/clk-exynos5433.c +++ b/drivers/clk/samsung/clk-exynos5433.c @@ -3700,8 +3700,8 @@ static const struct exynos_cpuclk_cfg_data exynos5433= _apolloclk_d[] __initconst =20 static const struct samsung_cpu_clock apollo_cpu_clks[] __initconst =3D { CPU_CLK(CLK_SCLK_APOLLO, "apolloclk", CLK_MOUT_APOLLO_PLL, - CLK_MOUT_BUS_PLL_APOLLO_USER, CLK_CPU_HAS_E5433_REGS_LAYOUT, - 0x0, exynos5433_apolloclk_d), + CLK_MOUT_BUS_PLL_APOLLO_USER, 0, 0x0, + CPUCLK_LAYOUT_E5433, exynos5433_apolloclk_d), }; =20 static const struct samsung_cmu_info apollo_cmu_info __initconst =3D { @@ -3944,8 +3944,8 @@ static const struct exynos_cpuclk_cfg_data exynos5433= _atlasclk_d[] __initconst =3D =20 static const struct samsung_cpu_clock atlas_cpu_clks[] __initconst =3D { CPU_CLK(CLK_SCLK_ATLAS, "atlasclk", CLK_MOUT_ATLAS_PLL, - CLK_MOUT_BUS_PLL_ATLAS_USER, CLK_CPU_HAS_E5433_REGS_LAYOUT, - 0x0, exynos5433_atlasclk_d), + CLK_MOUT_BUS_PLL_ATLAS_USER, 0, 0x0, + CPUCLK_LAYOUT_E5433, exynos5433_atlasclk_d), }; =20 static const struct samsung_cmu_info atlas_cmu_info __initconst =3D { diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h index 516b716407e5..a763309e6f12 100644 --- a/drivers/clk/samsung/clk.h +++ b/drivers/clk/samsung/clk.h @@ -12,6 +12,7 @@ =20 #include #include "clk-pll.h" +#include "clk-cpu.h" =20 /** * struct samsung_clk_provider - information about clock provider @@ -282,10 +283,11 @@ struct samsung_cpu_clock { unsigned int alt_parent_id; unsigned long flags; int offset; + enum exynos_cpuclk_layout reg_layout; const struct exynos_cpuclk_cfg_data *cfg; }; =20 -#define CPU_CLK(_id, _name, _pid, _apid, _flags, _offset, _cfg) \ +#define CPU_CLK(_id, _name, _pid, _apid, _flags, _offset, _layout, _cfg) \ { \ .id =3D _id, \ .name =3D _name, \ @@ -293,6 +295,7 @@ struct samsung_cpu_clock { .alt_parent_id =3D _apid, \ .flags =3D _flags, \ .offset =3D _offset, \ + .reg_layout =3D _layout, \ .cfg =3D _cfg, \ } =20 --=20 2.39.2 From nobody Sat Feb 7 19:04:16 2026 Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1469D4EB5E for ; Sat, 24 Feb 2024 20:21:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806064; cv=none; b=E5QIGfJ07KwPDn0YAfqiVoF1gk2jaoiO9QR5ZfPIHguCE1GW/J9MUeTpPk6+Nh97m88IPMFrAOOyjCGycA3fA/38+jmO97cW5dJe0PF+0ZscbOHkjiyrUybz+kp9iNvaFYb/jgUzrKuMHJ68+S6ULudfm4Gr51oS4P35I5xorv8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806064; c=relaxed/simple; bh=1ImW2IACKGUhYJ7/rOYdyKajWLj0N3ZFaS5Yy40Yw9Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=o1ttbse0fLmiTiJ56KrxQCyyznrzB7EGhKsfLRAMALUsVj8OOb+f4AmLeXuNeloZljg2OUgGESS029i88nIbd/LFjRDzwN43ZzlZ4TXD6VB4rmSor4vIjhbiaZ02/o5JlSNiAmKlyMC8uBahJRTek4XuKRVyKPEiYx4ExQ+dm2A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Qk5FAEkj; arc=none smtp.client-ip=209.85.167.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Qk5FAEkj" Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3c15b7b36bbso701630b6e.1 for ; Sat, 24 Feb 2024 12:21:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708806061; x=1709410861; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S7KoDUleWCo5UKlQBGeeXR+YMlhweLkGTgyZVq03PTg=; b=Qk5FAEkjrBHH8HlHdVAu9FwzTs1OZcvOlRjeq5hHbGEDMWbAVC0Rp+UsrP/uA1dkIO hNDPTPu3Nzi1ochSmYgkPuibYyOwknfrwgAWLo+GcMkIJ3ww52EaRN7zW10zBvJOXnLw 6sn4JAKxYdgsYWqLbV66W8cAfNaxHcdHl9KhMK3UluqNeTAGSZjPQsy+u5WToBiCn1Kl A+4sAwb0uJeKLVQrpskgly/cLXxMFvASYGOc1UsownmtMX0iFQQ1CWyDwvN/Ih7psvJb Iab/NmG4IVxl/FYoOz4Jsc2xKwkSzGO+2VXMxnMb+6pyage8G8KKFKJG+s4RP9LcVEtr bZLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806061; x=1709410861; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S7KoDUleWCo5UKlQBGeeXR+YMlhweLkGTgyZVq03PTg=; b=gU+ljraBFH8KRDPbvBp2esETHEVO3wQ26ysdAacjhLVaWqklfuSWVUzHszQGnEFwd+ P0ZlXtlfD52e8r3Kutwi2p2ByR6HmL9u8NcLKFDSRjl+Vemjg/vbkaM9zUH/UYkoUQXf bqNHs4LKXDF4E0UskN2l2h715jwMKjPpjXb0Pyz50aEuYQDTSe0jJssuWJgOnWw2x8Vm qbOdTS7oy7x/G+qIDsFWpLk5DgAB/II0f1QZPjB+8ZO/cg7cHNIMXXiPinf+n6fvD5X6 QWsK265bjj0OyOR2jSgu6wNP7kMvs6G91sgOfl9map3hDEH85sGwJO60DfEFAG0tbtih v5vg== X-Forwarded-Encrypted: i=1; AJvYcCWn95CvaCiHpQNl+2XaP0b2ghBdAZKshLsmfAvNMPb4wijEIjJX+9MUhZTCL/0x/G270RYN/GwopDgQZE06USz4NTyZx5ORHN7GoONU X-Gm-Message-State: AOJu0Yzk4nqjOo/7pjn0zk20vpXmQbvZR4C9ptXSKwbIoTFBvCgyid+j 7Rt/pO+MmLxbvE0UPjaKiuxg7SwUbBQIE/6iRkryuvy9xkecoaAR6awhviq9Wg0= X-Google-Smtp-Source: AGHT+IENaAaBEvjJseobNlvF+eiZDk+l+seaHD0oo3sk7o+f/hO5ZUaGaS5Q1MrGsUHlW0icJeudIw== X-Received: by 2002:a05:6808:f88:b0:3c1:9c5b:74a7 with SMTP id o8-20020a0568080f8800b003c19c5b74a7mr119158oiw.17.1708806061101; Sat, 24 Feb 2024 12:21:01 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 22-20020aca0916000000b003c150705429sm382420oij.12.2024.02.24.12.21.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 12:21:00 -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 09/15] clk: samsung: Keep CPU clock chip specific data in a dedicated struct Date: Sat, 24 Feb 2024 14:20:47 -0600 Message-Id: <20240224202053.25313-10-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224202053.25313-1-semen.protsenko@linaro.org> References: <20240224202053.25313-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Keep chip specific data in the data structure, don't mix it with code. It makes it easier to add more chip specific data further. Having all chip specific data in the table eliminates possible code bloat when adding more rate handlers for new chips, and also makes it possible to keep some other chip related data in that array. No functional change. Signed-off-by: Sam Protsenko --- Changes in v3: - none Changes in v2: - Improved the commit message: explained why it's beneficial for new chips to keep chip-specific data in one table drivers/clk/samsung/clk-cpu.c | 40 +++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index 635ab8cc54a2..eb2b67d08f89 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -43,6 +43,16 @@ struct exynos_cpuclk; typedef int (*exynos_rate_change_fn_t)(struct clk_notifier_data *ndata, struct exynos_cpuclk *cpuclk); =20 +/** + * struct exynos_cpuclk_chip - Chip specific data for CPU clock + * @pre_rate_cb: callback to run before CPU clock rate change + * @post_rate_cb: callback to run after CPU clock rate change + */ +struct exynos_cpuclk_chip { + exynos_rate_change_fn_t pre_rate_cb; + exynos_rate_change_fn_t post_rate_cb; +}; + /** * struct exynos_cpuclk - information about clock supplied to a CPU core * @hw: handle between CCF and CPU clock @@ -55,8 +65,7 @@ typedef int (*exynos_rate_change_fn_t)(struct clk_notifie= r_data *ndata, * @clk_nb: clock notifier registered for changes in clock speed of the * primary parent clock * @flags: configuration flags for the CPU clock - * @pre_rate_cb: callback to run before CPU clock rate change - * @post_rate_cb: callback to run after CPU clock rate change + * @chip: chip-specific data for the CPU clock * * This structure holds information required for programming the CPU clock= for * various clock speeds. @@ -70,9 +79,7 @@ struct exynos_cpuclk { const unsigned long num_cfgs; struct notifier_block clk_nb; unsigned long flags; - - exynos_rate_change_fn_t pre_rate_cb; - exynos_rate_change_fn_t post_rate_cb; + const struct exynos_cpuclk_chip *chip; }; =20 /* ---- Common code ------------------------------------------------------= --- */ @@ -420,13 +427,24 @@ static int exynos_cpuclk_notifier_cb(struct notifier_= block *nb, cpuclk =3D container_of(nb, struct exynos_cpuclk, clk_nb); =20 if (event =3D=3D PRE_RATE_CHANGE) - err =3D cpuclk->pre_rate_cb(ndata, cpuclk); + err =3D cpuclk->chip->pre_rate_cb(ndata, cpuclk); else if (event =3D=3D POST_RATE_CHANGE) - err =3D cpuclk->post_rate_cb(ndata, cpuclk); + err =3D cpuclk->chip->post_rate_cb(ndata, cpuclk); =20 return notifier_from_errno(err); } =20 +static const struct exynos_cpuclk_chip exynos_clkcpu_chips[] =3D { + [CPUCLK_LAYOUT_E4210] =3D { + .pre_rate_cb =3D exynos_cpuclk_pre_rate_change, + .post_rate_cb =3D exynos_cpuclk_post_rate_change, + }, + [CPUCLK_LAYOUT_E5433] =3D { + .pre_rate_cb =3D exynos5433_cpuclk_pre_rate_change, + .post_rate_cb =3D exynos5433_cpuclk_post_rate_change, + }, +}; + /* helper function to register a CPU clock */ static int __init exynos_register_cpu_clock(struct samsung_clk_provider *c= tx, const struct samsung_cpu_clock *clk_data) @@ -465,13 +483,7 @@ static int __init exynos_register_cpu_clock(struct sam= sung_clk_provider *ctx, cpuclk->lock =3D &ctx->lock; cpuclk->flags =3D clk_data->flags; cpuclk->clk_nb.notifier_call =3D exynos_cpuclk_notifier_cb; - if (clk_data->reg_layout =3D=3D CPUCLK_LAYOUT_E5433) { - cpuclk->pre_rate_cb =3D exynos5433_cpuclk_pre_rate_change; - cpuclk->post_rate_cb =3D exynos5433_cpuclk_post_rate_change; - } else { - cpuclk->pre_rate_cb =3D exynos_cpuclk_pre_rate_change; - cpuclk->post_rate_cb =3D exynos_cpuclk_post_rate_change; - } + cpuclk->chip =3D &exynos_clkcpu_chips[clk_data->reg_layout]; =20 ret =3D clk_notifier_register(parent->clk, &cpuclk->clk_nb); if (ret) { --=20 2.39.2 From nobody Sat Feb 7 19:04:16 2026 Received: from mail-oa1-f49.google.com (mail-oa1-f49.google.com [209.85.160.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A4E24F61C for ; Sat, 24 Feb 2024 20:21:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806065; cv=none; b=ap67WEhnF42PuVzQGxU57NOafNgpzDOJf9CzXRRUUdf0EdSdo99R0dcHw1gDF8gn6bhDGiT3z6GWrq8WqkCYATZQVcQ/2rQM1KK7rK7H5oxbYxnyPyrkxs/JtnY6aw6eTOKfcNLx2C0wdIaJfMerye0SzTMjBTfsVJBOSHG63hw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806065; c=relaxed/simple; bh=/bokbG/13B4Rq8pTUpOOZajb+pMZCBVUzRNl3zqiVlU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nPb4GvwuFR+e6q/veHCIimyMye/ulIQi0bOlk332DEKgDkOLAqwJ17V7S3RAU6v+pAMLvpOfMy/O4UgaPyMlp7kUwyrshTyL9MbsLPKE3I532D8E5Z2X3skBA6GMYlY1Nzg0k6AT4TOd7jV+NrsTZFqtiwWZoyk5yzIltCBs344= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=FWQqARyI; arc=none smtp.client-ip=209.85.160.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FWQqARyI" Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-21fa086008fso976175fac.0 for ; Sat, 24 Feb 2024 12:21:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708806062; x=1709410862; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iN2UWeJ2Y6EenGAeuO3GljZkDZayc7fncQnG812Xabg=; b=FWQqARyIGVGB3b9zqZi0PRfqW2ofEdlgeYDqnBWC34R3JEJPBnh8Mr0YCJAQFQceM3 JAirQibtjB9hgYuYrVN34eReuny7L8ktIQ5QaR0Xc5YIzWiTqix1PhVglQebQZUB4c3Y +bhyCdFfR+3j8bd0cEQoyiU2PtuJhrIenbwaC67NGJ097bGN9jN3N5b5Wx/IQoZrSJSC tLEwM+HQvHyh5vXbe+cJwY12UXe33fArXBiuBcM0Vq0omSIORyS34x6lR29RCZm5WPM1 4FEyOwQDAnUhaK7m7DMUYvjnNFH5+N8/MN1ReLYgAfwvlRVEuAVDvW1iWawLAx5SnShR ifLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806062; x=1709410862; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iN2UWeJ2Y6EenGAeuO3GljZkDZayc7fncQnG812Xabg=; b=m5t2LVMInGxj3FwN8non+yP/S1UGhD9insN/Oz96foKuLXeQkaFQKTkXYWIrZ9IYwy OE56uQ/XMViexy1ta6zJuiRZHvjssOj+fXdEN0WghPT3jXfxiXPrP/TIDmB+f/8gnLcX PsjV31JeUC5j7cCwkD6GXqJnZgT1fAVxUowMmLubdgxGwl06cG34OQ1TnVLe/BB1Jj30 U++Ehj/u/2d5etQaUjx+dsbmW5rEZmNYJr2kIKnngsSea3aLKXRX+2tiwmKvq6YZRshe wfGA02rRfOiu89khZ2EdUfBrvXdIJzehkUmu8BFDjwC1HP7U87HiuQ50LA9LhVvNojnw QvUw== X-Forwarded-Encrypted: i=1; AJvYcCUgmGip+xdbINHfKjVZL9Clpg7G4WtfApejtOIGvpUW8P/9HzZOH0As1rrJMk3J3fvL9+GO4s8zKE+TXJMe2BQ3x6S9gMfjS4wYJltc X-Gm-Message-State: AOJu0YzbC3924J3kY/kZwKLPQBB11DHoRAYly9KjlN5pklGR5qYrcSV+ YliVuJ6hoaGQL6741gLVITae87BUDybbXat8O3ditJkJQFhIKY+HrpQLhKuCE80= X-Google-Smtp-Source: AGHT+IFfqENRmopUTkTwwQ1a6djbqtdWtCsUtmwNY4lLcrJNH1YTphv/hiI7myCmYeGaYAnGis4G2A== X-Received: by 2002:a05:6871:4cd:b0:21e:7ad8:dce8 with SMTP id n13-20020a05687104cd00b0021e7ad8dce8mr3125937oai.23.1708806062054; Sat, 24 Feb 2024 12:21:02 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id xd12-20020a056870ce4c00b0021f86169b99sm578648oab.43.2024.02.24.12.21.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 12:21:01 -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 10/15] clk: samsung: Keep register offsets in chip specific structure Date: Sat, 24 Feb 2024 14:20:48 -0600 Message-Id: <20240224202053.25313-11-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224202053.25313-1-semen.protsenko@linaro.org> References: <20240224202053.25313-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Abstract CPU clock registers by keeping their offsets in a dedicated chip specific structure to accommodate for oncoming Exynos850 support, which has different offsets for cluster 0 and cluster 1. This rework also makes it possible to use exynos_set_safe_div() for all chips, so exynos5433_set_safe_div() is removed here to reduce the code duplication. The ".regs" field has to be (void *) as different Exynos chips can have very different register layout, so this way it's possible for ".regs" to point to different structures, each representing its own chip's layout. No functional change. Signed-off-by: Sam Protsenko --- Changes in v3: - Changed struct exynos_cpuclk_chip.regs field type from (void *) to (struct exynls_cpuclk_regs *) - Moved struct exynos_cpuclk_regs above struct exynos_cpuclk_chip, as the former is used in the latter Changes in v2: - Improved the commit message: explained why .regs field has to be (void *) - Changed .ctrl_base field to .base to reflect changes in previous commits drivers/clk/samsung/clk-cpu.c | 156 +++++++++++++++++++--------------- 1 file changed, 86 insertions(+), 70 deletions(-) diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index eb2b67d08f89..e29d08a1c8b3 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -43,14 +43,34 @@ struct exynos_cpuclk; typedef int (*exynos_rate_change_fn_t)(struct clk_notifier_data *ndata, struct exynos_cpuclk *cpuclk); =20 +/** + * struct exynos_cpuclk_regs - Register offsets for CPU related clocks + * @mux_sel: offset of CPU MUX_SEL register (for selecting MUX clock paren= t) + * @mux_stat: offset of CPU MUX_STAT register (for checking MUX clock stat= us) + * @div_cpu0: offset of CPU DIV0 register (for modifying divider values) + * @div_cpu1: offset of CPU DIV1 register (for modifying divider values) + * @div_stat_cpu0: offset of CPU DIV0_STAT register (for checking DIV stat= us) + * @div_stat_cpu1: offset of CPU DIV1_STAT register (for checking DIV stat= us) + */ +struct exynos_cpuclk_regs { + u32 mux_sel; + u32 mux_stat; + u32 div_cpu0; + u32 div_cpu1; + u32 div_stat_cpu0; + u32 div_stat_cpu1; +}; + /** * struct exynos_cpuclk_chip - Chip specific data for CPU clock + * @regs: register offsets for CPU related clocks * @pre_rate_cb: callback to run before CPU clock rate change * @post_rate_cb: callback to run after CPU clock rate change */ struct exynos_cpuclk_chip { - exynos_rate_change_fn_t pre_rate_cb; - exynos_rate_change_fn_t post_rate_cb; + const struct exynos_cpuclk_regs * const regs; + exynos_rate_change_fn_t pre_rate_cb; + exynos_rate_change_fn_t post_rate_cb; }; =20 /** @@ -130,43 +150,48 @@ static void wait_until_mux_stable(void __iomem *mux_r= eg, u32 mux_pos, pr_err("%s: re-parenting mux timed-out\n", __func__); } =20 -/* ---- Exynos 3/4/5 -----------------------------------------------------= --- */ - -#define E4210_SRC_CPU 0x200 -#define E4210_STAT_CPU 0x400 -#define E4210_DIV_CPU0 0x500 -#define E4210_DIV_CPU1 0x504 -#define E4210_DIV_STAT_CPU0 0x600 -#define E4210_DIV_STAT_CPU1 0x604 - -#define E4210_DIV0_RATIO0_MASK GENMASK(2, 0) -#define E4210_DIV1_HPM_MASK GENMASK(6, 4) -#define E4210_DIV1_COPY_MASK GENMASK(2, 0) -#define E4210_MUX_HPM_MASK BIT(20) -#define E4210_DIV0_ATB_SHIFT 16 -#define E4210_DIV0_ATB_MASK (DIV_MASK << E4210_DIV0_ATB_SHIFT) - /* * Helper function to set the 'safe' dividers for the CPU clock. The param= eters * div and mask contain the divider value and the register bit mask of the * dividers to be programmed. */ -static void exynos_set_safe_div(void __iomem *base, unsigned long div, +static void exynos_set_safe_div(struct exynos_cpuclk *cpuclk, unsigned lon= g div, unsigned long mask) { + const struct exynos_cpuclk_regs * const regs =3D cpuclk->chip->regs; + void __iomem *base =3D cpuclk->base; unsigned long div0; =20 - div0 =3D readl(base + E4210_DIV_CPU0); + div0 =3D readl(base + regs->div_cpu0); div0 =3D (div0 & ~mask) | (div & mask); - writel(div0, base + E4210_DIV_CPU0); - wait_until_divider_stable(base + E4210_DIV_STAT_CPU0, mask); + writel(div0, base + regs->div_cpu0); + wait_until_divider_stable(base + regs->div_stat_cpu0, mask); } =20 +/* ---- Exynos 3/4/5 -----------------------------------------------------= --- */ + +#define E4210_DIV0_RATIO0_MASK GENMASK(2, 0) +#define E4210_DIV1_HPM_MASK GENMASK(6, 4) +#define E4210_DIV1_COPY_MASK GENMASK(2, 0) +#define E4210_MUX_HPM_MASK BIT(20) +#define E4210_DIV0_ATB_SHIFT 16 +#define E4210_DIV0_ATB_MASK (DIV_MASK << E4210_DIV0_ATB_SHIFT) + +static const struct exynos_cpuclk_regs e4210_cpuclk_regs =3D { + .mux_sel =3D 0x200, + .mux_stat =3D 0x400, + .div_cpu0 =3D 0x500, + .div_cpu1 =3D 0x504, + .div_stat_cpu0 =3D 0x600, + .div_stat_cpu1 =3D 0x604, +}; + /* handler for pre-rate change notification from parent clock */ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata, struct exynos_cpuclk *cpuclk) { const struct exynos_cpuclk_cfg_data *cfg_data =3D cpuclk->cfg; + const struct exynos_cpuclk_regs * const regs =3D cpuclk->chip->regs; void __iomem *base =3D cpuclk->base; unsigned long alt_prate =3D clk_hw_get_rate(cpuclk->alt_parent); unsigned long div0, div1 =3D 0, mux_reg; @@ -189,8 +214,8 @@ static int exynos_cpuclk_pre_rate_change(struct clk_not= ifier_data *ndata, div0 =3D cfg_data->div0; if (cpuclk->flags & CLK_CPU_HAS_DIV1) { div1 =3D cfg_data->div1; - if (readl(base + E4210_SRC_CPU) & E4210_MUX_HPM_MASK) - div1 =3D readl(base + E4210_DIV_CPU1) & + if (readl(base + regs->mux_sel) & E4210_MUX_HPM_MASK) + div1 =3D readl(base + regs->div_cpu1) & (E4210_DIV1_HPM_MASK | E4210_DIV1_COPY_MASK); } =20 @@ -217,22 +242,22 @@ static int exynos_cpuclk_pre_rate_change(struct clk_n= otifier_data *ndata, alt_div |=3D E4210_DIV0_ATB_MASK; alt_div_mask |=3D E4210_DIV0_ATB_MASK; } - exynos_set_safe_div(base, alt_div, alt_div_mask); + exynos_set_safe_div(cpuclk, alt_div, alt_div_mask); div0 |=3D alt_div; } =20 /* select sclk_mpll as the alternate parent */ - mux_reg =3D readl(base + E4210_SRC_CPU); - writel(mux_reg | (1 << 16), base + E4210_SRC_CPU); - wait_until_mux_stable(base + E4210_STAT_CPU, 16, 2); + mux_reg =3D readl(base + regs->mux_sel); + writel(mux_reg | (1 << 16), base + regs->mux_sel); + wait_until_mux_stable(base + regs->mux_stat, 16, 2); =20 /* alternate parent is active now. set the dividers */ - writel(div0, base + E4210_DIV_CPU0); - wait_until_divider_stable(base + E4210_DIV_STAT_CPU0, DIV_MASK_ALL); + writel(div0, base + regs->div_cpu0); + wait_until_divider_stable(base + regs->div_stat_cpu0, DIV_MASK_ALL); =20 if (cpuclk->flags & CLK_CPU_HAS_DIV1) { - writel(div1, base + E4210_DIV_CPU1); - wait_until_divider_stable(base + E4210_DIV_STAT_CPU1, + writel(div1, base + regs->div_cpu1); + wait_until_divider_stable(base + regs->div_stat_cpu1, DIV_MASK_ALL); } =20 @@ -245,6 +270,7 @@ static int exynos_cpuclk_post_rate_change(struct clk_no= tifier_data *ndata, struct exynos_cpuclk *cpuclk) { const struct exynos_cpuclk_cfg_data *cfg_data =3D cpuclk->cfg; + const struct exynos_cpuclk_regs * const regs =3D cpuclk->chip->regs; void __iomem *base =3D cpuclk->base; unsigned long div =3D 0, div_mask =3D DIV_MASK; unsigned long mux_reg; @@ -262,50 +288,37 @@ static int exynos_cpuclk_post_rate_change(struct clk_= notifier_data *ndata, spin_lock_irqsave(cpuclk->lock, flags); =20 /* select mout_apll as the alternate parent */ - mux_reg =3D readl(base + E4210_SRC_CPU); - writel(mux_reg & ~(1 << 16), base + E4210_SRC_CPU); - wait_until_mux_stable(base + E4210_STAT_CPU, 16, 1); + mux_reg =3D readl(base + regs->mux_sel); + writel(mux_reg & ~(1 << 16), base + regs->mux_sel); + wait_until_mux_stable(base + regs->mux_stat, 16, 1); =20 if (cpuclk->flags & CLK_CPU_NEEDS_DEBUG_ALT_DIV) { div |=3D (cfg_data->div0 & E4210_DIV0_ATB_MASK); div_mask |=3D E4210_DIV0_ATB_MASK; } =20 - exynos_set_safe_div(base, div, div_mask); + exynos_set_safe_div(cpuclk, div, div_mask); spin_unlock_irqrestore(cpuclk->lock, flags); return 0; } =20 /* ---- Exynos5433 -------------------------------------------------------= --- */ =20 -#define E5433_MUX_SEL2 0x208 -#define E5433_MUX_STAT2 0x408 -#define E5433_DIV_CPU0 0x600 -#define E5433_DIV_CPU1 0x604 -#define E5433_DIV_STAT_CPU0 0x700 -#define E5433_DIV_STAT_CPU1 0x704 - -/* - * Helper function to set the 'safe' dividers for the CPU clock. The param= eters - * div and mask contain the divider value and the register bit mask of the - * dividers to be programmed. - */ -static void exynos5433_set_safe_div(void __iomem *base, unsigned long div, - unsigned long mask) -{ - unsigned long div0; - - div0 =3D readl(base + E5433_DIV_CPU0); - div0 =3D (div0 & ~mask) | (div & mask); - writel(div0, base + E5433_DIV_CPU0); - wait_until_divider_stable(base + E5433_DIV_STAT_CPU0, mask); -} +static const struct exynos_cpuclk_regs e5433_cpuclk_regs =3D { + .mux_sel =3D 0x208, + .mux_stat =3D 0x408, + .div_cpu0 =3D 0x600, + .div_cpu1 =3D 0x604, + .div_stat_cpu0 =3D 0x700, + .div_stat_cpu1 =3D 0x704, +}; =20 /* handler for pre-rate change notification from parent clock */ static int exynos5433_cpuclk_pre_rate_change(struct clk_notifier_data *nda= ta, struct exynos_cpuclk *cpuclk) { const struct exynos_cpuclk_cfg_data *cfg_data =3D cpuclk->cfg; + const struct exynos_cpuclk_regs * const regs =3D cpuclk->chip->regs; void __iomem *base =3D cpuclk->base; unsigned long alt_prate =3D clk_hw_get_rate(cpuclk->alt_parent); unsigned long div0, div1 =3D 0, mux_reg; @@ -342,21 +355,21 @@ static int exynos5433_cpuclk_pre_rate_change(struct c= lk_notifier_data *ndata, alt_div =3D DIV_ROUND_UP(alt_prate, tmp_rate) - 1; WARN_ON(alt_div >=3D MAX_DIV); =20 - exynos5433_set_safe_div(base, alt_div, alt_div_mask); + exynos_set_safe_div(cpuclk, alt_div, alt_div_mask); div0 |=3D alt_div; } =20 /* select the alternate parent */ - mux_reg =3D readl(base + E5433_MUX_SEL2); - writel(mux_reg | 1, base + E5433_MUX_SEL2); - wait_until_mux_stable(base + E5433_MUX_STAT2, 0, 2); + mux_reg =3D readl(base + regs->mux_sel); + writel(mux_reg | 1, base + regs->mux_sel); + wait_until_mux_stable(base + regs->mux_stat, 0, 2); =20 /* alternate parent is active now. set the dividers */ - writel(div0, base + E5433_DIV_CPU0); - wait_until_divider_stable(base + E5433_DIV_STAT_CPU0, DIV_MASK_ALL); + writel(div0, base + regs->div_cpu0); + wait_until_divider_stable(base + regs->div_stat_cpu0, DIV_MASK_ALL); =20 - writel(div1, base + E5433_DIV_CPU1); - wait_until_divider_stable(base + E5433_DIV_STAT_CPU1, DIV_MASK_ALL); + writel(div1, base + regs->div_cpu1); + wait_until_divider_stable(base + regs->div_stat_cpu1, DIV_MASK_ALL); =20 spin_unlock_irqrestore(cpuclk->lock, flags); return 0; @@ -366,6 +379,7 @@ static int exynos5433_cpuclk_pre_rate_change(struct clk= _notifier_data *ndata, static int exynos5433_cpuclk_post_rate_change(struct clk_notifier_data *nd= ata, struct exynos_cpuclk *cpuclk) { + const struct exynos_cpuclk_regs * const regs =3D cpuclk->chip->regs; void __iomem *base =3D cpuclk->base; unsigned long div =3D 0, div_mask =3D DIV_MASK; unsigned long mux_reg; @@ -374,11 +388,11 @@ static int exynos5433_cpuclk_post_rate_change(struct = clk_notifier_data *ndata, spin_lock_irqsave(cpuclk->lock, flags); =20 /* select apll as the alternate parent */ - mux_reg =3D readl(base + E5433_MUX_SEL2); - writel(mux_reg & ~1, base + E5433_MUX_SEL2); - wait_until_mux_stable(base + E5433_MUX_STAT2, 0, 1); + mux_reg =3D readl(base + regs->mux_sel); + writel(mux_reg & ~1, base + regs->mux_sel); + wait_until_mux_stable(base + regs->mux_stat, 0, 1); =20 - exynos5433_set_safe_div(base, div, div_mask); + exynos_set_safe_div(cpuclk, div, div_mask); spin_unlock_irqrestore(cpuclk->lock, flags); return 0; } @@ -436,10 +450,12 @@ static int exynos_cpuclk_notifier_cb(struct notifier_= block *nb, =20 static const struct exynos_cpuclk_chip exynos_clkcpu_chips[] =3D { [CPUCLK_LAYOUT_E4210] =3D { + .regs =3D &e4210_cpuclk_regs, .pre_rate_cb =3D exynos_cpuclk_pre_rate_change, .post_rate_cb =3D exynos_cpuclk_post_rate_change, }, [CPUCLK_LAYOUT_E5433] =3D { + .regs =3D &e5433_cpuclk_regs, .pre_rate_cb =3D exynos5433_cpuclk_pre_rate_change, .post_rate_cb =3D exynos5433_cpuclk_post_rate_change, }, --=20 2.39.2 From nobody Sat Feb 7 19:04:16 2026 Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0D2B50A70 for ; Sat, 24 Feb 2024 20:21:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806066; cv=none; b=gYFNNZGOTReXu/UyQyPA7VZvZeS7CuM+nqo6IM9MSxO6jUIMHIOWv6OTtiJPchI9C0fximcyEEO/E0xGe9a/I2llGzIBVCJLzLuIlfHvuStpyn+KMP6hZfAGNIyy6zUGZyr0kPAelv2tQex8jpSwdDXW3EaZK9u5KGq4p5NG34Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806066; c=relaxed/simple; bh=9SoRSzxWcGaydbHrFDSNHoHFdfw9AKcnZIpgUrABSWs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=J9gTp/7jHy4gB4fU+Y5nIPFkOvEUnj+zH+JrO0C6W4sy4OTwzaOvLLLMKCz4Vn9nHnhtqJVMJnJZFqaRTzJobTerb6ESIlSJHvTvKkFTBW9r3TMXy7oJp0sQU8F1L65RAUD8xLZQdgPEme2FVOJIBIxs9Cg64lGMJOj8EzYyq+A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=qMqoYQjc; arc=none smtp.client-ip=209.85.210.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qMqoYQjc" Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-6e47a0fad63so576202a34.1 for ; Sat, 24 Feb 2024 12:21:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708806063; x=1709410863; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jxynHCX6n2NFtKK18h8LwX8Im2S2Zjm5Bqoy0lY/gAg=; b=qMqoYQjcM0+EZhrIXFTcImYo10vWsVnxqKJrNkIBbPjD9s/6860xni1sLr4DfW7pBO YJcziO5e7ODz6E93D13CgHeYuc/4qNlfsEchulxLKMd++m8iMQVlGUEkGwmfcmQUbocz hPpRfsUa7YQr9W0Lo7FfYgKCtGVOWN/6yI3WL/WcKJarpBtD5sRnCHm14E26brW0XnQ9 d0a2gg1IKTWw+xe1lDdlFqksPOWAbN24bZdo0loEqtdQg4D4LrmehDug4RZr4aFg7UVD fnBaTios5IT+K7K5jV6P7QlhMXrD+CObSf9BeRWlLQ3c6TEu+O3DrVVmE08sdp6P1lxh QESA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806063; x=1709410863; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jxynHCX6n2NFtKK18h8LwX8Im2S2Zjm5Bqoy0lY/gAg=; b=XjCxPEt31CT36AqwMcoupW4WAUIY44SjVRk6rufLnPhujOFDGs2gPLmQP6oS0bBhwZ UOcYyFRC+eyKEYSbmjWMXrDhJReeHUb2Qs52hhHOFhzWh3OkJg4F4gCP3U7IGUFLISC9 4j4Xj4cqZ22dCaT6N9PhwtBA2Bnp01tk6nS+O8BbQwLn9ZS7ZO+qEEaQwEIrZb7nC84c z3YWwLiNomSUIhkobVswHBlXT7ybCTTnrM2rAF7xq5Bf7JHBvvup2usnpuXhSfWzGIkG DQrjwH/5MZ6uzb06Oy18dleA/zWvj50Ilyll4XBfgk1SovvXXj9S0S5FkhNFMQLCV7Nr ixEQ== X-Forwarded-Encrypted: i=1; AJvYcCVbiMkPnMcXkajkRb5TbY48BpRyDf2in2r/ACm82qiwYxZ8Gqxr3jnpuEM4HttxOHeZhetDMsoO4HM58YyvvhRSu+UzOtvNAJz8DwO2 X-Gm-Message-State: AOJu0Yy25FodHAL5J3MPY6q1DSqCeGN13ndPo7cjOQIMUY+fXqHK3fIM LjzgCMKfcpQQKs0stgCc+LHhcwPXmLfmcx+Wq0nSF1kjOy00AjPOrziaOQFmTA4= X-Google-Smtp-Source: AGHT+IFnDJ/rs9ipgn5drE3Y9e4JSbMKRailfOBMuRxXVrrb84Xu0Nn8Lvf8nI4GGCITh/z9FbQ+3w== X-Received: by 2002:a9d:4e93:0:b0:6e4:8456:c362 with SMTP id v19-20020a9d4e93000000b006e48456c362mr1406094otk.14.1708806062983; Sat, 24 Feb 2024 12:21:02 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id n17-20020a4a3451000000b005a02b453ff8sm448112oof.45.2024.02.24.12.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 12:21:02 -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 11/15] clk: samsung: Pass mask to wait_until_mux_stable() Date: Sat, 24 Feb 2024 14:20:49 -0600 Message-Id: <20240224202053.25313-12-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224202053.25313-1-semen.protsenko@linaro.org> References: <20240224202053.25313-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make it possible to use wait_until_mux_stable() for MUX registers where the mask is different from MUX_MASK (e.g. in upcoming CPU clock implementation for Exynos850). No functional change. Signed-off-by: Sam Protsenko --- Changes in v3: - none Changes in v2: - none drivers/clk/samsung/clk-cpu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index e29d08a1c8b3..0cf288138167 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -135,16 +135,16 @@ static void wait_until_divider_stable(void __iomem *d= iv_reg, unsigned long mask) * value was changed. */ static void wait_until_mux_stable(void __iomem *mux_reg, u32 mux_pos, - unsigned long mux_value) + unsigned long mask, unsigned long mux_value) { unsigned long timeout =3D jiffies + msecs_to_jiffies(MAX_STAB_TIME); =20 do { - if (((readl(mux_reg) >> mux_pos) & MUX_MASK) =3D=3D mux_value) + if (((readl(mux_reg) >> mux_pos) & mask) =3D=3D mux_value) return; } while (time_before(jiffies, timeout)); =20 - if (((readl(mux_reg) >> mux_pos) & MUX_MASK) =3D=3D mux_value) + if (((readl(mux_reg) >> mux_pos) & mask) =3D=3D mux_value) return; =20 pr_err("%s: re-parenting mux timed-out\n", __func__); @@ -249,7 +249,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_not= ifier_data *ndata, /* select sclk_mpll as the alternate parent */ mux_reg =3D readl(base + regs->mux_sel); writel(mux_reg | (1 << 16), base + regs->mux_sel); - wait_until_mux_stable(base + regs->mux_stat, 16, 2); + wait_until_mux_stable(base + regs->mux_stat, 16, MUX_MASK, 2); =20 /* alternate parent is active now. set the dividers */ writel(div0, base + regs->div_cpu0); @@ -290,7 +290,7 @@ static int exynos_cpuclk_post_rate_change(struct clk_no= tifier_data *ndata, /* select mout_apll as the alternate parent */ mux_reg =3D readl(base + regs->mux_sel); writel(mux_reg & ~(1 << 16), base + regs->mux_sel); - wait_until_mux_stable(base + regs->mux_stat, 16, 1); + wait_until_mux_stable(base + regs->mux_stat, 16, MUX_MASK, 1); =20 if (cpuclk->flags & CLK_CPU_NEEDS_DEBUG_ALT_DIV) { div |=3D (cfg_data->div0 & E4210_DIV0_ATB_MASK); @@ -362,7 +362,7 @@ static int exynos5433_cpuclk_pre_rate_change(struct clk= _notifier_data *ndata, /* select the alternate parent */ mux_reg =3D readl(base + regs->mux_sel); writel(mux_reg | 1, base + regs->mux_sel); - wait_until_mux_stable(base + regs->mux_stat, 0, 2); + wait_until_mux_stable(base + regs->mux_stat, 0, MUX_MASK, 2); =20 /* alternate parent is active now. set the dividers */ writel(div0, base + regs->div_cpu0); @@ -390,7 +390,7 @@ static int exynos5433_cpuclk_post_rate_change(struct cl= k_notifier_data *ndata, /* select apll as the alternate parent */ mux_reg =3D readl(base + regs->mux_sel); writel(mux_reg & ~1, base + regs->mux_sel); - wait_until_mux_stable(base + regs->mux_stat, 0, 1); + wait_until_mux_stable(base + regs->mux_stat, 0, MUX_MASK, 1); =20 exynos_set_safe_div(cpuclk, div, div_mask); spin_unlock_irqrestore(cpuclk->lock, flags); --=20 2.39.2 From nobody Sat Feb 7 19:04:16 2026 Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8CD35103C for ; Sat, 24 Feb 2024 20:21:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806067; cv=none; b=eRhrqkx/vWgfu8cbKDMNzKBG4vWQpVea3FOQpPjRBrWkyi3DVm3cDy0e3xpBKovAFyNwNlAzg94EYgf3AnqTZMtG/VgmEtsexb9O2JUo4xfFaFDuFyUyyBQwIhgIiNTu1pyBFss4ZLlkv+SV9IaKIrhNMXx/T5HehV6iswfbfeg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806067; c=relaxed/simple; bh=9IGEijDoQiVXlFlrlwF4bqCIQO/DVJF6uV65BmN5IJk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ceKlKgsx/4N1nz4TnwICPxwGsETQkUil+CMGnIvw4cFTLiWmSHqTBlcc0gsc/n2zO0bOVo3SQ0wZ7zVygK+TJATGdOaQu/BIm3IncZFhpFTJuTAlwnGOemRs0SXi7T4byb2N1kRlCvihy6ejzFbvlDwFNIpgSyUi/8wQt+Krnw4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=jR201hfe; arc=none smtp.client-ip=209.85.167.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jR201hfe" Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3c15d1bd5b1so1126083b6e.1 for ; Sat, 24 Feb 2024 12:21:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708806064; x=1709410864; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bRzpcpTlkocgklC/igIeXP7AAH24T8PbXBQTZ2YqBko=; b=jR201hfe3oJ3bwb2wR25ocp7RuUVPuSglZ7EJB0ecgoDamrm+wyD/uV1SQD8IwSJUw dkUdfm03NRjCNI0Utzs2xoMyiQpID5Jonx1WjZMYKceAsH8pqx6rRWJ5sq5gPSGSGjkZ D4hd5G8MKzzWkuHG69iNb5DU2oOlw/+WP/ZZraxIVItIIzPiBTMLTxdWbSkd3gfTgtOQ TG8ve8/fCfrMlfTKsfYmFEt1S8g+p3kRsdLQ/m5zaELsNuXl/H5mnaxj3XBEL+OHG228 vA9hqVvWqAPP5clDtCJ68/71QRzDCHZYK3uV3niT13hUUazPCWXxY0xDe6kaalDlb8cF dsZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806064; x=1709410864; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bRzpcpTlkocgklC/igIeXP7AAH24T8PbXBQTZ2YqBko=; b=YwUlcQwLPv3w7qk/G/nib8FFpDky6yhg7iAPrt21PMBW1t4Acd2agvAywJaG2fIzZi G6dEa6fNy7jM7lgmyCIlYUA1yFwGDIDt8ixBxb/vVZs+OpBXIrFnHi6kvHnV+ULNdyoG Ke9tP9/NkG5czOcV1Bm5ti0vo6r5VJioeWUHqasN7mMulOp4Ath3DAcv+0AYfad9WzBT wan1pez7dR0+qZZEtdY8d4mXF4/pXqSZkzULfnnXU18F8GzvsKv/XkOP+8lH8qthCE80 K7cwtthuOiedi5bZYh47b6ItrwX1DgXkRm0/jH0RFBMOXJu59jwsyjA75Xk4otx3Rj/Y CWeQ== X-Forwarded-Encrypted: i=1; AJvYcCWsZ34nEoxMXC0em7q5AMMALgd8ZfDTs2Q+nh19gldPjrkSFlV9WJqCKO5sKK+69zz2109CYd/WGod+CRkK5Q7ETSjovuP3Tf5lwQKa X-Gm-Message-State: AOJu0Yxy3BgrVIuCLIePRfECrpNH7EeFdeb7kUCHOydao98RIdQalYLz JD8H7FMcuqi5rr9K55voZsl+c9uG8tYWe+I3JdIbW2HBcWyUHQ/yvfbUlZF00zE= X-Google-Smtp-Source: AGHT+IHdr3BVt2CyrCrzGMJ5Kh3DUvKcHv+fa9gzXmAALOTHsIjD4YFJgQ0NSc7TzQkObjCSfABbYA== X-Received: by 2002:a54:448b:0:b0:3c1:377a:4641 with SMTP id v11-20020a54448b000000b003c1377a4641mr3051812oiv.24.1708806063814; Sat, 24 Feb 2024 12:21:03 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id bp4-20020a056808238400b003c19a459283sm132430oib.17.2024.02.24.12.21.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 12:21:03 -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 12/15] clk: samsung: Add CPU clock support for Exynos850 Date: Sat, 24 Feb 2024 14:20:50 -0600 Message-Id: <20240224202053.25313-13-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224202053.25313-1-semen.protsenko@linaro.org> References: <20240224202053.25313-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Implement CPU clock control for Exynos850 SoC. It follows the same procedure which is already implemented for other SoCs in clk-cpu.c: 1. Set the correct rate for the alternate parent (if needed) before switching to use it as the CPU clock 2. Switch to the alternate parent, so the CPU continues to get clocked while the PLL is being re-configured 3. Adjust the dividers for the CPU related buses (ACLK, ATCLK, etc) 4. Re-configure the PLL for the new CPU clock rate. It's done automatically, as the CPU clock rate change propagates to the PLL clock, because the CPU clock has CLK_SET_RATE_PARENT flag set in exynos_register_cpu_clock() 5. Once the PLL is locked, set it back as the CPU clock source 6. Set alternate parent clock rate back to max speed As in already existing clk-cpu.c code, the divider and mux clocks are configured in a low-level fashion (using direct register access instead of CCF API), to avoid affecting how DIV and MUX clock flags are declared in the actual clock driver (clk-exynos850.c). No functional change. This patch adds support for Exynos850 CPU clock, but doesn't enable it per se. Signed-off-by: Sam Protsenko --- Changes in v3: - Merged struct exynos850_cpuclk_regs fields into struct exynos_cpuclk_regs Changes in v2: - Changed .ctrl_base field to .base, to reflect changes made in previous commits drivers/clk/samsung/clk-cpu.c | 177 ++++++++++++++++++++++++++++++++++ drivers/clk/samsung/clk-cpu.h | 4 + 2 files changed, 181 insertions(+) diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index 0cf288138167..6ac884fccac6 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -29,6 +29,7 @@ * down in order to keep the output clock rate within the previous OPP lim= its. */ =20 +#include #include #include #include @@ -51,6 +52,8 @@ typedef int (*exynos_rate_change_fn_t)(struct clk_notifie= r_data *ndata, * @div_cpu1: offset of CPU DIV1 register (for modifying divider values) * @div_stat_cpu0: offset of CPU DIV0_STAT register (for checking DIV stat= us) * @div_stat_cpu1: offset of CPU DIV1_STAT register (for checking DIV stat= us) + * @mux: offset of MUX register for choosing CPU clock source + * @divs: offsets of DIV registers (ACLK, ATCLK, PCLKDBG and PERIPHCLK) */ struct exynos_cpuclk_regs { u32 mux_sel; @@ -59,6 +62,9 @@ struct exynos_cpuclk_regs { u32 div_cpu1; u32 div_stat_cpu0; u32 div_stat_cpu1; + + u32 mux; + u32 divs[4]; }; =20 /** @@ -397,6 +403,167 @@ static int exynos5433_cpuclk_post_rate_change(struct = clk_notifier_data *ndata, return 0; } =20 +/* ---- Exynos850 --------------------------------------------------------= --- */ + +#define E850_DIV_RATIO_MASK GENMASK(3, 0) +#define E850_BUSY_MASK BIT(16) + +/* Max time for divider or mux to stabilize, usec */ +#define E850_DIV_MUX_STAB_TIME 100 +/* OSCCLK clock rate, Hz */ +#define E850_OSCCLK (26 * MHZ) + +static const struct exynos_cpuclk_regs e850cl0_cpuclk_regs =3D { + .mux =3D 0x100c, + .divs =3D { 0x1800, 0x1808, 0x180c, 0x1810 }, +}; + +static const struct exynos_cpuclk_regs e850cl1_cpuclk_regs =3D { + .mux =3D 0x1000, + .divs =3D { 0x1800, 0x1808, 0x180c, 0x1810 }, +}; + +/* + * Set alternate parent rate to "rate" value or less. + * + * rate: Desired alt_parent rate, or 0 for max alt_parent rate + * + * Exynos850 doesn't have CPU clock divider in CMU_CPUCLx block (CMUREF di= vider + * doesn't affect CPU speed). So CPUCLx_SWITCH divider from CMU_TOP is used + * instead to adjust alternate parent speed. + * + * It's possible to use clk_set_max_rate() instead of this function, but it + * would set overly pessimistic rate values to alternate parent. + */ +static int exynos850_alt_parent_set_max_rate(const struct clk_hw *alt_pare= nt, + unsigned long rate) +{ + struct clk_hw *clk_div, *clk_divp; + unsigned long divp_rate, div_rate, div; + int ret; + + /* Divider from CMU_TOP */ + clk_div =3D clk_hw_get_parent(alt_parent); + if (!clk_div) + return -ENOENT; + /* Divider's parent from CMU_TOP */ + clk_divp =3D clk_hw_get_parent(clk_div); + if (!clk_divp) + return -ENOENT; + /* Divider input rate */ + divp_rate =3D clk_hw_get_rate(clk_divp); + if (!divp_rate) + return -EINVAL; + + /* Calculate new alt_parent rate for integer divider value */ + if (rate =3D=3D 0) + div =3D 1; + else + div =3D DIV_ROUND_UP(divp_rate, rate); + div_rate =3D DIV_ROUND_UP(divp_rate, div); + WARN_ON(div >=3D MAX_DIV); + + /* alt_parent will propagate this change up to the divider */ + ret =3D clk_set_rate(alt_parent->clk, div_rate); + if (ret) + return ret; + udelay(E850_DIV_MUX_STAB_TIME); + + return 0; +} + +/* Handler for pre-rate change notification from parent clock */ +static int exynos850_cpuclk_pre_rate_change(struct clk_notifier_data *ndat= a, + struct exynos_cpuclk *cpuclk) +{ + const unsigned int shifts[4] =3D { 16, 12, 8, 4 }; /* E850_CPU_DIV0() */ + const struct exynos_cpuclk_regs * const regs =3D cpuclk->chip->regs; + const struct exynos_cpuclk_cfg_data *cfg_data =3D cpuclk->cfg; + const struct clk_hw *alt_parent =3D cpuclk->alt_parent; + void __iomem *base =3D cpuclk->base; + unsigned long alt_prate =3D clk_hw_get_rate(alt_parent); + unsigned long flags; + u32 mux_reg; + size_t i; + int ret; + + /* No actions are needed when switching to or from OSCCLK parent */ + if (ndata->new_rate =3D=3D E850_OSCCLK || ndata->old_rate =3D=3D E850_OSC= CLK) + return 0; + + /* Find out the divider values to use for clock data */ + while ((cfg_data->prate * 1000) !=3D ndata->new_rate) { + if (cfg_data->prate =3D=3D 0) + return -EINVAL; + cfg_data++; + } + + /* + * If the old parent clock speed is less than the clock speed of + * the alternate parent, then it should be ensured that at no point + * the armclk speed is more than the old_prate until the dividers are + * set. Also workaround the issue of the dividers being set to lower + * values before the parent clock speed is set to new lower speed + * (this can result in too high speed of armclk output clocks). + */ + if (alt_prate > ndata->old_rate || ndata->old_rate > ndata->new_rate) { + unsigned long tmp_rate =3D min(ndata->old_rate, ndata->new_rate); + + ret =3D exynos850_alt_parent_set_max_rate(alt_parent, tmp_rate); + if (ret) + return ret; + } + + spin_lock_irqsave(cpuclk->lock, flags); + + /* Select the alternate parent */ + mux_reg =3D readl(base + regs->mux); + writel(mux_reg | 1, base + regs->mux); + wait_until_mux_stable(base + regs->mux, 16, 1, 0); + + /* Alternate parent is active now. Set the dividers */ + for (i =3D 0; i < ARRAY_SIZE(shifts); ++i) { + unsigned long div =3D (cfg_data->div0 >> shifts[i]) & 0xf; + u32 val; + + val =3D readl(base + regs->divs[i]); + val =3D (val & ~E850_DIV_RATIO_MASK) | div; + writel(val, base + regs->divs[i]); + wait_until_divider_stable(base + regs->divs[i], E850_BUSY_MASK); + } + + spin_unlock_irqrestore(cpuclk->lock, flags); + + return 0; +} + +/* Handler for post-rate change notification from parent clock */ +static int exynos850_cpuclk_post_rate_change(struct clk_notifier_data *nda= ta, + struct exynos_cpuclk *cpuclk) +{ + const struct exynos_cpuclk_regs * const regs =3D cpuclk->chip->regs; + const struct clk_hw *alt_parent =3D cpuclk->alt_parent; + void __iomem *base =3D cpuclk->base; + unsigned long flags; + u32 mux_reg; + + /* No actions are needed when switching to or from OSCCLK parent */ + if (ndata->new_rate =3D=3D E850_OSCCLK || ndata->old_rate =3D=3D E850_OSC= CLK) + return 0; + + spin_lock_irqsave(cpuclk->lock, flags); + + /* Select main parent (PLL) for mux */ + mux_reg =3D readl(base + regs->mux); + writel(mux_reg & ~1, base + regs->mux); + wait_until_mux_stable(base + regs->mux, 16, 1, 0); + + spin_unlock_irqrestore(cpuclk->lock, flags); + + /* Set alt_parent rate back to max */ + return exynos850_alt_parent_set_max_rate(alt_parent, 0); +} + /* -----------------------------------------------------------------------= --- */ =20 /* Common round rate callback usable for all types of CPU clocks */ @@ -459,6 +626,16 @@ static const struct exynos_cpuclk_chip exynos_clkcpu_c= hips[] =3D { .pre_rate_cb =3D exynos5433_cpuclk_pre_rate_change, .post_rate_cb =3D exynos5433_cpuclk_post_rate_change, }, + [CPUCLK_LAYOUT_E850_CL0] =3D { + .regs =3D &e850cl0_cpuclk_regs, + .pre_rate_cb =3D exynos850_cpuclk_pre_rate_change, + .post_rate_cb =3D exynos850_cpuclk_post_rate_change, + }, + [CPUCLK_LAYOUT_E850_CL1] =3D { + .regs =3D &e850cl1_cpuclk_regs, + .pre_rate_cb =3D exynos850_cpuclk_pre_rate_change, + .post_rate_cb =3D exynos850_cpuclk_post_rate_change, + }, }; =20 /* helper function to register a CPU clock */ diff --git a/drivers/clk/samsung/clk-cpu.h b/drivers/clk/samsung/clk-cpu.h index 4382ab005ad3..892843611b0a 100644 --- a/drivers/clk/samsung/clk-cpu.h +++ b/drivers/clk/samsung/clk-cpu.h @@ -17,10 +17,14 @@ * enum exynos_cpuclk_layout - CPU clock registers layout compatibility * @CPUCLK_LAYOUT_E4210: Exynos4210 compatible layout * @CPUCLK_LAYOUT_E5433: Exynos5433 compatible layout + * @CPUCLK_LAYOUT_E850_CL0: Exynos850 cluster 0 compatible layout + * @CPUCLK_LAYOUT_E850_CL1: Exynos850 cluster 1 compatible layout */ enum exynos_cpuclk_layout { CPUCLK_LAYOUT_E4210, CPUCLK_LAYOUT_E5433, + CPUCLK_LAYOUT_E850_CL0, + CPUCLK_LAYOUT_E850_CL1, }; =20 /** --=20 2.39.2 From nobody Sat Feb 7 19:04:16 2026 Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99A55524C2 for ; Sat, 24 Feb 2024 20:21:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806069; cv=none; b=aAuIujfqHtnq7ZdGd2/Evu7GSFP46WuXF/cgzH3Hn95J3YHVTNt261F+yr1/iNytvR7mfYGJejxsngCsdiirStfuzcbADz8VwrMRntf617eZS/xzms+8+yJE++QW9cB0yc/+cVIEzOEhIVBtsqXg5bINVXS+VxfujCX9bn1ue98= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806069; c=relaxed/simple; bh=KNeDjg6z7m0neE4OIePvaN8WwBzJmJ9x6TDOEsGKkpM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NJOiNbJ68KCDo/efl6ol6D2eUj+b/wjflIbNIofy0t/QHqecfWv30M3lxfCbNtsnd8ZvXCBo4uCBxkZS36c2bvPlZpxzaqyY2PklCXbJmerqGhah8KyA3LZCBLqexEg7yxVBIgkJXqpP0+7qv4s36wn8Fie3pTzouHgy4kzas+w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=r8LOTh4C; arc=none smtp.client-ip=209.85.167.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="r8LOTh4C" Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3c13410a319so1257201b6e.3 for ; Sat, 24 Feb 2024 12:21:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708806064; x=1709410864; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iIIGoVTb2BIabxpFU1BFV2MUUL9rjPCj9ysOp0U/Roc=; b=r8LOTh4CF20dAQVF/9aqIaUdndmbCVt8upqKeQ6lKvTyIn38G0c/RKR6+/7u0Znt0m HnU0JSC7HKm3i5BIxdW7X+IycAmkbVi8lhmLJ79LUDbZHVYZjzALV6IfR2glKUjBz9P5 NCVNNImATY3O2lOA04ByAPT7CqhkfOppIS/21E7uvOOqmyew/xbpfXVX3gDPfPkfb2QO 1P4LvVKMI0tqtr1KYTlK7jRMiXsNEF2YDud0FKlTZxjbiFhD5Us2FDZ23jLrMeZsI0Rm 8nzamEre4Ds/ObbsNqzVP+3tXLXSZ+WVX4zlHRfjYRTSBrTEEfVRlJV9Fz6BjaMcirtw mACw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806064; x=1709410864; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iIIGoVTb2BIabxpFU1BFV2MUUL9rjPCj9ysOp0U/Roc=; b=GpembrzMny6Z1qUGMNsucNBKHpSc1w9yiILUhimv8mepPgxUQEfG670gF1AzT0VvU9 j5b9MjJJySPv53AWUyCDo9vbOAeoRdSVKTl+VlEH1d9usJPftipU/9VgnpBKakvjRJzM n9deCAT5/esbVUcaZo47XJ+Rwfk+7k+bmptCQOBQ5I9vl3UXYXM+6X7EewZV2MNBALUa x5DsuSaHBnojSiNBUN0YZ8qYl6zgWhE6DvNamr35rrpgb3rTBlhWQssHcJtepSd/e3bA QI2FWuzr4wR9PQV4WAq1Yi1X+WuHdUj2Mu41HsrhqTWZtORlEZJKAFP8yjNl3ZJvSJHI +zqQ== X-Forwarded-Encrypted: i=1; AJvYcCVc387d9OVPpE64FDRIqIK+tvW8dxTkyEFLPpopuWfmXxX++lAlW/AnuVOeqNpPeOY6Ba/bYEo89rUVS19SR5YvBtwGBOl1LEjGsjKD X-Gm-Message-State: AOJu0Yyk7Glj/08xxqrkSEijcJ+FfCGVMtXJr42bSY7RDUCsZ+x79K90 deQLLKZU7s6tsaz4tQ+77GHEoW7b2tghfMlr6HPx+v9O9Xu7VGhDk9t/PEzNIVw= X-Google-Smtp-Source: AGHT+IFdE43PGQAbJJsQ/m9VfIt4oEQPBnjVkvIxpCyc60wifT658At/vFcVoYSAwct1ffVNjxN8Tg== X-Received: by 2002:a05:6808:114e:b0:3c0:349d:f4f4 with SMTP id u14-20020a056808114e00b003c0349df4f4mr4047530oiu.28.1708806064510; Sat, 24 Feb 2024 12:21:04 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 2-20020aca1002000000b003c1404b9b3fsm375093oiq.27.2024.02.24.12.21.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 12:21:04 -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 13/15] clk: samsung: Implement manual PLL control for ARM64 SoCs Date: Sat, 24 Feb 2024 14:20:51 -0600 Message-Id: <20240224202053.25313-14-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224202053.25313-1-semen.protsenko@linaro.org> References: <20240224202053.25313-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Some ARM64 Exynos chips are capable to control PLL clocks automatically. For those chips, whether the PLL is controlled automatically or manually is chosen in PLL_CON1 register with next bits: [28] ENABLE_AUTOMATIC_CLKGATING [1] MANUAL_PLL_CTRL [0] AUTO_PLL_CTRL The bl2 bootloader sets 0x10000001 value for some PLL_CON1 registers, which means any attempt to control those PLLs manually (e.g. disabling/enabling those PLLs or changing MUX parent clocks) would lead to PLL lock timeout with error message like this: Could not lock PLL ... At the moment, all Samsung clock drivers implement manual clock control. So in order to make it possible to control PLLs, corresponding PLL_CON1 registers should be set to 0x2 first. Some older ARM64 chips don't implement the automatic clock control though. It also might be desirable to configure some PLLs for manual control, while keeping the default configuration for the rest. So it'd convenient to choose this PLL mode for each CMU separately. Introduce .manual_plls field to CMU structure to choose the PLL control mode. Because it'll be initialized with "false" in all existing CMU structures by default, it won't affect any existing clock drivers, allowing for this feature to be enabled gradually when it's needed with no change for the rest of users. In case .manual_plls is set, set PLL_CON1 registers to manual control, akin to what's already done for gate clocks in exynos_arm64_init_clocks(). Of course, PLL_CON1 registers should be added to corresponding struct samsung_cmu_info::clk_regs array to make sure they get initialized. No functional change. This patch adds a feature, but doesn't enable it for any users. Signed-off-by: Sam Protsenko --- Changes in v3: - none Changes in v2: - none drivers/clk/samsung/clk-exynos-arm64.c | 44 +++++++++++++++++--------- drivers/clk/samsung/clk.h | 4 +++ 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos-arm64.c b/drivers/clk/samsung/c= lk-exynos-arm64.c index 6fb7194df7ab..55490209b9a9 100644 --- a/drivers/clk/samsung/clk-exynos-arm64.c +++ b/drivers/clk/samsung/clk-exynos-arm64.c @@ -25,6 +25,19 @@ #define GATE_OFF_START 0x2000 #define GATE_OFF_END 0x2fff =20 +/* PLL CON register offsets range */ +#define PLL_CON_START 0x100 +#define PLL_CON_END 0x600 + +/* PLL register bits */ +#define PLL_CON1_MANUAL BIT(1) + +/* Helper macros to check for particular clock regiter by its offset */ +#define IS_GATE_REG(o) ((o) >=3D GATE_OFF_START && (o) <=3D GATE_OFF_END) +#define IS_PLL_CONx_REG(o) ((o) >=3D PLL_CON_START && (o) <=3D PLL_CON_END) +#define IS_PLL_CON1_REG(o) \ + (IS_PLL_CONx_REG(o) && ((o) & 0xf) =3D=3D 0x4 && !((o) & 0x10)) + struct exynos_arm64_cmu_data { struct samsung_clk_reg_dump *clk_save; unsigned int nr_clk_save; @@ -40,15 +53,16 @@ struct exynos_arm64_cmu_data { =20 /** * exynos_arm64_init_clocks - Set clocks initial configuration - * @np: CMU device tree node with "reg" property (CMU addr) - * @reg_offs: Register offsets array for clocks to init - * @reg_offs_len: Number of register offsets in reg_offs array + * @np: CMU device tree node with "reg" property (CMU addr) + * @cmu: CMU data * - * Set manual control mode for all gate clocks. + * Set manual control mode for all gate and PLL clocks. */ static void __init exynos_arm64_init_clocks(struct device_node *np, - const unsigned long *reg_offs, size_t reg_offs_len) + const struct samsung_cmu_info *cmu) { + const unsigned long *reg_offs =3D cmu->clk_regs; + size_t reg_offs_len =3D cmu->nr_clk_regs; void __iomem *reg_base; size_t i; =20 @@ -60,14 +74,14 @@ static void __init exynos_arm64_init_clocks(struct devi= ce_node *np, void __iomem *reg =3D reg_base + reg_offs[i]; u32 val; =20 - /* Modify only gate clock registers */ - if (reg_offs[i] < GATE_OFF_START || reg_offs[i] > GATE_OFF_END) - continue; - - val =3D readl(reg); - val |=3D GATE_MANUAL; - val &=3D ~GATE_ENABLE_HWACG; - writel(val, reg); + if (cmu->manual_plls && IS_PLL_CON1_REG(reg_offs[i])) { + writel(PLL_CON1_MANUAL, reg); + } else if (IS_GATE_REG(reg_offs[i])) { + val =3D readl(reg); + val |=3D GATE_MANUAL; + val &=3D ~GATE_ENABLE_HWACG; + writel(val, reg); + } } =20 iounmap(reg_base); @@ -177,7 +191,7 @@ void __init exynos_arm64_register_cmu(struct device *de= v, pr_err("%s: could not enable bus clock %s; err =3D %d\n", __func__, cmu->clk_name, err); =20 - exynos_arm64_init_clocks(np, cmu->clk_regs, cmu->nr_clk_regs); + exynos_arm64_init_clocks(np, cmu); samsung_cmu_register_one(np, cmu); } =20 @@ -224,7 +238,7 @@ int __init exynos_arm64_register_cmu_pm(struct platform= _device *pdev, __func__, cmu->clk_name, ret); =20 if (set_manual) - exynos_arm64_init_clocks(np, cmu->clk_regs, cmu->nr_clk_regs); + exynos_arm64_init_clocks(np, cmu); =20 reg_base =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(reg_base)) diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h index a763309e6f12..a70bd7cce39f 100644 --- a/drivers/clk/samsung/clk.h +++ b/drivers/clk/samsung/clk.h @@ -330,6 +330,7 @@ struct samsung_clock_reg_cache { * @suspend_regs: list of clock registers to set before suspend * @nr_suspend_regs: count of clock registers in @suspend_regs * @clk_name: name of the parent clock needed for CMU register access + * @manual_plls: Enable manual control for PLL clocks */ struct samsung_cmu_info { const struct samsung_pll_clock *pll_clks; @@ -354,6 +355,9 @@ struct samsung_cmu_info { const struct samsung_clk_reg_dump *suspend_regs; unsigned int nr_suspend_regs; const char *clk_name; + + /* ARM64 Exynos CMUs */ + bool manual_plls; }; =20 struct samsung_clk_provider *samsung_clk_init(struct device *dev, --=20 2.39.2 From nobody Sat Feb 7 19:04:16 2026 Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84E7752F6D for ; Sat, 24 Feb 2024 20:21:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806071; cv=none; b=jLChBoNTC5RIeQCsSqwe+4/RucZcMPDE2eY0XMi/KDJfHK+FI1VVDpxKs/9jqAG2ZlLOnTaOMDJ8sChQ3nx1KO+8e+4kautv7n6p3nNvoiv2FknpuX3v2pSW2lbC1g7lYo/EbE2IYci+jElDGkGzUOUIo5VTjhcRI8DNFrvGIL8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806071; c=relaxed/simple; bh=WdxFPOGra9PzrvfGTjysb1T6mIS+18DaenHlHLOCudI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Oorut7O+2En29mVi++TvTjgOxyp8UR5+WdpSj58lvMF5STgUi01x4YokNxX2r/LIceYKZLAdLwojB+NpBC4s1RlpZZPIFDXkbU/kBbnXDDKMFImksg9aUWcUQf0E7LBKwoT9AHgD1QKBRazVegNxXqAyUhlbS44VuFpfVLdy3Cc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=rUayYpNE; arc=none smtp.client-ip=209.85.160.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rUayYpNE" Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-21fa872dce3so911682fac.2 for ; Sat, 24 Feb 2024 12:21:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708806065; x=1709410865; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0cB7fDb7g9CThp7SOjeT23w0HjAttE252MakP3aMPzY=; b=rUayYpNEHt8VdOcfhgeViuXJ1I0oXoJcziDTsJ40/bQ6XuASLmX6ImNpWod2RPgfvx kXhPz093GMmi4fhTx2OxU796qED8CfFQXkIiL8xWx8dcnB9rE1svsJiWlg4/xvuy+8ie pa1BhOakWLbVZT9m+l/ZMoJ/b1IQ562cwUK37qNI68TRX5vDtl+U8bN5eV9cDc3fZU/4 JA7O/D54dT7IolbnoxT1n9QG2MY+bR3jXjJCX693qzqhOFWBXaU/DhHu858FwUWuEv/K 7Us27b9d/KfZXxDTAEUdU8ZewrFX3N/cjYUhcgB9GeN9CDXxkT9Uj9EE2loSYC/qXjOO e+xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806065; x=1709410865; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0cB7fDb7g9CThp7SOjeT23w0HjAttE252MakP3aMPzY=; b=BJMiUAj2k7AR1jG6ltT8OsyUy1Q5XbutCoivAU7JNx+DnnMXIP8sa0dsTCy/y+CTzC MbmrrYwOz24ca9xXuCs3LUYxeeKkVLSWD21atkaIVosAzhlCz6MnNrwy0otJZDZpY+hp 5uXa11Zh5Tm6W++P/Non+By7qpzaIvEH9h3r1Y5GruldH9NX8+hNumM7Bjvr1x1T4CpO qWMh45R9AJkrK4TTM+ymv3vgHM2O4tlfUPMLbpGuxqq1N1nwVKa62C0XTY4x4GtZ7ual 9OtdNxHx1MJgBIa1EvJZzzLUA/fdNaJ1x4SvUggVOCXhAr99COF18sMO5Dff3xzq0zuU DYwg== X-Forwarded-Encrypted: i=1; AJvYcCWyhV1hs2sXVColwuFm5tRW+0q9x2CtSW1nfHhRcNdsC2/LuCgXvQgZUnYa3hYqDNO2brcTZm5w9oTGAM9KhM4HYwn53DiJ7DNXusWu X-Gm-Message-State: AOJu0Yycu5B1I7qnm6O/ObqbP6F8IQuw+Te28K+zYIksi5d9Ku5PoPz9 TyXxZknhqPCX0Mt/47y0YdfA6UyHNyoIBLtdevtiiZFGQS0ScUm1MW6WCdreJQ4= X-Google-Smtp-Source: AGHT+IH/wSq5ERqaxErUek27eNekMzGTjPfrROSjMiyxbMKx6654eKffWoSxcuTl7kTbEjpVitWGEA== X-Received: by 2002:a05:6870:164d:b0:21e:a94b:e80 with SMTP id c13-20020a056870164d00b0021ea94b0e80mr3544255oae.18.1708806065302; Sat, 24 Feb 2024 12:21:05 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id zf2-20020a0568716a8200b0021ef23c342fsm577256oab.28.2024.02.24.12.21.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 12:21:04 -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 14/15] clk: samsung: exynos850: Add CMU_CPUCL0 and CMU_CPUCL1 Date: Sat, 24 Feb 2024 14:20:52 -0600 Message-Id: <20240224202053.25313-15-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224202053.25313-1-semen.protsenko@linaro.org> References: <20240224202053.25313-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Implement support for CPU clock management units: - CMU_CPUCL0: clocks for cluster 0: 4 x Cortex-A55 (cpu0..cpu3) - CMU_CPUCL1: clocks for cluster 1: 4 x Cortex-A55 (cpu4..cpu7) CPU PLLs are generating main CPU clocks for each cluster, and there are alternate ("switch") clocks that can be used temporarily while re-configuring the PLL for a new rate. ACLK, ATCLK, PCLKDBG and PERIPHCLK clocks are driving corresponding buses. CLK_CLUSTERx_SCLK are actual leaf CPU clocks and should be used to change CPU rates. Also some CoreSight clocks can be derived from DBG_USER (debug clock). PLL table was extracted from ECT table. ECT stands for "Exynos Characteristic Table", it's a Samsung specific binary data populated by BL2 bootloader in RAM at 0x90000000 address, containing PLL tables for various CMUs and other hardware specific information. The particular PLL type used in CMU_CPUCL0 and CMU_CPUCL1 (pll0822x) is an integer PLL with middle FVCO. The equation to calculate its output rate is: fout =3D fin * M / (P*2^S) where: fin =3D 26 MHz (OSCCLK frequency) M =3D 64..1023 P =3D 1..63 S =3D 0..6 The PLL table tries to keep "P" value low to reduce the locking time, which for pll0822x is "t =3D P * 150" (in OSCCLK cycles). Signed-off-by: Sam Protsenko --- Changes in v3: - none Changes in v2: - none drivers/clk/samsung/clk-exynos850.c | 440 +++++++++++++++++++++++++++- 1 file changed, 439 insertions(+), 1 deletion(-) diff --git a/drivers/clk/samsung/clk-exynos850.c b/drivers/clk/samsung/clk-= exynos850.c index 82cfa22c0788..6215471c4ac6 100644 --- a/drivers/clk/samsung/clk-exynos850.c +++ b/drivers/clk/samsung/clk-exynos850.c @@ -14,13 +14,16 @@ #include =20 #include "clk.h" +#include "clk-cpu.h" #include "clk-exynos-arm64.h" =20 /* NOTE: Must be equal to the last clock ID increased by one */ -#define CLKS_NR_TOP (CLK_DOUT_G3D_SWITCH + 1) +#define CLKS_NR_TOP (CLK_DOUT_CPUCL1_SWITCH + 1) #define CLKS_NR_APM (CLK_GOUT_SYSREG_APM_PCLK + 1) #define CLKS_NR_AUD (CLK_GOUT_AUD_CMU_AUD_PCLK + 1) #define CLKS_NR_CMGP (CLK_GOUT_SYSREG_CMGP_PCLK + 1) +#define CLKS_NR_CPUCL0 (CLK_CLUSTER0_SCLK + 1) +#define CLKS_NR_CPUCL1 (CLK_CLUSTER1_SCLK + 1) #define CLKS_NR_G3D (CLK_GOUT_G3D_SYSREG_PCLK + 1) #define CLKS_NR_HSI (CLK_GOUT_HSI_CMU_HSI_PCLK + 1) #define CLKS_NR_IS (CLK_GOUT_IS_SYSREG_PCLK + 1) @@ -47,6 +50,10 @@ #define CLK_CON_MUX_MUX_CLKCMU_CORE_CCI 0x1018 #define CLK_CON_MUX_MUX_CLKCMU_CORE_MMC_EMBD 0x101c #define CLK_CON_MUX_MUX_CLKCMU_CORE_SSS 0x1020 +#define CLK_CON_MUX_MUX_CLKCMU_CPUCL0_DBG 0x1024 +#define CLK_CON_MUX_MUX_CLKCMU_CPUCL0_SWITCH 0x1028 +#define CLK_CON_MUX_MUX_CLKCMU_CPUCL1_DBG 0x102c +#define CLK_CON_MUX_MUX_CLKCMU_CPUCL1_SWITCH 0x1030 #define CLK_CON_MUX_MUX_CLKCMU_DPU 0x1034 #define CLK_CON_MUX_MUX_CLKCMU_G3D_SWITCH 0x1038 #define CLK_CON_MUX_MUX_CLKCMU_HSI_BUS 0x103c @@ -69,6 +76,10 @@ #define CLK_CON_DIV_CLKCMU_CORE_CCI 0x1824 #define CLK_CON_DIV_CLKCMU_CORE_MMC_EMBD 0x1828 #define CLK_CON_DIV_CLKCMU_CORE_SSS 0x182c +#define CLK_CON_DIV_CLKCMU_CPUCL0_DBG 0x1830 +#define CLK_CON_DIV_CLKCMU_CPUCL0_SWITCH 0x1834 +#define CLK_CON_DIV_CLKCMU_CPUCL1_DBG 0x1838 +#define CLK_CON_DIV_CLKCMU_CPUCL1_SWITCH 0x183c #define CLK_CON_DIV_CLKCMU_DPU 0x1840 #define CLK_CON_DIV_CLKCMU_G3D_SWITCH 0x1844 #define CLK_CON_DIV_CLKCMU_HSI_BUS 0x1848 @@ -97,6 +108,10 @@ #define CLK_CON_GAT_GATE_CLKCMU_CORE_CCI 0x2020 #define CLK_CON_GAT_GATE_CLKCMU_CORE_MMC_EMBD 0x2024 #define CLK_CON_GAT_GATE_CLKCMU_CORE_SSS 0x2028 +#define CLK_CON_GAT_GATE_CLKCMU_CPUCL0_DBG 0x202c +#define CLK_CON_GAT_GATE_CLKCMU_CPUCL0_SWITCH 0x2030 +#define CLK_CON_GAT_GATE_CLKCMU_CPUCL1_DBG 0x2034 +#define CLK_CON_GAT_GATE_CLKCMU_CPUCL1_SWITCH 0x2038 #define CLK_CON_GAT_GATE_CLKCMU_DPU 0x203c #define CLK_CON_GAT_GATE_CLKCMU_G3D_SWITCH 0x2040 #define CLK_CON_GAT_GATE_CLKCMU_HSI_BUS 0x2044 @@ -130,6 +145,10 @@ static const unsigned long top_clk_regs[] __initconst = =3D { CLK_CON_MUX_MUX_CLKCMU_CORE_CCI, CLK_CON_MUX_MUX_CLKCMU_CORE_MMC_EMBD, CLK_CON_MUX_MUX_CLKCMU_CORE_SSS, + CLK_CON_MUX_MUX_CLKCMU_CPUCL0_DBG, + CLK_CON_MUX_MUX_CLKCMU_CPUCL0_SWITCH, + CLK_CON_MUX_MUX_CLKCMU_CPUCL1_DBG, + CLK_CON_MUX_MUX_CLKCMU_CPUCL1_SWITCH, CLK_CON_MUX_MUX_CLKCMU_DPU, CLK_CON_MUX_MUX_CLKCMU_G3D_SWITCH, CLK_CON_MUX_MUX_CLKCMU_HSI_BUS, @@ -152,6 +171,10 @@ static const unsigned long top_clk_regs[] __initconst = =3D { CLK_CON_DIV_CLKCMU_CORE_CCI, CLK_CON_DIV_CLKCMU_CORE_MMC_EMBD, CLK_CON_DIV_CLKCMU_CORE_SSS, + CLK_CON_DIV_CLKCMU_CPUCL0_DBG, + CLK_CON_DIV_CLKCMU_CPUCL0_SWITCH, + CLK_CON_DIV_CLKCMU_CPUCL1_DBG, + CLK_CON_DIV_CLKCMU_CPUCL1_SWITCH, CLK_CON_DIV_CLKCMU_DPU, CLK_CON_DIV_CLKCMU_G3D_SWITCH, CLK_CON_DIV_CLKCMU_HSI_BUS, @@ -180,6 +203,10 @@ static const unsigned long top_clk_regs[] __initconst = =3D { CLK_CON_GAT_GATE_CLKCMU_CORE_CCI, CLK_CON_GAT_GATE_CLKCMU_CORE_MMC_EMBD, CLK_CON_GAT_GATE_CLKCMU_CORE_SSS, + CLK_CON_GAT_GATE_CLKCMU_CPUCL0_DBG, + CLK_CON_GAT_GATE_CLKCMU_CPUCL0_SWITCH, + CLK_CON_GAT_GATE_CLKCMU_CPUCL1_DBG, + CLK_CON_GAT_GATE_CLKCMU_CPUCL1_SWITCH, CLK_CON_GAT_GATE_CLKCMU_DPU, CLK_CON_GAT_GATE_CLKCMU_G3D_SWITCH, CLK_CON_GAT_GATE_CLKCMU_HSI_BUS, @@ -234,6 +261,14 @@ PNAME(mout_core_mmc_embd_p) =3D { "oscclk", "dout_shar= ed0_div2", "oscclk", "oscclk" }; PNAME(mout_core_sss_p) =3D { "dout_shared0_div3", "dout_shared1_div3", "dout_shared0_div4", "dout_shared1_div4" }; +/* List of parent clocks for Muxes in CMU_TOP: for CMU_CPUCL0 */ +PNAME(mout_cpucl0_switch_p) =3D { "fout_shared0_pll", "fout_shared1_pll", + "dout_shared0_div2", "dout_shared1_div2" }; +PNAME(mout_cpucl0_dbg_p) =3D { "dout_shared0_div4", "dout_shared1_div4" }; +/* List of parent clocks for Muxes in CMU_TOP: for CMU_CPUCL1 */ +PNAME(mout_cpucl1_switch_p) =3D { "fout_shared0_pll", "fout_shared1_pll", + "dout_shared0_div2", "dout_shared1_div2" }; +PNAME(mout_cpucl1_dbg_p) =3D { "dout_shared0_div4", "dout_shared1_div4" }; /* List of parent clocks for Muxes in CMU_TOP: for CMU_G3D */ PNAME(mout_g3d_switch_p) =3D { "dout_shared0_div2", "dout_shared1_div2", "dout_shared0_div3", "dout_shared1_div3" }; @@ -300,6 +335,18 @@ static const struct samsung_mux_clock top_mux_clks[] _= _initconst =3D { MUX(CLK_MOUT_CORE_SSS, "mout_core_sss", mout_core_sss_p, CLK_CON_MUX_MUX_CLKCMU_CORE_SSS, 0, 2), =20 + /* CPUCL0 */ + MUX(CLK_MOUT_CPUCL0_DBG, "mout_cpucl0_dbg", mout_cpucl0_dbg_p, + CLK_CON_MUX_MUX_CLKCMU_CPUCL0_DBG, 0, 1), + MUX(CLK_MOUT_CPUCL0_SWITCH, "mout_cpucl0_switch", mout_cpucl0_switch_p, + CLK_CON_MUX_MUX_CLKCMU_CPUCL0_SWITCH, 0, 2), + + /* CPUCL1 */ + MUX(CLK_MOUT_CPUCL1_DBG, "mout_cpucl1_dbg", mout_cpucl1_dbg_p, + CLK_CON_MUX_MUX_CLKCMU_CPUCL1_DBG, 0, 1), + MUX(CLK_MOUT_CPUCL1_SWITCH, "mout_cpucl1_switch", mout_cpucl1_switch_p, + CLK_CON_MUX_MUX_CLKCMU_CPUCL1_SWITCH, 0, 2), + /* DPU */ MUX(CLK_MOUT_DPU, "mout_dpu", mout_dpu_p, CLK_CON_MUX_MUX_CLKCMU_DPU, 0, 2), @@ -378,6 +425,18 @@ static const struct samsung_div_clock top_div_clks[] _= _initconst =3D { DIV(CLK_DOUT_CORE_SSS, "dout_core_sss", "gout_core_sss", CLK_CON_DIV_CLKCMU_CORE_SSS, 0, 4), =20 + /* CPUCL0 */ + DIV(CLK_DOUT_CPUCL0_DBG, "dout_cpucl0_dbg", "gout_cpucl0_dbg", + CLK_CON_DIV_CLKCMU_CPUCL0_DBG, 0, 3), + DIV(CLK_DOUT_CPUCL0_SWITCH, "dout_cpucl0_switch", "gout_cpucl0_switch", + CLK_CON_DIV_CLKCMU_CPUCL0_SWITCH, 0, 3), + + /* CPUCL1 */ + DIV(CLK_DOUT_CPUCL1_DBG, "dout_cpucl1_dbg", "gout_cpucl1_dbg", + CLK_CON_DIV_CLKCMU_CPUCL1_DBG, 0, 3), + DIV(CLK_DOUT_CPUCL1_SWITCH, "dout_cpucl1_switch", "gout_cpucl1_switch", + CLK_CON_DIV_CLKCMU_CPUCL1_SWITCH, 0, 3), + /* DPU */ DIV(CLK_DOUT_DPU, "dout_dpu", "gout_dpu", CLK_CON_DIV_CLKCMU_DPU, 0, 4), @@ -442,6 +501,18 @@ static const struct samsung_gate_clock top_gate_clks[]= __initconst =3D { GATE(CLK_GOUT_AUD, "gout_aud", "mout_aud", CLK_CON_GAT_GATE_CLKCMU_AUD, 21, 0, 0), =20 + /* CPUCL0 */ + GATE(CLK_GOUT_CPUCL0_DBG, "gout_cpucl0_dbg", "mout_cpucl0_dbg", + CLK_CON_GAT_GATE_CLKCMU_CPUCL0_DBG, 21, 0, 0), + GATE(CLK_GOUT_CPUCL0_SWITCH, "gout_cpucl0_switch", "mout_cpucl0_switch", + CLK_CON_GAT_GATE_CLKCMU_CPUCL0_SWITCH, 21, 0, 0), + + /* CPUCL1 */ + GATE(CLK_GOUT_CPUCL1_DBG, "gout_cpucl1_dbg", "mout_cpucl1_dbg", + CLK_CON_GAT_GATE_CLKCMU_CPUCL1_DBG, 21, 0, 0), + GATE(CLK_GOUT_CPUCL1_SWITCH, "gout_cpucl1_switch", "mout_cpucl1_switch", + CLK_CON_GAT_GATE_CLKCMU_CPUCL1_SWITCH, 21, 0, 0), + /* DPU */ GATE(CLK_GOUT_DPU, "gout_dpu", "mout_dpu", CLK_CON_GAT_GATE_CLKCMU_DPU, 21, 0, 0), @@ -1030,6 +1101,373 @@ static const struct samsung_cmu_info cmgp_cmu_info = __initconst =3D { .clk_name =3D "gout_clkcmu_cmgp_bus", }; =20 +/* ---- CMU_CPUCL0 -------------------------------------------------------= --- */ + +/* Register Offset definitions for CMU_CPUCL0 (0x10900000) */ +#define PLL_LOCKTIME_PLL_CPUCL0 0x0000 +#define PLL_CON0_PLL_CPUCL0 0x0100 +#define PLL_CON1_PLL_CPUCL0 0x0104 +#define PLL_CON3_PLL_CPUCL0 0x010c +#define PLL_CON0_MUX_CLKCMU_CPUCL0_DBG_USER 0x0600 +#define PLL_CON0_MUX_CLKCMU_CPUCL0_SWITCH_USER 0x0610 +#define CLK_CON_MUX_MUX_CLK_CPUCL0_PLL 0x100c +#define CLK_CON_DIV_DIV_CLK_CLUSTER0_ACLK 0x1800 +#define CLK_CON_DIV_DIV_CLK_CLUSTER0_ATCLK 0x1808 +#define CLK_CON_DIV_DIV_CLK_CLUSTER0_PCLKDBG 0x180c +#define CLK_CON_DIV_DIV_CLK_CLUSTER0_PERIPHCLK 0x1810 +#define CLK_CON_DIV_DIV_CLK_CPUCL0_CMUREF 0x1814 +#define CLK_CON_DIV_DIV_CLK_CPUCL0_CPU 0x1818 +#define CLK_CON_DIV_DIV_CLK_CPUCL0_PCLK 0x181c +#define CLK_CON_GAT_CLK_CPUCL0_CLUSTER0_ATCLK 0x2000 +#define CLK_CON_GAT_CLK_CPUCL0_CLUSTER0_PCLK 0x2004 +#define CLK_CON_GAT_CLK_CPUCL0_CLUSTER0_PERIPHCLK 0x2008 +#define CLK_CON_GAT_CLK_CPUCL0_CLUSTER0_SCLK 0x200c +#define CLK_CON_GAT_CLK_CPUCL0_CMU_CPUCL0_PCLK 0x2010 +#define CLK_CON_GAT_GATE_CLK_CPUCL0_CPU 0x2020 + +static const unsigned long cpucl0_clk_regs[] __initconst =3D { + PLL_LOCKTIME_PLL_CPUCL0, + PLL_CON0_PLL_CPUCL0, + PLL_CON1_PLL_CPUCL0, + PLL_CON3_PLL_CPUCL0, + PLL_CON0_MUX_CLKCMU_CPUCL0_DBG_USER, + PLL_CON0_MUX_CLKCMU_CPUCL0_SWITCH_USER, + CLK_CON_MUX_MUX_CLK_CPUCL0_PLL, + CLK_CON_DIV_DIV_CLK_CLUSTER0_ACLK, + CLK_CON_DIV_DIV_CLK_CLUSTER0_ATCLK, + CLK_CON_DIV_DIV_CLK_CLUSTER0_PCLKDBG, + CLK_CON_DIV_DIV_CLK_CLUSTER0_PERIPHCLK, + CLK_CON_DIV_DIV_CLK_CPUCL0_CMUREF, + CLK_CON_DIV_DIV_CLK_CPUCL0_CPU, + CLK_CON_DIV_DIV_CLK_CPUCL0_PCLK, + CLK_CON_GAT_CLK_CPUCL0_CLUSTER0_ATCLK, + CLK_CON_GAT_CLK_CPUCL0_CLUSTER0_PCLK, + CLK_CON_GAT_CLK_CPUCL0_CLUSTER0_PERIPHCLK, + CLK_CON_GAT_CLK_CPUCL0_CLUSTER0_SCLK, + CLK_CON_GAT_CLK_CPUCL0_CMU_CPUCL0_PCLK, + CLK_CON_GAT_GATE_CLK_CPUCL0_CPU, +}; + +/* List of parent clocks for Muxes in CMU_CPUCL0 */ +PNAME(mout_pll_cpucl0_p) =3D { "oscclk", "fout_cpucl0_pll" }; +PNAME(mout_cpucl0_switch_user_p) =3D { "oscclk", "dout_cpucl0_switch" }; +PNAME(mout_cpucl0_dbg_user_p) =3D { "oscclk", "dout_cpucl0_dbg" }; +PNAME(mout_cpucl0_pll_p) =3D { "mout_pll_cpucl0", + "mout_cpucl0_switch_user" }; + +static const struct samsung_pll_rate_table cpu_pll_rates[] __initconst =3D= { + PLL_35XX_RATE(26 * MHZ, 2210000000U, 255, 3, 0), + PLL_35XX_RATE(26 * MHZ, 2106000000U, 243, 3, 0), + PLL_35XX_RATE(26 * MHZ, 2002000000U, 231, 3, 0), + PLL_35XX_RATE(26 * MHZ, 1846000000U, 213, 3, 0), + PLL_35XX_RATE(26 * MHZ, 1742000000U, 201, 3, 0), + PLL_35XX_RATE(26 * MHZ, 1586000000U, 183, 3, 0), + PLL_35XX_RATE(26 * MHZ, 1456000000U, 168, 3, 0), + PLL_35XX_RATE(26 * MHZ, 1300000000U, 150, 3, 0), + PLL_35XX_RATE(26 * MHZ, 1157000000U, 267, 3, 1), + PLL_35XX_RATE(26 * MHZ, 1053000000U, 243, 3, 1), + PLL_35XX_RATE(26 * MHZ, 949000000U, 219, 3, 1), + PLL_35XX_RATE(26 * MHZ, 806000000U, 186, 3, 1), + PLL_35XX_RATE(26 * MHZ, 650000000U, 150, 3, 1), + PLL_35XX_RATE(26 * MHZ, 546000000U, 252, 3, 2), + PLL_35XX_RATE(26 * MHZ, 442000000U, 204, 3, 2), + PLL_35XX_RATE(26 * MHZ, 351000000U, 162, 3, 2), + PLL_35XX_RATE(26 * MHZ, 247000000U, 114, 3, 2), + PLL_35XX_RATE(26 * MHZ, 182000000U, 168, 3, 3), + PLL_35XX_RATE(26 * MHZ, 130000000U, 120, 3, 3), +}; + +static const struct samsung_pll_clock cpucl0_pll_clks[] __initconst =3D { + PLL(pll_0822x, CLK_FOUT_CPUCL0_PLL, "fout_cpucl0_pll", "oscclk", + PLL_LOCKTIME_PLL_CPUCL0, PLL_CON3_PLL_CPUCL0, cpu_pll_rates), +}; + +static const struct samsung_mux_clock cpucl0_mux_clks[] __initconst =3D { + MUX_F(CLK_MOUT_PLL_CPUCL0, "mout_pll_cpucl0", mout_pll_cpucl0_p, + PLL_CON0_PLL_CPUCL0, 4, 1, + CLK_SET_RATE_PARENT | CLK_RECALC_NEW_RATES, 0), + MUX_F(CLK_MOUT_CPUCL0_SWITCH_USER, "mout_cpucl0_switch_user", + mout_cpucl0_switch_user_p, + PLL_CON0_MUX_CLKCMU_CPUCL0_SWITCH_USER, 4, 1, + CLK_SET_RATE_PARENT, 0), + MUX(CLK_MOUT_CPUCL0_DBG_USER, "mout_cpucl0_dbg_user", + mout_cpucl0_dbg_user_p, + PLL_CON0_MUX_CLKCMU_CPUCL0_DBG_USER, 4, 1), + MUX_F(CLK_MOUT_CPUCL0_PLL, "mout_cpucl0_pll", mout_cpucl0_pll_p, + CLK_CON_MUX_MUX_CLK_CPUCL0_PLL, 0, 1, CLK_SET_RATE_PARENT, 0), +}; + +static const struct samsung_div_clock cpucl0_div_clks[] __initconst =3D { + DIV_F(CLK_DOUT_CPUCL0_CPU, "dout_cpucl0_cpu", "mout_cpucl0_pll", + CLK_CON_DIV_DIV_CLK_CPUCL0_CPU, 0, 1, + CLK_GET_RATE_NOCACHE, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_CPUCL0_CMUREF, "dout_cpucl0_cmuref", "dout_cpucl0_cpu", + CLK_CON_DIV_DIV_CLK_CPUCL0_CMUREF, 0, 3, + CLK_GET_RATE_NOCACHE, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_CPUCL0_PCLK, "dout_cpucl0_pclk", "dout_cpucl0_cpu", + CLK_CON_DIV_DIV_CLK_CPUCL0_PCLK, 0, 4, + CLK_GET_RATE_NOCACHE, CLK_DIVIDER_READ_ONLY), + + /* EMBEDDED_CMU_CPUCL0 */ + DIV_F(CLK_DOUT_CLUSTER0_ACLK, "dout_cluster0_aclk", "gout_cluster0_cpu", + CLK_CON_DIV_DIV_CLK_CLUSTER0_ACLK, 0, 4, + CLK_GET_RATE_NOCACHE, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_CLUSTER0_ATCLK, "dout_cluster0_atclk", + "gout_cluster0_cpu", CLK_CON_DIV_DIV_CLK_CLUSTER0_ATCLK, 0, 4, + CLK_GET_RATE_NOCACHE, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_CLUSTER0_PCLKDBG, "dout_cluster0_pclkdbg", + "gout_cluster0_cpu", CLK_CON_DIV_DIV_CLK_CLUSTER0_PCLKDBG, 0, 4, + CLK_GET_RATE_NOCACHE, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_CLUSTER0_PERIPHCLK, "dout_cluster0_periphclk", + "gout_cluster0_cpu", CLK_CON_DIV_DIV_CLK_CLUSTER0_PERIPHCLK, 0, 4, + CLK_GET_RATE_NOCACHE, CLK_DIVIDER_READ_ONLY), +}; + +static const struct samsung_gate_clock cpucl0_gate_clks[] __initconst =3D { + GATE(CLK_GOUT_CPUCL0_CMU_CPUCL0_PCLK, "gout_cpucl0_cmu_cpucl0_pclk", + "dout_cpucl0_pclk", + CLK_CON_GAT_CLK_CPUCL0_CMU_CPUCL0_PCLK, 21, CLK_IGNORE_UNUSED, 0), + + /* EMBEDDED_CMU_CPUCL0 */ + GATE(CLK_GOUT_CLUSTER0_CPU, "gout_cluster0_cpu", "dout_cpucl0_cpu", + CLK_CON_GAT_GATE_CLK_CPUCL0_CPU, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_CLUSTER0_SCLK, "gout_cluster0_sclk", "gout_cluster0_cpu", + CLK_CON_GAT_CLK_CPUCL0_CLUSTER0_SCLK, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_CLUSTER0_ATCLK, "gout_cluster0_atclk", + "dout_cluster0_atclk", + CLK_CON_GAT_CLK_CPUCL0_CLUSTER0_ATCLK, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_CLUSTER0_PERIPHCLK, "gout_cluster0_periphclk", + "dout_cluster0_periphclk", + CLK_CON_GAT_CLK_CPUCL0_CLUSTER0_PERIPHCLK, 21, + CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_CLUSTER0_PCLK, "gout_cluster0_pclk", + "dout_cluster0_pclkdbg", + CLK_CON_GAT_CLK_CPUCL0_CLUSTER0_PCLK, 21, CLK_IGNORE_UNUSED, 0), +}; + +/* + * Each parameter is going to be written into the corresponding DIV regist= er. So + * the actual divider value for each parameter will be 1/(param+1). All th= ese + * parameters must be in the range of 0..15, as the divider range for all = of + * these DIV clocks is 1..16. The default values for these dividers is + * (1, 3, 3, 1). + */ +#define E850_CPU_DIV0(aclk, atclk, pclkdbg, periphclk) \ + (((aclk) << 16) | ((atclk) << 12) | ((pclkdbg) << 8) | \ + ((periphclk) << 4)) + +static const struct exynos_cpuclk_cfg_data exynos850_cluster_clk_d[] __ini= tconst +=3D { + { 2210000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 2106000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 2002000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 1846000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 1742000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 1586000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 1456000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 1300000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 1157000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 1053000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 949000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 806000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 650000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 546000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 442000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 351000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 247000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 182000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 130000, E850_CPU_DIV0(1, 3, 3, 1) }, + { 0 } +}; + +static const struct samsung_cpu_clock cpucl0_cpu_clks[] __initconst =3D { + CPU_CLK(CLK_CLUSTER0_SCLK, "cluster0_clk", CLK_MOUT_PLL_CPUCL0, + CLK_MOUT_CPUCL0_SWITCH_USER, 0, 0x0, CPUCLK_LAYOUT_E850_CL0, + exynos850_cluster_clk_d), +}; + +static const struct samsung_cmu_info cpucl0_cmu_info __initconst =3D { + .pll_clks =3D cpucl0_pll_clks, + .nr_pll_clks =3D ARRAY_SIZE(cpucl0_pll_clks), + .mux_clks =3D cpucl0_mux_clks, + .nr_mux_clks =3D ARRAY_SIZE(cpucl0_mux_clks), + .div_clks =3D cpucl0_div_clks, + .nr_div_clks =3D ARRAY_SIZE(cpucl0_div_clks), + .gate_clks =3D cpucl0_gate_clks, + .nr_gate_clks =3D ARRAY_SIZE(cpucl0_gate_clks), + .cpu_clks =3D cpucl0_cpu_clks, + .nr_cpu_clks =3D ARRAY_SIZE(cpucl0_cpu_clks), + .nr_clk_ids =3D CLKS_NR_CPUCL0, + .clk_regs =3D cpucl0_clk_regs, + .nr_clk_regs =3D ARRAY_SIZE(cpucl0_clk_regs), + .clk_name =3D "dout_cpucl0_switch", + .manual_plls =3D true, +}; + +static void __init exynos850_cmu_cpucl0_init(struct device_node *np) +{ + exynos_arm64_register_cmu(NULL, np, &cpucl0_cmu_info); +} + +/* Register CMU_CPUCL0 early, as CPU clocks should be available ASAP */ +CLK_OF_DECLARE(exynos850_cmu_cpucl0, "samsung,exynos850-cmu-cpucl0", + exynos850_cmu_cpucl0_init); + +/* ---- CMU_CPUCL1 -------------------------------------------------------= --- */ + +/* Register Offset definitions for CMU_CPUCL1 (0x10800000) */ +#define PLL_LOCKTIME_PLL_CPUCL1 0x0000 +#define PLL_CON0_PLL_CPUCL1 0x0100 +#define PLL_CON1_PLL_CPUCL1 0x0104 +#define PLL_CON3_PLL_CPUCL1 0x010c +#define PLL_CON0_MUX_CLKCMU_CPUCL1_DBG_USER 0x0600 +#define PLL_CON0_MUX_CLKCMU_CPUCL1_SWITCH_USER 0x0610 +#define CLK_CON_MUX_MUX_CLK_CPUCL1_PLL 0x1000 +#define CLK_CON_DIV_DIV_CLK_CLUSTER1_ACLK 0x1800 +#define CLK_CON_DIV_DIV_CLK_CLUSTER1_ATCLK 0x1808 +#define CLK_CON_DIV_DIV_CLK_CLUSTER1_PCLKDBG 0x180c +#define CLK_CON_DIV_DIV_CLK_CLUSTER1_PERIPHCLK 0x1810 +#define CLK_CON_DIV_DIV_CLK_CPUCL1_CMUREF 0x1814 +#define CLK_CON_DIV_DIV_CLK_CPUCL1_CPU 0x1818 +#define CLK_CON_DIV_DIV_CLK_CPUCL1_PCLK 0x181c +#define CLK_CON_GAT_CLK_CPUCL1_CLUSTER1_ATCLK 0x2000 +#define CLK_CON_GAT_CLK_CPUCL1_CLUSTER1_PCLK 0x2004 +#define CLK_CON_GAT_CLK_CPUCL1_CLUSTER1_PERIPHCLK 0x2008 +#define CLK_CON_GAT_CLK_CPUCL1_CLUSTER1_SCLK 0x200c +#define CLK_CON_GAT_CLK_CPUCL1_CMU_CPUCL1_PCLK 0x2010 +#define CLK_CON_GAT_GATE_CLK_CPUCL1_CPU 0x2020 + +static const unsigned long cpucl1_clk_regs[] __initconst =3D { + PLL_LOCKTIME_PLL_CPUCL1, + PLL_CON0_PLL_CPUCL1, + PLL_CON1_PLL_CPUCL1, + PLL_CON3_PLL_CPUCL1, + PLL_CON0_MUX_CLKCMU_CPUCL1_DBG_USER, + PLL_CON0_MUX_CLKCMU_CPUCL1_SWITCH_USER, + CLK_CON_MUX_MUX_CLK_CPUCL1_PLL, + CLK_CON_DIV_DIV_CLK_CLUSTER1_ACLK, + CLK_CON_DIV_DIV_CLK_CLUSTER1_ATCLK, + CLK_CON_DIV_DIV_CLK_CLUSTER1_PCLKDBG, + CLK_CON_DIV_DIV_CLK_CLUSTER1_PERIPHCLK, + CLK_CON_DIV_DIV_CLK_CPUCL1_CMUREF, + CLK_CON_DIV_DIV_CLK_CPUCL1_CPU, + CLK_CON_DIV_DIV_CLK_CPUCL1_PCLK, + CLK_CON_GAT_CLK_CPUCL1_CLUSTER1_ATCLK, + CLK_CON_GAT_CLK_CPUCL1_CLUSTER1_PCLK, + CLK_CON_GAT_CLK_CPUCL1_CLUSTER1_PERIPHCLK, + CLK_CON_GAT_CLK_CPUCL1_CLUSTER1_SCLK, + CLK_CON_GAT_CLK_CPUCL1_CMU_CPUCL1_PCLK, + CLK_CON_GAT_GATE_CLK_CPUCL1_CPU, +}; + +/* List of parent clocks for Muxes in CMU_CPUCL0 */ +PNAME(mout_pll_cpucl1_p) =3D { "oscclk", "fout_cpucl1_pll" }; +PNAME(mout_cpucl1_switch_user_p) =3D { "oscclk", "dout_cpucl1_switch" }; +PNAME(mout_cpucl1_dbg_user_p) =3D { "oscclk", "dout_cpucl1_dbg" }; +PNAME(mout_cpucl1_pll_p) =3D { "mout_pll_cpucl1", + "mout_cpucl1_switch_user" }; + +static const struct samsung_pll_clock cpucl1_pll_clks[] __initconst =3D { + PLL(pll_0822x, CLK_FOUT_CPUCL1_PLL, "fout_cpucl1_pll", "oscclk", + PLL_LOCKTIME_PLL_CPUCL1, PLL_CON3_PLL_CPUCL1, cpu_pll_rates), +}; + +static const struct samsung_mux_clock cpucl1_mux_clks[] __initconst =3D { + MUX_F(CLK_MOUT_PLL_CPUCL1, "mout_pll_cpucl1", mout_pll_cpucl1_p, + PLL_CON0_PLL_CPUCL1, 4, 1, + CLK_SET_RATE_PARENT | CLK_RECALC_NEW_RATES, 0), + MUX_F(CLK_MOUT_CPUCL1_SWITCH_USER, "mout_cpucl1_switch_user", + mout_cpucl1_switch_user_p, + PLL_CON0_MUX_CLKCMU_CPUCL1_SWITCH_USER, 4, 1, + CLK_SET_RATE_PARENT, 0), + MUX(CLK_MOUT_CPUCL1_DBG_USER, "mout_cpucl1_dbg_user", + mout_cpucl1_dbg_user_p, + PLL_CON0_MUX_CLKCMU_CPUCL1_DBG_USER, 4, 1), + MUX_F(CLK_MOUT_CPUCL1_PLL, "mout_cpucl1_pll", mout_cpucl1_pll_p, + CLK_CON_MUX_MUX_CLK_CPUCL1_PLL, 0, 1, CLK_SET_RATE_PARENT, 0), +}; + +static const struct samsung_div_clock cpucl1_div_clks[] __initconst =3D { + DIV_F(CLK_DOUT_CPUCL1_CPU, "dout_cpucl1_cpu", "mout_cpucl1_pll", + CLK_CON_DIV_DIV_CLK_CPUCL1_CPU, 0, 1, + CLK_GET_RATE_NOCACHE, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_CPUCL1_CMUREF, "dout_cpucl1_cmuref", "dout_cpucl1_cpu", + CLK_CON_DIV_DIV_CLK_CPUCL1_CMUREF, 0, 3, + CLK_GET_RATE_NOCACHE, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_CPUCL1_PCLK, "dout_cpucl1_pclk", "dout_cpucl1_cpu", + CLK_CON_DIV_DIV_CLK_CPUCL1_PCLK, 0, 4, + CLK_GET_RATE_NOCACHE, CLK_DIVIDER_READ_ONLY), + + /* EMBEDDED_CMU_CPUCL1 */ + DIV_F(CLK_DOUT_CLUSTER1_ACLK, "dout_cluster1_aclk", "gout_cluster1_cpu", + CLK_CON_DIV_DIV_CLK_CLUSTER1_ACLK, 0, 4, + CLK_GET_RATE_NOCACHE, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_CLUSTER1_ATCLK, "dout_cluster1_atclk", + "gout_cluster1_cpu", CLK_CON_DIV_DIV_CLK_CLUSTER1_ATCLK, 0, 4, + CLK_GET_RATE_NOCACHE, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_CLUSTER1_PCLKDBG, "dout_cluster1_pclkdbg", + "gout_cluster1_cpu", CLK_CON_DIV_DIV_CLK_CLUSTER1_PCLKDBG, 0, 4, + CLK_GET_RATE_NOCACHE, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_CLUSTER1_PERIPHCLK, "dout_cluster1_periphclk", + "gout_cluster1_cpu", CLK_CON_DIV_DIV_CLK_CLUSTER1_PERIPHCLK, 0, 4, + CLK_GET_RATE_NOCACHE, CLK_DIVIDER_READ_ONLY), +}; + +static const struct samsung_gate_clock cpucl1_gate_clks[] __initconst =3D { + GATE(CLK_GOUT_CPUCL1_CMU_CPUCL1_PCLK, "gout_cpucl1_cmu_cpucl1_pclk", + "dout_cpucl1_pclk", + CLK_CON_GAT_CLK_CPUCL1_CMU_CPUCL1_PCLK, 21, CLK_IGNORE_UNUSED, 0), + + /* EMBEDDED_CMU_CPUCL1 */ + GATE(CLK_GOUT_CLUSTER1_CPU, "gout_cluster1_cpu", "dout_cpucl1_cpu", + CLK_CON_GAT_GATE_CLK_CPUCL1_CPU, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_CLUSTER1_SCLK, "gout_cluster1_sclk", "gout_cluster1_cpu", + CLK_CON_GAT_CLK_CPUCL1_CLUSTER1_SCLK, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_CLUSTER1_ATCLK, "gout_cluster1_atclk", + "dout_cluster1_atclk", + CLK_CON_GAT_CLK_CPUCL1_CLUSTER1_ATCLK, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_CLUSTER1_PERIPHCLK, "gout_cluster1_periphclk", + "dout_cluster1_periphclk", + CLK_CON_GAT_CLK_CPUCL1_CLUSTER1_PERIPHCLK, 21, + CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_CLUSTER1_PCLK, "gout_cluster1_pclk", + "dout_cluster1_pclkdbg", + CLK_CON_GAT_CLK_CPUCL1_CLUSTER1_PCLK, 21, CLK_IGNORE_UNUSED, 0), +}; + +static const struct samsung_cpu_clock cpucl1_cpu_clks[] __initconst =3D { + CPU_CLK(CLK_CLUSTER1_SCLK, "cluster1_clk", CLK_MOUT_PLL_CPUCL1, + CLK_MOUT_CPUCL1_SWITCH_USER, 0, 0x0, CPUCLK_LAYOUT_E850_CL1, + exynos850_cluster_clk_d), +}; + +static const struct samsung_cmu_info cpucl1_cmu_info __initconst =3D { + .pll_clks =3D cpucl1_pll_clks, + .nr_pll_clks =3D ARRAY_SIZE(cpucl1_pll_clks), + .mux_clks =3D cpucl1_mux_clks, + .nr_mux_clks =3D ARRAY_SIZE(cpucl1_mux_clks), + .div_clks =3D cpucl1_div_clks, + .nr_div_clks =3D ARRAY_SIZE(cpucl1_div_clks), + .gate_clks =3D cpucl1_gate_clks, + .nr_gate_clks =3D ARRAY_SIZE(cpucl1_gate_clks), + .cpu_clks =3D cpucl1_cpu_clks, + .nr_cpu_clks =3D ARRAY_SIZE(cpucl1_cpu_clks), + .nr_clk_ids =3D CLKS_NR_CPUCL1, + .clk_regs =3D cpucl1_clk_regs, + .nr_clk_regs =3D ARRAY_SIZE(cpucl1_clk_regs), + .clk_name =3D "dout_cpucl1_switch", + .manual_plls =3D true, +}; + +static void __init exynos850_cmu_cpucl1_init(struct device_node *np) +{ + exynos_arm64_register_cmu(NULL, np, &cpucl1_cmu_info); +} + +/* Register CMU_CPUCL1 early, as CPU clocks should be available ASAP */ +CLK_OF_DECLARE(exynos850_cmu_cpucl1, "samsung,exynos850-cmu-cpucl1", + exynos850_cmu_cpucl1_init); + /* ---- CMU_G3D ----------------------------------------------------------= --- */ =20 /* Register Offset definitions for CMU_G3D (0x11400000) */ --=20 2.39.2 From nobody Sat Feb 7 19:04:16 2026 Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3B244D58A for ; Sat, 24 Feb 2024 20:21:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806069; cv=none; b=FXcK9IOyCqiPiGGNULJz0nQonMhpUHCyqGy082DBbVR04fHhPd2AcU68zdikGxEoDQ+5tn4Ys7dn6X3M2KFeVBiCz1ZHtyWHyse3Yn6TjXArq7ZwJRcYmp6KGgBh5l5O8aDQvgbof61XVeytHlq/pQV1BrEKOpKyyI0x6Jf/rsY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708806069; c=relaxed/simple; bh=Mv0a3gOoxI7PWU3YTmYf9kqa0HHrZlHBLeIQmvrLoHo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Qyr0qIkUl/WybjLjjmz1Udp6GrdGS1Nvy4OLdVK9JLiqNBOYIwbtYOTA5/d7r6BLL9B9+jeeLOZrsRGJ8EO6sTdYfCb7ASTp4pS5i42dKe51LuYupIkC0KjhBheZS+oMgY5xHFgk8qDyZyEIJsxVNVIWYWuH60FTlwRJxK7n2gI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=MJIcIsEU; arc=none smtp.client-ip=209.85.161.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MJIcIsEU" Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-5a0680bc600so138595eaf.0 for ; Sat, 24 Feb 2024 12:21:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708806066; x=1709410866; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qMCmyVuJ+YwjHrCIo4ko9XwoXKrRHcalREosYeHxNXc=; b=MJIcIsEU8pZIjGcDojuGsJDb19QAYEoqwOCm/zlvHWn34Sq5tJShnDw1XD6k0HRdfV t5JAOVwgF9q8QbqeW+ViJgAb4+T/J28bMV5ka0yi/WWA/t29jjKlRwx5kODfjDuRx5w5 Q1prXntbMBP05I5vh1gGFP9nwL+X2E1dTDsDwyzn7Hi7Ol7OyNJ6XFOwVpw65uzL9nQq eemm4JWb8Py3dTDAsamGveNsJ3Tz9cy47GBnY86mAnHHjQtngqT5wUh7m9OA4KHVIiOK aPItbrpoqfZqGOHz4ZpYzS/Z84fbpNt6gfTM0P76QIhEaAXhm1zS1VhmMAso2qt/dseY ySbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708806066; x=1709410866; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qMCmyVuJ+YwjHrCIo4ko9XwoXKrRHcalREosYeHxNXc=; b=XDRIRVdCyHU5G1mgjQbeCjLmpqQQn/H2h77RBUORSQqmQTbhUzDnGseRwbepjLXsja teYBPX+V1OLGlNxHo4bXEcdjv8K9UssszhR2Px6GVjc0bLPsG6qn/0rDjIFlKr8EFJDP 8Ng7uTUbT8rbwdOi6bfhqk1DhcwgRo37Yhzy66/e2iOtJoLsRQi0PnSsNQ2ZemKNwHaD ADABrMqEPdibtEVyRFWzTkH9283cqrETMLUsYfRYk95WI8s4JfkDUJTSYDjyS0WTEIVi 28NR9S/GQUkmusbba2iFTsAr8Jt+gIxVdgQdV3xBg/ezXmYVlewNz6yGynYjEvLD4tb7 imaw== X-Forwarded-Encrypted: i=1; AJvYcCVjI41ETUgke9YqrT+uS3gGqsm2m7XOiBvE39yLPV5ilccivqmJnN4izZ7LvYc8oEkOwRXRdVNC0IHzH3KMv1nUzoEM5wzsDqQJE7Gk X-Gm-Message-State: AOJu0YxwOLsd+K6Ig+sT9ZkxFBaJSN/fFBqJuhhHzYndmjiFmwSvtTe1 Eft3wjwtBjxKC3qt8CnH2sko4wpZGoBxr7CunHW8mW/r/aB3SIl7JeffRTABatQ= X-Google-Smtp-Source: AGHT+IHFNAI0Xv1tyiOZGKweUmEOjy5ItYWEMGeKD0/G3QST9r+0j6ysSLDAuOz/E3BwJwri2VJemA== X-Received: by 2002:a05:6820:296:b0:5a0:4598:7a90 with SMTP id q22-20020a056820029600b005a045987a90mr583929ood.5.1708806066047; Sat, 24 Feb 2024 12:21:06 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id e30-20020a4a91de000000b005a04afb627fsm450503ooh.24.2024.02.24.12.21.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 12:21:05 -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 15/15] arm64: dts: exynos: Add CPU clocks for Exynos850 Date: Sat, 24 Feb 2024 14:20:53 -0600 Message-Id: <20240224202053.25313-16-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224202053.25313-1-semen.protsenko@linaro.org> References: <20240224202053.25313-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Define CPU cluster 0 and CPU cluster 1 CMUs, which generate CPU clocks, and add corresponding CPU clocks to CPU nodes. Signed-off-by: Sam Protsenko --- Changes in v3: - none Changes in v2: - Added "for Exynos850" part to the commit title arch/arm64/boot/dts/exynos/exynos850.dtsi | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/exynos850.dtsi b/arch/arm64/boot/dt= s/exynos/exynos850.dtsi index 2ba67c3d0681..0706c8534ceb 100644 --- a/arch/arm64/boot/dts/exynos/exynos850.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos850.dtsi @@ -93,6 +93,8 @@ cpu0: cpu@0 { compatible =3D "arm,cortex-a55"; reg =3D <0x0>; enable-method =3D "psci"; + clocks =3D <&cmu_cpucl0 CLK_CLUSTER0_SCLK>; + clock-names =3D "cluster0_clk"; }; cpu1: cpu@1 { device_type =3D "cpu"; @@ -117,6 +119,8 @@ cpu4: cpu@100 { compatible =3D "arm,cortex-a55"; reg =3D <0x100>; enable-method =3D "psci"; + clocks =3D <&cmu_cpucl1 CLK_CLUSTER1_SCLK>; + clock-names =3D "cluster1_clk"; }; cpu5: cpu@101 { device_type =3D "cpu"; @@ -254,6 +258,28 @@ cmu_peri: clock-controller@10030000 { "dout_peri_uart", "dout_peri_ip"; }; =20 + cmu_cpucl1: clock-controller@10800000 { + compatible =3D "samsung,exynos850-cmu-cpucl1"; + reg =3D <0x10800000 0x8000>; + #clock-cells =3D <1>; + + clocks =3D <&oscclk>, <&cmu_top CLK_DOUT_CPUCL1_SWITCH>, + <&cmu_top CLK_DOUT_CPUCL1_DBG>; + clock-names =3D "oscclk", "dout_cpucl1_switch", + "dout_cpucl1_dbg"; + }; + + cmu_cpucl0: clock-controller@10900000 { + compatible =3D "samsung,exynos850-cmu-cpucl0"; + reg =3D <0x10900000 0x8000>; + #clock-cells =3D <1>; + + clocks =3D <&oscclk>, <&cmu_top CLK_DOUT_CPUCL0_SWITCH>, + <&cmu_top CLK_DOUT_CPUCL0_DBG>; + clock-names =3D "oscclk", "dout_cpucl0_switch", + "dout_cpucl0_dbg"; + }; + cmu_g3d: clock-controller@11400000 { compatible =3D "samsung,exynos850-cmu-g3d"; reg =3D <0x11400000 0x8000>; --=20 2.39.2