From nobody Wed Jun 10 06:15:18 2026 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C236F34216C for ; Wed, 20 May 2026 16:49:13 +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=1779295757; cv=none; b=tLwrgJ/tSOxzPWOdHitJz46Tig4MRBVd+t8YCe15iVBR+2AXkVfC81XlRVHhoShk+cjDpewRpYBwN5SGujZspivEbuM3Bdh8uRsezInaNgbzaa/OmmOkXTKwHIiZFsB28qGvEyIfGcjvJuzryTqd4r4XOZzGrGwi+DLQ6VwUD8k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779295757; c=relaxed/simple; bh=F6+RYDULt4OCEld7JGFE9rEHRKCd9PgaJxEgaJaHdgE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uZ4F5iz80RrPj05IEXJsbDG6Wa1QZsavtwIByK2QVB1yHGwuWaGllAVYloTTiqQG+C9doBGQXD/70/6Gg+ljPgHiR+6Un3OMZ2fkROpjY5ICXr8TIcUq7UM0ZrV+qKTm+uncKp44F54C/ZSyv8CWd4KW4oRhTKcNbDwtTAo17sQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=V1XumvJu; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V1XumvJu" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-49021532ebdso20268095e9.2 for ; Wed, 20 May 2026 09:49:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779295752; x=1779900552; 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=9Z0EKz99OQ69IIyWqmPNk9Dp2si8fNBwQRm1/KGhrU8=; b=V1XumvJuOp5WFPElm5X+4zLWup5CnF55cv9YJzR0SP2dZy9lopJDFmZy+edp4P/NXH hgaza5Zex1CAJ1ZkENzToNbA3qqxghbVRjNY2ojgv1ivKs0Sy3jB71sLMxMJc8ieRXNw zXfHO+YUGMk+KIPk2UJ9cVXGNG9EV97SmCJyZ3379m+X7unm32COST8ClRclUzfT+IHj 3Cox6SDNofDBZHXLbry90rKbVac1QpA6Gwrr/NlHi1GHTQArD5EQ7cmgZl9yBtmgaRZE cGL0FZ24pet3Z06/XZrOJb+X7usrxaXuOvXuTAQfIVqkVP3FdDh20IVakjo/7wv8Lysx h3WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779295752; x=1779900552; 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=9Z0EKz99OQ69IIyWqmPNk9Dp2si8fNBwQRm1/KGhrU8=; b=ZyCcfZjUHl61JKZGGC22GT3+Y+J18Zq2X0RdkHgYO64AetcCtHu5RfwYOsXFEjXzqc 8uxjFLyG4RtCjCL/7Zro5+kGMPy+LqDb2tfsbCigPjVeYLyxsC40RB+IiwRPWHSqTG2Y U5F4I6+Wh5NPkWgye+wgXsSCgtZRZQuRln8OlW0v/0gIz7CEpwE4VoQyK7in3bCfvwbt wPFb3TM+AMhZ3Jw+FtWY9e0JSVCvPzRO+StsfSLpWu+4ar0ife3SretQYKtQTUww7YTk dmNbs8bmgJEPPkoEYbMwkXmBEpKthBPXei5qTYuc8Ba1aj2/hBXi0OnPV5/cNeLfqKFa Iusg== X-Forwarded-Encrypted: i=1; AFNElJ+oOoIaJxKeFQ5ybZ0sUSRPcp5vg2OLWM3ZfVTgrq2g/sxQPiBsE25Lo1qfqhP3SFV10GrtU9lXWb8SPoU=@vger.kernel.org X-Gm-Message-State: AOJu0YyAcrdhInQ0Phl7+xbh6tjRSbj3eeK6zrRWqeHLXU0bneqa6Crx dFowDF27FENT+dgx2mWhlgV9vqfpOiog6VzEFfz1L356KKGBySnHikA3 X-Gm-Gg: Acq92OFI/v+5cbbEyqB5DcWF4GiR2NhewIWG/KiccZB916m/fdLzv6tmcoopL2qyuZ1 Y3vvCTpm0a0iX/zB3j2n76bm3ICmMNUdPeMNoCUCcYOOX3MDtUXFCRRmtkCGNKrIfOPJpLQMe34 0JDb0Vgfe3pE7sCwJdUQvAwqmgVUXAFGAeeLyBE9nHIEL8/0m+MFhWho+vtSkTDynefoR3Qn0oy hJ23FqZeTSrXd3pjn8cm7iMfJdbi+PWcF2BvGfeVJsSQcLbD5O1x1X44jfe6XMnr/3p3loxyCq1 Lw/cQ7D9Wee5+HDgUHAX/NryopBBvgwJAfGUxTspKWmStbD2a7kAUN948WK/HXZL56zLKECFhww 1EKzun0I30jS8cx0um+aQAsdtG1EuY8nUfUUZyZCtapuDW/QhTne1SPEBAfNP5PwPyXHkYfNbbq TNjr1KDm5+2J7tn4q+SWkRhiweqcNrGgXmCx0zQiKoCBa3gJMhXiJ1blrj7X712a4ZtoQEhWsr0 MeNsZOkrQ7jSJ1QRTbZlrJLofB/8rEt6Ca2jN/jGO6Goc2rQblKaaK7wA== X-Received: by 2002:a05:600c:858d:b0:48f:e230:80a3 with SMTP id 5b1f17b1804b1-48fe6514c31mr301498345e9.33.1779295751631; Wed, 20 May 2026 09:49:11 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:dcb8:81c1:dc9e:cd68]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49033d8e71dsm3110285e9.9.2026.05.20.09.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 09:49:11 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Manivannan Sadhasivam , Claudiu Beznea , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Geert Uytterhoeven , Magnus Damm Cc: linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v3 1/4] dt-bindings: PCI: renesas,r9a08g045-pcie: Add RZ/V2H(P) support Date: Wed, 20 May 2026 17:48:20 +0100 Message-ID: <20260520164823.436992-2-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520164823.436992-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20260520164823.436992-1-prabhakar.mahadev-lad.rj@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: Lad Prabhakar Add support for the PCIe controller found on the Renesas RZ/V2H(P) SoC. The RZ/V2H(P) controller is similar to the RZ/G3E variant but includes additional registers and configuration bits for PCIe lane control. It supports multilink operation configured as either a single x4 link or two independent x2 link controllers. Unlike earlier SoCs supported by this driver which only feature a single PCIe controller, the RZ/V2H(P) SoC implements two controllers. Both instances rely on the system controller (SYSC) for configuration, but the required registers reside at different offsets for each controller. To correctly identify the controller instance and map the corresponding system controller registers, update the "renesas,sysc" property to a phandle-array. For the RZ/V2H(P) SoC, require an accompanying cell to specify the controller instance index (0 or 1). For all earlier SoCs, strictly restrict the property to a single phandle with zero argument cells. Additionally, make the "num-lanes" property mandatory for this SoC and restrict its values according to the hardware capabilities. Signed-off-by: Lad Prabhakar Reviewed-by: Claudiu Beznea Reviewed-by: Rob Herring (Arm) --- v2->v3: - Dropped using linux,pci-domain property. - Switched property to phandle-array for renesas,sysc to support multiple controllers with different SYSC register sets. - Updated commit message for clarity. v1->v2: - Updated commit message. - Dropped un-necessary new line in schema. --- .../bindings/pci/renesas,r9a08g045-pcie.yaml | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/renesas,r9a08g045-pcie.y= aml b/Documentation/devicetree/bindings/pci/renesas,r9a08g045-pcie.yaml index 90086909e921..09d78bd1a577 100644 --- a/Documentation/devicetree/bindings/pci/renesas,r9a08g045-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/renesas,r9a08g045-pcie.yaml @@ -14,7 +14,7 @@ description: | with PCIe Base Specification 4.0 and supports different link speeds depending on the SoC variant: - Gen2 (5 GT/s): RZ/G3S - - Gen3 (8 GT/s): RZ/G3E, RZ/V2N + - Gen3 (8 GT/s): RZ/G3E, RZ/V2H(P), RZ/V2N =20 properties: compatible: @@ -22,6 +22,7 @@ properties: - enum: - renesas,r9a08g045-pcie # RZ/G3S - renesas,r9a09g047-pcie # RZ/G3E + - renesas,r9a09g057-pcie # RZ/V2H(P) - items: - const: renesas,r9a09g056-pcie # RZ/V2N - const: renesas,r9a09g047-pcie @@ -139,7 +140,13 @@ properties: - clkl1pm clock request state - power off information in L2 state - errors (fatal, non-fatal, correctable) - $ref: /schemas/types.yaml#/definitions/phandle + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: Phandle to system controller + - description: PCIe controller index + enum: [0, 1] + minItems: 1 =20 patternProperties: "^pcie@0,[0-0]$": @@ -220,7 +227,9 @@ allOf: properties: compatible: contains: - const: renesas,r9a09g047-pcie + enum: + - renesas,r9a09g047-pcie + - renesas,r9a09g057-pcie then: properties: interrupts: @@ -235,6 +244,25 @@ allOf: maxItems: 1 reset-names: maxItems: 1 + - if: + properties: + compatible: + contains: + const: renesas,r9a09g057-pcie + then: + properties: + num-lanes: + enum: [2, 4] + renesas,sysc: + items: + - minItems: 2 + required: + - num-lanes + else: + properties: + renesas,sysc: + items: + - maxItems: 1 =20 unevaluatedProperties: false =20 --=20 2.54.0 From nobody Wed Jun 10 06:15:18 2026 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C10823630BC for ; Wed, 20 May 2026 16:49:14 +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=1779295757; cv=none; b=ktfxx3GoObUvJ/3FqxDtd4zGHADPpH2MgTugt+HWdHR/XRX89+EnyJU7XaBxaP/KvGs1tbF/2YRP257JNnkbQuoudjrSVLy6vUoascmTVULraFXuVdFJnB73N4zsP4wOqpqMlgoeo+pNlRoNTatFTb4VDWCPHGE/hRYVhEQTfkQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779295757; c=relaxed/simple; bh=KHCNdg8WDuW8IcELyLOslLxssl5wbWlUe6xFPFofttA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ha4veNG3wo64PSPLJ95+geol48GoHpb9hEDNznMFhgcVeeRwfJbGqnM/kpf17ebQHKXbYZg8A5EbCJ05jRkRDR7hr5RdaAGVuoB4tC11HbIu/S/8IH3KmWeAfJKTzgL730gWbLvskbnwDkS0bX/M4HDSUcg7ArKYNurD9x+KfOM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YVk8b0L+; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YVk8b0L+" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4891d7164ddso29002795e9.3 for ; Wed, 20 May 2026 09:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779295753; x=1779900553; 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=uRMlPPpvWg0+TEQtNgaYgNZz3rw+h40bKIEhdoGDsxg=; b=YVk8b0L+rlmt6P9fuWhXkVZ7LDvpGLj3gturB7s9lnZyek0mTr+WEBQnK7AmXtmtT3 ie0UzU5iUKazHnLpjfcFuS7/gM66R801sqqkKfqs/tGyQeDJqMCfN3d+wMVA4K4LRvuh 4F1knett9Iw/BcbZZRsc1JfFpIhlUCvL12wS2ArEDh9kOCzkTFDV6hAj0XxKFNVVlKt9 BjmU4AJEdVja1gNhwEf4+SkT54/6+/fuRiQLY1GCGBPZtlXN5+B3zMPSDpQOIguRK8At 4tcjqIoKB8asUzhUkrMq9tDx8mzc0zBtzTfAVwwzHQzuMmDuyaGsZLQX5ZhZTRen7aiO tphQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779295753; x=1779900553; 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=uRMlPPpvWg0+TEQtNgaYgNZz3rw+h40bKIEhdoGDsxg=; b=NvXxsP3kPfxjlszSSXiREVs8yRdARyysSv6rEiZWX/QABwIsDv1n62SMiVUc4RnqXP vAHqB3iNepLdGwZWVe54HHeaRjnFG+8H2J1nDVoFLIxw+NxSC/VLc3z+S/YTnIwa2BVT AGPORzOkxNvG9TlMQomIIN7R2gBleXUuZGje9HJ4Y+1Kwipfh15kGN6S5PYWoFeSSuVv oNRqjr9wSZHfQKA7rfrjyGTAiqiPUEUl1rxXJXBAHY+MeNoRAOYvJSWh2NqI8BUmW137 8nkm0H4hi3D5GliZkEYNzvssoiqcPKplLrLIeQMF/cg6Qp7Rha6w4smzT0UvnyXIUXgv TFAQ== X-Forwarded-Encrypted: i=1; AFNElJ/qavT1q2oJsmm9YlMoZuXddzCnFnGzmtqXTGPwQCZTkRx+GvFCcZdXt5QfrwBxTLmEDfGO6iiuCVfBu0U=@vger.kernel.org X-Gm-Message-State: AOJu0YwrrzAZ88HHTTYr4fgnPVLyScntBS0929/s+yOjR4zGul6bL0XT n0wbdkjQIjfeRR2z+HlXnj3NjMFtMBJXmzf7CT2A/X3yg8B0sWFrcRMV X-Gm-Gg: Acq92OHpfTchS0x8HVsTzj1AnT5ASxJn5LzUctulusARHjQp38aLq8TM6YfVeb4U9Kg 8n/bFHyg7Kq72rGg7QMVrew0vvZ86MZlGU8PQUjGSjL/lw5qTlAX9notD4ru3JjBFcetYQ0H3xg BuzQHQtYgafWnlk+IAsgJoLJfIOfHAoh5wZ0XMOmR4UdH9lLzUBKIRB6EftEQo4/Cbx/WtwXRmp lq7YCu7DHZlQ0VXdJSUL0gEUojQjwj/GyHMi7v9J2gkvNW8WYHo+LdX2KHJa7xf3qdkw0AOIlS1 oAOe+JWUoke85P7Ht47Ie3WSJpSuTOvDY0Ck+cZBt6XAUi+OwT/QnWlT5KUwFx7lLgasikH/bGP X1hWuPbUmaiA9fzDzb1fYCahWP9Oab3GfFcnOJEJy0XN8YUl7JsOgH6f12OI38u9g2gHJhgJzV1 Bubn6w1QwayQzsQoDNxy98xo+52OGo56w8/xvyb6HBDlzM63F57ScMjV8F+tVpS2gpSQBfA+Rap 5oBXBNUhI6K3ZBZbAIFebDeEfy3sQCj/dksCXUN9TBNvXS6mJVN5Z7geg== X-Received: by 2002:a05:600c:4692:b0:48f:d5b8:5b07 with SMTP id 5b1f17b1804b1-48fe63253e0mr403611915e9.20.1779295752770; Wed, 20 May 2026 09:49:12 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:dcb8:81c1:dc9e:cd68]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49033d8e71dsm3110285e9.9.2026.05.20.09.49.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 09:49:12 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Manivannan Sadhasivam , Claudiu Beznea , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Geert Uytterhoeven , Magnus Damm Cc: linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v3 2/4] PCI: rzg3s-host: Use shared reset controls for power domain resets Date: Wed, 20 May 2026 17:48:21 +0100 Message-ID: <20260520164823.436992-3-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520164823.436992-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20260520164823.436992-1-prabhakar.mahadev-lad.rj@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: Lad Prabhakar Switch to shared reset controls for PCIe power resets to prepare for RZ/V2H(P) support. On this platform, multiple PCIe controllers share the same reset line, requiring shared ownership of the reset control. Signed-off-by: Lad Prabhakar Reviewed-by: Claudiu Beznea Tested-by: Claudiu Beznea --- v2->v3: - No change. v1->v2: - Updated commit message. --- drivers/pci/controller/pcie-rzg3s-host.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/control= ler/pcie-rzg3s-host.c index d86e7516dcc2..a5192e4b58df 100644 --- a/drivers/pci/controller/pcie-rzg3s-host.c +++ b/drivers/pci/controller/pcie-rzg3s-host.c @@ -1276,9 +1276,9 @@ static int rzg3s_pcie_resets_prepare_and_get(struct r= zg3s_pcie_host *host) for (i =3D 0; i < data->num_cfg_resets; i++) host->cfg_resets[i].id =3D data->cfg_resets[i]; =20 - ret =3D devm_reset_control_bulk_get_exclusive(host->dev, - data->num_power_resets, - host->power_resets); + ret =3D devm_reset_control_bulk_get_shared(host->dev, + data->num_power_resets, + host->power_resets); if (ret) return ret; =20 --=20 2.54.0 From nobody Wed Jun 10 06:15:18 2026 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.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 AA09131F9BE for ; Wed, 20 May 2026 16:49:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779295757; cv=none; b=VcKI+dfiH+NXjQEorZc7FSlxV8KifvjYyQXxyw7A5w+ovzaa78Fkm4cfKcB/seTDW4SFoXMvIXu6+6g5RkkELaey2UTZkOgziZfMEct8gy3ga1jeC3ZganJyk0Xvb/i085N6xCadPO94v0R88gzh1vP+BNjW4aIsAi4p4h4rOAw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779295757; c=relaxed/simple; bh=IffwwzS6mxt9E+MupQMia2lUc0CzJ/JnFkty4R2zCW4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LuGiSmgKyZT3626A9t+JkeRlQtULgrYcq2IhDFv0/cO2jmrKpNOHlFpCktG/zpD+htmyCIZ/Vj08LwZydwh3iJhS48j1yIRICx4aMmMHm7pYvsZCkve8VnIx1kCZsudBVxIXTTJ7TzbMoY77Fl/jjADW9FIvcnfp/PsXTbSkkYY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VfqOhvwa; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VfqOhvwa" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-488e1a8ac40so47741735e9.2 for ; Wed, 20 May 2026 09:49:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779295754; x=1779900554; 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=GiT4GoPWpBPCpjw1giXUMYXIVEB55hR/7Bfzyfrs5eA=; b=VfqOhvwaYZ5nbTtqH9+QVNvTMfOCcRSRbtBVcBCStB/h1ef9Rf/7gjbtTQkkWzYhpu kbgvzobzgzM7LIC/mRLatc+lsnBqTLsSrsFZ7ShQ9mImOL1wYhvL9Ce5oSxFdR048e5T gkvjyJKwy4jvlFXdiT1I52VpuPq2a4x3ANZRgqQlM0qTiIY3YKZEW+lE/hhZhpogOXvU EPCXX1UzDhTIToCgwf4/eXkS1Ew0HHmke7uNDrclRAaVaHtavjmxNO4LIbZzhYP70ia+ mFIkxl0C+ydNBfenUW5g3GAV/Rb9gEBD4L7KsE7NEHdw0zBPWsKE4q73lPeoSkbWh18k CMBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779295754; x=1779900554; 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=GiT4GoPWpBPCpjw1giXUMYXIVEB55hR/7Bfzyfrs5eA=; b=otIck+JvZgxdNDZjzvcL2ugUWPXvHDMwRRJwolrnZ5mg4YqZ56vyM8EYZ8TgisvEIH AhsPrd1h8sn3fdT8YygVtPbXmVF0gj7XaDEcbbQoeRnDQE2fQD4eYyIr1S3mBQKEh3HZ OdpPiXNDFmWJdAlmYS1lK0Nn6xsQYEOEcpEGGVYTVFoR4UcSePU/pwFVqLizHUY1Eu9t 0dq5JzRuyf/oDMI6asiiLUrdhbn9w25BCuWVBCpTK6/57+KgFBxTw8h/L5ioQMZc5/is a+HYwwvM1mqshpLi6Z0Fg5GFU8iQonf04J0od8HMEMZVF7v8yvMakaOIR/tayuzSnd2j 46rg== X-Forwarded-Encrypted: i=1; AFNElJ8vn0sH326C6GGHOFg4/NNATzI0bdK+9E8XVV7x9oLdgwNU+JcLB4vnYjo4sSgCfK/Zs2nUg6fD/ZtYZ+E=@vger.kernel.org X-Gm-Message-State: AOJu0YxRMUZfkMX579d5Sg2aSjMlP/9XsOiUOnlbtHh2OLE/6SfyxwSa zSY9ig+Gkcb/0oxAte2TrCI0pjNgcaN5gBvQfVSwKXW2j2FcvmanC5Qi X-Gm-Gg: Acq92OH8F1NLIv1qfpvClFlRI7SylQtWIp+Ri6jxjF0rDMfhtyWWV0NX8gagKn7RO4I PxZmUQ49HMtAVlpQ3en/yb9d6s5PanDrVcjXqBpN27mxJOQ7pugaQu9dO5ylrjAHdZA1S9Xdgj3 Ith5AMdFNU9hJ2LWVIgUJ8yLeZqt6woIWhicW/IrHEvGaiHxYsex/d2bF2EyTrtiPTQU19SpXi9 tPibv/6x7UCoC/kgcE9Y+Gmu5Ij9Z9IZVa5QxhBDkp4bF86CrT7dTPG3oHovTBqMn6UNdXMkWbb BXNaphcKyeRMNlqVoMs23ScXPG8T48MLc+EWr1IUpOapVrEUD90mbh7FGsPyIQgRAKZrLgcPpdk FRuEEcRFLtAsoJ0nNrlFvjcLXct/ONez1/rSp7OdHImbvnyiGhwgRpzi23FVboGnDKLEU53rolG +50VpxFKg5Nq4IcCmy/GOnTNiVxButEEhRCdziWx+8cVIlgcal+Zh1/8IrGnssN+B5C/oKLvamg O7aupluT+hLCOzMkgNlUus0j3BTwIotO34fkLbLwnh1HPUyT59WMIXTsw== X-Received: by 2002:a05:600c:4692:b0:48a:906b:14ca with SMTP id 5b1f17b1804b1-48fe632579dmr384304235e9.20.1779295753642; Wed, 20 May 2026 09:49:13 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:dcb8:81c1:dc9e:cd68]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49033d8e71dsm3110285e9.9.2026.05.20.09.49.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 09:49:13 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Manivannan Sadhasivam , Claudiu Beznea , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Geert Uytterhoeven , Magnus Damm Cc: linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v3 3/4] PCI: rzg3s-host: Prepare System Controller handling for multiple controllers Date: Wed, 20 May 2026 17:48:22 +0100 Message-ID: <20260520164823.436992-4-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520164823.436992-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20260520164823.436992-1-prabhakar.mahadev-lad.rj@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: Lad Prabhakar Prepare the driver to handle multiple PCIe controllers with distinct System Controller (SYSC) register sets, as required by RZ/V2H(P). The current design stores a single sysc_info structure per SoC, which is insufficient for multi-controller configurations. Introduce controller identifiers and extend struct rzg3s_pcie_soc_data to hold a sysc_info array indexed per PCIe controller. Add a controller_id field to struct rzg3s_pcie_host and select the appropriate System Controller information during probe based on the hardware instance. Keep existing single-controller SoCs functionally unchanged while preparing the driver for RZ/V2H(P) multi-controller support. Signed-off-by: Lad Prabhakar Reviewed-by: Claudiu Beznea Tested-by: Claudiu Beznea --- v2->v3: - No change. v1->v2: - Renamed RZG3S_PCIE_CHANNEL_ID* to RZG3S_PCIE_CONTROLLER_ID* for clarity. - Updated commit message. --- drivers/pci/controller/pcie-rzg3s-host.c | 48 ++++++++++++++++-------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/control= ler/pcie-rzg3s-host.c index a5192e4b58df..edb49af7429a 100644 --- a/drivers/pci/controller/pcie-rzg3s-host.c +++ b/drivers/pci/controller/pcie-rzg3s-host.c @@ -241,6 +241,18 @@ struct rzg3s_pcie_msi { int irq; }; =20 +/** + * enum rzg3s_pcie_controller_id - RZ/G3S PCIe controller IDs + * @RZG3S_PCIE_CONTROLLER_ID_0: PCIe controller 0 + * @RZG3S_PCIE_CONTROLLER_ID_1: PCIe controller 1 + * @RZG3S_PCIE_CONTROLLER_ID_MAX: Max PCIe controllers + */ +enum rzg3s_pcie_controller_id { + RZG3S_PCIE_CONTROLLER_ID_0, + RZG3S_PCIE_CONTROLLER_ID_1, + RZG3S_PCIE_CONTROLLER_ID_MAX, +}; + struct rzg3s_pcie_host; =20 /** @@ -253,7 +265,7 @@ struct rzg3s_pcie_host; * power-on * @cfg_resets: array with the resets that need to be de-asserted after * configuration - * @sysc_info: SYSC info + * @sysc_info: System Controller info for each controller * @num_power_resets: number of power resets * @num_cfg_resets: number of configuration resets */ @@ -264,7 +276,7 @@ struct rzg3s_pcie_soc_data { int (*config_deinit)(struct rzg3s_pcie_host *host); const char * const *power_resets; const char * const *cfg_resets; - struct rzg3s_sysc_info sysc_info; + struct rzg3s_sysc_info sysc_info[RZG3S_PCIE_CONTROLLER_ID_MAX]; u8 num_power_resets; u8 num_cfg_resets; }; @@ -296,6 +308,7 @@ struct rzg3s_pcie_port { * @hw_lock: lock for access to the HW resources * @intx_irqs: INTx interrupts * @max_link_speed: maximum supported link speed + * @controller_id: PCIe controller identifier, used for System Controller = access */ struct rzg3s_pcie_host { void __iomem *axi; @@ -311,6 +324,7 @@ struct rzg3s_pcie_host { raw_spinlock_t hw_lock; int intx_irqs[PCI_NUM_INTX]; int max_link_speed; + enum rzg3s_pcie_controller_id controller_id; }; =20 #define rzg3s_msi_to_host(_msi) container_of(_msi, struct rzg3s_pcie_host,= msi) @@ -1698,7 +1712,7 @@ static int rzg3s_pcie_probe(struct platform_device *p= dev) return -ENOMEM; =20 sysc =3D host->sysc; - sysc->info =3D &host->data->sysc_info; + sysc->info =3D &host->data->sysc_info[host->controller_id]; =20 host->axi =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(host->axi)) @@ -1891,10 +1905,12 @@ static const struct rzg3s_pcie_soc_data rzg3s_soc_d= ata =3D { .config_deinit =3D rzg3s_pcie_config_deinit, .init_phy =3D rzg3s_soc_pcie_init_phy, .sysc_info =3D { - .functions =3D { - [RZG3S_SYSC_FUNC_ID_RST_RSM_B] =3D { - .offset =3D 0xd74, - .mask =3D BIT(0), + [RZG3S_PCIE_CONTROLLER_ID_0] =3D { + .functions =3D { + [RZG3S_SYSC_FUNC_ID_RST_RSM_B] =3D { + .offset =3D 0xd74, + .mask =3D BIT(0), + }, }, }, }, @@ -1909,14 +1925,16 @@ static const struct rzg3s_pcie_soc_data rzg3e_soc_d= ata =3D { .config_post_init =3D rzg3e_pcie_config_post_init, .config_deinit =3D rzg3e_pcie_config_deinit, .sysc_info =3D { - .functions =3D { - [RZG3S_SYSC_FUNC_ID_L1_ALLOW] =3D { - .offset =3D 0x1020, - .mask =3D BIT(0), - }, - [RZG3S_SYSC_FUNC_ID_MODE] =3D { - .offset =3D 0x1024, - .mask =3D BIT(0), + [RZG3S_PCIE_CONTROLLER_ID_0] =3D { + .functions =3D { + [RZG3S_SYSC_FUNC_ID_L1_ALLOW] =3D { + .offset =3D 0x1020, + .mask =3D BIT(0), + }, + [RZG3S_SYSC_FUNC_ID_MODE] =3D { + .offset =3D 0x1024, + .mask =3D BIT(0), + }, }, }, }, --=20 2.54.0 From nobody Wed Jun 10 06:15:18 2026 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87C563B3886 for ; Wed, 20 May 2026 16:49:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779295759; cv=none; b=iNCkKRbUtNL47ZWggIXeMTDbkOz5TlmM22tR8uTJm5rjiFyxglnZdCFzQx27/8k+BakdFxb0ldQLtIKfQZ6PzPm8zl7q2yKL8Fp1hzF/uMqny2+XgPDD3/14/wzCh8vi2JXKC9U5zRtBLlPl+AbztcfEbioYovluStm5TH9JU7c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779295759; c=relaxed/simple; bh=KAhzL7kuPf7TDtuhxPvX/+A05jUcMp0Qu4qTKAZAKI4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f43O+atu0JYsZCmUHYO+XTBx2HCz7fa8HA+MUT2MHp+tFr8L2HpFwoZrxGiXevQxj6F2urMv4Y9c4kimvFCKkjSrqS32JJDyNBjP02L95PqegOccT/tDx8pvIqBMKM5M4Gg/ou2O/WppVCxrZEyBb2ASmkgPs2U4u7jd3AzhNcs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kR//idYI; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kR//idYI" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-48fde648a71so37903325e9.0 for ; Wed, 20 May 2026 09:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779295755; x=1779900555; 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=LYJvdDeAzqbJzpWMdXR3dlBUpIWW8S3jv24vj3I7EAM=; b=kR//idYIccnSyjiPyd7+os9Mqrxp8M1YmoKshhtV6+R2SScHeRhMuDf2H3Ru7ipTs1 T6C3n2c7SxzFgE1EDdRWJl0OXd6OIxIyeEAMz8Xe+2pyHq1Ts0sUBZtfGBeKp5BLq01J 2ObsHYzfYLTjGo+ECufJlh//eO6qhIdlSLEpCzavzz76mSlyyiM9GFw5jwG6sLRPUWiB SOTixQru7RyiVqiq3xZ3CSsSBtBgSimWN/py+vjKqfsMwvBhmXSSqfPM7ztRDvtYQKVa 45VpDAS5nmhuxJAJs8j4laLXD+Z8RzgAUfNEqSMeyVGPFnTpzsEkdqowSfedmLPPOh2d /bNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779295755; x=1779900555; 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=LYJvdDeAzqbJzpWMdXR3dlBUpIWW8S3jv24vj3I7EAM=; b=r/d7311h6izLf3KN5Edh2v9dS/Zjgae71QfA8q8ldguLcm3VoS/X0N3katdZ1eMHTg hTG2WhI7OHtPH8vYrOwoJUgxFo0HFJx7lOUk56MDuAiQe3NeyLlP0+t2hRLAETvox2pB irBHDmVTdkGyEEbVFlJwQNSp/6Qfcc/niDsN5cKvDuptF/YShtp2p1fVGa/pTJ78QvTS isfznvYBjrf834khojxVSBrUjLqoL/r+0OC9XmSPDO9N4Ginqe7xkV4UdJafnyQGAgAB ssBm5+WTteiacyTkd48t+8hiOpoThM4D8gKVy+5WVv0RLMk+T9mWz8/PqNoYEYcnVNuN M+0A== X-Forwarded-Encrypted: i=1; AFNElJ9Pd4YTcSUMvWbNleNrOJP6xwBAwcQ4OdQs+IHv0xSBpVdtd0T5wXij3Wn+gB9HB1sqPGeNlJ2RquI0rlE=@vger.kernel.org X-Gm-Message-State: AOJu0Ywuq2YupB6eeTOgK9FSFOzUanCuNxrsPCgOPMNaiKd/KMDgg4Qu osqjrazK3Dz8Z+o0VOoQIMBD5WqMxE6SC4Z3Im5P9WISH57d7yT7vhH9 X-Gm-Gg: Acq92OFT28sHiHkcLgcwFGQVrsGSkCOpuIWsRdrUbEmQ4LQajOUhULyc/1kxOQ7X+QR NEVu7RSM73s1+Z6JxD2pP1GgkB9BeRQBBG3nP5zdSJ3jVEZ05JPk6+zYetZKuzi7VKFO3EM6aKU p86CEuNB4NmM4TQZfLUn85PsdbmJyIOcPVMQjl5SBhccE+s77KIZjN3z8leBJOJuXZNBfbTrub7 w4E9sO/08e56Ry+dWZ7SJ6cxRUbmhzntnTXj75L2b5yZt+ULor5c8Be7lGogQ/tsZ4RraixzBRh eZuAYpuxQiKN5FKJS5HOoLqpKMLUKp5rFjUCdJxzuV4CSlR0Eu09py6azh+hfVMjXVa2AfdE0Qk h0BcDc8C0tuJbVZeAjLcdfcJ+qgMWOxeFog7FfPzvCAFYd8lS74y7yHSM9ttwW2FACkgXVqrsic k4FBRi6v2cK0lyYI1ohM/0AKb0/IgLy+wo/PWlPzA6gQnnNgqq8tM0qVsn/WlKGyPwdFGK2J37h quDQyLRfOiPEv2skwVn33iaZGKLBEB81hMLjMTtViw3s3k= X-Received: by 2002:a05:600c:c0c1:b0:48a:761:5816 with SMTP id 5b1f17b1804b1-49033d3f1f1mr3438225e9.8.1779295754507; Wed, 20 May 2026 09:49:14 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:dcb8:81c1:dc9e:cd68]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49033d8e71dsm3110285e9.9.2026.05.20.09.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 09:49:14 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Manivannan Sadhasivam , Claudiu Beznea , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Geert Uytterhoeven , Magnus Damm Cc: linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v3 4/4] PCI: rzg3s-host: Add support for RZ/V2H(P) SoC Date: Wed, 20 May 2026 17:48:23 +0100 Message-ID: <20260520164823.436992-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520164823.436992-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20260520164823.436992-1-prabhakar.mahadev-lad.rj@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: Lad Prabhakar Add support for the RZ/V2H(P) SoC PCIe controllers to the rzg3s-host driver. The RZ/V2H(P) SoC features two independent PCIe controllers that share four physical lanes. The hardware supports two configuration modes: single x4 mode where the first controller uses all four lanes, or dual x2 mode where both controllers use two lanes each. Introduce a setup_lanes() function pointer to configure the PCIe lanes based on the hardware instance. Implement rzv2h_pcie_setup_lanes() to detect the configuration at boot time and program the lane mode via the system controller. Signed-off-by: Lad Prabhakar Reviewed-by: Claudiu Beznea Tested-by: Claudiu Beznea --- v2->v3: - Parsed controller-id from the "renesas,sysc" property instead of using linux,pci-domain. v1->v2: - Updated commit message. - Added locks to protect shared lane configuration state and prevent concurrent access issues during probe. - Added cleanup action to release lanes on driver removal. - Reconfigured RZG3S_SYSC_FUNC_ID_LINK_MASTER in resume path. - Renamed num_channels to num_pcie_controllers for clarity. --- drivers/pci/controller/pcie-rzg3s-host.c | 180 +++++++++++++++++++++++ 1 file changed, 180 insertions(+) diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/control= ler/pcie-rzg3s-host.c index edb49af7429a..15879b2c0bd2 100644 --- a/drivers/pci/controller/pcie-rzg3s-host.c +++ b/drivers/pci/controller/pcie-rzg3s-host.c @@ -179,6 +179,16 @@ /* Timeouts experimentally determined */ #define RZG3S_REQ_ISSUE_TIMEOUT_US 2500 =20 +/** + * enum rzg3s_sysc_link_mode - PCIe link configuration modes + * @RZG3S_SYSC_LINK_MODE_SINGLE_X4: Single port with x4 lanes + * @RZG3S_SYSC_LINK_MODE_DUAL_X2: Dual ports with x2 lanes each + */ +enum rzg3s_sysc_link_mode { + RZG3S_SYSC_LINK_MODE_SINGLE_X4 =3D 1, + RZG3S_SYSC_LINK_MODE_DUAL_X2 =3D 3, +}; + /** * struct rzg3s_sysc_function - System Controller function descriptor * @offset: Register offset from the System Controller base address @@ -194,12 +204,14 @@ struct rzg3s_sysc_function { * @RZG3S_SYSC_FUNC_ID_RST_RSM_B: RST_RSM_B SYSC function ID * @RZG3S_SYSC_FUNC_ID_L1_ALLOW: L1 allow SYSC function ID * @RZG3S_SYSC_FUNC_ID_MODE: Mode SYSC function ID + * @RZG3S_SYSC_FUNC_ID_LINK_MASTER: Link master SYSC function ID * @RZG3S_SYSC_FUNC_ID_MAX: Max SYSC function ID */ enum rzg3s_sysc_func_id { RZG3S_SYSC_FUNC_ID_RST_RSM_B, RZG3S_SYSC_FUNC_ID_L1_ALLOW, RZG3S_SYSC_FUNC_ID_MODE, + RZG3S_SYSC_FUNC_ID_LINK_MASTER, RZG3S_SYSC_FUNC_ID_MAX, }; =20 @@ -261,6 +273,7 @@ struct rzg3s_pcie_host; * @config_pre_init: Optional callback for SoC-specific pre-configuration * @config_post_init: Callback for SoC-specific post-configuration * @config_deinit: Callback for SoC-specific de-initialization + * @setup_lanes: Callback for setting up the number of lanes * @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 @@ -268,17 +281,20 @@ struct rzg3s_pcie_host; * @sysc_info: System Controller info for each controller * @num_power_resets: number of power resets * @num_cfg_resets: number of configuration resets + * @num_pcie_controllers: number of PCIe controllers */ struct rzg3s_pcie_soc_data { int (*init_phy)(struct rzg3s_pcie_host *host); void (*config_pre_init)(struct rzg3s_pcie_host *host); int (*config_post_init)(struct rzg3s_pcie_host *host); int (*config_deinit)(struct rzg3s_pcie_host *host); + int (*setup_lanes)(struct rzg3s_pcie_host *host); const char * const *power_resets; const char * const *cfg_resets; struct rzg3s_sysc_info sysc_info[RZG3S_PCIE_CONTROLLER_ID_MAX]; u8 num_power_resets; u8 num_cfg_resets; + u8 num_pcie_controllers; }; =20 /** @@ -309,6 +325,7 @@ struct rzg3s_pcie_port { * @intx_irqs: INTx interrupts * @max_link_speed: maximum supported link speed * @controller_id: PCIe controller identifier, used for System Controller = access + * @num_lanes: The number of lanes */ struct rzg3s_pcie_host { void __iomem *axi; @@ -325,10 +342,23 @@ struct rzg3s_pcie_host { int intx_irqs[PCI_NUM_INTX]; int max_link_speed; enum rzg3s_pcie_controller_id controller_id; + u8 num_lanes; }; =20 #define rzg3s_msi_to_host(_msi) container_of(_msi, struct rzg3s_pcie_host,= msi) =20 +/* + * RZ/V2H(P) supports a total of 4 lanes shared across two controllers. + * rzv2h_lane_lock serialises both the counter update and the SYSC + * register write so that concurrent async probes cannot race on the + * shared LINK_MASTER register (offset 0x1060). + * rzv2h_num_total_lanes tracks global lane usage to prevent + * over-allocation or invalid bifurcation modes. + */ +#define RZV2H_PCIE_MAX_LANES 4 +static DEFINE_SPINLOCK(rzv2h_lane_lock); +static u8 rzv2h_num_total_lanes; + static int rzg3s_sysc_config_func(struct rzg3s_sysc *sysc, enum rzg3s_sysc_func_id fid, u32 val) { @@ -1155,6 +1185,13 @@ static int rzg3s_pcie_config_init(struct rzg3s_pcie_= host *host) rzg3s_pcie_update_bits(host->pcie, PCI_CLASS_REVISION, mask, field_prep(mask, PCI_CLASS_BRIDGE_PCI_NORMAL)); =20 + if (host->num_lanes) { + rzg3s_pcie_update_bits(host->pcie + RZG3S_PCI_CFG_PCIEC, + PCI_EXP_LNKCAP, PCI_EXP_LNKCAP_MLW, + FIELD_PREP(PCI_EXP_LNKCAP_MLW, + host->num_lanes)); + } + /* Disable access control to the CFGU */ writel_relaxed(0, host->axi + RZG3S_PCI_PERM); =20 @@ -1687,6 +1724,75 @@ rzg3s_pcie_host_setup(struct rzg3s_pcie_host *host, return ret; } =20 +static int rzg3s_pcie_get_controller_id(struct rzg3s_pcie_host *host) +{ + struct device_node *np =3D host->dev->of_node; + struct of_phandle_args sysc_args; + int ret; + + if (host->data->num_pcie_controllers =3D=3D 1) + return 0; + + ret =3D of_parse_phandle_with_fixed_args(np, "renesas,sysc", 1, 0, &sysc_= args); + if (ret) + return ret; + + of_node_put(sysc_args.np); + + if (sysc_args.args[0] >=3D host->data->num_pcie_controllers || + sysc_args.args[0] >=3D RZG3S_PCIE_CONTROLLER_ID_MAX) + return -EINVAL; + + host->controller_id =3D sysc_args.args[0]; + + return 0; +} + +static int rzv2h_pcie_setup_lanes(struct rzg3s_pcie_host *host) +{ + struct device_node *np =3D host->dev->of_node; + u32 num_lanes; + int ret; + + ret =3D of_property_read_u32(np, "num-lanes", &num_lanes); + if (ret) + return ret; + + /* + * RZ/V2H(P) supports up to 4 lanes, but only in single x4 mode + * for the first controller. Dual x2 mode is supported with 2 + * lanes for both controllers. + */ + if (num_lanes !=3D 4 && num_lanes !=3D 2) + return -EINVAL; + + if (host->controller_id =3D=3D RZG3S_PCIE_CONTROLLER_ID_1 && num_lanes > = 2) + return -EINVAL; + + guard(spinlock)(&rzv2h_lane_lock); + if (rzv2h_num_total_lanes + num_lanes > RZV2H_PCIE_MAX_LANES) + return -EINVAL; + + ret =3D rzg3s_sysc_config_func(host->sysc, RZG3S_SYSC_FUNC_ID_LINK_MASTER, + num_lanes =3D=3D 2 ? + RZG3S_SYSC_LINK_MODE_DUAL_X2 : + RZG3S_SYSC_LINK_MODE_SINGLE_X4); + if (!ret) { + rzv2h_num_total_lanes +=3D num_lanes; + host->num_lanes =3D num_lanes; + } + + return ret; +} + +static void rzv2h_pcie_release_lanes(void *data) +{ + struct rzg3s_pcie_host *host =3D data; + + guard(spinlock)(&rzv2h_lane_lock); + rzv2h_num_total_lanes -=3D host->num_lanes; +} + static int rzg3s_pcie_probe(struct platform_device *pdev) { struct pci_host_bridge *bridge; @@ -1711,6 +1817,10 @@ static int rzg3s_pcie_probe(struct platform_device *= pdev) if (!host->sysc) return -ENOMEM; =20 + ret =3D rzg3s_pcie_get_controller_id(host); + if (ret) + return ret; + sysc =3D host->sysc; sysc->info =3D &host->data->sysc_info[host->controller_id]; =20 @@ -1740,6 +1850,16 @@ static int rzg3s_pcie_probe(struct platform_device *= pdev) if (ret) goto port_refclk_put; =20 + if (host->data->setup_lanes) { + ret =3D host->data->setup_lanes(host); + if (ret) + goto sysc_signal_restore; + + ret =3D devm_add_action_or_reset(dev, rzv2h_pcie_release_lanes, host); + if (ret) + goto sysc_signal_restore; + } + ret =3D rzg3s_pcie_resets_prepare_and_get(host); if (ret) goto sysc_signal_restore; @@ -1854,6 +1974,16 @@ static int rzg3s_pcie_resume_noirq(struct device *de= v) if (ret) return ret; =20 + if (host->num_lanes) { + ret =3D rzg3s_sysc_config_func(host->sysc, + RZG3S_SYSC_FUNC_ID_LINK_MASTER, + host->num_lanes =3D=3D 2 ? + RZG3S_SYSC_LINK_MODE_DUAL_X2 : + RZG3S_SYSC_LINK_MODE_SINGLE_X4); + if (ret) + goto assert_rst_rsm_b; + } + ret =3D rzg3s_pcie_power_resets_deassert(host); if (ret) goto assert_rst_rsm_b; @@ -1901,6 +2031,7 @@ static const struct rzg3s_pcie_soc_data rzg3s_soc_dat= a =3D { .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), + .num_pcie_controllers =3D 1, .config_post_init =3D rzg3s_pcie_config_post_init, .config_deinit =3D rzg3s_pcie_config_deinit, .init_phy =3D rzg3s_soc_pcie_init_phy, @@ -1921,6 +2052,7 @@ static const char * const rzg3e_soc_power_resets[] = =3D { "aresetn" }; static const struct rzg3s_pcie_soc_data rzg3e_soc_data =3D { .power_resets =3D rzg3e_soc_power_resets, .num_power_resets =3D ARRAY_SIZE(rzg3e_soc_power_resets), + .num_pcie_controllers =3D 1, .config_pre_init =3D rzg3e_pcie_config_pre_init, .config_post_init =3D rzg3e_pcie_config_post_init, .config_deinit =3D rzg3e_pcie_config_deinit, @@ -1940,6 +2072,50 @@ static const struct rzg3s_pcie_soc_data rzg3e_soc_da= ta =3D { }, }; =20 +static const struct rzg3s_pcie_soc_data rzv2h_soc_data =3D { + .power_resets =3D rzg3e_soc_power_resets, + .num_power_resets =3D ARRAY_SIZE(rzg3e_soc_power_resets), + .num_pcie_controllers =3D 2, + .config_pre_init =3D rzg3e_pcie_config_pre_init, + .config_post_init =3D rzg3e_pcie_config_post_init, + .config_deinit =3D rzg3e_pcie_config_deinit, + .setup_lanes =3D rzv2h_pcie_setup_lanes, + .sysc_info =3D { + [RZG3S_PCIE_CONTROLLER_ID_0] =3D { + .functions =3D { + [RZG3S_SYSC_FUNC_ID_L1_ALLOW] =3D { + .offset =3D 0x1020, + .mask =3D BIT(0), + }, + [RZG3S_SYSC_FUNC_ID_MODE] =3D { + .offset =3D 0x1024, + .mask =3D BIT(0), + }, + [RZG3S_SYSC_FUNC_ID_LINK_MASTER] =3D { + .offset =3D 0x1060, + .mask =3D GENMASK(9, 8), + }, + }, + }, + [RZG3S_PCIE_CONTROLLER_ID_1] =3D { + .functions =3D { + [RZG3S_SYSC_FUNC_ID_L1_ALLOW] =3D { + .offset =3D 0x1050, + .mask =3D BIT(0), + }, + [RZG3S_SYSC_FUNC_ID_MODE] =3D { + .offset =3D 0x1054, + .mask =3D BIT(0), + }, + [RZG3S_SYSC_FUNC_ID_LINK_MASTER] =3D { + .offset =3D 0x1060, + .mask =3D GENMASK(9, 8), + }, + }, + }, + }, +}; + static const struct of_device_id rzg3s_pcie_of_match[] =3D { { .compatible =3D "renesas,r9a08g045-pcie", @@ -1949,6 +2125,10 @@ static const struct of_device_id rzg3s_pcie_of_match= [] =3D { .compatible =3D "renesas,r9a09g047-pcie", .data =3D &rzg3e_soc_data, }, + { + .compatible =3D "renesas,r9a09g057-pcie", + .data =3D &rzv2h_soc_data, + }, {} }; =20 --=20 2.54.0