From nobody Tue Nov 24 11:35:57 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=1795465958; b=fN40pwkYLtKCUTWQoXa8xf3jEvn5EFy2xnE0UTjVi2+/WFYLal/blpqyh2kpKOTJyzcq 1FLAOh0zFwVm4SYhBPD0E2qw5ZbWl0Qb0UhP+ENXYgNmJc/3jlWemFw1KMWpssBI/hxkE uUJYhAsTmS+XGz+Nfds682gQtLuFq/R2uJJhJhW5MCUYzBPKb3IafGJYYboONkWtKpNje mXBOL27G3dPHo3HjCou5eyRStuYqpjLmI1rOpmqqpjzNSGvumv1vXbDanDsD7PMr7ryZC pHuWRwFJsppABSisP+d+XiJ4Vs8JpkkbT/8onweffpCneR5WH8FfSj8COaCe0kZbgsA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795465958; 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=9tyMkUr9+zYWv3mAdl+/oTYNIcjMUy1JAChBbK6vIio=; b=X94Hs1ghZB0oKrxzTHUY9bia7zYIxTl6j9O5JjCJCUahXP11JgohvUgqTd59pWPRZCEs dylIX9oPD8g1gBApRmyBkfX529SLvWKsQxhqPSyUVNamdoj9dnjqFqJMkzWPuOYN6vz+I nQ1FEG4lUls9XxMDD2R40gcqFgsanA713a7SNH9L6TmwkNR+SaCD+UAxAtjC8s3JWqOXA 3q3pg0XBLZ6ISrFFz8r50OKK5IPNZy8jNOm7HNx4YGSnb+/EX3x2tFFUh6eHrjeIMFeWt Yhz3IfFBLGtWrhT3h0dICAZpE1AKt06Odjti5v2IB1+vCKDfcsukv5WasEG/gf1qQ+w== 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=KQNLeil0; 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 23485606A31E; Mon, 23 Nov 2026 20:32:38 +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=KQNLeil0 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=1795465957; b=iOtjEsL2Q+i3LzgiE3w+KuJluBjxBbo8EwFX/moGyUba1kn+UbIuLex6pPFm5UeHFvwM H8ig3agIoHRCwwAunmlZwX97AMxtqOHoGlWKGT1EGb8JqLmM/gMIroTAT2KTR9qDfcueo zjblP0hyjnZN6ba/DIXf/y6FsZrDJbUxVsUnsWWI6fVbVV+Omq2hvBr2ArRGsAmT/+QWt vwEnOc5GFFDMiJj7Xyv7r+PX9Gr+UuThajO/M5OI1guQfwEWNqaxut7Nwk/utZLNwWUVV ejCn1PmvuyXnT2R8yVeixCOr+daR4TqjN6alCpOrKTBNdExupWsQSJeRYemPSd9axEw== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1795465957; 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=9tyMkUr9+zYWv3mAdl+/oTYNIcjMUy1JAChBbK6vIio=; b=z9dSqIBGAboFrpQnMo61whta9IURKSojLxc9ri2KnSbBYbMYyOhPLoyTlRc9cNjszCwf PkH3D2rXPc9XDqbmNukH9j+1AW/VhrhMVJqg0jj9k2AaAk6pUKF+2HcoSD1tao7Bg4OCs wcb77IF7/QahfMs5CMJKz1IYLdydkkKAaUFzsU3bxM1pFhtofvDcsrTifK3ilV2SeWUWD JeSOc3wCnMmxC7J1TWE27yZ1irO7Tw3Lwl1j+vQq9Dd49t31mDqIBALGWaFcamQE0DSVM THM9swcm4VhGHluEQ4Gk3KuAs/dbKkNOy7tB4HT49jlw+dGvf4iPYAUPh7nwilLCDHQ== 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 DC98B1F000D3; Mon, 23 Nov 2026 20:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795465957; bh=9tyMkUr9+zYWv3mAdl+/oTYNIcjMUy1JAChBbK6vIio=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=KQNLeil0pnY3SrpZpmzEetia+5h2ujIhwz395ANnl5+CGDA4FJrm6su6cs0RtKQR1 b9qrMND+GQ4PWNWC0tdvTwcrjjFt9HXQV7Scq5uXfnixwVAZ/gdYI6AldMGh94GSpH aA997h2qIxXWaumeCqUxezbRuMZ0abYn6PlOQkT70461iQS7lz+V4J4kToFJ4UdZFb WKPJ8G13SlT1HYrc76oYGqBSEe1PqxyAWVw7RtvkurczwjVIPpvvNHaCISMiltdMQs eTQ/cDaZU3EvFhWcNB9pw7H9cDHSV+ZU2+g0u53vUm0VDHPya55EU9ii81hnS6L49r kagMxuPPI0wsA== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 5E1B54C6FF; Mon, 23 Nov 2026 20:32:17 +0000 (UTC) From: Fil Dunsky via B4 Relay Date: Mon, 23 Nov 2026 23:32:15 +0300 Subject: [PATCH v2 1/8] PCI: dwc: Export the multiplexed MSI interrupt handler 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-b4-cs7542-pcie-v2-1-f589a9cd0bef@gmail.com> References: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> In-Reply-To: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> To: Manivannan Sadhasivam , Stephen Boyd , Vinod Koul Cc: Jingoo Han , Lorenzo Pieralisi , Krzysztof Wilczynski , Rob Herring , Bjorn Helgaas , Brian Masney , Jerome Brunet , Neil Armstrong , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795465935; l=872; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=Mna9V2FvctfGCov2fj28CrWMP+FmQdEcH5a5uq4pt5U=; b=iPA0bYRf79FFPZCfNmPxcL55dq3dCI1ypOQzRlCncf7ujc4VHkSd+c3JzvJjVekdl6zTVt/SN I53Le0IATu0AVXqUzEOQetC/fcE6WJgt8jFDHqqTTa+3cqZRXGvbTNs 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 Allow modular host glue with a combined application interrupt to dispatch the internal MSI receiver without installing a second chained handler. Signed-off-by: Fil Dunsky --- drivers/pci/controller/dwc/pcie-designware-host.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pc= i/controller/dwc/pcie-designware-host.c index bbb02458a..1d076bb62 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -85,6 +85,7 @@ void dw_handle_msi_irq(struct dw_pcie_rp *pp) generic_handle_demux_domain_irq(pp->msi_irq_domain, irq_off + pos); } } +EXPORT_SYMBOL_GPL(dw_handle_msi_irq); =20 /* Chained MSI interrupt service routine */ static void dw_chained_msi_isr(struct irq_desc *desc) --=20 2.53.0 From nobody Tue Nov 24 11:35:57 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=1795465964; b=hKad0N2qy9EedlLSOG5rxJNZKq8tnHDjS5SVsnAtKk+7Sv4TJyTE/Tbb621QeIx+1LwO R0IO0k/qg9gOH4jQE2j9EheWulLNbWBkzrNhyupf3Q0UiHX09zfXntU7H5s96c9PPz3oO OytKpREGVSknSfzTYCMVxeMyzD1K5ZZHTrXmQMJ0Dezndo3/Vo33JsCNOsdxFwMJsBFCM I9NUewwKelGRH60tteCFZdndwkHBsZiQkzQrWPpkKDRxz6OR+EucQo3ufWR/EnjfysNf5 kja/6qniheCrZumBV+21UDZmjYK0igB34Fc9+l4cbsbvLzORLuKr0IiCwwbM8vd24dA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795465964; 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=6P272XRmtxVRxUwOCYKqdPoT8y/CgT8kIkZk04v3YWI=; b=NSG4/01KCLZD2foPkQUCcovudN9eoB47wuAbhVLfEfwjN/2K8pqkyuLbgqCvKXLAHyLb y8pWtMIgYpwwRlOrdEcWzd3GDewcEXmbmRbBNwX8zBniKnjdz9ETKfcP9VIZWOHAyL4ES TrShhBBqsZOEwQiiHTpM51gbu3EGO7btnNW7HUiuIKmogXwdIxpcHRY5PvjYfJu5/xP+O 9eU1n34Poe14u0vu+qwzS9paAYbebyKnmq48g/usPfTBFH0wVBk7+wBRqCUYKmuPn19cH CHEYMX8mvzRGOxZKyGNRteAPzERN+3lnBIRTrLAAs89RNOe5Gh9GXFanK7zZwjdKWdA== 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=mNi9GM5h; 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 59761606A682; Mon, 23 Nov 2026 20:32:44 +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=mNi9GM5h 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=1795465963; b=O0KU5gMTHRZ6ha1UDuyB7fxH28xZWF1JM5HtVisr7qMVIveTwTorp7CTeURvKHlP0rXV Awj7xsaQ4zm5naZq8Y+HKauqGj9RgkXLDpGd8YfW78OcNJC2LrMm2FovAyTmm5zn45+as DxUoRJHXYOIbX7H3z4n2jdcE4r5z5j1IvetdbM+Rxfuo/CXgFFKSQRkVfJdJOi/NF7ksU FA81Vi1LRxFIog93NS4A9YD2JN7u0ODW4XcHpBbKi8Bi4yElAw2kc73aqGR2ovxlkoBiR 3B8DsxImOMqRd0cgjvvnx8gwn7Lh0h3P0FIQR0nqkZ78V26Jh4Ofoi0dn5D3b36YF9g== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1795465963; 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=6P272XRmtxVRxUwOCYKqdPoT8y/CgT8kIkZk04v3YWI=; b=eYqQz+9W8x4LlTsaUXxBJrtNOhxbfADkbD85SKH1364v9tRrqjoIbXB494ZWhyjWnpIh EI1TkroOFnkPp1wC4hcC3UkkoEFDeCCP8Vf6dwDhhzusj9+eZTlpd1UizQuUrsaQBmOth EuEzvEI9mUR7jfTEPZRtgQSy0o7jLorzEDU5YHVNdtxVSejOLIhp/KceGPXEZJiN9uRdR ZeeaAShv50NWa7ioW0R7hy1QgZ1yh/tNCM6Ot3UqzzLIuNrv27D+FSDFgv7FDha3HmPhN 9ZwIFV/9bRwBIHR5AmrJSAisTQjcfWx8xJKEdjv7rUercGVr8ldMvskSHJMBGbb0veA== 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 F06AA1F000EB; Mon, 23 Nov 2026 20:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795465963; bh=6P272XRmtxVRxUwOCYKqdPoT8y/CgT8kIkZk04v3YWI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=mNi9GM5hyJs9lnuUF2uiubdVbfjOBxrAp3WFP47gtTBjX0shGksTkE9l2U24xH7IA +cdYhbgXghO2/mmrew1ZEbx51+nB3aJhtY9EXYt3qEJSiTA7McziVBh3t2CUH7QVHR o5LlzkzoZH2SppelWjEkuNnkN4xOSeorKKB7Y2LgUgnbxdNq6++TO6H/pswOnEwD04 nHieyVuEXYK8aN345fcXF7jMLyjn9B375tgY8NGQvIbo5jqfFEGzjAh2GHc0h97Zcq FJ5wbyqWGFR5r7TpJr6aGCvrEG51hofvfldSZX33FGTUCjbkhqeCCWwcHlcilmKSLE J6v3nUx7OJcKQ== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 799A24C6FB; Mon, 23 Nov 2026 20:32:17 +0000 (UTC) From: Fil Dunsky via B4 Relay Date: Mon, 23 Nov 2026 23:32:16 +0300 Subject: [PATCH v2 2/8] dt-bindings: soc: Describe CS7542 PCIe clocks and resets 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-b4-cs7542-pcie-v2-2-f589a9cd0bef@gmail.com> References: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> In-Reply-To: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> To: Manivannan Sadhasivam , Stephen Boyd , Vinod Koul Cc: Jingoo Han , Lorenzo Pieralisi , Krzysztof Wilczynski , Rob Herring , Bjorn Helgaas , Brian Masney , Jerome Brunet , Neil Armstrong , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795465935; l=3193; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=f8i2MUsoVg+zzyGMskQHqPaf9wJgR56JnWGThlimNzg=; b=DMG0WPKRoRxeDezktvzlUVonyL/6hwSDG2kJFWn3seAiKvsgWodsaxp7f0DPc7Rymn84o8WIF Pg28KF8cPe7D2TkrATMT7wBqddl/i2RrOVv/6qddpnMuBCUlh0VzPeR 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 The global register block already supplies the strap clocks. Extend that same provider with the three PCIe gate clocks and controller reset lines, rather than inventing a resource-less child to instantiate a driver. Keep the existing APB/CPU/AXI indices and add named PCIe clock and reset specifiers. The reset property is optional for clock-only descriptions. Signed-off-by: Fil Dunsky --- .../devicetree/bindings/soc/cortina/cortina,cs7542-syscon.yaml | 10 ++++++= ++-- include/dt-bindings/clock/cortina,cs7542-clock.h | 4 ++++ include/dt-bindings/reset/cortina,cs7542-reset.h | 9 ++++++= +++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-s= yscon.yaml b/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-s= yscon.yaml index fb074de87..dc7306868 100644 --- a/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.y= aml +++ b/Documentation/devicetree/bindings/soc/cortina/cortina,cs7542-syscon.y= aml @@ -12,8 +12,10 @@ maintainers: 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. + It provides the APB, CPU and AXI clock rates selected by the boot straps, + and the three PCIe clock gates and controller reset lines. + Clock specifiers are defined in dt-bindings/clock/cortina,cs7542-clock.h; + reset specifiers are defined in dt-bindings/reset/cortina,cs7542-reset.h. The pin controller uses the same register map through its parent syscon. =20 properties: @@ -29,6 +31,9 @@ properties: "#clock-cells": const: 1 =20 + "#reset-cells": + const: 1 + pinctrl: type: object $ref: /schemas/pinctrl/cortina,cs7542-pinctrl.yaml# @@ -46,4 +51,5 @@ examples: compatible =3D "cortina,cs7542-syscon", "syscon", "simple-mfd"; reg =3D <0xf0000000 0x100>; #clock-cells =3D <1>; + #reset-cells =3D <1>; }; diff --git a/include/dt-bindings/clock/cortina,cs7542-clock.h b/include/dt-= bindings/clock/cortina,cs7542-clock.h index 34d544238..c68c6ba20 100644 --- a/include/dt-bindings/clock/cortina,cs7542-clock.h +++ b/include/dt-bindings/clock/cortina,cs7542-clock.h @@ -6,4 +6,8 @@ #define CS7542_CLK_CPU 1 #define CS7542_CLK_AXI 2 =20 +#define CS7542_CLK_PCIE0 3 +#define CS7542_CLK_PCIE1 4 +#define CS7542_CLK_PCIE2 5 + #endif diff --git a/include/dt-bindings/reset/cortina,cs7542-reset.h b/include/dt-= bindings/reset/cortina,cs7542-reset.h new file mode 100644 index 000000000..bfd5799b2 --- /dev/null +++ b/include/dt-bindings/reset/cortina,cs7542-reset.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +#ifndef _DT_BINDINGS_RESET_CORTINA_CS7542_H +#define _DT_BINDINGS_RESET_CORTINA_CS7542_H + +#define CS7542_RESET_PCIE0 0 +#define CS7542_RESET_PCIE1 1 +#define CS7542_RESET_PCIE2 2 + +#endif --=20 2.53.0 From nobody Tue Nov 24 11:35:57 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=1795465961; b=ySue6Yjf8HE+tAPI44ZqDCDXGjVyQ8yYOgS7oEFckrjjvVF4+t3d5ArbGdca67eULg3t 5gwY6YNwrQhhPTKNAQDJ1sqz/ESLKkpNyaoLowwAxipctFr4blF40QdUkSPxxL5x4wNiN NhBryVaf2q6s/VoXuSqpSAQu2eqgGNX2XSt5dgdN2EnPaFAn4lpCovwAGzIQjqA2IYqrV a7uIBshsUysazYMycBSlbj2DJdmMX54QYoO3KAi1nrFfgcS2+5HKbnHu3fNVZwQyIMJVO bBDeypy0K1LRqWurtpMuuZI9Ks2Y+MJR9w8D2933ZBBNYBZHyPd9H/QWtX8G7haC4tg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795465961; 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=zvxd9dARkZhllOfsvOtfG9Epi2HmWipiIYRGTUsDCJw=; b=J/8zpKImX/pYjjhdH89YdfguHhV9dydqEBn3wl2z1Cqy4uTCgRVgtJwvi10jhMh1+0gI zas07NG1RoNiBgqlZ5hBoehPZi+jnJrU4gjjcJ90tORTlXXYjLDnqj1YkfV4hlIaTPVOX wSUftaaDbNBH/775GQbg9Q3Nr84UtXgTxVP+EuQaLVDxeuHMMGxZx5ksxZ3Y+KyUx3PTz 3jdmCleQAw0lxf13oE9xFzXfSfp8FmJghzpCcb+Dc9jd6Zv+kuTYcI5r/E3U5QISYxO1y 2PP61HqVDM7fQZGpidUfPwVG7RCDhAUW213EgIwCD3bTdNj5YQQMbNYFqlbVSXtc8gg== 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="TQnk4T/g"; 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 3B38A606A690; Mon, 23 Nov 2026 20:32:40 +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=TQnk4T/g 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=1795465960; b=q+/5PvYnFQe60dArcwUXOraV8MnXCMlNdaUTYGSxwQTs/mF/rRIQHq/mrwB+MOjPyWLv jtZr/pFnSPtPZUdODpUtXS65hA01syzYbI209HyeinrxjPBsD0hdOLsauBD9gQtPteVUW uc2J51TYJ2riYIJV3NMcdClpmzy/ueTNeSwKJdQDq/zBRI6/d+uF3g9Xv8JASPPPbs3le QJLvCGITHl+DBOBf18mdI/uVvuE1Xcu8FFJ5fZZCctVdglmi3o3BlGjOIhmEmFQLeBPYS iqjmDjHvRwHrNVzOrXh0CSEFG8y1cTgOSrsXGnSQA0R+Wg9ckrx7LdT85bHS86CSKKw== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1795465960; 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=zvxd9dARkZhllOfsvOtfG9Epi2HmWipiIYRGTUsDCJw=; b=MSVqzgCOfysHAy6HbLWS3xkZ+PjEq+pAQV4dA7N1ba4MFNmMKL/8wf+zeYRjruAm5k+A 49VVqcL1aZSVMx748PRhtNemfB8qLbgcrEXO9UNrZAJzYB735aYYJ8YmDKcFFOvmz3Ld4 EK27wQ8khaXeuDnD3HHxqVkRGDOPhZSpS0x4y0jJ/s9S9xw06hOj68pwcyok9aWzPXfi+ P3Y5bO2ZyjVW26aaRHA1Xc9ud/zaTVpky1aLCad9+YUpuRRIbiO7RJLLJyH7sEx2QE6Ts eCeAkUy1R74ljSkJ9RS/txzdjn1nGF2cv4ZxfJDK8MEU6D1PwSpgFlfclkMCXWK1Wow== 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 165561F000EF; Mon, 23 Nov 2026 20:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795465960; bh=zvxd9dARkZhllOfsvOtfG9Epi2HmWipiIYRGTUsDCJw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=TQnk4T/g2M/XspQOYlU6DS3sPuCQd8AjTew4bdpEjy+fPgb8xBTDTzjimHIwaPbhL xBd3mlI0v9LLnCtWh8WvfYA7IVfGGGm4OqBZEIgo3VCNOIruhCJGNhRpRFkruKh3tP /Uw4xBJTnzLCw4nUf7lLBH42pbOdkN9sxRBARoOMjnV219k9RPNz2BP1CK0+0DyOun KwAWzlABcK5KGSGirlEy3/YNghQ6ruoBCwNFZecOEhtOXpGYMTr6P2i6Unzkx0cX0Y VH+U73T83SqphRSGyzP26OcRLualACzOba/6qUzr8iHKIkxZZzmExhm9zcyN2Raa1f rF1DPkrNC8mWg== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 949AC4C706; Mon, 23 Nov 2026 20:32:17 +0000 (UTC) From: Fil Dunsky via B4 Relay Date: Mon, 23 Nov 2026 23:32:17 +0300 Subject: [PATCH v2 3/8] clk: cs7542: Add PCIe gates and resets to the global provider 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-b4-cs7542-pcie-v2-3-f589a9cd0bef@gmail.com> References: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> In-Reply-To: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> To: Manivannan Sadhasivam , Stephen Boyd , Vinod Koul Cc: Jingoo Han , Lorenzo Pieralisi , Krzysztof Wilczynski , Rob Herring , Bjorn Helgaas , Brian Masney , Jerome Brunet , Neil Armstrong , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795465935; l=8596; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=wxPmwU/hDwsNVP5PJfG+P4N3ss/7sNIINtDOJjhHa0o=; b=ZJTbQ/sULq7QjHr8zIbPK9QgGbx1VxtG9MD1hMnVjq5cTMZvYO9zSuS1nDiBuKu2UAQZuNRgD ZrzFvW22cJlA1L8EEBHEvjzyVtQg/5BPOYPWNFcaB2cTTIlt0u9xolY 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 the three PCIe gate clocks and controller resets from the global syscon node. Preserve the early strap clocks used by the ARM timers and the shared regmap updates that protect unrelated reset and gate bits. The driver is built in because APB is needed during timer discovery. The PCIe host and PHY consumers remain independently modular. Unwind all registered clocks and the reset provider on initialization failures. Signed-off-by: Fil Dunsky --- drivers/clk/Kconfig | 6 +- drivers/clk/clk-cs7542.c | 183 +++++++++++++++++++++++++++++++++++++++++--= ---- 2 files changed, 166 insertions(+), 23 deletions(-) diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 47b5265fe..4dcc60979 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -59,13 +59,15 @@ config LMK04832 Low-Noise JESD204B Compliant Clock Jitter Cleaner With Dual Loop PLLs =20 config COMMON_CLK_CS7542 - bool "Cortina Systems CS7542 strap-selected clocks" + bool "Cortina Systems CS7542 global clocks and resets" depends on OF && HAS_IOMEM select MFD_SYSCON + select RESET_CONTROLLER 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. + dividers. It also provides the three PCIe clock gates and resets. + It is built in because the APB clock is needed by timers. =20 config COMMON_CLK_APPLE_NCO tristate "Clock driver for Apple SoC NCOs" diff --git a/drivers/clk/clk-cs7542.c b/drivers/clk/clk-cs7542.c index 4e6c1e98a..e4bb1bb70 100644 --- a/drivers/clk/clk-cs7542.c +++ b/drivers/clk/clk-cs7542.c @@ -1,24 +1,28 @@ // SPDX-License-Identifier: GPL-2.0-only -/* Cortina Systems CS7542 strap-selected clocks */ +/* Cortina Systems CS7542 global clocks and PCIe resets. */ =20 #include #include +#include #include #include #include +#include #include #include #include +#include #include =20 #include =20 #define CS7542_GLOBAL_STRAP 0x0c #define CS7542_STRAP_SPEED GENMASK(3, 1) -#define CS7542_NUM_CLKS 3 +#define CS7542_NUM_FIXED_CLKS 3 +#define CS7542_NUM_CLKS 6 =20 /* Rates from the GPL vendor kernel's get_platform_clk(). */ -static const unsigned long cs7542_rates[][CS7542_NUM_CLKS] =3D { +static const unsigned long cs7542_rates[][CS7542_NUM_FIXED_CLKS] =3D { /* APB, CPU, AXI */ { 100000000, 400000000, 133333333 }, { 100000000, 600000000, 150000000 }, @@ -33,14 +37,115 @@ 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", + [CS7542_CLK_PCIE0] =3D "cs7542-pcie0", + [CS7542_CLK_PCIE1] =3D "cs7542-pcie1", + [CS7542_CLK_PCIE2] =3D "cs7542-pcie2", +}; + +#define CS7542_PORTS 3 +#define GLOBAL_RESET 0x04 +#define GLOBAL_CONFIG 0x10 + +struct cs7542_gate { + struct clk_hw hw; + struct regmap *map; + u32 mask; +}; + +struct cs7542_control { + struct reset_controller_dev rcdev; + struct regmap *map; + struct cs7542_gate gates[CS7542_PORTS]; + struct clk_hw_onecell_data *clks; +}; + +static int cs7542_gate_prepare(struct clk_hw *hw) +{ + struct cs7542_gate *gate =3D container_of(hw, struct cs7542_gate, hw); + + return regmap_update_bits(gate->map, GLOBAL_CONFIG, gate->mask, gate->mas= k); +} + +static void cs7542_gate_unprepare(struct clk_hw *hw) +{ + struct cs7542_gate *gate =3D container_of(hw, struct cs7542_gate, hw); + + regmap_update_bits(gate->map, GLOBAL_CONFIG, gate->mask, 0); +} + +static int cs7542_gate_is_prepared(struct clk_hw *hw) +{ + struct cs7542_gate *gate =3D container_of(hw, struct cs7542_gate, hw); + unsigned int value; + int ret; + + ret =3D regmap_read(gate->map, GLOBAL_CONFIG, &value); + return ret ? ret : !!(value & gate->mask); +} + +static const struct clk_ops cs7542_gate_ops =3D { + .prepare =3D cs7542_gate_prepare, + .unprepare =3D cs7542_gate_unprepare, + .is_prepared =3D cs7542_gate_is_prepared, +}; + +static int cs7542_reset_update(struct reset_controller_dev *rcdev, + unsigned long id, bool assert) +{ + struct cs7542_control *ctl =3D container_of(rcdev, struct cs7542_control,= rcdev); + u32 mask =3D BIT(6 + id); + + return regmap_update_bits(ctl->map, GLOBAL_RESET, mask, assert ? mask : 0= ); +} + +static int cs7542_reset_assert(struct reset_controller_dev *rcdev, unsigne= d long id) +{ + return cs7542_reset_update(rcdev, id, true); +} + +static int cs7542_reset_deassert(struct reset_controller_dev *rcdev, unsig= ned long id) +{ + return cs7542_reset_update(rcdev, id, false); +} + +static int cs7542_reset_status(struct reset_controller_dev *rcdev, unsigne= d long id) +{ + struct cs7542_control *ctl =3D container_of(rcdev, struct cs7542_control,= rcdev); + unsigned int value; + int ret; + + ret =3D regmap_read(ctl->map, GLOBAL_RESET, &value); + return ret ? ret : !!(value & BIT(6 + id)); +} + +static int cs7542_reset_pulse(struct reset_controller_dev *rcdev, unsigned= long id) +{ + int ret; + + ret =3D cs7542_reset_assert(rcdev, id); + if (ret) + return ret; + usleep_range(10000, 12000); + ret =3D cs7542_reset_deassert(rcdev, id); + if (ret) + return ret; + usleep_range(10000, 12000); + return 0; +} + +static const struct reset_control_ops cs7542_reset_ops =3D { + .assert =3D cs7542_reset_assert, + .deassert =3D cs7542_reset_deassert, + .status =3D cs7542_reset_status, + .reset =3D cs7542_reset_pulse, }; =20 static void __init cs7542_clk_init(struct device_node *np) { - struct clk_hw_onecell_data *data; + struct cs7542_control *ctl; struct regmap *map; unsigned int strap, speed; - int i, ret; + int i, j, ret; =20 map =3D syscon_node_to_regmap(np); if (IS_ERR(map)) { @@ -60,30 +165,66 @@ static void __init cs7542_clk_init(struct device_node = *np) return; } =20 - data =3D kzalloc_flex(*data, hws, CS7542_NUM_CLKS); - if (!data) + ctl =3D kzalloc(sizeof(*ctl), GFP_KERNEL); + if (!ctl) + return; + ctl->map =3D map; + ctl->clks =3D kzalloc_flex(*ctl->clks, hws, CS7542_NUM_CLKS); + if (!ctl->clks) { + kfree(ctl); 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; + } + ctl->clks->num =3D CS7542_NUM_CLKS; + + for (i =3D 0; i < CS7542_NUM_FIXED_CLKS; i++) { + ctl->clks->hws[i] =3D clk_hw_register_fixed_rate(NULL, + cs7542_clock_names[i], NULL, + 0, cs7542_rates[speed][i]); + if (IS_ERR(ctl->clks->hws[i])) { + ret =3D PTR_ERR(ctl->clks->hws[i]); + goto err_unregister_fixed; } } =20 - ret =3D of_clk_add_hw_provider(np, of_clk_hw_onecell_get, data); + for (j =3D 0; j < CS7542_PORTS; j++) { + struct cs7542_gate *gate =3D &ctl->gates[j]; + struct clk_init_data init =3D { + .name =3D cs7542_clock_names[CS7542_CLK_PCIE0 + j], + .ops =3D &cs7542_gate_ops, + }; + + /* Gate-only controls: no source frequency is assumed. */ + gate->map =3D map; + gate->mask =3D BIT(10 + 2 * j); + gate->hw.init =3D &init; + ret =3D clk_hw_register(NULL, &gate->hw); + if (ret) + goto err_unregister_gates; + ctl->clks->hws[CS7542_CLK_PCIE0 + j] =3D &gate->hw; + } + + ctl->rcdev.owner =3D THIS_MODULE; + ctl->rcdev.ops =3D &cs7542_reset_ops; + ctl->rcdev.of_node =3D np; + ctl->rcdev.nr_resets =3D CS7542_PORTS; + ret =3D reset_controller_register(&ctl->rcdev); + if (ret) + goto err_unregister_gates; + + ret =3D of_clk_add_hw_provider(np, of_clk_hw_onecell_get, ctl->clks); if (!ret) return; =20 -err_unregister: + reset_controller_unregister(&ctl->rcdev); +err_unregister_gates: + while (j--) + clk_hw_unregister(&ctl->gates[j].hw); +err_unregister_fixed: while (i--) - clk_hw_unregister_fixed_rate(data->hws[i]); - kfree(data); - pr_err("%pOF: cannot register clocks: %d\n", np, ret); + clk_hw_unregister_fixed_rate(ctl->clks->hws[i]); + kfree(ctl->clks); + kfree(ctl); + pr_err("%pOF: cannot register global controls: %d\n", np, ret); } =20 /* Timers need APB before platform devices, but the pinctrl child must pro= be. */ --=20 2.53.0 From nobody Tue Nov 24 11:35:57 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=1795465960; b=ADEmWRfdvf/qPPujo5M8lB5J8b+rJ5GuhgBKI+2c19EE5R2YaLSo8L5fDQqrtoDM4wp+ /a9z7hcbFZgT9kDKGeYmDkmA3GjjB3uX2N99lMBDJz272bFJuyEzghxRJ7Bg+GYgEe2Gx TNdTpVHfgivmvAatjhVSEopRUpUzwRRRagKUJ8GX9d6VjjV3uCLY3c93zid2VqbZxKx0P 8Q1HhTaPhDwzsy7a3Jm42eztvoAD83rNqgv4ApaSNbeNoOrlUJMlj5I+RlncFFcLckaJf ry5lRmv0uWUrd8kxE9Bb93vawpAayP0+GhUVtKznb5eazoZRBtjDSaoHrCkfC2Pnemg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795465960; 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=lSA+wX9NNEY3sTm7hObzBOSDNhatk2iNQOlIwAan+js=; b=0ItDSq5YonG+vr2BOVmnp4zMIA+uPXklkkSVe+DUn2zv0ZD/NkEKd+ivNXFBbYHTbXPO x03G8gFjDGp2m8aiQ7VHgOjp+GHKUwmA1VGhfynH0J4N4T/EzseCMD2HykoHAtOr1DFAg sWb479sU7uhXmCdU9BmIEJCWmvIneZvOG3kZ79tSBLUS8jFu2qfhSbByIDGA6RwYsO3vU PdjdAGO3pGH+kZmJAmV1nwe4dfkudMj5NhExCMQINm76DBRBHF+Xj6jJMUq5899bURaIs AW7jHL5NAWU5nPLLL0+dBPZC3OIFGNY8VQj8nqyXLNbaZpFgyojwefETOW04af6ZGTw== 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=QTV+OLqE; 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 F38AC606A33E; Mon, 23 Nov 2026 20:32:39 +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=QTV+OLqE 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=1795465959; b=x1XuYOcOsPPdpVxE8YCrOHBJamovsqznqOmaKR0PkGyyoefdXu5kkg5SPjpPlkQl85t1 w7Ri7Cpd2VOHduwTS9F2YNXANn71XGQOSaw3OjeWLgy5jRnLXXh+s2zSZ91+RbyltRYBY 65kpCkl92Y0iPTNLZLlt+F5VaOiJzh5P9Ny5tNx0dq6abcfOmFxv4/716Mq8E/YYA8Bby yXtOLxvd/n88k1t/LOR3C/0Gp/fEP2zDorcnY7IysMQsN0p6HlFy3p6363r1RGF/83stz eYoG2WSV1k2DPEaPABMbAfsnDzv6JP9pwP7qdydtYX0ZXekG/bPL3x7mIh/YXAW1Z5Q== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1795465959; 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=lSA+wX9NNEY3sTm7hObzBOSDNhatk2iNQOlIwAan+js=; b=17Y4UXSHWV7frmYT/v/Pe/UXZcol0dRbA8yfqCPRLy1lAvGJ1H41G+DPalFYZcVXn18r BD09XXP/YbY6GimG+jMRczrYloYSLSbTfy9OlwqauaGk88aIGl378d+4D3L1p7CWuJlLJ iXQ65adVPXV0LgYg354dtazVp94iwPDWhP1We0nenQcg35qhSA4VNkRQ7FasGixa9TsKk p2UwZx0MAJtzC2Hfepa6GhcH5mdViwBs7tF6vY93tev1SDQVLvkCwBDhoL0I4IgRKrpYp kAl9URld72AVAVfS9kDgNrG08Iq7j8XsTKj4B966KqcWhuu5fu0YtRVs8s0kvhgjh+A== 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 32B771F000D1; Mon, 23 Nov 2026 20:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795465959; bh=lSA+wX9NNEY3sTm7hObzBOSDNhatk2iNQOlIwAan+js=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=QTV+OLqEpMuSgJeTfvIE27E7FRr2wDGmlAhczjlfNK48DJ/Aissrs+qXqzcWCq2SM UqWoDnvLPM7L+HfF6jxeRcN+HwtoQFWDsP5URjP5DRxsyHVwgKvCwPays99umwTnpJ XvdCPMUEG/gCJFF5yh3qoun30rn9SX0axuA41HqLlu2yyF52sMAGPB8mVkL/gVNROa wffGEGrmMn2i6/G1hsUSSHAZiL+HuKyPsYK//Lj9ycLW5YnyPMfOS+c/oHXlOJc+ic K5OoJnJohhrneaNng9x9+phb3ibDCOqUWYeoVdbCi/2XSe2gIkK3463O5KnNdomZGz hd1DlMuA/74RA== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id B09C64C70A; Mon, 23 Nov 2026 20:32:17 +0000 (UTC) From: Fil Dunsky via B4 Relay Date: Mon, 23 Nov 2026 23:32:18 +0300 Subject: [PATCH v2 4/8] dt-bindings: phy: Describe CS7542 PCIe SerDes 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-b4-cs7542-pcie-v2-4-f589a9cd0bef@gmail.com> References: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> In-Reply-To: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> To: Manivannan Sadhasivam , Stephen Boyd , Vinod Koul Cc: Jingoo Han , Lorenzo Pieralisi , Krzysztof Wilczynski , Rob Herring , Bjorn Helgaas , Brian Masney , Jerome Brunet , Neil Armstrong , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795465935; l=2484; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=MyL1iV5O/zQ+yKb0w2UWGAKIr38mntIf4hXKW1lxhNg=; b=UXKv6FgpeRwIkYXwJFceJBFMvFDJqHn2ytGbIl4h2Wd1rCSHkXQDOUS12Q5Lx1HC8egNLGh1g c89qdqk9MSACOCZ+I3uYzMj8RQtRoYJuSPK3TCzQWILStTqZXKbmnjk 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 three Snow Bush lanes, their shared status bank, global reset controls and 24 MHz reference. PCIe is the only supported operating mode. Signed-off-by: Fil Dunsky --- .../bindings/phy/cortina,cs7542-pcie-phy.yaml | 67 ++++++++++++++++++= ++++ 1 file changed, 67 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/cortina,cs7542-pcie-phy.= yaml b/Documentation/devicetree/bindings/phy/cortina,cs7542-pcie-phy.yaml new file mode 100644 index 000000000..9ccde6e05 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/cortina,cs7542-pcie-phy.yaml @@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/cortina,cs7542-pcie-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cortina Systems CS7542 PCIe SerDes + +maintainers: + - Fil Dunsky + +description: | + Three Snow Bush SerDes lanes shared by PCIe and SATA. Only PCIe mode + with a 24 MHz reference is described. The PHY specifier is the lane + number, 0 through 2. The status resource contains the shared PHY + status registers, with a stride of 0x80 bytes per lane. + +properties: + compatible: + const: cortina,cs7542-pcie-phy + + reg: + items: + - description: Lane 0 programming registers + - description: Lane 1 programming registers + - description: Lane 2 programming registers + - description: Shared PHY status registers + + reg-names: + items: + - const: phy0 + - const: phy1 + - const: phy2 + - const: status + + clocks: + maxItems: 1 + description: 24 MHz SerDes reference clock + + cortina,global-syscon: + $ref: /schemas/types.yaml#/definitions/phandle + description: Global control syscon providing lane reset and mode selec= tion + + "#phy-cells": + const: 1 + +required: + - compatible + - reg + - reg-names + - clocks + - cortina,global-syscon + - "#phy-cells" + +additionalProperties: false + +examples: + - | + phy@f00a1000 { + compatible =3D "cortina,cs7542-pcie-phy"; + reg =3D <0xf00a1000 0x400>, <0xf00a5000 0x400>, + <0xf00a9000 0x400>, <0xf00a0e00 0x180>; + reg-names =3D "phy0", "phy1", "phy2", "status"; + clocks =3D <&ref24>; + cortina,global-syscon =3D <&global>; + #phy-cells =3D <1>; + }; --=20 2.53.0 From nobody Tue Nov 24 11:35:57 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=1795465968; b=ZD03VkBTLDYnue1S6lh+igrhvlgZDePreD8SIdccl1ml/qwKIxU3pGwJBMD33VB8R9p7 thJL30cxT9vFZnIEOMwstY0GpgFK7ovFIaHzYAC8XEO3BMBwfFWfLakzXso0X1zpWw/od eyKqdkr0q9wIObatEkQPAraV7KSD/LAp4TqUuhQAzp7LoM+TrK/nM0+f3x+n2r94n0TQe L9qK8ageEk0lVGqFh2OJ5bzgj7GXEfeiOkM7oEgNIDvWwBr/vsrr3bWXOx+tst+4aKy9z D2tDm7wvLXYSMLSJzTl7YP/Jy/dz4jAaEHOOZ+pwAF7HSKifVaCTJq0A5P6HV0GJVRQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795465968; 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=Zz6L92ZDSFMnlI2YQdsV7kK/kM96g1+mYDq69MPiFmU=; b=Xlhd9A646ph+BfFKVhd4beQdqyTnl4J52SOtBoW3/0M259AoLopcyS2NmMf2zo5HgfvC KQ0sttlox8T9b5bAtBJi12jdTB9N5d8oictI3aeCreTFRitzKcYGiVPP2nsjVgD6FcoP5 KjMSmSXQKvP4KNc5thmNeny9sHoS79bLyyGGIl34cdIuwsddGccu8kdsjLEnGvU1rzcL4 1lEjQfqpJLtcDR5d9rq66CiieExy4t3qKkaT2W5iYC1SgiK2LaIYdAV2LzCPG/j8VbmJh MTGnhbAnf0j3+XnSU7ES47f+kFlJ+nK3PdrhvG6EDKrkZ+F5KAB8YC+sjixIHkui5CA== 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=HaRtxg2+; 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 9E90D60A260A; Mon, 23 Nov 2026 20:32:48 +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=HaRtxg2+ 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=1795465968; b=qyxoT7WR06Xmz5AwJq/7M6WjYxdFo3zcWDfGw4uvVwLQFrrobBa0+CBUF8KVTr0Asfkf /YafirODe1oI5NCZ4rXcww35ofdrV8V8b+fazdblhmCmS0rl3+T/puPuM/za+4e1+9ph5 SxGv0k2UaqqDVivrseyaLwjot12CeKV5vEfcvWcivp/UinsztE3W0wix1u3ftJJgF3vmj Ihkq/6vKUCOUN/pS3h8g4j8zRwc3PtNPqjSphTJQsze+ZO/wzUvut2bzSXFwU+W0Ww24d ndUBzF2iyK5NGVjPMkj7y8d1ICmkDTr6frFkgoQGfEYI/ksLb77GjWu36uEOMjHpBFw== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1795465968; 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=Zz6L92ZDSFMnlI2YQdsV7kK/kM96g1+mYDq69MPiFmU=; b=D+dd9jcU19J+0tAynY+QpY05Y8VC6Xg2O0HhxpQgVYyWELA+/TmyewDpmt2Byzvv+CNR esw9F9F5UrDrOG1bM1SvrAG+dHqsWfAYa394sKr89C0t2PkKuBiH80khxJasR0GNuYmnN WArKMRoVLlZ6s6T8tDf30eNnE0ELOv/1VCTjAa31cECk4CsWV9JMXsjeSrrhibPHXp3wX gz5nGZj+MtROZZWEu6QzDg7aIDUGn5LToMz+0RyUAbBAmdgcVpv109PWlyNRq/CGceqMr tk1j8+FUngerLuKR6mc5zLMhs8T6G/Bawa+U3RXyGz9XGKdtlW0bBhx0zqdHQiSU1SQ== 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 1299F1F000ED; Mon, 23 Nov 2026 20:32:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795465968; bh=Zz6L92ZDSFMnlI2YQdsV7kK/kM96g1+mYDq69MPiFmU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=HaRtxg2+P/EL8rMR+2MUOMlzr/pT4NIlSF9DGaxGScIICK8lKQ6OBo7WF4DlSer8z 5DYbefu1jHy8MRS68EIoPFDctgawFu+Y2wRNRIkjukdy6bXPbbrVMbEuARf4Yxotqe gIk8HlHklYeh9Pshn6vaBHSPi740WlDDqzUkeY2hn4M4jvJjFBs1pMh4eZawCKuEad Q+UnKtSVmitJBPRbY7A+kDCg4shig6g56M3KGdVJLgW7ruGthk7A/r8MDE1sPPgG80 zAKSifi3lmWAe06pGXc0BMu6vZNPsKLQl1M5Lxs+lyOcDJEq5PudlAfEq1/6BVe2iA ojCCrZum2+Gqw== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id CC3D64C70E; Mon, 23 Nov 2026 20:32:17 +0000 (UTC) From: Fil Dunsky via B4 Relay Date: Mon, 23 Nov 2026 23:32:19 +0300 Subject: [PATCH v2 5/8] phy: Add CS7542 PCIe SerDes 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-b4-cs7542-pcie-v2-5-f589a9cd0bef@gmail.com> References: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> In-Reply-To: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> To: Manivannan Sadhasivam , Stephen Boyd , Vinod Koul Cc: Jingoo Han , Lorenzo Pieralisi , Krzysztof Wilczynski , Rob Herring , Bjorn Helgaas , Brian Masney , Jerome Brunet , Neil Armstrong , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795465935; l=9297; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=xbqhgVGjORFnQ5gPtfVS3sFJz4weZ5kVBK/LGnXuSak=; b=MUSxUum1MJLt+e2T6Y8GAHpAgGq1H1etG6XJ04YCQDH64a5vh8Z7F1aUXhahMXMbnu7Vb4MxP YFPFk3WpKAlBAWKsJ68EfQfhi8FhtDeIoZHrggR2GGSh3fpLwGV7kgE 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 Provide per-lane generic PHYs using the vendor 24 MHz programming table and revision-dependent value. Sequence power and reset through the shared global regmap and fail on CMU lock timeout with balanced power cleanup. Use the shared PHY status bank without overlapping PCIe wrapper resources. Signed-off-by: Fil Dunsky --- drivers/phy/Kconfig | 11 ++ drivers/phy/Makefile | 2 + drivers/phy/phy-cs7542-pcie.c | 232 ++++++++++++++++++++++++++++++++++++++= ++++ 3 files changed, 245 insertions(+) diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 105fbe408..77cff94fe 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -204,4 +204,15 @@ source "drivers/phy/tegra/Kconfig" source "drivers/phy/ti/Kconfig" source "drivers/phy/xilinx/Kconfig" =20 +config PHY_CS7542_PCIE + tristate "Cortina Systems CS7542 PCIe SerDes" + depends on OF && HAS_IOMEM && COMMON_CLK + select GENERIC_PHY + select MFD_SYSCON + help + Support the three CS7542 Snow Bush SerDes lanes in PCIe mode + with a 24 MHz reference clock. Lane resets share the global syscon. + SATA mode and other reference frequencies are not supported. + The module is called phy-cs7542-pcie. + endmenu diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index c6dd02003..54df29e74 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -55,3 +55,5 @@ obj-$(CONFIG_GENERIC_PHY) +=3D allwinner/ \ tegra/ \ ti/ \ xilinx/ + +obj-$(CONFIG_PHY_CS7542_PCIE) +=3D phy-cs7542-pcie.o diff --git a/drivers/phy/phy-cs7542-pcie.c b/drivers/phy/phy-cs7542-pcie.c new file mode 100644 index 000000000..d027baa93 --- /dev/null +++ b/drivers/phy/phy-cs7542-pcie.c @@ -0,0 +1,232 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* CS7542 Snow Bush SerDes, PCIe mode with a 24 MHz reference clock. */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GLOBAL_JTAG_ID 0x00 +#define GLOBAL_PHY_CONTROL 0x14 +#define PHY_REFCLK_MASK(p) (3U << ((p) * 2)) +#define PHY_REFCLK_24MHZ(p) (2U << ((p) * 2)) +#define PHY_PD(p) BIT(8 + (p)) +#define PHY_CMU_RESETN(p) BIT(16 + (p) * 4) +#define PHY_LN0_RESETN(p) BIT(17 + (p) * 4) +#define PHY_POR_N(p) BIT(19 + (p) * 4) +#define PHY_CMU_OK BIT(18) +#define PHY_STATUS_STRIDE 0x80 +#define SNOW_COM_REG0 0x00 +#define SNOW_REG0_CFG 0x00090006 +#define SNOW_REG0_AHB_RESETN BIT(0) +#define SNOW_REV_REG 96 +#define SNOW_REV_REG_A0 0x5e082e00 +#define SNOW_REV_REG_A1 0x5e080600 +#define SNOW_COM_LANE_REG0 0xc8 +#define SNOW_LANE_REG0_CFG 0x400290c0 +#define SNOW_LANE_REG0_MASTER_RESETN BIT(1) +#define CS7542_PORTS 3 + +struct cs7542_serdes; +struct cs7542_lane { + struct cs7542_serdes *serdes; + void __iomem *base; + struct phy *phy; + unsigned int id; +}; + +struct cs7542_serdes { + struct device *dev; + struct regmap *global; + void __iomem *status; + struct clk *ref; + struct cs7542_lane lanes[CS7542_PORTS]; + u32 revision_value; +}; + +struct snow_reg { + u16 off; + u32 val; +}; + +static const struct snow_reg snow_phy_24mhz[] =3D { + { 0, SNOW_REG0_CFG }, { 4, 0x000e0960 }, { 32, 0x68a00000 }, + { 44, 0x50040000 }, { 48, 0x40250270 }, { 52, 0x00004001 }, + { 100, 0xf0914200 }, { 104, 0x4c0c9048 }, { 108, 0x00000373 }, + { 124, 0x04841000 }, { 128, 0x000000e0 }, { 132, 0x04000023 }, + { 136, 0x68001038 }, { 140, 0x0d181ea2 }, { 144, 0x0000000c }, + { 196, 0x0f600000 }, { 200, SNOW_LANE_REG0_CFG }, { 204, 0x0000003c }, + { 208, 0xc68b8300 }, { 212, 0x98280301 }, { 216, 0xe1782819 }, + { 220, 0x00f410f0 }, { 232, 0xa0a0a000 }, { 236, 0xa0a0a0a0 }, + { 240, 0x9fc00068 }, { 244, 0x00000001 }, { 248, 0x00000000 }, + { 252, 0xd07e4130 }, { 256, 0x935285cc }, { 260, 0xb0dd49e0 }, + { 264, 0x0000020b }, { 300, 0xd8000000 }, { 304, 0x0001ff1a }, + { 308, 0xf0000000 }, { 312, 0xffffffff }, { 316, 0x3fc3c21c }, + { 320, 0x0000000a }, { 324, 0x00f80000 }, +}; + +static int cs7542_phy_power_off(struct phy *phy) +{ + struct cs7542_lane *lane =3D phy_get_drvdata(phy); + unsigned int p =3D lane->id; + u32 mask =3D PHY_PD(p) | PHY_CMU_RESETN(p) | PHY_LN0_RESETN(p) | PHY_POR_= N(p); + int ret; + + ret =3D regmap_update_bits(lane->serdes->global, GLOBAL_PHY_CONTROL, mask= , PHY_PD(p)); + clk_disable_unprepare(lane->serdes->ref); + return ret; +} + +static int cs7542_phy_power_on(struct phy *phy) +{ + struct cs7542_lane *lane =3D phy_get_drvdata(phy); + struct cs7542_serdes *sd =3D lane->serdes; + unsigned int p =3D lane->id; + u32 mask, value; + int ret, i; + + ret =3D clk_prepare_enable(sd->ref); + if (ret) + return ret; + mask =3D PHY_PD(p) | PHY_CMU_RESETN(p) | PHY_LN0_RESETN(p) | PHY_POR_N(p)= | + PHY_REFCLK_MASK(p); + ret =3D regmap_update_bits(sd->global, GLOBAL_PHY_CONTROL, mask, + PHY_PD(p) | PHY_REFCLK_24MHZ(p)); + if (ret) + goto power_off; + msleep(100); + ret =3D regmap_update_bits(sd->global, GLOBAL_PHY_CONTROL, PHY_PD(p) | PH= Y_POR_N(p), + PHY_POR_N(p)); + if (ret) + goto power_off; + usleep_range(10, 20); + for (i =3D 0; i < ARRAY_SIZE(snow_phy_24mhz); i++) { + if (snow_phy_24mhz[i].off =3D=3D SNOW_REV_REG + 4) + writel(sd->revision_value, lane->base + SNOW_REV_REG); + writel(snow_phy_24mhz[i].val, lane->base + snow_phy_24mhz[i].off); + } + writel(SNOW_REG0_CFG | SNOW_REG0_AHB_RESETN, lane->base + SNOW_COM_REG0); + ret =3D regmap_update_bits(sd->global, GLOBAL_PHY_CONTROL, PHY_CMU_RESETN= (p), + PHY_CMU_RESETN(p)); + if (ret) + goto power_off; + ret =3D readl_poll_timeout(sd->status + p * PHY_STATUS_STRIDE, value, + value & PHY_CMU_OK, 100, 100000); + if (ret) { + dev_err(sd->dev, "lane %u CMU did not lock\n", p); + goto power_off; + } + writel(SNOW_LANE_REG0_CFG | SNOW_LANE_REG0_MASTER_RESETN, + lane->base + SNOW_COM_LANE_REG0); + ret =3D regmap_update_bits(sd->global, GLOBAL_PHY_CONTROL, PHY_LN0_RESETN= (p), + PHY_LN0_RESETN(p)); + if (ret) + goto power_off; + msleep(100); + return 0; + +power_off: + cs7542_phy_power_off(phy); + return ret; +} + +static int cs7542_phy_set_mode(struct phy *phy, enum phy_mode mode, int su= bmode) +{ + return mode =3D=3D PHY_MODE_PCIE && !submode ? 0 : -EINVAL; +} + +static const struct phy_ops cs7542_phy_ops =3D { + .power_on =3D cs7542_phy_power_on, + .power_off =3D cs7542_phy_power_off, + .set_mode =3D cs7542_phy_set_mode, + .owner =3D THIS_MODULE, +}; + +static struct phy *cs7542_phy_xlate(struct device *dev, const struct of_ph= andle_args *args) +{ + struct cs7542_serdes *sd =3D dev_get_drvdata(dev); + + if (args->args_count !=3D 1 || args->args[0] >=3D CS7542_PORTS) + return ERR_PTR(-EINVAL); + return sd->lanes[args->args[0]].phy; +} + +static int cs7542_phy_probe(struct platform_device *pdev) +{ + struct device *dev =3D &pdev->dev; + struct phy_provider *provider; + struct cs7542_serdes *sd; + unsigned int id; + int ret, i; + + sd =3D devm_kzalloc(dev, sizeof(*sd), GFP_KERNEL); + if (!sd) + return -ENOMEM; + sd->dev =3D dev; + sd->global =3D syscon_regmap_lookup_by_phandle(dev->of_node, "cortina,glo= bal-syscon"); + if (IS_ERR(sd->global)) + return dev_err_probe(dev, PTR_ERR(sd->global), "global register map\n"); + sd->ref =3D devm_clk_get(dev, NULL); + if (IS_ERR(sd->ref)) + return dev_err_probe(dev, PTR_ERR(sd->ref), "reference clock\n"); + if (clk_get_rate(sd->ref) !=3D 24000000) + return dev_err_probe(dev, -EINVAL, "only 24 MHz reference supported\n"); + ret =3D regmap_read(sd->global, GLOBAL_JTAG_ID, &id); + if (ret) + return ret; + switch (FIELD_GET(GENMASK(15, 12), id)) { + case 0: + case 1: + sd->revision_value =3D SNOW_REV_REG_A0; + break; + case 8: + case 9: + sd->revision_value =3D SNOW_REV_REG_A1; + break; + default: + return dev_err_probe(dev, -ENODEV, "unsupported silicon revision %#x\n",= id); + } + sd->status =3D devm_platform_ioremap_resource(pdev, CS7542_PORTS); + if (IS_ERR(sd->status)) + return PTR_ERR(sd->status); + for (i =3D 0; i < CS7542_PORTS; i++) { + struct cs7542_lane *lane =3D &sd->lanes[i]; + + lane->id =3D i; + lane->serdes =3D sd; + lane->base =3D devm_platform_ioremap_resource(pdev, i); + if (IS_ERR(lane->base)) + return PTR_ERR(lane->base); + lane->phy =3D devm_phy_create(dev, NULL, &cs7542_phy_ops); + if (IS_ERR(lane->phy)) + return PTR_ERR(lane->phy); + phy_set_drvdata(lane->phy, lane); + } + platform_set_drvdata(pdev, sd); + provider =3D devm_of_phy_provider_register(dev, cs7542_phy_xlate); + return PTR_ERR_OR_ZERO(provider); +} + +static const struct of_device_id cs7542_phy_match[] =3D { + { .compatible =3D "cortina,cs7542-pcie-phy" }, + { } +}; +MODULE_DEVICE_TABLE(of, cs7542_phy_match); + +static struct platform_driver cs7542_phy_driver =3D { + .probe =3D cs7542_phy_probe, + .driver =3D { + .name =3D "cs7542-pcie-phy", + .of_match_table =3D cs7542_phy_match, + }, +}; +module_platform_driver(cs7542_phy_driver); + +MODULE_DESCRIPTION("Cortina Systems CS7542 PCIe SerDes"); +MODULE_LICENSE("GPL"); --=20 2.53.0 From nobody Tue Nov 24 11:35:57 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=1795465970; b=3Bg/n6ACV7coiYZlOtVe+XoQ+PMlF89gGGw6ZnAEZIQNzkFNMFYG3U0pnHzooSzAxNPx s0Qz5RIh8Eujp8YEzXnT+UWO2ahTOhqxEd+AI/NGTR+fFX7dC+V5313AHADGS3yaFZbT7 i3VfI7PiHQnw10eQrJSI4cfiNY5o/yX4gnNM7OlKFyVR0cqOFMxBuB/I8D+WtpEZok1QV 2nyqpIC+R4HUk2a3zwJHepStNAvnA7F40d1xCSr/LEEuvVRVlOqm7UTvZezXJE4BME/dN nzd9Kgdm6uywfPtZcFbOI8wMu6DTuOVRRlVxJyaeevGz7IiCRpD23u9ffNtr3pAeAPQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795465970; 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=zOUM8yzNNyOUEeQgBWPO0qM5NW4wCU809J1juOxgETg=; b=EI8jMEPvt+RaNpcr0jlha4BzvBvduk/T6VKMcCDwcrM0wZPkNlxe8spfZAC2VLfdFXs/ j7yGbKGvdSeBfDRQeeNwkWyHU+m8XW/CauoIebfGjDQMPMbz3TEExOz0a0Xt3Bleqgvsb CAX+T7blXOKpGZ2m/aEvYKMXzPPCBSJsUX0HiWKHXtn47E1EYl4QOWI/we/80XpFtbBhA pXJlIE22ZY8wUDbEusps5F/q+6LpwgkBfAMHeSHJOU+0yDgh62sWbVD2clFcqknAf3oMN tNvudqW20ZJ+q8jkgoqr4/pujL7aSHVca+zyscmw9joFY0ygmywmPAZFHo8/aXxOz0w== 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=ctTObiM2; 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 4A7F360A2623; Mon, 23 Nov 2026 20:32:50 +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=ctTObiM2 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=1795465969; b=Yu4PZaw3R0HGC6/ovGOWTiAlEVoNkikdh2Br/a+ktj9jPfieJ7sQu81YM7MrOgQeoj51 n9J38l2oI/KQ9ttza+fJzx+e8kgjUWz5bcg9zJu5uhDrCBJGKcpXTiePDpePak98mwxtR KM3IQTW7jMgsAlf0khujRR1GjH+F+ZvUcFdaoTOXik3tbtiJdDdOMeQoIMc/aojePHvTZ a/IuB7aMiDZKA8zyPz5JmCoSG6Gj2Xq1+IFBtjECOzM7ARiSJVjq51PB+uYOjEj81p1Xj bJJLuZ7BCLhMqKsiLVpOlh2HbzuYSbyHVHxkO7zccFfES0fiK4LawQzvx0Pk24ZERXQ== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1795465969; 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=zOUM8yzNNyOUEeQgBWPO0qM5NW4wCU809J1juOxgETg=; b=GKTpKKNYeKHDlAytc/O3mt5KSwKyjp2D4RYmCMGanFGrCuqoiMjreRbJRh0Jni7tP/oG PFMKagnyIgaNygA77GRQU4LGPijtvHwYZ2PcaTJ+H4V7rwfmLr7QB7HZDBfTDU0VCqDV/ 0cqTv/rcTNkiJtfZMxW/UpKhjBGm8qAZFRrIEfaPEZAqWoPCLmGaijSLWe0Xwci+EHwnz YPdRJtYdMt6niROzjxEYZQkgALRLWkdMYqSnRAmuq81HOMc084Yx4PYmwxFhq0Ube+dtR P7ZSmpii2JJSAAyDRVXBCM8GfhTX5JW4yhHOPmvDrCVBUOFHp/wvM4XedHN/By78cVg== 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 153071F000EE; Mon, 23 Nov 2026 20:32:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795465969; bh=zOUM8yzNNyOUEeQgBWPO0qM5NW4wCU809J1juOxgETg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=ctTObiM26CLGx9z4GIs+EsIU/8zjOZw2kQ2yQrCWg8C2PJTTwXCN4loK7th3+hAsw Zj8Zv75FMqXZnQAnsgivOQ+0cXWSjexy6jOsPwGHIYSeh0mne7DNx9UgqOVA7nZY55 YqQdsg3b6MA7HKcqcAU9yUQ8skEoJ8bzO8GzlDlaKDMncQ8HyV92liQOfCv7UCfUNE uiK7SAKVltCqQcx5A/9FilZYGC+QB5Z80IT6CyAAy2XU8trCo3Hlly324c2nmiH1qh pBjUWtLLR8gb0vnUHCTohOC+0KoYU+m0vTs6FtmGJOXf+PbcBirRS+EWD1Dz2QApuU Q2KlTBIf1975g== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id E8A8A4C712; Mon, 23 Nov 2026 20:32:17 +0000 (UTC) From: Fil Dunsky via B4 Relay Date: Mon, 23 Nov 2026 23:32:20 +0300 Subject: [PATCH v2 6/8] dt-bindings: PCI: Describe the CS7542 host controller 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-b4-cs7542-pcie-v2-6-f589a9cd0bef@gmail.com> References: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> In-Reply-To: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> To: Manivannan Sadhasivam , Stephen Boyd , Vinod Koul Cc: Jingoo Han , Lorenzo Pieralisi , Krzysztof Wilczynski , Rob Herring , Bjorn Helgaas , Brian Masney , Jerome Brunet , Neil Armstrong , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795465935; l=3988; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=Vmod6N4o3vqaSh1IK8EbHrW7VX/NgdSVfaTIztFcUoM=; b=Xivi4LcanyE1E17n8Vs4I3xi+sg0eaz6nTCzeXOlirKlXuA52hN7XWQrVsbCl3vq/6z28ZXkD ZYtHAFzN4mWCk2smkJYmOrUSKWJ8qKLTVsCQO9YD6ePkNrMDAf7CBTf 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 DesignWare host wrapper, clock/reset/PHY consumers, combined interrupt and INTx domain. Document the root configuration access limit. Signed-off-by: Fil Dunsky --- .../bindings/pci/cortina,cs7542-pcie.yaml | 129 +++++++++++++++++= ++++ 1 file changed, 129 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/cortina,cs7542-pcie.yaml= b/Documentation/devicetree/bindings/pci/cortina,cs7542-pcie.yaml new file mode 100644 index 000000000..c8ef5176d --- /dev/null +++ b/Documentation/devicetree/bindings/pci/cortina,cs7542-pcie.yaml @@ -0,0 +1,129 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/cortina,cs7542-pcie.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cortina Systems CS7542 PCIe host controller + +maintainers: + - Fil Dunsky + +description: | + DesignWare host with a Cortina application wrapper. A single interrupt + multiplexes four INTx lines, the internal MSI receiver and link errors. + Root-port configuration is accessible only below offset 0x200; the + DesignWare private register bank starts at offset 0x700. + +allOf: + - $ref: /schemas/pci/snps,dw-pcie.yaml# + +properties: + compatible: + const: cortina,cs7542-pcie + + reg: + items: + - description: DBI registers including the viewport iATU + - description: Downstream configuration window + - description: Application wrapper registers + + reg-names: + items: + - const: dbi + - const: config + - const: app + + clocks: + maxItems: 1 + + interrupts: + maxItems: 1 + + interrupt-names: + const: msi + + resets: + maxItems: 1 + + phys: + maxItems: 1 + + phy-names: + const: pcie + + num-lanes: + const: 1 + + reset-gpios: + maxItems: 1 + description: Optional active-low endpoint PERST# + + interrupt-controller: + type: object + additionalProperties: false + properties: + "#address-cells": + const: 0 + "#interrupt-cells": + const: 1 + interrupt-controller: true + required: + - "#address-cells" + - "#interrupt-cells" + - interrupt-controller + +required: + - compatible + - reg + - reg-names + - clocks + - interrupts + - interrupt-names + - resets + - phys + - phy-names + - num-lanes + - interrupt-controller + - interrupt-map + - interrupt-map-mask + +unevaluatedProperties: false + +examples: + - | + #include + #include + #include + + pcie@80000000 { + compatible =3D "cortina,cs7542-pcie"; + reg =3D <0x80000000 0x1000>, <0x80001000 0x1000>, + <0xf00a0000 0x100>; + reg-names =3D "dbi", "config", "app"; + #address-cells =3D <3>; + #size-cells =3D <2>; + device_type =3D "pci"; + bus-range =3D <0 0xff>; + num-lanes =3D <1>; + ranges =3D <0x82000000 0 0x80200000 0x80200000 0 0x1fe00000>; + clocks =3D <&global CS7542_CLK_PCIE0>; + interrupt-parent =3D <&gic>; + interrupts =3D ; + interrupt-names =3D "msi"; + resets =3D <&global CS7542_RESET_PCIE0>; + phys =3D <&serdes 0>; + phy-names =3D "pcie"; + #interrupt-cells =3D <1>; + interrupt-map-mask =3D <0 0 0 7>; + interrupt-map =3D <0 0 0 1 &pcie_intc 1>, + <0 0 0 2 &pcie_intc 2>, + <0 0 0 3 &pcie_intc 3>, + <0 0 0 4 &pcie_intc 4>; + + pcie_intc: interrupt-controller { + #address-cells =3D <0>; + #interrupt-cells =3D <1>; + interrupt-controller; + }; + }; --=20 2.53.0 From nobody Tue Nov 24 11:35:57 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=1795465967; b=ZED9V8/5/O0MUoKkovH5nOHz8idB8WMFrKMRik4N4RgjieHXCJQqtAjQJM9KHZ9F4Qfy FpAKAppqFbuwGf44kFk7XnUlEoCOYkmNvIPbXlQCXttquunRnJpOgo3NUBnA64Bt6hjyT xu5PT0LX86iZvwPED51zCRUBipA6iStOcr6gIuT0ayDhPns/OUy7tRN6SZ6/2gvVQeosH JYBZ9LLjDhI8Vg6+LXe3MA3cCeAU7R/2OXIIxTXdxJnXDOjnbCGvepSwgmMsD43II9zEH QekcsVyggFcqkdqpU8r7VrJXopQUi+6dZyjnznkCE0D2abBuZORbuwHap3A/lsbua+A== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795465967; 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=TTLncUG7iLwGPnOHBKwYjybEFaBsLi1iU63YH7pv0Fo=; b=IHODRep3EVEI23F4tzoOuRqqeX1gHA90M10LG7uOsLNpWNkli0TZ52wtTQuf1NmfH/uC SKySFQNlPXTA3hY9V+R2v0SPtcre3VIk+7aTDzcIQao581Zd4/bmUEevE+A+bCT2efWZN 7Ta+Gp5GT+8ES4v/VYUAvDglO7AXG08na0ggNcrXN6J4nKYuo2eOpfjWMibN7m4nrnb8/ 2tdA1LwRqeOycAcuCcvvyzNDafW2g+iXAx8Mm90aHQHLBGhr+Ubk2qCBPz/4Wsk8Z0OMD JyTD3/dUm13UHuziqDEQt+5rRvtSYEpTRjVMKR17V/U/IoZhpgZB7B3ElptnWtoLYUA== 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=j+o0yEmG; 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 ADA79606A68E; Mon, 23 Nov 2026 20:32:47 +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=j+o0yEmG 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=1795465967; b=IEh7mixk+EBLCkjGbLpYvQv5IMs31uEPeDGoKRmWC/IPHkc1HwMjapa5wqnxhlYY250N McLZwtIiMHc3Tgsn3oJNSyqnhVNzo1xkAyUEKD74ee3FMFjY+ym/XTMiO8x69VM3RebfT HdQOOXFxmjKFE9hLJCF9ia2ljVoaPrcm/728yeQcAlsjbVqEAVKm+bAbF3Vph6Qysl35Q ia6Sy2SPJXXjPanwaYBb8PnwUIubbIH1XTtB/x32FQc2YGGzvSbArL5e5WIzJFz0j0M1z X9X5zwU+9bH48HVnXf+mDEuMoi+9vwB8F8SJKbQKxN3vBeYsNjPsg7LaVsOlZXQd4xA== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1795465967; 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=TTLncUG7iLwGPnOHBKwYjybEFaBsLi1iU63YH7pv0Fo=; b=ryg7GmvNFXSkYWRTI9NLPgPHJUrOU6LUIyJ1jilnn1Kfk1pPqUsVLXnQeEgsDH1ZwB8X 3/pO2aaeyx9/zIM4UPsX4xGdn/0WNsBKQr2l7s8RGp+3E0vIHP5NJoACrJseG64xFz4Lx diy+poCb/KfbcIMzsSRaF9wqh7f8BVhtCcHdEI4ra6cJ43ddb0FjBtiYNJHIfeJxZyzfi 08BBodcEZViXIPrYRgwAYsvTUlgFTX/6j+ZyUXk6UY0SoPHQz8NXnSF7oN4l6ux+TFRYj yq2lH6lVWeU8CrxWx/ai2QGMSDc8KymofTkYn5sgWii+omnx6HkiQ5sgsddyNyS9tmQ== 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 1A2721F000C0; Mon, 23 Nov 2026 20:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795465967; bh=TTLncUG7iLwGPnOHBKwYjybEFaBsLi1iU63YH7pv0Fo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=j+o0yEmGTyqirm8cCrEknCqGoLqOzSlYpNgLYcyYuQ7QNzleBE9VagDvoFhuAyLQn 31XTUGmR99arzXwU0Tgql5tkO6KuL+LCoP1fwjp6kKhQhHBzAgPEEzw4GJuXZvMPia MG8gjJuNjfuMHJNJ6HogRYiX9ER2n24uEsG0oihvQo1O1BxWJP2O5xA0Tvttt/Y8kg p7o1J0mE+/EfNOiKu2M4LGFXOxhd/SCnlJ/crRh68gZOKnAlbLIh/6Kaq9r1y8k8/r IzMYp6cYM/gUI/PA5Ed86V52JbRac7mruco5/JoobvNHKnfkuNNH1x/Uhrhi//notc DA045VspBW1Wg== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 18B8A4C716; Mon, 23 Nov 2026 20:32:18 +0000 (UTC) From: Fil Dunsky via B4 Relay Date: Mon, 23 Nov 2026 23:32:21 +0300 Subject: [PATCH v2 7/8] PCI: cs7542: Add CS7542 PCIe host 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-b4-cs7542-pcie-v2-7-f589a9cd0bef@gmail.com> References: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> In-Reply-To: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> To: Manivannan Sadhasivam , Stephen Boyd , Vinod Koul Cc: Jingoo Han , Lorenzo Pieralisi , Krzysztof Wilczynski , Rob Herring , Bjorn Helgaas , Brian Masney , Jerome Brunet , Neil Armstrong , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795465935; l=19798; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=4tnkY8D2cQa5y4SVCgW9HZoSXE2lPJ9+rP8fC5MXPik=; b=/Ry2Kg78NNvNTVQ8iEIQxlnsoKYPdZrtT1d8YRpZ1ox0Z/sDjSywhM1cabdIi1yB0dtTwjO2F 977/LgbHhmsAeloMgWOyfJ/9ae5lMbotz/QwvttQzYPcKCWEXFZu9FK 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 Add DesignWare host glue consuming separate clock, reset and PHY providers. Use live link status and stop previous training before enumeration. Finish endpoint teardown before draining the shared IRQ and freeing MSI domains. Dispatch enabled INTx/MSI sources through one application interrupt and use its MSI target window. Prevent root configuration accesses at and above 0x200, including direct DesignWare DBI reads, while preserving the private CSR bank and separate iATU callback base. Unwind power and IRQ domains on failure and removal. Read live link/LTSSM state through the application wrapper. After link loss, block configuration and DBI accesses until controller reset and reprobe. Signed-off-by: Fil Dunsky --- drivers/pci/controller/dwc/Kconfig | 12 + drivers/pci/controller/dwc/Makefile | 2 + drivers/pci/controller/dwc/pcie-cs7542.c | 551 +++++++++++++++++++++++++++= ++++ 3 files changed, 565 insertions(+) diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controller/dw= c/Kconfig index 0a0d56fcf..2ebaa8db1 100644 --- a/drivers/pci/controller/dwc/Kconfig +++ b/drivers/pci/controller/dwc/Kconfig @@ -577,4 +577,16 @@ config PCIE_ULTRARISC By default, this symbol is enabled when ARCH_ULTRARISC is active, requiring no further configuration on that platform. =20 +config PCIE_CS7542 + tristate "Cortina Systems CS7542 PCIe controller" + depends on OF && HAS_IOMEM && PCI_MSI && COMMON_CLK + select PCIE_DW_HOST + select GENERIC_PHY + select RESET_CONTROLLER + help + Enable the DesignWare PCIe host controllers on Cortina CS7542. + The global clock/reset provider and a generic PHY are required. + The application interrupt handles both legacy INTx and MSI. + The module is called pcie-cs7542. + endmenu diff --git a/drivers/pci/controller/dwc/Makefile b/drivers/pci/controller/d= wc/Makefile index d4f88cfc6..4a6ae9037 100644 --- a/drivers/pci/controller/dwc/Makefile +++ b/drivers/pci/controller/dwc/Makefile @@ -61,3 +61,5 @@ obj-$(CONFIG_ARM64) +=3D pcie-hisi.o obj-$(CONFIG_ARM64) +=3D pcie-tegra194-acpi.o endif endif + +obj-$(CONFIG_PCIE_CS7542) +=3D pcie-cs7542.o diff --git a/drivers/pci/controller/dwc/pcie-cs7542.c b/drivers/pci/control= ler/dwc/pcie-cs7542.c new file mode 100644 index 000000000..5487e667d --- /dev/null +++ b/drivers/pci/controller/dwc/pcie-cs7542.c @@ -0,0 +1,551 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pcie-designware.h" + +#define APP_INT_STATUS 0x00 +#define APP_INT_ENABLE 0x04 +#define APP_CORE_CONFIG 0x1c +#define APP_PM_STATUS 0x20 +#define APP_LINK_ACTIVE BIT(18) +#define APP_LTSSM_STATE GENMASK(9, 4) +#define APP_CFG_START 0x80 +#define APP_CFG_END 0x84 + +#define INT_INTX_ASSERT(x) BIT((x) * 2) +#define INT_INTX_ASSERT_MASK (BIT(0) | BIT(2) | BIT(4) | BIT(6)) +#define INT_MSI BIT(8) +#define INT_LINK_UP BIT(9) +#define INT_RADM_NONFATAL_ERR BIT(12) +#define INT_RADM_FATAL_ERR BIT(13) +#define INT_GM_COMPOSER_ERR BIT(16) +#define INT_RADMX_COMPOSER_ERR BIT(17) +#define INT_ELASTIC_OVF BIT(18) +#define INT_ELASTIC_UNF BIT(19) +#define INT_LINK_DOWN BIT(22) +#define INT_ERR_MASK (INT_RADM_NONFATAL_ERR | INT_RADM_FATAL_ERR | \ + INT_GM_COMPOSER_ERR | INT_RADMX_COMPOSER_ERR | \ + INT_ELASTIC_OVF | INT_ELASTIC_UNF | INT_LINK_DOWN) + +#define CORE_CFG_LTSSM_EN BIT(0) +#define CORE_CFG_AXI_UR_MASK BIT(5) + +#define APP_PORT_STRIDE 0x400 +#define APP_PHYS_BASE 0xF00A0000 +#define APP_CFG_WINDOW_LEN 0x1000 +#define APP_MSI_TARGET 0xC0 +#define RC_CFG_LIMIT 0x200 + +struct cortina_pcie { + struct dw_pcie pci; + void __iomem *app; + struct clk *clk; + struct phy *phy; + struct reset_control *reset; + struct gpio_desc *perst; + int irq; + bool msi_ready; + bool link_lost; + struct irq_domain *intx_domain; + raw_spinlock_t lock; + resource_size_t dbi_phys; + resource_size_t app_phys; + int port; +}; + +#define to_cortina_pcie(x) container_of((x), struct cortina_pcie, pci) + +static int cortina_pcie_port_init(struct cortina_pcie *cp) +{ + u32 value; + int ret; + + writel(cp->dbi_phys, cp->app + APP_CFG_START); + writel(cp->dbi_phys + APP_CFG_WINDOW_LEN - 1, cp->app + APP_CFG_END); + ret =3D readl_poll_timeout(cp->app + APP_CFG_END, value, + value =3D=3D cp->dbi_phys + APP_CFG_WINDOW_LEN - 1, 10, 10000); + if (ret) + return ret; + writel(0, cp->app + APP_INT_ENABLE); + writel(readl(cp->app + APP_INT_STATUS), cp->app + APP_INT_STATUS); + return 0; +} + +/* APP remains accessible after link loss, unlike the DBI port debug bank.= */ +static bool cortina_pcie_link_up(struct dw_pcie *pci) +{ + struct cortina_pcie *cp =3D to_cortina_pcie(pci); + + return !READ_ONCE(cp->link_lost) && + !!(readl(cp->app + APP_PM_STATUS) & APP_LINK_ACTIVE); +} + +static enum dw_pcie_ltssm cortina_pcie_get_ltssm(struct dw_pcie *pci) +{ + struct cortina_pcie *cp =3D to_cortina_pcie(pci); + + return FIELD_GET(APP_LTSSM_STATE, readl(cp->app + APP_PM_STATUS)); +} + +static int cortina_pcie_start_link(struct dw_pcie *pci) +{ + struct cortina_pcie *cp =3D to_cortina_pcie(pci); + u32 v; + + v =3D readl(cp->app + APP_CORE_CONFIG); + v |=3D CORE_CFG_LTSSM_EN | CORE_CFG_AXI_UR_MASK; + writel(v, cp->app + APP_CORE_CONFIG); + return 0; +} + +static void cortina_pcie_stop_link(struct dw_pcie *pci) +{ + struct cortina_pcie *cp =3D to_cortina_pcie(pci); + u32 value =3D readl(cp->app + APP_CORE_CONFIG); + + writel(value & ~CORE_CFG_LTSSM_EN, cp->app + APP_CORE_CONFIG); +} + +static void cortina_pcie_irq_handler(struct irq_desc *desc) +{ + struct cortina_pcie *cp =3D irq_desc_get_handler_data(desc); + struct irq_chip *chip =3D irq_desc_get_chip(desc); + u32 status, clear; + int i; + + chained_irq_enter(chip, desc); + + status =3D readl(cp->app + APP_INT_STATUS); + status &=3D readl(cp->app + APP_INT_ENABLE); + clear =3D status & ~INT_LINK_UP; + if (status & INT_LINK_DOWN) + clear |=3D INT_LINK_UP; + writel(clear, cp->app + APP_INT_STATUS); + + if (status & INT_LINK_DOWN) { + /* The DBI interface needs a controller reset after link loss. */ + raw_spin_lock(&cp->lock); + WRITE_ONCE(cp->link_lost, true); + writel(0, cp->app + APP_INT_ENABLE); + raw_spin_unlock(&cp->lock); + dev_warn_ratelimited(cp->pci.dev, "link lost; controller reprobe require= d\n"); + goto out; + } + + if (status & INT_ERR_MASK) + dev_err_ratelimited(cp->pci.dev, "port %d: PCIe error, status %#x\n", + cp->port, status); + + for (i =3D 0; i < PCI_NUM_INTX; i++) + if (status & INT_INTX_ASSERT(i)) + generic_handle_domain_irq(cp->intx_domain, i); + if ((status & INT_MSI) && cp->msi_ready) + dw_handle_msi_irq(&cp->pci.pp); + +out: + chained_irq_exit(chip, desc); +} + +static void cortina_intx_mask(struct irq_data *d) +{ + struct cortina_pcie *cp =3D irq_data_get_irq_chip_data(d); + u32 bit =3D INT_INTX_ASSERT(d->hwirq); + unsigned long flags; + + raw_spin_lock_irqsave(&cp->lock, flags); + writel(readl(cp->app + APP_INT_ENABLE) & ~bit, cp->app + APP_INT_ENABLE); + raw_spin_unlock_irqrestore(&cp->lock, flags); +} + +static void cortina_intx_unmask(struct irq_data *d) +{ + struct cortina_pcie *cp =3D irq_data_get_irq_chip_data(d); + u32 bit =3D INT_INTX_ASSERT(d->hwirq); + unsigned long flags; + + raw_spin_lock_irqsave(&cp->lock, flags); + if (!READ_ONCE(cp->link_lost)) + writel(readl(cp->app + APP_INT_ENABLE) | bit, cp->app + APP_INT_ENABLE); + raw_spin_unlock_irqrestore(&cp->lock, flags); +} + +static struct irq_chip cortina_intx_chip =3D { + .name =3D "cortina-INTx", + .irq_mask =3D cortina_intx_mask, + .irq_unmask =3D cortina_intx_unmask, +}; + +static int cortina_pcie_intx_map(struct irq_domain *domain, unsigned int i= rq, + irq_hw_number_t hwirq) +{ + irq_set_chip_and_handler(irq, &cortina_intx_chip, handle_simple_irq); + irq_set_chip_data(irq, domain->host_data); + return 0; +} + +static const struct irq_domain_ops cortina_intx_domain_ops =3D { + .map =3D cortina_pcie_intx_map, + .xlate =3D pci_irqd_intx_xlate, +}; + +static int cortina_pcie_init_irq_domain(struct cortina_pcie *cp) +{ + struct device *dev =3D cp->pci.dev; + struct device_node *intc; + + intc =3D of_get_child_by_name(dev->of_node, "interrupt-controller"); + if (!intc) + return dev_err_probe(dev, -ENODEV, "no interrupt-controller child\n"); + + cp->intx_domain =3D irq_domain_create_linear(of_fwnode_handle(intc), PCI_= NUM_INTX, + &cortina_intx_domain_ops, cp); + of_node_put(intc); + if (!cp->intx_domain) + return dev_err_probe(dev, -ENOMEM, "cannot create INTx domain\n"); + return 0; +} + +static int cortina_pcie_rd_own_conf(struct pci_bus *bus, unsigned int devf= n, + int where, int size, u32 *val) +{ + struct cortina_pcie *cp =3D to_cortina_pcie(to_dw_pcie_from_pp(bus->sysda= ta)); + + unsigned long flags; + int ret; + + *val =3D ~0U; + if (where < 0 || (size !=3D 1 && size !=3D 2 && size !=3D 4) || + (where & (size - 1))) + return PCIBIOS_BAD_REGISTER_NUMBER; + if (READ_ONCE(cp->link_lost)) + return PCIBIOS_DEVICE_NOT_FOUND; + if (where >=3D RC_CFG_LIMIT || size > RC_CFG_LIMIT - where) { + *val =3D 0; + return PCIBIOS_SUCCESSFUL; + } + raw_spin_lock_irqsave(&cp->lock, flags); + ret =3D cp->link_lost ? PCIBIOS_DEVICE_NOT_FOUND : + pci_generic_config_read(bus, devfn, where, size, val); + raw_spin_unlock_irqrestore(&cp->lock, flags); + return ret; +} + +static int cortina_pcie_wr_own_conf(struct pci_bus *bus, unsigned int devf= n, + int where, int size, u32 val) +{ + struct cortina_pcie *cp =3D to_cortina_pcie(to_dw_pcie_from_pp(bus->sysda= ta)); + + unsigned long flags; + int ret; + + if (where < 0 || (size !=3D 1 && size !=3D 2 && size !=3D 4) || + (where & (size - 1))) + return PCIBIOS_BAD_REGISTER_NUMBER; + if (READ_ONCE(cp->link_lost)) + return PCIBIOS_DEVICE_NOT_FOUND; + if (where >=3D RC_CFG_LIMIT || size > RC_CFG_LIMIT - where) { + dev_dbg(bus->dev.parent, "ignoring RC config write at %#x\n", where); + return PCIBIOS_SUCCESSFUL; + } + raw_spin_lock_irqsave(&cp->lock, flags); + ret =3D cp->link_lost ? PCIBIOS_DEVICE_NOT_FOUND : + pci_generic_config_write(bus, devfn, where, size, val); + raw_spin_unlock_irqrestore(&cp->lock, flags); + return ret; +} + +static struct pci_ops cortina_own_pci_ops =3D { + .map_bus =3D dw_pcie_own_conf_map_bus, + .read =3D cortina_pcie_rd_own_conf, + .write =3D cortina_pcie_wr_own_conf, +}; + +static int cortina_pcie_host_init(struct dw_pcie_rp *pp) +{ + pp->bridge->ops =3D &cortina_own_pci_ops; + pp->keep_rp_msi_en =3D true; + return 0; +} + +static void cortina_pcie_host_post_init(struct dw_pcie_rp *pp) +{ + struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); + u8 cap =3D dw_pcie_find_capability(pci, PCI_CAP_ID_MSI); + u16 flags; + + /* PCI enumeration clears MSI enable while initializing capabilities. */ + if (cap) { + flags =3D dw_pcie_readw_dbi(pci, cap + PCI_MSI_FLAGS); + dw_pcie_writew_dbi(pci, cap + PCI_MSI_FLAGS, flags | PCI_MSI_FLAGS_ENABL= E); + } +} + +static int cortina_pcie_msi_init(struct dw_pcie_rp *pp) +{ + struct cortina_pcie *cp =3D to_cortina_pcie(to_dw_pcie_from_pp(pp)); + u32 ctrl; + int ret; + + /* The application IRQ multiplexes MSI and INTx, so do not chain it twice= . */ + pp->msi_irq[0] =3D -ENODEV; + ret =3D dw_pcie_msi_host_init(pp); + if (ret) + return ret; + /* CS7542 routes endpoint MSI writes through its application target. */ + pp->msi_data =3D cp->app_phys + APP_MSI_TARGET; + /* A custom MSI hook owns setup and teardown of the multiplexed receiver.= */ + for (ctrl =3D 0; ctrl < pp->num_vectors / MAX_MSI_IRQS_PER_CTRL; ctrl++) { + dw_pcie_writel_dbi(&cp->pci, PCIE_MSI_INTR0_MASK + ctrl * MSI_REG_CTRL_B= LOCK_SIZE, + pp->irq_mask[ctrl]); + dw_pcie_writel_dbi(&cp->pci, PCIE_MSI_INTR0_ENABLE + ctrl * MSI_REG_CTRL= _BLOCK_SIZE, + ~0); + } + dw_pcie_writel_dbi(&cp->pci, PCIE_MSI_ADDR_LO, lower_32_bits(pp->msi_data= )); + dw_pcie_writel_dbi(&cp->pci, PCIE_MSI_ADDR_HI, upper_32_bits(pp->msi_data= )); + cp->msi_ready =3D true; + return 0; +} + +static void cortina_pcie_quiesce(struct cortina_pcie *cp) +{ + unsigned long flags; + + /* Serialize with config/DBI accesses and prevent interrupt re-enables. */ + raw_spin_lock_irqsave(&cp->lock, flags); + WRITE_ONCE(cp->link_lost, true); + writel(0, cp->app + APP_INT_ENABLE); + readl(cp->app + APP_INT_ENABLE); + raw_spin_unlock_irqrestore(&cp->lock, flags); + synchronize_irq(cp->irq); +} + +static void cortina_pcie_remove_irq_domain(struct cortina_pcie *cp) +{ + unsigned int i; + + irq_set_chained_handler_and_data(cp->irq, NULL, NULL); + synchronize_irq(cp->irq); + for (i =3D 0; i < PCI_NUM_INTX; i++) + irq_dispose_mapping(irq_find_mapping(cp->intx_domain, i)); + irq_domain_remove(cp->intx_domain); +} + +static void cortina_pcie_host_deinit(struct dw_pcie_rp *pp) +{ + struct cortina_pcie *cp =3D to_cortina_pcie(to_dw_pcie_from_pp(pp)); + + /* Endpoints have stopped; now drain the shared IRQ before freeing domain= s. */ + cortina_pcie_quiesce(cp); + if (cp->msi_ready) { + cp->msi_ready =3D false; + dw_pcie_free_msi(pp); + pp->msi_irq_domain =3D NULL; + } +} + +static const struct dw_pcie_host_ops cortina_pcie_host_ops =3D { + .init =3D cortina_pcie_host_init, + .post_init =3D cortina_pcie_host_post_init, + .deinit =3D cortina_pcie_host_deinit, + .msi_init =3D cortina_pcie_msi_init, +}; + +/* Standard RC configuration above 512 bytes wedges the CS7542 bus. + * The DesignWare private register bank at 0x700 and above remains accessi= ble. + */ +static u32 cortina_pcie_read_dbi(struct dw_pcie *pci, void __iomem *base, + u32 reg, size_t size) +{ + struct cortina_pcie *cp =3D to_cortina_pcie(pci); + unsigned long flags; + u32 value =3D 0; + + /* Zero also makes the iATU enable poll fail after link loss. */ + raw_spin_lock_irqsave(&cp->lock, flags); + if (!cp->link_lost && + !(base =3D=3D pci->dbi_base && reg < 0x700 && reg + size > RC_CFG_LIM= IT)) + dw_pcie_read(base + reg, size, &value); + raw_spin_unlock_irqrestore(&cp->lock, flags); + return value; +} + +static void cortina_pcie_write_dbi(struct dw_pcie *pci, void __iomem *base, + u32 reg, size_t size, u32 value) +{ + struct cortina_pcie *cp =3D to_cortina_pcie(pci); + unsigned long flags; + + raw_spin_lock_irqsave(&cp->lock, flags); + if (!cp->link_lost && + !(base =3D=3D pci->dbi_base && reg < 0x700 && reg + size > RC_CFG_LIM= IT)) + dw_pcie_write(base + reg, size, value); + raw_spin_unlock_irqrestore(&cp->lock, flags); +} + +static const struct dw_pcie_ops cortina_dw_pcie_ops =3D { + .read_dbi =3D cortina_pcie_read_dbi, + .write_dbi =3D cortina_pcie_write_dbi, + .link_up =3D cortina_pcie_link_up, + .get_ltssm =3D cortina_pcie_get_ltssm, + .start_link =3D cortina_pcie_start_link, + .stop_link =3D cortina_pcie_stop_link, +}; + +static void cortina_pcie_power_off(struct cortina_pcie *cp) +{ + gpiod_set_value_cansleep(cp->perst, 1); + reset_control_assert(cp->reset); + phy_power_off(cp->phy); + phy_exit(cp->phy); + clk_disable_unprepare(cp->clk); +} + +static int cortina_pcie_probe(struct platform_device *pdev) +{ + struct device *dev =3D &pdev->dev; + struct cortina_pcie *cp; + struct dw_pcie *pci; + struct resource *res; + int ret; + + cp =3D devm_kzalloc(dev, sizeof(*cp), GFP_KERNEL); + if (!cp) + return -ENOMEM; + pci =3D &cp->pci; + pci->dev =3D dev; + pci->ops =3D &cortina_dw_pcie_ops; + res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi"); + if (!res) + return -EINVAL; + cp->dbi_phys =3D res->start; + cp->app =3D devm_platform_ioremap_resource_byname(pdev, "app"); + if (IS_ERR(cp->app)) + return PTR_ERR(cp->app); + res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "app"); + cp->app_phys =3D res->start; + if (res->start < APP_PHYS_BASE || + (res->start - APP_PHYS_BASE) % APP_PORT_STRIDE || + (res->start - APP_PHYS_BASE) / APP_PORT_STRIDE >=3D 3) + return -EINVAL; + cp->port =3D (res->start - APP_PHYS_BASE) / APP_PORT_STRIDE; + raw_spin_lock_init(&cp->lock); + cp->clk =3D devm_clk_get(dev, NULL); + if (IS_ERR(cp->clk)) + return dev_err_probe(dev, PTR_ERR(cp->clk), "controller clock\n"); + cp->reset =3D devm_reset_control_get_exclusive(dev, NULL); + if (IS_ERR(cp->reset)) + return dev_err_probe(dev, PTR_ERR(cp->reset), "controller reset\n"); + cp->phy =3D devm_phy_get(dev, "pcie"); + if (IS_ERR(cp->phy)) + return dev_err_probe(dev, PTR_ERR(cp->phy), "SerDes\n"); + cp->perst =3D devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(cp->perst)) + return dev_err_probe(dev, PTR_ERR(cp->perst), "PERST# GPIO\n"); + cp->irq =3D platform_get_irq(pdev, 0); + if (cp->irq < 0) + return cp->irq; + + ret =3D clk_prepare_enable(cp->clk); + if (ret) + return ret; + ret =3D phy_init(cp->phy); + if (ret) + goto disable_clk; + ret =3D phy_set_mode(cp->phy, PHY_MODE_PCIE); + if (ret) + goto exit_phy; + ret =3D phy_power_on(cp->phy); + if (ret) + goto exit_phy; + ret =3D reset_control_reset(cp->reset); + if (ret) + goto power_off; + writel(0, cp->app + APP_INT_ENABLE); + cortina_pcie_stop_link(pci); + writel(readl(cp->app + APP_INT_STATUS), cp->app + APP_INT_STATUS); + gpiod_set_value_cansleep(cp->perst, 0); + msleep(100); + ret =3D cortina_pcie_port_init(cp); + if (ret) + goto power_off; + ret =3D cortina_pcie_init_irq_domain(cp); + if (ret) + goto power_off; + irq_set_chained_handler_and_data(cp->irq, cortina_pcie_irq_handler, cp); + writel(INT_MSI | INT_ERR_MASK, cp->app + APP_INT_ENABLE); + pci->pp.ops =3D &cortina_pcie_host_ops; + ret =3D dw_pcie_host_init(&pci->pp); + if (ret) { + cortina_pcie_quiesce(cp); + cortina_pcie_remove_irq_domain(cp); + goto power_off; + } + platform_set_drvdata(pdev, cp); + return 0; + +power_off: + gpiod_set_value_cansleep(cp->perst, 1); + reset_control_assert(cp->reset); + phy_power_off(cp->phy); +exit_phy: + phy_exit(cp->phy); +disable_clk: + reset_control_assert(cp->reset); + clk_disable_unprepare(cp->clk); + return dev_err_probe(dev, ret, "host initialization\n"); +} + +static void cortina_pcie_remove(struct platform_device *pdev) +{ + struct cortina_pcie *cp =3D platform_get_drvdata(pdev); + + dw_pcie_host_deinit(&cp->pci.pp); + cortina_pcie_remove_irq_domain(cp); + cortina_pcie_power_off(cp); +} + +static void cortina_pcie_shutdown(struct platform_device *pdev) +{ + struct cortina_pcie *cp =3D platform_get_drvdata(pdev); + + cortina_pcie_quiesce(cp); + cortina_pcie_stop_link(&cp->pci); + gpiod_set_value_cansleep(cp->perst, 1); + reset_control_assert(cp->reset); +} + +static const struct of_device_id cortina_pcie_of_match[] =3D { + { .compatible =3D "cortina,cs7542-pcie" }, + { } +}; +MODULE_DEVICE_TABLE(of, cortina_pcie_of_match); + +static struct platform_driver cortina_pcie_driver =3D { + .probe =3D cortina_pcie_probe, + .remove =3D cortina_pcie_remove, + .shutdown =3D cortina_pcie_shutdown, + .driver =3D { + .name =3D "cs7542-pcie", + .of_match_table =3D cortina_pcie_of_match, + }, +}; +module_platform_driver(cortina_pcie_driver); + +MODULE_DESCRIPTION("Cortina Systems CS7542 PCIe host controller"); +MODULE_LICENSE("GPL"); --=20 2.53.0 From nobody Tue Nov 24 11:35:57 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=1795465977; b=E+fW0+C6d2+IRFF7HuYKGnTsRzMh9KDCB1AkzSKToGbpI0l4ibpoJSiiYgmHX0RzVMt4 tG5BAZWMYOR8meV6iTN1kDUqEmVpgTEOoNkqRLwTzy4vFfthh5BHyedwx7pROYXpj4Pev so7dBnGOEGONkaFpLHMzerXAZ+HEOEEbGQyjcOvZwsH/2U5Z1Byqk9Uf+xlDNysgTB+Kh fR8q1HzESHBn7fh58sPSzZ6IjdWUzX/U6mvx/Yk/ArMe+qex8z+h3lmWvvEc2M0hadoVF Ezhi48XNz7Ve1z81VJUI96xCWV04M90IURfparqJES97X8hWOyXg7vwLJlF4g+miZ1A== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795465977; 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=Lej6RTvtrpI2hEP/db8Qbcau2rotxEBHFNsfNijRJu8=; b=m9195HQaUJTKKIuX6sFJKCITBy21Q9BchHlndMFJXlbX8DU9a2e56xlsFDr9XUslIyYx mSuFKd0aB/SrrT8KWLKKBVpQQWwRUC0fCpD0sGPfbsw87I/FKTW6Y008eEDSnx7+n4gJm NiSxNaUBRg0LPLAXqupSjzgBuyoqLSAlqMEZssv5ts7T3Bv5vKcl0+noLo8+gkIDhWhbm XqAH6lhBm6KkiufWYyhxK50zj3dC9WZwk86lli9wba7+bQWOlvl/jkwRTvQ8FbLhlRX56 tXkSwovDnWNpHUbaehV8bFuS3zRPwR3nBvm0enrrivko3rxSOq0Wpntyzp97JZYcGsA== 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=j3TuCmyq; 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 1661C606A68B; Mon, 23 Nov 2026 20:32:56 +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=j3TuCmyq 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=1795465976; b=rZ+uTr+orARP/Vcb2rVjKEsCV4/tylX0sYou8d8WmpJka1WFhlYhOsKA4NTApHuImCX3 EmD2qli6Fgx+BqosiciAn/o9APZWP4DCof9c5wZn6ucNvV45yuZsmudpHXvCOSfbh3lSf h0rJzRFxInIJGGO3kWc7hO+KwAZF8l+A2uMtg2PExjJasvt453G/ESvEAoqejLvp7uYyR Kz7zjl6bE/L6FUQj3gkhmvNi00epoQ3LrlFGZ6xOCWEox1U+vrOezitK3MXs2RK7cDTXa vYZ/qyAVz/JUS/QEsL5vPxkz8HsFRzp3KK6XhtGbuDgUM/6jqgNJcR/K9YKNtWtuJVw== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1795465976; 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=Lej6RTvtrpI2hEP/db8Qbcau2rotxEBHFNsfNijRJu8=; b=yjtaHckWJk6LRVVoQ4h7gHVDl8ASFaWgZczE1AWjjGxIJlpd6xutZIuRtXc8mHCFAkm9 lf2WZhjNksFiCb/GQJAyKxFOStWwKlGC84QBErk8MkqguRzRBHCW8yQnaSvEAZTfGcKvV ZomfCDZ2jYVV0V3yohKZL4ZLqcAyYlQBIE8txeT57lv+j7ng9wAArE+ghr26DCSDKeItA BA/S3enpMmGj7O/gF9Mtq6zJlhWJSqbjG/pilI0J+rsxMy0ewgr+eTZReobOMhCmE0Ltb B5OWk86JjCXV/symfIk9EWBpz786/PgeFf5LiMZls8Ri6tmqR8HvYsiwAVLnqGwu6pg== 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 1C5751F0093C; Mon, 23 Nov 2026 20:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795465976; bh=Lej6RTvtrpI2hEP/db8Qbcau2rotxEBHFNsfNijRJu8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=j3TuCmyqIDDR8NGD5LuQq5sXRj6fH32sOmv8uCX+++9Fem+v9yg6pXxafl552aMco fdfgPP9C+1FFxsAqzZ7Heuac1Qm+3+2PWTnFhLgBMQvfZXy1n5TMgKdFL6uCrk02j3 nPSH4SioRgMHqPsxOBk394Tu+01/OL7DCeP+jXbjWoEdzcPGAl3PN2yIwvL6dy/OS4 bMSzNCbWSVREEXjj/UcerYGGoY95hSWPUXLpDx+e8vKaqvbHFoTPtnhA7yBIGWYMpS 68dXjwStQsrN6b0B3natzvKxyfwih6/oA1MpsrHgSRx6orNSf1dFh62s+yTHtaHVK/ p9YHKOe32HZag== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 34DAC4C71A; Mon, 23 Nov 2026 20:32:18 +0000 (UTC) From: Fil Dunsky via B4 Relay Date: Mon, 23 Nov 2026 23:32:22 +0300 Subject: [PATCH v2 8/8] MAINTAINERS: Add CS7542 PCIe 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-b4-cs7542-pcie-v2-8-f589a9cd0bef@gmail.com> References: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> In-Reply-To: <20261123-b4-cs7542-pcie-v2-0-f589a9cd0bef@gmail.com> To: Manivannan Sadhasivam , Stephen Boyd , Vinod Koul Cc: Jingoo Han , Lorenzo Pieralisi , Krzysztof Wilczynski , Rob Herring , Bjorn Helgaas , Brian Masney , Jerome Brunet , Neil Armstrong , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795465935; l=1356; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=jDKZmt7guwHzNgRKzZtW9q1sZuhebiJ5PQkmWsr+DNk=; b=COAIM9n7CTGeI8/L4LkcbqnsEldMGtaqCfIl/GPNmucZysECPadrp5Gs0ZzEUCWCmxfqt0Ccb lEinjDjWYRmCm41Fm5Fkw5271BcAEUcjoMXeS16jSw1BCeT47F5tcqn 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 Cover the new PCIe control, SerDes and host drivers and their bindings under the existing CS7542 entry. Signed-off-by: Fil Dunsky --- MAINTAINERS | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index d8835aeca..511a6cb34 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2949,15 +2949,20 @@ 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 +ARM/CORTINA SYSTEMS CS7542 GLOBAL CONTROL AND PCIE M: Fil Dunsky L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained +F: Documentation/devicetree/bindings/pci/cortina,cs7542-pcie.yaml +F: Documentation/devicetree/bindings/phy/cortina,cs7542-pcie-phy.yaml F: Documentation/devicetree/bindings/pinctrl/cortina,cs7542-pinctrl.yaml F: Documentation/devicetree/bindings/soc/cortina/ F: drivers/clk/clk-cs7542.c +F: drivers/pci/controller/dwc/pcie-cs7542.c +F: drivers/phy/phy-cs7542-pcie.c F: drivers/pinctrl/pinctrl-cs7542.c F: include/dt-bindings/clock/cortina,cs7542-clock.h +F: include/dt-bindings/reset/cortina,cs7542-reset.h =20 ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE M: Hans Ulli Kroll --=20 2.53.0