From nobody Sat Feb 7 22:21:04 2026 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 0B5B01FE44B for ; Sun, 2 Nov 2025 20:27:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762115253; cv=none; b=BmBt4fxqcRC6S2DLXrbjJ7+4+lPHKE6uHdQuYnNFH8sSMplVXMqv6Z64xJpwFBf+EmpzLIUiQcazuTvWDHpReR0C4Mdpp23fqN59YK9lK20OjqWXw06F/4Hc+LezbzQPUFjy8IE1Qqfhc7hZ3hfeoE+LChGidwngqT9LcgosKMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762115253; c=relaxed/simple; bh=rW93Hlr4vcum+GKJgXc1ajFfnfWqcxUHYUOR3Zmf44g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ttNTy+rhM+e6UWKQbM0TFijgL7PxO64BQO7P6Kfz/l6WXtliFO0u/WXCJUOtVp8GQz22wUG4TuRYC+ljquUmiUb6rzjNEiuaFr6U8HynqCHQJuaXRey6UcTFzfq5oErN26OmPW1IzIxIwTjlFsaQgobUFFC03GSEz0//GXZDmYA= 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=spPclBD/; arc=none smtp.client-ip=209.85.128.52 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="spPclBD/" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-475dd559b0bso51122355e9.1 for ; Sun, 02 Nov 2025 12:27:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762115249; x=1762720049; 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=VqwzmV8ucm9ZpizFb4InEfSGE/OBpMLcQ1DSFma1Oj8=; b=spPclBD/+xF/1VDujn3fFq7tYrhrEkpEAxmvtImr4ddLUF9DaiV0DiJ3cMs0jsANoa jp8m6v9yoLRJpmVZOsW7tqgIl9ohdP9G2aPy3HClM2jQ9qhLCCZUrgGCa45cFD5K/+jA jST7JeGyw+NNkpqgAWLVnFC3DEySjKh++WCtOgmxBQVRm4Go1mkVZTf5BRd4iOulyK8m Fnoq51tykTYEFkAGx390iGC5Aa2+qjEGeCkAt8KSFw2HzeMRX2xxDubo5h1XK76+VvQr vehHxG0slZjXO0GSdkjwoVsdXRUo5V96VU5xQdjb148GQyPQafU0xsZfVxpZFV1aLIHh Zh0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762115249; x=1762720049; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VqwzmV8ucm9ZpizFb4InEfSGE/OBpMLcQ1DSFma1Oj8=; b=BpdelMc+8L9IomC6DrOQEt2pj3aqKhwAMTE1zBhwMPfMyzkmQ4ZjvT16ns/0ncG3TI Fu7ZZN0eXDrGT3Zg7PS4Gt+Fx5CT96a9ZVDrjppWIswshJLR6RZHbYhtgvIVAbuieScM dEQfhXjVxy54Yq7ZHp1On6OaOELP+d/kK44bkkq1pyQJrpf3rC6HdWr62D1gik+oxGQn UISJIw9XBapTGP2ZRuSBa6x1ZWmVWT/DS/kqfbwwGBB2OwPLf1R72IABeW6xM2YwTPaf 3AQgtCrtuNptee0vyFr1F9CnbYTyu9vqiMI9xv43hrjZ238NouUMZKDFJ5DSgxCkGbi0 EVDg== X-Forwarded-Encrypted: i=1; AJvYcCVCkp0RGxto6wFG87hQCtsASBZCAApSCb0HHobunfop7VX9LhlJWWLBS2o0HYXQgbQaTAhAQrACxBcZK0Y=@vger.kernel.org X-Gm-Message-State: AOJu0YxKVGNejLJMiikbroPAKCJZEDJaH0O/vukf89hSLblywwB+gMNS HzSlKrvo946SRJ5OHTJ/piZLpZfrVWRjXv0sL32231bcZPahPnNx0vSC+1tmqWZDOt4= X-Gm-Gg: ASbGnct2oCZ3huUkkhgLVc8Dm6KTFRVozQZ1SJakPIxCClpgIAtaJ+TRljh+bQ3Kous L5Pi//uD+IQhjsnCPhyxL+VUIredx+tj7uqr/xFRJsxqnvncQPRyPvegG7Gzk9KnOAGYwoy8gUF YRGCwRRZ6rf4a2V0TDUnL3LmSyHsJEzDaex6L53KpXF5F63p3PFNZEe0WXAsxa24PLUFag/3Xkn ks7HP+WswyhZw037UwMXTEXdNlmFlWUIOqewdfyMZ3QxMK9jcjiroVntv09KVySHJXwPvgvaHjD tL6R7pniNLld1GGMbAga4Z2t/zVHssIFUmg08G151M9j42dOQNFDY2yM+Fy0/+XFq51hT5sfYJx 4SFCkgbG6mJBUVENOX5+xjT+a2L3dx+4R4NHbcof5UZJQHufmW6ZwilLrSVJaqS/+W1pnIxJi7p 2qy/dOZrkLK4cyBVKBCo//k5luHcKYTvQWfUIdYQqXOQ== X-Google-Smtp-Source: AGHT+IHO6Kj16XZq6wFeuaf1RbffW2vio8belueyNJjXBAP6hwWK/ytmja/cRAdCXN2PlNhsCr1t1g== X-Received: by 2002:a05:600c:190e:b0:471:168f:717a with SMTP id 5b1f17b1804b1-477308599b4mr87271515e9.16.1762115249274; Sun, 02 Nov 2025 12:27:29 -0800 (PST) Received: from gpeter-l.roam.corp.google.com ([145.224.65.248]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4773c374f84sm114664165e9.0.2025.11.02.12.27.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Nov 2025 12:27:28 -0800 (PST) From: Peter Griffin Date: Sun, 02 Nov 2025 20:27:14 +0000 Subject: [PATCH v3 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: <20251102-automatic-clocks-v3-1-ff10eafe61c8@linaro.org> References: <20251102-automatic-clocks-v3-0-ff10eafe61c8@linaro.org> In-Reply-To: <20251102-automatic-clocks-v3-0-ff10eafe61c8@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=2325; i=peter.griffin@linaro.org; h=from:subject:message-id; bh=rW93Hlr4vcum+GKJgXc1ajFfnfWqcxUHYUOR3Zmf44g=; b=owEBbQKS/ZANAwAKAc7ouNYCNHK6AcsmYgBpB76svQKBqYy4GDQ/oR5w5NFCQd80R2RbT/sW6 cO1sayfIrKJAjMEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaQe+rAAKCRDO6LjWAjRy un7MD/9tdkOyjZlhnamX0fDBgvsMJET6LH8N8JPdTmn7dkF7GI4cvOuhDF0DKY24mkl1k1t+Ihs ynh39V1v15ZLyrpKTDjD3mTCEWxJjHRdF2WcHeXr0w7Oi+yuqjZaVcnMFa/hWoFP0kstG4NpApi jliMamJwva3OATI1hqBH08xqxqlyTSztEr79ZOhVR+7ugOcVREUNP+D16BSObwDHjhwJSN3QQU5 MacwZsMYrD6R6Ym/qMH3MDnjj4TqcuLCzNwaAl0D+/UsgZ+wUIXBRLB/0OkTMOrwhuySjw60yPM vzJF4IXTtPUygBa+75pAPGUhnHtMrCD/MQkXTPlahGD6knkYwPnALiif3neHHcpNdEytS9cBGx1 //Q4tvT53ZaPER/CbhFZMvkwWv+EiMvgnn4uyS/zCD/Lgt8vaHmCpBvxUpb5DkjNKUger87dwoa LjICe7n3KKwbVNrd20GQdk5MVmUBucaQ34jDCJMJOCtU5DYUGPccAvlvDhVONyHhe1ocTkSTz8g 9/7o+kOtywqhAdi11O31sc9s2SO9m2oA0wUgEfWgY9Jp6F1VkoAz4BrT9yRskKJIjAmrRuRe24j 2Havbr/MOjzlFvNvgqXHx97qAyvrYsMt9p3Ck29WQ2muZ5JZb1soWDVffEKo2CQmJmb+Lx7namy /7yR4IgeWDLaRog== 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 MEMCLK registers. If present these registers need to be initialised in the clock driver. Update the bindings documentation so that all CMUs (with the exception of gs101-cmu-top) have samsung,sysreg as a required property. Additionally update the DT example to included the correct CMU size as registers in that region are used for auto clock mode. Signed-off-by: Peter Griffin --- Changes in v2: - Update commit description as to why the sysreg is required (Krzysztof) - Update commit description regarding updated example (Andre) --- .../bindings/clock/google,gs101-clock.yaml | 23 ++++++++++++++++++= +++- 1 file changed, 22 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..5ce5ba523110af3a2a7740b8ba2= 8e2271c76bddb 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,22 @@ allOf: - const: bus - const: ip =20 + - if: + properties: + compatible: + contains: + enum: + - google,gs101-cmu-apm + - google,gs101-cmu-misc + - google,gs101-hsi0 + - google,gs101-cmu-hsi2 + - google,gs101-cmu-peric0 + - google,gs101-cmu-peric1 + + then: + required: + - samsung,sysreg + additionalProperties: false =20 examples: @@ -175,7 +196,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.51.1.930.gacf6e81ea2-goog From nobody Sat Feb 7 22:21:04 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 4D86186348 for ; Sun, 2 Nov 2025 20:27:32 +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=1762115254; cv=none; b=Xcmla4UtCCktOYlA+NXhO+2yIfkmmwMB/0fUHkixqS/okDHawKt+AiL75h0V12QH1O4HVGrOzf05VZx9tUzlTO4Z0ehyyTqO4FzI8MmUSKyTfrXxdNdE8tSeIn2dlP96LZjjpPz3lmnResS8QUnKiMedPY/gwLRFtt6qv1LAWvw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762115254; c=relaxed/simple; bh=nN8tTkTawLljwHrR/jD0xbk9vXmrtVCl9Rq1rJpMFpY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rQU9pi+8udtDuiyrNoiBooiaXqr1f7OrxUYOn0uYnwgt85vnALs1Bg4sZV8V+s0PuMOL52ucL3MSZRrK/rKUEZT75Fgr8Q7Qb5mW5kYlxcRNeKkJqEDLa0H7mrXweq9jkxMFGdkYcLnpmmtpLZpA9Epj6g4+yOk56MgBOd9xhDI= 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=nlEo1vyG; 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="nlEo1vyG" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-475dbc3c9efso22054755e9.0 for ; Sun, 02 Nov 2025 12:27:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762115251; x=1762720051; 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=TTngrYfAUFTcMg616558EOBLpim7WtyStRU50Tfvew8=; b=nlEo1vyG+hXK5BUqeN8CPsDAW3Hsl8GOMs403oONgLuiCY55xPx9JsAl5OOtEa0wob +1RUAp9qQ85jEbGFaAFzBzayhAXFg+RJdGiIfHyYJeQYRi02/d64MJgtOvGqdPH7dE6u RCK3x4flZnTCRM3sbehQpYSqaIu7shhmktrAz6XuVxlr4K4WR/ioqC69jJ3PGear4CpF iPxANshGKVOBprTEWTVdnj6vr2Lmm4Dr7L5YRM2BBzBNWRoRsT75GqTB+zrvjCSiegdi mALcAP4oEOwKDW6+VFMHOtVyJAmFcCSk7+82zW23KQroDQu8R2FsTXlaa6t/WiSFQINO X/RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762115251; x=1762720051; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TTngrYfAUFTcMg616558EOBLpim7WtyStRU50Tfvew8=; b=RbWMDXAW5gWfZ1U66MB9V1OIY+0iyl9DP70ksQYxE1X23qM9HnpWYWKjTErQlN2ufG CTjgQqHBBSSgAp14XsF9lO0VPmbgUQKV24UFAOexO++M2tLQ4VqWyU/GvSkktDUnlT5d hzxGiKWO0Fn4y+Ax2f2p2ZY1H8GLfaVXvBgCq8B8DOE1pfLAXSC/EeTitvlQoIN1HziE EYTiAKcxYleu39VsdtLYOSV10CrzjtniKBp9zZEgtWGowKod/em9653pMjv1cUK0p3MY rP6AL29m0AIj4BPGDfE/uCVuWwKMbI6U5CHk4OcKR4jSNFs+aWo3h5rsD7HbMdl1YEUx Th/A== X-Forwarded-Encrypted: i=1; AJvYcCU7Z33WAWaLOJksGJ8Gd1TlZhDn3fmZ9+eq6d0V1qjQV/pNFSm7ZpfZ/rl3RtuQtkhlYdypAlIsjl6QRSQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyCmaoCnu4SfWdA/6+q+Euv6LDa+0gRnm1EdA88H7zfouotD9z5 +W7hsDD+ZfsaKJx5CAXzpqk1efFopv47LuBqyNgPMnQ1F0/DXeB5gvGLfG0qKjCZKRI= X-Gm-Gg: ASbGnctzEK993sdnZHBSyIYnGofAL5bT2jscCz7O4t6tyu7SgGhQbjO+70qEN/JEBgH LlUjAe2GRRbOI+DVRKqiluEGU/7uAcJsJcyjOeIvYetiddQPXge83HkOzJgKkOrm5NpDZrNjhvm PT7sbhw8fupC4WFyewDl4TOLRvZHEzZzhA2Kbbj68tG1oyC9CqCMneHO9sh5qcPNUrRP8A+++bG qqcb8psY2TXBP00G1XoVVMDnCxPoCTH94+HEX2igvRJ5lLe+1zjek8uaOw1/ms4B4sVjXQR8nhn uHIg8FT2Jri0G3/AZKXWMr/nAspG1dqqbrgsLgmhZyR5f1hdw3Nsb8D/cOlv+6n7F68MdsBbXll IOYq9hUxtJ8xeVLK9gPNL4eGDfnEjYuUlcijsek0+buUHD6woFukaRgCqKA42BYYDeXgaiWiisg /RceROkIEpJATtkzXUAFhSSGQ6Daasmzg= X-Google-Smtp-Source: AGHT+IF7iJ+IgLBUP9LE7khd4BTeU79k3SW+Aq/qgYQ2ReUgs8miL0YqahEetcsdRE6/eSU7CMke4A== X-Received: by 2002:a05:600c:3489:b0:477:58:7d04 with SMTP id 5b1f17b1804b1-477307e214dmr92032845e9.9.1762115250618; Sun, 02 Nov 2025 12:27:30 -0800 (PST) Received: from gpeter-l.roam.corp.google.com ([145.224.65.248]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4773c374f84sm114664165e9.0.2025.11.02.12.27.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Nov 2025 12:27:30 -0800 (PST) From: Peter Griffin Date: Sun, 02 Nov 2025 20:27:15 +0000 Subject: [PATCH v3 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: <20251102-automatic-clocks-v3-2-ff10eafe61c8@linaro.org> References: <20251102-automatic-clocks-v3-0-ff10eafe61c8@linaro.org> In-Reply-To: <20251102-automatic-clocks-v3-0-ff10eafe61c8@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=2207; i=peter.griffin@linaro.org; h=from:subject:message-id; bh=nN8tTkTawLljwHrR/jD0xbk9vXmrtVCl9Rq1rJpMFpY=; b=owEBbQKS/ZANAwAKAc7ouNYCNHK6AcsmYgBpB76tYpUV3fOT+rf32etuSr6akf6snwSSeY/JQ uXlfMOQIJGJAjMEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaQe+rQAKCRDO6LjWAjRy usr2D/wID/WRNDiqnQlsa8OyzPlkf0/VUyOybWhKF0Kj5odKclbYF2mxiScH+cIq9O0KL65XXN9 BeN/ur987Dump6bm/2RiO7OKViS6igi7fbZrb6xfY8yHXM97A3x8QM+s9y/K6HNTnW3ZfCbceeE qCWA7BQgey9BsTzvr9WBYq06XAVsqujR/vhd7U8xrO1ZWwYSR6os0mKeZ8iJIRmQv28Bbvk74I4 RWP36iDmy46mIZCjcWQenVKLLB8wd//NzgF4+twS71jMrGyTCAyFtAkLYvjy4Hm/3QF3JD6IuDw SPM2IaGq2C2NRTE0P5HK97fsPI/2b6A/dYQpUcu8rjQdpBUr49RP89Azhn601bhgIKqydE0GZjI vQuban4CFg+pes9d3APbuvKQFVDDUpQWjTPLEpK70zw5sogUgzXlfXUA+zcpmzDeA2GpPo3YIPH p7z54RnNqv9HTnSCERNP5CqVdUIlYCVsVwk1E/v8ZLVy2T2yIiQXh/92tpgq+lKeZ7SIjBzHMBf 78PLsvVuoaL4lDZQghUB8GBNXh6MAtg/eKTIpkgcTD53qPK3x68rMD0uImtxtqGynMEutGneU6k CrysUXcf6J4nvDbrssGgpWitEon14PdRMFpj1YwtRedtRksDMmmZZsJ54fgoYUb8MGwcQv8Jabl +Hfbv24jEDwvZGw== X-Developer-Key: i=peter.griffin@linaro.org; a=openpgp; fpr=0EFC8E6F5578750D56B549FCCEE8B8D6023472BA sysreg bank contains BUSCOMPONENT_DRCG_EN and MEMCLK clock registers that need to be initialized in the CMU clock driver. Signed-off-by: Peter Griffin --- 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 d06d1d05f36408137a8acd98e43d48ea7d4f4292..c39ca4c4508f046ca16ae86be42= 468c7245561b8 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 { @@ -662,6 +663,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 { @@ -1208,6 +1210,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 { @@ -1566,6 +1569,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 { @@ -1637,6 +1641,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 { @@ -1697,6 +1702,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.51.1.930.gacf6e81ea2-goog From nobody Sat Feb 7 22:21:04 2026 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 C2599242D86 for ; Sun, 2 Nov 2025 20:27:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762115257; cv=none; b=jwQMqjIBzqn5UKjaJrwRhHl0Qh08s+nldOplQ7B4BKHCmyyOTTpUStp1/2011DIhHKtZpOQKgUiyDRz4b0bVyKDzXVDsdiY9e6spcVozez0nLstcR5x7YhhvcR93mBIBUExy6TQ4jnAzCUcgOqO1F+Z8Ezh8g/JFdqv9oEJjXrw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762115257; c=relaxed/simple; bh=e2GJsAS4Nm0dDjEN91x5d8aIws8SmqS7zw40KNSqRZA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lwX536LkNIip2XOrb077oLfTyCdmFt4ha3ZP4QzLsuOKPjM4SNzFeENCQBkPiInfiZVH03UfsxkOX10QJcyq2iBi5dD/EJ9nToqTgLWIH/pxW3CkDDWMGDuxeGHR8ZGGfU7YqLlszmv86+6SjOq0G+uOyCVX7GBI0eyhQkb7iYA= 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=n8GUJTqU; arc=none smtp.client-ip=209.85.128.41 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="n8GUJTqU" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-475dd559b0bso51122805e9.1 for ; Sun, 02 Nov 2025 12:27:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762115253; x=1762720053; 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=Zs5oUZnI6NIKVlDEfwsjw8ht8thBId5vQ59aNIJMMiE=; b=n8GUJTqUJ3fOczmQKj2Gg7FOM9VMuX1I34ia+ctL73FIyGBjzct2UzgBfTJ8dpmAMY z8+0msFpM6fC2rDSkj3j2nBRgv+593aA0WCM/kdcDqVcmKfC6Sa7J9ztv8FfVt+u7IrT B3S4NqoDAaA4pF8QHyIKZRKB/AIayKLUasMezijYioc7VBb1Ft3BDX4Vn6c5TtE2rLOn gSIznzI3Ho/7BmXYWwyxxB4DeLPwVAD+7u8XBBW37LipjgPxNytf+e+45Q4FPBqpkn9X x/sxhnty9/YIOuyQ61lfNeVt+kyM/X1fcT4rfr7V8hJhzKnT2cA3jEAdrLn+skSC7R3W CAgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762115253; x=1762720053; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zs5oUZnI6NIKVlDEfwsjw8ht8thBId5vQ59aNIJMMiE=; b=d4vQAsPXDczji3/jRNZQkEXmtvEX5DdDwGgeJpFJmhVCE0nFPi8hUEb68KEnDSWsJA nBgo1xO1mRytUkXc7zG4U1lRDQZtQppDSllA8T9GbtCmMH3a1snDAAn4s1QK/JawiHHh lTY1r52HqkdaJtI5psrLxKmT2vTIHr4gMaE4IvTkjSRQra//lsiylmXRpZGuIMvbdtWB UfreECRAYXhzGAoOeXuGWh/si3EalijxLaI7BfXQD/6hzVHNrMKHBzHN5Jy7QjVOkpB7 daMNEUUW2U5Qjpmb7huXyeX4gBP9xsxRRsZ1nIg6U7UM2OMGvOntWgpPV+WGwyfZTypU eoaw== X-Forwarded-Encrypted: i=1; AJvYcCXJ5hBFtF1lvrTCRldGxbkDnZuhdDFXbsEvqzOj18CldMZ1gZekcJALjYjhlxPwqg2dml9KiWOIga3T+Aw=@vger.kernel.org X-Gm-Message-State: AOJu0YxtrMDue4O1l+YXq7JQWZEVID0QOyERZ9690GA1CffIQf1kqm6x MSKu0FZaSE8TWVITh5oTeloMSuWcoS/z5e1/FDlG+TDQEGA2QciT4QB8MivNW9bWE34= X-Gm-Gg: ASbGnct3L4MPPBEUJ5JhQ9js+QmArZ5xt5CJIWB/0GeGxY247dBpNok5h9BdsAUPC9S PgeuRuvyLhtACL/3BL2R+IhDo3EIvIEbxWS6c5BfwVVz1C4Fh6JCzD5iPvODGE7WuVMNomZvRDV KUGzG6xBmYY6xD2+bcJUE3dKshlgiuEg+FPtyp8FJ+9AJgWLYh56nflikdh7Nt7/DzqtagfbfAX GT0rDBJt9bsV4D9uFGZm51eajYTZgaOaQAHG7PFoR1FOHZF+TptJ0HcdGfsfEZCI0JtVCmvymIh 3JizMuZX9VErbK+PwaH/hwCRUVRGDVXjgGgjrM8wD+wW2bVscygWgWuRfTVb7i2YL+aPdg38zG/ y4+zL73j0BlzEPfnXjnBjor/rfyyL5qC2rRM2D6CAP9a5PKPiZxGb1zE4v2r4qADkm830Y8RDss 3w5AtoNMveQGjcVRnRfFXDICUFbqO3LhN9FMzr2YtoPuEJk6erDAQZ X-Google-Smtp-Source: AGHT+IGsqOSWCjukVCfYILs3tlCfKuJNlAn9hH+Wqh9DHLVxV03UX/WE2Nj2sJfyhkCkH18pwHJQeA== X-Received: by 2002:a05:600c:5026:b0:477:e66:4082 with SMTP id 5b1f17b1804b1-477308cd668mr98920995e9.29.1762115252991; Sun, 02 Nov 2025 12:27:32 -0800 (PST) Received: from gpeter-l.roam.corp.google.com ([145.224.65.248]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4773c374f84sm114664165e9.0.2025.11.02.12.27.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Nov 2025 12:27:31 -0800 (PST) From: Peter Griffin Date: Sun, 02 Nov 2025 20:27:16 +0000 Subject: [PATCH v3 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: <20251102-automatic-clocks-v3-3-ff10eafe61c8@linaro.org> References: <20251102-automatic-clocks-v3-0-ff10eafe61c8@linaro.org> In-Reply-To: <20251102-automatic-clocks-v3-0-ff10eafe61c8@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=29436; i=peter.griffin@linaro.org; h=from:subject:message-id; bh=e2GJsAS4Nm0dDjEN91x5d8aIws8SmqS7zw40KNSqRZA=; b=owEBbQKS/ZANAwAKAc7ouNYCNHK6AcsmYgBpB76tJsz9J2ZNhsH3sGyEF3uplo3IdAmHeGZKw iaG29X/2uWJAjMEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaQe+rQAKCRDO6LjWAjRy undSD/9u9kFaiMSQY6fQhq9VSvH93bbswVygQo+w5uX1Cm60rGuDu6M5s6nrGvGHrKcHyBc2a6E 6wZcHcBl5xQwcb+h0QfmDK4VouPB3DK+sjj0Ciumk0XTOS+2SLjurczmI6XNN6fDzQm/6U6erqu VbpW+RjfyJzsKTx0vE2PcfeGzKqzYhERw9qyn+2CWlR+1uJI+BCqEEkrjACRDlAjDwEBQokKAXD sJ2CZ5QdNR2Ks4GTvz+F6K1X/9f3kYGog+M77/NtkgIK1e9JAYaNW0QONGPWEfql8aUfw4PZ3ln ivb1rsO57C09MV7p+hTFLbURdF6IQf3kv8spMNjukYEQjd9xH8ybjOmqYJQIoOzCSYfrh4A+w2Z MRS6m7hEkNlETcMUG3e4rPq0125aZpXktFNvoK11IqyjVJgPBPfgZLLUU7hF7yAFPG5YL+vDC/e au2aT+nulZZX8k2ohJ8Wg70lNZIODVvYeT/g2C7lKXsSNMgnr6LyuUFPUYOiKkIF8XlKCE0Q+ye awuNjdPMnND5v3E1T/K2w9iVL9DxYqZ24Ehoy6jFkk/duXZ5s7ZF4Evlh7AROmKYXm0+mw6/umK ryidOm2jZzG3D1eOVPF8Bt74so5Bt+hpRuX2ZAejpsdQ/N93ehFQ8Ee+JhnxX0xLdJC7xMrCql0 IKqamOPI8VFXvqw== 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 dbc9925ca8f46e951dfb5d391c0e744ca370abcc..83de526346bc06c811beac3667b= ab482e2eca7b8 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) 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) 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 struct syscore_ops samsung_clk_syscore_ops =3D { @@ -299,6 +419,7 @@ static struct syscore_ops samsung_clk_syscore_ops =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, @@ -319,6 +440,7 @@ void samsung_clk_extended_sleep_init(void __iomem *reg_= base, register_syscore_ops(&samsung_clk_syscore_ops); =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; @@ -330,10 +452,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) @@ -353,6 +485,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. @@ -371,14 +534,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.51.1.930.gacf6e81ea2-goog From nobody Sat Feb 7 22:21:04 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 AEE452264CC for ; Sun, 2 Nov 2025 20:27:38 +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=1762115260; cv=none; b=Jf/JoaSKVmkuhaV69tjGaohNzC08fos4Cj0lyxZjum5M36BDC55OgeDUm3ygPMaXCh+6UcyEtdChNyUJz4IzeuNG46jvrDajstFJXu0WGPRz/+bNHwWOxbZWLvSvg4LRQ1bT3TSJ5/OAuCZroR1/8XEp+RlbgI4XZZmWwe16LZo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762115260; c=relaxed/simple; bh=ArSvj5nXGIoLUhxaTwM0e0vrMG9VC4hP4JEZ9NlwLy4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=osfVvWo+3/R8Xb52w+/oem2J1Pe8Jp0JfoPPbHE4IbLD3WMtGW9Fny8vrtwBuWBuVhKSN189L/wRmazTvox9ZTTWaa6A/MWvFLCgHGNhEIp6j0XzS5s1QTY+99kCbmagunNxv+zjp/kEGfPjXiwGJ7fQSogbirVTvpw5Y84qCAs= 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=AgsrtHw0; 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="AgsrtHw0" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4710665e7deso17143405e9.1 for ; Sun, 02 Nov 2025 12:27:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762115257; x=1762720057; 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=pjBT7bI6FeaMlwLFqK21S9i1STzhdgd24lkDcjg28sI=; b=AgsrtHw007ztDt80nTsmNJj+rGAXj63TC0e8BvfDRi2jhQjJd85gtlaKPLxjWrq/LI Ps1bQNJxRyn6vQ8EVJYEM6IHqzKi/Gr3+zP5azf65lJ/BO+yIrhSLNlRA17uCLjWqjxk IRnn1Pur7tCOB1+GfkyIuTVtuUalhFfM/5bXLGSob3FjkPzpeRglRelp9GPB+nssKaS1 GcQdwNi7Dy43tLFnCapISs66lOnoaHhidzA7ctgea7rrLQOerV392NOD/eZ/8DeVhT86 hNk7djKycVIGUrvMbLUDVO45g/DMToA6C1PgRp7n18kycW//PveycDBUuBRBnKMzj9cO bYWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762115257; x=1762720057; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pjBT7bI6FeaMlwLFqK21S9i1STzhdgd24lkDcjg28sI=; b=JNkjkIkJmtTbWsotMZ666NedJ4te2MfiR9uPtLNWwjxZETR3tzD1KRB5q2vQJcKPI5 phzurylx5JQ9EDKfhHU65Er33T6ATDsLREGu1MgYmY4yS2Z5Le2i4EspSkI/e0zfH9Hh vKzGE3oY9EDtHZ6FegwdNIe+i3bZOVJ/Xe/0kBzvPAYioV11tRL01xaKRlURnhG630D1 7hqDHtI51ARpOheP3Fc3HITdw4Q4MqWQ3/Hgityq1A76IMfwz84vpYD4a+lqhSGEZYdr 7Sb5krwUhFCgjQ3NrCwmJ17eFPNUKwZ7riOyBTuVTPQ+MSnf+p1ihdetgWi2vgjogqwP LwWA== X-Forwarded-Encrypted: i=1; AJvYcCX1ZkCaPG6cFqCQsUCguA2UanD128B6j0RxBLULzUZ4xDuHCfTXH31zOFNQNk+dSo4zL3OI37ajd9goPzk=@vger.kernel.org X-Gm-Message-State: AOJu0YxxLseM17dwd6Rp+H0iD2LR6cQDj9UWcugUMfs4HCeiXIIjCxLf efHcTRnr6mK6qg1ekmlRx9ngOrySvEI78uChkRNfOMjLf+vsPW7+Bb3e6fMtk6bwhI0= X-Gm-Gg: ASbGncsXoPXMNzWfyHO7eOnh5r+8E3ZuwHUD+yl+ddYTRBE+JULBWeLFKKuLhT9H6XH unGs2AGCBO5qHTKuYMSQhELWZyZhXQB/x2XupnTdvDfjeNBdAAV1EcqLdhcnG2RZqosw6H37aDa t1h6/98YWDXt2RUbl5SwADr29szrfQ8rcj+u3f6RQC1hffQAiq2Z1M8Rx9i/PhRfHZcBn5IfAZS c9QGJxQw70+WuHYn+Gxul3cnA7U740tH6DOrYMNp9tzjMGJgzkpyZYuYwhsgTWrwgES3b1xRhKf diFnkXM4ZTX+hlZMiY4VwzB7wBsM8JhVAgQ8BvtVTNSZ4Pvki7lsCI4nz3E80gT4jL/o9Wky5bs d0xnGTjfxMdFVGQSBPO7ktQAEu3xS7zO5TAJMWxRdHcHORcXOGfKo1X9d/JSR6fK7rINH6GZiwx OfehzTQGcnJhik2ZE38dEJ4xDUNQ204q7Ttp6ndEL8IA== X-Google-Smtp-Source: AGHT+IHclmceGA6xzLYK7AZwfvYGojs4HfrUGxVjb+fGjreUEWAioSECHuNNDZPvqg7GQ77Jc1vnDA== X-Received: by 2002:a05:600c:6207:b0:46e:206a:78cc with SMTP id 5b1f17b1804b1-477308be7c3mr112935755e9.28.1762115256976; Sun, 02 Nov 2025 12:27:36 -0800 (PST) Received: from gpeter-l.roam.corp.google.com ([145.224.65.248]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4773c374f84sm114664165e9.0.2025.11.02.12.27.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Nov 2025 12:27:35 -0800 (PST) From: Peter Griffin Date: Sun, 02 Nov 2025 20:27:17 +0000 Subject: [PATCH v3 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: <20251102-automatic-clocks-v3-4-ff10eafe61c8@linaro.org> References: <20251102-automatic-clocks-v3-0-ff10eafe61c8@linaro.org> In-Reply-To: <20251102-automatic-clocks-v3-0-ff10eafe61c8@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=6237; i=peter.griffin@linaro.org; h=from:subject:message-id; bh=ArSvj5nXGIoLUhxaTwM0e0vrMG9VC4hP4JEZ9NlwLy4=; b=owEBbQKS/ZANAwAKAc7ouNYCNHK6AcsmYgBpB76tfGyRfQkS/Vg9YDiwdRGOaYsOiZdACXdoB K8PM1sF53WJAjMEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaQe+rQAKCRDO6LjWAjRy uucWD/0RNZPQkDYgBH6LMcJ2iFEd+R6tP0ILXN0GZ828NPV/Q2QPGkoUVdbjo3vu/zAIlqUMB9+ hnzKKcf7mtvSKpALlgGR9DYR8EOmhCLCduvh5NSC6zp1aG4H9xqtZveKLFo1eMdGlF+Q/ApyBqw hCtCP0GulpTQsZDT002zvkMKkR1LBOS9o1cQpfWzgy3aTM/WFiAFM3Bbb8JxUhGRn9krxEpW6/P INbBQLsJPkSjQUFkOu9hMnLyBDVtfkzL/oadfrh5E4CMOReLneNAQMErJwNPXvlAcUsdAkwTKmy EBcz4iiBzpDhNIQKIH8+5yKsKpLPz1PqClDGyfMnhFYYBG02jUa+wl8iczsigdDyN9lDauLdi56 dlGQ163DTGy/h2qu+TfW2i1+X5Z31eLuCCZwJRCDoNOf9HpU1g36RIDBZxun6fe6I8M7xcQtlyw K3L6ReuliSvVG4uh28gUdmtoCpgeEkG/FaYTr/vaPFfJdt+BHMZxYj+ayb/G7i1L/ML6oFREe46 vEe98evNnenD4TWa8gcUTE/4/wLvUNvvObQAdsJVzIqmzQFVg5uOJRM/84rtm1FqdEIaigAqWDh PPXxlMMT42lcmb5Be8cA9mRJQWTRr6CtRlSR91sqDIUdv/RAhmOqgOvP9XBlQ6x4n6Yzhr0l87S GHNr6GQDt5kyvhQ== 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 --- drivers/clk/samsung/clk-gs101.c | 56 +++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 56 insertions(+) diff --git a/drivers/clk/samsung/clk-gs101.c b/drivers/clk/samsung/clk-gs10= 1.c index 70b26db9b95ad0b376d23f637c7683fbc8c8c600..68c5ed8f0fe1cac5169313b6ec7= 05f9eec44ff53 100644 --- a/drivers/clk/samsung/clk-gs101.c +++ b/drivers/clk/samsung/clk-gs101.c @@ -9,6 +9,7 @@ #include #include #include +#include #include =20 #include @@ -26,6 +27,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 +1438,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 +1908,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 +1925,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 +2394,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 +2889,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 +3456,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 +4050,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 +4064,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 +4418,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.51.1.930.gacf6e81ea2-goog