From nobody Sun Feb 8 22:17:41 2026 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 349332D7DF2 for ; Wed, 22 Oct 2025 17:43:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.68 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761154997; cv=none; b=AMRcUcPSZSb+1KUjtc+Rm69j8d/QnZyDC1//A8da7Gv7WBPS7q3XM3VB7hkpddi+8gVhb/cgyiFxWvB4JMSGoz6OoBsLbRyP67KIfihr0gA3H3sRE5NRh/sM4p/aocA6bUUrAfGoxbBoP9cKiVcinPuP/hMa92GV3wDfAj5e2WA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761154997; c=relaxed/simple; bh=/WvSXC7W4Q8hEck5OteLiosiwPd50zkgon/bnQ1zTTs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SOgE9OvpAzr2kkJL3mg5b/PvFrs4FkfAWc52ASeKz+SP/93jlszsm0uENk+ozw872u1wZDQdmst1KPw21TccGW80iETtVT/My9Z2w3MieFYIN8MY7pItWg2P0qMxPPVFCBC77fOu9GkHnQnHY06N40ZtaENkaEPjZDNSIhr2sAE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=yXuaHZu4; arc=none smtp.client-ip=209.85.128.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="yXuaHZu4" Received: by mail-wm1-f68.google.com with SMTP id 5b1f17b1804b1-47112a73785so54981455e9.3 for ; Wed, 22 Oct 2025 10:43:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761154992; x=1761759792; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j/K6pNfM50RfxSgZt1gAI6BQibb85E1lqSjk2vGJD9Y=; b=yXuaHZu4Qp59MjLK5Bo4dTmY0edoUTYcX6LEBGg+HQ0tSomdA//dUllVedoyz2J2ov ucRLhl0fv5oPwn4BPED1hqZOB1ynbdswKN4bGmJEM+qVNQ5edlfe1L2nNF70NJk5jlyG A7wOApcM6fLDp+BZODTD2zYASxJoG5hnpPFHIjFkkQEV5vxZYgWM1aEnONNn/UKX+Cey 8/CXZReNyS/GtLt1PQJapg1H27HKvfYWlmm1iSGSWpCVrOCAJjdA/Haned6l58svEO94 8+2vv6d6cVdfWfnISSo9T347jjsLcVGE4Z3QBJExv3zLw3BijeQGzSNJ6AAg1VMxKNwM LFOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761154992; x=1761759792; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j/K6pNfM50RfxSgZt1gAI6BQibb85E1lqSjk2vGJD9Y=; b=RSieXsX3+x5zGp1YrKjFJZF6VgBMCdUW34HiwX6uKGSH2SPJdM8eTjon6UdAno8X1z 8bR2rm3yA+Ohvy6oMh03CxpYuJO9AxE6ABXQKCTULTywF43jQnIe79tfo4AjwL9IK3WN Kkze1wbJXFsWarfvotZN9BC5Ogcolpws/2HuuD14ilSK0i2GYHJ3zc/XONxqj3qpCpl8 93cCEwe8M0WLr92buawe5PG0J0qt+px8N04Vsz4lh8YR66swz74hcQUYbM1edoQ7Vvf5 DVV0LXMXaDoC4+b9NnIXRU1uNKyitKHtRCnvlhGhah0zawc0K5CqJtGw1Iop5AnzqMwu J93A== X-Forwarded-Encrypted: i=1; AJvYcCWiOHCcho143ITHAOUbZFvpdKi8FjTBwpfjkgdO6KgXrLBeAWMxYRMSON+XJf9v9D4KIZtera3dn/chETQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yzx3u9YDyktyGDoBkQC+kiSOY5wgJ4xSyBWqBRTPm0JkDsPp3Tc rd6nGoZ40gEUbOVeEfLH4aprv4BhfkeZH8iV0CsAF7zzTf8/cY5m98uV8HZ2YhZJm2s= X-Gm-Gg: ASbGncsAK4kjrcTbclXuNKbYyUgIODpydjWf3fbP6s6WG/Hl0ajVBa4PuhpurmpR3E3 /P2lZDWxGew8ouPN9bdbsFdNPH9O9PEXIaj68m0Llfcxi9K7TsH+D5ZKsnK1UVjChPMIb8mXT24 +FXpbtBBKF0lZ0YhRQqOubZuH1mn5/W+29IiFaMTwI8ETWt06qTiIvRHiFWITrtJOfMa1FD8vFz J5y9phrjO1EEQWGtTLZ0aD1obpLK+J530Balyet3j5KatGKY1n3tkb4bSXM1dkkbzIEX0pCMQaZ 8S2w0hoPcu/OMDN9EFAb6f8FGmFk+/SaTo47m3Tb+IAxIeTmtST/8ZMbqIuaxeGiWVP2t3wm7dw VmNATfP1Tjej9YT9/YKFsC1qsT67WOtx5jHf8p/6QiDqR4MJBpLLfGNdi1mu5GSRd7SaQMeRzV5 y6n1CeFBLNIdIcLUSZ8No= X-Google-Smtp-Source: AGHT+IGaffzb8yHlNU55p9rF8t2TGW4QRT5HNlWnXs4LSZW3Gb59mNXLLVvwX2nvyEKIz0B5fJhCCw== X-Received: by 2002:a05:600c:c091:b0:46f:b42e:edcf with SMTP id 5b1f17b1804b1-47117925d66mr115832685e9.40.1761154992519; Wed, 22 Oct 2025 10:43:12 -0700 (PDT) Received: from vingu-cube.. ([2a01:e0a:f:6020:edfc:89e3:4805:d8de]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47494aad668sm43434755e9.2.2025.10.22.10.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Oct 2025 10:43:11 -0700 (PDT) From: Vincent Guittot To: chester62515@gmail.com, mbrugger@suse.com, ghennadi.procopciuc@oss.nxp.com, s32@nxp.com, bhelgaas@google.com, jingoohan1@gmail.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, Ionut.Vicovan@nxp.com, larisa.grigore@nxp.com, Ghennadi.Procopciuc@nxp.com, ciprianmarian.costea@nxp.com, bogdan.hamciuc@nxp.com, Frank.li@nxp.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Cc: cassel@kernel.org Subject: [PATCH 1/4 v3] dt-bindings: PCI: s32g: Add NXP PCIe controller Date: Wed, 22 Oct 2025 19:43:06 +0200 Message-ID: <20251022174309.1180931-2-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251022174309.1180931-1-vincent.guittot@linaro.org> References: <20251022174309.1180931-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Describe the PCIe host controller available on the S32G platforms. Co-developed-by: Ionut Vicovan Signed-off-by: Ionut Vicovan Co-developed-by: Bogdan-Gabriel Roman Signed-off-by: Bogdan-Gabriel Roman Co-developed-by: Larisa Grigore Signed-off-by: Larisa Grigore Co-developed-by: Ghennadi Procopciuc Signed-off-by: Ghennadi Procopciuc Co-developed-by: Ciprian Marian Costea Signed-off-by: Ciprian Marian Costea Co-developed-by: Bogdan Hamciuc Signed-off-by: Bogdan Hamciuc Signed-off-by: Vincent Guittot --- .../bindings/pci/nxp,s32g-pcie.yaml | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/nxp,s32g-pcie.yaml diff --git a/Documentation/devicetree/bindings/pci/nxp,s32g-pcie.yaml b/Doc= umentation/devicetree/bindings/pci/nxp,s32g-pcie.yaml new file mode 100644 index 000000000000..2d8f7ad67651 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/nxp,s32g-pcie.yaml @@ -0,0 +1,102 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/nxp,s32g-pcie.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP S32G2xxx/S32G3xxx PCIe Root Complex controller + +maintainers: + - Bogdan Hamciuc + - Ionut Vicovan + +description: + This PCIe controller is based on the Synopsys DesignWare PCIe IP. + The S32G SoC family has two PCIe controllers, which can be configured as + either Root Complex or Endpoint. + +allOf: + - $ref: /schemas/pci/snps,dw-pcie.yaml# + +properties: + compatible: + oneOf: + - enum: + - nxp,s32g2-pcie + - items: + - const: nxp,s32g3-pcie + - const: nxp,s32g2-pcie + + reg: + maxItems: 6 + + reg-names: + items: + - const: dbi + - const: dbi2 + - const: atu + - const: dma + - const: ctrl + - const: config + + interrupts: + maxItems: 2 + + interrupt-names: + items: + - const: dma + - const: msi + +required: + - compatible + - reg + - reg-names + - interrupts + - interrupt-names + - ranges + - phys + +unevaluatedProperties: false + +examples: + - | + #include + #include + + bus { + #address-cells =3D <2>; + #size-cells =3D <2>; + + pcie@40400000 { + compatible =3D "nxp,s32g3-pcie", + "nxp,s32g2-pcie"; + reg =3D <0x00 0x40400000 0x0 0x00001000>, /* dbi registers */ + <0x00 0x40420000 0x0 0x00001000>, /* dbi2 registers */ + <0x00 0x40460000 0x0 0x00001000>, /* atu registers */ + <0x00 0x40470000 0x0 0x00001000>, /* dma registers */ + <0x00 0x40481000 0x0 0x000000f8>, /* ctrl registers */ + <0x5f 0xffffe000 0x0 0x00002000>; /* config space */ + reg-names =3D "dbi", "dbi2", "atu", "dma", "ctrl", "config"; + dma-coherent; + #address-cells =3D <3>; + #size-cells =3D <2>; + device_type =3D "pci"; + ranges =3D + <0x81000000 0x0 0x00000000 0x5f 0xfffe0000 0x0 0x0001= 0000>, + <0x82000000 0x0 0x00000000 0x58 0x00000000 0x0 0x8000= 0000>, + <0x82000000 0x1 0x00000000 0x59 0x00000000 0x6 0xfffe= 0000>; + + bus-range =3D <0x0 0xff>; + interrupts =3D , + ; + interrupt-names =3D "dma", "msi"; + #interrupt-cells =3D <1>; + interrupt-map-mask =3D <0 0 0 0x7>; + interrupt-map =3D <0 0 0 1 &gic 0 0 GIC_SPI 128 IRQ_TYPE_LEVEL= _HIGH>, + <0 0 0 2 &gic 0 0 GIC_SPI 129 IRQ_TYPE_LEVEL_H= IGH>, + <0 0 0 3 &gic 0 0 GIC_SPI 130 IRQ_TYPE_LEVEL_H= IGH>, + <0 0 0 4 &gic 0 0 GIC_SPI 131 IRQ_TYPE_LEVEL_H= IGH>; + + phys =3D <&serdes0 PHY_TYPE_PCIE 0 0>; + }; + }; --=20 2.43.0 From nobody Sun Feb 8 22:17:41 2026 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6276E2D9487 for ; Wed, 22 Oct 2025 17:43:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761154998; cv=none; b=XJoVbAvz9Lpf3TQ9Kqvlynze2G2TRRoJ5siCfqpsYPs88y39gYz/ljvTXqnJm2UEvyWq8xLrfGzOezeeUsA1NtYdbP+agDbG9AAJimcMmNUAw0j91kx/pv8dOnBGSRMi1S59AH9AbD2zz7sDWauxjIfgEoiwdh16LsJqqqEbOyE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761154998; c=relaxed/simple; bh=YDmC2z63xnyncBVrO7Ltif8kw4rumvv6Ka6aN/+Z8sc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MWkzE4fLaBfqwWr61/DNUUT5Nw25La95fCHST9dTakV1GTGgy7TqmgMK0AoulQoBFEHox0SagTz5nCgx1g37PYtb9Rru2s1PiLGVEjNiLuFlAM4RVjaTYFOrc7OvUDz26uUeL8augnZ1QWcKw5aktrURtljDGKyL/BFLVDJwVkk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=dSn0QDBM; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dSn0QDBM" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-471131d6121so54624605e9.1 for ; Wed, 22 Oct 2025 10:43:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761154995; x=1761759795; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WSJqWy4wfSXZhaQaKW322RhPmT1j8xGKth4T2OfqmIA=; b=dSn0QDBMpd78CHfafrYHCXypX3+cTcFGcfGWgO26ZPe9FOws69Kg+Sio0Tz+0v60/e KkE2O2wZMz52fVMUcPdJG/Akyf8yZ5CmHEw28ydLcjdjJ7YHfbafpvSd3EBi5ziPv4O/ c4ERXqC8UdbfrsIEpDMBN9d3B6aXpXb2d5zW8fzMrDK4KeC2E0NX52c7f7pJsuQUw7CM H0uMxJ+ch/lIscYPa2Q7RNBIuBMcyuzyHkZmiGzdcxkuEIrxOTJ41NWuRamm7hcpBGun knZ3oOHFl5dK7w0OeIQSuqid9XNa/xnpizi+YdgD0E/M747TytWNfL5nb2B5yraH6qbP nsGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761154995; x=1761759795; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WSJqWy4wfSXZhaQaKW322RhPmT1j8xGKth4T2OfqmIA=; b=D83VayuujEYszFzcHNtyI/2Aw3eAgSy63ZOwYkPSq+hMWeRjwHBHvMeaiLwTPGwiX1 4ucmQQS18Bo2i/+YFOQR/Ay/rCxNWhtnjfQ46+gKNur3mm5rgXxYdVAZ43TN1QqmOoCY hgLSmYWw2RxcVTAEX2qVhmT0m8mm0tAvRCMzxGFay0FcwXMpuWRz24U+TPuDnOr0tbuu jciaboHY2pCHGHVc6u/vNv9j6Ylk8lb5A+fa2PZIGVebBjQdKVw06rs3F70BR6ccYM22 wk+GgZ1bTMypC1lsQqhzippwNgLP4zakoUJaDCK/PF+1+L7jZ6ygK2CInUBgDn0ojUha kzwg== X-Forwarded-Encrypted: i=1; AJvYcCWutl3XGud0EtfaSvRHNrnmL8cooyca4cRXHtWW2qm8u2auNJjJ9tLKksnH25cAScd8zvGfBzI6g1NTEq4=@vger.kernel.org X-Gm-Message-State: AOJu0YxvxVN4dw+NvrC1nY+7OYaV/Jzq+J+OrN4dnuejOTxfdmh29bbg qLbqntgPf583hsE+VDzWpG3QRlDOs2LIG56juWl6D9wdt+xNoheYNZ2l91PvMAq1bUo= X-Gm-Gg: ASbGncux5IszKNZjy4lvpbftiZkyHHbiHQghutuX3mOnwRyJuwtt+y1CwEz1wlXrYwD kCb50i7/tjIF7LuXd6KHaZ/qp+rDgyHcSFbHVbovqlRLK9Nght2rkfFkYfeHHYb8SO37P/p3l0r wbxwPs7eYowho6BnaCvmRIKyD/HPZjYxMWSdOlSfZASRcyD1Ffl8hgkPTED1Cy4DM5s9BhR9Dgb EfE5NICU6VrNez0cL660SyOyIbzSoQgqyRsSUB902ETyiDWIxpaPE9QQ+Vt1E3aI9JQiCVvE5ZA CHzigYrNveBch36/FcUdwZVwevtbFxAOiI7+TbJOylj4IPm6O81KYVyFxjmSTNFxBZu+clmzDHo TrhyDTPjnm1TU8O0kM5V3SrgFhNwaSXR8bBhIe3ajn8VFlnC+Vwd/RWcGh4lhsjhW46KnT99sVO NtvV6eIh0m X-Google-Smtp-Source: AGHT+IFA9ek93FErYNmJh5LdN2QDJprClDXAFVaAVFgE+OTKe5HXqKKsARiJ6YdVC5ACPC1UbPa9Gg== X-Received: by 2002:a05:600c:6095:b0:471:95a:60c9 with SMTP id 5b1f17b1804b1-4711786d054mr173817175e9.8.1761154994747; Wed, 22 Oct 2025 10:43:14 -0700 (PDT) Received: from vingu-cube.. ([2a01:e0a:f:6020:edfc:89e3:4805:d8de]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47494aad668sm43434755e9.2.2025.10.22.10.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Oct 2025 10:43:13 -0700 (PDT) From: Vincent Guittot To: chester62515@gmail.com, mbrugger@suse.com, ghennadi.procopciuc@oss.nxp.com, s32@nxp.com, bhelgaas@google.com, jingoohan1@gmail.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, Ionut.Vicovan@nxp.com, larisa.grigore@nxp.com, Ghennadi.Procopciuc@nxp.com, ciprianmarian.costea@nxp.com, bogdan.hamciuc@nxp.com, Frank.li@nxp.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Cc: cassel@kernel.org Subject: [PATCH 2/4 v3] PCI: dw: Add more registers and bitfield definition Date: Wed, 22 Oct 2025 19:43:07 +0200 Message-ID: <20251022174309.1180931-3-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251022174309.1180931-1-vincent.guittot@linaro.org> References: <20251022174309.1180931-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add new registers and bitfield definition: - GEN3_RELATED_OFF_EQ_PHASE_2_3 field of GEN3_RELATED_OFF - 3 Coherency control registers Signed-off-by: Vincent Guittot --- drivers/pci/controller/dwc/pcie-designware.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/con= troller/dwc/pcie-designware.h index e995f692a1ec..e60b77f1b5e6 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -121,6 +121,7 @@ =20 #define GEN3_RELATED_OFF 0x890 #define GEN3_RELATED_OFF_GEN3_ZRXDC_NONCOMPL BIT(0) +#define GEN3_RELATED_OFF_EQ_PHASE_2_3 BIT(9) #define GEN3_RELATED_OFF_RXEQ_RGRDLESS_RXTS BIT(13) #define GEN3_RELATED_OFF_GEN3_EQ_DISABLE BIT(16) #define GEN3_RELATED_OFF_RATE_SHADOW_SEL_SHIFT 24 @@ -138,6 +139,13 @@ #define GEN3_EQ_FMDC_MAX_PRE_CURSOR_DELTA GENMASK(13, 10) #define GEN3_EQ_FMDC_MAX_POST_CURSOR_DELTA GENMASK(17, 14) =20 +#define COHERENCY_CONTROL_1_OFF 0x8E0 +#define CFG_MEMTYPE_BOUNDARY_LOW_ADDR_MASK GENMASK(31, 2) +#define CFG_MEMTYPE_VALUE BIT(0) + +#define COHERENCY_CONTROL_2_OFF 0x8E4 +#define COHERENCY_CONTROL_3_OFF 0x8E8 + #define PCIE_PORT_MULTI_LANE_CTRL 0x8C0 #define PORT_MLTI_UPCFG_SUPPORT BIT(7) =20 --=20 2.43.0 From nobody Sun Feb 8 22:17:41 2026 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30F7E2D97A0 for ; Wed, 22 Oct 2025 17:43:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761155001; cv=none; b=CpyCcKFcDj0nmxw56+M5+TfM+WNFi4AgMYQoD6w7hZ7HtLHvrTvDEFr0dc0gvpsS+c7JKUyUHLm5QYJIWfpHTkggF+Z7SbLW+dPFNbq8kFfhAiCLCVqaI0TwUds79AWEyEmNz3FWNi03/8VluHb78UNWxbNQL8uSW6cRfXaNY1Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761155001; c=relaxed/simple; bh=AHQ+PPz0lajD0Sbg9dkLO7N8/9v2UFyfb6OC+VlckOI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pl45vm2eBYP3mKOU2AJ9e0UsUp6Tu9mbySnXvUO5v71WdYqGKwgCkb8y5FK7nUzNFcfe0OVK2eRc/x8edBJvP/pFF3uf4UkhbgwWhKy2P8cfDLZ5Duw2OyNI7/3nUmLog7VDCRXboQT9VKlzyXiIjQ+QDJOiricCh1SZ13XJzqk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=EnVX4TiI; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="EnVX4TiI" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-46e6a6a5e42so38402975e9.0 for ; Wed, 22 Oct 2025 10:43:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761154996; x=1761759796; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EAW0fJOEgm/3OZNhaFXEVj7ih7MDZGYCIb3wxvxnUgY=; b=EnVX4TiIbacu/s9dKYTbLOdHK34pbI2Rb2/NGGUw4b27PF3xOjqSnIc572eeJr6SgC DWP15uE2f7kgsg6ZSuDDUTuG62JFUyxuZgSvWODWjqRFZ6SjcQDrSTiTuKZsFGE9hkUJ wWJWb80du91sMVllXL5xQEpIORV/a4cg91Ko4feGlA9njZAeiEQvEw/YlaKFdxJyyfeZ jR3rYvXS/xqB46rbcCGNGGf7yren28oJ0w4Bw+c+FNS8PJ7QzkTcMeFpxaRrZl1RjKvK 4N4NFeESbEW+ET4JPPTObK6nLkwviSyFMxYqy0jchPAlbTi2OahOPJLwTNQIfHfBqr9F H2Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761154996; x=1761759796; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EAW0fJOEgm/3OZNhaFXEVj7ih7MDZGYCIb3wxvxnUgY=; b=J5lsroUPPH2tbGAyKky0U3A9mIHucV1mXt594K06kR7mmCoOL2DJ2J3LE7j6RC/2mQ bmYkrfiTTLYgMDoXvtCHl2WOttMmNkeA0mdNDflTnik1agdJaHMqI4fLMFPQfy/hCrpS eql9yHmeJ3Dl1wXMr67PFWguC2RYKnf8LFFauSDruZpoBhNdsnGOdNLKMZPWV8/69uHQ vp+vz+Ipwacwdk3vei+pN6lqnrX+Gh+m3NeyWA0gARnmDm6tdPmVVo/izo8Q4hGArm0v q4iO27WM2NLJxMjjyRelBFFt0exwp/WLqYtyx+wvVRG+hJYqrq/Hr7Vo2Z9Ounw3f3Vn fdlg== X-Forwarded-Encrypted: i=1; AJvYcCWtRZtnt/aoEE2jEbjUGGI/NyrPUJzWZxk4hMTUL8bU58ue9wmXgV3iulp3E5bmMi8KT/Bv1pkyMC93kiA=@vger.kernel.org X-Gm-Message-State: AOJu0YyxqZStM0jrhKy2CAY4falG6e2fpuClrla/c2hLuSjY2vRQcSlM XHaPIjixMAX+SzZhtCyYJEaeUGBfy6PFrOI478qQBOAaSSek+Ff8rRgfEiL9Bl4ucvs= X-Gm-Gg: ASbGnctIKpf58Wttpuh4kvePLvVydYTVRuJcPjWAC/c7I0oluFxz7Ebs0g4Sq3hYMy/ msM0tOExhCqm0s6QHrknUpLcq19HHV2nalpHcEIruyYCY1SdinWMowp/jg6HRL0+d8k8Z/Zd7BF NegEDPw3ABQ1PdNZgHFPVMvG7J2IMKrfiwE5VR2sZqZ+UfMwRr2X0XgiVfmitSqJTEpFjHrpTF+ OVyl6tvn0EMaVVnXKzOjp3G2TirOj1n0u3fJ/6BqZ0oOsx+zlj3xj2rsLN5iW+LbNGphlHWkT26 d0gWtNGEOuQx5pY7267CE4SStaasDwLKtfvZuNriS3YKG155wT9lSzHHkE1qeFSPXh9PAw7kjmC PdP53j4Lhogxtg6uiSb8Kl2ZKpB8JwCrNSpwzIkD4NRq0RYSKopFH+htk9OEwuUQSZuE2KlggSJ scnXV478lP X-Google-Smtp-Source: AGHT+IGm/cwWONtZV5J+zWL9XkRoy7AS0qpJj+VyisJzdvWqNmyDUXTbPVop32iUGbLguD/uMSNlhg== X-Received: by 2002:a05:600c:818f:b0:46f:b42e:e361 with SMTP id 5b1f17b1804b1-47117931c89mr151814655e9.41.1761154996494; Wed, 22 Oct 2025 10:43:16 -0700 (PDT) Received: from vingu-cube.. ([2a01:e0a:f:6020:edfc:89e3:4805:d8de]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47494aad668sm43434755e9.2.2025.10.22.10.43.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Oct 2025 10:43:15 -0700 (PDT) From: Vincent Guittot To: chester62515@gmail.com, mbrugger@suse.com, ghennadi.procopciuc@oss.nxp.com, s32@nxp.com, bhelgaas@google.com, jingoohan1@gmail.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, Ionut.Vicovan@nxp.com, larisa.grigore@nxp.com, Ghennadi.Procopciuc@nxp.com, ciprianmarian.costea@nxp.com, bogdan.hamciuc@nxp.com, Frank.li@nxp.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Cc: cassel@kernel.org Subject: [PATCH 3/4 v3] PCI: s32g: Add initial PCIe support (RC) Date: Wed, 22 Oct 2025 19:43:08 +0200 Message-ID: <20251022174309.1180931-4-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251022174309.1180931-1-vincent.guittot@linaro.org> References: <20251022174309.1180931-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add initial support of the PCIe controller for S32G Soc family. Only host mode is supported. Co-developed-by: Ionut Vicovan Signed-off-by: Ionut Vicovan Co-developed-by: Ciprian Marian Costea Signed-off-by: Ciprian Marian Costea Co-developed-by: Ghennadi Procopciuc Signed-off-by: Ghennadi Procopciuc Co-developed-by: Larisa Grigore Signed-off-by: Larisa Grigore Signed-off-by: Vincent Guittot --- drivers/pci/controller/dwc/Kconfig | 10 + drivers/pci/controller/dwc/Makefile | 1 + .../pci/controller/dwc/pcie-nxp-s32g-regs.h | 37 ++ drivers/pci/controller/dwc/pcie-nxp-s32g.c | 439 ++++++++++++++++++ 4 files changed, 487 insertions(+) create mode 100644 drivers/pci/controller/dwc/pcie-nxp-s32g-regs.h create mode 100644 drivers/pci/controller/dwc/pcie-nxp-s32g.c diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controller/dw= c/Kconfig index 349d4657393c..3f3172a0cd95 100644 --- a/drivers/pci/controller/dwc/Kconfig +++ b/drivers/pci/controller/dwc/Kconfig @@ -406,6 +406,16 @@ config PCIE_UNIPHIER_EP Say Y here if you want PCIe endpoint controller support on UniPhier SoCs. This driver supports Pro5 SoC. =20 +config PCIE_NXP_S32G + tristate "NXP S32G PCIe controller (host mode)" + depends on ARCH_S32 || COMPILE_TEST + select PCIE_DW_HOST + help + Enable support for the PCIe controller in NXP S32G based boards to + work in Host mode. The controller is based on DesignWare IP and + can work either as RC or EP. In order to enable host-specific + features PCIE_S32G must be selected. + config PCIE_SOPHGO_DW bool "Sophgo DesignWare PCIe controller (host mode)" depends on ARCH_SOPHGO || COMPILE_TEST diff --git a/drivers/pci/controller/dwc/Makefile b/drivers/pci/controller/d= wc/Makefile index 7ae28f3b0fb3..3301bbbad78c 100644 --- a/drivers/pci/controller/dwc/Makefile +++ b/drivers/pci/controller/dwc/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_PCI_DRA7XX) +=3D pci-dra7xx.o obj-$(CONFIG_PCI_EXYNOS) +=3D pci-exynos.o obj-$(CONFIG_PCIE_FU740) +=3D pcie-fu740.o obj-$(CONFIG_PCI_IMX6) +=3D pci-imx6.o +obj-$(CONFIG_PCIE_NXP_S32G) +=3D pcie-nxp-s32g.o obj-$(CONFIG_PCIE_SPEAR13XX) +=3D pcie-spear13xx.o obj-$(CONFIG_PCI_KEYSTONE) +=3D pci-keystone.o obj-$(CONFIG_PCI_LAYERSCAPE) +=3D pci-layerscape.o diff --git a/drivers/pci/controller/dwc/pcie-nxp-s32g-regs.h b/drivers/pci/= controller/dwc/pcie-nxp-s32g-regs.h new file mode 100644 index 000000000000..6f04204054dd --- /dev/null +++ b/drivers/pci/controller/dwc/pcie-nxp-s32g-regs.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2015-2016 Freescale Semiconductor, Inc. + * Copyright 2016-2023, 2025 NXP + */ + +#ifndef PCIE_S32G_REGS_H +#define PCIE_S32G_REGS_H + +/* PCIe controller Sub-System */ + +/* Link Interrupt Control And Status */ +#define PCIE_S32G_LINK_INT_CTRL_STS 0x40 +#define LINK_REQ_RST_NOT_INT_EN BIT(1) +#define LINK_REQ_RST_NOT_CLR BIT(2) + +/* PCIe controller 0 General Control 1 */ +#define PCIE_S32G_PE0_GEN_CTRL_1 0x50 +#define DEVICE_TYPE_MASK GENMASK(3, 0) +#define DEVICE_TYPE(x) FIELD_PREP(DEVICE_TYPE_MASK, x) +#define SRIS_MODE BIT(8) + +/* PCIe controller 0 General Control 3 */ +#define PCIE_S32G_PE0_GEN_CTRL_3 0x58 +#define LTSSM_EN BIT(0) + +/* PCIe Controller 0 Transmit Message Request */ +#define PCIE_S32G_PE0_TX_MSG_REQ 0x80 +#define PME_TURN_OFF_REQ BIT(19) + +/* PCIe Controller 0 Link Debug 2 */ +#define PCIE_S32G_PE0_LINK_DBG_2 0xB4 +#define SMLH_LTSSM_STATE_MASK GENMASK(5, 0) +#define SMLH_LINK_UP BIT(6) +#define RDLH_LINK_UP BIT(7) + +#endif /* PCI_S32G_REGS_H */ diff --git a/drivers/pci/controller/dwc/pcie-nxp-s32g.c b/drivers/pci/contr= oller/dwc/pcie-nxp-s32g.c new file mode 100644 index 000000000000..53529f63c555 --- /dev/null +++ b/drivers/pci/controller/dwc/pcie-nxp-s32g.c @@ -0,0 +1,439 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * PCIe host controller driver for NXP S32G SoCs + * + * Copyright 2019-2025 NXP + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pcie-designware.h" +#include "pcie-nxp-s32g-regs.h" + +struct s32g_pcie { + struct dw_pcie pci; + void __iomem *ctrl_base; + struct phy *phy; +}; + +#define to_s32g_from_dw_pcie(x) \ + container_of(x, struct s32g_pcie, pci) + +static void s32g_pcie_writel_ctrl(struct s32g_pcie *s32g_pp, u32 reg, u32 = val) +{ + writel(val, s32g_pp->ctrl_base + reg); +} + +static u32 s32g_pcie_readl_ctrl(struct s32g_pcie *s32g_pp, u32 reg) +{ + return readl(s32g_pp->ctrl_base + reg); +} + +static void s32g_pcie_enable_ltssm(struct s32g_pcie *s32g_pp) +{ + u32 reg; + + reg =3D s32g_pcie_readl_ctrl(s32g_pp, PCIE_S32G_PE0_GEN_CTRL_3); + reg |=3D LTSSM_EN; + s32g_pcie_writel_ctrl(s32g_pp, PCIE_S32G_PE0_GEN_CTRL_3, reg); +} + +static void s32g_pcie_disable_ltssm(struct s32g_pcie *s32g_pp) +{ + u32 reg; + + reg =3D s32g_pcie_readl_ctrl(s32g_pp, PCIE_S32G_PE0_GEN_CTRL_3); + reg &=3D ~LTSSM_EN; + s32g_pcie_writel_ctrl(s32g_pp, PCIE_S32G_PE0_GEN_CTRL_3, reg); +} + +static bool is_s32g_pcie_ltssm_enabled(struct s32g_pcie *s32g_pp) +{ + return (s32g_pcie_readl_ctrl(s32g_pp, PCIE_S32G_PE0_GEN_CTRL_3) & LTSSM_E= N); +} + +static enum dw_pcie_ltssm s32g_pcie_get_ltssm(struct dw_pcie *pci) +{ + struct s32g_pcie *s32g_pp =3D to_s32g_from_dw_pcie(pci); + u32 reg =3D s32g_pcie_readl_ctrl(s32g_pp, PCIE_S32G_PE0_LINK_DBG_2); + + return (enum dw_pcie_ltssm)FIELD_GET(SMLH_LTSSM_STATE_MASK, reg); +} + +#define PCIE_LINKUP (SMLH_LINK_UP | RDLH_LINK_UP) + +static bool s32g_has_data_phy_link(struct s32g_pcie *s32g_pp) +{ + u32 reg =3D s32g_pcie_readl_ctrl(s32g_pp, PCIE_S32G_PE0_LINK_DBG_2); + + if ((reg & PCIE_LINKUP) =3D=3D PCIE_LINKUP) { + switch (FIELD_GET(SMLH_LTSSM_STATE_MASK, reg)) { + case DW_PCIE_LTSSM_L0: + case DW_PCIE_LTSSM_L0S: + case DW_PCIE_LTSSM_L1_IDLE: + return true; + default: + return false; + } + } + + return false; +} + +static bool s32g_pcie_link_up(struct dw_pcie *pci) +{ + struct s32g_pcie *s32g_pp =3D to_s32g_from_dw_pcie(pci); + + if (!is_s32g_pcie_ltssm_enabled(s32g_pp)) + return false; + + return s32g_has_data_phy_link(s32g_pp); +} + +static int s32g_pcie_start_link(struct dw_pcie *pci) +{ + struct s32g_pcie *s32g_pp =3D to_s32g_from_dw_pcie(pci); + + s32g_pcie_enable_ltssm(s32g_pp); + + return 0; +} + +static void s32g_pcie_stop_link(struct dw_pcie *pci) +{ + struct s32g_pcie *s32g_pp =3D to_s32g_from_dw_pcie(pci); + + s32g_pcie_disable_ltssm(s32g_pp); +} + +static struct dw_pcie_ops s32g_pcie_ops =3D { + .get_ltssm =3D s32g_pcie_get_ltssm, + .link_up =3D s32g_pcie_link_up, + .start_link =3D s32g_pcie_start_link, + .stop_link =3D s32g_pcie_stop_link, +}; + +static void s32g_pcie_pme_turn_off(struct dw_pcie_rp *pp) +{ + struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); + struct s32g_pcie *s32g_pp =3D to_s32g_from_dw_pcie(pci); + u32 reg; + + reg =3D s32g_pcie_readl_ctrl(s32g_pp, PCIE_S32G_PE0_TX_MSG_REQ); + reg |=3D PME_TURN_OFF_REQ; + s32g_pcie_writel_ctrl(s32g_pp, PCIE_S32G_PE0_TX_MSG_REQ, reg); +} + +static const struct dw_pcie_host_ops s32g_pcie_host_ops =3D { + .pme_turn_off =3D s32g_pcie_pme_turn_off, +}; + +static void s32g_pcie_disable_equalization(struct dw_pcie *pci) +{ + u32 reg; + + reg =3D dw_pcie_readl_dbi(pci, GEN3_EQ_CONTROL_OFF); + reg &=3D ~(GEN3_EQ_CONTROL_OFF_FB_MODE | + GEN3_EQ_CONTROL_OFF_PSET_REQ_VEC); + reg |=3D FIELD_PREP(GEN3_EQ_CONTROL_OFF_FB_MODE, 1) | + FIELD_PREP(GEN3_EQ_CONTROL_OFF_PSET_REQ_VEC, 0x84); + + dw_pcie_dbi_ro_wr_en(pci); + dw_pcie_writel_dbi(pci, GEN3_EQ_CONTROL_OFF, reg); + dw_pcie_dbi_ro_wr_dis(pci); +} + +/* Configure the AMBA AXI Coherency Extensions (ACE) interface */ +static void s32g_pcie_reset_mstr_ace(struct dw_pcie *pci, u64 ddr_base_add= r) +{ + u32 ddr_base_low =3D lower_32_bits(ddr_base_addr); + u32 ddr_base_high =3D upper_32_bits(ddr_base_addr); + + dw_pcie_dbi_ro_wr_en(pci); + dw_pcie_writel_dbi(pci, COHERENCY_CONTROL_3_OFF, 0x0); + + /* + * Ncore is a cache-coherent interconnect module that enables the + * integration of heterogeneous coherent and non-coherent agents in + * the chip. Ncore Transactions to peripheral should be non-coherent + * or it might drop them. + * One example where this is needed are PCIe MSIs, which use NoSnoop=3D0 + * and might end up routed to Ncore. + * Define the start of DDR as seen by Linux as the boundary between + * "memory" and "peripherals", with peripherals being below. + */ + dw_pcie_writel_dbi(pci, COHERENCY_CONTROL_1_OFF, + (ddr_base_low & CFG_MEMTYPE_BOUNDARY_LOW_ADDR_MASK)); + dw_pcie_writel_dbi(pci, COHERENCY_CONTROL_2_OFF, ddr_base_high); + dw_pcie_dbi_ro_wr_dis(pci); +} + +static void s32g_init_pcie_controller(struct s32g_pcie *s32g_pp) +{ + struct dw_pcie *pci =3D &s32g_pp->pci; + u8 offset =3D dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); + u32 val; + + /* Set RP mode */ + val =3D s32g_pcie_readl_ctrl(s32g_pp, PCIE_S32G_PE0_GEN_CTRL_1); + val &=3D ~DEVICE_TYPE_MASK; + val |=3D DEVICE_TYPE(PCI_EXP_TYPE_ROOT_PORT); + + /* Use default CRNS */ + val &=3D ~SRIS_MODE; + + s32g_pcie_writel_ctrl(s32g_pp, PCIE_S32G_PE0_GEN_CTRL_1, val); + + /* Disable phase 2,3 equalization */ + s32g_pcie_disable_equalization(pci); + + /* + * Make sure we use the coherency defaults (just in case the settings + * have been changed from their reset values) + */ + s32g_pcie_reset_mstr_ace(pci, memblock_start_of_DRAM()); + + dw_pcie_dbi_ro_wr_en(pci); + + val =3D dw_pcie_readl_dbi(pci, PCIE_PORT_FORCE); + val |=3D PORT_FORCE_DO_DESKEW_FOR_SRIS; + dw_pcie_writel_dbi(pci, PCIE_PORT_FORCE, val); + + /* + * Set max payload supported, 256 bytes and + * relaxed ordering. + */ + val =3D dw_pcie_readl_dbi(pci, offset + PCI_EXP_DEVCTL); + val &=3D ~(PCI_EXP_DEVCTL_RELAX_EN | + PCI_EXP_DEVCTL_PAYLOAD | + PCI_EXP_DEVCTL_READRQ); + val |=3D PCI_EXP_DEVCTL_RELAX_EN | + PCI_EXP_DEVCTL_PAYLOAD_256B | + PCI_EXP_DEVCTL_READRQ_256B; + dw_pcie_writel_dbi(pci, offset + PCI_EXP_DEVCTL, val); + + /* Enable errors */ + val =3D dw_pcie_readl_dbi(pci, offset + PCI_EXP_DEVCTL); + val |=3D PCI_EXP_DEVCTL_CERE | + PCI_EXP_DEVCTL_NFERE | + PCI_EXP_DEVCTL_FERE | + PCI_EXP_DEVCTL_URRE; + dw_pcie_writel_dbi(pci, offset + PCI_EXP_DEVCTL, val); + + val =3D dw_pcie_readl_dbi(pci, GEN3_RELATED_OFF); + val |=3D GEN3_RELATED_OFF_EQ_PHASE_2_3; + dw_pcie_writel_dbi(pci, GEN3_RELATED_OFF, val); + + dw_pcie_dbi_ro_wr_dis(pci); +} + +static int s32g_init_pcie_phy(struct s32g_pcie *s32g_pp) +{ + struct dw_pcie *pci =3D &s32g_pp->pci; + struct device *dev =3D pci->dev; + int ret; + + ret =3D phy_init(s32g_pp->phy); + if (ret) { + dev_err(dev, "Failed to init serdes PHY\n"); + return ret; + } + + ret =3D phy_set_mode_ext(s32g_pp->phy, PHY_MODE_PCIE, 0); + if (ret) { + dev_err(dev, "Failed to set mode on serdes PHY\n"); + goto err_phy_exit; + } + + ret =3D phy_power_on(s32g_pp->phy); + if (ret) { + dev_err(dev, "Failed to power on serdes PHY\n"); + goto err_phy_exit; + } + + return 0; + +err_phy_exit: + phy_exit(s32g_pp->phy); + return ret; +} + +static int s32g_deinit_pcie_phy(struct s32g_pcie *s32g_pp) +{ + struct dw_pcie *pci =3D &s32g_pp->pci; + struct device *dev =3D pci->dev; + int ret; + + ret =3D phy_power_off(s32g_pp->phy); + if (ret) { + dev_err(dev, "Failed to power off serdes PHY\n"); + return ret; + } + + ret =3D phy_exit(s32g_pp->phy); + if (ret) { + dev_err(dev, "Failed to exit serdes PHY\n"); + return ret; + } + + return 0; +} + +static int s32g_pcie_init(struct device *dev, + struct s32g_pcie *s32g_pp) +{ + int ret; + + s32g_pcie_disable_ltssm(s32g_pp); + + ret =3D s32g_init_pcie_phy(s32g_pp); + if (ret) + return ret; + + s32g_init_pcie_controller(s32g_pp); + + return 0; +} + +static void s32g_pcie_deinit(struct s32g_pcie *s32g_pp) +{ + s32g_pcie_disable_ltssm(s32g_pp); + s32g_deinit_pcie_phy(s32g_pp); +} + +static int s32g_pcie_host_init(struct s32g_pcie *s32g_pp) +{ + struct dw_pcie *pci =3D &s32g_pp->pci; + struct dw_pcie_rp *pp =3D &pci->pp; + int ret; + + pp->ops =3D &s32g_pcie_host_ops; + + ret =3D dw_pcie_host_init(pp); + + return ret; +} + +static int s32g_pcie_get_resources(struct platform_device *pdev, + struct s32g_pcie *s32g_pp) +{ + struct device *dev =3D &pdev->dev; + struct dw_pcie *pci =3D &s32g_pp->pci; + + s32g_pp->phy =3D devm_phy_get(dev, NULL); + if (IS_ERR(s32g_pp->phy)) + return dev_err_probe(dev, PTR_ERR(s32g_pp->phy), + "Failed to get serdes PHY\n"); + s32g_pp->ctrl_base =3D devm_platform_ioremap_resource_byname(pdev, "ctrl"= ); + if (IS_ERR(s32g_pp->ctrl_base)) + return PTR_ERR(s32g_pp->ctrl_base); + + pci->dbi_base =3D devm_platform_ioremap_resource_byname(pdev, "dbi"); + if (IS_ERR(pci->dbi_base)) + return PTR_ERR(pci->dbi_base); + + pci->dev =3D dev; + pci->ops =3D &s32g_pcie_ops; + + platform_set_drvdata(pdev, s32g_pp); + + return 0; +} + +static int s32g_pcie_probe(struct platform_device *pdev) +{ + struct device *dev =3D &pdev->dev; + struct s32g_pcie *s32g_pp; + int ret; + + s32g_pp =3D devm_kzalloc(dev, sizeof(*s32g_pp), GFP_KERNEL); + if (!s32g_pp) + return -ENOMEM; + + ret =3D s32g_pcie_get_resources(pdev, s32g_pp); + if (ret) + return ret; + + pm_runtime_no_callbacks(dev); + devm_pm_runtime_enable(dev); + ret =3D pm_runtime_get_sync(dev); + if (ret < 0) + goto err_pm_runtime_put; + + ret =3D s32g_pcie_init(dev, s32g_pp); + if (ret) + goto err_pm_runtime_put; + + ret =3D s32g_pcie_host_init(s32g_pp); + if (ret) + goto err_pcie_deinit; + + return 0; + +err_pcie_deinit: + s32g_pcie_deinit(s32g_pp); +err_pm_runtime_put: + pm_runtime_put(dev); + + return ret; +} + +static int s32g_pcie_suspend_noirq(struct device *dev) +{ + struct s32g_pcie *s32g_pp =3D dev_get_drvdata(dev); + struct dw_pcie *pci =3D &s32g_pp->pci; + + if (!dw_pcie_link_up(pci)) + return 0; + + return dw_pcie_suspend_noirq(pci); +} + +static int s32g_pcie_resume_noirq(struct device *dev) +{ + struct s32g_pcie *s32g_pp =3D dev_get_drvdata(dev); + struct dw_pcie *pci =3D &s32g_pp->pci; + + s32g_init_pcie_controller(s32g_pp); + + return dw_pcie_resume_noirq(pci); +} + +static const struct dev_pm_ops s32g_pcie_pm_ops =3D { + NOIRQ_SYSTEM_SLEEP_PM_OPS(s32g_pcie_suspend_noirq, + s32g_pcie_resume_noirq) +}; + +static const struct of_device_id s32g_pcie_of_match[] =3D { + { .compatible =3D "nxp,s32g2-pcie"}, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, s32g_pcie_of_match); + +static struct platform_driver s32g_pcie_driver =3D { + .driver =3D { + .name =3D "s32g-pcie", + .of_match_table =3D s32g_pcie_of_match, + .suppress_bind_attrs =3D true, + .pm =3D pm_sleep_ptr(&s32g_pcie_pm_ops), + .probe_type =3D PROBE_PREFER_ASYNCHRONOUS, + }, + .probe =3D s32g_pcie_probe, +}; + +module_platform_driver(s32g_pcie_driver); + +MODULE_AUTHOR("Ionut Vicovan "); +MODULE_DESCRIPTION("NXP S32G PCIe Host controller driver"); +MODULE_LICENSE("GPL"); --=20 2.43.0 From nobody Sun Feb 8 22:17:41 2026 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D56A32D8372 for ; Wed, 22 Oct 2025 17:43:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761155002; cv=none; b=aUkyElH2SRTl2etTXhx/9AC5HP46ArtLf6ZdJ1QrgLNDeN5nsgmydjah44mWLbQSpDAjivootyQ98F4sPiWQxSpi9UE8rONCJno88pHVa0UBVx+E/AQoYQ/sbIHQPOt+mdugqJFhdc9lLPn72bb6IWZjH9YCLvUBQQuCaAqxYDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761155002; c=relaxed/simple; bh=pebkCgjq2t7R/8JhhzKY0KYiQYww5PdgMrly8jY12Ow=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SuCx37W/eTV7426cWTvqWuHzQRn5TxEJtIRE3Thqo5bG/8+Yyn9ZpTTnokoxTUhsKjuB0JWjrOEy+Er6/+xGEXkwtEfKUHRLRpusy5S0xLS3e5433Ndr3Efl9hyRvg52vbBuXRtS8g9zw0Y2xxhDtkfoxWEB+F97CbK8HvEAlDI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=oNnzfZeA; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oNnzfZeA" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-42701b29a7eso806888f8f.0 for ; Wed, 22 Oct 2025 10:43:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761154998; x=1761759798; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DBgZ5OtYg07NCXp61kXr/BSbIWhE2fs8T+/yOfxFjCU=; b=oNnzfZeAzg9okwy0bKEyYuUIuYr4oexT+gBg+RSOAjwRHpWtgvPu7fgFDmYiPRbXqI 6tKoz/1AMxOKEko8xgPQrOWwC7P39+sZ+IH2BQ8ViOILGuUfjQdIW0fdybVmQDT6iRhK eF2450YMmjC+Y2e3F0Ch9U0500cjyzVyT7JZEE+Juy2twckYEmK6MmnpUX2Cd2XDQFVD sUQvagOUpCp1RuqLYjdPALLkih2bMo26EzRCpqw8rB0P8OQQ7BZGM5WCMUk6cU7IR/L8 it9ixpe4rZH6GPcUiW/0FvAiFf8JxZp/wm8b1IYd/AiSreeI7WiU6sFk9s8DOIVwiT2w +tPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761154998; x=1761759798; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DBgZ5OtYg07NCXp61kXr/BSbIWhE2fs8T+/yOfxFjCU=; b=TEk16yc+sGKzSX3NQPjSwv6DcABchTQb0tUGl+cS03GkXBwA+L7YfhKIRMGDtL84r/ 0va6AMbD6z1cHxQnWG3g4uxCOe1rPCrqHjMPtIiYcZOZIGtkzJ/1jOkH4txkM7FB380v vMkdpsHtXO3ZS5NUfP085tj3pbJFZyMCkq5hlxjWUUKIF9139DYE4ciEj881er00S92e 1IJb/SvTK+CJjc1l1MZjtFkFIAGKUycRJvIdOxR/FKfWhGk9CfSzR+QC5bOI/mbtomzd y39pJDRbp4VcVzf1kz91Klz2NwTaoQCvAuGRiZqEUpdrYjXBclFlS7D+pX8pvqPsGZQW 9NGA== X-Forwarded-Encrypted: i=1; AJvYcCXKulNKefIgaYtihrJb2KBTo3ijiX7BVRjZywMeTChjSVbEy3pG2c1AGlPY9QpV4xbpR3jGRJB7QjGMC9s=@vger.kernel.org X-Gm-Message-State: AOJu0Yz6g/0bt12BBGmYGOjREVbqBQYP4MJIKTA0vxYQR3wfMqVbj1Fq pEVt6ggf9OQNX0e1b0Tr8PUsOz/ANr6GZ9Gl5/BhJj/smZdePbNk5ZWWJQkaFPFUg8c= X-Gm-Gg: ASbGnct9DwAB3eZUHMIVBT+uWQP0IDxgm/j6h+F0aohoRcbSjy9YT2tox07ktNwuI/U PN/Qk/kkAfdjVV2YVzwYXK7re89jnyHTOkeLGcBuSAGukEiADOTPRt9rkk6yrZqGJGyK1R7mrur Xd68JsqhNL/jv5F3JCIrCeguE2pa0X1OBhn3rr8B/n69IkhelGcy5SoAbWVTEQpdQDkG4soqm9D 4iI2UA3EitDb6xfhtQJBV6lM+GOlPXhKPDzlbOOFNXNvNe3Q+CHN3AeMZLbOz9EBXcjMejWsczV ZystchqcYIyPdDypbGCxG44MgRPBKZIrx6RLeGq4QG7OflaGZm1oRUaofNno8YNyOtGQcQPLeli CaarhucKntizZghD9etK8t1Gtb3pFGR1ZaFwmLvSqW1AI3BHbHBYaEd7zfvnum9OVXqOqAdFGzk loCZkdo7VG X-Google-Smtp-Source: AGHT+IFjziwUg1Dl3LOqBcFgSgns22D4G3uLdqScO3DNYkyYm03zLF/NNOMCJcEGGUm1q7BfvTYL1w== X-Received: by 2002:a05:6000:2289:b0:427:84a:6db1 with SMTP id ffacd0b85a97d-42856a8c525mr2170414f8f.31.1761154998227; Wed, 22 Oct 2025 10:43:18 -0700 (PDT) Received: from vingu-cube.. ([2a01:e0a:f:6020:edfc:89e3:4805:d8de]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47494aad668sm43434755e9.2.2025.10.22.10.43.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Oct 2025 10:43:16 -0700 (PDT) From: Vincent Guittot To: chester62515@gmail.com, mbrugger@suse.com, ghennadi.procopciuc@oss.nxp.com, s32@nxp.com, bhelgaas@google.com, jingoohan1@gmail.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, Ionut.Vicovan@nxp.com, larisa.grigore@nxp.com, Ghennadi.Procopciuc@nxp.com, ciprianmarian.costea@nxp.com, bogdan.hamciuc@nxp.com, Frank.li@nxp.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Cc: cassel@kernel.org Subject: [PATCH 4/4 v3] MAINTAINERS: Add MAINTAINER for NXP S32G PCIe driver Date: Wed, 22 Oct 2025 19:43:09 +0200 Message-ID: <20251022174309.1180931-5-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251022174309.1180931-1-vincent.guittot@linaro.org> References: <20251022174309.1180931-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a new entry for S32G PCIe driver. Signed-off-by: Vincent Guittot Reviewed-by: Frank Li --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 545a4776795e..e542aae55556 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3132,6 +3132,15 @@ F: arch/arm64/boot/dts/freescale/s32g*.dts* F: drivers/pinctrl/nxp/ F: drivers/rtc/rtc-s32g.c =20 +ARM/NXP S32G PCIE CONTROLLER DRIVER +M: Ghennadi Procopciuc +R: NXP S32 Linux Team +L: imx@lists.linux.dev +L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) +S: Maintained +F: Documentation/devicetree/bindings/pci/nxp,s32g-pcie.yaml +F: drivers/pci/controller/dwc/pcie-nxp-s32g* + ARM/NXP S32G/S32R DWMAC ETHERNET DRIVER M: Jan Petrous R: s32@nxp.com --=20 2.43.0