From nobody Sun Feb 8 07:21:52 2026 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 81197313E20 for ; Mon, 22 Dec 2025 10:22:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766398949; cv=none; b=Vj+/Lhik46mKqsFPTnUSBy1VwObRS3aAz/7eCqi7MtiP07WSacxB4GOQhBNKrYpXswElNiGGvBD4OmAFtj6JmR/xz1g/wjsTebAdu/3m74L/DWpDh7Ye+vHjfk//dvQNI4dRuOir7odk/AJp1JfSSAFke8JRqx8aLhbgLu8LMTk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766398949; c=relaxed/simple; bh=HBZKxM+L4XbIj/0bVAaLELAMW01kR1SncGYaCmbhxbc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kr5tKlaEAv9sryiP2x8YxJfHUsDlggSsXvyAJHs5w1dNzaGOCf1H+rgTFB6tKW5VwdHvJ3ewj3vjwcSnb9prS572KuYc8trK/KnJFJhTupRjWAfCQH1SYRonJ5er+vqk2JpXYGE5j51n3LuR2llEnadFnY2HgFPb/U6CLbrrmqo= 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=Obal92Ib; arc=none smtp.client-ip=209.85.221.48 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="Obal92Ib" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-430f3ef2d37so2838490f8f.3 for ; Mon, 22 Dec 2025 02:22:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766398946; x=1767003746; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gV3ODo6F13X1bXwo/uKA4praO9ZfNmVtiFryiaGb6Gs=; b=Obal92IbbBkK8Neum8MgXm5UQUhWeJZhX8lMa6IbVSUUf5UgR/kb/SEE7vuP91oyXb MsD0ZHiIOif52k5lqjnlvXmbPBAQY4tVstQDqKoPI7gAyVW4mj1200ym3kaNaUqSYIBs YtSuAYExZn/i1p6+LmpCCZQOWRTjAX9k1hY73YTArCCwFc/eRDWh02W4We0387lLHZfI mA8sm+hBSkAv31YL1zfDr5GFviLmAltzRGwJjIW6ovMycJiR5TGeQBH0aHI0q7bJv84x fvpi/Ee07hBvSoqsPkjqhhiX3AWx4DuqqP6V6lLVO/2HrNFgcSbalKSWsNS39AwmmjL6 KxQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766398946; x=1767003746; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=gV3ODo6F13X1bXwo/uKA4praO9ZfNmVtiFryiaGb6Gs=; b=RxxZL7fP5ZpTQGuA22JLrgVScL/AhETOvc9C6IhTK8dwiknmWCr+OtWJKe2NF7BLjE xhumJn65+CfWYPtPnhLNELkhrsqR40L4YbZq7EPwgk3Rk6Tdk36s8di3LMxRs9v9GGWa lzTOcoIae0uw1U9dRKOhETwQIKuHlbkpH+H8V56HkYTMKC6/lmRxbokGiOcpxH2qujG/ Nc0RHEstJ0BWHCyT92fe/327xLl1vWY5sIxfSYjcOOnM3juIkyLgOhGYJXgFz2HUoQtW nJuTj2k3jEf/eyOncg8O8eagRGtX8npRoBwF+VFf69zIEd+WQ34515VB/p/AVNaktK/6 xbZg== X-Forwarded-Encrypted: i=1; AJvYcCUsR8F9fdnHbG/BTVEgyT14iivS8Uay0YxVJlFGYupJMH/JcAqpdtZ0HKhNJCDZMTjxYLzob4Kz/BSu7dI=@vger.kernel.org X-Gm-Message-State: AOJu0Yzw1HCixYOUYHMo1AlYTgC34KutLBLYM8S2gTP+0SJALCxrdKO3 ca3k2mh4QpK32dJmZlpWob+td8CQBfslIVYWS1r22mAteALa372yynMfvx4uwUw8X4k= X-Gm-Gg: AY/fxX5oYt9HNZsReUg9BmdKssXptev9oJxvC14FJ1t+BEvaD/ewgDxpyRWrIrLjHaf CsF+I00zyWpDpS9LPBXe4IyZZHL355Qfn2Qku2PUhF1Y3DOWvfQP1WnhWhoJNflAPKAw7GTGwSq N9txjCoyjycQ876GEr+RsckE/TKED28soE7/EP1kyE+agsJR70IxvrIjBXsdwYzxsQjPIn5SL+m 5RgmF/FSX0n2f11uj53u+gUCbEnOR8jiqwL20YFQ/b2WHD3lfbC8lyASyD9zB6HCwSwEV2UybbL zDHHvKREk/CwVfCINMCERcXGz0irhDXfR1jpvx0EJJIj9VResW9QlDgp3SOc8wIU31zTRY2M7aC IYdQoG/FJ+RlGiuclE9Y+O95ZJOjWFSyWx/xj48eut4OsghiTKgRak0ymJZZ1i98+WDFCzKU5wz hTF2fUKZKPteesnNyWjN9Wuc6tTTt/re7omkQRFM8= X-Google-Smtp-Source: AGHT+IGgiHPoZfvEvLMMkvb40+kGv1VyoyONqoU2+qFBxEmmPGJZxre1hXPXFrJ0WJGq4sn/Equgjw== X-Received: by 2002:a05:6000:4202:b0:430:fd9f:e6e2 with SMTP id ffacd0b85a97d-4324e4c3e3cmr11605703f8f.9.1766398945842; Mon, 22 Dec 2025 02:22:25 -0800 (PST) Received: from gpeter-l.roam.corp.google.com ([150.228.9.32]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4324ea82feasm21082813f8f.24.2025.12.22.02.22.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Dec 2025 02:22:25 -0800 (PST) From: Peter Griffin Date: Mon, 22 Dec 2025 10:22:12 +0000 Subject: [PATCH v7 1/4] dt-bindings: clock: google,gs101-clock: add samsung,sysreg property as required Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251222-automatic-clocks-v7-1-fec86fa89874@linaro.org> References: <20251222-automatic-clocks-v7-0-fec86fa89874@linaro.org> In-Reply-To: <20251222-automatic-clocks-v7-0-fec86fa89874@linaro.org> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , =?utf-8?q?Andr=C3=A9_Draszik?= , Tudor Ambarus , Michael Turquette , Stephen Boyd , Sam Protsenko , Sylwester Nawrocki , Chanwoo Choi Cc: Will McVicker , Krzysztof Kozlowski , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, kernel-team@android.com, Peter Griffin , Krzysztof Kozlowski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3035; i=peter.griffin@linaro.org; h=from:subject:message-id; bh=HBZKxM+L4XbIj/0bVAaLELAMW01kR1SncGYaCmbhxbc=; b=owEBbQKS/ZANAwAKAc7ouNYCNHK6AcsmYgBpSRvdg60hfuVcDiZdNu950EdMWZySiihRxtyx3 EfLG5mp+eOJAjMEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaUkb3QAKCRDO6LjWAjRy utr3EACTGOAhJ1hCnCIVqJuSlu7QQ6AwrTPxufUoAzWVwcfqf8wjAG8/xe1khihoZz9SZ3O0RwG wEphnvoXD2NDEPUIteALxG5wUbu+3ottY+wRK4JU3jGRZeJ3TLaCNdJ5CKMElRVNVejVz9glVgw 6VE9bux7U+ZF3c6m4HwxqhXJhK0b92xnyKg9+dxB9qtbDvtoNMr8G8SXKsZvzFEbpNBCmeJLsUP YBcrVOLcavMFiEDVRox0BTXLOJjGezKsstV7NcHAcdSkQwwHvl8AlW50ezGh2W3nzs+I6l9zbxG AwiW713NWeb1h17mFZnKzLAlVG+JZnZxz4Qxv6AMmfnjxno5PxHoh9w7k4hpMJwg5oTwNfSrpTu dHjbL2xqwfKPLAj3Wy/gEcjgchqy8BZs33rbyvyScai7Hmv7SqBFyPOIoDVNAD4fWstsgxg7ME7 yvMe5IenPbHfF/hc28u4u+SYySU8DqLpyY9fHD7Ca0XW383DwC3aBKYKt04eVHB4jBanfN1pEEj HRjFpGHCRsOgGgfWUhS1jITkKYf8UHNslBftN3etW7HLW+dVre3CErFb7cdeGADIpek3EaaVuA8 YHUOEpsPCL5gvHQAybewVbWL71RipmUH7EyWPU5lIFABMrF5ZwFIhj9UvK3qSc+pbQ8p1qsfHKt FHwMq1yGPZZB5dw== X-Developer-Key: i=peter.griffin@linaro.org; a=openpgp; fpr=0EFC8E6F5578750D56B549FCCEE8B8D6023472BA Each CMU (with the exception of cmu_top) has a corresponding sysreg bank that contains the BUSCOMPONENT_DRCG_EN and optional MEMCLK registers. The BUSCOMPONENT_DRCG_EN register enables dynamic root clock gating of bus components and MEMCLK gates the sram clock. Now the clock driver supports automatic clock mode, to fully enable dynamic root clock gating it is required to configure these registers. Update the bindings documentation so that all CMUs (with the exception of gs101-cmu-top) have samsung,sysreg as a required property. Note this is NOT an ABI break, as if the property isn't specified the clock driver will fallback to the current behaviour of not initializing the registers. The system still boots, but bus components won't benefit from dynamic root clock gating and dynamic power will be higher (which has been the case until now anyway). Additionally update the DT example to included the correct CMU size as registers in that region are used for automatic clock mode. Acked-by: Rob Herring (Arm) Reviewed-by: Andr=C3=A9 Draszik Reviewed-by: Rob Herring (Arm) Signed-off-by: Peter Griffin --- Changes in v5: - Invert the test for google,gs101-cmu-top (Andre) Changes in v4 - Update commit description with additional requested details (Krzysztof) Changes in v3: - Update commit description as to why the sysreg is required (Krzysztof) Changes in v2: - Update commit description regarding updated example (Andre) --- .../devicetree/bindings/clock/google,gs101-clock.yaml | 19 +++++++++++++++= +++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/clock/google,gs101-clock.yam= l b/Documentation/devicetree/bindings/clock/google,gs101-clock.yaml index 31e106ef913dead9a038b3b6d8b43b950587f6aa..09e679c1a9def03d53b8b493929= 911ea902a1763 100644 --- a/Documentation/devicetree/bindings/clock/google,gs101-clock.yaml +++ b/Documentation/devicetree/bindings/clock/google,gs101-clock.yaml @@ -52,6 +52,11 @@ properties: reg: maxItems: 1 =20 + samsung,sysreg: + $ref: /schemas/types.yaml#/definitions/phandle + description: + Phandle to system registers interface. + required: - compatible - "#clock-cells" @@ -166,6 +171,18 @@ allOf: - const: bus - const: ip =20 + - if: + properties: + compatible: + contains: + const: google,gs101-cmu-top + then: + properties: + samsung,sysreg: false + else: + required: + - samsung,sysreg + additionalProperties: false =20 examples: @@ -175,7 +192,7 @@ examples: =20 cmu_top: clock-controller@1e080000 { compatible =3D "google,gs101-cmu-top"; - reg =3D <0x1e080000 0x8000>; + reg =3D <0x1e080000 0x10000>; #clock-cells =3D <1>; clocks =3D <&ext_24_5m>; clock-names =3D "oscclk"; --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 07:21:52 2026 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) (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 ECD903148D4 for ; Mon, 22 Dec 2025 10:22:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.66 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766398950; cv=none; b=K1edJDrGnUCBGOib2lCVrJ40ynmOe7Qjahg0nzKZnR9DEgGyN5MQZ1TzQxQWsfIg5qeTQpbl4wtNji7VJoqzf/vvoNjsID/yjICXeQW9Lnpp2xZcre8VjtEhnRDrfuSERGUk3WHUwbymvMgOZpylefi1PwK78EObfg735E++Nho= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766398950; c=relaxed/simple; bh=h92o4zwYNSX6815UCmoJUrl3OjU4KjoLxMi/xiWmdfY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NKj2NpVgttAbIXIy9y0dQsAlS047xMtDHxKswRmKLXNkvgooyMrO84oiVjVbdOThf3fUDX+qTie/Nhx8uQYgDB3+iN+Oq6rrn2yE5EURNkV8jw0lkbGCc7cHrCfJwdA9uF2rqg+4GenVJZPJYHVwjjM9r070p6xihLmv1zs7lSE= 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=CogELlIc; arc=none smtp.client-ip=209.85.128.66 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="CogELlIc" Received: by mail-wm1-f66.google.com with SMTP id 5b1f17b1804b1-477b91680f8so32134165e9.0 for ; Mon, 22 Dec 2025 02:22:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766398947; x=1767003747; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=7Ju9j+YC1WJ2vWa+GZa2BXWls/TDlfesLoKVGyWNUzk=; b=CogELlIc2ubH7pzt5KZw4qooVsYZdBXQUe3lJYdN4F9KUoAmQtvtKv3R1agUgQLfNH NkJ7ml6jj6x3vxA98lLhg3XI7IK7j/Mm0DFW3A06v2xZWgSBvb7StWvcrRTli0XV/YiT +RV2NwLFfvMHnGZrXhyxtbNWowAejSIjGj5WR1aqmSK9T2/ZQCPXCrUi+ZqjN2ZJw/E0 DluNspXNJmZZzIs/JjOmjlpyhOOz0URFN68UwmdbVSlVFErRYb8BIa88IYpu8xCrn3Nb efYDbo2o23MxvPCB2rJ+Pv8NNcOeAjP8AaVMaqoRrzDAF8M0lLMdQAa4DsyC3mPYHcEA Ybhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766398947; x=1767003747; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=7Ju9j+YC1WJ2vWa+GZa2BXWls/TDlfesLoKVGyWNUzk=; b=V1dsIRae6tkz/BJOzQhy8o4Wi2r/it1+ZmHHyk79NO0YDAAFddLHZPmGoj/7POiANA EbEPKdak1T7aKWzTsBCZDypjKVGzIzE+q4UnTSTqWFILRX+P7Z9eT+QIKurL6hYoLEge EXEHycvyWA2Lrb7WNpEzMHOmzmXZVWHrlvrTHbUa0PfF5g2FR2fomFIoFeKg25zjqN1s qfSoJCX8n9bqGiM0sAxBwe0daqZZV6pFaqcC4SlGKPli3aBr8A5dK0gbd0HvOnQziYNK rokxJ1yh+E7oc35s5uKxBCuW6rZsNfAM3gDoa2ErVegsvz0PUgcJY9pRDtMacEBsAU3J wkEA== X-Forwarded-Encrypted: i=1; AJvYcCWSyHTDx24LVqSiqFdrTgapzSvHg+3Gc99MfMJEwsS4xjfv8epWdhylMkSG2w0PZK8h+oUPpVR29WoXwL4=@vger.kernel.org X-Gm-Message-State: AOJu0YwTJTzM47O7CDDmlHzoflj6OaGLzlWHU0LkGTkRy907cCEsO/oP gOH/GkGXwsTEU1kBKI0ErxLGH5tVloDpm2pNSw5QE3g1z4eEH9inshHa+bGbAsururM= X-Gm-Gg: AY/fxX5mVCbMICEq8HZh5HQhskEeBMz2r3uJNIKK1mKA3Eb8a5tDjZq9AOeqW8tEjlx Tt6lab4lNBtQgyG4WXsd3q48zKuUE/jpxfxQc61jE2Vv/ol/hyd0AuVkVdjvMO+SNp1QhWHHpGQ TITNYgZbELlvEQHsVrzfObSsC3yeWAfPnNNeQHHnKsZCUX4Ev8nAtopn9hNYExu3dn9L33MvjQP /vUrrTmDARw9XStU9Bf//CIVsfXqTNgjduFd/lvZDCaQ5tFnJR/gZNl5owG5PK7LR+0C1zy3A+u 3QdWtk6NguviRwyjEOiT7+yW8ut5AP7i3vwKRBwrWX9cMWB4gZtIRmABW50PGkTg//t/QrE74tV JOg5utzOclAewA4hvPaqiTSSmKIatPS/EN3hOQE6wSL1OnvUFZCXCp5jZijCPu8OpzYX3rBKPrj iZf1qmzvHMPFGz25Np+e8Oq0xmtIO1o5o4NdyfIyg= X-Google-Smtp-Source: AGHT+IGBxQCC0mhYfZCgatlSYEwZuZIabwAahMk3vvXTWTdnnwMS9fmadg7QIbWO/xNvrGz/StfC2g== X-Received: by 2002:a05:600c:310e:b0:479:2a3c:f31a with SMTP id 5b1f17b1804b1-47d1956eb70mr105896795e9.1.1766398947266; Mon, 22 Dec 2025 02:22:27 -0800 (PST) Received: from gpeter-l.roam.corp.google.com ([150.228.9.32]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4324ea82feasm21082813f8f.24.2025.12.22.02.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Dec 2025 02:22:26 -0800 (PST) From: Peter Griffin Date: Mon, 22 Dec 2025 10:22:13 +0000 Subject: [PATCH v7 2/4] arm64: dts: exynos: gs101: add samsung,sysreg property to CMU nodes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251222-automatic-clocks-v7-2-fec86fa89874@linaro.org> References: <20251222-automatic-clocks-v7-0-fec86fa89874@linaro.org> In-Reply-To: <20251222-automatic-clocks-v7-0-fec86fa89874@linaro.org> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , =?utf-8?q?Andr=C3=A9_Draszik?= , Tudor Ambarus , Michael Turquette , Stephen Boyd , Sam Protsenko , Sylwester Nawrocki , Chanwoo Choi Cc: Will McVicker , Krzysztof Kozlowski , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, kernel-team@android.com, Peter Griffin , Krzysztof Kozlowski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2739; i=peter.griffin@linaro.org; h=from:subject:message-id; bh=h92o4zwYNSX6815UCmoJUrl3OjU4KjoLxMi/xiWmdfY=; b=owEBbAKT/ZANAwAKAc7ouNYCNHK6AcsmYgBpSRvdNO3GTfrxdRIea1vh38XYzq9WEqdQZckeb 4xI+2khpGKJAjIEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaUkb3QAKCRDO6LjWAjRy uo3oD/jFBjbVbdVJydY7tkVyN9ygLHX3QF9rpzd4UmrLTUYFD1RJwAoeMMQnlvrkfbTPIvp/GSz XYCj3/HVMkmuk2FkhYnHnlptQaeJoZ8TDu1jlM+s4JpfXTpw86u0+EmKxkyjNIJDTYToIcWMdy7 u4Qu2ulI6UdWSXz/5eLU8WH4vBHRVbh9bpsS0bO7fOjyl4mrUBDf4V1WcEFDjHDpGZFjwh5DUgn yUMM2RoKkqMSGMKMfllmg0rvTrcGr78IPmLBWvCLHBTGiVANACDt8eL28rlTC3ni+s6tIr4Al0d JeckRSnvrDFtNuZi6XS8BWnvoT9vB25nhH4I0mwWpMCZrZgRZxWDAnBIDYdJ+5dh6S9KARYVBzl mbyC4IpNvktltXeh12U0ParJEUuyckbPWm5sLr9yN/Ira31hqc40QXfWqhoNYN+03AZ6Stq+bIn XUMPiedabopU2I4zh3Fb8rAbGqpLKORm6OZEseO4Za3iuyvgVoupINFc6tIOV+ITyytUZT9QaZK I0Tq8Tzo5IcgffLEw27BFETG6N8xZ/4n1XpOrUnVx03fOElYVm/iTb0GFWdqG5B3s2oPAcC1hei 2r98BF0PCj59lIAnHQa0y+DM+Y3RQ/lbfVDGAzTUYv5WLfZyx5d47+xIt5+s1UNQBRqCXwYBrE+ /+tVrlBnP3c4/ X-Developer-Key: i=peter.griffin@linaro.org; a=openpgp; fpr=0EFC8E6F5578750D56B549FCCEE8B8D6023472BA With the exception of cmu_top, each CMU has a corresponding sysreg bank that contains the BUSCOMPONENT_DRCG_EN and optional MEMCLK registers. The BUSCOMPONENT_DRCG_EN register enables dynamic root clock gating of bus components and MEMCLK gates the sram clock. Now the clock driver supports automatic clock mode, provide the samsung,sysreg property so the driver can enable dynamic root clock gating of bus components and gate sram clock. Note without the property specified the driver simply falls back to previous behaviour of not configuring these registers so it is not an ABI break. Signed-off-by: Peter Griffin --- Changes in v4: - Update commit message (Peter) --- arch/arm64/boot/dts/exynos/google/gs101.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/gs101.dtsi b/arch/arm64/boot= /dts/exynos/google/gs101.dtsi index 9b38c2248016aa65293c0abf9ccaf20857d89693..2e25eeb0c2590b99ef98c7bdac3= caa0c34161706 100644 --- a/arch/arm64/boot/dts/exynos/google/gs101.dtsi +++ b/arch/arm64/boot/dts/exynos/google/gs101.dtsi @@ -578,6 +578,7 @@ cmu_misc: clock-controller@10010000 { clocks =3D <&cmu_top CLK_DOUT_CMU_MISC_BUS>, <&cmu_top CLK_DOUT_CMU_MISC_SSS>; clock-names =3D "bus", "sss"; + samsung,sysreg =3D <&sysreg_misc>; }; =20 sysreg_misc: syscon@10030000 { @@ -671,6 +672,7 @@ cmu_peric0: clock-controller@10800000 { <&cmu_top CLK_DOUT_CMU_PERIC0_BUS>, <&cmu_top CLK_DOUT_CMU_PERIC0_IP>; clock-names =3D "oscclk", "bus", "ip"; + samsung,sysreg =3D <&sysreg_peric0>; }; =20 sysreg_peric0: syscon@10820000 { @@ -1217,6 +1219,7 @@ cmu_peric1: clock-controller@10c00000 { <&cmu_top CLK_DOUT_CMU_PERIC1_BUS>, <&cmu_top CLK_DOUT_CMU_PERIC1_IP>; clock-names =3D "oscclk", "bus", "ip"; + samsung,sysreg =3D <&sysreg_peric1>; }; =20 sysreg_peric1: syscon@10c20000 { @@ -1575,6 +1578,7 @@ cmu_hsi0: clock-controller@11000000 { <&cmu_top CLK_DOUT_CMU_HSI0_USBDPDBG>; clock-names =3D "oscclk", "bus", "dpgtc", "usb31drd", "usbdpdbg"; + samsung,sysreg =3D <&sysreg_hsi0>; }; =20 sysreg_hsi0: syscon@11020000 { @@ -1646,6 +1650,7 @@ cmu_hsi2: clock-controller@14400000 { <&cmu_top CLK_DOUT_CMU_HSI2_UFS_EMBD>, <&cmu_top CLK_DOUT_CMU_HSI2_MMC_CARD>; clock-names =3D "oscclk", "bus", "pcie", "ufs", "mmc"; + samsung,sysreg =3D <&sysreg_hsi2>; }; =20 sysreg_hsi2: syscon@14420000 { @@ -1706,6 +1711,7 @@ cmu_apm: clock-controller@17400000 { =20 clocks =3D <&ext_24_5m>; clock-names =3D "oscclk"; + samsung,sysreg =3D <&sysreg_apm>; }; =20 sysreg_apm: syscon@17420000 { --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 07:21:52 2026 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.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 CB15C314D00 for ; Mon, 22 Dec 2025 10:22:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766398953; cv=none; b=nVc5XY+NDsdbDy4qgsAlw1PVwEBJxlYWK22ba6bTm41RK8JrwvK6kmueVYlRNFIY0eatkICNzD7+9HTfP9wavW4sf0fl4s5QjX/SrMUC8JOeOmGDFRkAMK2oz905EfBirsDCjVkKrQ30WD3pEm9RKgv1I0yveKDjmx/YrnwJvgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766398953; c=relaxed/simple; bh=w4lPht67fTvYGZmbShhkk5lw4OKSQQI5Wz3XQCPBKDM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mplP0B6NGwSy94DcFEvc2yH2H1Tf+4B2QR3bhmn/bPoExNGm9NIZZn3Rf5nggH3cIqXyRUlmgeJ40ihktyFB9yNaLq6lHsCJgRrJTyYdLqzcO3nUwKaisWEYpLTVJV0A7AwWDN3nwnJy1N3b6mTc0zxeHb/4p7ATy2x6yKnzh3w= 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=rUTncnMZ; arc=none smtp.client-ip=209.85.221.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="rUTncnMZ" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-42fbbc3df8fso1864523f8f.2 for ; Mon, 22 Dec 2025 02:22:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766398949; x=1767003749; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=X8lFBrW+4OdRAv68RetouxFahorox7xHTMUV5fmhvYk=; b=rUTncnMZ5LFWXasGaYErqcWzNFZhm15QsZIEHbmUsH1uDJ5wW7XpDXcpJ3a7HnSk5F Xjx0PCA+DTpgql5q0cUE7qaCWxALnJMer3Iszgz1uboa3tl8yVXpu/g0kOLpioXR34dD taUce9i3sxY0a6xOHSRzxPYhJvl10DjyLMJlniptsEmymESQH7HAcgSNm+jZuH7uV9CZ es9b4AS5ocNV1m7lNn070qRKzHgcyiwPkvzeqZ0JZPYpoTu6/cJA+I7DNXZqjz01RPD1 1ud93p+LRMTe7VsloRW7q6/k7HezhmM/OjDUijenTfYAQAK+sR/ny30KIkpew1CPhXuG Yp9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766398949; x=1767003749; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=X8lFBrW+4OdRAv68RetouxFahorox7xHTMUV5fmhvYk=; b=uTiU75sJ1Us/XQTWbquggYS3FIW40hH0enCzX/c5v4NMYOxZAMx8JQiFEmJ5SOcdIf mb7sWC1LOMKsS0lFTw87jlWEL2qZRyMzAAmMab9rnR+C+azUCzpa2r56zCBYcp2esZGI 8rectkmaA7IEZeBH4KPJZBoFyfT/2uZJERlKA64Cq0FIFXxhVsqtWPtbuN7d3RXQe6fT zgeO+WhRMZbOdCSpCzhO7UQ/m848F6pkcJEKPeHPs/IT5xc+YVzz4G600pVEfPLHKyAe X+BUBqOEQZaxr+eyfnlvEq9gUInnzYTnbZCeO8tw+QqNeJSg1FeNxJR+pWTzAwye45T8 YqDA== X-Forwarded-Encrypted: i=1; AJvYcCXdjmkt7mVCskvK6gC0Kg8UpbLEO5rPgmu3UyDuXFB5dQZOL08JiO5akrgG0xR0wmIQVwxgf/CSu3xz458=@vger.kernel.org X-Gm-Message-State: AOJu0YzIxamNai+N6c0wC47m0j+2CZPjOpFPauGyANow2N1PF197QrBx kDX8nzEkghrwklH5rHP8Zl/RQYCTIvYNXDlsV4ul4Jpr5/OWxjDlnXmzC4rOJrLH5FY= X-Gm-Gg: AY/fxX5vpT3QwjYfXZxQiNuh/jj9MeDeGZnulZOTS3jWcw306faCTUOlJa2UX2+B7pp ChXOc7rINbMuKvieACoOvhkFbgvVQbdlH8Bp15fMOzJwOIetUYZiUQeh8fPhz0ZOQkgALZE24DZ LhqyMNTAjUvbA1OZaUe6yaLPYZGH/1xSkc3ooR5QN2emOOeSkfW4x5ujgqyKjc2dKZAna1KdAjy G492j7lnvmnuoDNBDfN+it5+Vucb3WvTyCNb0Ah7FeIaWm9VRv2P7771Hmdx6LC6kQCKNyNuQ54 6rFAvxg5UbiXXnWzjwtJiFz95MbQucbEqSQbMcZVX26HnOIhxpjvUHxLw/K+r4X2Zn9MQ8e6icS 4/ltMvj7V3S8VtRa9onmTvtXORm8XsHijbztS+JufBc3zWguIOBvlGzvXKl6AZjXnEWtcr/j+C3 1EXSya+c27g9jcxQ/xUVzbm9Ub1UV4021YcfSFPgM= X-Google-Smtp-Source: AGHT+IHwsuvsKykhRcsrRT4EuGGpudjQmRK5Vh9S/3pTR2j0/GKLlwrD0MiqkE++JJaMGePv5JSXmg== X-Received: by 2002:a05:6000:2387:b0:430:8583:d196 with SMTP id ffacd0b85a97d-4324e5015eemr11832852f8f.33.1766398948941; Mon, 22 Dec 2025 02:22:28 -0800 (PST) Received: from gpeter-l.roam.corp.google.com ([150.228.9.32]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4324ea82feasm21082813f8f.24.2025.12.22.02.22.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Dec 2025 02:22:28 -0800 (PST) From: Peter Griffin Date: Mon, 22 Dec 2025 10:22:14 +0000 Subject: [PATCH v7 3/4] clk: samsung: Implement automatic clock gating mode for CMUs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251222-automatic-clocks-v7-3-fec86fa89874@linaro.org> References: <20251222-automatic-clocks-v7-0-fec86fa89874@linaro.org> In-Reply-To: <20251222-automatic-clocks-v7-0-fec86fa89874@linaro.org> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , =?utf-8?q?Andr=C3=A9_Draszik?= , Tudor Ambarus , Michael Turquette , Stephen Boyd , Sam Protsenko , Sylwester Nawrocki , Chanwoo Choi Cc: Will McVicker , Krzysztof Kozlowski , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, kernel-team@android.com, Peter Griffin , Krzysztof Kozlowski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=29438; i=peter.griffin@linaro.org; h=from:subject:message-id; bh=w4lPht67fTvYGZmbShhkk5lw4OKSQQI5Wz3XQCPBKDM=; b=owEBbQKS/ZANAwAKAc7ouNYCNHK6AcsmYgBpSRveiBSR7W4UCwqPwT2FRtr32O1X60tljX5hK /Cux5CsvSSJAjMEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaUkb3gAKCRDO6LjWAjRy uoc5EACcKjrVBuS3SC9hdNS+e8wEeH1sP2m2PeBauZGSOIHnx/RQw3rmG0WJGUzjvFfyla+Jhea isw9p5T1qrgQa26Suc72hFaYYkd+9+OONOWqjWXiu36PFPaue4fUI8QBES6+ibaZtekuhKBzsfv 4iDSJu8sLwO+flRzFTmp82msCSpCd+dw4C2KdXdBijBQPbapIGkWfeo8f04Xt5vWcPQFzIdY3Gx YlzGx7XxAfMxwpSeJrzbIlLLCufOPuC3pNAkijUdx8jWExK8B3U+GEzxt1YB6XULdskm5YfrR1p EKtI7seE32mflyL2gH1t0Nwr2wMfYKFKOnIYZyal8hjL3nTlpfuMQ0ogkMtMSMizFAc8u/FZNPG edfAl4WfzzPdfOiSgqKCRp8o9mXYt7UpxGSJPCBxxD8KrHfPNynahoqj8SJT+Vexd1jVV6fy6EK 7NJg3djrPRoApmCRzHw8TYGCUs7MNhxccNwPeu0arkSO9qHnFWcWVdszHknI53fFqzbhjukQFkj y9RkBsDmYlQFqrOK+ofJQqhDL0090pH+RjDAgaG0x7A+gvSDPFg7yCAoabr5S+0PZuPSVRbpKeP mGAczo8KmSfipQRYSsrjqYkvxuZNFrw53vX9jwPbYkca7UAyABr04OSUoMOH+/dZ7az2y5YQcyq 9u9ES2AbcCE/a/A== X-Developer-Key: i=peter.griffin@linaro.org; a=openpgp; fpr=0EFC8E6F5578750D56B549FCCEE8B8D6023472BA Update exynos_arm64_init_clocks() so that it enables the automatic clock mode bits in the CMU option register if the auto_clock_gate flag and option_offset fields are set for the CMU. To ensure compatibility with older DTs (that specified an incorrect CMU reg size), detect this and fallback to manual clock gate mode as the auto clock mode feature depends on registers in this area. The CMU option register bits are global and effect every clock component in the CMU, as such clearing the GATE_ENABLE_HWACG bit and setting GATE_MANUAL bit on every gate register is only required if auto_clock_gate is false. Additionally if auto_clock_gate is enabled the dynamic root clock gating and memclk registers will be configured in the corresponding CMUs sysreg bank. These registers are exposed via syscon, so the register samsung_clk_save/restore paths are updated to also take a regmap. As many gates for various Samsung SoCs are already exposed in the Samsung clock drivers a new samsung_auto_clk_gate_ops is implemented. This uses some CMU debug registers to report whether clocks are enabled or disabled when operating in automatic mode. This allows /sys/kernel/debug/clk/clk_summary to still dump the entire clock tree and correctly report the status of each clock in the system. Signed-off-by: Peter Griffin --- Changes in v3: - Add missing 'np' func param to kerneldoc in samsung_cmu_register_clocks (0-DAY CI) Changes in v2: - Fallback to manual clock gate mode for old DTs with incorrect CMU size (added samsung_is_auto_capable()) (Krzysztof) - Rename OPT_UNKNOWN bit to OPT_EN_LAYER2_CTRL (Andre) - Rename OPT_EN_MEM_PM_GATING to OPT_EN_MEM_PWR_GATING (Andre) - Reverse Option bit definitions LSB -> MSB (Krzysztof) - Update kerneldoc init_clk_regs comment (Andre) - Fix space on various comments (Andre) - Fix regmap typo on samsung_clk_save/restore calls (Andre) - Include error code in pr_err message (Andre) - Add macros for dcrg and memclk (Andre) - Avoid confusing !IS_ERR_OR_NULL(ctx->sysreg) test (Krzysztof) - Update kerneldoc to mention drcg_offset & memclk_offset are in sysreg (An= dre) - Fix 0-DAY CI randconfig warning (0-DAY CI) - Update clk-s5pv210 and clk-s3c64xx.c samsung_clk_sleep_init call sites (P= eter) --- drivers/clk/samsung/clk-exynos-arm64.c | 62 ++++++++-- drivers/clk/samsung/clk-exynos4.c | 12 +- drivers/clk/samsung/clk-exynos4412-isp.c | 4 +- drivers/clk/samsung/clk-exynos5250.c | 2 +- drivers/clk/samsung/clk-exynos5420.c | 4 +- drivers/clk/samsung/clk-s3c64xx.c | 4 +- drivers/clk/samsung/clk-s5pv210.c | 2 +- drivers/clk/samsung/clk.c | 200 +++++++++++++++++++++++++++= +--- drivers/clk/samsung/clk.h | 55 ++++++++- 9 files changed, 302 insertions(+), 43 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos-arm64.c b/drivers/clk/samsung/c= lk-exynos-arm64.c index bf7de21f329ec89069dcf817ca578fcf9b2d9809..11e4d49f2390ba714eff5a329bb= 1f427cd6437b9 100644 --- a/drivers/clk/samsung/clk-exynos-arm64.c +++ b/drivers/clk/samsung/clk-exynos-arm64.c @@ -24,6 +24,16 @@ #define GATE_MANUAL BIT(20) #define GATE_ENABLE_HWACG BIT(28) =20 +/* Option register bits */ +#define OPT_EN_MEM_PWR_GATING BIT(24) +#define OPT_EN_AUTO_GATING BIT(28) +#define OPT_EN_PWR_MANAGEMENT BIT(29) +#define OPT_EN_LAYER2_CTRL BIT(30) +#define OPT_EN_DBG BIT(31) + +#define CMU_OPT_GLOBAL_EN_AUTO_GATING (OPT_EN_DBG | OPT_EN_LAYER2_CTRL | \ + OPT_EN_PWR_MANAGEMENT | OPT_EN_AUTO_GATING | OPT_EN_MEM_PWR_GATING) + /* PLL_CONx_PLL register offsets range */ #define PLL_CON_OFF_START 0x100 #define PLL_CON_OFF_END 0x600 @@ -37,6 +47,8 @@ struct exynos_arm64_cmu_data { unsigned int nr_clk_save; const struct samsung_clk_reg_dump *clk_suspend; unsigned int nr_clk_suspend; + struct samsung_clk_reg_dump *clk_sysreg_save; + unsigned int nr_clk_sysreg; =20 struct clk *clk; struct clk **pclks; @@ -76,19 +88,41 @@ static void __init exynos_arm64_init_clocks(struct devi= ce_node *np, const unsigned long *reg_offs =3D cmu->clk_regs; size_t reg_offs_len =3D cmu->nr_clk_regs; void __iomem *reg_base; + bool init_auto; size_t i; =20 reg_base =3D of_iomap(np, 0); if (!reg_base) panic("%s: failed to map registers\n", __func__); =20 + /* ensure compatibility with older DTs */ + if (cmu->auto_clock_gate && samsung_is_auto_capable(np)) + init_auto =3D true; + else + init_auto =3D false; + + if (cmu->option_offset && init_auto) { + /* + * Enable the global automatic mode for the entire CMU. + * This overrides the individual HWACG bits in each of the + * individual gate, mux and qch registers. + */ + writel(CMU_OPT_GLOBAL_EN_AUTO_GATING, + reg_base + cmu->option_offset); + } + for (i =3D 0; i < reg_offs_len; ++i) { void __iomem *reg =3D reg_base + reg_offs[i]; u32 val; =20 if (cmu->manual_plls && is_pll_con1_reg(reg_offs[i])) { writel(PLL_CON1_MANUAL, reg); - } else if (is_gate_reg(reg_offs[i])) { + } else if (is_gate_reg(reg_offs[i]) && !init_auto) { + /* + * Setting GATE_MANUAL bit (which is described in TRM as + * reserved!) overrides the global CMU automatic mode + * option. + */ val =3D readl(reg); val |=3D GATE_MANUAL; val &=3D ~GATE_ENABLE_HWACG; @@ -210,8 +244,8 @@ void __init exynos_arm64_register_cmu(struct device *de= v, /** * exynos_arm64_register_cmu_pm - Register Exynos CMU domain with PM suppo= rt * - * @pdev: Platform device object - * @set_manual: If true, set gate clocks to manual mode + * @pdev: Platform device object + * @init_clk_regs: If true, initialize CMU registers * * It's a version of exynos_arm64_register_cmu() with PM support. Should be * called from probe function of platform driver. @@ -219,7 +253,7 @@ void __init exynos_arm64_register_cmu(struct device *de= v, * Return: 0 on success, or negative error code on error. */ int __init exynos_arm64_register_cmu_pm(struct platform_device *pdev, - bool set_manual) + bool init_clk_regs) { const struct samsung_cmu_info *cmu; struct device *dev =3D &pdev->dev; @@ -249,7 +283,7 @@ int __init exynos_arm64_register_cmu_pm(struct platform= _device *pdev, dev_err(dev, "%s: could not enable bus clock %s; err =3D %d\n", __func__, cmu->clk_name, ret); =20 - if (set_manual) + if (init_clk_regs) exynos_arm64_init_clocks(np, cmu); =20 reg_base =3D devm_platform_ioremap_resource(pdev, 0); @@ -268,8 +302,10 @@ int __init exynos_arm64_register_cmu_pm(struct platfor= m_device *pdev, pm_runtime_set_active(dev); pm_runtime_enable(dev); =20 - samsung_cmu_register_clocks(data->ctx, cmu); + samsung_cmu_register_clocks(data->ctx, cmu, np); samsung_clk_of_add_provider(dev->of_node, data->ctx); + /* sysreg DT nodes reference a clock in this CMU */ + samsung_en_dyn_root_clk_gating(np, data->ctx, cmu); pm_runtime_put_sync(dev); =20 return 0; @@ -280,14 +316,17 @@ int exynos_arm64_cmu_suspend(struct device *dev) struct exynos_arm64_cmu_data *data =3D dev_get_drvdata(dev); int i; =20 - samsung_clk_save(data->ctx->reg_base, data->clk_save, + samsung_clk_save(data->ctx->reg_base, NULL, data->clk_save, data->nr_clk_save); =20 + samsung_clk_save(NULL, data->ctx->sysreg, data->clk_sysreg_save, + data->nr_clk_sysreg); + for (i =3D 0; i < data->nr_pclks; i++) clk_prepare_enable(data->pclks[i]); =20 /* For suspend some registers have to be set to certain values */ - samsung_clk_restore(data->ctx->reg_base, data->clk_suspend, + samsung_clk_restore(data->ctx->reg_base, NULL, data->clk_suspend, data->nr_clk_suspend); =20 for (i =3D 0; i < data->nr_pclks; i++) @@ -308,9 +347,14 @@ int exynos_arm64_cmu_resume(struct device *dev) for (i =3D 0; i < data->nr_pclks; i++) clk_prepare_enable(data->pclks[i]); =20 - samsung_clk_restore(data->ctx->reg_base, data->clk_save, + samsung_clk_restore(data->ctx->reg_base, NULL, data->clk_save, data->nr_clk_save); =20 + if (data->ctx->sysreg) + samsung_clk_restore(NULL, data->ctx->sysreg, + data->clk_sysreg_save, + data->nr_clk_sysreg); + for (i =3D 0; i < data->nr_pclks; i++) clk_disable_unprepare(data->pclks[i]); =20 diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-ex= ynos4.c index cc5c1644c41c08b27bc48d809a08cd8a006cbe8f..246bd28bac2d577a58a7b9e0e93= b700548370a36 100644 --- a/drivers/clk/samsung/clk-exynos4.c +++ b/drivers/clk/samsung/clk-exynos4.c @@ -1361,12 +1361,12 @@ static void __init exynos4_clk_init(struct device_n= ode *np, ARRAY_SIZE(exynos4x12_plls)); } =20 - samsung_cmu_register_clocks(ctx, &cmu_info_exynos4); + samsung_cmu_register_clocks(ctx, &cmu_info_exynos4, np); =20 if (exynos4_soc =3D=3D EXYNOS4210) { - samsung_cmu_register_clocks(ctx, &cmu_info_exynos4210); + samsung_cmu_register_clocks(ctx, &cmu_info_exynos4210, np); } else { - samsung_cmu_register_clocks(ctx, &cmu_info_exynos4x12); + samsung_cmu_register_clocks(ctx, &cmu_info_exynos4x12, np); if (soc =3D=3D EXYNOS4412) samsung_clk_register_cpu(ctx, exynos4412_cpu_clks, ARRAY_SIZE(exynos4412_cpu_clks)); @@ -1378,15 +1378,15 @@ static void __init exynos4_clk_init(struct device_n= ode *np, if (soc =3D=3D EXYNOS4212 || soc =3D=3D EXYNOS4412) exynos4x12_core_down_clock(); =20 - samsung_clk_extended_sleep_init(reg_base, + samsung_clk_extended_sleep_init(reg_base, NULL, exynos4_clk_regs, ARRAY_SIZE(exynos4_clk_regs), src_mask_suspend, ARRAY_SIZE(src_mask_suspend)); if (exynos4_soc =3D=3D EXYNOS4210) - samsung_clk_extended_sleep_init(reg_base, + samsung_clk_extended_sleep_init(reg_base, NULL, exynos4210_clk_save, ARRAY_SIZE(exynos4210_clk_save), src_mask_suspend_e4210, ARRAY_SIZE(src_mask_suspend_e4210)); else - samsung_clk_sleep_init(reg_base, exynos4x12_clk_save, + samsung_clk_sleep_init(reg_base, NULL, exynos4x12_clk_save, ARRAY_SIZE(exynos4x12_clk_save)); =20 samsung_clk_of_add_provider(np, ctx); diff --git a/drivers/clk/samsung/clk-exynos4412-isp.c b/drivers/clk/samsung= /clk-exynos4412-isp.c index fa915057e109e0008ebe0b1b5d1652fd5804e82b..772bc18a1e686f23b11bf160b80= 3becff6279637 100644 --- a/drivers/clk/samsung/clk-exynos4412-isp.c +++ b/drivers/clk/samsung/clk-exynos4412-isp.c @@ -94,7 +94,7 @@ static int __maybe_unused exynos4x12_isp_clk_suspend(stru= ct device *dev) { struct samsung_clk_provider *ctx =3D dev_get_drvdata(dev); =20 - samsung_clk_save(ctx->reg_base, exynos4x12_save_isp, + samsung_clk_save(ctx->reg_base, NULL, exynos4x12_save_isp, ARRAY_SIZE(exynos4x12_clk_isp_save)); return 0; } @@ -103,7 +103,7 @@ static int __maybe_unused exynos4x12_isp_clk_resume(str= uct device *dev) { struct samsung_clk_provider *ctx =3D dev_get_drvdata(dev); =20 - samsung_clk_restore(ctx->reg_base, exynos4x12_save_isp, + samsung_clk_restore(ctx->reg_base, NULL, exynos4x12_save_isp, ARRAY_SIZE(exynos4x12_clk_isp_save)); return 0; } diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk= -exynos5250.c index e90d3a0848cbc24b2709c10795f6affcda404567..f97f30b29be7317db8186bac39c= f52e1893eb106 100644 --- a/drivers/clk/samsung/clk-exynos5250.c +++ b/drivers/clk/samsung/clk-exynos5250.c @@ -854,7 +854,7 @@ static void __init exynos5250_clk_init(struct device_no= de *np) PWR_CTRL2_CORE2_UP_RATIO | PWR_CTRL2_CORE1_UP_RATIO); __raw_writel(tmp, reg_base + PWR_CTRL2); =20 - samsung_clk_sleep_init(reg_base, exynos5250_clk_regs, + samsung_clk_sleep_init(reg_base, NULL, exynos5250_clk_regs, ARRAY_SIZE(exynos5250_clk_regs)); exynos5_subcmus_init(ctx, ARRAY_SIZE(exynos5250_subcmus), exynos5250_subcmus); diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk= -exynos5420.c index a9df4e6db82fa7831d4e5c7210b0163d7d301ec1..1982e0751ceec7e57f9e82d96dc= badce1f691092 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c @@ -1649,12 +1649,12 @@ static void __init exynos5x_clk_init(struct device_= node *np, ARRAY_SIZE(exynos5800_cpu_clks)); } =20 - samsung_clk_extended_sleep_init(reg_base, + samsung_clk_extended_sleep_init(reg_base, NULL, exynos5x_clk_regs, ARRAY_SIZE(exynos5x_clk_regs), exynos5420_set_clksrc, ARRAY_SIZE(exynos5420_set_clksrc)); =20 if (soc =3D=3D EXYNOS5800) { - samsung_clk_sleep_init(reg_base, exynos5800_clk_regs, + samsung_clk_sleep_init(reg_base, NULL, exynos5800_clk_regs, ARRAY_SIZE(exynos5800_clk_regs)); =20 exynos5_subcmus_init(ctx, ARRAY_SIZE(exynos5800_subcmus), diff --git a/drivers/clk/samsung/clk-s3c64xx.c b/drivers/clk/samsung/clk-s3= c64xx.c index 397a057af5d1e704e7ead7ba04b477fdc28c45bf..5a2d5a5703ffc5ed48b9a18a20c= 39be2de827920 100644 --- a/drivers/clk/samsung/clk-s3c64xx.c +++ b/drivers/clk/samsung/clk-s3c64xx.c @@ -449,10 +449,10 @@ void __init s3c64xx_clk_init(struct device_node *np, = unsigned long xtal_f, samsung_clk_register_alias(ctx, s3c64xx_clock_aliases, ARRAY_SIZE(s3c64xx_clock_aliases)); =20 - samsung_clk_sleep_init(reg_base, s3c64xx_clk_regs, + samsung_clk_sleep_init(reg_base, NULL, s3c64xx_clk_regs, ARRAY_SIZE(s3c64xx_clk_regs)); if (!is_s3c6400) - samsung_clk_sleep_init(reg_base, s3c6410_clk_regs, + samsung_clk_sleep_init(reg_base, NULL, s3c6410_clk_regs, ARRAY_SIZE(s3c6410_clk_regs)); =20 samsung_clk_of_add_provider(np, ctx); diff --git a/drivers/clk/samsung/clk-s5pv210.c b/drivers/clk/samsung/clk-s5= pv210.c index 9a4217cc1908aa60ebbe51b2b5c841138cc46ef3..4ee4f2b5efbc1d4770fefff22de= 21f7d4e5e9506 100644 --- a/drivers/clk/samsung/clk-s5pv210.c +++ b/drivers/clk/samsung/clk-s5pv210.c @@ -782,7 +782,7 @@ static void __init __s5pv210_clk_init(struct device_nod= e *np, samsung_clk_register_alias(ctx, s5pv210_aliases, ARRAY_SIZE(s5pv210_aliases)); =20 - samsung_clk_sleep_init(reg_base, s5pv210_clk_regs, + samsung_clk_sleep_init(reg_base, NULL, s5pv210_clk_regs, ARRAY_SIZE(s5pv210_clk_regs)); =20 samsung_clk_of_add_provider(np, ctx); diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c index c149ca6c221725195faeb76b0d73374c3b48261b..06ea5deef4ee2ffb87dcd141025= 61886ea80b7bc 100644 --- a/drivers/clk/samsung/clk.c +++ b/drivers/clk/samsung/clk.c @@ -12,8 +12,10 @@ #include #include #include +#include #include #include +#include #include =20 #include "clk.h" @@ -21,19 +23,29 @@ static LIST_HEAD(clock_reg_cache_list); =20 void samsung_clk_save(void __iomem *base, + struct regmap *regmap, struct samsung_clk_reg_dump *rd, unsigned int num_regs) { - for (; num_regs > 0; --num_regs, ++rd) - rd->value =3D readl(base + rd->offset); + for (; num_regs > 0; --num_regs, ++rd) { + if (base) + rd->value =3D readl(base + rd->offset); + else if (regmap) + regmap_read(regmap, rd->offset, &rd->value); + } } =20 void samsung_clk_restore(void __iomem *base, + struct regmap *regmap, const struct samsung_clk_reg_dump *rd, unsigned int num_regs) { - for (; num_regs > 0; --num_regs, ++rd) - writel(rd->value, base + rd->offset); + for (; num_regs > 0; --num_regs, ++rd) { + if (base) + writel(rd->value, base + rd->offset); + else if (regmap) + regmap_write(regmap, rd->offset, rd->value); + } } =20 struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump( @@ -227,6 +239,103 @@ void __init samsung_clk_register_div(struct samsung_c= lk_provider *ctx, } } =20 +/* + * Some older DT's have an incorrect CMU resource size which is incompatib= le + * with the auto clock mode feature. In such cases we switch back to manual + * clock gating mode. + */ +bool samsung_is_auto_capable(struct device_node *np) +{ + struct resource res; + resource_size_t size; + + if (of_address_to_resource(np, 0, &res)) + return false; + + size =3D resource_size(&res); + if (size !=3D 0x10000) { + pr_warn("%pOF: incorrect res size for automatic clocks\n", np); + return false; + } + return true; +} + +#define ACG_MSK GENMASK(6, 4) +#define CLK_IDLE GENMASK(5, 4) +static int samsung_auto_clk_gate_is_en(struct clk_hw *hw) +{ + u32 reg; + struct clk_gate *gate =3D to_clk_gate(hw); + + reg =3D readl(gate->reg); + return ((reg & ACG_MSK) =3D=3D CLK_IDLE) ? 0 : 1; +} + +/* enable and disable are nops in automatic clock mode */ +static int samsung_auto_clk_gate_en(struct clk_hw *hw) +{ + return 0; +} + +static void samsung_auto_clk_gate_dis(struct clk_hw *hw) +{ +} + +static const struct clk_ops samsung_auto_clk_gate_ops =3D { + .enable =3D samsung_auto_clk_gate_en, + .disable =3D samsung_auto_clk_gate_dis, + .is_enabled =3D samsung_auto_clk_gate_is_en, +}; + +struct clk_hw *samsung_register_auto_gate(struct device *dev, + struct device_node *np, const char *name, + const char *parent_name, const struct clk_hw *parent_hw, + const struct clk_parent_data *parent_data, + unsigned long flags, + void __iomem *reg, u8 bit_idx, + u8 clk_gate_flags, spinlock_t *lock) +{ + struct clk_gate *gate; + struct clk_hw *hw; + struct clk_init_data init =3D {}; + int ret =3D -EINVAL; + + /* allocate the gate */ + gate =3D kzalloc(sizeof(*gate), GFP_KERNEL); + if (!gate) + return ERR_PTR(-ENOMEM); + + init.name =3D name; + init.ops =3D &samsung_auto_clk_gate_ops; + init.flags =3D flags; + init.parent_names =3D parent_name ? &parent_name : NULL; + init.parent_hws =3D parent_hw ? &parent_hw : NULL; + init.parent_data =3D parent_data; + if (parent_name || parent_hw || parent_data) + init.num_parents =3D 1; + else + init.num_parents =3D 0; + + /* struct clk_gate assignments */ + gate->reg =3D reg; + gate->bit_idx =3D bit_idx; + gate->flags =3D clk_gate_flags; + gate->lock =3D lock; + gate->hw.init =3D &init; + + hw =3D &gate->hw; + if (dev || !np) + ret =3D clk_hw_register(dev, hw); + else if (np) + ret =3D of_clk_hw_register(np, hw); + if (ret) { + kfree(gate); + hw =3D ERR_PTR(ret); + } + + return hw; +} + /* register a list of gate clocks */ void __init samsung_clk_register_gate(struct samsung_clk_provider *ctx, const struct samsung_gate_clock *list, @@ -234,14 +343,24 @@ void __init samsung_clk_register_gate(struct samsung_= clk_provider *ctx, { struct clk_hw *clk_hw; unsigned int idx; + void __iomem *reg_offs; =20 for (idx =3D 0; idx < nr_clk; idx++, list++) { - clk_hw =3D clk_hw_register_gate(ctx->dev, list->name, list->parent_name, - list->flags, ctx->reg_base + list->offset, + reg_offs =3D ctx->reg_base + list->offset; + + if (ctx->auto_clock_gate && ctx->gate_dbg_offset) + clk_hw =3D samsung_register_auto_gate(ctx->dev, NULL, + list->name, list->parent_name, NULL, NULL, + list->flags, reg_offs + ctx->gate_dbg_offset, list->bit_idx, list->gate_flags, &ctx->lock); + else + clk_hw =3D clk_hw_register_gate(ctx->dev, list->name, + list->parent_name, list->flags, + ctx->reg_base + list->offset, list->bit_idx, + list->gate_flags, &ctx->lock); if (IS_ERR(clk_hw)) { - pr_err("%s: failed to register clock %s\n", __func__, - list->name); + pr_err("%s: failed to register clock %s: %ld\n", __func__, + list->name, PTR_ERR(clk_hw)); continue; } =20 @@ -276,10 +395,11 @@ static int samsung_clk_suspend(void *data) struct samsung_clock_reg_cache *reg_cache; =20 list_for_each_entry(reg_cache, &clock_reg_cache_list, node) { - samsung_clk_save(reg_cache->reg_base, reg_cache->rdump, - reg_cache->rd_num); - samsung_clk_restore(reg_cache->reg_base, reg_cache->rsuspend, - reg_cache->rsuspend_num); + samsung_clk_save(reg_cache->reg_base, reg_cache->sysreg, + reg_cache->rdump, reg_cache->rd_num); + samsung_clk_restore(reg_cache->reg_base, reg_cache->sysreg, + reg_cache->rsuspend, + reg_cache->rsuspend_num); } return 0; } @@ -289,8 +409,8 @@ static void samsung_clk_resume(void *data) struct samsung_clock_reg_cache *reg_cache; =20 list_for_each_entry(reg_cache, &clock_reg_cache_list, node) - samsung_clk_restore(reg_cache->reg_base, reg_cache->rdump, - reg_cache->rd_num); + samsung_clk_restore(reg_cache->reg_base, reg_cache->sysreg, + reg_cache->rdump, reg_cache->rd_num); } =20 static const struct syscore_ops samsung_clk_syscore_ops =3D { @@ -303,6 +423,7 @@ static struct syscore samsung_clk_syscore =3D { }; =20 void samsung_clk_extended_sleep_init(void __iomem *reg_base, + struct regmap *sysreg, const unsigned long *rdump, unsigned long nr_rdump, const struct samsung_clk_reg_dump *rsuspend, @@ -323,6 +444,7 @@ void samsung_clk_extended_sleep_init(void __iomem *reg_= base, register_syscore(&samsung_clk_syscore); =20 reg_cache->reg_base =3D reg_base; + reg_cache->sysreg =3D sysreg; reg_cache->rd_num =3D nr_rdump; reg_cache->rsuspend =3D rsuspend; reg_cache->rsuspend_num =3D nr_rsuspend; @@ -334,10 +456,20 @@ void samsung_clk_extended_sleep_init(void __iomem *re= g_base, * samsung_cmu_register_clocks() - Register all clocks provided in CMU obj= ect * @ctx: Clock provider object * @cmu: CMU object with clocks to register + * @np: CMU device tree node */ void __init samsung_cmu_register_clocks(struct samsung_clk_provider *ctx, - const struct samsung_cmu_info *cmu) + const struct samsung_cmu_info *cmu, + struct device_node *np) { + if (samsung_is_auto_capable(np) && cmu->auto_clock_gate) + ctx->auto_clock_gate =3D cmu->auto_clock_gate; + + ctx->gate_dbg_offset =3D cmu->gate_dbg_offset; + ctx->option_offset =3D cmu->option_offset; + ctx->drcg_offset =3D cmu->drcg_offset; + ctx->memclk_offset =3D cmu->memclk_offset; + if (cmu->pll_clks) samsung_clk_register_pll(ctx, cmu->pll_clks, cmu->nr_pll_clks); if (cmu->mux_clks) @@ -357,6 +489,37 @@ void __init samsung_cmu_register_clocks(struct samsung= _clk_provider *ctx, samsung_clk_register_cpu(ctx, cmu->cpu_clks, cmu->nr_cpu_clks); } =20 +/* Each bit enable/disables DRCG of a bus component */ +#define DRCG_EN_MSK GENMASK(31, 0) +#define MEMCLK_EN BIT(0) + +/* Enable Dynamic Root Clock Gating (DRCG) of bus components */ +void samsung_en_dyn_root_clk_gating(struct device_node *np, + struct samsung_clk_provider *ctx, + const struct samsung_cmu_info *cmu) +{ + if (!ctx->auto_clock_gate) + return; + + ctx->sysreg =3D syscon_regmap_lookup_by_phandle(np, "samsung,sysreg"); + if (IS_ERR(ctx->sysreg)) { + pr_warn("%pOF: Unable to get CMU sysreg\n", np); + ctx->sysreg =3D NULL; + } else { + /* Enable DRCG for all bus components */ + regmap_write(ctx->sysreg, ctx->drcg_offset, DRCG_EN_MSK); + /* Enable memclk gate (not present on all sysreg) */ + if (ctx->memclk_offset) + regmap_write_bits(ctx->sysreg, ctx->memclk_offset, + MEMCLK_EN, 0x0); + + samsung_clk_extended_sleep_init(NULL, ctx->sysreg, + cmu->sysreg_clk_regs, + cmu->nr_sysreg_clk_regs, + NULL, 0); + } +} + /* * Common function which registers plls, muxes, dividers and gates * for each CMU. It also add CMU register list to register cache. @@ -375,14 +538,17 @@ struct samsung_clk_provider * __init samsung_cmu_regi= ster_one( } =20 ctx =3D samsung_clk_init(NULL, reg_base, cmu->nr_clk_ids); - samsung_cmu_register_clocks(ctx, cmu); + samsung_cmu_register_clocks(ctx, cmu, np); =20 if (cmu->clk_regs) - samsung_clk_extended_sleep_init(reg_base, + samsung_clk_extended_sleep_init(reg_base, NULL, cmu->clk_regs, cmu->nr_clk_regs, cmu->suspend_regs, cmu->nr_suspend_regs); =20 samsung_clk_of_add_provider(np, ctx); =20 + /* sysreg DT nodes reference a clock in this CMU */ + samsung_en_dyn_root_clk_gating(np, ctx, cmu); + return ctx; } diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h index 18660c1ac6f0106b17b9efc9c6b3cd62d46f7b82..a56aa3be54d817cd24bf2bc2942= 7e783a1a9a859 100644 --- a/drivers/clk/samsung/clk.h +++ b/drivers/clk/samsung/clk.h @@ -12,6 +12,7 @@ =20 #include #include +#include #include "clk-pll.h" #include "clk-cpu.h" =20 @@ -19,13 +20,25 @@ * struct samsung_clk_provider - information about clock provider * @reg_base: virtual address for the register base * @dev: clock provider device needed for runtime PM + * @sysreg: syscon regmap for clock-provider sysreg controller * @lock: maintains exclusion between callbacks for a given clock-provider + * @auto_clock_gate: enable auto clk mode for all clocks in clock-provider + * @gate_dbg_offset: gate debug reg offset. Used for all gates in auto clk= mode + * @option_offset: option reg offset. Enables auto mode for clock-provider + * @drcg_offset: dynamic root clk gate enable register offset in sysreg + * @memclk_offset: memclk enable register offset in sysreg * @clk_data: holds clock related data like clk_hw* and number of clocks */ struct samsung_clk_provider { void __iomem *reg_base; struct device *dev; + struct regmap *sysreg; spinlock_t lock; + bool auto_clock_gate; + u32 gate_dbg_offset; + u32 option_offset; + u32 drcg_offset; + u32 memclk_offset; /* clk_data must be the last entry due to variable length 'hws' array */ struct clk_hw_onecell_data clk_data; }; @@ -310,6 +323,7 @@ struct samsung_cpu_clock { struct samsung_clock_reg_cache { struct list_head node; void __iomem *reg_base; + struct regmap *sysreg; struct samsung_clk_reg_dump *rdump; unsigned int rd_num; const struct samsung_clk_reg_dump *rsuspend; @@ -338,7 +352,14 @@ 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 + * @sysreg_clk_regs: list of sysreg clock registers + * @nr_sysreg_clk_regs: count of clock registers in @sysreg_clk_regs * @manual_plls: Enable manual control for PLL clocks + * @auto_clock_gate: enable auto clock mode for all components in CMU + * @gate_dbg_offset: gate debug reg offset. Used by all gates in auto clk = mode + * @option_offset: option reg offset. Enables auto clk mode for entire CMU + * @drcg_offset: dynamic root clk gate enable register offset in sysreg + * @memclk_offset: memclk enable register offset in sysreg */ struct samsung_cmu_info { const struct samsung_pll_clock *pll_clks; @@ -364,8 +385,16 @@ struct samsung_cmu_info { unsigned int nr_suspend_regs; const char *clk_name; =20 + const unsigned long *sysreg_clk_regs; + unsigned int nr_sysreg_clk_regs; + /* ARM64 Exynos CMUs */ bool manual_plls; + bool auto_clock_gate; + u32 gate_dbg_offset; + u32 option_offset; + u32 drcg_offset; + u32 memclk_offset; }; =20 struct samsung_clk_provider *samsung_clk_init(struct device *dev, @@ -408,35 +437,55 @@ void samsung_clk_register_cpu(struct samsung_clk_prov= ider *ctx, const struct samsung_cpu_clock *list, unsigned int nr_clk); =20 void samsung_cmu_register_clocks(struct samsung_clk_provider *ctx, - const struct samsung_cmu_info *cmu); + const struct samsung_cmu_info *cmu, + struct device_node *np); struct samsung_clk_provider *samsung_cmu_register_one( struct device_node *, const struct samsung_cmu_info *); =20 #ifdef CONFIG_PM_SLEEP void samsung_clk_extended_sleep_init(void __iomem *reg_base, + struct regmap *sysreg, const unsigned long *rdump, unsigned long nr_rdump, const struct samsung_clk_reg_dump *rsuspend, unsigned long nr_rsuspend); #else static inline void samsung_clk_extended_sleep_init(void __iomem *reg_base, + struct regmap *sysreg, const unsigned long *rdump, unsigned long nr_rdump, const struct samsung_clk_reg_dump *rsuspend, unsigned long nr_rsuspend) {} #endif -#define samsung_clk_sleep_init(reg_base, rdump, nr_rdump) \ - samsung_clk_extended_sleep_init(reg_base, rdump, nr_rdump, NULL, 0) +#define samsung_clk_sleep_init(reg_base, sysreg, rdump, nr_rdump) \ + samsung_clk_extended_sleep_init(reg_base, sysreg, rdump, nr_rdump, \ + NULL, 0) =20 void samsung_clk_save(void __iomem *base, + struct regmap *regmap, struct samsung_clk_reg_dump *rd, unsigned int num_regs); void samsung_clk_restore(void __iomem *base, + struct regmap *regmap, const struct samsung_clk_reg_dump *rd, unsigned int num_regs); struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump( const unsigned long *rdump, unsigned long nr_rdump); =20 +void samsung_en_dyn_root_clk_gating(struct device_node *np, + struct samsung_clk_provider *ctx, + const struct samsung_cmu_info *cmu); + +struct clk_hw *samsung_register_auto_gate(struct device *dev, + struct device_node *np, const char *name, + const char *parent_name, const struct clk_hw *parent_hw, + const struct clk_parent_data *parent_data, + unsigned long flags, + void __iomem *reg, u8 bit_idx, + u8 clk_gate_flags, spinlock_t *lock); + +bool samsung_is_auto_capable(struct device_node *np); + #endif /* __SAMSUNG_CLK_H */ --=20 2.52.0.351.gbe84eed79e-goog From nobody Sun Feb 8 07:21:52 2026 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.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 5F1F23161B8 for ; Mon, 22 Dec 2025 10:22:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766398954; cv=none; b=EehUJa8upmxbxsSUI6KRIg4u2sGwaasMmgbZXBLvXfZC02+5hNf26g8aJ+vkWfXQPuu03f9BeTeOHRWydWkUsGdZEfouyq0NhiUyQkg7cepHiv7qY2G8XYHnqOAKRliJCHvnT6/1osuGt5Ac6rf0s0GU9zeBd8x0nZ1oaQxbKwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766398954; c=relaxed/simple; bh=/Z6zZxIOHE0bexMt7q7vSkBhyGsyTsuiXJos9cuRaKY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R5TC0F9yUgcDnWqnT+xZBkENj/8zEpgrgqnHIVSsvnl/y4p55Qaef5ON1QxR5Hr9dZ0C2QOuvhd+vDijQRRSciG07e52pZFzGssx+vsuCFOPhakYI51OxthlqV/jfgVXOkTQ4/zANoFnb359E374YfCRuiujwz1XOR3Xe3FQaU0= 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=lg47hCeS; arc=none smtp.client-ip=209.85.221.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="lg47hCeS" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-42fb0fc5aa4so3076478f8f.1 for ; Mon, 22 Dec 2025 02:22:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766398951; x=1767003751; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=PT6Q5dW5KkgWP7tZaLfWqSYR2o+Foff/zTHPq2XLG/U=; b=lg47hCeSmMjUvQrEtb7Ezuxlb16OX7yrns6rgEIhkV5XxN1j/6gdcrGiWsJ900OeBr K6RoL5Tk347+AFFWB3yOlZHpa0Wo9fQzg05GSrZZ3ymbv5UOqDvRpCWaMz1ldebzN9FY kqMPeQLCIvSJC/HI2cdHm0IdbDjTHCPvFqmQ9ShQSZCpdLP+cP7M+8etUlL+hhwK2nNr FbN93hCpKdcvuf8uiboRFZpItxJUwUOr+XCXOTrRxQEAGwkUVWOdJa9/GYrc15d78G/x 0dA+0ViljaUfRL2z7g9q+FiJKoFs74QIgpt98WhQwDvY7WG2RuUy3Zl9jkP8bDTtc/Ge oZwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766398951; x=1767003751; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=PT6Q5dW5KkgWP7tZaLfWqSYR2o+Foff/zTHPq2XLG/U=; b=ZCjM7/jKXG8lDgomYixQKiibeV9WC2WbqTSa/KMmZvFJApuy3j4W2Czpd0TXZMax6p 92XdbBiZigo9+pnDx42K3Bqu6L4kAMFGNq3lTtMIFtyCDE5LbQQO1Nal/0firTXWdjUD dZIVnG532PsT2rrNFb5thc1zSjh3zqBySna9vnactv9VvKr1xpGfiURQX/BxD+1j+rvM YNowBygJdgpeq4Wf5vN7mR0UoqnzHL9Vxsrq242kUyA3cXjsbfwAEUPaW6Og5AqErCWT lXjIHvUff8Q1JFLKtZqeUGoqHF2OzGotQvryqWlgzeQCdkUpHsuGvExU5ujE7Z0pwyf4 7poQ== X-Forwarded-Encrypted: i=1; AJvYcCXS1RD1IZgzGsoBtdoXr4JOChoTlocACHursjloyMYQu1TZn4JV9a74b29KLAygql48rHbnwfsE5Kv//AY=@vger.kernel.org X-Gm-Message-State: AOJu0YzNOVILJhEAiZshcOqpN2Aib2JqsIXCfIvij7wLQ7O1hV5OU/6k uelgcUPwb19mwFf95YVICsSX6KjI3m8fESOOoXDzQD3IVg+Hw4x0FnZUp5auQbYXsXQ= X-Gm-Gg: AY/fxX6b8rfl+bDodQIPP3rE/NfudZjY14b0wM4fugqcFAvv62Uwk3WZeEijJEIgB4k 7h+JeS2Qcq0YmbBIQXQwaNv79sRne/UMPJObROoTB87HsvUP8382DxC4RrSDi42QRACnVbNH5nG Lo/sILjjQSx9jq8AAR6Hix7QNJM1Lkw0ND0tudUEMJjsoIKWNMHYjiu1DJh/VWOzGBgDXxbW+4E H+PHT9WKdkhN/5VrQJWEJYIAc53Tgd1hwLcDGvNNNK3IE2nCkFSGPNtmQTlqqYIVX2JGLiYy5vl 7C3fYKaC3ZXBjeWmdp+AAT+HJFyj1Ob7r89WvYLmzwcfKDHE9AtL+4H5lYxVAPnwZNiOHFYA9Ug W51G/2VHhxEJGD6suz9FqnF/uci5NGK0bOWbfBa6BaRMzBtv5yRh3YJ7wRqN5R9EBbWCxy27Fko hg/RnSdHv0JSmGVI1el8Ye++ODlP2j3ruUYlb9KFc= X-Google-Smtp-Source: AGHT+IGxik5wZb6PJ3ZvxaBK6HnP18pgqXLZsVTlxUcURxM01dwk5X4GOejTSgcqBo9Mh0RevTTv5Q== X-Received: by 2002:a05:6000:2203:b0:431:4c6:724d with SMTP id ffacd0b85a97d-4324e4fdb00mr12420505f8f.29.1766398950600; Mon, 22 Dec 2025 02:22:30 -0800 (PST) Received: from gpeter-l.roam.corp.google.com ([150.228.9.32]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4324ea82feasm21082813f8f.24.2025.12.22.02.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Dec 2025 02:22:29 -0800 (PST) From: Peter Griffin Date: Mon, 22 Dec 2025 10:22:15 +0000 Subject: [PATCH v7 4/4] clk: samsung: gs101: Enable auto_clock_gate mode for each gs101 CMU Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251222-automatic-clocks-v7-4-fec86fa89874@linaro.org> References: <20251222-automatic-clocks-v7-0-fec86fa89874@linaro.org> In-Reply-To: <20251222-automatic-clocks-v7-0-fec86fa89874@linaro.org> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , =?utf-8?q?Andr=C3=A9_Draszik?= , Tudor Ambarus , Michael Turquette , Stephen Boyd , Sam Protsenko , Sylwester Nawrocki , Chanwoo Choi Cc: Will McVicker , Krzysztof Kozlowski , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, kernel-team@android.com, Peter Griffin , Krzysztof Kozlowski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6078; i=peter.griffin@linaro.org; h=from:subject:message-id; bh=/Z6zZxIOHE0bexMt7q7vSkBhyGsyTsuiXJos9cuRaKY=; b=owEBbQKS/ZANAwAKAc7ouNYCNHK6AcsmYgBpSRve79sRE6Wiibe1gwos813YqTCmnceQ/Jgxj ODyrBDXma2JAjMEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaUkb3gAKCRDO6LjWAjRy up+3EACCbn7AeVJ7SP/7s4uvGaRUCmaTr06pvM6zozJEYE+UeOH9TaLN9jslCVOvFFCAwS8b8tf NjFfpkUdp3yqWM6Nq0k79AKldDt85/ay/S8coqz4d/HxeJizxgKnnXUes1aYZgPk3Gj6qsCDzjP WigzwpGEZGeUWlEng5E6AX1p/GDo38haM4tasUTJSKJ9fIub8K3+HrMur/vncCKwR5o0Y/HQuPS I/1cNb559uo+JhGUmkpoMZFprCBxZquuOxL/YGas0tv7xP+rKXT9PhxI9Rn8YDh+TTAfc9C/X+t jCBIKqNUq4seCMq0JQsnRIKWklAmMvysUBZii0rTk1e2G6zKUXfmjEbplMIV+Y5ko6oWXTX7Rk9 FeSvR7UAGlBM2zOgxAXszmYI6uOnIBL01bV7nE1Bc93DtbH1N8G9kboJcOiwzz/eXdD1kxEc+cC yAig1+wRjENdZhs9fTx4Ugmm+FhOR28v3peBDOZBi7XSgAxNKYgqbStE67MQxBjYT5/kt+beTlt 7JXRW9/792mhNEBAL6VN+daYxGsD4gpJ8iCuO4FIHabBNke+wTv/35hZfI6HLy1WbprqkP3mp4P +22N9tplsARHac5+SPa1Pq+yW3EFdM0erf1ZuW1RoG3P3G4J5xpdJ8imcy758Dxo0iJ0YIQPWqV RZM4gcywVoUk0bg== X-Developer-Key: i=peter.griffin@linaro.org; a=openpgp; fpr=0EFC8E6F5578750D56B549FCCEE8B8D6023472BA Enable auto clock mode, and define the additional fields which are used when this mode is enabled. /sys/kernel/debug/clk/clk_summary now reports approximately 308 running clocks and 298 disabled clocks. Prior to this commit 586 clocks were running and 17 disabled. Signed-off-by: Peter Griffin --- Changes in v4: - Remove unnecessary header of_address.h (Peter) --- drivers/clk/samsung/clk-gs101.c | 55 +++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 55 insertions(+) diff --git a/drivers/clk/samsung/clk-gs101.c b/drivers/clk/samsung/clk-gs10= 1.c index 70b26db9b95ad0b376d23f637c7683fbc8c8c600..8551289b46eb88ec61dd1914d0f= e782ae6794000 100644 --- a/drivers/clk/samsung/clk-gs101.c +++ b/drivers/clk/samsung/clk-gs101.c @@ -26,6 +26,10 @@ #define CLKS_NR_PERIC0 (CLK_GOUT_PERIC0_SYSREG_PERIC0_PCLK + 1) #define CLKS_NR_PERIC1 (CLK_GOUT_PERIC1_SYSREG_PERIC1_PCLK + 1) =20 +#define GS101_GATE_DBG_OFFSET 0x4000 +#define GS101_DRCG_EN_OFFSET 0x104 +#define GS101_MEMCLK_OFFSET 0x108 + /* ---- CMU_TOP ----------------------------------------------------------= --- */ =20 /* Register Offset definitions for CMU_TOP (0x1e080000) */ @@ -1433,6 +1437,9 @@ static const struct samsung_cmu_info top_cmu_info __i= nitconst =3D { .nr_clk_ids =3D CLKS_NR_TOP, .clk_regs =3D cmu_top_clk_regs, .nr_clk_regs =3D ARRAY_SIZE(cmu_top_clk_regs), + .auto_clock_gate =3D true, + .gate_dbg_offset =3D GS101_GATE_DBG_OFFSET, + .option_offset =3D CMU_CMU_TOP_CONTROLLER_OPTION, }; =20 static void __init gs101_cmu_top_init(struct device_node *np) @@ -1900,6 +1907,11 @@ static const struct samsung_gate_clock apm_gate_clks= [] __initconst =3D { CLK_CON_GAT_GOUT_BLK_APM_UID_XIU_DP_APM_IPCLKPORT_ACLK, 21, CLK_IS_C= RITICAL, 0), }; =20 +static const unsigned long dcrg_memclk_sysreg[] __initconst =3D { + GS101_DRCG_EN_OFFSET, + GS101_MEMCLK_OFFSET, +}; + static const struct samsung_cmu_info apm_cmu_info __initconst =3D { .mux_clks =3D apm_mux_clks, .nr_mux_clks =3D ARRAY_SIZE(apm_mux_clks), @@ -1912,6 +1924,12 @@ static const struct samsung_cmu_info apm_cmu_info __= initconst =3D { .nr_clk_ids =3D CLKS_NR_APM, .clk_regs =3D apm_clk_regs, .nr_clk_regs =3D ARRAY_SIZE(apm_clk_regs), + .sysreg_clk_regs =3D dcrg_memclk_sysreg, + .nr_sysreg_clk_regs =3D ARRAY_SIZE(dcrg_memclk_sysreg), + .auto_clock_gate =3D true, + .gate_dbg_offset =3D GS101_GATE_DBG_OFFSET, + .drcg_offset =3D GS101_DRCG_EN_OFFSET, + .memclk_offset =3D GS101_MEMCLK_OFFSET, }; =20 /* ---- CMU_HSI0 ---------------------------------------------------------= --- */ @@ -2375,7 +2393,14 @@ static const struct samsung_cmu_info hsi0_cmu_info _= _initconst =3D { .nr_clk_ids =3D CLKS_NR_HSI0, .clk_regs =3D hsi0_clk_regs, .nr_clk_regs =3D ARRAY_SIZE(hsi0_clk_regs), + .sysreg_clk_regs =3D dcrg_memclk_sysreg, + .nr_sysreg_clk_regs =3D ARRAY_SIZE(dcrg_memclk_sysreg), .clk_name =3D "bus", + .auto_clock_gate =3D true, + .gate_dbg_offset =3D GS101_GATE_DBG_OFFSET, + .option_offset =3D HSI0_CMU_HSI0_CONTROLLER_OPTION, + .drcg_offset =3D GS101_DRCG_EN_OFFSET, + .memclk_offset =3D GS101_MEMCLK_OFFSET, }; =20 /* ---- CMU_HSI2 ---------------------------------------------------------= --- */ @@ -2863,7 +2888,14 @@ static const struct samsung_cmu_info hsi2_cmu_info _= _initconst =3D { .nr_clk_ids =3D CLKS_NR_HSI2, .clk_regs =3D cmu_hsi2_clk_regs, .nr_clk_regs =3D ARRAY_SIZE(cmu_hsi2_clk_regs), + .sysreg_clk_regs =3D dcrg_memclk_sysreg, + .nr_sysreg_clk_regs =3D ARRAY_SIZE(dcrg_memclk_sysreg), .clk_name =3D "bus", + .auto_clock_gate =3D true, + .gate_dbg_offset =3D GS101_GATE_DBG_OFFSET, + .option_offset =3D HSI2_CMU_HSI2_CONTROLLER_OPTION, + .drcg_offset =3D GS101_DRCG_EN_OFFSET, + .memclk_offset =3D GS101_MEMCLK_OFFSET, }; =20 /* ---- CMU_MISC ---------------------------------------------------------= --- */ @@ -3423,7 +3455,14 @@ static const struct samsung_cmu_info misc_cmu_info _= _initconst =3D { .nr_clk_ids =3D CLKS_NR_MISC, .clk_regs =3D misc_clk_regs, .nr_clk_regs =3D ARRAY_SIZE(misc_clk_regs), + .sysreg_clk_regs =3D dcrg_memclk_sysreg, + .nr_sysreg_clk_regs =3D ARRAY_SIZE(dcrg_memclk_sysreg), .clk_name =3D "bus", + .auto_clock_gate =3D true, + .gate_dbg_offset =3D GS101_GATE_DBG_OFFSET, + .option_offset =3D MISC_CMU_MISC_CONTROLLER_OPTION, + .drcg_offset =3D GS101_DRCG_EN_OFFSET, + .memclk_offset =3D GS101_MEMCLK_OFFSET, }; =20 static void __init gs101_cmu_misc_init(struct device_node *np) @@ -4010,6 +4049,10 @@ static const struct samsung_gate_clock peric0_gate_c= lks[] __initconst =3D { 21, 0, 0), }; =20 +static const unsigned long dcrg_sysreg[] __initconst =3D { + GS101_DRCG_EN_OFFSET, +}; + static const struct samsung_cmu_info peric0_cmu_info __initconst =3D { .mux_clks =3D peric0_mux_clks, .nr_mux_clks =3D ARRAY_SIZE(peric0_mux_clks), @@ -4020,7 +4063,13 @@ static const struct samsung_cmu_info peric0_cmu_info= __initconst =3D { .nr_clk_ids =3D CLKS_NR_PERIC0, .clk_regs =3D peric0_clk_regs, .nr_clk_regs =3D ARRAY_SIZE(peric0_clk_regs), + .sysreg_clk_regs =3D dcrg_sysreg, + .nr_sysreg_clk_regs =3D ARRAY_SIZE(dcrg_sysreg), .clk_name =3D "bus", + .auto_clock_gate =3D true, + .gate_dbg_offset =3D GS101_GATE_DBG_OFFSET, + .option_offset =3D PERIC0_CMU_PERIC0_CONTROLLER_OPTION, + .drcg_offset =3D GS101_DRCG_EN_OFFSET, }; =20 /* ---- CMU_PERIC1 -------------------------------------------------------= --- */ @@ -4368,7 +4417,13 @@ static const struct samsung_cmu_info peric1_cmu_info= __initconst =3D { .nr_clk_ids =3D CLKS_NR_PERIC1, .clk_regs =3D peric1_clk_regs, .nr_clk_regs =3D ARRAY_SIZE(peric1_clk_regs), + .sysreg_clk_regs =3D dcrg_sysreg, + .nr_sysreg_clk_regs =3D ARRAY_SIZE(dcrg_sysreg), .clk_name =3D "bus", + .auto_clock_gate =3D true, + .gate_dbg_offset =3D GS101_GATE_DBG_OFFSET, + .option_offset =3D PERIC1_CMU_PERIC1_CONTROLLER_OPTION, + .drcg_offset =3D GS101_DRCG_EN_OFFSET, }; =20 /* ---- platform_driver --------------------------------------------------= --- */ --=20 2.52.0.351.gbe84eed79e-goog