From nobody Sat Feb 7 18:20:10 2026 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.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 A0D042D9EE7 for ; Sat, 20 Dec 2025 09:05:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766221557; cv=none; b=MsxMWakcOvltJf3gD+LcIXJdh45mANQ1LEnq1Rte1BoeOgt0qN+PhsUHHia9BikQ+d4e7YeAvdmAASHgwQ/LjqDn9tqUl5LJVsxzAeV90YLRvFsnvoBpFfScbn6wAASCPSkmITXsEh0xy/1qMT5imVerNHgJ43L5TvA+Z+AwBc0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766221557; c=relaxed/simple; bh=bUKPDLDgvyDmiCQQmMkKtxjUpJMIVvdlMfzNhg8FZ4I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=thRGyCEFguQIBgXAPgc0xXs2YPdfSpKjZv6mQ6UF5X4YXn565Mu9Z5P7ci+BsVLVLAH7BZEY3paGf1jyFz76c/xE1BWFK/b0aUt6WjzmfRd4TaG4JokIVNsfy1vZZ3I+jElCo8huAIfKdaagDZ6DOlu+maQEsF8tzrtYwR8w9qg= 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=sUxiB5tu; arc=none smtp.client-ip=209.85.128.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="sUxiB5tu" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4779cb0a33fso25765415e9.0 for ; Sat, 20 Dec 2025 01:05:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766221554; x=1766826354; 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=XVw0aWse2vPhALDrtiy2o4KqkTy0qvB3phpySxD9iBU=; b=sUxiB5tu4BqMJL+YCHWPtDB7ip+7uz1gar90lqE5wFZscDmhYoUnM4MWmLf2Bv+2aK DlPhkhHZDLwXppy/TeQdo1ZaSPPUTh/WQR3eZY5I1KSh4SrdBO4yLD/udPAXWM0ZXcCF kRrBtmJGf/mZ2nN3yXvYr0kAxV1JyFGauDitcCTrljNOe4CTFqx0/LSn1GjU9gHkJ8e8 LWKhljXClcUJg39lKb2szjiLknBi/bIDN/bTiovuzKR/ivKV8uvLZYv2FiuNyg3UbvPm KsxxlZHxpPHB8gOss/rQpSi/SEKIqI3fKRKYEfS5goMGwejrlgOAuey0oTZyTHpS2meP ivHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766221554; x=1766826354; 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=XVw0aWse2vPhALDrtiy2o4KqkTy0qvB3phpySxD9iBU=; b=l+Q+S8KCS/hdHwSCWoVFg1yVdYMyDYei+Q1Wrm+PWXUJRT0TW9qYTk4VpFEs+DBGwZ G18xheENEoXqFiPZ/p/D8dqxa0OwhKXf1TDRQDNTEu7CQSGD3qZv6Y0vfpZcFnk4mt32 j+rXhmb1YNjSxm0Mjfhrgqj0p9IB3h9231aAs21Qk91ngH4yyGKu7G6vyAOkQ8o+ewNk nWuAzUeBv1D9P2Pw3LL26D+bC2hN77B0q0xvGwwdUN6N9GJTY69CT/38dcJ2m5Cs4xiq QUpn7RhLPG4RwfzO0TjydNqXQEwpmsETKqdIrWn8tm3GcCujdQDIvm1663KnoZejYXNt bS+w== X-Forwarded-Encrypted: i=1; AJvYcCV4k8s+QbHCRVGogOaAfStv4wtQjH9du99GwXhpG0JcUZ4IFhdd4VjDzJSBgv8Hmq+BhRAKftVVKHWNgNc=@vger.kernel.org X-Gm-Message-State: AOJu0Yw79oXjMhQXG8azuaY9BgAPn12bX+L0le00S+uoghCcDlmZhnYX y/1X/g1yRafXSj2Ys+NOuVsO02U5fJnYSCCIAsk2U5oaw5yiBv3IvwyK4o54ynwEy5c= X-Gm-Gg: AY/fxX5lt4zHTv9f/0fyB+HC+EmugABrEzf+kAs2J7EgkuSX5oAi2SIrHe4lsm34Y/R QvcMwIOC5dzrx7AHOe16WY3sC7DJ0NpRhnJ8K90HqrGUcS2mMDMOe0zc9XgC7ROHWJMHXgjnlIk 0peIFmD86EYT80EP6DFSuECv8dgUzYrYRLH5C/1lUSwd1LP17rODokMIZAtXoSCDPBIIB8M9fLp Lv2wzLKH30VAdRT56oKfMKPZ0AtiiS/P3toqQ3CeWySVKouiQntmv+miOPoeQ0D1EJqiXlZi0kb kUI6binE8kXkZmFU+z0wG5dvOuigofzdLEJr80xtbFoJES4X6y1Sp7npgx4w44WXHxjEwaE3y/p VpV565gT7+MZSGjVBcWKfXxfkAs6Y9QG7XTjQBOV3WKbqs09RnxI1Id25rUID/CbpvLK9L3CMz5 VMmFzx2dC+EcvLBOkOfRduSg+NpGqg4kePgtP4/qg= X-Google-Smtp-Source: AGHT+IHm7esSV913JpdZ+YNyx0nqLo6qDaknHuHbwAmvI0v8Wnn36TQkgkaeC8uL3ugSC4TXAIGoqQ== X-Received: by 2002:a05:600c:620d:b0:47b:da85:b9ef with SMTP id 5b1f17b1804b1-47d19569c23mr60792875e9.16.1766221553759; Sat, 20 Dec 2025 01:05:53 -0800 (PST) Received: from gpeter-l.roam.corp.google.com ([150.228.9.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d1936d220sm88466685e9.8.2025.12.20.01.05.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Dec 2025 01:05:53 -0800 (PST) From: Peter Griffin Date: Sat, 20 Dec 2025 09:05:39 +0000 Subject: [PATCH v6 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: <20251220-automatic-clocks-v6-1-36c2f276a135@linaro.org> References: <20251220-automatic-clocks-v6-0-36c2f276a135@linaro.org> In-Reply-To: <20251220-automatic-clocks-v6-0-36c2f276a135@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=2882; i=peter.griffin@linaro.org; h=from:subject:message-id; bh=bUKPDLDgvyDmiCQQmMkKtxjUpJMIVvdlMfzNhg8FZ4I=; b=owEBbQKS/ZANAwAKAc7ouNYCNHK6AcsmYgBpRmbtf4HhlaQ6BY7Iw6T389W5xKye2Rc4k0PgV PmqcNLorLmJAjMEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaUZm7QAKCRDO6LjWAjRy un+/D/4puNY+0dl4g/cgXGWqZa6pGPbTlYDisHMcXVvoToKPpj99jEPpUolN+8x04z7ayoFFfn1 goVpUIp6PRJyLMBy0vEERO47zp1u7CkFIhPhgvqium9Hs8KyfskVBD18nXqd4Mw0hhGmAH3EVkG eXUtSs7xDZxfqhX5fIvn6YHpgdqi69o3g3tAAC/99H5YgCmnehe5GGSlnPgKionfjdPUwo2R3p/ AyRzWJMPDXs+72NxewSTQR8LdwvVPLp2YOk03suCHG5h+vuKgvnPa6omSXu9eN13aGGVkpJzAWZ wSbyGrNTGtm/fuU6dkNntTqptaTdXJPBWNFKRmF4jLGyBmcW6xmk9er0qwOqnGWcRwCgT4g7RE+ WtNYOuNxtzvkMgS5uDVLekdAcH+OiczykTG21Q8Sirx57TfCCu7/QWegwWvTYMh/S8Lqxzr4lZv yQV0RypJikvza8EvKol3LHFShVF0fSfpNQCSynxoW0dAuI6wwK0575PeK9w7NlyCuFfjPj7vVqX FkBKLvVy5pfYRrB+dqVlOJyRxr0Bjqv3ZAda+aR9le+uGj+NVWmDhNJXY88AwoOuTOrv0hEcmnt RnESt47SMVByS2AjZuF8m/dQGqNS6C/RjMGT/xldnPixsfTaeT7U1sarWIad/v9NMch24lNiS6q fn7E9263EZC9wYg== 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. 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 Sat Feb 7 18:20:10 2026 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (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 DF6631FC0EF for ; Sat, 20 Dec 2025 09:05:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.67 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766221558; cv=none; b=kFhttCEjSTwaJwXYcEJNgfvkdx5Vltry+V4w/IBnzYXF7KmiYqBCZxnZFTgxKsWzEXNkMAQCsY63QSfNAT1X4LPocgJO4igb9uoO/tkee0/9v8ioLbXD+KgF7KTaPhkrrGJ+4cEvawCVu4pL7fMZKTJwAy2om/jQ2WvX5gMSGeA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766221558; c=relaxed/simple; bh=h92o4zwYNSX6815UCmoJUrl3OjU4KjoLxMi/xiWmdfY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FdWxm0Et3Asl0w8vT1dbelnG+CumUv2FtsunDReGVeAOQnBtyD+PnG9jKMBA62Os0SAX4cAr/iOBncC6Pbxm/e7fWyPdLPp+pin7O88es3uQ5h9PrdN2i4hzoWV4oJkyuUc2MuCfL3YVzNAF7OPOVFfSTTv5nsP60fjwxwyR/ug= 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=YKldrA8j; arc=none smtp.client-ip=209.85.128.67 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="YKldrA8j" Received: by mail-wm1-f67.google.com with SMTP id 5b1f17b1804b1-47789cd2083so13942005e9.2 for ; Sat, 20 Dec 2025 01:05:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766221555; x=1766826355; 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=YKldrA8jMnjeQpzzQkPxN2DYtxIvxrVuxD5F1BPAqPuDSi9lGsZUPeXTlqKBwBIx3d bjopAKjuhe4jXd3trGpqICBIRlpLHsioZVcW47VLnr5+b8vr4dmKykGwBph2Lfwy/5AO DoTEDGHUJEtymUkfpb3du290/oC6MxDQnSFEuI+RFv44PAQE0lcirCpuHl1FELVLcipx v82/K6hPqp9ywHZTR3P0IwTOM4PTA5EtIZ+GlZAjT4kL7UVUBX2VPLBYBQ9EftJV1rc4 gTaNMTfooskPcLO09FeA23HBRm6bsck+KieWpUki2PNJ5F+9gQYfQkQgJqXzbrgAqZ1J uG4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766221555; x=1766826355; 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=S5yRNEhjI4ah0TYzXXQEXtbVJenIxqjJEJvLRQR6FTEDV63to5UfaHqtH/Dt/ZTxEy +R7JGwjWyxeeHNGjw/dOrjY8HM3P0qjHWlcXFQAarRzdV1GtHDWB2HLquW4ZeWao/h0Q 4sCy4mG3mS4xS/BLPh4r8qjIs6FjKQTnGLPbd72gIu0519YljvtwzMV+HzncTd3JZ5UP dpV/ZETraSOECgksaJjTTsPUyVSvLYjgzeH27bwfIU1KehmrhkvNN3naxZjvZpf55vyl 0/+FIhwhSRF/P8Jf7DpQ6csm4SKdRoXVszXtnC5aLkkEkoJW8rJcvvSAFuY17MdYeGz1 3NHQ== X-Forwarded-Encrypted: i=1; AJvYcCUNoWQZcW2whJXdAvjS9INChd/Zm3sMdbuvgUm7aQHFqAU9j0jfpDgEQbSH2BM27syClEFl1NTR+hs1AEM=@vger.kernel.org X-Gm-Message-State: AOJu0YwtlM1D8m/NqDvhZf3SM9RlfF4IfDyN8lLc7+6TyKIiwfR16K7M 878iZ04JqVUO2oKjaspOGnfD8c1qMyJW2BTuaDv9dyp7zu6Qq3OssBs9W25321SX2Rk= X-Gm-Gg: AY/fxX7ApFG4FOLr5C15k+2sAhJgh/QeVu/E90eHZuYQWDlwuAG7LFEIHDS0bNivGCF yMaQF4E8aSgBNclhycTV4362bkgzL3e+fb36QxsPDHMARIMf4mEzmzHLwsGIfLs1DyXdAQ2tIJj XIcdPeUGFoAC9OvMEz9xO4YUlR2b0m1pluqB6/8BwxdQPxAqtNCvDHmbKV1YNy76UMSwiaRW3aa SEbe3BLs4VggnKL2YoD2AIXaY4HM+KqkeaVGg2BWVWUA/ACzC9Mfs2bv1EwsGR8usoO7QJhI85K /KN3Ywep1xwdiwiwWUcTwDT8bFNcR0cjZvqQUqGWKmoevH+HRNsAT14c/YiQdWO7bBmpZSLF4bX je2IpTQkgc38TfQvhKK0RQ9Whvje/tDr+zGn2cpMaYWlFg0HoCcsrB+DlqSi0ycJOdL8ZULkWzt IZdfzn+eMWmsRUYDh+iO9qAwQgjx78yj7a0oWoJa4C8QhBx71nlQ== X-Google-Smtp-Source: AGHT+IE1iVnBUqpj1iTbwtmkbTAjU6Y58uPgcEI500vkbYk4bozZEqi5QO1qW3InydBQVTDCJXx55Q== X-Received: by 2002:a05:600c:6388:b0:477:63db:c718 with SMTP id 5b1f17b1804b1-47d19557cd2mr51367045e9.16.1766221555250; Sat, 20 Dec 2025 01:05:55 -0800 (PST) Received: from gpeter-l.roam.corp.google.com ([150.228.9.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d1936d220sm88466685e9.8.2025.12.20.01.05.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Dec 2025 01:05:54 -0800 (PST) From: Peter Griffin Date: Sat, 20 Dec 2025 09:05:40 +0000 Subject: [PATCH v6 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: <20251220-automatic-clocks-v6-2-36c2f276a135@linaro.org> References: <20251220-automatic-clocks-v6-0-36c2f276a135@linaro.org> In-Reply-To: <20251220-automatic-clocks-v6-0-36c2f276a135@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=owEBbQKS/ZANAwAKAc7ouNYCNHK6AcsmYgBpRmbtPuXfNw2JAKPYzs1rhcAAssMDOJ5EMhC+b a9n1Uw1/bSJAjMEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaUZm7QAKCRDO6LjWAjRy uicBD/9cejbAXAxcXgsCfHKp0zhJl64kTRLzpTC+2c+IDQndHym7x8DMGI57fTeMGZW3Amd+fnR F3NC609qaNexjPJRbLHQy4IoQvmikAmrple6ENuSaFFe26iae1Lk/GzSf5+kAkmkf/FHh87+gEH CozQ7H2BcVplfSO6QvApjfoDGMBjoMuqmA89P5hdP5dK8fGez8FG/wfIIQbf03miSO1AaR+uOwk rtI0mBShE29JCLUqFCOsZMsG0NyJi4AasPsW8ap2ACMJwe50rwHIvjDuFvvffQ1uf/DMYREsj3x aXbcAdn8ASKNEf0/7QpP6uww2RO6tvshK1ESczTqVGDNvL7tbAecAeYk7yR8FTEbqMiWH7/SGKM tjfHLlHCzlaRYSFMCdSIS0UdC953wvgJanvd4dyx0XEYX+zwKMLEAAWwfOru4yEf5YYpS6c3wcw G/JacgCF0vg+RP8hmr1UhlA/rCkpps2Js+grqjl4d3aF0FVdLNeOMdCZpI0O0uOQnjjKKnuCHmw pMloOkDvuJhukrvzDS5dO4fITuoei8X1OWC3F26o4E+FTdXPdB2J7V4kkLjVR/fKyzSGHPHAihC fGzycNMRAgwMd6Z8yo066VM7Hpqcp+jhyTPDQeyJhSu0sflctCO03gwFiPPP897Vr9HF4UVSkvy +y7nmadSJWu8SBQ== 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 Sat Feb 7 18:20:10 2026 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (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 B9ACE2FC007 for ; Sat, 20 Dec 2025 09:05:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.67 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766221562; cv=none; b=pa3nukgkp4h2fzVy67hJZtA+PxRWAB5k5/vt/xpVosN+K1Fvh60HHxZT95qq9+9jTX1qtg07dy87LS1UcKHbFZDFqSluaqMumvxQr3i1W3sayPZ/HS7pagQpyHbC/nL5VJCkd655/Dtf1N/zy4BnGFfNlfuRy2QX7wtraXbn0Ik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766221562; c=relaxed/simple; bh=w4lPht67fTvYGZmbShhkk5lw4OKSQQI5Wz3XQCPBKDM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=U6ycFP6zAL28NvDPL5fAKc0EIfDU3r0HPkCmDumhyj3DJfcD3j77V4ien/+p6qsgbN/RypmuSezXlu1B+VzcJLcOPfWj6eI3Jk6r6qfSxuk9hDD+xtgItoKK+DmUOngpiSg9qGBf9NbNN+TMkCuT0CF8tL+4JTu1fiNkSmNO4KI= 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=T0Qx6o7+; arc=none smtp.client-ip=209.85.128.67 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="T0Qx6o7+" Received: by mail-wm1-f67.google.com with SMTP id 5b1f17b1804b1-47796a837c7so18035615e9.0 for ; Sat, 20 Dec 2025 01:05:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766221557; x=1766826357; 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=T0Qx6o7+dRiYqTLlvhKlV7vSmgdNhLi//w2dTuE+GrHYxgZ5RU2qv//AsjuMueZ53F JRM+AtP59elBPFZ+hVGCEv56xxp34PD22OmTPZLknzzhk3RrBOmZbzG01EsPdSIYWt/g Fdrf0o1tJCyQbVQOFV5RbMx+hxpz/aZhzj5Blr6uv3QDQJTJ8ueSL6Thb2DqChG9l+C7 v9nUqYTy4Oh62Acn+vBLey5QZXTpxy8ux461iEiYzGRlcy39N8gTEm7NnUVRvT8sCNpQ cNyP8bfOoPWPuHjJe5Tb7Qqk2i7d2o8M7PfFj2s+RfOa33CC3P6qjies7eLmW+qEld6O nELg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766221557; x=1766826357; 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=HsJGtodv/yPQYJINDwPhKNuYcCcSpJecVxos3mVO5dR/JDLkAnqyxGr9wHA28wYQkW ttD7mORBs5wPr+aBAp0D4QFD7GJSMR5S3obOAmclo9MD7YzKR6NPQSi3uTjYZPWFPk3D J/sPwHwxIbLXChFkPBGUK4oObqxh17vddnL0C64ZobJCx0On2cHOrsf45DgwZV5CUa+h L6FZrg8aA66hhkZL1BFaywzDd+glsFZ/38Ak4MR19zB+dtJC+l0rSJfIV+NwS7qn9cNA /UyLYTY6U70UzG1WqmvE6xMmZzkRka4KIgTN13cmf8dciZa5Pdxqnffi7EQC9hKrimGO v77w== X-Forwarded-Encrypted: i=1; AJvYcCXs8nG5wv0AlC1nYlTM7KdHEpDqJf/UIjMALa/1ONW9RezLQ7ZaGF2C+95kIg6eTELAMuJAhUuDPy7lknI=@vger.kernel.org X-Gm-Message-State: AOJu0YwmY8YH0CXuLNFSTZN3W6uLrbRtPekpBDfYgN4LJz2BQw7jopC9 /ZVXaSQb5d5veLEHZ7IC3kuDmMX1JkGWd+LpFtqWJWSqQBusPnygut0w+smPHm2jIKI= X-Gm-Gg: AY/fxX5dgZEoWvfBR2c2+P300C45uqp9D+Di0WFFpef0ghxmyRaTLMhOeimFhUt8/KS umlR9b9mix3njuO+j7sWCLnDD9v3FzagWdwoOOe3OS8XINX0To8qmTr94jdwPlmLigurLyt68Wc iATWyzHuqFw4NPz8Y+8apcPicPnRTGvIkhvOCDXkfwfCN56Kve2fMpxBIqO31LGvFgIHVjdSsEc 12NzeUx/xB3VOi2ncx/sXh3yFihKuh2ONErr2oX52odqI/k1KHxQBgDsEEnlqaR8dG5IBjNB+9J UIse5H4P7XYiY//RJfd5C0u54re1dQdezzFOFt/qdatCjF8QJWh9rJpwLIhKWr95FNuvADX1+P7 E0m1COCySDNPFtsqQTQP6NAr/rzxrDv1m0hVU5Po1+M1aDSFR4CWUozrj5G0trvNDCEtJR+dfjF S21XXWgkajQ/u/Q9CxNgKcXfiihOfqf6CTu1ipi2I= X-Google-Smtp-Source: AGHT+IFwZfDLFP2EWtJhDOs01APgVEjeSQpVpF77su7pSmQDZd0T4j0yeJIeZGJrcH+UxcF7A1qTpw== X-Received: by 2002:a05:600c:4e8f:b0:477:df7:b020 with SMTP id 5b1f17b1804b1-47d1957da79mr49556975e9.18.1766221556728; Sat, 20 Dec 2025 01:05:56 -0800 (PST) Received: from gpeter-l.roam.corp.google.com ([150.228.9.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d1936d220sm88466685e9.8.2025.12.20.01.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Dec 2025 01:05:56 -0800 (PST) From: Peter Griffin Date: Sat, 20 Dec 2025 09:05:41 +0000 Subject: [PATCH v6 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: <20251220-automatic-clocks-v6-3-36c2f276a135@linaro.org> References: <20251220-automatic-clocks-v6-0-36c2f276a135@linaro.org> In-Reply-To: <20251220-automatic-clocks-v6-0-36c2f276a135@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/ZANAwAKAc7ouNYCNHK6AcsmYgBpRmbud8bOu+TKcFm4d5SiWgArKtReZAtRGCBmC UVI3Nj3KQSJAjMEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaUZm7gAKCRDO6LjWAjRy umjXD/4lm3MkYbnQAh2gMSUpvjnVvt9lq4al67cTrbxWGydN1f+ZynknSPtGHZrMhRkLnmcPQpr bqCZ0JARWiyEYL1C5NiALkU/SifuhU4zajYRAXw/Dw2uMf5/UOg22aFbb+Rz8Ox6TR7LYP9A5z/ wZLHEECSUD91uhHtkjBF5GWVPUoHJVCubixlCljQwEODqbzCQoa3/nddt/ZpAHGijSBlcX4jw7d DNIKu/D8EkbyK9w95UZCkvuMRaDuSH/CC09dJmb6OMLD6RQFMJRAzl1hMIP5qmSDjk12dGpl1Tt RVjjIGN7Yq2MIG5tri1gKkUiD/uVgmfvWdErI5q2MPjtK0ImHr7h3U5K9IfYmEr+vKrwdJftRF3 QuQ6O4nkcbT8o92QiaNMKDZY6jvDGTI/eP6FHwqKT2MIpBM3FaAKgfjcKCZCYkyheKDyr7MnbGa qyVJUEHk84lxtAMkXa7uo0695HByjsd2neB1o4vrbuuh8dvmEvdhPlbww9bfOmnnLpFbEVWI4Vg G+a161FiXW4ZuHiU5j/h/t3Ee3DRCRfmCT9Xo/RMvzYhS11sMqtY5hOzg2Td3oGIgn2Op6e1tZh AO5NVb0lteq8K8cyIimnRBLfi3jume+PgDIlFdVMu51WOfIMbLMtrSYAPkBuw9YqZXi0JLD+yB/ p8lfDRBAFhcoGSQ== 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 Sat Feb 7 18:20:10 2026 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.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 474402E54BB for ; Sat, 20 Dec 2025 09:06:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766221563; cv=none; b=Qh2B+r17fNfkaTUj6Z975KuP8V12CVyAdWxwycZbBAe58fsmf2ax3Gx+9kZQ1zRKULG6Mik3Znoji7gK0tBT8JGK5xZ1YlkKnOiFjv6JpIJDkW9jnz6rLapRlR4YWumai1Cy34Om5DL/mVLiVJt8WyS4sn6aIfoz81TOGfNb8Ss= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766221563; c=relaxed/simple; bh=/Z6zZxIOHE0bexMt7q7vSkBhyGsyTsuiXJos9cuRaKY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ov2xtprQ22WuqElLeCs69vHEZ+HRVE3QkpvlzKzOCytl8IsYMnOHJscPdny93kfXVzQJ/+qIXnufHCe4BU0DjZPACizRC6dhIahXKEYRY6xf6U50f+dL93RYgvgls3MvYTBArVARFuP/tqgCUgYpsYCgYVjVfoXiV9n7RlQt8rI= 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=iwXr1U4p; arc=none smtp.client-ip=209.85.128.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="iwXr1U4p" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-47795f6f5c0so14051785e9.1 for ; Sat, 20 Dec 2025 01:06:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766221559; x=1766826359; 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=iwXr1U4pHBVFKUsW5iHtsallGwffMOdrr7XsfqgeipDGfGQ+BNDy73GDbC1ShlpABu Yo0XJlDS8FkBFjw1Vmqlrj9o4RjcbhUtrEvjm4QAQ3HknYdG3aQ8AsL/Rfb/Jo3ftUyj B3VJTIX9eNb/FlnU4oT8IDikx61Tn0CTDF5AqTpY5Kh8J9FpNpzKfbb48zMdOXnZyFlE P9zKy2CAM0dun1Xw2bx8YGNpKlcBeghLFOxEAQq9k/bcRTEtkEJ6fI20M01v64lGWf5o 3fYP4qjJL5OepwBDAqfunWFOmKffeu3Xhih7TOD0+iwQ6OHdJB3lJULs//DnUlXR1vt0 AnBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766221559; x=1766826359; 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=Etdgv9zWWRjmOwHiKXLGsVQz61zmXuzr8lhavEZ3AYQf+LHN+uNJkYHiLxdz8wk2lN YeZC3rpw7c2oID5sJdkFYyEqygh5WgkaacnkHlF+L5UulxmAP5GwFfqECWYFDYu13BAO OdaXn19rfw0w7Mr8sai9hiQTLY4vilE1ZDz85pA7h8ccOxL1jrJpNEuGPgZdJGUbaybU XvDSD2XJisQ5dp8IneGvdrDDOeb1hVik0fdIC+Bl0V+UFitzGCOAdMZIQoZLiff8UNyO bIIAUxmMgR/bnh2CVgO1Zf8LTCyrAo4EcqWjmm6EgdNgwwMle1UaUWf4Tr8zL1//YAE6 +uZw== X-Forwarded-Encrypted: i=1; AJvYcCXUE5p2gj3o9ikOtA4tW4U1V1TLLDz7AYYs3N8veVvaetQGukeiZAJ3HTBKuEa2uc2i/+U8ksNVSMIFx9Y=@vger.kernel.org X-Gm-Message-State: AOJu0YwwWYR0w1XP9S0WvHlZGZ5VGquG6sXqMMdP5/pg8vxrDXemkICb xPdUz2Hs8Ern0CVKnHBrFbdDSXX927yVzkDkarm+kBxt+H+S/XQUqt7txYOE5DPlJF4= X-Gm-Gg: AY/fxX4z8yEfU0206qGMa8z6Gm7o18kSHpb3abuISbkvJW8wgVu82JS17c4sP55ihlU 6Wk43FfgpQFkvfplIgAzt0hPAWlP6glA8Ip/yk8jTSBKDJnN41LECp/+axRB8v++SG1uu85Lv8v oXzM8zQHAVGAejuTfBD5vq2aWKUueuD1wk7a1usoK3/3vftkWxhWgWj+MqJ/ZFB4gIG3m8oHxyc sC3DoHos++2HO00X+zwC35jMVvU4dVYpawfYeoY9fjTAcok8QU75g5DGykCZYdHrdyqgKFOYLDd VF7GXjhvys841o2qrmxdW2HQeZp44onDhwi71BixgFhpgFJpSwaw/CR4EmpmQC7Q6QecSTIdvPm JzMkhjX/QPLqcd1rWpOoK4IeH8yiPd3hihfmd2l4sMWZXgAMqXWfsBAJ6ixJGsLeQ1h/fUIcNvN t33K5du5N7pFE1v9sWrYeMnMtsdnQK5rWHSt4pLeY= X-Google-Smtp-Source: AGHT+IFCUXWI6aw3Mi0uQPnoiCABpAeI+lRIlbv8QjWYLfVthEPpi5pHmK0OXgUKHYpht3AdIb214A== X-Received: by 2002:a05:600c:470e:b0:46e:506b:20c5 with SMTP id 5b1f17b1804b1-47d19589469mr52722335e9.26.1766221558592; Sat, 20 Dec 2025 01:05:58 -0800 (PST) Received: from gpeter-l.roam.corp.google.com ([150.228.9.32]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d1936d220sm88466685e9.8.2025.12.20.01.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Dec 2025 01:05:57 -0800 (PST) From: Peter Griffin Date: Sat, 20 Dec 2025 09:05:42 +0000 Subject: [PATCH v6 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: <20251220-automatic-clocks-v6-4-36c2f276a135@linaro.org> References: <20251220-automatic-clocks-v6-0-36c2f276a135@linaro.org> In-Reply-To: <20251220-automatic-clocks-v6-0-36c2f276a135@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/ZANAwAKAc7ouNYCNHK6AcsmYgBpRmbuBqmDI4GAqQs79cB1AkMOySGopviN+P3hb uecIYdF8IuJAjMEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaUZm7gAKCRDO6LjWAjRy um/vEACicphWUljDI3ykObAXL+bUHs0wN+2joaKqvPwVqdTWr6a25rNAvmK3kwjLayHZikDoLTd 9TOeYdv8s6+1+g5zXx5RH4TtF+KNUlZpNkri3jjQKxWBLf0awRS/FVYr0rX+/+f8ECt92C81q95 MMY8xU+jGvZ53TrxVmfSsnl/Wots3TaO9Bk499iz60mLtg/p1otQfObAeCBdL0XiguSEVQRBmIC k49HVnccEQ8k4lQagnSqG/V9YQ/PHYcMF0c4AAdBTvTKIgDBLN8bwiR/XR/49eBQSXIu7y44ok1 Vrjf53DKBHZ9QNCAaVTS3qLRnXbPPrim7jUhRuLpo1SAMDZTejpfZRe+HTj+Fcio/tz9V+Au/LV R27RI11sZeZonax2PEHqRYlP/Z9PC1lGodEIOCs7y4YIaUy20zfevGfXJyPJL2Vqlq1hu2g3bt5 e26Ss7JlxP1Eq+G/VVjx2rEK3HoaWe5Qrbib80x/oJs5K27+26PrVXeH3Fl/h/JAFY01/jtc2ad VZujbRnRRbK9b3e6c6kQ56v95kftLQIzUH3hsuYO3cr1A3BqiNyVmFNQJ5XJ4PldhvID8Egj9et wJJF1hAIHd7iDYaECNe/mSGc0MN989glz6BeSgMFTfivQnJOuSC86d4Y4DQ/Xbitiq6ZEL+Wc4W rgbbAo4+V6U6cYQ== 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