From nobody Tue Dec 2 02:20:16 2025 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 EAC5B26F2A1 for ; Wed, 19 Nov 2025 14:35:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763562944; cv=none; b=o8hS0D011CkVqRXgZ8/g6+kyIXbiFQ5rCYR5FIUzxgzzeTHEtSuFT2IBCuuwNdhwtxRDqkVaDBaxsGcm4NJP+QkUPpaEmQNYLMYDmcwbrwp2An6Q+JETXWPeXtjbm/huGN5Emdh3Qgt84X2rCPlj0RNhi3LYC0f1oD2WDxqDt1I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763562944; c=relaxed/simple; bh=2s1ldoDAAOCeqI4vXy6t0+kpm4QSYz/W+/sVKlzITXo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fbHuZeitpdSP5CssSLgpNxtYa2roHHC98Vl+VQ7AGUWVHggdNplcLnppZwzHpZ6YXT54ukUI5bsBEYHO6ruoNf9uT17sU/WQfV9qbEZFvplJntglZ+uj2kBG97/KWug/OuQdCAwm+Epj4zs+wdNTTM9ELMmcG2jRHiBbbnpEFps= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=Wq8ejWvl; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="Wq8ejWvl" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-42b3c965ca9so3533908f8f.1 for ; Wed, 19 Nov 2025 06:35:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1763562940; x=1764167740; 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=i9I9xzbVBEVmP862tUzbCY7lncO0qWsliO++ye7NN98=; b=Wq8ejWvlyGZuEJv74S32SZtnEw8mbJkC48a7QVr65GjW0jz6I+T4RBaRN8gm3+GMHs ZjnxMD4Wa59prnvZxt1v+X0w8gQbPE+uYSiTdiqBSmtFsY1+fRlbBwFP3JOVDJpF2NbU jkZTaVs9CZ39RFjwLfgvF2ibn/+HXW94feboC2pkq3DNtgaBd4Q4EmrE7QdhSPXeu8KB yUmt2vhB7zgDeW8MAwowanJciZcPSR6MlL3cW2zOZpQnS3faX9O3VgPUg9n0Yk3mXydb 94MvxdkWNtxm8NRZ14Ba0zrqz2UyD4DUfvvvYedHLlsjqlj4N5aEKpkjShliQU4ax5VT OK1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763562940; x=1764167740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=i9I9xzbVBEVmP862tUzbCY7lncO0qWsliO++ye7NN98=; b=nwxjYK/n5AvPw5fuyXUlwcV5uu1eO982k9TeduH8qGPnlMQ6NwwbS97r8J04NCNJhN qRV8W+79sRQMkJOXhm2/+/GpwTo0PMZNsigbEPHmLR56svf/oB/2EI28T91LzXLbnROA BYw7AzPogvfQ50ihXTWbrG3qOiG5ochpvvVFZsCx5p/XGu1jxBBjHycQBdAmQD6++znd K/R0U6CllqO8BJJlVLDCtZYSJfA4J/H4jnT51dVzRf3BdfEK1Mw69ndH9hrlyMrxWXeJ 7tpNqkZ3GF/m6R6grM1RVvrZSlEstw7kKehySDEeRQa3SEkYTPXZJWgPptzfA0O/8iMP Xp+w== X-Forwarded-Encrypted: i=1; AJvYcCU+DjyXhYirbHtgAzmXsINDbNMqeD3QeBMgOlqA6kxWrHBfDwBCay2ajC6M53LD6f5926/5TJVggS12Ovo=@vger.kernel.org X-Gm-Message-State: AOJu0Yzp1bIiWHcquhGUwwpaRrTYRnndSGlQB+caDINZYUsohbcREFW5 7ATkKtLopPlWPIi8cxDmo+Pf5Pt8P+YyxICCrfvIJeTO7QZSbb0b78wR5OP5rDBOvApCtQJSfu9 v2QQCswg= X-Gm-Gg: ASbGnctbL/zvIwRdD3aakeFzYs3As+q8P56IebTiVIMOfpaaDJxAog8Pxk69DuQ30bC TCKb5V+VMJyjR8hNyeWCqAoakirswBJ7Ut+Yj4ShrW3vzUxN95zB2EYEdDwQnFIF8ivCQ2BDbxq jg0DNce7lv/R75zV51UcDAg90SmQKgQAuuMOrO5jQ4Je7owW1rwCBPUggankSJCi76y32fqZSLt Xz5FcsEdobhvnn83uXHOTsfSHoOrBHazK1BMhlnsxCVL7hIIfZU+AHMQjok9JK5sgpbI9GfIkmN DrSodndLg5haUnghV7zttIaJRoKOxo6EQjtZTrpD8vMybRowo5PjinfZ8UsBl8GF8l1jvZapsPU RjUcQylVvWfaSRLiAiYmG4s16cH9gG8gxPvjcENRpwUZ6jG+ybEfJjuLWXNNH2MyhwbJOePGdZj Vvt1QuyZ2H4XFQrAYYm+PZdSZgIYbj1D7vbFUbMfEdUR5aeC6bVrc= X-Google-Smtp-Source: AGHT+IGfTUIBKGBMAFy1O/INhjzO03xKvUpP9DH1xWfi1tpg5N/KvvRX49nQ3sxqtiJYDXL48Jtjeg== X-Received: by 2002:a05:6000:2510:b0:42b:3268:bfc0 with SMTP id ffacd0b85a97d-42cb1fb9eb4mr2697621f8f.49.1763562940263; Wed, 19 Nov 2025 06:35:40 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.134]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53f0b894sm39973399f8f.26.2025.11.19.06.35.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 06:35:39 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: bhelgaas@google.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, p.zabel@pengutronix.de Cc: claudiu.beznea@tuxon.dev, linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH v8 1/6] dt-bindings: PCI: renesas,r9a08g045s33-pcie: Add Renesas RZ/G3S Date: Wed, 19 Nov 2025 16:35:18 +0200 Message-ID: <20251119143523.977085-2-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119143523.977085-1-claudiu.beznea.uj@bp.renesas.com> References: <20251119143523.977085-1-claudiu.beznea.uj@bp.renesas.com> 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" From: Claudiu Beznea The PCIe IP available on the Renesas RZ/G3S complies with the PCI Express Base Specification 4.0. It is designed for root complex applications and features a single-lane (x1) implementation. Add documentation for it. Reviewed-by: Rob Herring (Arm) Signed-off-by: Claudiu Beznea --- Changes in v8: - none Changes in v7: - collected tags Changes in v6: - updated the patch title - described the functionalites that system controller has for PCIe=20 - dropped /schemas/pci/pci-device.yaml# from allOf section - dropped max-link-speed from example - dropped pcie_port0 label from example Changes in v5: - dropped Tb tag - style updates to the dma-ranges and ranges properties from examples section - re-enabled the node from examples section Changes in v4: - dropped "s33" string from compatible name - added port node documentation; due to this dropped Rob's Rb tag - reorderded properties - dropped spaces b/w "INT" and "A", "B", "C", "D" in comments Changes in v3: - collected tags - updated the flags of ranges property from example Changes in v2: - update the interrupt names by dropping "int" and "rc" string; due to this the patch description was adjusted - added "interrupt-controller" and made it mandatory - s/clkl1pm/pm/g - dropped the legacy-interrupt-controller node; with this the gic interrupt controller node was dropped as well as it is not needed anymore - updated interrupt-map in example and added interrupt-controller - added clock-names as required property as the pm clock is not handled though PM domains; this will allow the driver to have the option to request the pm clock by its name when implementation will be adjusted to used the pm clock - adjusted the size of dma-ranges to reflect the usage on SMARC module board - moved "renesas,sysc" at the end of the node in example to align with dts coding style .../bindings/pci/renesas,r9a08g045-pcie.yaml | 249 ++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/renesas,r9a08g045= -pcie.yaml diff --git a/Documentation/devicetree/bindings/pci/renesas,r9a08g045-pcie.y= aml b/Documentation/devicetree/bindings/pci/renesas,r9a08g045-pcie.yaml new file mode 100644 index 000000000000..d668782546a2 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/renesas,r9a08g045-pcie.yaml @@ -0,0 +1,249 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/renesas,r9a08g045-pcie.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas RZ/G3S PCIe host controller + +maintainers: + - Claudiu Beznea + +description: + Renesas RZ/G3S PCIe host controller complies with PCIe Base Specification + 4.0 and supports up to 5 GT/s (Gen2). + +properties: + compatible: + const: renesas,r9a08g045-pcie # RZ/G3S + + reg: + maxItems: 1 + + interrupts: + items: + - description: System error interrupt + - description: System error on correctable error interrupt + - description: System error on non-fatal error interrupt + - description: System error on fatal error interrupt + - description: AXI error interrupt + - description: INTA interrupt + - description: INTB interrupt + - description: INTC interrupt + - description: INTD interrupt + - description: MSI interrupt + - description: Link bandwidth interrupt + - description: PME interrupt + - description: DMA interrupt + - description: PCIe event interrupt + - description: Message interrupt + - description: All interrupts + + interrupt-names: + items: + - description: serr + - description: ser_cor + - description: serr_nonfatal + - description: serr_fatal + - description: axi_err + - description: inta + - description: intb + - description: intc + - description: intd + - description: msi + - description: link_bandwidth + - description: pm_pme + - description: dma + - description: pcie_evt + - description: msg + - description: all + + interrupt-controller: true + + clocks: + items: + - description: System clock + - description: PM control clock + + clock-names: + items: + - description: aclk + - description: pm + + resets: + items: + - description: AXI2PCIe Bridge reset + - description: Data link layer/transaction layer reset + - description: Transaction layer (ACLK domain) reset + - description: Transaction layer (PCLK domain) reset + - description: Physical layer reset + - description: Configuration register reset + - description: Configuration register reset + + reset-names: + items: + - description: aresetn + - description: rst_b + - description: rst_gp_b + - description: rst_ps_b + - description: rst_rsm_b + - description: rst_cfg_b + - description: rst_load_b + + power-domains: + maxItems: 1 + + dma-ranges: + description: + A single range for the inbound memory region. + maxItems: 1 + + renesas,sysc: + description: | + System controller registers control and monitor various PCIe + functionalities. + + Control: + - transition to L1 state + - receiver termination settings + - RST_RSM_B signal + + Monitor: + - clkl1pm clock request state + - power off information in L2 state + - errors (fatal, non-fatal, correctable) + $ref: /schemas/types.yaml#/definitions/phandle + +patternProperties: + "^pcie@0,[0-0]$": + type: object + allOf: + - $ref: /schemas/pci/pci-pci-bridge.yaml# + + properties: + reg: + maxItems: 1 + + vendor-id: + const: 0x1912 + + device-id: + const: 0x0033 + + clocks: + items: + - description: Reference clock + + clock-names: + items: + - const: ref + + required: + - device_type + - vendor-id + - device-id + - clocks + - clock-names + + unevaluatedProperties: false + +required: + - compatible + - reg + - clocks + - clock-names + - resets + - reset-names + - interrupts + - interrupt-names + - interrupt-map + - interrupt-map-mask + - interrupt-controller + - power-domains + - "#address-cells" + - "#size-cells" + - "#interrupt-cells" + - renesas,sysc + +allOf: + - $ref: /schemas/pci/pci-host-bridge.yaml# + +unevaluatedProperties: false + +examples: + - | + #include + #include + + bus { + #address-cells =3D <2>; + #size-cells =3D <2>; + + pcie@11e40000 { + compatible =3D "renesas,r9a08g045-pcie"; + reg =3D <0 0x11e40000 0 0x10000>; + ranges =3D <0x02000000 0 0x30000000 0 0x30000000 0 0x08000000>; + /* Map all possible DRAM ranges (4 GB). */ + dma-ranges =3D <0x42000000 0 0x40000000 0 0x40000000 1 0x00000= 000>; + bus-range =3D <0x0 0xff>; + interrupts =3D , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + ; + interrupt-names =3D "serr", "serr_cor", "serr_nonfatal", + "serr_fatal", "axi_err", "inta", + "intb", "intc", "intd", "msi", + "link_bandwidth", "pm_pme", "dma", + "pcie_evt", "msg", "all"; + #interrupt-cells =3D <1>; + interrupt-controller; + interrupt-map-mask =3D <0 0 0 7>; + interrupt-map =3D <0 0 0 1 &pcie 0 0 0 0>, /* INTA */ + <0 0 0 2 &pcie 0 0 0 1>, /* INTB */ + <0 0 0 3 &pcie 0 0 0 2>, /* INTC */ + <0 0 0 4 &pcie 0 0 0 3>; /* INTD */ + clocks =3D <&cpg CPG_MOD R9A08G045_PCI_ACLK>, + <&cpg CPG_MOD R9A08G045_PCI_CLKL1PM>; + clock-names =3D "aclk", "pm"; + resets =3D <&cpg R9A08G045_PCI_ARESETN>, + <&cpg R9A08G045_PCI_RST_B>, + <&cpg R9A08G045_PCI_RST_GP_B>, + <&cpg R9A08G045_PCI_RST_PS_B>, + <&cpg R9A08G045_PCI_RST_RSM_B>, + <&cpg R9A08G045_PCI_RST_CFG_B>, + <&cpg R9A08G045_PCI_RST_LOAD_B>; + reset-names =3D "aresetn", "rst_b", "rst_gp_b", "rst_ps_b", + "rst_rsm_b", "rst_cfg_b", "rst_load_b"; + power-domains =3D <&cpg>; + device_type =3D "pci"; + #address-cells =3D <3>; + #size-cells =3D <2>; + renesas,sysc =3D <&sysc>; + + pcie@0,0 { + reg =3D <0x0 0x0 0x0 0x0 0x0>; + ranges; + clocks =3D <&versa3 5>; + clock-names =3D "ref"; + device_type =3D "pci"; + vendor-id =3D <0x1912>; + device-id =3D <0x0033>; + #address-cells =3D <3>; + #size-cells =3D <2>; + }; + }; + }; + +... --=20 2.43.0 From nobody Tue Dec 2 02:20:16 2025 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 9E0D5364037 for ; Wed, 19 Nov 2025 14:35:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763562953; cv=none; b=d4vvj4ETTqKbi0zbwX5wBzun4ZeFvyen71VYv/cS+m/vKeIPVwqptwoD7MOLx5Bw3Imr5YSsrnnusGGFg5SpgCCUhGe9hl/GQss671VU2TUHyvLjvHZIInlEk5bBW0nNnZzzb3JYP7uXBUBiJ7qgkPVc8aYj4Ln+rCVP7jkvEVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763562953; c=relaxed/simple; bh=1oW+e+sOq3fUUwlzTxAnjkep7CH6/4accWqamKdYlVs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=USDfl1VWm4Id1GMXGEK+zR/i7g85s2MwgiiY1PY17W3XT97r4UVZRKydomC5PZFgfYtb3U7azTfC/PikguFR2ZdQhGInzpjV8IWzgROahPWrBpYPoWOar5H/ZMvluqJ+RYp/lCAHudruJzY69jG1MGVcJAtTIMtAQ97jcyAouaQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=nNnx18gP; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="nNnx18gP" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-42b427cda88so4879801f8f.0 for ; Wed, 19 Nov 2025 06:35:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1763562947; x=1764167747; 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=tRcuL6HnhTwvVHEu/6G9AVdhXtj+JzeDQErjGrNG0cM=; b=nNnx18gPenbgYOebmW95qjTdYYe6G+21FVdZ5S364ysBehOik4CsqMT26s6c12pfIJ qkNxCUyl3MiCC1tgkqzziWnKYUH5JycwyCTbmGCX1ltEM8qQLeHSJkXh7m5m6xKk2qjT 9qX9iNe/Pq7B/sS01swnp+r2cBtLmEm4SFR1fNr0yHKop5Kd8ezpOghiXzslyOM84Xl7 3KcIq1nNYY3a3X4m+1ODO0sZExE00Q6d/sH3dz+u4tUa3k58DeoIC9a0U8dRvPc3yPs8 XC/0m5JAxS7p+jYzNhRTNqm6haPje01KWkRbORTtItu2blmhQyYFhWrBUqSjP1lglU2W d6Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763562947; x=1764167747; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=tRcuL6HnhTwvVHEu/6G9AVdhXtj+JzeDQErjGrNG0cM=; b=pyYa1/DoLY90eaHIhNqsrRe7B1Qm2zmrbJjx6nZ7swM8qNYhAJgOqrcx41AEawOgwO Wwu60K9sPRaJp8yz+2ZigyuYhoH6pFn1sXqQAJFqRVUSNFT2NSjIP/1kVeBnxYWiYh07 qohGvkNvSiCO2EYTTk6UVvtOLkkmzFDATL9Uj/uSe3wz50z0W8fhaHHfV65PCO1jD3/Q ut+69EKJS0tYbl1t09B4bSGeu3ph/7/7FJpFIh5n7zzh6pI8Ozfr45nkfMvWQyJd38db KyFKKT0F37CFZ52JtErgjzzjzwBPudcdBvJt21/pmkpplR8VMC87pkdmlqFjhLbXmBoy ABhA== X-Forwarded-Encrypted: i=1; AJvYcCVxGQnnS2eLum4niUKVznKPMlVQHz0W+o3pjv5GMbblkRrS8yXMBhNVhkgoG9IebxlYsPx1R5yH/UFN2OA=@vger.kernel.org X-Gm-Message-State: AOJu0Yx1x28PO4nEXgiWGc5OhqZtgsF13Ri28LajUmNTIToaCPOSSppD vh5AJiq2Hf4Qszn2ig/3Fp7iY/JmoY5kfUpZt8EHTO8xc1o7rdqx55I71GZL9elPxTQ= X-Gm-Gg: ASbGncvnqyJDcKtn7kWEWLby08mf29+/FerKnMgvE26697B1OrS3pt183kiYsB/2SHV ByR01w6KQPCPaBbZegeh2Ul0JcPPmW6aH5AZGYf3pHBmrdzaOftxtcM7xhsm/LKUKP1knEzL5R5 T7kxAQMaClLjTQAb0pCI6IEd8f7tUbERN4z5bS2YBuF9WTt1JR4sJC8dtz0G+xUgUl/unS+V32t uWoU6+aUKQ2pXFWFFBZSp9YvS8ZSQWI846W5jDC3vxQyy0tdteFAJGFL1s0WM8MlmKQOzFUbJxt y+YKL9+Pj2DPTZW2QdglEZ7NfPQPgTJ7JyaBRECbwuZlwv+VnUv6YoctkQRd+gQ2C6r0j/mAKF5 1EaDqf0NhWWQ329fiy7n0IxwqdEkKbCScujMg5sf6ZtOVr0Jt8RF5vlF/2J+IpZSn3UBBagx/JH Y1IWa6ZpMlgWRmL8+3ju35X9QFWjjrqIox9JxryKxJ2thuCnMa8iC6HF3xhozdag== X-Google-Smtp-Source: AGHT+IF/gyJDxCGEWujpDrVGN2/wHKyEqJjXOyuvx4tXnZLM6I4sKmoqMTxkRcmcVzUUu2X0GPZyEQ== X-Received: by 2002:a05:6000:430e:b0:42b:3c3e:5d2f with SMTP id ffacd0b85a97d-42b593678aamr19816262f8f.39.1763562943687; Wed, 19 Nov 2025 06:35:43 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.134]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53f0b894sm39973399f8f.26.2025.11.19.06.35.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 06:35:42 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: bhelgaas@google.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, p.zabel@pengutronix.de Cc: claudiu.beznea@tuxon.dev, linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea , Wolfram Sang Subject: [PATCH v8 2/6] PCI: rzg3s-host: Add Renesas RZ/G3S SoC host driver Date: Wed, 19 Nov 2025 16:35:19 +0200 Message-ID: <20251119143523.977085-3-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119143523.977085-1-claudiu.beznea.uj@bp.renesas.com> References: <20251119143523.977085-1-claudiu.beznea.uj@bp.renesas.com> 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" From: Claudiu Beznea The Renesas RZ/G3S features a PCIe IP that complies with the PCI Express Base Specification 4.0 and supports speeds of up to 5 GT/s. It functions only as a root complex, with a single-lane (x1) configuration. The controller includes Type 1 configuration registers, as well as IP specific registers (called AXI registers) required for various adjustments. Hardware manual can be downloaded from the address in the "Link" section. The following steps should be followed to access the manual: 1/ Click the "User Manual" button 2/ Click "Confirm"; this will start downloading an archive 3/ Open the downloaded archive 4/ Navigate to r01uh1014ej*-rzg3s-users-manual-hardware -> Deliverables 5/ Open the file r01uh1014ej*-rzg3s.pdf Link: https://www.renesas.com/en/products/rz-g3s?queryID=3D695cc067c2d89e3f= 271d43656ede4d12 Tested-by: Wolfram Sang Signed-off-by: Claudiu Beznea --- Changes in v8: - in struct rzg3s_pcie_host: moved "struct rzg3s_pcie_port port" near "struct rzg3s_pcie_msi msi" to avoid any padding, if any - in rzg3s_pcie_root_write(): propagate the return value of pci_generic_config_write() - in rzg3s_pcie_init_msi(): use msi->irq instead of irq in the debug message - in rzg3s_pcie_set_max_link_speed(): s/lcs/ls/g to reflect the name of the read register - in rzg3s_pcie_host_setup(): s/doamin/domain=20 Changes in v7: - rebased on top of v6.18-rc1 Changes in v6: - split the help message from Kconfig to 80 chars - dropped unused defines - dropped dot at the end of short comments - re-arranged the members of rzg3s_pcie_child_prepare_bus(), rzg3s_pcie_child_read_conf(), rzg3s_pcie_child_write_conf(), rzg3s_pcie_root_map_bus() to save few lines - in rzg3s_pcie_irq_compose_msi_msg() drop drop_mask and use RZG3S_PCI_MSIRCVWADRL_MASK - merge INTx and MSI configuration in rzg3s_pcie_init_irqdomain(); with it, rzg3s_pcie_host_setup() takes now only 2 function pointer for IRQ domain config and teardown; also, updated the names of other functions to match the most used pattern accross other drivers: -- rzg3s_pcie_msi_enable() -> rzg3s_pcie_init_msi() -- rzg3s_pcie_host_parse_root_port() -> rzg3s_pcie_host_parse_port() -- rzg3s_pcie_host_init_root_port() -> rzg3s_pcie_host_init_port()=20 - used dev_fwnode() instead of of_fwnode_handle() - used fsleep() instead of usleep_range() - pass "size - 1" to rzg3s_pcie_set_inbound_window() only and keep the undecremented value in the calling function - added a comment on top of request_irq() to explain why devm_ variant was not used Changes in v5: - replaced devm action or resets with gotos - s/writeb/writeb_relaxed/g - s/readw/readw_relaxed/g - s/readl/readl_relaxed/g - s/writel/writel_relaxed/g - dropped rzg3s_pcie_child_ops::map_bus, rename rzg3s_pcie_child_map_bus() (that was used to instantiate rzg3s_pcie_child_ops::map_bus) to rzg3s_pcie_child_prepare_bus() and used it directly in rzg3s_pcie_child_read_conf() and rzg3s_pcie_child_write_conf() - convert the 3rd argument of readl_poll_timeout() to microseconds - set rzg3s_pcie_driver.driver.probe_type =3D PROBE_PREFER_ASYNCHRONOUS Changes in v4: - updated patch title - drop the option to build the driver as module - make it dependent on IRQ_MSI_LIB and adjust the code to use this library - added code to parse and set PCIe port; moved device ID, vendor ID setup under port configuration; added reference clock setup to the port (which was missed previously); moved the PHY setup on port specific setup function - used of_pci_get_max_link_speed() to get the maximum available link speed from device tree; with this updated the logic that set the max link speed - simplified the logic in rzg3s_pcie_child_issue_request() - set the type of access in rzg3s_pcie_child_write_conf/rzg3s_pcie_child_re= ad_conf() - added comment on rzg3s_pcie_root_write() about the used lock for serializ= ation - added RZG3S_PCI_MSIRCVWMSKL_MASK mask and use it properly to set the MSI size - fixed typos, dropped "link up" log on probe - updated the error message on inbound/outbound window failure setup along with the returning code - used unsigned int type for the counter in for loops from rzg3s_soc_pcie_init_phy() - dropped unnecessary comments - moved msleep(PCIE_RESET_CONFIG_WAIT_MS) in rzg3s_pcie_host_setup() to allow resume path to also benefit of it - drop the power reset de-assert from rzg3s_pcie_resets_prepare(), rename rzg3s_pcie_resets_prepare() into rzg3s_pcie_resets_prepare_and_get() to reflect that rzg3s_pcie_resets_prepare_and_get() only allocate memory for resets and get them; the power resets are now de-asserted outside of rzg3s_pcie_resets_prepare_and_get() - add a comment for pm_runtime_resume_and_get() to reflect it is used to power the clock domain the controller belongs to Changes in v3: - updated patch description with link to the hardware manual and steps to access it - included to solve compilation errors - used devm_mutex_init() - used SZ_4K instead of 4096 - dropped PCIe register defines and used the ones from include/uapi/linux/pci_regs.h; added RZG3S_PCI_CFG_PCIEC as the starting offset of the capabilities to be used before the host bridge is registered - added blank lines around registers and bitfields defines - kept the defines for bitfies in order (from MSB to LSB) - dropped timeout defines (except RZG3S_REQ_ISSUE_TIMEOUT_US) and used the ones from ../pci.h - dropped rzg3s_pcie_link_speed and used defines from=20 include/uapi/linux/pci_regs.h - in rzg3s_pcie_child_write() call directly rzg3s_pcie_child_write_conf() if size is 4 and print the warning message on in the other cases - return NULL in rzg3s_pcie_child_map_bus() and added a comment about it - in rzg3s_pcie_root_write() and rzg3s_soc_pcie_init_phy() added a comment about the setting done on RZG3S_PCI_PERM register - register rzg3s_pcie_msi_free_domains(), rzg3s_pcie_msi_teardown(), rzg3s_pcie_intx_teardown() as devm action or reset functions - used irq_domain_create_linear() for intx domain - added the rzg3s_pcie_power_resets_deassert() helper to de-assert the power domain and wait before doing it - wait PCIE_RESET_CONFIG_WAIT_MS before registering the host - made rzg3s_soc_power_resets[] and rzg3s_soc_cfg_resets[] static - added suppress_bind_attrs =3D true - collected tags Changes in v2: - dropped the references to other RZ SoCs from patch description - dropped the dot at the end of single line comments that are not a sentence - as a result of v2 rework removed unused macros and definitions (e.g. RZG3S_PCI_REQISS_TR_TP1_RD, RZG3S_PCI_REQISS_TR_TP1_WR, enum rzg3s_pcie_cfg_access_type) - dropped driver specific defines that are for generic PCI register offsets and used the generic ones - updated the value of RZG3S_PCI_MSI_INT_NR as on RZ/G3S there are no more than 32 MSIs (v1 value was due to mistake in the HW manual) - added timeout macros to be used by read_poll_timeout() specific functions - re-worked the reset handling part by using reset subsystem specific functions only; with this the struct rzg3s_pcie_soc_data was added; reference to PHY initialization function was added to this structure as well - dropped devres_group_id as the issue it tried to address will now be fixed in platform bus code (v2 posted [2]) - use 80 columns alignment - updated function name in the idea of using names similar to what is used in other drivers - added rzg3s_pcie_root_ops and rzg3s_pcie_child_ops and populate bridge->ops, bridge->child_ops with it; from probe: + bridge->ops =3D &rzg3s_pcie_root_ops; + bridge->child_ops =3D &rzg3s_pcie_child_ops; - print a warning for 32 bit accesses (based on the value of bus->unsafe_warn as done in the common code) - dropped dev_dbg() in read/write functions - added HW manual revision identifier in comments that points to the statements from manual - reworked the rzg3s_pcie_intx_setup() as the legacy interrupt DT node is not used anymore - in rzg3s_pcie_config_init() do not hardcode anymore the primary bus, secondary bus, subordinate bus but get this information from device tree and update HW registers accordingly - dropped rzg3s_pcie_remove() and added rzg3s_pcie_host_remove_action() to be used as a devm action or reset function - s/rzg3s_pcie_suspend/rzg3s_pcie_suspend_noirq, s/rzg3s_pcie_resume/rzg3s_pcie_resume_noirq - dropped DEFINE_NOIRQ_DEV_PM_OPS() - updated driver name (rzg3s-pcie-host) to reflect it is for RZ/G3S=20 [2] https://lore.kernel.org/all/20250526122054.65532-2-claudiu.beznea.uj@bp= .renesas.com MAINTAINERS | 8 + drivers/pci/controller/Kconfig | 9 + drivers/pci/controller/Makefile | 1 + drivers/pci/controller/pcie-rzg3s-host.c | 1759 ++++++++++++++++++++++ 4 files changed, 1777 insertions(+) create mode 100644 drivers/pci/controller/pcie-rzg3s-host.c diff --git a/MAINTAINERS b/MAINTAINERS index 46126ce2f968..b177960aad7f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20007,6 +20007,14 @@ S: Maintained F: drivers/pci/controller/dwc/pcie-qcom-common.c F: drivers/pci/controller/dwc/pcie-qcom.c =20 +PCIE DRIVER FOR RENESAS RZ/G3S SERIES +M: Claudiu Beznea +L: linux-pci@vger.kernel.org +L: linux-renesas-soc@vger.kernel.org +S: Supported +F: Documentation/devicetree/bindings/pci/renesas,r9a08g045-pcie.yaml +F: drivers/pci/controller/pcie-rzg3s-host.c + PCIE DRIVER FOR ROCKCHIP M: Shawn Lin L: linux-pci@vger.kernel.org diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig index 41748d083b93..8da33077b72a 100644 --- a/drivers/pci/controller/Kconfig +++ b/drivers/pci/controller/Kconfig @@ -266,6 +266,15 @@ config PCI_RCAR_GEN2 There are 3 internal PCI controllers available with a single built-in EHCI/OHCI host controller present on each one. =20 +config PCIE_RENESAS_RZG3S_HOST + bool "Renesas RZ/G3S PCIe host controller" + depends on ARCH_RENESAS || COMPILE_TEST + select MFD_SYSCON + select IRQ_MSI_LIB + help + Say Y here if you want PCIe host controller support on Renesas RZ/G3S + SoC. + config PCIE_ROCKCHIP bool depends on PCI diff --git a/drivers/pci/controller/Makefile b/drivers/pci/controller/Makef= ile index 038ccbd9e3ba..229929a945c2 100644 --- a/drivers/pci/controller/Makefile +++ b/drivers/pci/controller/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_PCI_TEGRA) +=3D pci-tegra.o obj-$(CONFIG_PCI_RCAR_GEN2) +=3D pci-rcar-gen2.o obj-$(CONFIG_PCIE_RCAR_HOST) +=3D pcie-rcar.o pcie-rcar-host.o obj-$(CONFIG_PCIE_RCAR_EP) +=3D pcie-rcar.o pcie-rcar-ep.o +obj-$(CONFIG_PCIE_RENESAS_RZG3S_HOST) +=3D pcie-rzg3s-host.o obj-$(CONFIG_PCI_HOST_COMMON) +=3D pci-host-common.o obj-$(CONFIG_PCI_HOST_GENERIC) +=3D pci-host-generic.o obj-$(CONFIG_PCI_HOST_THUNDER_ECAM) +=3D pci-thunder-ecam.o diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/control= ler/pcie-rzg3s-host.c new file mode 100644 index 000000000000..9e15db129d96 --- /dev/null +++ b/drivers/pci/controller/pcie-rzg3s-host.c @@ -0,0 +1,1759 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * PCIe driver for Renesas RZ/G3S SoCs + * + * Copyright (C) 2025 Renesas Electronics Corp. + * + * Based on: + * drivers/pci/controller/pcie-rcar-host.c + * Copyright (C) 2009 - 2011 Paul Mundt + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../pci.h" + +/* AXI registers */ +#define RZG3S_PCI_REQDATA(id) (0x80 + (id) * 0x4) +#define RZG3S_PCI_REQRCVDAT 0x8c + +#define RZG3S_PCI_REQADR1 0x90 +#define RZG3S_PCI_REQADR1_BUS GENMASK(31, 24) +#define RZG3S_PCI_REQADR1_DEV GENMASK(23, 19) +#define RZG3S_PCI_REQADR1_FUNC GENMASK(18, 16) +#define RZG3S_PCI_REQADR1_REG GENMASK(11, 0) + +#define RZG3S_PCI_REQBE 0x98 +#define RZG3S_PCI_REQBE_BYTE_EN GENMASK(3, 0) + +#define RZG3S_PCI_REQISS 0x9c +#define RZG3S_PCI_REQISS_MOR_STATUS GENMASK(18, 16) +#define RZG3S_PCI_REQISS_TR_TYPE GENMASK(11, 8) +#define RZG3S_PCI_REQISS_TR_TP0_RD FIELD_PREP(RZG3S_PCI_REQISS_TR_TYPE, 0= x4) +#define RZG3S_PCI_REQISS_TR_TP0_WR FIELD_PREP(RZG3S_PCI_REQISS_TR_TYPE, 0= x5) +#define RZG3S_PCI_REQISS_TR_TP1_RD FIELD_PREP(RZG3S_PCI_REQISS_TR_TYPE, 0= x6) +#define RZG3S_PCI_REQISS_TR_TP1_WR FIELD_PREP(RZG3S_PCI_REQISS_TR_TYPE, 0= x7) +#define RZG3S_PCI_REQISS_REQ_ISSUE BIT(0) + +#define RZG3S_PCI_MSIRCVWADRL 0x100 +#define RZG3S_PCI_MSIRCVWADRL_MASK GENMASK(31, 3) +#define RZG3S_PCI_MSIRCVWADRL_MSG_DATA_ENA BIT(1) +#define RZG3S_PCI_MSIRCVWADRL_ENA BIT(0) + +#define RZG3S_PCI_MSIRCVWADRU 0x104 + +#define RZG3S_PCI_MSIRCVWMSKL 0x108 +#define RZG3S_PCI_MSIRCVWMSKL_MASK GENMASK(31, 2) + +#define RZG3S_PCI_PINTRCVIE 0x110 +#define RZG3S_PCI_PINTRCVIE_INTX(i) BIT(i) +#define RZG3S_PCI_PINTRCVIE_MSI BIT(4) + +#define RZG3S_PCI_PINTRCVIS 0x114 +#define RZG3S_PCI_PINTRCVIS_INTX(i) BIT(i) +#define RZG3S_PCI_PINTRCVIS_MSI BIT(4) + +#define RZG3S_PCI_MSGRCVIE 0x120 +#define RZG3S_PCI_MSGRCVIE_MSG_RCV BIT(24) + +#define RZG3S_PCI_MSGRCVIS 0x124 +#define RZG3S_PCI_MSGRCVIS_MRI BIT(24) + +#define RZG3S_PCI_PEIE0 0x200 + +#define RZG3S_PCI_PEIS0 0x204 +#define RZG3S_PCI_PEIS0_RX_DLLP_PM_ENTER BIT(12) +#define RZG3S_PCI_PEIS0_DL_UPDOWN BIT(9) + +#define RZG3S_PCI_PEIE1 0x208 +#define RZG3S_PCI_PEIS1 0x20c +#define RZG3S_PCI_AMEIS 0x214 +#define RZG3S_PCI_ASEIS1 0x224 + +#define RZG3S_PCI_PCSTAT1 0x408 +#define RZG3S_PCI_PCSTAT1_LTSSM_STATE GENMASK(14, 10) +#define RZG3S_PCI_PCSTAT1_DL_DOWN_STS BIT(0) + +#define RZG3S_PCI_PCCTRL2 0x410 +#define RZG3S_PCI_PCCTRL2_LS_CHG GENMASK(9, 8) +#define RZG3S_PCI_PCCTRL2_LS_CHG_REQ BIT(0) + +#define RZG3S_PCI_PCSTAT2 0x414 +#define RZG3S_PCI_PCSTAT2_LS_CHG_DONE BIT(28) +#define RZG3S_PCI_PCSTAT2_SDRIRE GENMASK(7, 1) + +#define RZG3S_PCI_PERM 0x300 +#define RZG3S_PCI_PERM_CFG_HWINIT_EN BIT(2) +#define RZG3S_PCI_PERM_PIPE_PHY_REG_EN BIT(1) + +#define RZG3S_PCI_MSIRE(id) (0x600 + (id) * 0x10) +#define RZG3S_PCI_MSIRE_ENA BIT(0) + +#define RZG3S_PCI_MSIRM(id) (0x608 + (id) * 0x10) +#define RZG3S_PCI_MSIRS(id) (0x60c + (id) * 0x10) + +#define RZG3S_PCI_AWBASEL(id) (0x1000 + (id) * 0x20) +#define RZG3S_PCI_AWBASEL_WIN_ENA BIT(0) + +#define RZG3S_PCI_AWBASEU(id) (0x1004 + (id) * 0x20) +#define RZG3S_PCI_AWMASKL(id) (0x1008 + (id) * 0x20) +#define RZG3S_PCI_AWMASKU(id) (0x100c + (id) * 0x20) +#define RZG3S_PCI_ADESTL(id) (0x1010 + (id) * 0x20) +#define RZG3S_PCI_ADESTU(id) (0x1014 + (id) * 0x20) + +#define RZG3S_PCI_PWBASEL(id) (0x1100 + (id) * 0x20) +#define RZG3S_PCI_PWBASEL_ENA BIT(0) + +#define RZG3S_PCI_PWBASEU(id) (0x1104 + (id) * 0x20) +#define RZG3S_PCI_PDESTL(id) (0x1110 + (id) * 0x20) +#define RZG3S_PCI_PDESTU(id) (0x1114 + (id) * 0x20) +#define RZG3S_PCI_PWMASKL(id) (0x1108 + (id) * 0x20) +#define RZG3S_PCI_PWMASKU(id) (0x110c + (id) * 0x20) + +/* PHY control registers */ +#define RZG3S_PCI_PHY_XCFGD(id) (0x2000 + (id) * 0x10) +#define RZG3S_PCI_PHY_XCFGD_NUM 39 + +#define RZG3S_PCI_PHY_XCFGA_CMN(id) (0x2400 + (id) * 0x10) +#define RZG3S_PCI_PHY_XCFGA_CMN_NUM 16 + +#define RZG3S_PCI_PHY_XCFGA_RX(id) (0x2500 + (id) * 0x10) +#define RZG3S_PCI_PHY_XCFGA_RX_NUM 13 + +#define RZG3S_PCI_PHY_XCFGA_TX 0x25d0 + +#define RZG3S_PCI_PHY_XCFG_CTRL 0x2a20 +#define RZG3S_PCI_PHY_XCFG_CTRL_PHYREG_SEL BIT(0) + +/* PCIe registers */ +#define RZG3S_PCI_CFG_BASE 0x6000 +#define RZG3S_PCI_CFG_BARMSK00L 0xa0 +#define RZG3S_PCI_CFG_BARMSK00U 0xa4 + +#define RZG3S_PCI_CFG_PCIEC 0x60 + +/* System controller registers */ +#define RZG3S_SYS_PCIE_RST_RSM_B 0xd74 +#define RZG3S_SYS_PCIE_RST_RSM_B_MASK BIT(0) + +/* Maximum number of windows */ +#define RZG3S_MAX_WINDOWS 8 + +/* Number of MSI interrupts per register */ +#define RZG3S_PCI_MSI_INT_PER_REG 32 +/* The number of MSI interrupts */ +#define RZG3S_PCI_MSI_INT_NR RZG3S_PCI_MSI_INT_PER_REG + +/* Timeouts experimentally determined */ +#define RZG3S_REQ_ISSUE_TIMEOUT_US 2500 + +/** + * struct rzg3s_pcie_msi - RZ/G3S PCIe MSI data structure + * @domain: IRQ domain + * @map: bitmap with the allocated MSIs + * @dma_addr: address of the allocated MSI window + * @window_base: base address of the MSI window + * @pages: allocated pages for MSI window mapping + * @map_lock: lock for bitmap with the allocated MSIs + * @irq: MSI interrupt + */ +struct rzg3s_pcie_msi { + struct irq_domain *domain; + DECLARE_BITMAP(map, RZG3S_PCI_MSI_INT_NR); + dma_addr_t dma_addr; + dma_addr_t window_base; + unsigned long pages; + struct mutex map_lock; + int irq; +}; + +struct rzg3s_pcie_host; + +/** + * struct rzg3s_pcie_soc_data - SoC specific data + * @init_phy: PHY initialization function + * @power_resets: array with the resets that need to be de-asserted after + * power-on + * @cfg_resets: array with the resets that need to be de-asserted after + * configuration + * @num_power_resets: number of power resets + * @num_cfg_resets: number of configuration resets + */ +struct rzg3s_pcie_soc_data { + int (*init_phy)(struct rzg3s_pcie_host *host); + const char * const *power_resets; + const char * const *cfg_resets; + u8 num_power_resets; + u8 num_cfg_resets; +}; + +/** + * struct rzg3s_pcie_port - RZ/G3S PCIe Root port data structure + * @refclk: PCIe reference clock + * @vendor_id: Vendor ID + * @device_id: Device ID + */ +struct rzg3s_pcie_port { + struct clk *refclk; + u32 vendor_id; + u32 device_id; +}; + +/** + * struct rzg3s_pcie_host - RZ/G3S PCIe data structure + * @axi: base address for AXI registers + * @pcie: base address for PCIe registers + * @dev: struct device + * @power_resets: reset control signals that should be set after power up + * @cfg_resets: reset control signals that should be set after configurati= on + * @sysc: SYSC regmap + * @intx_domain: INTx IRQ domain + * @data: SoC specific data + * @msi: MSI data structure + * @port: PCIe Root port + * @hw_lock: lock for access to the HW resources + * @intx_irqs: INTx interrupts + * @max_link_speed: maximum supported link speed + */ +struct rzg3s_pcie_host { + void __iomem *axi; + void __iomem *pcie; + struct device *dev; + struct reset_control_bulk_data *power_resets; + struct reset_control_bulk_data *cfg_resets; + struct regmap *sysc; + struct irq_domain *intx_domain; + const struct rzg3s_pcie_soc_data *data; + struct rzg3s_pcie_msi msi; + struct rzg3s_pcie_port port; + raw_spinlock_t hw_lock; + int intx_irqs[PCI_NUM_INTX]; + int max_link_speed; +}; + +#define rzg3s_msi_to_host(_msi) container_of(_msi, struct rzg3s_pcie_host,= msi) + +static void rzg3s_pcie_update_bits(void __iomem *base, u32 offset, u32 mas= k, + u32 val) +{ + u32 tmp; + + tmp =3D readl_relaxed(base + offset); + tmp &=3D ~mask; + tmp |=3D val & mask; + writel_relaxed(tmp, base + offset); +} + +static int rzg3s_pcie_child_issue_request(struct rzg3s_pcie_host *host) +{ + u32 val; + int ret; + + rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_REQISS, + RZG3S_PCI_REQISS_REQ_ISSUE, + RZG3S_PCI_REQISS_REQ_ISSUE); + ret =3D readl_poll_timeout_atomic(host->axi + RZG3S_PCI_REQISS, val, + !(val & RZG3S_PCI_REQISS_REQ_ISSUE), + 5, RZG3S_REQ_ISSUE_TIMEOUT_US); + + if (val & RZG3S_PCI_REQISS_MOR_STATUS) + return -EIO; + + return ret; +} + +static void rzg3s_pcie_child_prepare_bus(struct pci_bus *bus, + unsigned int devfn, int where) +{ + struct rzg3s_pcie_host *host =3D bus->sysdata; + unsigned int dev, func, reg; + + dev =3D PCI_SLOT(devfn); + func =3D PCI_FUNC(devfn); + reg =3D where & ~0x3; + + /* Set the destination */ + writel_relaxed(FIELD_PREP(RZG3S_PCI_REQADR1_BUS, bus->number) | + FIELD_PREP(RZG3S_PCI_REQADR1_DEV, dev) | + FIELD_PREP(RZG3S_PCI_REQADR1_FUNC, func) | + FIELD_PREP(RZG3S_PCI_REQADR1_REG, reg), + host->axi + RZG3S_PCI_REQADR1); + + /* Set byte enable */ + writel_relaxed(RZG3S_PCI_REQBE_BYTE_EN, host->axi + RZG3S_PCI_REQBE); +} + +static int rzg3s_pcie_child_read_conf(struct rzg3s_pcie_host *host, + struct pci_bus *bus, unsigned int devfn, + int where, u32 *data) +{ + bool type0 =3D pci_is_root_bus(bus->parent) ? true : false; + int ret; + + rzg3s_pcie_child_prepare_bus(bus, devfn, where); + + /* Set the type of request */ + writel_relaxed(type0 ? RZG3S_PCI_REQISS_TR_TP0_RD : + RZG3S_PCI_REQISS_TR_TP1_RD, + host->axi + RZG3S_PCI_REQISS); + + /* Issue the request and wait to finish */ + ret =3D rzg3s_pcie_child_issue_request(host); + if (ret) + return PCIBIOS_SET_FAILED; + + /* Read the data */ + *data =3D readl_relaxed(host->axi + RZG3S_PCI_REQRCVDAT); + + return PCIBIOS_SUCCESSFUL; +} + +/* Serialization is provided by 'pci_lock' in drivers/pci/access.c */ +static int rzg3s_pcie_child_read(struct pci_bus *bus, unsigned int devfn, + int where, int size, u32 *val) +{ + struct rzg3s_pcie_host *host =3D bus->sysdata; + int ret; + + ret =3D rzg3s_pcie_child_read_conf(host, bus, devfn, where, val); + if (ret !=3D PCIBIOS_SUCCESSFUL) + return ret; + + if (size <=3D 2) + *val =3D (*val >> (8 * (where & 3))) & ((1 << (size * 8)) - 1); + + return PCIBIOS_SUCCESSFUL; +} + +static int rzg3s_pcie_child_write_conf(struct rzg3s_pcie_host *host, + struct pci_bus *bus, unsigned int devfn, + int where, u32 data) +{ + bool type0 =3D pci_is_root_bus(bus->parent) ? true : false; + int ret; + + rzg3s_pcie_child_prepare_bus(bus, devfn, where); + + /* Set the write data */ + writel_relaxed(0, host->axi + RZG3S_PCI_REQDATA(0)); + writel_relaxed(0, host->axi + RZG3S_PCI_REQDATA(1)); + writel_relaxed(data, host->axi + RZG3S_PCI_REQDATA(2)); + + /* Set the type of request */ + writel_relaxed(type0 ? RZG3S_PCI_REQISS_TR_TP0_WR : + RZG3S_PCI_REQISS_TR_TP1_WR, + host->axi + RZG3S_PCI_REQISS); + + /* Issue the request and wait to finish */ + ret =3D rzg3s_pcie_child_issue_request(host); + if (ret) + return PCIBIOS_SET_FAILED; + + return PCIBIOS_SUCCESSFUL; +} + +/* Serialization is provided by 'pci_lock' in drivers/pci/access.c */ +static int rzg3s_pcie_child_write(struct pci_bus *bus, unsigned int devfn, + int where, int size, u32 val) +{ + struct rzg3s_pcie_host *host =3D bus->sysdata; + u32 data, shift; + int ret; + + if (size =3D=3D 4) + return rzg3s_pcie_child_write_conf(host, bus, devfn, where, val); + + /* + * Controller does 32 bit accesses. To do byte accesses software need + * to do read/modify/write. This may have potential side effects. For + * example, software may perform a 16-bit write. If the hardware only + * supports 32-bit accesses, we must do a 32-bit read, merge in the 16 + * bits we intend to write, followed by a 32-bit write. If the 16 bits + * we *don't* intend to write happen to have any RW1C + * (write-one-to-clear) bits set, we just inadvertently cleared + * something we shouldn't have. + */ + if (!bus->unsafe_warn) { + dev_warn(&bus->dev, "%d-byte config write to %04x:%02x:%02x.%d offset %#= x may corrupt adjacent RW1C bits\n", + size, pci_domain_nr(bus), bus->number, + PCI_SLOT(devfn), PCI_FUNC(devfn), where); + bus->unsafe_warn =3D 1; + } + + ret =3D rzg3s_pcie_child_read_conf(host, bus, devfn, where, &data); + if (ret !=3D PCIBIOS_SUCCESSFUL) + return ret; + + if (size =3D=3D 1) { + shift =3D BITS_PER_BYTE * (where & 3); + data &=3D ~(0xff << shift); + data |=3D ((val & 0xff) << shift); + } else if (size =3D=3D 2) { + shift =3D BITS_PER_BYTE * (where & 2); + data &=3D ~(0xffff << shift); + data |=3D ((val & 0xffff) << shift); + } else { + data =3D val; + } + + return rzg3s_pcie_child_write_conf(host, bus, devfn, where, data); +} + +static struct pci_ops rzg3s_pcie_child_ops =3D { + .read =3D rzg3s_pcie_child_read, + .write =3D rzg3s_pcie_child_write, +}; + +static void __iomem *rzg3s_pcie_root_map_bus(struct pci_bus *bus, + unsigned int devfn, int where) +{ + struct rzg3s_pcie_host *host =3D bus->sysdata; + + if (devfn) + return NULL; + + return host->pcie + where; +} + +/* Serialization is provided by 'pci_lock' in drivers/pci/access.c */ +static int rzg3s_pcie_root_write(struct pci_bus *bus, unsigned int devfn, + int where, int size, u32 val) +{ + struct rzg3s_pcie_host *host =3D bus->sysdata; + int ret; + + /* Enable access control to the CFGU */ + writel_relaxed(RZG3S_PCI_PERM_CFG_HWINIT_EN, + host->axi + RZG3S_PCI_PERM); + + ret =3D pci_generic_config_write(bus, devfn, where, size, val); + + /* Disable access control to the CFGU */ + writel_relaxed(0, host->axi + RZG3S_PCI_PERM); + + return ret; +} + +static struct pci_ops rzg3s_pcie_root_ops =3D { + .read =3D pci_generic_config_read, + .write =3D rzg3s_pcie_root_write, + .map_bus =3D rzg3s_pcie_root_map_bus, +}; + +static void rzg3s_pcie_intx_irq_handler(struct irq_desc *desc) +{ + struct rzg3s_pcie_host *host =3D irq_desc_get_handler_data(desc); + struct irq_chip *chip =3D irq_desc_get_chip(desc); + unsigned int irq =3D irq_desc_get_irq(desc); + u32 intx =3D irq - host->intx_irqs[0]; + + chained_irq_enter(chip, desc); + generic_handle_domain_irq(host->intx_domain, intx); + chained_irq_exit(chip, desc); +} + +static irqreturn_t rzg3s_pcie_msi_irq(int irq, void *data) +{ + u8 regs =3D RZG3S_PCI_MSI_INT_NR / RZG3S_PCI_MSI_INT_PER_REG; + DECLARE_BITMAP(bitmap, RZG3S_PCI_MSI_INT_NR); + struct rzg3s_pcie_host *host =3D data; + struct rzg3s_pcie_msi *msi =3D &host->msi; + unsigned long bit; + u32 status; + + status =3D readl_relaxed(host->axi + RZG3S_PCI_PINTRCVIS); + if (!(status & RZG3S_PCI_PINTRCVIS_MSI)) + return IRQ_NONE; + + /* Clear the MSI */ + rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_PINTRCVIS, + RZG3S_PCI_PINTRCVIS_MSI, + RZG3S_PCI_PINTRCVIS_MSI); + rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_MSGRCVIS, + RZG3S_PCI_MSGRCVIS_MRI, RZG3S_PCI_MSGRCVIS_MRI); + + for (u8 reg_id =3D 0; reg_id < regs; reg_id++) { + status =3D readl_relaxed(host->axi + RZG3S_PCI_MSIRS(reg_id)); + bitmap_write(bitmap, status, reg_id * RZG3S_PCI_MSI_INT_PER_REG, + RZG3S_PCI_MSI_INT_PER_REG); + } + + for_each_set_bit(bit, bitmap, RZG3S_PCI_MSI_INT_NR) { + int ret; + + ret =3D generic_handle_domain_irq(msi->domain, bit); + if (ret) { + u8 reg_bit =3D bit % RZG3S_PCI_MSI_INT_PER_REG; + u8 reg_id =3D bit / RZG3S_PCI_MSI_INT_PER_REG; + + /* Unknown MSI, just clear it */ + writel_relaxed(BIT(reg_bit), + host->axi + RZG3S_PCI_MSIRS(reg_id)); + } + } + + return IRQ_HANDLED; +} + +static void rzg3s_pcie_msi_irq_ack(struct irq_data *d) +{ + struct rzg3s_pcie_msi *msi =3D irq_data_get_irq_chip_data(d); + struct rzg3s_pcie_host *host =3D rzg3s_msi_to_host(msi); + u8 reg_bit =3D d->hwirq % RZG3S_PCI_MSI_INT_PER_REG; + u8 reg_id =3D d->hwirq / RZG3S_PCI_MSI_INT_PER_REG; + + guard(raw_spinlock_irqsave)(&host->hw_lock); + + writel_relaxed(BIT(reg_bit), host->axi + RZG3S_PCI_MSIRS(reg_id)); +} + +static void rzg3s_pcie_msi_irq_mask(struct irq_data *d) +{ + struct rzg3s_pcie_msi *msi =3D irq_data_get_irq_chip_data(d); + struct rzg3s_pcie_host *host =3D rzg3s_msi_to_host(msi); + u8 reg_bit =3D d->hwirq % RZG3S_PCI_MSI_INT_PER_REG; + u8 reg_id =3D d->hwirq / RZG3S_PCI_MSI_INT_PER_REG; + + guard(raw_spinlock_irqsave)(&host->hw_lock); + + rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_MSIRM(reg_id), BIT(reg_bit), + BIT(reg_bit)); +} + +static void rzg3s_pcie_msi_irq_unmask(struct irq_data *d) +{ + struct rzg3s_pcie_msi *msi =3D irq_data_get_irq_chip_data(d); + struct rzg3s_pcie_host *host =3D rzg3s_msi_to_host(msi); + u8 reg_bit =3D d->hwirq % RZG3S_PCI_MSI_INT_PER_REG; + u8 reg_id =3D d->hwirq / RZG3S_PCI_MSI_INT_PER_REG; + + guard(raw_spinlock_irqsave)(&host->hw_lock); + + rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_MSIRM(reg_id), BIT(reg_bit), + 0); +} + +static void rzg3s_pcie_irq_compose_msi_msg(struct irq_data *data, + struct msi_msg *msg) +{ + struct rzg3s_pcie_msi *msi =3D irq_data_get_irq_chip_data(data); + struct rzg3s_pcie_host *host =3D rzg3s_msi_to_host(msi); + u32 lo, hi; + + /* + * Enable and msg data enable bits are part of the address lo. Drop + * them along with the unused bit. + */ + lo =3D readl_relaxed(host->axi + RZG3S_PCI_MSIRCVWADRL) & + RZG3S_PCI_MSIRCVWADRL_MASK; + hi =3D readl_relaxed(host->axi + RZG3S_PCI_MSIRCVWADRU); + + msg->address_lo =3D lo; + msg->address_hi =3D hi; + msg->data =3D data->hwirq; +} + +static struct irq_chip rzg3s_pcie_msi_bottom_chip =3D { + .name =3D "rzg3s-pcie-msi", + .irq_ack =3D rzg3s_pcie_msi_irq_ack, + .irq_mask =3D rzg3s_pcie_msi_irq_mask, + .irq_unmask =3D rzg3s_pcie_msi_irq_unmask, + .irq_compose_msi_msg =3D rzg3s_pcie_irq_compose_msi_msg, +}; + +static int rzg3s_pcie_msi_domain_alloc(struct irq_domain *domain, + unsigned int virq, unsigned int nr_irqs, + void *args) +{ + struct rzg3s_pcie_msi *msi =3D domain->host_data; + int hwirq; + + scoped_guard(mutex, &msi->map_lock) { + hwirq =3D bitmap_find_free_region(msi->map, RZG3S_PCI_MSI_INT_NR, + order_base_2(nr_irqs)); + } + + if (hwirq < 0) + return -ENOSPC; + + for (unsigned int i =3D 0; i < nr_irqs; i++) { + irq_domain_set_info(domain, virq + i, hwirq + i, + &rzg3s_pcie_msi_bottom_chip, + domain->host_data, handle_edge_irq, NULL, + NULL); + } + + return 0; +} + +static void rzg3s_pcie_msi_domain_free(struct irq_domain *domain, + unsigned int virq, unsigned int nr_irqs) +{ + struct irq_data *d =3D irq_domain_get_irq_data(domain, virq); + struct rzg3s_pcie_msi *msi =3D domain->host_data; + + guard(mutex)(&msi->map_lock); + + bitmap_release_region(msi->map, d->hwirq, order_base_2(nr_irqs)); +} + +static const struct irq_domain_ops rzg3s_pcie_msi_domain_ops =3D { + .alloc =3D rzg3s_pcie_msi_domain_alloc, + .free =3D rzg3s_pcie_msi_domain_free, +}; + +#define RZG3S_PCIE_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \ + MSI_FLAG_USE_DEF_CHIP_OPS | \ + MSI_FLAG_NO_AFFINITY | \ + MSI_FLAG_PCI_MSI_MASK_PARENT) + +#define RZG3S_PCIE_MSI_FLAGS_SUPPORTED (MSI_FLAG_MULTI_PCI_MSI | \ + MSI_GENERIC_FLAGS_MASK) + +static const struct msi_parent_ops rzg3s_pcie_msi_parent_ops =3D { + .required_flags =3D RZG3S_PCIE_MSI_FLAGS_REQUIRED, + .supported_flags =3D RZG3S_PCIE_MSI_FLAGS_SUPPORTED, + .bus_select_token =3D DOMAIN_BUS_PCI_MSI, + .chip_flags =3D MSI_CHIP_FLAG_SET_ACK, + .prefix =3D "RZG3S-", + .init_dev_msi_info =3D msi_lib_init_dev_msi_info, +}; + +static int rzg3s_pcie_msi_allocate_domains(struct rzg3s_pcie_msi *msi) +{ + struct rzg3s_pcie_host *host =3D rzg3s_msi_to_host(msi); + struct device *dev =3D host->dev; + struct irq_domain_info info =3D { + .fwnode =3D dev_fwnode(dev), + .ops =3D &rzg3s_pcie_msi_domain_ops, + .size =3D RZG3S_PCI_MSI_INT_NR, + .host_data =3D msi, + }; + + msi->domain =3D msi_create_parent_irq_domain(&info, + &rzg3s_pcie_msi_parent_ops); + if (!msi->domain) + return dev_err_probe(dev, -ENOMEM, + "failed to create IRQ domain\n"); + + return 0; +} + +static int rzg3s_pcie_msi_hw_setup(struct rzg3s_pcie_host *host) +{ + u8 regs =3D RZG3S_PCI_MSI_INT_NR / RZG3S_PCI_MSI_INT_PER_REG; + struct rzg3s_pcie_msi *msi =3D &host->msi; + + /* + * Set MSI window size. HW will set the window to + * RZG3S_PCI_MSI_INT_NR * 4 bytes. + */ + writel_relaxed(FIELD_PREP(RZG3S_PCI_MSIRCVWMSKL_MASK, + RZG3S_PCI_MSI_INT_NR - 1), + host->axi + RZG3S_PCI_MSIRCVWMSKL); + + /* Set MSI window address and enable MSI window */ + writel_relaxed(upper_32_bits(msi->window_base), + host->axi + RZG3S_PCI_MSIRCVWADRU); + writel_relaxed(lower_32_bits(msi->window_base) | + RZG3S_PCI_MSIRCVWADRL_ENA | + RZG3S_PCI_MSIRCVWADRL_MSG_DATA_ENA, + host->axi + RZG3S_PCI_MSIRCVWADRL); + + /* Set MSI receive enable */ + for (u8 reg_id =3D 0; reg_id < regs; reg_id++) { + writel_relaxed(RZG3S_PCI_MSIRE_ENA, + host->axi + RZG3S_PCI_MSIRE(reg_id)); + } + + /* Enable message receive interrupts */ + writel_relaxed(RZG3S_PCI_MSGRCVIE_MSG_RCV, + host->axi + RZG3S_PCI_MSGRCVIE); + + /* Enable MSI */ + rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_PINTRCVIE, + RZG3S_PCI_PINTRCVIE_MSI, + RZG3S_PCI_PINTRCVIE_MSI); + + return 0; +} + +static int rzg3s_pcie_msi_setup(struct rzg3s_pcie_host *host) +{ + size_t size =3D RZG3S_PCI_MSI_INT_NR * sizeof(u32); + struct rzg3s_pcie_msi *msi =3D &host->msi; + struct device *dev =3D host->dev; + int id, ret; + + msi->pages =3D __get_free_pages(GFP_KERNEL | GFP_DMA, 0); + if (!msi->pages) + return -ENOMEM; + + msi->dma_addr =3D dma_map_single(dev, (void *)msi->pages, size * 2, + DMA_BIDIRECTIONAL); + if (dma_mapping_error(dev, msi->dma_addr)) { + ret =3D -ENOMEM; + goto free_pages; + } + + /* + * According to the RZ/G3S HW manual (Rev.1.10, section 34.4.5.2 Setting + * the MSI Window) the MSI window needs to fall within one of the + * enabled AXI windows. Find an enabled AXI window to setup the MSI + * window. + */ + for (id =3D 0; id < RZG3S_MAX_WINDOWS; id++) { + u64 base, basel, baseu; + u64 mask, maskl, masku; + + basel =3D readl_relaxed(host->axi + RZG3S_PCI_AWBASEL(id)); + /* Skip checking this AXI window if it's not enabled */ + if (!(basel & RZG3S_PCI_AWBASEL_WIN_ENA)) + continue; + + baseu =3D readl_relaxed(host->axi + RZG3S_PCI_AWBASEU(id)); + base =3D baseu << 32 | basel; + + maskl =3D readl_relaxed(host->axi + RZG3S_PCI_AWMASKL(id)); + masku =3D readl_relaxed(host->axi + RZG3S_PCI_AWMASKU(id)); + mask =3D masku << 32 | maskl; + + if (msi->dma_addr < base || msi->dma_addr > base + mask) + continue; + + break; + } + + if (id =3D=3D RZG3S_MAX_WINDOWS) { + ret =3D -EINVAL; + goto dma_unmap; + } + + /* The MSI base address need to be aligned to the MSI size */ + msi->window_base =3D ALIGN(msi->dma_addr, size); + if (msi->window_base < msi->dma_addr) { + ret =3D -EINVAL; + goto dma_unmap; + } + + rzg3s_pcie_msi_hw_setup(host); + + return 0; + +dma_unmap: + dma_unmap_single(dev, msi->dma_addr, size * 2, DMA_BIDIRECTIONAL); +free_pages: + free_pages(msi->pages, 0); + return ret; +} + +static void rzg3s_pcie_msi_hw_teardown(struct rzg3s_pcie_host *host) +{ + u8 regs =3D RZG3S_PCI_MSI_INT_NR / RZG3S_PCI_MSI_INT_PER_REG; + + /* Disable MSI */ + rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_PINTRCVIE, + RZG3S_PCI_PINTRCVIE_MSI, 0); + + /* Disable message receive interrupts */ + rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_MSGRCVIE, + RZG3S_PCI_MSGRCVIE_MSG_RCV, 0); + + /* Disable MSI receive enable */ + for (u8 reg_id =3D 0; reg_id < regs; reg_id++) + writel_relaxed(0, host->axi + RZG3S_PCI_MSIRE(reg_id)); + + /* Disable MSI window */ + writel_relaxed(0, host->axi + RZG3S_PCI_MSIRCVWADRL); +} + +static void rzg3s_pcie_teardown_msi(struct rzg3s_pcie_host *host) +{ + size_t size =3D RZG3S_PCI_MSI_INT_NR * sizeof(u32); + struct rzg3s_pcie_msi *msi =3D &host->msi; + + rzg3s_pcie_msi_hw_teardown(host); + + free_irq(msi->irq, host); + irq_domain_remove(msi->domain); + + /* Free unused memory */ + dma_unmap_single(host->dev, msi->dma_addr, size * 2, DMA_BIDIRECTIONAL); + free_pages(msi->pages, 0); +} + +static int rzg3s_pcie_init_msi(struct rzg3s_pcie_host *host) +{ + struct platform_device *pdev =3D to_platform_device(host->dev); + struct rzg3s_pcie_msi *msi =3D &host->msi; + struct device *dev =3D host->dev; + const char *devname; + int ret; + + ret =3D devm_mutex_init(dev, &msi->map_lock); + if (ret) + return ret; + + msi->irq =3D platform_get_irq_byname(pdev, "msi"); + if (msi->irq < 0) + return dev_err_probe(dev, msi->irq, "Failed to get MSI IRQ!\n"); + + devname =3D devm_kasprintf(dev, GFP_KERNEL, "%s-msi", dev_name(dev)); + if (!devname) + return -ENOMEM; + + ret =3D rzg3s_pcie_msi_allocate_domains(msi); + if (ret) + return ret; + + /* + * Don't use devm_request_irq() as the driver uses non-devm helpers + * to control clocks. Mixing them may lead to subtle bugs. + */ + ret =3D request_irq(msi->irq, rzg3s_pcie_msi_irq, 0, devname, host); + if (ret) { + dev_err_probe(dev, ret, "Failed to request IRQ: %d\n", ret); + goto free_domains; + } + + ret =3D rzg3s_pcie_msi_setup(host); + if (ret) { + dev_err_probe(dev, ret, "Failed to setup MSI!\n"); + goto free_irq; + } + + return 0; + +free_irq: + free_irq(msi->irq, host); +free_domains: + irq_domain_remove(msi->domain); + return ret; +} + +static void rzg3s_pcie_intx_irq_ack(struct irq_data *d) +{ + struct rzg3s_pcie_host *host =3D irq_data_get_irq_chip_data(d); + + guard(raw_spinlock_irqsave)(&host->hw_lock); + + rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_PINTRCVIS, + RZG3S_PCI_PINTRCVIS_INTX(d->hwirq), + RZG3S_PCI_PINTRCVIS_INTX(d->hwirq)); +} + +static void rzg3s_pcie_intx_irq_mask(struct irq_data *d) +{ + struct rzg3s_pcie_host *host =3D irq_data_get_irq_chip_data(d); + + guard(raw_spinlock_irqsave)(&host->hw_lock); + + rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_PINTRCVIE, + RZG3S_PCI_PINTRCVIE_INTX(d->hwirq), 0); +} + +static void rzg3s_pcie_intx_irq_unmask(struct irq_data *d) +{ + struct rzg3s_pcie_host *host =3D irq_data_get_irq_chip_data(d); + + guard(raw_spinlock_irqsave)(&host->hw_lock); + + rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_PINTRCVIE, + RZG3S_PCI_PINTRCVIE_INTX(d->hwirq), + RZG3S_PCI_PINTRCVIE_INTX(d->hwirq)); +} + +static struct irq_chip rzg3s_pcie_intx_irq_chip =3D { + .name =3D "PCIe INTx", + .irq_ack =3D rzg3s_pcie_intx_irq_ack, + .irq_mask =3D rzg3s_pcie_intx_irq_mask, + .irq_unmask =3D rzg3s_pcie_intx_irq_unmask, +}; + +static int rzg3s_pcie_intx_map(struct irq_domain *domain, unsigned int irq, + irq_hw_number_t hwirq) +{ + irq_set_chip_and_handler(irq, &rzg3s_pcie_intx_irq_chip, + handle_level_irq); + irq_set_chip_data(irq, domain->host_data); + + return 0; +} + +static const struct irq_domain_ops rzg3s_pcie_intx_domain_ops =3D { + .map =3D rzg3s_pcie_intx_map, + .xlate =3D irq_domain_xlate_onetwocell, +}; + +static int rzg3s_pcie_init_irqdomain(struct rzg3s_pcie_host *host) +{ + struct device *dev =3D host->dev; + struct platform_device *pdev =3D to_platform_device(dev); + + for (int i =3D 0; i < PCI_NUM_INTX; i++) { + char irq_name[5] =3D {0}; + int irq; + + scnprintf(irq_name, ARRAY_SIZE(irq_name), "int%c", 'a' + i); + + irq =3D platform_get_irq_byname(pdev, irq_name); + if (irq < 0) + return dev_err_probe(dev, -EINVAL, + "Failed to parse and map INT%c IRQ\n", + 'A' + i); + + host->intx_irqs[i] =3D irq; + irq_set_chained_handler_and_data(irq, + rzg3s_pcie_intx_irq_handler, + host); + } + + host->intx_domain =3D irq_domain_create_linear(dev_fwnode(dev), + PCI_NUM_INTX, + &rzg3s_pcie_intx_domain_ops, + host); + if (!host->intx_domain) + return dev_err_probe(dev, -EINVAL, + "Failed to add irq domain for INTx IRQs\n"); + irq_domain_update_bus_token(host->intx_domain, DOMAIN_BUS_WIRED); + + if (IS_ENABLED(CONFIG_PCI_MSI)) { + int ret =3D rzg3s_pcie_init_msi(host); + + if (ret) { + irq_domain_remove(host->intx_domain); + return ret; + } + } + + return 0; +} + +static void rzg3s_pcie_teardown_irqdomain(struct rzg3s_pcie_host *host) +{ + if (IS_ENABLED(CONFIG_PCI_MSI)) + rzg3s_pcie_teardown_msi(host); + + irq_domain_remove(host->intx_domain); +} + +static int rzg3s_pcie_set_max_link_speed(struct rzg3s_pcie_host *host) +{ + u32 remote_supported_link_speeds, max_supported_link_speeds; + u32 cs2, tmp, pcie_cap =3D RZG3S_PCI_CFG_PCIEC; + u32 cur_link_speed, link_speed; + u8 ltssm_state_l0 =3D 0xc; + int ret; + u16 ls; + + /* + * According to the RZ/G3S HW manual (Rev.1.10, section 34.6.3 Caution + * when Changing the Speed Spontaneously) link speed change can be done + * only when the LTSSM is in L0. + */ + ret =3D readl_poll_timeout(host->axi + RZG3S_PCI_PCSTAT1, tmp, + FIELD_GET(RZG3S_PCI_PCSTAT1_LTSSM_STATE, tmp) =3D=3D ltssm_state_l0, + PCIE_LINK_WAIT_SLEEP_MS * MILLI, + PCIE_LINK_WAIT_SLEEP_MS * MILLI * + PCIE_LINK_WAIT_MAX_RETRIES); + if (ret) + return ret; + + ls =3D readw_relaxed(host->pcie + pcie_cap + PCI_EXP_LNKSTA); + cs2 =3D readl_relaxed(host->axi + RZG3S_PCI_PCSTAT2); + + switch (pcie_link_speed[host->max_link_speed]) { + case PCIE_SPEED_5_0GT: + max_supported_link_speeds =3D GENMASK(PCI_EXP_LNKSTA_CLS_5_0GB - 1, 0); + link_speed =3D PCI_EXP_LNKCTL2_TLS_5_0GT; + break; + default: + /* Should not happen */ + return -EINVAL; + } + + cur_link_speed =3D FIELD_GET(PCI_EXP_LNKSTA_CLS, ls); + remote_supported_link_speeds =3D FIELD_GET(RZG3S_PCI_PCSTAT2_SDRIRE, cs2); + /* Drop reserved bits */ + remote_supported_link_speeds &=3D max_supported_link_speeds; + + /* + * Return if max link speed is already set or the connected device + * doesn't support it. + */ + if (cur_link_speed =3D=3D host->max_link_speed || + remote_supported_link_speeds !=3D max_supported_link_speeds) + return 0; + + /* Set target Link speed */ + rzg3s_pcie_update_bits(host->pcie, pcie_cap + PCI_EXP_LNKCTL2, + PCI_EXP_LNKCTL2_TLS, + FIELD_PREP(PCI_EXP_LNKCTL2_TLS, link_speed)); + + /* Request link speed change */ + rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_PCCTRL2, + RZG3S_PCI_PCCTRL2_LS_CHG_REQ | + RZG3S_PCI_PCCTRL2_LS_CHG, + RZG3S_PCI_PCCTRL2_LS_CHG_REQ | + FIELD_PREP(RZG3S_PCI_PCCTRL2_LS_CHG, + link_speed - 1)); + + ret =3D readl_poll_timeout(host->axi + RZG3S_PCI_PCSTAT2, cs2, + (cs2 & RZG3S_PCI_PCSTAT2_LS_CHG_DONE), + PCIE_LINK_WAIT_SLEEP_MS * MILLI, + PCIE_LINK_WAIT_SLEEP_MS * MILLI * + PCIE_LINK_WAIT_MAX_RETRIES); + + /* + * According to the RZ/G3S HW manual (Rev.1.10, section 34.6.3 Caution + * when Changing the Speed Spontaneously) the PCI_PCCTRL2_LS_CHG_REQ + * should be de-asserted after checking for PCI_PCSTAT2_LS_CHG_DONE. + */ + rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_PCCTRL2, + RZG3S_PCI_PCCTRL2_LS_CHG_REQ, 0); + + return ret; +} + +static int rzg3s_pcie_config_init(struct rzg3s_pcie_host *host) +{ + struct pci_host_bridge *bridge =3D pci_host_bridge_from_priv(host); + struct resource_entry *ft; + struct resource *bus; + u8 subordinate_bus; + u8 secondary_bus; + u8 primary_bus; + + ft =3D resource_list_first_type(&bridge->windows, IORESOURCE_BUS); + if (!ft) + return -ENODEV; + + bus =3D ft->res; + primary_bus =3D bus->start; + secondary_bus =3D bus->start + 1; + subordinate_bus =3D bus->end; + + /* Enable access control to the CFGU */ + writel_relaxed(RZG3S_PCI_PERM_CFG_HWINIT_EN, + host->axi + RZG3S_PCI_PERM); + + /* HW manual recommends to write 0xffffffff on initialization */ + writel_relaxed(0xffffffff, host->pcie + RZG3S_PCI_CFG_BARMSK00L); + writel_relaxed(0xffffffff, host->pcie + RZG3S_PCI_CFG_BARMSK00U); + + /* Update bus info */ + writeb_relaxed(primary_bus, host->pcie + PCI_PRIMARY_BUS); + writeb_relaxed(secondary_bus, host->pcie + PCI_SECONDARY_BUS); + writeb_relaxed(subordinate_bus, host->pcie + PCI_SUBORDINATE_BUS); + + /* Disable access control to the CFGU */ + writel_relaxed(0, host->axi + RZG3S_PCI_PERM); + + return 0; +} + +static void rzg3s_pcie_irq_init(struct rzg3s_pcie_host *host) +{ + /* + * According to the HW manual of the RZ/G3S (Rev.1.10, sections + * corresponding to all registers written with ~0U), the hardware + * ignores value written to unused bits. Writing ~0U to these registers + * should be safe. + */ + + /* Clear the link state and PM transitions */ + writel_relaxed(RZG3S_PCI_PEIS0_DL_UPDOWN | + RZG3S_PCI_PEIS0_RX_DLLP_PM_ENTER, + host->axi + RZG3S_PCI_PEIS0); + + /* Disable all interrupts */ + writel_relaxed(0, host->axi + RZG3S_PCI_PEIE0); + + /* Clear all parity and ecc error interrupts */ + writel_relaxed(~0U, host->axi + RZG3S_PCI_PEIS1); + + /* Disable all parity and ecc error interrupts */ + writel_relaxed(0, host->axi + RZG3S_PCI_PEIE1); + + /* Clear all AXI master error interrupts */ + writel_relaxed(~0U, host->axi + RZG3S_PCI_AMEIS); + + /* Clear all AXI slave error interrupts */ + writel_relaxed(~0U, host->axi + RZG3S_PCI_ASEIS1); + + /* Clear all message receive interrupts */ + writel_relaxed(~0U, host->axi + RZG3S_PCI_MSGRCVIS); +} + +static int rzg3s_pcie_power_resets_deassert(struct rzg3s_pcie_host *host) +{ + const struct rzg3s_pcie_soc_data *data =3D host->data; + + /* + * According to the RZ/G3S HW manual (Rev.1.10, section + * 34.5.1.2 De-asserting the Reset) the PCIe IP needs to wait 5ms from + * power on to the de-assertion of reset. + */ + fsleep(5000); + return reset_control_bulk_deassert(data->num_power_resets, + host->power_resets); +} + +static int rzg3s_pcie_resets_prepare_and_get(struct rzg3s_pcie_host *host) +{ + const struct rzg3s_pcie_soc_data *data =3D host->data; + int ret; + + host->power_resets =3D devm_kmalloc_array(host->dev, + data->num_power_resets, + sizeof(*host->power_resets), + GFP_KERNEL); + if (!host->power_resets) + return -ENOMEM; + + for (unsigned int i =3D 0; i < data->num_power_resets; i++) + host->power_resets[i].id =3D data->power_resets[i]; + + host->cfg_resets =3D devm_kmalloc_array(host->dev, + data->num_cfg_resets, + sizeof(*host->cfg_resets), + GFP_KERNEL); + if (!host->cfg_resets) + return -ENOMEM; + + for (unsigned int i =3D 0; i < data->num_cfg_resets; i++) + host->cfg_resets[i].id =3D data->cfg_resets[i]; + + ret =3D devm_reset_control_bulk_get_exclusive(host->dev, + data->num_power_resets, + host->power_resets); + if (ret) + return ret; + + return devm_reset_control_bulk_get_exclusive(host->dev, + data->num_cfg_resets, + host->cfg_resets); +} + +static int rzg3s_pcie_host_parse_port(struct rzg3s_pcie_host *host) +{ + struct device_node *of_port =3D of_get_next_child(host->dev->of_node, NUL= L); + struct rzg3s_pcie_port *port =3D &host->port; + int ret; + + ret =3D of_property_read_u32(of_port, "vendor-id", &port->vendor_id); + if (ret) + return ret; + + ret =3D of_property_read_u32(of_port, "device-id", &port->device_id); + if (ret) + return ret; + + port->refclk =3D of_clk_get_by_name(of_port, "ref"); + if (IS_ERR(port->refclk)) + return PTR_ERR(port->refclk); + + return 0; +} + +static int rzg3s_pcie_host_init_port(struct rzg3s_pcie_host *host) +{ + struct rzg3s_pcie_port *port =3D &host->port; + struct device *dev =3D host->dev; + int ret; + + /* Enable access control to the CFGU */ + writel_relaxed(RZG3S_PCI_PERM_CFG_HWINIT_EN, + host->axi + RZG3S_PCI_PERM); + + /* Update vendor ID and device ID */ + writew_relaxed(port->vendor_id, host->pcie + PCI_VENDOR_ID); + writew_relaxed(port->device_id, host->pcie + PCI_DEVICE_ID); + + /* Disable access control to the CFGU */ + writel_relaxed(0, host->axi + RZG3S_PCI_PERM); + + ret =3D clk_prepare_enable(port->refclk); + if (ret) + return dev_err_probe(dev, ret, "Failed to enable refclk!\n"); + + /* Set the PHY, if any */ + if (host->data->init_phy) { + ret =3D host->data->init_phy(host); + if (ret) { + dev_err_probe(dev, ret, "Failed to set the PHY!\n"); + goto refclk_disable; + } + } + + return 0; + +refclk_disable: + clk_disable_unprepare(port->refclk); + return ret; +} + +static int rzg3s_pcie_host_init(struct rzg3s_pcie_host *host) +{ + u32 val; + int ret; + + /* Initialize the PCIe related registers */ + ret =3D rzg3s_pcie_config_init(host); + if (ret) + return ret; + + ret =3D rzg3s_pcie_host_init_port(host); + if (ret) + return ret; + + /* Initialize the interrupts */ + rzg3s_pcie_irq_init(host); + + ret =3D reset_control_bulk_deassert(host->data->num_cfg_resets, + host->cfg_resets); + if (ret) + goto disable_port_refclk; + + /* Wait for link up */ + ret =3D readl_poll_timeout(host->axi + RZG3S_PCI_PCSTAT1, val, + !(val & RZG3S_PCI_PCSTAT1_DL_DOWN_STS), + PCIE_LINK_WAIT_SLEEP_MS * MILLI, + PCIE_LINK_WAIT_SLEEP_MS * MILLI * + PCIE_LINK_WAIT_MAX_RETRIES); + if (ret) + goto cfg_resets_deassert; + + val =3D readl_relaxed(host->axi + RZG3S_PCI_PCSTAT2); + dev_info(host->dev, "PCIe link status [0x%x]\n", val); + + return 0; + +cfg_resets_deassert: + reset_control_bulk_assert(host->data->num_cfg_resets, + host->cfg_resets); +disable_port_refclk: + clk_disable_unprepare(host->port.refclk); + return ret; +} + +static void rzg3s_pcie_set_inbound_window(struct rzg3s_pcie_host *host, + u64 cpu_addr, u64 pci_addr, u64 size, + int id) +{ + /* Set CPU window base address */ + writel_relaxed(upper_32_bits(cpu_addr), + host->axi + RZG3S_PCI_ADESTU(id)); + writel_relaxed(lower_32_bits(cpu_addr), + host->axi + RZG3S_PCI_ADESTL(id)); + + /* Set window size */ + writel_relaxed(upper_32_bits(size), host->axi + RZG3S_PCI_AWMASKU(id)); + writel_relaxed(lower_32_bits(size), host->axi + RZG3S_PCI_AWMASKL(id)); + + /* Set PCIe window base address and enable the window */ + writel_relaxed(upper_32_bits(pci_addr), + host->axi + RZG3S_PCI_AWBASEU(id)); + writel_relaxed(lower_32_bits(pci_addr) | RZG3S_PCI_AWBASEL_WIN_ENA, + host->axi + RZG3S_PCI_AWBASEL(id)); +} + +static int rzg3s_pcie_set_inbound_windows(struct rzg3s_pcie_host *host, + struct resource_entry *entry, + int *index) +{ + u64 pci_addr =3D entry->res->start - entry->offset; + u64 cpu_addr =3D entry->res->start; + u64 cpu_end =3D entry->res->end; + u64 size_id =3D 0; + int id =3D *index; + u64 size; + + while (cpu_addr < cpu_end) { + if (id >=3D RZG3S_MAX_WINDOWS) + return dev_err_probe(host->dev, -ENOSPC, + "Failed to map inbound window for resource (%s)\n", + entry->res->name); + + size =3D resource_size(entry->res) - size_id; + + /* + * According to the RZ/G3S HW manual (Rev.1.10, + * section 34.3.1.71 AXI Window Mask (Lower) Registers) the min + * size is 4K. + */ + size =3D max(size, SZ_4K); + + /* + * According the RZ/G3S HW manual (Rev.1.10, sections: + * - 34.3.1.69 AXI Window Base (Lower) Registers + * - 34.3.1.71 AXI Window Mask (Lower) Registers + * - 34.3.1.73 AXI Destination (Lower) Registers) + * the CPU addr, PCIe addr, size should be 4K aligned and be a + * power of 2. + */ + size =3D ALIGN(size, SZ_4K); + size =3D roundup_pow_of_two(size); + + cpu_addr =3D ALIGN(cpu_addr, SZ_4K); + pci_addr =3D ALIGN(pci_addr, SZ_4K); + + /* + * According to the RZ/G3S HW manual (Rev.1.10, section + * 34.3.1.71 AXI Window Mask (Lower) Registers) HW expects first + * 12 LSB bits to be 0xfff. Subtract 1 from size for this. + */ + rzg3s_pcie_set_inbound_window(host, cpu_addr, pci_addr, + size - 1, id); + + pci_addr +=3D size; + cpu_addr +=3D size; + size_id =3D size; + id++; + } + *index =3D id; + + return 0; +} + +static int rzg3s_pcie_parse_map_dma_ranges(struct rzg3s_pcie_host *host) +{ + struct pci_host_bridge *bridge =3D pci_host_bridge_from_priv(host); + struct resource_entry *entry; + int i =3D 0, ret; + + resource_list_for_each_entry(entry, &bridge->dma_ranges) { + ret =3D rzg3s_pcie_set_inbound_windows(host, entry, &i); + if (ret) + return ret; + } + + return 0; +} + +static void rzg3s_pcie_set_outbound_window(struct rzg3s_pcie_host *host, + struct resource_entry *win, int id) +{ + struct resource *res =3D win->res; + resource_size_t size =3D resource_size(res); + resource_size_t res_start; + + if (res->flags & IORESOURCE_IO) + res_start =3D pci_pio_to_address(res->start) - win->offset; + else + res_start =3D res->start - win->offset; + + /* + * According to the RZ/G3S HW manual (Rev.1.10, section 34.3.1.75 PCIe + * Window Base (Lower) Registers) the window base address need to be 4K + * aligned. + */ + res_start =3D ALIGN(res_start, SZ_4K); + + size =3D ALIGN(size, SZ_4K); + size =3D roundup_pow_of_two(size) - 1; + + /* Set PCIe destination */ + writel_relaxed(upper_32_bits(res_start), + host->axi + RZG3S_PCI_PDESTU(id)); + writel_relaxed(lower_32_bits(res_start), + host->axi + RZG3S_PCI_PDESTL(id)); + + /* Set PCIe window mask */ + writel_relaxed(upper_32_bits(size), host->axi + RZG3S_PCI_PWMASKU(id)); + writel_relaxed(lower_32_bits(size), host->axi + RZG3S_PCI_PWMASKL(id)); + + /* Set PCIe window base and enable the window */ + writel_relaxed(upper_32_bits(res_start), + host->axi + RZG3S_PCI_PWBASEU(id)); + writel_relaxed(lower_32_bits(res_start) | RZG3S_PCI_PWBASEL_ENA, + host->axi + RZG3S_PCI_PWBASEL(id)); +} + +static int rzg3s_pcie_parse_map_ranges(struct rzg3s_pcie_host *host) +{ + struct pci_host_bridge *bridge =3D pci_host_bridge_from_priv(host); + struct resource_entry *win; + int i =3D 0; + + resource_list_for_each_entry(win, &bridge->windows) { + struct resource *res =3D win->res; + + if (i >=3D RZG3S_MAX_WINDOWS) + return dev_err_probe(host->dev, -ENOSPC, + "Failed to map outbound window for resource (%s)\n", + res->name); + + if (!res->flags) + continue; + + switch (resource_type(res)) { + case IORESOURCE_IO: + case IORESOURCE_MEM: + rzg3s_pcie_set_outbound_window(host, win, i); + i++; + break; + } + } + + return 0; +} + +static int rzg3s_soc_pcie_init_phy(struct rzg3s_pcie_host *host) +{ + static const u32 xcfgd_settings[RZG3S_PCI_PHY_XCFGD_NUM] =3D { + [8] =3D 0xe0006801, 0x007f7e30, 0x183e0000, 0x978ff500, + 0xec000000, 0x009f1400, 0x0000d009, + [17] =3D 0x78000000, + [19] =3D 0x00880000, 0x000005c0, 0x07000000, 0x00780920, + 0xc9400ce2, 0x90000c0c, 0x000c1414, 0x00005034, + 0x00006000, 0x00000001, + }; + static const u32 xcfga_cmn_settings[RZG3S_PCI_PHY_XCFGA_CMN_NUM] =3D { + 0x00000d10, 0x08310100, 0x00c21404, 0x013c0010, 0x01874440, + 0x1a216082, 0x00103440, 0x00000080, 0x00000010, 0x0c1000c1, + 0x1000c100, 0x0222000c, 0x00640019, 0x00a00028, 0x01d11228, + 0x0201001d, + }; + static const u32 xcfga_rx_settings[RZG3S_PCI_PHY_XCFGA_RX_NUM] =3D { + 0x07d55000, 0x030e3f00, 0x00000288, 0x102c5880, 0x0000000b, + 0x04141441, 0x00641641, 0x00d63d63, 0x00641641, 0x01970377, + 0x00190287, 0x00190028, 0x00000028, + }; + + /* + * Enable access permission for physical layer control and status + * registers. + */ + writel_relaxed(RZG3S_PCI_PERM_PIPE_PHY_REG_EN, + host->axi + RZG3S_PCI_PERM); + + for (unsigned int i =3D 0; i < RZG3S_PCI_PHY_XCFGD_NUM; i++) { + writel_relaxed(xcfgd_settings[i], + host->axi + RZG3S_PCI_PHY_XCFGD(i)); + } + + for (unsigned int i =3D 0; i < RZG3S_PCI_PHY_XCFGA_CMN_NUM; i++) { + writel_relaxed(xcfga_cmn_settings[i], + host->axi + RZG3S_PCI_PHY_XCFGA_CMN(i)); + } + + for (unsigned int i =3D 0; i < RZG3S_PCI_PHY_XCFGA_RX_NUM; i++) { + writel_relaxed(xcfga_rx_settings[i], + host->axi + RZG3S_PCI_PHY_XCFGA_RX(i)); + } + + writel_relaxed(0x107, host->axi + RZG3S_PCI_PHY_XCFGA_TX); + + /* Select PHY settings values */ + writel_relaxed(RZG3S_PCI_PHY_XCFG_CTRL_PHYREG_SEL, + host->axi + RZG3S_PCI_PHY_XCFG_CTRL); + + /* + * Disable access permission for physical layer control and status + * registers. + */ + writel_relaxed(0, host->axi + RZG3S_PCI_PERM); + + return 0; +} + +static int +rzg3s_pcie_host_setup(struct rzg3s_pcie_host *host, + int (*init_irqdomain)(struct rzg3s_pcie_host *host), + void (*teardown_irqdomain)(struct rzg3s_pcie_host *host)) +{ + struct device *dev =3D host->dev; + int ret; + + /* Set inbound windows */ + ret =3D rzg3s_pcie_parse_map_dma_ranges(host); + if (ret) + return dev_err_probe(dev, ret, + "Failed to set inbound windows!\n"); + + /* Set outbound windows */ + ret =3D rzg3s_pcie_parse_map_ranges(host); + if (ret) + return dev_err_probe(dev, ret, + "Failed to set outbound windows!\n"); + + ret =3D init_irqdomain(host); + if (ret) + return dev_err_probe(dev, ret, "Failed to init IRQ domain\n"); + + ret =3D rzg3s_pcie_host_init(host); + if (ret) { + dev_err_probe(dev, ret, "Failed to initialize the HW!\n"); + goto teardown_irqdomain; + } + + ret =3D rzg3s_pcie_set_max_link_speed(host); + if (ret) + dev_info(dev, "Failed to set max link speed\n"); + + msleep(PCIE_RESET_CONFIG_WAIT_MS); + + return 0; + +teardown_irqdomain: + teardown_irqdomain(host); + + return ret; +} + +static int rzg3s_pcie_probe(struct platform_device *pdev) +{ + struct pci_host_bridge *bridge; + struct device *dev =3D &pdev->dev; + struct device_node *np =3D dev->of_node; + struct device_node *sysc_np __free(device_node) =3D + of_parse_phandle(np, "renesas,sysc", 0); + struct rzg3s_pcie_host *host; + int ret; + + bridge =3D devm_pci_alloc_host_bridge(dev, sizeof(*host)); + if (!bridge) + return -ENOMEM; + + host =3D pci_host_bridge_priv(bridge); + host->dev =3D dev; + host->data =3D device_get_match_data(dev); + platform_set_drvdata(pdev, host); + + host->axi =3D devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(host->axi)) + return PTR_ERR(host->axi); + host->pcie =3D host->axi + RZG3S_PCI_CFG_BASE; + + host->max_link_speed =3D of_pci_get_max_link_speed(np); + if (host->max_link_speed < 0) + host->max_link_speed =3D 2; + + ret =3D rzg3s_pcie_host_parse_port(host); + if (ret) + return ret; + + host->sysc =3D syscon_node_to_regmap(sysc_np); + if (IS_ERR(host->sysc)) { + ret =3D PTR_ERR(host->sysc); + goto port_refclk_put; + } + + ret =3D regmap_update_bits(host->sysc, RZG3S_SYS_PCIE_RST_RSM_B, + RZG3S_SYS_PCIE_RST_RSM_B_MASK, + FIELD_PREP(RZG3S_SYS_PCIE_RST_RSM_B_MASK, 1)); + if (ret) + goto port_refclk_put; + + ret =3D rzg3s_pcie_resets_prepare_and_get(host); + if (ret) + goto sysc_signal_restore; + + ret =3D rzg3s_pcie_power_resets_deassert(host); + if (ret) + goto sysc_signal_restore; + + pm_runtime_enable(dev); + + /* + * Controller clocks are part of a clock power domain. Enable them + * through runtime PM. + */ + ret =3D pm_runtime_resume_and_get(dev); + if (ret) + goto rpm_disable; + + raw_spin_lock_init(&host->hw_lock); + + ret =3D rzg3s_pcie_host_setup(host, rzg3s_pcie_init_irqdomain, + rzg3s_pcie_teardown_irqdomain); + if (ret) + goto rpm_put; + + bridge->sysdata =3D host; + bridge->ops =3D &rzg3s_pcie_root_ops; + bridge->child_ops =3D &rzg3s_pcie_child_ops; + ret =3D pci_host_probe(bridge); + if (ret) + goto host_probe_teardown; + + return 0; + +host_probe_teardown: + rzg3s_pcie_teardown_irqdomain(host); + reset_control_bulk_deassert(host->data->num_cfg_resets, + host->cfg_resets); +rpm_put: + pm_runtime_put_sync(dev); +rpm_disable: + pm_runtime_disable(dev); + reset_control_bulk_assert(host->data->num_power_resets, + host->power_resets); +sysc_signal_restore: + /* + * SYSC RST_RSM_B signal need to be asserted before turning off the + * power to the PHY. + */ + regmap_update_bits(host->sysc, RZG3S_SYS_PCIE_RST_RSM_B, + RZG3S_SYS_PCIE_RST_RSM_B_MASK, + FIELD_PREP(RZG3S_SYS_PCIE_RST_RSM_B_MASK, 0)); +port_refclk_put: + clk_put(host->port.refclk); + + return ret; +} + +static int rzg3s_pcie_suspend_noirq(struct device *dev) +{ + struct rzg3s_pcie_host *host =3D dev_get_drvdata(dev); + const struct rzg3s_pcie_soc_data *data =3D host->data; + struct rzg3s_pcie_port *port =3D &host->port; + struct regmap *sysc =3D host->sysc; + int ret; + + ret =3D pm_runtime_put_sync(dev); + if (ret) + return ret; + + clk_disable_unprepare(port->refclk); + + ret =3D reset_control_bulk_assert(data->num_power_resets, + host->power_resets); + if (ret) + goto refclk_restore; + + ret =3D reset_control_bulk_assert(data->num_cfg_resets, + host->cfg_resets); + if (ret) + goto power_resets_restore; + + ret =3D regmap_update_bits(sysc, RZG3S_SYS_PCIE_RST_RSM_B, + RZG3S_SYS_PCIE_RST_RSM_B_MASK, + FIELD_PREP(RZG3S_SYS_PCIE_RST_RSM_B_MASK, 0)); + if (ret) + goto cfg_resets_restore; + + return 0; + + /* Restore the previous state if any error happens */ +cfg_resets_restore: + reset_control_bulk_deassert(data->num_cfg_resets, + host->cfg_resets); +power_resets_restore: + reset_control_bulk_deassert(data->num_power_resets, + host->power_resets); +refclk_restore: + clk_prepare_enable(port->refclk); + pm_runtime_resume_and_get(dev); + return ret; +} + +static int rzg3s_pcie_resume_noirq(struct device *dev) +{ + struct rzg3s_pcie_host *host =3D dev_get_drvdata(dev); + const struct rzg3s_pcie_soc_data *data =3D host->data; + struct regmap *sysc =3D host->sysc; + int ret; + + ret =3D regmap_update_bits(sysc, RZG3S_SYS_PCIE_RST_RSM_B, + RZG3S_SYS_PCIE_RST_RSM_B_MASK, + FIELD_PREP(RZG3S_SYS_PCIE_RST_RSM_B_MASK, 1)); + if (ret) + return ret; + + ret =3D rzg3s_pcie_power_resets_deassert(host); + if (ret) + goto assert_rst_rsm_b; + + ret =3D pm_runtime_resume_and_get(dev); + if (ret) + goto assert_power_resets; + + ret =3D rzg3s_pcie_host_setup(host, rzg3s_pcie_msi_hw_setup, + rzg3s_pcie_msi_hw_teardown); + if (ret) + goto rpm_put; + + return 0; + + /* + * If any error happens there is no way to recover the IP. Put it in the + * lowest possible power state. + */ +rpm_put: + pm_runtime_put_sync(dev); +assert_power_resets: + reset_control_bulk_assert(data->num_power_resets, + host->power_resets); +assert_rst_rsm_b: + regmap_update_bits(sysc, RZG3S_SYS_PCIE_RST_RSM_B, + RZG3S_SYS_PCIE_RST_RSM_B_MASK, + FIELD_PREP(RZG3S_SYS_PCIE_RST_RSM_B_MASK, 0)); + return ret; +} + +static const struct dev_pm_ops rzg3s_pcie_pm_ops =3D { + NOIRQ_SYSTEM_SLEEP_PM_OPS(rzg3s_pcie_suspend_noirq, + rzg3s_pcie_resume_noirq) +}; + +static const char * const rzg3s_soc_power_resets[] =3D { + "aresetn", "rst_cfg_b", "rst_load_b", +}; + +static const char * const rzg3s_soc_cfg_resets[] =3D { + "rst_b", "rst_ps_b", "rst_gp_b", "rst_rsm_b", +}; + +static const struct rzg3s_pcie_soc_data rzg3s_soc_data =3D { + .power_resets =3D rzg3s_soc_power_resets, + .num_power_resets =3D ARRAY_SIZE(rzg3s_soc_power_resets), + .cfg_resets =3D rzg3s_soc_cfg_resets, + .num_cfg_resets =3D ARRAY_SIZE(rzg3s_soc_cfg_resets), + .init_phy =3D rzg3s_soc_pcie_init_phy, +}; + +static const struct of_device_id rzg3s_pcie_of_match[] =3D { + { + .compatible =3D "renesas,r9a08g045-pcie", + .data =3D &rzg3s_soc_data, + }, + {} +}; + +static struct platform_driver rzg3s_pcie_driver =3D { + .driver =3D { + .name =3D "rzg3s-pcie-host", + .of_match_table =3D rzg3s_pcie_of_match, + .pm =3D pm_ptr(&rzg3s_pcie_pm_ops), + .suppress_bind_attrs =3D true, + .probe_type =3D PROBE_PREFER_ASYNCHRONOUS, + }, + .probe =3D rzg3s_pcie_probe, +}; +builtin_platform_driver(rzg3s_pcie_driver); --=20 2.43.0 From nobody Tue Dec 2 02:20:16 2025 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 85B843612CA for ; Wed, 19 Nov 2025 14:35:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763562952; cv=none; b=rgWJLExVjNMT6p4oTZphFuFBk2+MUY/ha1l5yVySTcCe6w5hE1Rz80Y0Xf0byHFk+9BqXBGZE6acXl34dn/gnjgL10y0TPXVjTG5xEIcNqMZe+x7FGDxt4YOlRAAKSUoMIzVxJo6+9EoIKgn0CHhztqWuqfX0CNDf9U3DpE+Xro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763562952; c=relaxed/simple; bh=oLgillCwr3ol7/w9E4u4ksaOb+6NxowwyKm+wJrPQtA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RImLRvc/nQhVcexX27TF+XQzN5kfj92/Gqo/2Ll8N65rr69OMx1qcO5cLyTEVu7sftyOaVYQrNCY7g5XKBcpddspRzRBTDtrfKuBS79trdvgQhIOOcpai9oEbMw12Kj+Y82mfKRzdi7gbpJ+uRsayS+nSMSvWck5r22APO+txLI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=TqqOeqlW; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="TqqOeqlW" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-47790b080e4so29761295e9.3 for ; Wed, 19 Nov 2025 06:35:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1763562949; x=1764167749; 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=IM2VhAUMoufw5+LLnfeRxVHnf+6zT5XAyOCZf4oWdrc=; b=TqqOeqlWMdP9ohoZyILh0bDpE7jYR1vvY64luk+d/tY4PnVO9lseoDeAoQpy4ivcVi aaCh4qblPh/0JOOdCbnzZUkC+9tcJx8eUCOxlBpFGW9EbUP8IahvEXXU3hZoSH5OypxR 5EPh22azZPtSh6yECT00WXZBcinUzt+7DFjS7G34ir3qSU9ewnACex1ZskGewfr2Pp/l TB5Kl1TVzqhp+rfHLYrHYaDhB04imgGZ4xeXYlJTT1wyM2SemTkwjp9tgYqAqMsbLMjU o4MRp0sE8q7yUS3akAPn8x22SEooRe2+O2OcRjlcsBIpGsgaN2GE4RrVk0F0tlwb4S08 p63Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763562949; x=1764167749; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=IM2VhAUMoufw5+LLnfeRxVHnf+6zT5XAyOCZf4oWdrc=; b=WuaCZ0n8NQSBF4C5wMsV4NKX1LvUHbxmW3h2J4WOfc6Oef2WY9Q9lu31AZ0PgqLHlJ lo4p8Bh3uTSbDHqOP6SmLrJcQkbS3bWN993Esv/ZWx0ntmsj9QkvPZZjxKFiNhROXhrq a3Nr/ulFvXAVVXCdWUEwlpEwtjxqBLMIqpET+pZxiBfOCtErtY4+ikzI64UyOOfRNVD5 K565SyD8814IOYz41Q1PI0aBZsplTQcLOgqPxV0WIWh3L7sZdMawHzJzpWnSNaPJgIKT X/4CBcxc/1HQoMysUgn1ibzirrCw2cgKivmzUL6CfSdLzw5LAnwXk6UAonlAk9uVdSjw Diog== X-Forwarded-Encrypted: i=1; AJvYcCWw0PQZY31X6apcGPJVe7l2juPjfdBKWibIFmTVodMtd/xc0o5wro+oThPCf+8zJ8I+EZkHADG2Fxe8IDo=@vger.kernel.org X-Gm-Message-State: AOJu0Yzs3NziZ+thzNzPfHbS1mFSdMHMkfc93O1zYa6jJMcO1xZwa0z6 dhES65AVej7j2/cW9L3s+VrzNNC+bqtHu0HXBDd/SVp8rUw60tMGs9CUQq4PJKuRC+1Z9fY0giH vzvYTs5Y= X-Gm-Gg: ASbGncvBmmFx7P7Fv//NjiOzs05DvL9IIJ/aAenNhG3jAY2NlWhC5r5QQuG+JPhnBy5 MZaScICGlyG0TXQdFvfJL6wRK5mzHUkYerY3Xh+L2o6GXgsUc8OLzMbKNzScf/8QvjkU/1TZC1z k4t/TOv7Hg94b8b4xdsFyU9t0vS86HVf0vk0rdm5W9HObNU2j+6G9wqRcq6QkNlhuSzfHd9zyro wCbvWobYCGU1FpoVPPkKw+U+HvqmFtam8gm7FSiV4XDrru0rJFEePl9qbxiMj+kIG4JsqaipnZl VdtlAVPy0XP7PBHT97hVVMdP9Rv43QfZ6J1YyAVA5puvIaqhEvJZOTEVDezfxHnOnvWt2Zo9tlG U0cLZYAkoC4wxbQLHXoxGvvBU8Rus05+ksNzqJ3DUnvcBFaHq5dHi3Pl6vuglw4qE7oU8YmrJDb KlsnbKrPC41zSsG6sxEQyT3egdxipLv+1I1misqAy09RDMQ0tnO+Y= X-Google-Smtp-Source: AGHT+IEGiMJoLIMjx5zyljEp90fL86O4kiqQ25tLXsQTYyIDtzz8qjStVtrHSSOGXCpxDhm4kVf5OA== X-Received: by 2002:a05:600c:4fd2:b0:471:9da:5232 with SMTP id 5b1f17b1804b1-4778fe62164mr189433135e9.15.1763562948802; Wed, 19 Nov 2025 06:35:48 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.134]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53f0b894sm39973399f8f.26.2025.11.19.06.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 06:35:47 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: bhelgaas@google.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, p.zabel@pengutronix.de Cc: claudiu.beznea@tuxon.dev, linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea , Wolfram Sang Subject: [PATCH v8 3/6] arm64: dts: renesas: r9a08g045: Add PCIe node Date: Wed, 19 Nov 2025 16:35:20 +0200 Message-ID: <20251119143523.977085-4-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119143523.977085-1-claudiu.beznea.uj@bp.renesas.com> References: <20251119143523.977085-1-claudiu.beznea.uj@bp.renesas.com> 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" From: Claudiu Beznea The RZ/G3S SoC has a variant (R9A08G045S33) which supports PCIe. Add the PCIe node. Tested-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven Signed-off-by: Claudiu Beznea Acked-by: Manivannan Sadhasivam --- Changes in v8: - none Changes in v7: - none Changes in v6: - dropped max-link-speed Changes in v5: - updated the last part of ranges and dma-ranges - collected tags Changes in v4: - moved the node to r9a08g045.dtsi - dropped the "s33" from the compatible string - added port node - re-ordered properties to have them grouped together Changes in v3: - collected tags - changed the ranges flags Changes in v2: - updated the dma-ranges to reflect the SoC capability; added a comment about it. - updated clock-names, interrupt names - dropped legacy-interrupt-controller node - added interrupt-controller property - moved renesas,sysc at the end of the node to comply with DT coding style arch/arm64/boot/dts/renesas/r9a08g045.dtsi | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/r9a08g045.dtsi b/arch/arm64/boot/d= ts/renesas/r9a08g045.dtsi index 16e6ac614417..8fd3659b70fe 100644 --- a/arch/arm64/boot/dts/renesas/r9a08g045.dtsi +++ b/arch/arm64/boot/dts/renesas/r9a08g045.dtsi @@ -717,6 +717,71 @@ eth1: ethernet@11c40000 { status =3D "disabled"; }; =20 + pcie: pcie@11e40000 { + compatible =3D "renesas,r9a08g045-pcie"; + reg =3D <0 0x11e40000 0 0x10000>; + ranges =3D <0x02000000 0 0x30000000 0 0x30000000 0 0x08000000>; + /* Map all possible DRAM ranges (4 GB). */ + dma-ranges =3D <0x42000000 0 0x40000000 0 0x40000000 1 0x00000000>; + bus-range =3D <0x0 0xff>; + interrupts =3D , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + ; + interrupt-names =3D "serr", "serr_cor", "serr_nonfatal", + "serr_fatal", "axi_err", "inta", + "intb", "intc", "intd", "msi", + "link_bandwidth", "pm_pme", "dma", + "pcie_evt", "msg", "all"; + #interrupt-cells =3D <1>; + interrupt-controller; + interrupt-map-mask =3D <0 0 0 7>; + interrupt-map =3D <0 0 0 1 &pcie 0 0 0 0>, /* INTA */ + <0 0 0 2 &pcie 0 0 0 1>, /* INTB */ + <0 0 0 3 &pcie 0 0 0 2>, /* INTC */ + <0 0 0 4 &pcie 0 0 0 3>; /* INTD */ + clocks =3D <&cpg CPG_MOD R9A08G045_PCI_ACLK>, + <&cpg CPG_MOD R9A08G045_PCI_CLKL1PM>; + clock-names =3D "aclk", "pm"; + resets =3D <&cpg R9A08G045_PCI_ARESETN>, + <&cpg R9A08G045_PCI_RST_B>, + <&cpg R9A08G045_PCI_RST_GP_B>, + <&cpg R9A08G045_PCI_RST_PS_B>, + <&cpg R9A08G045_PCI_RST_RSM_B>, + <&cpg R9A08G045_PCI_RST_CFG_B>, + <&cpg R9A08G045_PCI_RST_LOAD_B>; + reset-names =3D "aresetn", "rst_b", "rst_gp_b", "rst_ps_b", + "rst_rsm_b", "rst_cfg_b", "rst_load_b"; + power-domains =3D <&cpg>; + device_type =3D "pci"; + #address-cells =3D <3>; + #size-cells =3D <2>; + renesas,sysc =3D <&sysc>; + status =3D "disabled"; + + pcie_port0: pcie@0,0 { + reg =3D <0x0 0x0 0x0 0x0 0x0>; + ranges; + device_type =3D "pci"; + vendor-id =3D <0x1912>; + device-id =3D <0x0033>; + #address-cells =3D <3>; + #size-cells =3D <2>; + }; + }; + gic: interrupt-controller@12400000 { compatible =3D "arm,gic-v3"; #interrupt-cells =3D <3>; --=20 2.43.0 From nobody Tue Dec 2 02:20:16 2025 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C656435C1BB for ; Wed, 19 Nov 2025 14:35:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763562954; cv=none; b=efpJhsLDnzY/WxhIHXxychirGvcqCWVsfQSv5r5eK9ZmE+jMbXMiHueVJpBPifZeRkA8tJYBZlz12iZbrWifLDrFpevxgHnpT9Ox/wctG5zcmiIWpkqrYWdghQO8+328Te1FLshOKFiTzn20aayKrdZdaN3EMkbLJyfdfnAP5tc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763562954; c=relaxed/simple; bh=11llYBJlsNGu46qBbvgUePXbm5WDYTu1X+hgJv0rNa4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tlbVqaPHk1iLLftqMw2N/DEiQR9WMqSnzkOpHZNmjigSkJtJ4d4uoWqSwtuQ+HselgOxlIzfFTa2kigSHESz16sVAO97Wh8LJB3/7dajD6YqRlL9lfEp9LdCO9Pv96SDbtcDdwi/qCmsrdylSicKyyrAEv/tQMapMJUHhOHyrzc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=UELPLbVE; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="UELPLbVE" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4775895d69cso35792155e9.0 for ; Wed, 19 Nov 2025 06:35:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1763562951; x=1764167751; 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=YNQs+jMGb0vll66kRY8SuunRCpU0Vo1BfiANzBw4F1c=; b=UELPLbVE1WnSMn/cS4lA838slWRaGWPaZgsLYDymmrkD9LBuFTDgHzM23VXe8WxxwR EoXAw6icDtrX49NMgpFZ68iDHNtzvQMcmh2tkOY78eYq+a3i7pmEo44Z8ZuZd0FndX1m RifGHZgN/DFOoRXyQHwYL/9D2vy12FZYxCQ55zQWA8GKGsmzIGNBIrtlSc67npjPr5f6 4pzz2PVwicpeMTWIXktz2kJSfCWjTwskHCuKQVTkLyXBoCbIVPI5wFtyUG+LUHT1ZB71 FXR5XDq1Qmscc7H3ZrPmvxn7umgjahqA0Y5pihUFoonsIrOwZQUzlgpUWG03OdsjzZ5G Frdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763562951; x=1764167751; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YNQs+jMGb0vll66kRY8SuunRCpU0Vo1BfiANzBw4F1c=; b=nEBoeuvaVTLJ+Ll2zfemTUam2j9Uxjlu2tNz5VWf80sSV5ZDts86ItZ8YRW3+KvoQr DyovSuZ2pu0NwSvXDiTX53Yg9ei9JrOVSvv5QHwtn0zKDD3LdN7nAiVy/0FxTvaiSQgj ub6sz6lwiFHQySG4S5phTHeo/XqXPl/n9zYLmTvdyBN3tYc/VM7jXCXhexptTW/aj0Dg MRdF7Uz3uAJI4VPq0PpbEmrmoXFzuvDgi8dhq4XqJ+qXzYGWbh6e2fINoeBLJKYF+zv3 CNdeeKK5m+CigTTIUvCI4MYXVoI2mkQbWdObusZZTGF5RTY1OFYlfwpI8Fn2VJDyOo+D Z70Q== X-Forwarded-Encrypted: i=1; AJvYcCWd2dC7Qu9rU3i+SpaGnB4YGE/MaFpCm2xo7tSk8yIfRunsBEwCMbr+sZ5x2L8nM0hend7EiYqo5rK18Us=@vger.kernel.org X-Gm-Message-State: AOJu0Yy6Pq9Zu6XgL1Ouy+Wsdio1Pa4lChDoVNHtTJtih/dDqbYri3AH VLiz29A/XDDSYuwuTsqSbh02avBqFHngtNbKpcY2BeBJcEMERmsjhgbPvPIXNjhB+kE= X-Gm-Gg: ASbGncuBZmwT2xlOjJBgghL1/X0uKLZqZma00wzcqz+qbNjaNMqlAIk9Uh/rmHe81GN u5pyRAlhJA97oO9V92eLTDoPkpS8HvZxGmwN2jaOaqiCQ4HHYTwHBnAauNz0iBR+ZNnghhCstFR EJcFoUdHLkj1p9V3KIYJ6AK0ZXYS191GmHsr3bBX+KayRpg71eifeepyjrGb/8gNXWhprRr/1Ir 6X1VYw7N/hdwxuyAHZlNNiCuerkLp7vT8KvRFaWpe0EOTfKzrAp2k1iyETo15+AWt41lZMiyeUZ 68rl+GW3EX7HSizXUrh2fSlv0iYnqf7tXdaxRrRFzCkpcaUVBcqWXCfDCKO7dxVQfKVOKV6yDqk 7IPLwAkR/uAB1qX3vO7bFOWGO1Y4Rxte6A7DTj9h6AzsPZZJr5voqYoHp3kvVHIaEQRPPa2nWZH M8qD0e3vT9+detgoidD3Fqg60HgMGwbIrWLGf9U6vE7PV6UplGeTc= X-Google-Smtp-Source: AGHT+IETrxRzLL90ssPWWldKaErlCBtXruYKnH8kKJ9M+zXXzSsOk2J5nfNKsRlo8J6q3wsX3XzrlA== X-Received: by 2002:a05:6000:1a8e:b0:42b:3bc4:16dc with SMTP id ffacd0b85a97d-42b59350576mr19482167f8f.21.1763562950591; Wed, 19 Nov 2025 06:35:50 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.134]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53f0b894sm39973399f8f.26.2025.11.19.06.35.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 06:35:49 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: bhelgaas@google.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, p.zabel@pengutronix.de Cc: claudiu.beznea@tuxon.dev, linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH v8 4/6] arm64: dts: renesas: rzg3s-smarc-som: Add PCIe reference clock Date: Wed, 19 Nov 2025 16:35:21 +0200 Message-ID: <20251119143523.977085-5-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119143523.977085-1-claudiu.beznea.uj@bp.renesas.com> References: <20251119143523.977085-1-claudiu.beznea.uj@bp.renesas.com> 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" From: Claudiu Beznea Versa3 clock generator available on RZ/G3S SMARC Module provides the reference clock for SoC PCIe interface. Update the device tree to reflect this connection. Reviewed-by: Geert Uytterhoeven Signed-off-by: Claudiu Beznea Acked-by: Manivannan Sadhasivam --- Changes in v8: - none Changes in v7: - none Changes in v6: - collected tags Changes in v5: - this patch is the result of dropping the updates to dma-ranges for secure area and keeping only the remaining bits arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi b/arch/arm64/= boot/dts/renesas/rzg3s-smarc-som.dtsi index 39845faec894..b196f57fd551 100644 --- a/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi +++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi @@ -172,6 +172,11 @@ a0 80 30 30 9c }; }; =20 +&pcie_port0 { + clocks =3D <&versa3 5>; + clock-names =3D "ref"; +}; + #if SW_CONFIG2 =3D=3D SW_ON /* SD0 slot */ &sdhi0 { --=20 2.43.0 From nobody Tue Dec 2 02:20:16 2025 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F260366545 for ; Wed, 19 Nov 2025 14:35:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763562956; cv=none; b=GZEQ2txwovvcSa64ucjeQlTtIDsLWfTKS55ub7tDQT4CD6Tc2NrfFy4TSYcZrifI/GWk0y2KXUpJO3jEG7rmXniEscJ2sABTJLOI7t8YIgkS9zuy9m9sU6He/gPJba3+AzhqS9BKzTq1h5nNXbnswCnt+kJnpo5WQUDD8VvLc44= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763562956; c=relaxed/simple; bh=chd+bQesJb2L3x0eNh9hGNo1sfJ6ukKT0DUAGIoBLX0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NLBeBzKWPrrJkSH+MGJ3JWgG+4kLL/yd7a956lLTh5bcz7nNyK75gj7Vh0DVFU9+GGzY4GYlG346uESf4F7irHIgdkGCg9x+TGJLmFnChgjc6AylLUkLBmeinks86VUoGUqUGxcYVq5jKWkcN7tDsYbB3+pwCQ/qU2kXkgrX0Oo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=Pk6IkX/N; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="Pk6IkX/N" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-42b379cd896so3942387f8f.3 for ; Wed, 19 Nov 2025 06:35:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1763562952; x=1764167752; 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=+1SxqpFp7EveK0lxmcv0OJIyPAs1tqhEaS0Hczva7EE=; b=Pk6IkX/NNOHD+z3yRwHcEzI6d02PeTV7t8k79ZT2HPE/enOPDDSqU4L/AtSSHTV/e/ bweDHo9SgNjEqUR5tH0IHOSw/JbpVUsep4+iKHz8hF0MyW1Sxc0YP3eQD8A223NwdARx xykiP0ET8n4x3HmhIKlpi2vwmztqH9rVY9DxXMYp1+u7cDFx8zQWFrWOEIUDEo0BcikC xb+i/aFgwwUYyObWxJ1BLwIu0I+VSDpMm1/9Cre08eti/YvtA9DWqtlDMpL87uBke0x2 ++5uTzxOwf4jZx4LMYIX3qZ7zbfaDFXQLyhrHCFzfY0VTPzhWVPSawE8n+5neu3wDkDs pyeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763562952; x=1764167752; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=+1SxqpFp7EveK0lxmcv0OJIyPAs1tqhEaS0Hczva7EE=; b=haBTHp6g/SrB1LSrxFvPM10oC5geofm24LZ4wHmjFZHoEDDxBo42zosFt7c+pdLUVq 310NHMQJtNfFV1KNVlc85xSRY0bxqRDKuYnYLJhlbEIQ+4fN30VisMGsF6Bj2eYNiwS+ j6cMaRvpjVhy1SxAiHagC72eWUshHwy8RvJbWiBw9VOyLTEPnWfwQ1/xrSs8OTJdnAsv vcYKKor7+XXRHK3Ti0tcT48emfwbWPgOMj5C2/1FlgMEFtER0TR7uEzgnbusH9SgHPY2 tX1i2qZc8sX28CSyeBdGb6vUeTf+HswcgdsyCIYVFE1JMvSmVGDbkqGHZTugga8+Iyu5 k6tw== X-Forwarded-Encrypted: i=1; AJvYcCWZqr4yqt95XKOb6ZiEz7MBrDPm79BVcB/ZN9U5GCeudZ4UOzGOWVlrQdAE3AlePmx526LSqj6TXRpaUWY=@vger.kernel.org X-Gm-Message-State: AOJu0Yw2doc1fUwlOEgB7btrSXM/jExo44IqILU+FUcaZQvAJHjVETWg 7jXublURNgSA5maNVDZ2UcLY/C8do24kEeptfqGCSdLDxahqq4miy+zZc8pVsDcGBKo= X-Gm-Gg: ASbGncsk6h1NP0e16d6DZMPjnLCU3KncOGEJRCbxHnTcw8O1soupvLs9+zohgeeyywW 8x6XMvehB7MyCq2IFm6pwSIY7tCOYe9xSXx5e6Sk0NyP3yedE254ki2VsWtgM3XOnoLcILxv0yU rtEOiJD3R7WS5bUrqxQrQYqGzNGAbhdN88dW3GUfMCn0xT4Q5nSrz6RhnQHa5tCcQEpSaiV2lj2 cLq5TfNoHJo9Cf4ggfLXT6i8dyARRHM0IWScSxwDAWmkJPCybRpxv+XKhlom7OvGGpmInKJnrHx nzIztKPhO09LHe2J7Pr/kXmx1XeaAMksNOxjECf0mg4+zOlySdajzZ0T9/5i4teonVEzW8r7Csy R9w6UJQ0frGO+Hh63pgKYMWUw9Izlyhy7w/sY/KVa88QK+VaozjB+aJT6/OiNl48Oq+9g47hrHX k1k5xxxVCRJcwKg5GqRRWcu+VSC71Iqo1JylXOZcMs X-Google-Smtp-Source: AGHT+IF0e9B3ky1biES/Rv32imPBPNDCYeycJDEm/fa0WjGwv1dIJ3oB+znuXn9yZSJoHfPlbXgr6Q== X-Received: by 2002:a05:6000:22c2:b0:42b:2eb3:c90f with SMTP id ffacd0b85a97d-42b5935df10mr17441813f8f.10.1763562952459; Wed, 19 Nov 2025 06:35:52 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.134]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53f0b894sm39973399f8f.26.2025.11.19.06.35.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 06:35:51 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: bhelgaas@google.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, p.zabel@pengutronix.de Cc: claudiu.beznea@tuxon.dev, linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea , Wolfram Sang Subject: [PATCH v8 5/6] arm64: dts: renesas: rzg3s-smarc: Enable PCIe Date: Wed, 19 Nov 2025 16:35:22 +0200 Message-ID: <20251119143523.977085-6-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119143523.977085-1-claudiu.beznea.uj@bp.renesas.com> References: <20251119143523.977085-1-claudiu.beznea.uj@bp.renesas.com> 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" From: Claudiu Beznea The RZ Smarc Carrier-II board has PCIe headers mounted on it. Enable PCIe support. Tested-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven Signed-off-by: Claudiu Beznea Acked-by: Manivannan Sadhasivam --- Changes in v8: - none Changes in v7: - none Changes in v6: - none Changes in v5: - collected tags Changes in v4: - none Changes in v3: - collected tags Changes in v2: - none arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi b/arch/arm64/boot= /dts/renesas/rzg3s-smarc.dtsi index 5e044a4d0234..6e9e78aca0b0 100644 --- a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi +++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi @@ -132,6 +132,12 @@ power-monitor@44 { }; }; =20 +&pcie { + pinctrl-0 =3D <&pcie_pins>; + pinctrl-names =3D "default"; + status =3D "okay"; +}; + &pinctrl { audio_clock_pins: audio-clock { pins =3D "AUDIO_CLK1", "AUDIO_CLK2"; @@ -159,6 +165,11 @@ key-3-gpio-hog { line-name =3D "key-3-gpio-irq"; }; =20 + pcie_pins: pcie { + pinmux =3D , /* PCIE_RST_OUT_B */ + ; /* PCIE_CLKREQ_B */ + }; + scif0_pins: scif0 { pinmux =3D , /* RXD */ ; /* TXD */ --=20 2.43.0 From nobody Tue Dec 2 02:20:16 2025 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 3DCE73A9C0E for ; Wed, 19 Nov 2025 14:35:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763562958; cv=none; b=KQFGHtjwNDbh+mhh9yfJhYWN9t/zjjBXikOImEwylBuD2rpRCi6rNhopahAq+PsATB1ROxUuLYQFPg4C1jcoeoDghuwB1xEcPLtdGcG4JXvlhyluPqC0YJT31khe5450v0V2tJQyMXqKyuLLFd0h8ySaA+EAdXL2VKgO0fgK3ko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763562958; c=relaxed/simple; bh=GxxNnKqOhhteuHOBQbAn6ykS5DynDGw/557Fxfc/0MI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MLiyXWvy+jJmTJSF7vZQ8R9jQOMugDsnNbJH8erUsaiZir+veIoUZTJczJ6xgbHL8KwShOAlwhnXnUOTVh6nlFHa4N5VS5gYjRJPWNLLFCLA7Ogsd7R1BJpQpGZayXO/GuvJt9YfO48cpBQkCPKHhNI/GEI4wLtUuIG59Jq1f3M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=bPqUCbMN; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="bPqUCbMN" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-42b3720e58eso6226895f8f.3 for ; Wed, 19 Nov 2025 06:35:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1763562954; x=1764167754; 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=YE8+3pdeBgHj1yFTM9VT3Mx7PcWOCuB8Xgf4pUk7jgQ=; b=bPqUCbMNu+n/VTE/gI8v9H9621pt7VydXpcpFX1VcbE5fCRXAHJd9K2lv09NvIQ0WU 1z8LOg8d4mXR/X23Ki0D0PEQw6rbikm6/qv96guleehIfiZ8Up+OJkLALModhiDwHZ5m xHxFjL5ge64gnkDk9Be81JZ0h52Y2bxRCpcP7Z/fFP8ZsOjPyWvRGVZB+m1nyG7ZWBRu wVd/5ywQZbY0nN22f+CHYBW2lEUnJG8fr4cPzsoFKnkwXcT4ZDt1NkmklEcwi9JA6qmV dzRMCubbh+g+An8RJEKA9XxPxtuZEzTspxVw2W1K5+zPjDFlKhuEph9Be48q+8jXW/1K L0YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763562954; x=1764167754; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YE8+3pdeBgHj1yFTM9VT3Mx7PcWOCuB8Xgf4pUk7jgQ=; b=I+KxKinyi8UiI6g1y4xnse6yBR5nWUrMmObB73ja52MktG2dz3A11JkrkLdFO33EOO N+fbJDJLn0e5bdalJ9xmGazj6z9qvkEV08oM52lcIVjiL4apyv4Il8R4aTNm9fn/ODhu eBQBG1dQW/49yLVBnxWZ0EUg3Wq6UudvwCgwIEmUpFlKFll3p9+AKaEQCUac2GWXltKU OImbX1pqKwT3pwEX/5bmTsWkxLpIXuahLpJCPLD3Bp5gOutIr+4vv7hCAm33YBUNMAro Hl97XkxjCiFvRd5nTKoG6p7xmvCuUpzAYECnYZL/lX8w5w2paA2R9dh8pIJ8x1YNz+Cf rh1g== X-Forwarded-Encrypted: i=1; AJvYcCW3k7m/91pUZRF86oijWLRmrwDw8GJb7QdnA6hu5d2rFac0o6UezzrmXMu1SqrRxwqpHUjINPB0KRA+z8k=@vger.kernel.org X-Gm-Message-State: AOJu0YxKXYbrtWr8L0lcU1GO+xeAiFG7dWe1qkudwPETbqkJbtXope4z XMLPHgtLG46btLW6LboeviwgDCLqaZQ8yTuC487jZr9S1M2WxRavF5UAQeb1XwXh6e4= X-Gm-Gg: ASbGncvGhYMO35CefMt5uX31+78ju86mjjE0k/8i2A8wIhkGKOqdG1xdEa+VCsVR6KL 7DAJS4ly756WFGYPm3es0YCNUZZTo+kc25iBmJvvcdRPndFVLQuFqnjyvLxcrXQB5upQxeLcPV4 Pc67Qq0QvMgSlsNgkkvoalSYFc0PGKuBASss/p+xvFoNMholUKc3fk8ACR3swgNM9apImyranyx dSP/iRzZLPQrJhPkcwSjlS/lEAIlc1cPZjU0E1/y5thhVP9QR524VhcFp4u468mA0I/DuRhOPdz VZYx1rP7Dgqu19PLdxyyVRlI8mnSiaUSh5uGKxHKFV4fuCWKPfZCVWOGHeeGFcn5NdHapb3xVdr Hni7GCdNTddg9ENi7aLYXH+HLrprCMr5V3nz8Gc99FMk9VrTRklScNY1mg/HnB0nuc/M5C9WkbM 18o5M2+I7MrEJQK6elnhVx2LmBHRGKNzs3EWLXhLDuThO/caBpjoI= X-Google-Smtp-Source: AGHT+IEd2Ccf5fjluRhtVp52Y5wk7ZOl2KQ0o3HpW4E+mTPRtKka6q7IqCIxDBj/nihRBjkex/U8QA== X-Received: by 2002:a05:6000:2585:b0:426:ee08:8ea9 with SMTP id ffacd0b85a97d-42b593901d2mr20461307f8f.44.1763562954457; Wed, 19 Nov 2025 06:35:54 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.134]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53f0b894sm39973399f8f.26.2025.11.19.06.35.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 06:35:53 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: bhelgaas@google.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, p.zabel@pengutronix.de Cc: claudiu.beznea@tuxon.dev, linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH v8 6/6] arm64: defconfig: Enable PCIe for the Renesas RZ/G3S SoC Date: Wed, 19 Nov 2025 16:35:23 +0200 Message-ID: <20251119143523.977085-7-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251119143523.977085-1-claudiu.beznea.uj@bp.renesas.com> References: <20251119143523.977085-1-claudiu.beznea.uj@bp.renesas.com> 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" From: Claudiu Beznea Enable PCIe for the Renesas RZ/G3S SoC. Reviewed-by: Geert Uytterhoeven Signed-off-by: Claudiu Beznea Acked-by: Manivannan Sadhasivam --- Changes in v8: - none Changes in v7: - rebased on top of v6.18-rc1 Changes in v6: - collected tags Changes in v5: - dropped Tb tag Changes in v4: - made it builtin Changes in v3: - collected tags Changes in v2: - none arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index e3a2d37bd104..54fd09317edf 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig @@ -230,6 +230,7 @@ CONFIG_PCIE_MEDIATEK_GEN3=3Dm CONFIG_PCI_TEGRA=3Dy CONFIG_PCIE_RCAR_HOST=3Dy CONFIG_PCIE_RCAR_EP=3Dy +CONFIG_PCIE_RENESAS_RZG3S_HOST=3Dy CONFIG_PCIE_ROCKCHIP_HOST=3Dm CONFIG_PCI_XGENE=3Dy CONFIG_PCI_IMX6_HOST=3Dy --=20 2.43.0