From nobody Tue Nov 24 11:35:53 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795465625; b=n5u6JWTHSGCrtg2MvuOJ2Mt9gRMLgeC1OicL0ng0tuhCpYO0wWKq2uYUnU+ZYFB0qNTu n1ochOBjSQrEPvWXCPRTtp/aIXN2+97HA8YRd93YbRFdwmL9eF95P+9e6xAX077a/zrpd JYnU3CIQVnGMlnVkfAgOAMduQaPpvPPJIfVrDuDXKXRPj9WCs83JFKMg2jDpD2cR9dfIJ Ei2QY46kjRQ+JXsAYss3SVneKGbOJhGlCmEZKfeh44aiwHEkhcy161lDGBSNdNhvj0yI+ nDNo3/dF5+GFfGCV6MWwjl09kve4WlOTW8rPmt7oarkGh4HL8JTSBzguqBsBndx2S5A== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795465625; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=etweggmvewghqZeCOi7wUZ9wIdIXkNXXNOxh61ejO+Q=; b=Zb2jOA69Qx2JZIPz9wmLiyw0z5ip7eH2Opi2cn4+JkSVyxw9v9MFQnVZl4fSsWOclyLx vCwaWdWS6zburpQABfNTPshT8z07Z3W+GKG5HmP/ezl4hsPiXL9mtgewvuSDjqPTUVmQl MKO2zm7EtDc3R0sP1fYPMthj/tlsW6jI+qYzsyOQDrsEBnLylb5/c8YLxLqmBMnfXf6/c Sa1lfIIytcqhMnuDHIGgh154I8wjA6PE582HAM99oeOrQde9E0oaIGQhq5KszTebZNWHc FUJP3F+z8WJhEZWbYFkbygH6NgDJpEg+K8SyyarP3A1RVJ3Q9/3gvO6UKTsqa18iYTA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="HDCBx/5k"; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17867606A31E; Mon, 23 Nov 2026 20:27:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=HDCBx/5k Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1795465624; b=Hca5SzEFNJNFNxn8dwgk6RYCMIH7GIrOHfLKIYMuBWMnMYAeSKVE8xu9BBnt6LaPnaFB oAHQo4Pb0KLZZjDQwmNQtaz1QSe2ZPZ6dTtCWN9Pby1r7ZXpCPSDfC18XdchVCV/EiHZy INHaUFHcnskgXUSIlD3hoBBj1gfoM1zQRB7rFd+n8tzXnvx8LA1a1OR9+VMTZ+uR1dfut I2ioaEfkTApCBcJlTYZJCIqjVCTeUr4ykDFZ+g0QapO9YC4mS2tEdXt2n2EKKXWht2kDH vgTP/ELf4Gu69qB6ALuQv6F7oBkGCUOyg2jIPTpFJT8v4EnOty3xtyiBh//d3ueOr+g== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1795465624; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=etweggmvewghqZeCOi7wUZ9wIdIXkNXXNOxh61ejO+Q=; b=GswKGq8CU8mD1k43P8YtHNZtlItEwXY82z5VBSBKzX1kdtZ8p2UFPlBlAI84jr4mTTQj Ot4jjkcQLGuGesjQmNU1+J6nv0AUO8scvtTkZ1QqvhtQxLeWzCwOJLYx7UHVzxFod2osZ hsJiQpX/g3JpPl8XdoiE5PEE0pMl07RVBlsPv6q91y7HV25a9OEvySKQ+ZY8FCiHUBJ/O 0wUFlzwmxGSutYUhtAoxo1H7oh/pxct3+LFdgyOyQuwekpp5oP1EKwDgKIrDgLzSa9mUc pWtmtRguz90dl6y+wplnVDoP6ECmOwCWE5YkyaCiuDw9LZ1ZVI+tGWSWg8byOW1XPiQ== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id B51181F000C4; Mon, 23 Nov 2026 20:26:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795465624; bh=etweggmvewghqZeCOi7wUZ9wIdIXkNXXNOxh61ejO+Q=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=HDCBx/5kEhJnHc6TMy99sgojmZsqPB16Hare43hVfykqGf5dKDrmWaY/ShKCiURef ORCwdehUUjDWTPWgJsKkIoK9HuK5wwCG7J7mWJ8z4Fs2H0nrJ8JfLAcx/YKHiAH7DW ++X7Y0Nc8dnbMz3OdZLq0UjkpUQozjpB7g/P95tgnB4q5B+kQq7Jo3dGODZDDlZljo un0BVt6wZNMMvWuDOblDQCiv/mkrMT3TGrB3kinL0oLXBGrVuFEbx9rBYP8vD3n655 LcvEVvcuN8rgup3zARzpKfIYJPpxtp7XlrcZePi8lLESJKa1pWJjPjYEHFm3CMcjKo bxiihkAFh3znw== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 397994C6CB; Mon, 23 Nov 2026 20:26:58 +0000 (UTC) From: Fil Dunsky via B4 Relay Date: Mon, 23 Nov 2026 23:26:55 +0300 Subject: [PATCH v2 1/5] dt-bindings: soc: Add Cortina Systems CS7542 global control block X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Message-Id: <20261123-cs7542-syscon-v2-1-1cd74b2522f9@gmail.com> References: <20261123-cs7542-syscon-v2-0-1cd74b2522f9@gmail.com> In-Reply-To: <20261123-cs7542-syscon-v2-0-1cd74b2522f9@gmail.com> To: Linus Walleij , Stephen Boyd , Brian Masney , Jerome Brunet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bartosz Golaszewski Cc: Arnd Bergmann , linux-gpio@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795465614; l=2734; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=FpK/rtN440rKXrT4wuja3g3AXioE5n0xbhhWrVDfiGg=; b=ipRGVR0liCQjBfbPvnA26IUI9W9GGepF2VaOm+/bXlvPaqbrCcpP4bUSV8WHhC3NX+J4IDHAy PcVVeMO+ubKBmJyrDhQqLxgra6qTHJsYyrtDI3FnrwRgtyB3mAARPtN X-Developer-Key: i=filipp.dunsky@gmail.com; a=ed25519; pk=JAYP8e2rJ54DHOmhNtXud8rl1igAaAXoOHxtJmVXI1g= X-Endpoint-Received: by B4 Relay for filipp.dunsky@gmail.com/20260930 with auth_id=1085 X-Original-From: Fil Dunsky Reply-To: filipp.dunsky@gmail.com Content-Transfer-Encoding: quoted-printable From: Fil Dunsky Describe the shared global register block and its strap-selected APB, CPU and AXI clocks. A pinctrl child will share the syscon regmap. Keep clock IDs in the order used by the previous out-of-tree CS75xx clock provider. AI assistance: Codex prepared this change from the existing OpenWrt port and GPL vendor sources. Signed-off-by: Fil Dunsky --- .../soc/cortina/cortina,cs7542-syscon.yaml | 49 ++++++++++++++++++= ++++ include/dt-bindings/clock/cortina,cs7542-clock.h | 9 ++++ 2 files changed, 58 insertions(+) diff --git a/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-s= yscon.yaml b/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-s= yscon.yaml new file mode 100644 index 000000000..fb074de87 --- /dev/null +++ b/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.y= aml @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/cortina/cortina,cs7542-syscon.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cortina Systems CS7542 global control block + +maintainers: + - Fil Dunsky + +description: + The global control block contains the boot strap status, GPIO/peripheral + mux registers, reset controls and the secondary CPU release register. + It provides the APB, CPU and AXI clock rates selected by the boot straps. + The clock specifiers are defined in dt-bindings/clock/cortina,cs7542-clo= ck.h. + The pin controller uses the same register map through its parent syscon. + +properties: + compatible: + items: + - const: cortina,cs7542-syscon + - const: syscon + - const: simple-mfd + + reg: + maxItems: 1 + + "#clock-cells": + const: 1 + + pinctrl: + type: object + $ref: /schemas/pinctrl/cortina,cs7542-pinctrl.yaml# + +required: + - compatible + - reg + - "#clock-cells" + +additionalProperties: false + +examples: + - | + syscon@f0000000 { + compatible =3D "cortina,cs7542-syscon", "syscon", "simple-mfd"; + reg =3D <0xf0000000 0x100>; + #clock-cells =3D <1>; + }; diff --git a/include/dt-bindings/clock/cortina,cs7542-clock.h b/include/dt-= bindings/clock/cortina,cs7542-clock.h new file mode 100644 index 000000000..34d544238 --- /dev/null +++ b/include/dt-bindings/clock/cortina,cs7542-clock.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +#ifndef _DT_BINDINGS_CLOCK_CORTINA_CS7542_H +#define _DT_BINDINGS_CLOCK_CORTINA_CS7542_H + +#define CS7542_CLK_APB 0 +#define CS7542_CLK_CPU 1 +#define CS7542_CLK_AXI 2 + +#endif --=20 2.53.0 From nobody Tue Nov 24 11:35:53 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795465631; b=VjeQPm7EEXqUAclSB81nH1C2HW+B6Aqn8xOl8t20TnxG2+vC+GZNMhROI9O3Z0lnbCk7 RJhyE8g94bhiKnhRbovMjYLSgawG3vmtWUbbhYUelMwz3klFrElDJ9Lp0iyVrFKH9RBw2 +kjKuBvV5DkJnEH5piZntGCE2V/3T28kjjk5+0Ev6QLW+53WSNmKCaHCO4dmh3Yu7ZgOd uurBZgn2OTbGZnRQv+wBtLfpf6f0xxo7Q/OMdGvn7nOUVn6OsLIptytEkyoOwiQDEHUfe 6qUR86KCCIoqpNKLwRpFK8r8bPIkOX7QmSlFTk9M2Ex06hwsyuWCI2UWGw5elv/5qnw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795465631; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=l9bZ/Z4zkSpMsXFfmdertwdtzZqERHTevFQJLNpFelA=; b=Bv5DJkDa/Llhreu1EhhJ4263CRE6lv6ORlZBZZh+bpcmyq8n/qZcsgOUyf71RcrIdiQr fpqnCpjFfJZrSrbQEsDsmOerLcSLjd66MOCtE0MG+xfdqgDHeabUzX8MdMVK+Bae+WcNH GQZxu/5m2usJz6phAOWDkYqEtb8DE/daYMTvx38pdTkuKKYHx27he7xpZtNe1Z5rvl843 3jgNLC/+VcOBelqvz6ujDNf9bTKQhwi4AqGp7PBWJoOBU+0B6Ef7qeuSNnEddQSohuhtu RvCFP5ch2QoafOCVZelgInyiFime/gpiolAPPMj7E3NY3SIcQo1UVhpKwtsuE0Y8gJw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FZxxa04A; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF0E0606A69D; Mon, 23 Nov 2026 20:27:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FZxxa04A Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1795465631; b=ocUAre5jzjdFwaZ3XsZ1cGNxt/mhsn2oNzUixHR1eEfjSoqzz3DmRzqGbs6Xfm46P/2o QVUNWIBwCf6mMeewPYPy/YnWSO6fJMbe1iJwC20CKZLqPIkAX0GQAcWfAK7sI71kz7A+7 PMZctTjS9pjAIL9POFxf8OBxorpgrs5+qcOD5JkFz3cxC4tZeNHgeH9IcT4S9qm+qjnoQ UDwAgS0dHULEVU/mtxthg/zthBEaDL8ZoZCzKLRpsNxe24bq5gY4582bfGqZeIVXurrb1 LBT4H1XmLJ+OITTNtOwRxs31gRDveo/WSfHTSGa1DEKGgO6nzbYVNbLlqo9p5qqKnVA== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1795465631; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=l9bZ/Z4zkSpMsXFfmdertwdtzZqERHTevFQJLNpFelA=; b=m2GlYTHjvOmipwh+kv31HLn6CoIRhotHcWdYhElbXBKU1+M4U8qC4tpDxtnfTiIGHqzQ 17mvrtPx4kR6R0nS743zfyp61MZIp8CN8P3VcndLGWiLfHPSUpSWWlZKP1NKoGGSi07/C TjppSiJDjfiQjQmp/UXtFoRCkmX5uz6GXj/C2w+QUpzETlB1R6QksRwCdzg2f1AoE0ocW y/HPfwMJyiEGwBetZJnZgRAAdrLEwLIwraNE0GseXeovR3kv0hLqU1cnxKcr0e/+tX5zl wfg7xvTK9q9wAoL238eVb6M5LhliUL/UVTNFjV3u7dza02jnq9xAvJifbKF+Y2YKAlQ== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id C7E741F000CA; Mon, 23 Nov 2026 20:26:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795465631; bh=l9bZ/Z4zkSpMsXFfmdertwdtzZqERHTevFQJLNpFelA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=FZxxa04AzGuPYnQr2KskeCSG0MJQ0sk3iKKrqUNDBfN536EEJ1Nmd3Dl1kAWS4P8P mdw2OsFEVxFKXa7l9cspr61digUMG1XCnprOgN3lTGjh6wFi5iDmjbS3vnU5kWXkOk U3zeE+yw/zbzgIjbjopqo82rtsCVxpl3oZjRptqkq+6C0EpemFr9REDAfQ9QeSUC3P 2uxH4YXp2rxwSFER85fe4p/i/NuztU97uvzID2iRCXA35LWONgv+Gq/Gzk70/wCRpA 2vO2OFNWzvfmIrUH5KzhdwguAWoqZMKqCm5BY0MRXTQFrTthaGC5ME1wLrfOBy9XJP RTGr+kgKq4+eg== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 55A2A4C6D1; Mon, 23 Nov 2026 20:26:58 +0000 (UTC) From: Fil Dunsky via B4 Relay Date: Mon, 23 Nov 2026 23:26:56 +0300 Subject: [PATCH v2 2/5] dt-bindings: pinctrl: Add Cortina Systems CS7542 pin mux X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Message-Id: <20261123-cs7542-syscon-v2-2-1cd74b2522f9@gmail.com> References: <20261123-cs7542-syscon-v2-0-1cd74b2522f9@gmail.com> In-Reply-To: <20261123-cs7542-syscon-v2-0-1cd74b2522f9@gmail.com> To: Linus Walleij , Stephen Boyd , Brian Masney , Jerome Brunet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bartosz Golaszewski Cc: Arnd Bergmann , linux-gpio@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795465614; l=3060; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=F7pjXfN4EBv+S1ypEhkh5BVaKDFizMnbeKv3RXHbfp0=; b=1TGJ7kWa2uzt9MgqQ3tCTh3ok8nem6Xw/M61pN6pH/tv9BLuaqQS0yQtb0leMtlPDsi2KgvMP 7z0anRIgcsRBhtVMIDiXzg/2XN0DcBt3M9dKI+8+Qh02jDtIXHZ2MqQ X-Developer-Key: i=filipp.dunsky@gmail.com; a=ed25519; pk=JAYP8e2rJ54DHOmhNtXud8rl1igAaAXoOHxtJmVXI1g= X-Endpoint-Received: by B4 Relay for filipp.dunsky@gmail.com/20260930 with auth_id=1085 X-Original-From: Fil Dunsky Reply-To: filipp.dunsky@gmail.com Content-Transfer-Encoding: quoted-printable From: Fil Dunsky Describe the GPIO/peripheral selector in the global control block. Expose GPIO selection for all five banks and the UART signals used by the OpenWrt port, without inventing routes for other peripherals. Register offsets and masks are kept out of the device tree ABI. AI assistance: Codex prepared this change from the existing OpenWrt port and GPL vendor sources. Signed-off-by: Fil Dunsky --- .../bindings/pinctrl/cortina,cs7542-pinctrl.yaml | 84 ++++++++++++++++++= ++++ 1 file changed, 84 insertions(+) diff --git a/Documentation/devicetree/bindings/pinctrl/cortina,cs7542-pinct= rl.yaml b/Documentation/devicetree/bindings/pinctrl/cortina,cs7542-pinctrl.= yaml new file mode 100644 index 000000000..cd5c81a0d --- /dev/null +++ b/Documentation/devicetree/bindings/pinctrl/cortina,cs7542-pinctrl.yaml @@ -0,0 +1,84 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pinctrl/cortina,cs7542-pinctrl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cortina Systems CS7542 pin multiplexer + +maintainers: + - Fil Dunsky + +description: + The pin multiplexer is a child of the CS7542 global control syscon. + Five 32-bit registers select GPIO mode when a pin's bit is set, or the + peripheral signal when it is clear. Pin numbers match the five GPIO + banks, from gpio0 to gpio159. Initially only GPIO mode and the UART + signals on gpio72 through gpio77 are supported. Other peripheral + routes and electrical configuration are not described here. + +allOf: + - $ref: pinctrl.yaml# + +properties: + compatible: + const: cortina,cs7542-pinctrl + +patternProperties: + '-pins$': + type: object + $ref: pinmux-node.yaml# + additionalProperties: false + + properties: + function: + enum: [gpio, uart] + + pins: + items: + pattern: '^gpio([0-9]|[1-9][0-9]|1[0-5][0-9])$' + minItems: 1 + maxItems: 160 + + required: + - function + - pins + + allOf: + - if: + properties: + function: + const: uart + then: + properties: + pins: + items: + enum: [gpio72, gpio73, gpio74, gpio75, gpio76, gpio77] + +required: + - compatible + +additionalProperties: false + +examples: + - | + syscon@f0000000 { + compatible =3D "cortina,cs7542-syscon", "syscon", "simple-mfd"; + reg =3D <0xf0000000 0x100>; + #clock-cells =3D <1>; + + pinctrl { + compatible =3D "cortina,cs7542-pinctrl"; + + reset-pins { + function =3D "gpio"; + pins =3D "gpio37"; + }; + + aux-uarts-pins { + function =3D "uart"; + pins =3D "gpio72", "gpio73", "gpio74", "gpio75", + "gpio76", "gpio77"; + }; + }; + }; --=20 2.53.0 From nobody Tue Nov 24 11:35:53 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795465628; b=uCy8Pac955AwXu+UujyLSYRKfzsFEDZrZ3rdsQVRdmdENtCOdhzW+xu2S6c56vxWk8O+ 5WvwviQXqecmu0fueNJYG3VVeX0clXh7f3WfNIeO+sMMx1v+k0I7b5Xzm9xiaSHG0Rdaw 9Vr0HXJ7aemY37B5e4yOm/jHyK91sn5g4+Yvyrj2MbO1ejxD9P3YmL3U1gFZa1g4/pTPF PG+7HyxpPVRxIhPnkMRddFP0AABRzityxN7nHJyhYi90jIQvTPKrBZ2tZVDbjbmKHTofn /s+Zs0d/LqVa2FW5ZKqUw7P9d0wQ6zaMIMdteoczSuoOpfs4tfI+V/dU/4m3FHNSreA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795465628; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=O14BbX1wLIKYJhhhZsc1QX5KnrTbKI8v08Tn9x+QgPI=; b=V5exbmWVX8iC6ECo2QTThuXVoxt0T+ThH/73BD2nB0pylRmlyVBT6K9MX1Y1OYMJeT/L tNVSD1DcpnnsFRkMM8pvpdGEPKiVOCc2b9Z+dsvuxRgx+Oekkv/f3KONsEgYqrP3Ij1Un qe64c7wGI8eM8lz/pvKOlPNP+5gjF+JUVTQsxw7QJ/0viz4/9GEIDTQcm1sdhwH8JJJpW yVv1W+E6m/2Sa4MMGjqqVb/mQiRQcpgIis3+vHNPghYsBNxzCfvR7iNrarkzlu13UVJqD SdcjpH4HO6NoEO0dL+jP+0ESo65zLhVYyVCl8zMRkvp0A2VosF/5x1S1fzKHR7VHe7Q== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lVFlym97; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2C56606A335; Mon, 23 Nov 2026 20:27:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lVFlym97 Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1795465627; b=zcDU9SzB9mjAMueaWowi9WK0zAuslpOIciK30dZzI/JCKDxg0mSZE15e9au6vKBqeJBG 3DL/YvIZUFwt60p5TNIskg8N1ggcJMbxE+0qzGIWXniTO60/D68fKyjvwfQe9rtA0xKSI Z3NTIaARVFG/ZBAYLjow+y6W56fgNEp69KrRNy+IEfd84SDQLG4iO+n/KeX+Ipyt6QByh LCAozFDLBAzSfOpFUCDCuZ+anNREqgINEKAnPFAOYhk0L1G/oabknera4b1BtUCfjrEAv PYprLjy61MPhstt7mjehoBfXJvWXZyueh6Uu5nADCu6dHP/sZ2nQlfbRQiGHLGp3aGg== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1795465627; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=O14BbX1wLIKYJhhhZsc1QX5KnrTbKI8v08Tn9x+QgPI=; b=1aTmfdT22yw4oFHfjEFtQ6ovUB6fwDxEjPBJU+k3xMVEWRTmGuR2EbvoyWxV6XvA1gQZ mUNjSs2PZREo61mHyBK25e8pgMjGYxCzSS+WemSRMavxOEAamtgNfA/KYDnpqB4HeOe2L gl6/66dBAob4ur9wSrLX/K7y07GexswipTLdp/d7Hn0cPzzUIKRNvgOux/7PgybNKggFi Z5l81yzy5aJuGJaBNDj+Tz3RyXu/RCjwv6Fp9xryHxFmUhuP010N60jCUqk8uVTFlgJ9N +JCJQx646W1FqlHIt2bvvO2SGSfmmSF8HjcMkSOirmL9nEHOXn/n6y7Uh7WNdyo24Lw== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id E4CA41F000CF; Mon, 23 Nov 2026 20:26:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795465627; bh=O14BbX1wLIKYJhhhZsc1QX5KnrTbKI8v08Tn9x+QgPI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=lVFlym97nQ2sbSL5ozZO1aDO1fR1U3e7RJFB3YZp9m5I1SuVS296R67yGRppUBFGF Hlfdyj+THm0I4/O8FVx1zOlUn5kUfV+qXd3rFJylJG3A+tOQTgQmU+5pfx5+UJmzSM Le7+QFMLdlq/hYmm74hxKVtk1+0xbumTju1i60XX9MTyEAs/ANQoJ79TaJLc7CdwuV vJXUY6MaNdQ5F1V+iXXTsxLqmmmboOvE3bk3WcEXJn3NdFJ88fYgNXaXsm11A3c82h ldLAHSzr83WomvtqOkahsmTfBnckIyx9AtAK4D6dAdvPeLptOYrK62HE/vfn3/Ad7X GOfqE0YARPsLA== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 723E54C6D5; Mon, 23 Nov 2026 20:26:58 +0000 (UTC) From: Fil Dunsky via B4 Relay Date: Mon, 23 Nov 2026 23:26:57 +0300 Subject: [PATCH v2 3/5] clk: Add Cortina Systems CS7542 strap-selected clocks X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Message-Id: <20261123-cs7542-syscon-v2-3-1cd74b2522f9@gmail.com> References: <20261123-cs7542-syscon-v2-0-1cd74b2522f9@gmail.com> In-Reply-To: <20261123-cs7542-syscon-v2-0-1cd74b2522f9@gmail.com> To: Linus Walleij , Stephen Boyd , Brian Masney , Jerome Brunet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bartosz Golaszewski Cc: Arnd Bergmann , linux-gpio@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795465614; l=5002; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=JEa90SGQ0FgER4S1FcL2NkC7oSwXVNfRbOUFnfhpGuk=; b=KrJrQvjcrLUCB14UeBuoQd6zHRVPzDzRsfrhDKpL6DMmJCWveSgSQ8Yw1RS4Z1LTeOMkV6Tbb Dqbf19a8KAKA0WHbYwp4Ug2P8ilCGXXOFwHxSe4hyozneb65cUE/PbR X-Developer-Key: i=filipp.dunsky@gmail.com; a=ed25519; pk=JAYP8e2rJ54DHOmhNtXud8rl1igAaAXoOHxtJmVXI1g= X-Endpoint-Received: by B4 Relay for filipp.dunsky@gmail.com/20260930 with auth_id=1085 X-Original-From: Fil Dunsky Reply-To: filipp.dunsky@gmail.com Content-Transfer-Encoding: quoted-printable From: Fil Dunsky Register APB, CPU and AXI fixed-rate outputs from GLOBAL_STRAP[3:1], using the seven configurations recorded in the vendor kernel. Reject the reserved encoding instead of publishing a guessed frequency. Register before timer initialization and leave the syscon platform node available for its pinctrl child. Use the shared regmap, only read strap status, and unwind all registered clocks if provider setup fails. This is intentionally not a DVFS or programmable PLL driver. AI assistance: Codex prepared this change from the existing OpenWrt port and GPL vendor sources. Signed-off-by: Fil Dunsky --- drivers/clk/Kconfig | 9 +++++ drivers/clk/Makefile | 1 + drivers/clk/clk-cs7542.c | 90 ++++++++++++++++++++++++++++++++++++++++++++= ++++ 3 files changed, 100 insertions(+) diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 37a8e35d4..47b5265fe 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -58,6 +58,15 @@ config LMK04832 Say yes here to build support for Texas Instruments' LMK04832 Ultra Low-Noise JESD204B Compliant Clock Jitter Cleaner With Dual Loop PLLs =20 +config COMMON_CLK_CS7542 + bool "Cortina Systems CS7542 strap-selected clocks" + depends on OF && HAS_IOMEM + select MFD_SYSCON + help + Read the boot straps of the CS7542 global control block to provide + its APB, CPU and AXI clocks. This driver does not change PLLs or + dividers. It is built in because the APB clock is needed by timers. + config COMMON_CLK_APPLE_NCO tristate "Clock driver for Apple SoC NCOs" depends on ARCH_APPLE || COMPILE_TEST diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 52d138d4f..16b1168c8 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -63,6 +63,7 @@ obj-$(CONFIG_ARCH_AXXIA) +=3D clk-axm5516.o obj-$(CONFIG_COMMON_CLK_BD718XX) +=3D clk-bd718x7.o obj-$(CONFIG_COMMON_CLK_BM1880) +=3D clk-bm1880.o obj-$(CONFIG_COMMON_CLK_CDCE706) +=3D clk-cdce706.o +obj-$(CONFIG_COMMON_CLK_CS7542) +=3D clk-cs7542.o obj-$(CONFIG_COMMON_CLK_CDCE925) +=3D clk-cdce925.o obj-$(CONFIG_ARCH_CLPS711X) +=3D clk-clps711x.o obj-$(CONFIG_COMMON_CLK_CS2000_CP) +=3D clk-cs2000-cp.o diff --git a/drivers/clk/clk-cs7542.c b/drivers/clk/clk-cs7542.c new file mode 100644 index 000000000..4e6c1e98a --- /dev/null +++ b/drivers/clk/clk-cs7542.c @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Cortina Systems CS7542 strap-selected clocks */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define CS7542_GLOBAL_STRAP 0x0c +#define CS7542_STRAP_SPEED GENMASK(3, 1) +#define CS7542_NUM_CLKS 3 + +/* Rates from the GPL vendor kernel's get_platform_clk(). */ +static const unsigned long cs7542_rates[][CS7542_NUM_CLKS] =3D { + /* APB, CPU, AXI */ + { 100000000, 400000000, 133333333 }, + { 100000000, 600000000, 150000000 }, + { 100000000, 700000000, 140000000 }, + { 100000000, 800000000, 160000000 }, + { 100000000, 900000000, 150000000 }, + { 150000000, 750000000, 150000000 }, + { 170000000, 850000000, 141666667 }, +}; + +static const char * const cs7542_clock_names[] =3D { + [CS7542_CLK_APB] =3D "cs7542-apb", + [CS7542_CLK_CPU] =3D "cs7542-cpu", + [CS7542_CLK_AXI] =3D "cs7542-axi", +}; + +static void __init cs7542_clk_init(struct device_node *np) +{ + struct clk_hw_onecell_data *data; + struct regmap *map; + unsigned int strap, speed; + int i, ret; + + map =3D syscon_node_to_regmap(np); + if (IS_ERR(map)) { + pr_err("%pOF: cannot get global regmap: %ld\n", np, PTR_ERR(map)); + return; + } + + ret =3D regmap_read(map, CS7542_GLOBAL_STRAP, &strap); + if (ret) { + pr_err("%pOF: cannot read clock strap: %d\n", np, ret); + return; + } + + speed =3D FIELD_GET(CS7542_STRAP_SPEED, strap); + if (speed >=3D ARRAY_SIZE(cs7542_rates)) { + pr_err("%pOF: unsupported clock strap %u\n", np, speed); + return; + } + + data =3D kzalloc_flex(*data, hws, CS7542_NUM_CLKS); + if (!data) + return; + data->num =3D CS7542_NUM_CLKS; + + for (i =3D 0; i < CS7542_NUM_CLKS; i++) { + data->hws[i] =3D clk_hw_register_fixed_rate(NULL, + cs7542_clock_names[i], NULL, + 0, cs7542_rates[speed][i]); + if (IS_ERR(data->hws[i])) { + ret =3D PTR_ERR(data->hws[i]); + goto err_unregister; + } + } + + ret =3D of_clk_add_hw_provider(np, of_clk_hw_onecell_get, data); + if (!ret) + return; + +err_unregister: + while (i--) + clk_hw_unregister_fixed_rate(data->hws[i]); + kfree(data); + pr_err("%pOF: cannot register clocks: %d\n", np, ret); +} + +/* Timers need APB before platform devices, but the pinctrl child must pro= be. */ +CLK_OF_DECLARE_DRIVER(cs7542_clk, "cortina,cs7542-syscon", cs7542_clk_init= ); --=20 2.53.0 From nobody Tue Nov 24 11:35:53 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795465630; b=QIbvI+cBFzCeeJ5Mq/wKy5Tp1SxDWwWbCWhFYKW5gcApqBoH3ozsSxcOjn0cyRxGcuyL 1373M/Oz0u1P4lb5okY0ymh4VfC947xmEq4b9jgmvYLL7RLk4NpnlKqglREHQqpjJt41e m/ey9x3OwwDsXFYvlGLrsuWvrhICL5KumhYy98ziY3x4PKvk0aqJYEfhMRqED5ug9aqNp 7d6QDwSbR65SyoMH9odyOAWlNjKJyi5ax9mvcV583mFM389445fs2YiVf06Uer5wAW9UE 9g7XhkrOD893Aiz3CpVh7tZzsSfzrGiXpHE1SgHg+9sUrcrwQ8TNiLMIaZstFVwq83Q== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795465630; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=kxyZ6UZFcbYGCnLOm2Vxd4l9fBPKFCro49fi48VVP/w=; b=I03ZNEwoWP1FoOV7ziXrdIQVOJ8F+xw+b2hgiNAbRL1WDa51q4Ycdq/60nJ4h3rc8rO0 3L8cJkg4gP9G2pu58R9zD54QqYTaZ/C6nHic7odCkaKGshcFKkpop7GuLAFS8SWsDFjp/ FI/dxcz1RF4teJ2YtXS/gvdGxyqf0MZxTa56ZP7GMrH4MDJJsqsXHK3qdDVgCRRgv6N8R vOCco9NoM00FaftMhqcE8XVCdGmnedQ+SMCdT2Mwm8U0SHJxRStb3VMb/muKX0IEziWf3 udnMUi1rXYC+4ueWxQ3AZP0I87goWCsY8p+ps2Czyhg46K5AGYfSAtFV4PKpYbcLaMw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MKbYXgiO; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A2E2606A334; Mon, 23 Nov 2026 20:27:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MKbYXgiO Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1795465629; b=R9summlmE0LO4xu/L4OSgtlicDzgwEG0bbgPhPuJ8lh2WTQjkOelk+gfdQqMDrHNI/8Q mgjHZUWRwejHgXdFh2+k93RsuXgHks23BrCNHtqt+x3cDGBCXQjE8Zjl3Cd08lujXxzL6 g+mLS5nRBVfz2GXSezFVgj+6hcCJlkXi99/tajOT0Sig9AWi6oB8BaD1Z2Qg3JVclqzfu Z3HE8IhPqVOijd6L2P1oCZ7LJp4QmhFmZV6wnK4NmhN/k/ck04gGA2X6cbYNzOYtc7YPA MYKkGtGummsr7IyK5cu+Yrp0c3PkVPNpzaoS0AjVSEKiKLmWUOEx5hLEzK20sTXf8AQ== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1795465629; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=kxyZ6UZFcbYGCnLOm2Vxd4l9fBPKFCro49fi48VVP/w=; b=lv0zZjVSx/5mD+ls/O3EjwKpAQb9TiRdfdWtCEq9InL2v9lXza9q4Nl/dOdOM0X3joIo 3MxXgCEuQlO1vaxXRKXv21Dk8Y4ZCTdrDij1wgq8iO1rnruDp7cWY244tvjRYdiJGpWzk 635VuiUzzhbUci65t/j5tEdoIeZ4RFqcZH0LQ7G/II4IJeCBOlGcRZpA/lFJThxQJ9jAJ Iplm3I8hZl3+3On2Qo0acAIdkUvua/rmcnMeO2wprvimcmE6fuQbhbdAt+nQ0dAL1lID7 rdk3u95Y3N3awB8zWW3+FaPFMu20a/czSc4/O9yN1Bb6Vt6K7moCDErOyp5IwK2vlsg== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 0D4241F000D1; Mon, 23 Nov 2026 20:26:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795465629; bh=kxyZ6UZFcbYGCnLOm2Vxd4l9fBPKFCro49fi48VVP/w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=MKbYXgiOAaJ9dpffi8ODYhKdF9PoPgziAqdZ0M2q2bBx0tobN6I+LoI1TFMrb0sCj p4e/7bLSSbWcFaDNHldBK/VQGbRORj5MkWJWcRGVli9k/2CXayw2pKL0+2a5LUAe3d dkyrKa4UCwPgltiH7vReXYqp1Ku4AHhBYg2iEvsKNaEek7s7uhV4rKQmkei+nvy1K9 fAsRDVg7VuT1NP9rQLe3FYpkSsIrN8N3YVGKvZerDKjrZwspieZnpioqx8a4UyuIOY AEopZhteidhk9VRjCS6zCzLAjLxslW8sUNp/hei9eSSM7XzaaAvjYlgODj2FqLrFow XcW6jZ0NW29oA== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 8FF5C4C6D9; Mon, 23 Nov 2026 20:26:58 +0000 (UTC) From: Fil Dunsky via B4 Relay Date: Mon, 23 Nov 2026 23:26:58 +0300 Subject: [PATCH v2 4/5] pinctrl: Add Cortina Systems CS7542 pin multiplexer X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Message-Id: <20261123-cs7542-syscon-v2-4-1cd74b2522f9@gmail.com> References: <20261123-cs7542-syscon-v2-0-1cd74b2522f9@gmail.com> In-Reply-To: <20261123-cs7542-syscon-v2-0-1cd74b2522f9@gmail.com> To: Linus Walleij , Stephen Boyd , Brian Masney , Jerome Brunet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bartosz Golaszewski Cc: Arnd Bergmann , linux-gpio@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795465614; l=8324; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=UNpZwyEFgKF3jz0tUixduHTlnN10XC0JDB4foaScjk8=; b=HjzHWx+KKncsOSVhOPBX+wdlq2A4QvsU0p3wP8K1BIXGnvOpq41si01WU2NvLEsAA5apHw8Og hupMUzlYTJnBWt6yTGOBPPrVc7hsF8ft9gvaqqJJbVcB9qVnAQfc1sN X-Developer-Key: i=filipp.dunsky@gmail.com; a=ed25519; pk=JAYP8e2rJ54DHOmhNtXud8rl1igAaAXoOHxtJmVXI1g= X-Endpoint-Received: by B4 Relay for filipp.dunsky@gmail.com/20260930 with auth_id=1085 X-Original-From: Fil Dunsky Reply-To: filipp.dunsky@gmail.com Content-Transfer-Encoding: quoted-printable From: Fil Dunsky Use the global syscon regmap for the five GPIO mux registers. Each bit selects GPIO when set and a peripheral signal when clear. Support GPIO on all 160 lines and the six UART pins exercised by the OpenWrt port. Do not guess mux settings for the other peripherals. Use masked regmap updates so independent pins and users of the shared block retain their settings. No register changes are made merely by probing; only a selected state or a GPIO request changes a pin. Register and initialize the controller before enabling its own hogs. AI assistance: Codex prepared this change from the existing OpenWrt port and GPL vendor sources. Signed-off-by: Fil Dunsky Reviewed-by: Linus Walleij --- drivers/pinctrl/Kconfig | 13 +++ drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-cs7542.c | 195 +++++++++++++++++++++++++++++++++++= ++++ 3 files changed, 209 insertions(+) diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index dc7138302..89f247cb2 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig @@ -188,6 +188,19 @@ config PINCTRL_BM1880 help Pinctrl driver for Bitmain BM1880 SoC. =20 +config PINCTRL_CS7542 + tristate "Cortina Systems CS7542 pin multiplexer" + depends on OF && HAS_IOMEM + select MFD_SYSCON + select PINMUX + select GENERIC_PINCONF + help + Select GPIO mode or the supported peripheral signals in the CS7542 + global control block. This driver shares the syscon register map + with the clock provider and leaves unrelated pins unchanged. + Electrical pin configuration and other peripheral routes are not + implemented. + config PINCTRL_CY8C95X0 tristate "Cypress CY8C95X0 I2C pinctrl and GPIO driver" depends on I2C diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile index ce0825f4f..59541be4d 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile @@ -23,6 +23,7 @@ obj-$(CONFIG_PINCTRL_AW9523) +=3D pinctrl-aw9523.o obj-$(CONFIG_PINCTRL_AXP209) +=3D pinctrl-axp209.o obj-$(CONFIG_PINCTRL_BM1880) +=3D pinctrl-bm1880.o obj-$(CONFIG_PINCTRL_CY8C95X0) +=3D pinctrl-cy8c95x0.o +obj-$(CONFIG_PINCTRL_CS7542) +=3D pinctrl-cs7542.o obj-$(CONFIG_PINCTRL_DA850_PUPD) +=3D pinctrl-da850-pupd.o obj-$(CONFIG_PINCTRL_DA9062) +=3D pinctrl-da9062.o obj-$(CONFIG_PINCTRL_DIGICOLOR) +=3D pinctrl-digicolor.o diff --git a/drivers/pinctrl/pinctrl-cs7542.c b/drivers/pinctrl/pinctrl-cs7= 542.c new file mode 100644 index 000000000..748682675 --- /dev/null +++ b/drivers/pinctrl/pinctrl-cs7542.c @@ -0,0 +1,195 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Cortina Systems CS7542 GPIO/peripheral pin multiplexer */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "pinctrl-utils.h" + +#define CS7542_GPIO_MUX 0x1c +#define CS7542_NUM_PINS 160 +#define CS7542_UART_FIRST 72 +#define CS7542_UART_LAST 77 + +enum cs7542_function { + CS7542_FUNCTION_GPIO, + CS7542_FUNCTION_UART, +}; + +struct cs7542_pinctrl { + struct regmap *map; + struct pinctrl_desc desc; + struct pinctrl_pin_desc pins[CS7542_NUM_PINS]; + const char *groups[CS7542_NUM_PINS]; +}; + +static const char * const cs7542_functions[] =3D { "gpio", "uart" }; +static const char * const cs7542_uart_groups[] =3D { + "gpio72", "gpio73", "gpio74", "gpio75", "gpio76", "gpio77", +}; + +static int cs7542_get_groups_count(struct pinctrl_dev *pctldev) +{ + return CS7542_NUM_PINS; +} + +static const char *cs7542_get_group_name(struct pinctrl_dev *pctldev, + unsigned int group) +{ + struct cs7542_pinctrl *pctl =3D pinctrl_dev_get_drvdata(pctldev); + + return pctl->groups[group]; +} + +static int cs7542_get_group_pins(struct pinctrl_dev *pctldev, + unsigned int group, const unsigned int **pins, + unsigned int *num_pins) +{ + struct cs7542_pinctrl *pctl =3D pinctrl_dev_get_drvdata(pctldev); + + *pins =3D &pctl->pins[group].number; + *num_pins =3D 1; + return 0; +} + +static const struct pinctrl_ops cs7542_pinctrl_ops =3D { + .get_groups_count =3D cs7542_get_groups_count, + .get_group_name =3D cs7542_get_group_name, + .get_group_pins =3D cs7542_get_group_pins, + .dt_node_to_map =3D pinconf_generic_dt_node_to_map_pin, + .dt_free_map =3D pinctrl_utils_free_map, +}; + +static int cs7542_get_functions_count(struct pinctrl_dev *pctldev) +{ + return ARRAY_SIZE(cs7542_functions); +} + +static const char *cs7542_get_function_name(struct pinctrl_dev *pctldev, + unsigned int function) +{ + return cs7542_functions[function]; +} + +static int cs7542_get_function_groups(struct pinctrl_dev *pctldev, + unsigned int function, + const char * const **groups, + unsigned int *num_groups) +{ + struct cs7542_pinctrl *pctl =3D pinctrl_dev_get_drvdata(pctldev); + + if (function =3D=3D CS7542_FUNCTION_GPIO) { + *groups =3D pctl->groups; + *num_groups =3D CS7542_NUM_PINS; + } else { + *groups =3D cs7542_uart_groups; + *num_groups =3D ARRAY_SIZE(cs7542_uart_groups); + } + return 0; +} + +static int cs7542_set_mux(struct pinctrl_dev *pctldev, unsigned int functi= on, + unsigned int group) +{ + struct cs7542_pinctrl *pctl =3D pinctrl_dev_get_drvdata(pctldev); + unsigned int mask; + + if (group >=3D CS7542_NUM_PINS || function >=3D ARRAY_SIZE(cs7542_functio= ns)) + return -EINVAL; + if (function =3D=3D CS7542_FUNCTION_UART && + (group < CS7542_UART_FIRST || group > CS7542_UART_LAST)) + return -EINVAL; + + mask =3D BIT(group % 32); + return regmap_update_bits(pctl->map, CS7542_GPIO_MUX + (group / 32) * 4, + mask, function =3D=3D CS7542_FUNCTION_GPIO ? mask : 0); +} + +static int cs7542_gpio_request_enable(struct pinctrl_dev *pctldev, + struct pinctrl_gpio_range *range, + unsigned int pin) +{ + return cs7542_set_mux(pctldev, CS7542_FUNCTION_GPIO, pin); +} + +static bool cs7542_function_is_gpio(struct pinctrl_dev *pctldev, + unsigned int selector) +{ + return selector =3D=3D CS7542_FUNCTION_GPIO; +} + +static const struct pinmux_ops cs7542_pinmux_ops =3D { + .get_functions_count =3D cs7542_get_functions_count, + .get_function_name =3D cs7542_get_function_name, + .get_function_groups =3D cs7542_get_function_groups, + .function_is_gpio =3D cs7542_function_is_gpio, + .set_mux =3D cs7542_set_mux, + .gpio_request_enable =3D cs7542_gpio_request_enable, + .strict =3D true, +}; + +static int cs7542_pinctrl_probe(struct platform_device *pdev) +{ + struct device *dev =3D &pdev->dev; + struct cs7542_pinctrl *pctl; + struct pinctrl_dev *pctldev; + unsigned int i; + int ret; + + pctl =3D devm_kzalloc(dev, sizeof(*pctl), GFP_KERNEL); + if (!pctl) + return -ENOMEM; + + pctl->map =3D syscon_node_to_regmap(dev->of_node->parent); + if (IS_ERR(pctl->map)) + return dev_err_probe(dev, PTR_ERR(pctl->map), "cannot get global regmap\= n"); + + for (i =3D 0; i < CS7542_NUM_PINS; i++) { + pctl->groups[i] =3D devm_kasprintf(dev, GFP_KERNEL, "gpio%u", i); + if (!pctl->groups[i]) + return -ENOMEM; + pctl->pins[i].number =3D i; + pctl->pins[i].name =3D pctl->groups[i]; + } + + pctl->desc.name =3D dev_name(dev); + pctl->desc.owner =3D THIS_MODULE; + pctl->desc.pins =3D pctl->pins; + pctl->desc.npins =3D CS7542_NUM_PINS; + pctl->desc.pctlops =3D &cs7542_pinctrl_ops; + pctl->desc.pmxops =3D &cs7542_pinmux_ops; + + ret =3D devm_pinctrl_register_and_init(dev, &pctl->desc, pctl, &pctldev); + if (ret) + return dev_err_probe(dev, ret, "cannot register pin controller\n"); + + return pinctrl_enable(pctldev); +} + +static const struct of_device_id cs7542_pinctrl_match[] =3D { + { .compatible =3D "cortina,cs7542-pinctrl" }, + { } +}; +MODULE_DEVICE_TABLE(of, cs7542_pinctrl_match); + +static struct platform_driver cs7542_pinctrl_driver =3D { + .probe =3D cs7542_pinctrl_probe, + .driver =3D { + .name =3D "cs7542-pinctrl", + .of_match_table =3D cs7542_pinctrl_match, + }, +}; +module_platform_driver(cs7542_pinctrl_driver); + +MODULE_DESCRIPTION("Cortina Systems CS7542 pin multiplexer"); +MODULE_LICENSE("GPL"); --=20 2.53.0 From nobody Tue Nov 24 11:35:53 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795465638; b=wzT+x+aqhqsX3HXZLX1QCAW7GGODsBpO3Ux0SgNiksKs6HdI3w+KU/BJUhfM7onU90Kw Og9Q6jnKs1KeJQeVIzcG8FX4KHh9WLEKBqS0LGWgEFD08UQ5LITGXWezJd+YkicJWbbsx WL/4eTevyVD4cI5grPX4L3GtVuQNHVCkoZ7FUQwQl1ZUXCTs9+2I78WKrt4TDxSED2guU ZDWJOflGxw3GMEB9qSLzGQ1PuVsFwSjkmjJWOqpxbb2X5UY4AJJ+7ldh91hz/VwBWZnXf +ovmfbORRtdFN2MsK5idettNmkzVZxd4RYN8DQocLAVneMNhr+Qn1IVlMwDi2OkjW0w== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795465638; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=JA1RY4AoQnfSHpB9qDuwptqbpVvMYp1OIFwFo8h5NUs=; b=0TBvT5YmlskRGW1QtF99X7GulXeas28zJJRf4/ccExbXZ0lNrF/FIp4t7IsDjtuNMpfN 2k7MROfdxRJVbi+iVpvyvGtke2Wne6kG9Op96Mf6VW+mRj4bvX02gOah3WmEZg8zO/pW7 wpHTJFeLirnF1pfGRvuuFvUKfJsaMlTK2kTOOLzCna2wffAMzSt+RrjF/BKzYLIfeH9AF zWPqgwjMjqNInaknhz8p6VJ5YfbmBBi2/iu8yR93x8bgMy3ysZhZe+XceaaC4eTHxWrHm OMWSvy+ToSDaXpP79TuOyPWtpJaWJ2sm7HrsvE+fuOjUTvCLCwsSpHnDdVM2ppNV93Q== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Y615IMCE; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4674F606A6A3; Mon, 23 Nov 2026 20:27:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Y615IMCE Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1795465638; b=JXg5JtCXr9lwSEERf+m31ftx5Of0lQTElbBT+w7oCYORkl+Cnw6UwF7R/uxaFW79Fvdl NCZ1tlJczYKSdj7TmS5iFYcvlBXOkds16gY8biEh3r4Jo65XfMpeEmcPyBr4JdfNmmyGr K7XF2RGvbIaYIV1jhpe8AvSEYypY28nQ/9zeU4/P37PWbW9v4kh8uvFcRnYG89YHcAv6W osaI45e5LXPSBbod31faSr2C+uGnras9f7wJT6Wgp41zm+DHq9q19w28kwCHC0tRde0g0 dfLIHjXhK2TgFoNxn7h1hQHtxdCpA5Ij0W8asxJ3hVWdsuVn+9Gou0O70WJcpVeMgJA== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1795465638; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=JA1RY4AoQnfSHpB9qDuwptqbpVvMYp1OIFwFo8h5NUs=; b=msNFyoP5fbgUolASjjY1PiwDX4GifFvzFfMUHR7j97pMA4+93pVvKM2Cr23XYkN8RA5k x5V5IP5/37mt+XRnphK88GhFHht8gbos0/laCuPwk9O8x+yTc6Afdf/wib1qF0hO3IgrX 6sdipceaH+KlztEZU4BVZNHmRWCMn8i3Pev5Kh/soD4KPKafMLFo9r/60Za7p75z7bsud szhwZbgL+aP6uAnuANZ68rpyUwNGC8Wprh1I65PkEArad+Go+ZPjDvx2CQSxvSsoBJUkL w5dHvHXw0+B1FytRBaq/EVH2a5WqE2e54rnUPXzH0Vy5C10iCz0DJHJxtT2JF/M6Vxg== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 6423C1F000C4; Mon, 23 Nov 2026 20:27:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795465638; bh=JA1RY4AoQnfSHpB9qDuwptqbpVvMYp1OIFwFo8h5NUs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=Y615IMCE6ZHyF+uQeYMqDeDmE4h8V4Xf3YuP1phXJYZNlEwUPzgLac65zs4qOu5Vk 3W6+SYTqjr47vm+Kl1ULmpUhGHvY5eUnVJQEs5ypNvRUPF3K2ZdsluQYkDX9h7Ef6H Xm43+ntDKbWmx1mUZSTSs/SAPO1tAkNM7gBN3bz7an7f7qCCv+7Bm2JX+l1zIpsKpY H3LlXkOT0iGZ4/AkJxRjgvegBCiBbFNPQSoW9ZuXFJDL2no8F2v6/3HiuUvw9cKW6a 2GBHgn6TVsNFPtGLSprC6IrcKEHLlEorAlRLkZaf2BmJ+tF7xpH74ssAIG6BAxFa9L cuPBK200NfL+Q== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id AC4E14C6DD; Mon, 23 Nov 2026 20:26:58 +0000 (UTC) From: Fil Dunsky via B4 Relay Date: Mon, 23 Nov 2026 23:26:59 +0300 Subject: [PATCH v2 5/5] MAINTAINERS: Add CS7542 global control support X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Message-Id: <20261123-cs7542-syscon-v2-5-1cd74b2522f9@gmail.com> References: <20261123-cs7542-syscon-v2-0-1cd74b2522f9@gmail.com> In-Reply-To: <20261123-cs7542-syscon-v2-0-1cd74b2522f9@gmail.com> To: Linus Walleij , Stephen Boyd , Brian Masney , Jerome Brunet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bartosz Golaszewski Cc: Arnd Bergmann , linux-gpio@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795465614; l=1174; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=fgWHYLyeGItAI+Z6w73sl393x6RrEmbFL0xFZL+FdhU=; b=I9Y0WYCeAFYXc7S1UwMeT0BTdFu4HDPRBK8cINHLf2b7zR3WBPMm0SUh7Mr+fDy4C3i/BWeZe PZDMMzKQ4rvApav6YgCBt/8rc6sF4lse4gKdB6wY4tYya23RS2HwbD5 X-Developer-Key: i=filipp.dunsky@gmail.com; a=ed25519; pk=JAYP8e2rJ54DHOmhNtXud8rl1igAaAXoOHxtJmVXI1g= X-Endpoint-Received: by B4 Relay for filipp.dunsky@gmail.com/20260930 with auth_id=1085 X-Original-From: Fil Dunsky Reply-To: filipp.dunsky@gmail.com Content-Transfer-Encoding: quoted-printable From: Fil Dunsky Track the global control binding, strap clock provider and pin multiplexer independently of the pending platform series. AI assistance: Codex prepared this change from the existing OpenWrt port and GPL vendor sources. Signed-off-by: Fil Dunsky --- MAINTAINERS | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 44540a1eb..d8835aeca 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2949,6 +2949,16 @@ F: tools/perf/tests/shell/coresight/* F: tools/perf/util/cs-etm-decoder/* F: tools/perf/util/cs-etm.* =20 +ARM/CORTINA SYSTEMS CS7542 GLOBAL CONTROL +M: Fil Dunsky +L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) +S: Maintained +F: Documentation/devicetree/bindings/pinctrl/cortina,cs7542-pinctrl.yaml +F: Documentation/devicetree/bindings/soc/cortina/ +F: drivers/clk/clk-cs7542.c +F: drivers/pinctrl/pinctrl-cs7542.c +F: include/dt-bindings/clock/cortina,cs7542-clock.h + ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE M: Hans Ulli Kroll M: Linus Walleij --=20 2.53.0