From nobody Fri Dec 19 13:49:06 2025 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 E19B82AEE4 for ; Sun, 12 Oct 2025 20:59:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760302752; cv=none; b=ZOr0BZHVdTaTsNgAYcewBivFrQapGOXiCUT9vUuociJFJRTQnwDKQ+q8+DtjPWucqWR0A2zOgSzDSNSWduT3MRVtirrH7tcCrEcghRcYfsEc0ygxFJB82uWj4Iv0Pqc8QU5JDCPGrV93Rza9V52pdyKIb9+LFzoDWhio5WOr7jE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760302752; c=relaxed/simple; bh=6sa4dBlIVtXXSWxWD+PhcdWd6PIrRysSNnN6dDj8eWM=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Wpo0qKiusFRvVQ6AE/2jxuNPEYmjbrASXDgK9m/SA05r4qncECtdwzZnqbCvgJsQd2UYCUyibPeWsL9g7ff4PU5kaqjqCiHR/rCnnosg3Oo/HvR9D75qstbIQgyRfUcMq9CwnfUpOeJ8sYJXvP/iHYgBH9f8Ql5fHtvWFB2SjXs= 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=d+6ty8NE; arc=none smtp.client-ip=209.85.221.43 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="d+6ty8NE" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-3ee12a63af1so2065421f8f.1 for ; Sun, 12 Oct 2025 13:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760302749; x=1760907549; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=FV+6yoKv/P9OgvlWPQKcQD99p3mLWnHYMK2iXPsZM3o=; b=d+6ty8NEJ9SIn8PG2grgbLKg8UgW2mfoRDM7bEePjYVwOqD+wMQMakeMDC+b43zlRQ 4zdWQDSU+p2ryzkr/3kHXfX04kS4So5mBIgx9E4gSQg9wK//27EjnOkr79Zud6JUKOXs Lp//2gpP+V7F5/KiHC3GvpTZekiWy8wlO/V58YETmnWmXRmziaHY6sUDaMqNmV/DTQxs yI8wSRqckSuRTtIJdldJTDBB7YTbnFELPzUIr6ZjxvXVJj8VaOx+wHJ8Ip0qte7UxWuq TXLTVKAPx93hzkqsJ2xdtOta9FFMzw2oFhy1hFK3UrT2KyF7oLJhkPhIvIJtSFciycTK 5QTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760302749; x=1760907549; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FV+6yoKv/P9OgvlWPQKcQD99p3mLWnHYMK2iXPsZM3o=; b=atC+50rBLuKh+Ligfrsan4R5cp42TlypwJlAmXgCxH26wU33vWChlIQPFuI5rdXa28 d6pyK+eED2pUtMSV3lEBUIaeHpt5VMolsIS4trgyO0AsTRdhKTblGMJG9FivtStWUxr0 zXtbCk+xqbL7M8yeL+aXWGHk0Ya2Yc3m1z5R9adJ4ofPVvxKJzMN0JQKtZWtJ3C1Q7eC lsOjyBEZl83dduMzQA9pOdsC+FrjK7RDYRLysJz7DuApiIgGnKrQ6sPAszOuP+xBS3W8 dxV/y+swpvglehjXwwpDobGJm2pu9lO4gPuvaEU1mLCcCi1ra5Qdoo6coeF8yWp0CYVx gU/Q== X-Forwarded-Encrypted: i=1; AJvYcCW7KM23AALmby69qkuFFAIXLKBLR9Bi5Jff8v6xLb9s1IBY/FK/ZZl7m6GLfsXnuwyMoE58+3ILcA2736Q=@vger.kernel.org X-Gm-Message-State: AOJu0YzEmwJEnzEyIkhpsUntL6Y8NnJpMZUjVtxVXnIvnmnDsOoBd5jT fNqQIlgZKBhDe8OVclnttTtmPfFLCLUrq/DssM5Ve0Vb2aSR66NdkGxi X-Gm-Gg: ASbGnctMKo//Wpbk0atFWNqZypmsiEVvPFKE8ruYAx5uFnljbeMP5JJgSkp7ldV/JG0 cY7d18xOxxV+cDgKOEj0yqyvbwgUkS/k+OugvqXBu+uzgRy08cbnrzo0303UoeiMBAsSTZtmurE YQbxLcYk9H32GGMCcUX0BfQOFsg6fF/1THL9oIbSiiN7dm+swrJ+iHQaAoW7h0LSiI1yKJ7Cx+j yVp3rmtzdzJzlZtmFGPw2tL3cGxM8xH4JJYPUY8SjHFAG9Y8EjBeMxvaUayD9Nw2cUffAcsjZkx 396lJb/TGXBGANPbw6f0U9WhW2OM2MuT84b85sUxt0u7af9PCuQdE5Srq1usL4e2tBX8EHjGCF7 0e43sGxlTkzusisUvz6Sn0mnky+rJ3WiJCtwMpgoBXvABbPpjk5U1Y4OJTbpaUUvBzA2zJLYG35 vBft2sQfvz X-Google-Smtp-Source: AGHT+IHtY+2+uH13hhyazhLdneYWQO5n0wlug1GAYN01XwbK9r5lScGjBtdQeUGHDHf1GNUaqgMf6Q== X-Received: by 2002:a05:6000:3111:b0:40e:31a2:7efe with SMTP id ffacd0b85a97d-42667177d9fmr12401174f8f.14.1760302749069; Sun, 12 Oct 2025 13:59:09 -0700 (PDT) Received: from Ansuel-XPS24 (93-34-92-177.ip49.fastwebnet.it. [93.34.92.177]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-46fb489197dsm156506505e9.10.2025.10.12.13.59.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Oct 2025 13:59:08 -0700 (PDT) From: Christian Marangi To: Ryder Lee , Jianjun Wang , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Christian Marangi , linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, upstream@airoha.com Subject: [PATCH v5 1/5] ARM: dts: mediatek: drop wrong syscon hifsys compatible for MT2701/7623 Date: Sun, 12 Oct 2025 22:56:55 +0200 Message-ID: <20251012205900.5948-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251012205900.5948-1-ansuelsmth@gmail.com> References: <20251012205900.5948-1-ansuelsmth@gmail.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" The syscon compatible for the hifsys node for Mediatek MT2701/MT7623 SoC was wrongly added following the pattern of other clock node but it's actually not needed as the register are not used by other device on the SoC. On top of this it's against the schema for hifsys YAML and causes a dtbs_check warning. Drop the "syscon" compatible to mute the warning and reflect the compatible property described in the mediatek,mt2701-hifsys.yaml schema. Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Christian Marangi --- arch/arm/boot/dts/mediatek/mt2701.dtsi | 2 +- arch/arm/boot/dts/mediatek/mt7623.dtsi | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/mediatek/mt2701.dtsi b/arch/arm/boot/dts/med= iatek/mt2701.dtsi index ce6a4015fed5..128b87229f3d 100644 --- a/arch/arm/boot/dts/mediatek/mt2701.dtsi +++ b/arch/arm/boot/dts/mediatek/mt2701.dtsi @@ -597,7 +597,7 @@ larb1: larb@16010000 { }; =20 hifsys: syscon@1a000000 { - compatible =3D "mediatek,mt2701-hifsys", "syscon"; + compatible =3D "mediatek,mt2701-hifsys"; reg =3D <0 0x1a000000 0 0x1000>; #clock-cells =3D <1>; #reset-cells =3D <1>; diff --git a/arch/arm/boot/dts/mediatek/mt7623.dtsi b/arch/arm/boot/dts/med= iatek/mt7623.dtsi index fd7a89cc337d..4b1685b93989 100644 --- a/arch/arm/boot/dts/mediatek/mt7623.dtsi +++ b/arch/arm/boot/dts/mediatek/mt7623.dtsi @@ -744,8 +744,7 @@ vdecsys: syscon@16000000 { =20 hifsys: syscon@1a000000 { compatible =3D "mediatek,mt7623-hifsys", - "mediatek,mt2701-hifsys", - "syscon"; + "mediatek,mt2701-hifsys"; reg =3D <0 0x1a000000 0 0x1000>; #clock-cells =3D <1>; #reset-cells =3D <1>; --=20 2.51.0 From nobody Fri Dec 19 13:49:06 2025 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7504F23BCE3 for ; Sun, 12 Oct 2025 20:59:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760302756; cv=none; b=LApPiEM/2Bv+gGWrXXVA/5+WEOxyQ84i/ZSh5TsflcNqkiAoee7OCYZqVHyqXG0rqgByGZ4lDptJmBhyOC5FDvAwHwIMI7GLBfVyPNqJM6itry8CHP72foEMwdKZTYLdfdo4P17urfup8l87nDzq5OzRsSofAVKQPnZkDc1NHY0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760302756; c=relaxed/simple; bh=uSQJLqbcal/3fIvDJghFxsrITwI7poKPi9sEc5Og8bo=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FFwPfWA8Dko7v5nAiafEbrZxEdI0hn36ab+1udB/hDyBde9mHlNJrEX9UJ7DR2meayoHJSmeZzCa+oz7TfKFi+fqgdsbd9s7LGUymixTBHm+VM7LsuHqI4RogkXDGx7jlMdO6GiFBeeaipWty+2UpLbmS7Uf6xntu69EvD4cRFw= 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=CXz+f9x0; arc=none smtp.client-ip=209.85.128.53 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="CXz+f9x0" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-46e48d6b95fso32993225e9.3 for ; Sun, 12 Oct 2025 13:59:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760302751; x=1760907551; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=hYSFvNXJ1OxOrTIGf+Idmx9ir1vilL2ggeDDXDhQi4w=; b=CXz+f9x0E/Mbo16NAiHXIZFf1UOfoRbG0RXpgN8RMI4gNjlqIp9pSS72rhnAM37nA+ CDV3GqkFHDtwv3LKUzfCdYAsYYDfyCkEC85LeKQsrN7II+xrd8wS5hM+r/ZXhJjYgt6p mIjoy9ZXekC6nUA+lAEzkKfKzmbd19pr6fEcvJl0t7aBBnZtuS4Y44mDSIGlMq2MPSVM FCChoNEMIEfaCDJz+7kIDhkURZ8CPWegq/L325yUPafHi+dKrJKE+SNXwyTMzzZZ3EJX HyJt/UiHpGunNlHnDKE/6F+92bStMumJIZbYSPsqtcBVTsi1PgXJZZSLZmIm3vuM3sSu MJ7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760302751; x=1760907551; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hYSFvNXJ1OxOrTIGf+Idmx9ir1vilL2ggeDDXDhQi4w=; b=KQ7r9Zmah7k5MpoA2XhwXz8FktgkfgTni1bCzo2Vl8LKjrErTEFPmWMpH/ti7gTPkW dPtSS4Qqrzztse01kr63wskUUUtcaI5X4yb5ltAfphZZNEEq1Ph+kEfmQNLjKeqKqghI iqEg5r6+OedaA69rpp22roKq1tYp7OaIVz8QPMKY8nxDMnpv6eZ261dU7BF/Gg3Iu48v Ys9OUlmz15q18KNaN+44Mh6Io4PC0u++Zk1yGVLb8RcWlFQYMp4UCfRYOUY+/XkcWx0q EWAq12y+ohZRthnOfMi9GCn3lROHCmGKZk83Bz+a/5hphCaYKX3hzxAwontYLFfKEQyL mXSA== X-Forwarded-Encrypted: i=1; AJvYcCXvlww3ZkqXUjR48SK4EybtVcQ7cyFvOZvnClPphccXfH/431rMgIaEQwJ4Kz3DsOyJQBlP92yoHOiYRN4=@vger.kernel.org X-Gm-Message-State: AOJu0YxjlB47DIe8KmAJQDTGPyXatJkISCzt2Mha6rqxrp9aUI3XbPhx i4j1csXFjWSZb2g55mKT+FzThblXd4myWaHpEa9yorhAGm5AaFqZ0xIk X-Gm-Gg: ASbGncvxnJ+FGbWuLqEZ2XBBA1H+l+1qKYucwkRFmaqHrJSfJNag22WPfmT7+tks59h FLaMA+ucZgj2RPaqAaxs0ervRg63WQBBH65NbBnjH8IB9hLVIsotn40yDtZ6Uj0c60mW8x+cZ88 FGWR7DLYs2wj6tcSHXnh+3HsXeNiC23JS8GImWqJ3wKjIgVbZbQVFhCvusKuUUKhdiA29414i3T AxEMvZs2Uy3JYdUJwcSQNxOe6X6n0IgUm3lSkEa2/6i4RxxC0/K420WubmQZJ40w71N288TaBI2 oO879Z+vHjffdC8BHJxhlHYZ0QNP/MzITYPpcIEEUDxvWPgMmaeHeK5Tz1TJuHanGz89Qh/coLk NTlPD/yyw0YuMEzubjAbT1YAetLNUIjbfj8dIw2yKY8uUImkHh6NLQHmFg6eqy8Te9SRLjyY8Nw == X-Google-Smtp-Source: AGHT+IE/qZWuIeVOHVAdAPSs/X8s3cxy5ODj4035FEzP+gG24WTSi9JYBid4P2voLoXMQ7ZLoZm0MA== X-Received: by 2002:a05:600c:1990:b0:46e:1b89:77f1 with SMTP id 5b1f17b1804b1-46fa9aa1c74mr120521345e9.9.1760302750399; Sun, 12 Oct 2025 13:59:10 -0700 (PDT) Received: from Ansuel-XPS24 (93-34-92-177.ip49.fastwebnet.it. [93.34.92.177]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-46fb489197dsm156506505e9.10.2025.10.12.13.59.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Oct 2025 13:59:10 -0700 (PDT) From: Christian Marangi To: Ryder Lee , Jianjun Wang , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Christian Marangi , linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, upstream@airoha.com Subject: [PATCH v5 2/5] dt-bindings: PCI: mediatek: Convert to YAML schema Date: Sun, 12 Oct 2025 22:56:56 +0200 Message-ID: <20251012205900.5948-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251012205900.5948-1-ansuelsmth@gmail.com> References: <20251012205900.5948-1-ansuelsmth@gmail.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" Convert the PCI mediatek Documentation to YAML schema to enable validation of the supported GEN1/2 Mediatek PCIe controller. While converting, lots of cleanup were done from the .txt with better specifying what is supported by the various PCIe controller variant and drop of redundant info that are part of the standard PCIe Host Bridge schema. To reduce schema complexity the .txt is split in 2 YAML, one for mt7623/mt2701 and the other for every other compatible. Signed-off-by: Christian Marangi Reviewed-by: Rob Herring (Arm) --- .../bindings/pci/mediatek-pcie-mt7623.yaml | 164 +++++++++ .../devicetree/bindings/pci/mediatek-pcie.txt | 289 ---------------- .../bindings/pci/mediatek-pcie.yaml | 318 ++++++++++++++++++ 3 files changed, 482 insertions(+), 289 deletions(-) create mode 100644 Documentation/devicetree/bindings/pci/mediatek-pcie-mt7= 623.yaml delete mode 100644 Documentation/devicetree/bindings/pci/mediatek-pcie.txt create mode 100644 Documentation/devicetree/bindings/pci/mediatek-pcie.yaml diff --git a/Documentation/devicetree/bindings/pci/mediatek-pcie-mt7623.yam= l b/Documentation/devicetree/bindings/pci/mediatek-pcie-mt7623.yaml new file mode 100644 index 000000000000..e33bcc216e30 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/mediatek-pcie-mt7623.yaml @@ -0,0 +1,164 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/mediatek-pcie-mt7623.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe controller on MediaTek SoCs + +maintainers: + - Christian Marangi + +properties: + compatible: + enum: + - mediatek,mt2701-pcie + - mediatek,mt7623-pcie + + reg: + minItems: 4 + maxItems: 4 + + reg-names: + items: + - const: subsys + - const: port0 + - const: port1 + - const: port2 + + clocks: + minItems: 4 + maxItems: 4 + + clock-names: + items: + - const: free_ck + - const: sys_ck0 + - const: sys_ck1 + - const: sys_ck2 + + resets: + minItems: 3 + maxItems: 3 + + reset-names: + items: + - const: pcie-rst0 + - const: pcie-rst1 + - const: pcie-rst2 + + phys: + minItems: 3 + maxItems: 3 + + phy-names: + items: + - const: pcie-phy0 + - const: pcie-phy1 + - const: pcie-phy2 + + power-domains: + maxItems: 1 + +required: + - compatible + - reg + - reg-names + - ranges + - clocks + - clock-names + - '#interrupt-cells' + - resets + - reset-names + - phys + - phy-names + - power-domains + - pcie@0,0 + - pcie@1,0 + - pcie@2,0 + +allOf: + - $ref: /schemas/pci/pci-host-bridge.yaml# + +unevaluatedProperties: false + +examples: + # MT7623 + - | + #include + #include + #include + #include + #include + #include + + soc { + #address-cells =3D <2>; + #size-cells =3D <2>; + + pcie@1a140000 { + compatible =3D "mediatek,mt7623-pcie"; + device_type =3D "pci"; + reg =3D <0 0x1a140000 0 0x1000>, /* PCIe shared registers */ + <0 0x1a142000 0 0x1000>, /* Port0 registers */ + <0 0x1a143000 0 0x1000>, /* Port1 registers */ + <0 0x1a144000 0 0x1000>; /* Port2 registers */ + reg-names =3D "subsys", "port0", "port1", "port2"; + #address-cells =3D <3>; + #size-cells =3D <2>; + #interrupt-cells =3D <1>; + interrupt-map-mask =3D <0xf800 0 0 0>; + interrupt-map =3D <0x0000 0 0 0 &sysirq GIC_SPI 193 IRQ_TYPE_L= EVEL_LOW>, + <0x0800 0 0 0 &sysirq GIC_SPI 194 IRQ_TYPE_LEV= EL_LOW>, + <0x1000 0 0 0 &sysirq GIC_SPI 195 IRQ_TYPE_LEV= EL_LOW>; + clocks =3D <&topckgen CLK_TOP_ETHIF_SEL>, + <&hifsys CLK_HIFSYS_PCIE0>, + <&hifsys CLK_HIFSYS_PCIE1>, + <&hifsys CLK_HIFSYS_PCIE2>; + clock-names =3D "free_ck", "sys_ck0", "sys_ck1", "sys_ck2"; + resets =3D <&hifsys MT2701_HIFSYS_PCIE0_RST>, + <&hifsys MT2701_HIFSYS_PCIE1_RST>, + <&hifsys MT2701_HIFSYS_PCIE2_RST>; + reset-names =3D "pcie-rst0", "pcie-rst1", "pcie-rst2"; + phys =3D <&pcie0_phy PHY_TYPE_PCIE>, <&pcie1_phy PHY_TYPE_PCIE= >, + <&pcie2_phy PHY_TYPE_PCIE>; + phy-names =3D "pcie-phy0", "pcie-phy1", "pcie-phy2"; + power-domains =3D <&scpsys MT2701_POWER_DOMAIN_HIF>; + bus-range =3D <0x00 0xff>; + ranges =3D <0x81000000 0 0x1a160000 0 0x1a160000 0 0x00010000>= , /* I/O space */ + <0x83000000 0 0x60000000 0 0x60000000 0 0x10000000>; = /* memory space */ + + pcie@0,0 { + device_type =3D "pci"; + reg =3D <0x0000 0 0 0 0>; + #address-cells =3D <3>; + #size-cells =3D <2>; + #interrupt-cells =3D <1>; + interrupt-map-mask =3D <0 0 0 0>; + interrupt-map =3D <0 0 0 0 &sysirq GIC_SPI 193 IRQ_TYPE_LE= VEL_LOW>; + ranges; + }; + + pcie@1,0 { + device_type =3D "pci"; + reg =3D <0x0800 0 0 0 0>; + #address-cells =3D <3>; + #size-cells =3D <2>; + #interrupt-cells =3D <1>; + interrupt-map-mask =3D <0 0 0 0>; + interrupt-map =3D <0 0 0 0 &sysirq GIC_SPI 194 IRQ_TYPE_LE= VEL_LOW>; + ranges; + }; + + pcie@2,0 { + device_type =3D "pci"; + reg =3D <0x1000 0 0 0 0>; + #address-cells =3D <3>; + #size-cells =3D <2>; + #interrupt-cells =3D <1>; + interrupt-map-mask =3D <0 0 0 0>; + interrupt-map =3D <0 0 0 0 &sysirq GIC_SPI 195 IRQ_TYPE_LE= VEL_LOW>; + ranges; + }; + }; + }; diff --git a/Documentation/devicetree/bindings/pci/mediatek-pcie.txt b/Docu= mentation/devicetree/bindings/pci/mediatek-pcie.txt deleted file mode 100644 index 684227522267..000000000000 --- a/Documentation/devicetree/bindings/pci/mediatek-pcie.txt +++ /dev/null @@ -1,289 +0,0 @@ -MediaTek Gen2 PCIe controller - -Required properties: -- compatible: Should contain one of the following strings: - "mediatek,mt2701-pcie" - "mediatek,mt2712-pcie" - "mediatek,mt7622-pcie" - "mediatek,mt7623-pcie" - "mediatek,mt7629-pcie" - "airoha,en7523-pcie" -- device_type: Must be "pci" -- reg: Base addresses and lengths of the root ports. -- reg-names: Names of the above areas to use during resource lookup. -- #address-cells: Address representation for root ports (must be 3) -- #size-cells: Size representation for root ports (must be 2) -- clocks: Must contain an entry for each entry in clock-names. - See ../clocks/clock-bindings.txt for details. -- clock-names: - Mandatory entries: - - sys_ckN :transaction layer and data link layer clock - Required entries for MT2701/MT7623: - - free_ck :for reference clock of PCIe subsys - Required entries for MT2712/MT7622: - - ahb_ckN :AHB slave interface operating clock for CSR access and RC - initiated MMIO access - Required entries for MT7622: - - axi_ckN :application layer MMIO channel operating clock - - aux_ckN :pe2_mac_bridge and pe2_mac_core operating clock when - pcie_mac_ck/pcie_pipe_ck is turned off - - obff_ckN :OBFF functional block operating clock - - pipe_ckN :LTSSM and PHY/MAC layer operating clock - where N starting from 0 to one less than the number of root ports. -- phys: List of PHY specifiers (used by generic PHY framework). -- phy-names : Must be "pcie-phy0", "pcie-phy1", "pcie-phyN".. based on the - number of PHYs as specified in *phys* property. -- power-domains: A phandle and power domain specifier pair to the power do= main - which is responsible for collapsing and restoring power to the periphera= l. -- bus-range: Range of bus numbers associated with this controller. -- ranges: Ranges for the PCI memory and I/O regions. - -Required properties for MT7623/MT2701: -- #interrupt-cells: Size representation for interrupts (must be 1) -- interrupt-map-mask and interrupt-map: Standard PCI IRQ mapping properties - Please refer to the standard PCI bus binding document for a more detailed - explanation. -- resets: Must contain an entry for each entry in reset-names. - See ../reset/reset.txt for details. -- reset-names: Must be "pcie-rst0", "pcie-rst1", "pcie-rstN".. based on the - number of root ports. - -Required properties for MT2712/MT7622/MT7629: --interrupts: A list of interrupt outputs of the controller, must have one - entry for each PCIe port -- interrupt-names: Must include the following entries: - - "pcie_irq": The interrupt that is asserted when an MSI/INTX is received -- linux,pci-domain: PCI domain ID. Should be unique for each host controll= er - -In addition, the device tree node must have sub-nodes describing each -PCIe port interface, having the following mandatory properties: - -Required properties: -- device_type: Must be "pci" -- reg: Only the first four bytes are used to refer to the correct bus numb= er - and device number. -- #address-cells: Must be 3 -- #size-cells: Must be 2 -- #interrupt-cells: Must be 1 -- interrupt-map-mask and interrupt-map: Standard PCI IRQ mapping properties - Please refer to the standard PCI bus binding document for a more detailed - explanation. -- ranges: Sub-ranges distributed from the PCIe controller node. An empty - property is sufficient. - -Examples for MT7623: - - hifsys: syscon@1a000000 { - compatible =3D "mediatek,mt7623-hifsys", - "mediatek,mt2701-hifsys", - "syscon"; - reg =3D <0 0x1a000000 0 0x1000>; - #clock-cells =3D <1>; - #reset-cells =3D <1>; - }; - - pcie: pcie@1a140000 { - compatible =3D "mediatek,mt7623-pcie"; - device_type =3D "pci"; - reg =3D <0 0x1a140000 0 0x1000>, /* PCIe shared registers */ - <0 0x1a142000 0 0x1000>, /* Port0 registers */ - <0 0x1a143000 0 0x1000>, /* Port1 registers */ - <0 0x1a144000 0 0x1000>; /* Port2 registers */ - reg-names =3D "subsys", "port0", "port1", "port2"; - #address-cells =3D <3>; - #size-cells =3D <2>; - #interrupt-cells =3D <1>; - interrupt-map-mask =3D <0xf800 0 0 0>; - interrupt-map =3D <0x0000 0 0 0 &sysirq GIC_SPI 193 IRQ_TYPE_LEVEL_LOW>, - <0x0800 0 0 0 &sysirq GIC_SPI 194 IRQ_TYPE_LEVEL_LOW>, - <0x1000 0 0 0 &sysirq GIC_SPI 195 IRQ_TYPE_LEVEL_LOW>; - clocks =3D <&topckgen CLK_TOP_ETHIF_SEL>, - <&hifsys CLK_HIFSYS_PCIE0>, - <&hifsys CLK_HIFSYS_PCIE1>, - <&hifsys CLK_HIFSYS_PCIE2>; - clock-names =3D "free_ck", "sys_ck0", "sys_ck1", "sys_ck2"; - resets =3D <&hifsys MT2701_HIFSYS_PCIE0_RST>, - <&hifsys MT2701_HIFSYS_PCIE1_RST>, - <&hifsys MT2701_HIFSYS_PCIE2_RST>; - reset-names =3D "pcie-rst0", "pcie-rst1", "pcie-rst2"; - phys =3D <&pcie0_phy PHY_TYPE_PCIE>, <&pcie1_phy PHY_TYPE_PCIE>, - <&pcie2_phy PHY_TYPE_PCIE>; - phy-names =3D "pcie-phy0", "pcie-phy1", "pcie-phy2"; - power-domains =3D <&scpsys MT2701_POWER_DOMAIN_HIF>; - bus-range =3D <0x00 0xff>; - ranges =3D <0x81000000 0 0x1a160000 0 0x1a160000 0 0x00010000 /* I/O spa= ce */ - 0x83000000 0 0x60000000 0 0x60000000 0 0x10000000>; /* memory space */ - - pcie@0,0 { - reg =3D <0x0000 0 0 0 0>; - #address-cells =3D <3>; - #size-cells =3D <2>; - #interrupt-cells =3D <1>; - interrupt-map-mask =3D <0 0 0 0>; - interrupt-map =3D <0 0 0 0 &sysirq GIC_SPI 193 IRQ_TYPE_LEVEL_LOW>; - ranges; - }; - - pcie@1,0 { - reg =3D <0x0800 0 0 0 0>; - #address-cells =3D <3>; - #size-cells =3D <2>; - #interrupt-cells =3D <1>; - interrupt-map-mask =3D <0 0 0 0>; - interrupt-map =3D <0 0 0 0 &sysirq GIC_SPI 194 IRQ_TYPE_LEVEL_LOW>; - ranges; - }; - - pcie@2,0 { - reg =3D <0x1000 0 0 0 0>; - #address-cells =3D <3>; - #size-cells =3D <2>; - #interrupt-cells =3D <1>; - interrupt-map-mask =3D <0 0 0 0>; - interrupt-map =3D <0 0 0 0 &sysirq GIC_SPI 195 IRQ_TYPE_LEVEL_LOW>; - ranges; - }; - }; - -Examples for MT2712: - - pcie1: pcie@112ff000 { - compatible =3D "mediatek,mt2712-pcie"; - device_type =3D "pci"; - reg =3D <0 0x112ff000 0 0x1000>; - reg-names =3D "port1"; - linux,pci-domain =3D <1>; - #address-cells =3D <3>; - #size-cells =3D <2>; - interrupts =3D ; - interrupt-names =3D "pcie_irq"; - clocks =3D <&topckgen CLK_TOP_PE2_MAC_P1_SEL>, - <&pericfg CLK_PERI_PCIE1>; - clock-names =3D "sys_ck1", "ahb_ck1"; - phys =3D <&u3port1 PHY_TYPE_PCIE>; - phy-names =3D "pcie-phy1"; - bus-range =3D <0x00 0xff>; - ranges =3D <0x82000000 0 0x11400000 0x0 0x11400000 0 0x300000>; - status =3D "disabled"; - - #interrupt-cells =3D <1>; - interrupt-map-mask =3D <0 0 0 7>; - interrupt-map =3D <0 0 0 1 &pcie_intc1 0>, - <0 0 0 2 &pcie_intc1 1>, - <0 0 0 3 &pcie_intc1 2>, - <0 0 0 4 &pcie_intc1 3>; - pcie_intc1: interrupt-controller { - interrupt-controller; - #address-cells =3D <0>; - #interrupt-cells =3D <1>; - }; - }; - - pcie0: pcie@11700000 { - compatible =3D "mediatek,mt2712-pcie"; - device_type =3D "pci"; - reg =3D <0 0x11700000 0 0x1000>; - reg-names =3D "port0"; - linux,pci-domain =3D <0>; - #address-cells =3D <3>; - #size-cells =3D <2>; - interrupts =3D ; - interrupt-names =3D "pcie_irq"; - clocks =3D <&topckgen CLK_TOP_PE2_MAC_P0_SEL>, - <&pericfg CLK_PERI_PCIE0>; - clock-names =3D "sys_ck0", "ahb_ck0"; - phys =3D <&u3port0 PHY_TYPE_PCIE>; - phy-names =3D "pcie-phy0"; - bus-range =3D <0x00 0xff>; - ranges =3D <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>; - status =3D "disabled"; - - #interrupt-cells =3D <1>; - interrupt-map-mask =3D <0 0 0 7>; - interrupt-map =3D <0 0 0 1 &pcie_intc0 0>, - <0 0 0 2 &pcie_intc0 1>, - <0 0 0 3 &pcie_intc0 2>, - <0 0 0 4 &pcie_intc0 3>; - pcie_intc0: interrupt-controller { - interrupt-controller; - #address-cells =3D <0>; - #interrupt-cells =3D <1>; - }; - }; - -Examples for MT7622: - - pcie0: pcie@1a143000 { - compatible =3D "mediatek,mt7622-pcie"; - device_type =3D "pci"; - reg =3D <0 0x1a143000 0 0x1000>; - reg-names =3D "port0"; - linux,pci-domain =3D <0>; - #address-cells =3D <3>; - #size-cells =3D <2>; - interrupts =3D ; - interrupt-names =3D "pcie_irq"; - clocks =3D <&pciesys CLK_PCIE_P0_MAC_EN>, - <&pciesys CLK_PCIE_P0_AHB_EN>, - <&pciesys CLK_PCIE_P0_AUX_EN>, - <&pciesys CLK_PCIE_P0_AXI_EN>, - <&pciesys CLK_PCIE_P0_OBFF_EN>, - <&pciesys CLK_PCIE_P0_PIPE_EN>; - clock-names =3D "sys_ck0", "ahb_ck0", "aux_ck0", - "axi_ck0", "obff_ck0", "pipe_ck0"; - - power-domains =3D <&scpsys MT7622_POWER_DOMAIN_HIF0>; - bus-range =3D <0x00 0xff>; - ranges =3D <0x82000000 0 0x20000000 0x0 0x20000000 0 0x8000000>; - status =3D "disabled"; - - #interrupt-cells =3D <1>; - interrupt-map-mask =3D <0 0 0 7>; - interrupt-map =3D <0 0 0 1 &pcie_intc0 0>, - <0 0 0 2 &pcie_intc0 1>, - <0 0 0 3 &pcie_intc0 2>, - <0 0 0 4 &pcie_intc0 3>; - pcie_intc0: interrupt-controller { - interrupt-controller; - #address-cells =3D <0>; - #interrupt-cells =3D <1>; - }; - }; - - pcie1: pcie@1a145000 { - compatible =3D "mediatek,mt7622-pcie"; - device_type =3D "pci"; - reg =3D <0 0x1a145000 0 0x1000>; - reg-names =3D "port1"; - linux,pci-domain =3D <1>; - #address-cells =3D <3>; - #size-cells =3D <2>; - interrupts =3D ; - interrupt-names =3D "pcie_irq"; - clocks =3D <&pciesys CLK_PCIE_P1_MAC_EN>, - /* designer has connect RC1 with p0_ahb clock */ - <&pciesys CLK_PCIE_P0_AHB_EN>, - <&pciesys CLK_PCIE_P1_AUX_EN>, - <&pciesys CLK_PCIE_P1_AXI_EN>, - <&pciesys CLK_PCIE_P1_OBFF_EN>, - <&pciesys CLK_PCIE_P1_PIPE_EN>; - clock-names =3D "sys_ck1", "ahb_ck1", "aux_ck1", - "axi_ck1", "obff_ck1", "pipe_ck1"; - - power-domains =3D <&scpsys MT7622_POWER_DOMAIN_HIF0>; - bus-range =3D <0x00 0xff>; - ranges =3D <0x82000000 0 0x28000000 0x0 0x28000000 0 0x8000000>; - status =3D "disabled"; - - #interrupt-cells =3D <1>; - interrupt-map-mask =3D <0 0 0 7>; - interrupt-map =3D <0 0 0 1 &pcie_intc1 0>, - <0 0 0 2 &pcie_intc1 1>, - <0 0 0 3 &pcie_intc1 2>, - <0 0 0 4 &pcie_intc1 3>; - pcie_intc1: interrupt-controller { - interrupt-controller; - #address-cells =3D <0>; - #interrupt-cells =3D <1>; - }; - }; diff --git a/Documentation/devicetree/bindings/pci/mediatek-pcie.yaml b/Doc= umentation/devicetree/bindings/pci/mediatek-pcie.yaml new file mode 100644 index 000000000000..fca6cb20d18b --- /dev/null +++ b/Documentation/devicetree/bindings/pci/mediatek-pcie.yaml @@ -0,0 +1,318 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/mediatek-pcie.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe controller on MediaTek SoCs + +maintainers: + - Christian Marangi + +properties: + compatible: + oneOf: + - enum: + - mediatek,mt2712-pcie + - mediatek,mt7622-pcie + - mediatek,mt7629-pcie + - items: + - const: airoha,en7523-pcie + - const: mediatek,mt7622-pcie + + reg: + maxItems: 1 + + reg-names: + enum: [ port0, port1 ] + + clocks: + minItems: 1 + maxItems: 6 + + clock-names: + minItems: 1 + items: + - enum: [ sys_ck0, sys_ck1 ] + - enum: [ ahb_ck0, ahb_ck1 ] + - enum: [ aux_ck0, aux_ck1 ] + - enum: [ axi_ck0, axi_ck1 ] + - enum: [ obff_ck0, obff_ck1 ] + - enum: [ pipe_ck0, pipe_ck1 ] + + interrupts: + maxItems: 1 + + interrupt-names: + const: pcie_irq + + phys: + maxItems: 1 + + phy-names: + enum: [ pcie-phy0, pcie-phy1 ] + + power-domains: + maxItems: 1 + + '#interrupt-cells': + const: 1 + + interrupt-controller: + description: Interrupt controller node for handling legacy PCI interru= pts. + type: object + properties: + '#address-cells': + const: 0 + '#interrupt-cells': + const: 1 + interrupt-controller: true + + required: + - '#address-cells' + - '#interrupt-cells' + - interrupt-controller + + additionalProperties: false + +required: + - compatible + - reg + - reg-names + - ranges + - clocks + - clock-names + - '#interrupt-cells' + - interrupts + - interrupt-names + - interrupt-controller + +allOf: + - $ref: /schemas/pci/pci-host-bridge.yaml# + + - if: + properties: + compatible: + const: mediatek,mt2712-pcie + then: + properties: + clocks: + minItems: 2 + maxItems: 2 + + clock-names: + minItems: 2 + maxItems: 2 + + power-domains: false + + required: + - phys + - phy-names + + - if: + properties: + compatible: + const: mediatek,mt7622-pcie + then: + properties: + clocks: + minItems: 6 + + phys: false + + phy-names: false + + required: + - power-domains + + - if: + properties: + compatible: + const: mediatek,mt7629-pcie + then: + properties: + clocks: + minItems: 6 + + required: + - power-domains + + - if: + properties: + compatible: + contains: + const: airoha,en7523-pcie + then: + properties: + clocks: + maxItems: 1 + + clock-names: + maxItems: 1 + + phys: false + + phy-names: false + + power-domain: false + +unevaluatedProperties: false + +examples: + # MT2712 + - | + #include + #include + #include + + soc_1 { + #address-cells =3D <2>; + #size-cells =3D <2>; + + pcie@112ff000 { + compatible =3D "mediatek,mt2712-pcie"; + device_type =3D "pci"; + reg =3D <0 0x112ff000 0 0x1000>; + reg-names =3D "port1"; + linux,pci-domain =3D <1>; + #address-cells =3D <3>; + #size-cells =3D <2>; + interrupts =3D ; + interrupt-names =3D "pcie_irq"; + clocks =3D <&topckgen>, /* CLK_TOP_PE2_MAC_P1_SEL */ + <&pericfg>; /* CLK_PERI_PCIE1 */ + clock-names =3D "sys_ck1", "ahb_ck1"; + phys =3D <&u3port1 PHY_TYPE_PCIE>; + phy-names =3D "pcie-phy1"; + bus-range =3D <0x00 0xff>; + ranges =3D <0x82000000 0 0x11400000 0x0 0x11400000 0 0x30000= 0>; + + #interrupt-cells =3D <1>; + interrupt-map-mask =3D <0 0 0 7>; + interrupt-map =3D <0 0 0 1 &pcie_intc1 0>, + <0 0 0 2 &pcie_intc1 1>, + <0 0 0 3 &pcie_intc1 2>, + <0 0 0 4 &pcie_intc1 3>; + pcie_intc1: interrupt-controller { + interrupt-controller; + #address-cells =3D <0>; + #interrupt-cells =3D <1>; + }; + }; + + pcie@11700000 { + compatible =3D "mediatek,mt2712-pcie"; + device_type =3D "pci"; + reg =3D <0 0x11700000 0 0x1000>; + reg-names =3D "port0"; + linux,pci-domain =3D <0>; + #address-cells =3D <3>; + #size-cells =3D <2>; + interrupts =3D ; + interrupt-names =3D "pcie_irq"; + clocks =3D <&topckgen>, /* CLK_TOP_PE2_MAC_P0_SEL */ + <&pericfg>; /* CLK_PERI_PCIE0 */ + clock-names =3D "sys_ck0", "ahb_ck0"; + phys =3D <&u3port0 PHY_TYPE_PCIE>; + phy-names =3D "pcie-phy0"; + bus-range =3D <0x00 0xff>; + ranges =3D <0x82000000 0 0x20000000 0x0 0x20000000 0 0x1000000= 0>; + + #interrupt-cells =3D <1>; + interrupt-map-mask =3D <0 0 0 7>; + interrupt-map =3D <0 0 0 1 &pcie_intc0 0>, + <0 0 0 2 &pcie_intc0 1>, + <0 0 0 3 &pcie_intc0 2>, + <0 0 0 4 &pcie_intc0 3>; + pcie_intc0: interrupt-controller { + interrupt-controller; + #address-cells =3D <0>; + #interrupt-cells =3D <1>; + }; + }; + }; + + # MT7622 + - | + #include + #include + #include + + soc_2 { + #address-cells =3D <2>; + #size-cells =3D <2>; + + pcie@1a143000 { + compatible =3D "mediatek,mt7622-pcie"; + device_type =3D "pci"; + reg =3D <0 0x1a143000 0 0x1000>; + reg-names =3D "port0"; + linux,pci-domain =3D <0>; + #address-cells =3D <3>; + #size-cells =3D <2>; + interrupts =3D ; + interrupt-names =3D "pcie_irq"; + clocks =3D <&pciesys>, /* CLK_PCIE_P0_MAC_EN */ + <&pciesys>, /* CLK_PCIE_P0_AHB_EN */ + <&pciesys>, /* CLK_PCIE_P0_AUX_EN */ + <&pciesys>, /* CLK_PCIE_P0_AXI_EN */ + <&pciesys>, /* CLK_PCIE_P0_OBFF_EN */ + <&pciesys>; /* CLK_PCIE_P0_PIPE_EN */ + clock-names =3D "sys_ck0", "ahb_ck0", "aux_ck0", + "axi_ck0", "obff_ck0", "pipe_ck0"; + + power-domains =3D <&scpsys MT7622_POWER_DOMAIN_HIF0>; + bus-range =3D <0x00 0xff>; + ranges =3D <0x82000000 0 0x20000000 0x0 0x20000000 0 0x80000= 00>; + + #interrupt-cells =3D <1>; + interrupt-map-mask =3D <0 0 0 7>; + interrupt-map =3D <0 0 0 1 &pcie_intc0_1 0>, + <0 0 0 2 &pcie_intc0_1 1>, + <0 0 0 3 &pcie_intc0_1 2>, + <0 0 0 4 &pcie_intc0_1 3>; + pcie_intc0_1: interrupt-controller { + interrupt-controller; + #address-cells =3D <0>; + #interrupt-cells =3D <1>; + }; + }; + + pcie@1a145000 { + compatible =3D "mediatek,mt7622-pcie"; + device_type =3D "pci"; + reg =3D <0 0x1a145000 0 0x1000>; + reg-names =3D "port1"; + linux,pci-domain =3D <1>; + #address-cells =3D <3>; + #size-cells =3D <2>; + interrupts =3D ; + interrupt-names =3D "pcie_irq"; + clocks =3D <&pciesys>, /* CLK_PCIE_P1_MAC_EN */ + /* designer has connect RC1 with p0_ahb clock */ + <&pciesys>, /* CLK_PCIE_P0_AHB_EN */ + <&pciesys>, /* CLK_PCIE_P1_AUX_EN */ + <&pciesys>, /* CLK_PCIE_P1_AXI_EN */ + <&pciesys>, /* CLK_PCIE_P1_OBFF_EN */ + <&pciesys>; /* CLK_PCIE_P1_PIPE_EN */ + clock-names =3D "sys_ck1", "ahb_ck1", "aux_ck1", + "axi_ck1", "obff_ck1", "pipe_ck1"; + + power-domains =3D <&scpsys MT7622_POWER_DOMAIN_HIF0>; + bus-range =3D <0x00 0xff>; + ranges =3D <0x82000000 0 0x28000000 0x0 0x28000000 0 0x80000= 00>; + + #interrupt-cells =3D <1>; + interrupt-map-mask =3D <0 0 0 7>; + interrupt-map =3D <0 0 0 1 &pcie_intc1_1 0>, + <0 0 0 2 &pcie_intc1_1 1>, + <0 0 0 3 &pcie_intc1_1 2>, + <0 0 0 4 &pcie_intc1_1 3>; + pcie_intc1_1: interrupt-controller { + interrupt-controller; + #address-cells =3D <0>; + #interrupt-cells =3D <1>; + }; + }; + }; --=20 2.51.0 From nobody Fri Dec 19 13:49:06 2025 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9968C23C8C5 for ; Sun, 12 Oct 2025 20:59:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760302755; cv=none; b=feFCfJliwjdUu2MDBX4EHmdOM329suDLyptrkGaojie3+ccHB+4osz5e2pU/njQ7+R18c5Vg12kjR4TseEMCCmnrdyy9u0MTChpsmrQ7rrk23fb5LHY9EB4ujEm+O57SPhJxGhCvAE6Rdl55I8i7/k4Pf5Of0qPe1Vl/e30EjJU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760302755; c=relaxed/simple; bh=Xxrmwc5Jl0lDYsa2HAHicVYwNz8UvXqpx68FsI5Tskw=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CU6LvAEUJQraRGQ3/RoAe71B141/ZodGpDJolfftxJcduAWObfpBpMtKlyhJl/9w3dDXJ3Cek8z0xk4pWt4tuqjXUv5TUOQcAgeZ2r9c2TFnscj6+Bhy+1M6vzDFSnXXC72ltS8h6fv4mbJL50qPoj75N1araO5gBWV5pYOozdE= 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=Q8fWwKog; arc=none smtp.client-ip=209.85.128.41 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="Q8fWwKog" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-46e6674caa5so17919525e9.0 for ; Sun, 12 Oct 2025 13:59:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760302752; x=1760907552; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ALuuSU+7OMf38Yq7lgs2vGROJq6nvro7orSmMW4CmOM=; b=Q8fWwKog5OknnhUvOrbLRXznt1acb2R1gowlHXDWkQt0OwGTX/i5R9V0dQknjulRdM 9DWfmURoZdeoJRnTCxIISNyo3vg+CHm8qnM3m74eA+3OT/nvrf4NBGyR8CocfpbZ7eyS WsEHqZCDsCDJeaJQ/Oz0ue5Dd+Ie1wo3C92K/doGTkm1Sm9OTTATQSuo6Jz2yjVFx44X keitQegQeHlzXDcwzqAJpjUEECcINUlbdh7PFWs2LFcpoTz53S5azl3UFSW0aO0yD5ud J8T0Q1NZ+1+6rXQ3TGBHBzJstQLw1vFwoHqB4Aw7vr7hLnoOP6YHESMY4F/1D1af0q2T 7Ibg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760302752; x=1760907552; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ALuuSU+7OMf38Yq7lgs2vGROJq6nvro7orSmMW4CmOM=; b=trhKA7YbfJj4az69WdgdBJFCGx3SjD0jUziDuaREcB9Vi/cjhM3i5vYwLJ6wWA2xNI Pgw3FAR1CksauAi6bkCzzw2kcKIFgbBaY/FCsl/pMIyMRMtVO/E0IzQnGbXeP3vAuR78 CJfaWrJX88oL7prYN3wS75a2lHzaeuTSQXtonXaUIJFZJgefbjEgUAeboyaxKMwGfoP6 56s8LNnPe1+tlyXzUOLL60cLSn60AdS7nlfHxwYgjINjxEQRagXBntJQ2wV+RBgg8Tbk CYDr18dboJT38EZ20lWQ3WFjavUQ8+z0KrL1QVnaFyDsaNzgf8LFHS3E92vLEiqPmqPG l4LQ== X-Forwarded-Encrypted: i=1; AJvYcCXJu9hRrR5NaQvW9w3Rt3plZOFRQZ6Pcc743B4go6ksI5GAcG4cQgJlKEM0vuMSy8+FtlctbIrmZGTB1mY=@vger.kernel.org X-Gm-Message-State: AOJu0Yxt2eRGXowvtp4C7sHgHde9XS3CUPTRqQTee2Ee9ZysLu2hxte9 iS7fNmyHgE0i3/JuVTOyGIeuEIuL8ux+ctohI7X1H0wihv8LmvW97epP X-Gm-Gg: ASbGncvuO8qXMDx6UHBsHbrnbzkR0a7DbP61ue3kNHkiqncmHAMODS7fvrZoeKETfvl JKqqCWoO1Ncbq0vJcz/D0sWlWh5KZaRB26L6F5g3tQQixD7UZujfx/ZTwmT/hU6rMYwuL0l4P8R o6A+xBYhhYkdfoKiMtgd1KSxWH5r9afNILbp5l5jfCRchmxD2FdE5snTNijANFRzJ7yG7S+sQEY zIdUR3zHB0IGdz3DDlAN3y6pVX+Gzb49NeymTGVfimh8D1e4U7wzP4NQKLZXkbY++f0dbGYKzyj H3yqrUwf2pUT43hDYCzjTjZ3XfAmLIsoMNQTa+l1J4n4vTMVXVkKbONgJXS9o3Kc36HC36bzjT4 QFeGK3hzzkEYYSU4l/u5O5nwenEYsgY+KA+bkwL0poIU61lGLXl8LULQkEUgokDtyyNhYMWDUbD OnTtT3OOKl X-Google-Smtp-Source: AGHT+IG/dpUbIS0g2Y3eod2I3EyF2R8BKbiMyTePG06XGuV1O4BBygByLPvF2RP+JjrNujG+8ex+nQ== X-Received: by 2002:a7b:ca44:0:b0:46d:e5bd:2ba4 with SMTP id 5b1f17b1804b1-46fa29ffedemr100671465e9.18.1760302751667; Sun, 12 Oct 2025 13:59:11 -0700 (PDT) Received: from Ansuel-XPS24 (93-34-92-177.ip49.fastwebnet.it. [93.34.92.177]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-46fb489197dsm156506505e9.10.2025.10.12.13.59.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Oct 2025 13:59:11 -0700 (PDT) From: Christian Marangi To: Ryder Lee , Jianjun Wang , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Christian Marangi , linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, upstream@airoha.com Subject: [PATCH v5 3/5] dt-bindings: PCI: mediatek: Add support for Airoha AN7583 Date: Sun, 12 Oct 2025 22:56:57 +0200 Message-ID: <20251012205900.5948-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251012205900.5948-1-ansuelsmth@gmail.com> References: <20251012205900.5948-1-ansuelsmth@gmail.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" Introduce Airoha AN7583 SoC compatible in mediatek PCIe controller binding. Similar to GEN3, the Airoha AN7583 GEN2 PCIe controller require the PBUS csr property to permit the correct functionality of the PCIe controller. Signed-off-by: Christian Marangi Reviewed-by: Rob Herring (Arm) --- .../bindings/pci/mediatek-pcie.yaml | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/mediatek-pcie.yaml b/Doc= umentation/devicetree/bindings/pci/mediatek-pcie.yaml index fca6cb20d18b..0b8c78ec4f91 100644 --- a/Documentation/devicetree/bindings/pci/mediatek-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/mediatek-pcie.yaml @@ -13,6 +13,7 @@ properties: compatible: oneOf: - enum: + - airoha,an7583-pcie - mediatek,mt2712-pcie - mediatek,mt7622-pcie - mediatek,mt7629-pcie @@ -40,6 +41,12 @@ properties: - enum: [ obff_ck0, obff_ck1 ] - enum: [ pipe_ck0, pipe_ck1 ] =20 + resets: + maxItems: 1 + + reset-names: + const: pcie-rst1 + interrupts: maxItems: 1 =20 @@ -55,6 +62,17 @@ properties: power-domains: maxItems: 1 =20 + mediatek,pbus-csr: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle to pbus-csr syscon + - description: offset of pbus-csr base address register + - description: offset of pbus-csr base address mask register + description: + Phandle with two arguments to the syscon node used to detect if + a given address is accessible on PCIe controller. + '#interrupt-cells': const: 1 =20 @@ -90,6 +108,33 @@ required: allOf: - $ref: /schemas/pci/pci-host-bridge.yaml# =20 + - if: + properties: + compatible: + const: airoha,an7583-pcie + then: + properties: + reg-names: + const: port1 + + clocks: + maxItems: 1 + + clock-names: + const: sys_ck1 + + phy-names: + const: pcie-phy1 + + power-domain: false + + required: + - resets + - reset-names + - phys + - phy-names + - mediatek,pbus-csr + - if: properties: compatible: @@ -104,8 +149,14 @@ allOf: minItems: 2 maxItems: 2 =20 + reset: false + + reset-names: false + power-domains: false =20 + mediatek,pbus-csr: false + required: - phys - phy-names @@ -119,10 +170,16 @@ allOf: clocks: minItems: 6 =20 + reset: false + + reset-names: false + phys: false =20 phy-names: false =20 + mediatek,pbus-csr: false + required: - power-domains =20 @@ -135,6 +192,12 @@ allOf: clocks: minItems: 6 =20 + reset: false + + reset-names: false + + mediatek,pbus-csr: false + required: - power-domains =20 @@ -151,12 +214,18 @@ allOf: clock-names: maxItems: 1 =20 + reset: false + + reset-names: false + phys: false =20 phy-names: false =20 power-domain: false =20 + mediatek,pbus-csr: false + unevaluatedProperties: false =20 examples: @@ -316,3 +385,54 @@ examples: }; }; }; + + # AN7583 + - | + #include + #include + #include + + soc_3 { + #address-cells =3D <2>; + #size-cells =3D <2>; + + pcie@1fa92000 { + compatible =3D "airoha,an7583-pcie"; + device_type =3D "pci"; + linux,pci-domain =3D <1>; + #address-cells =3D <3>; + #size-cells =3D <2>; + + reg =3D <0x0 0x1fa92000 0x0 0x1670>; + reg-names =3D "port1"; + + clocks =3D <&scuclk EN7523_CLK_PCIE>; + clock-names =3D "sys_ck1"; + + phys =3D <&pciephy>; + phy-names =3D "pcie-phy1"; + + ranges =3D <0x02000000 0 0x24000000 0x0 0x24000000 0 0x4000000= >; + + resets =3D <&scuclk>; /* AN7583_PCIE1_RST */ + reset-names =3D "pcie-rst1"; + + mediatek,pbus-csr =3D <&pbus_csr 0x8 0xc>; + + interrupts =3D ; + interrupt-names =3D "pcie_irq"; + bus-range =3D <0x00 0xff>; + #interrupt-cells =3D <1>; + interrupt-map-mask =3D <0 0 0 7>; + interrupt-map =3D <0 0 0 1 &pcie_intc1 0>, + <0 0 0 2 &pcie_intc1 1>, + <0 0 0 3 &pcie_intc1 2>, + <0 0 0 4 &pcie_intc1 3>; + + pcie_intc1_4: interrupt-controller { + interrupt-controller; + #address-cells =3D <0>; + #interrupt-cells =3D <1>; + }; + }; + }; --=20 2.51.0 From nobody Fri Dec 19 13:49:06 2025 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 3C8EB238C2A for ; Sun, 12 Oct 2025 20:59:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760302757; cv=none; b=Tts0PZODhIxAGXQ8Xh9KBOkEInaqXh3kNudDgv2gpm7EXjY2KnTIj8D/X9927jpYKSyX0tTglfHUuOxrLSPb0m06pajXd0P7/KYfpzp2AzSZT9Gq+4nmYgVG9RIRB2fxrEG/8nMmMNMyBO2lrBelEHnMXgrSyTNjY7ribkjVvXE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760302757; c=relaxed/simple; bh=OuzlMBf2DYxUrGozGqCnGqXutFM3aRqod7/0oO6AhUE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tcOoeOt/x48dcu8HK0JLjwEtXwq6s7aMidMfKXfOh7iQUg9tzfOxVSzcO5h+dDx1Zcbn8DZ9ml38n+eOx2FtW0VcXX50MAvhSKXEYCyauyjtdzvMlGt28v/duf/cj/rK7GvNk3qT7yy3t43cfjUw/ZyRndYFoELdOBuRsU/3JCg= 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=DtHkRNkF; arc=none smtp.client-ip=209.85.128.45 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="DtHkRNkF" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-46e4f2696bdso37880975e9.0 for ; Sun, 12 Oct 2025 13:59:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760302754; x=1760907554; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=3LU04oH6Jeu7LPnO6lTLYJu+6qHSNvnAGZMQiBqSTLE=; b=DtHkRNkFksHqXz2/tbiNmV90QbRCxpF/rvEfWE7okfhJcvdU6BBZWVa6jU96WRwuLC N/wX4+qX/vt9PiZUXG31V3NHmVfnZrbxLJ1YZOeuocFuSeQUQUeE3Jg1jFjsJQpkDFGz FsRF2jjHzfn9y26qReOcWzojttuoryz67wUNldjaFad5/N6wlKKLeoG2jd8XTxYfarkK VIEIivz4QaPG+nCBEYviC1l8PsRrGbue5j5PxuxQ+Tapkh2g24U+rUkfhxW3Ln6VLzWh t9vDupoVuDN9L5aFTA0AeI2SKiy0N+1qqaUxtVNXgqNzT1CJ8maVNVKYNZbQk6aMk+YK p+OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760302754; x=1760907554; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3LU04oH6Jeu7LPnO6lTLYJu+6qHSNvnAGZMQiBqSTLE=; b=gWfGP1KdqAwKIE4uT9Owb5dc1byBl2SF41Pe2WA8oAs46K3YUrjjllpGf6Kx5HLXM0 DMEjFjqrtwxBrYdtSaeEdDQH3D8NxSMERtlWHWG6d1yhhXekh6K49wLbqrFQwWrwBVZK apBB3jBrHbB+sO7xdl9IQxnu1BQU4Av8xgH4uSSNnvj7LBk9QP9WPWMyhUuswtUba313 IDD745vAeOT/Xz/HhXWG43YBlxFWpT1ezBc8RoociGiHd9jrYv0eo7eCJGHuXeRT+Afe mBqdp7Nrp29haskViwP7E11rfiAZdjcUKEfApambisGCF8LSjj6DDMY2fGfHgfKb8ZcZ dU2Q== X-Forwarded-Encrypted: i=1; AJvYcCXGZGLvfgfvI3zGm+2KdA7b0Fj2hStI8WTkoEsKvetdJ+7l3eZ9P9Yj8zk4gifqGtFKfDCl1Q/sCl15UY4=@vger.kernel.org X-Gm-Message-State: AOJu0Yw8Tb0H+fSXZ/gQX+0Er110+LoIu0NQD5CivTskqNKu8fQOiPDq fMhXv8u+IWEkbYglB2Fo5tCyCPq/V8YwHpEKpx2UhbB1+3ttlmDqqobr X-Gm-Gg: ASbGncup6DjNy8AKJsolgBDu+nw3mHInvWWgpsopbMZssVL3+ebEhU5VJLYq2NBL/dV QeeVesCIHZUXrz6Cyu8rO0uPC4bXs/7iPE9D/lntjMmYMMUIVLU60xWBTVEO88tyQgJH3PL0GNv dbmSM7SgBtRbN+alHmJmIDMYbgXmQEDKTGoipnLGND6Fnco48EqLEasaR5EWEs5rMop++ZI96od cyAp6YfBr3VGgP1P3vOLFjbvw9OQXHfIAvcNF8TX+MFjQeqNS4KhgSX50Ep0hx3ggfQXQ6xy6Kr KDnhn0KEMZK45hdkZxAhNxtndMs/wbeW9v9mgF6B08FEii4IS8bhwnoxW7SUs3vO5yEo7aIp+CF A2iRwAeqt7dGAHUGmX1dLe7/BvkECdRyuW01DiuL2wNUv2MCHpjVNjd5cVEmjKEydeBduKrLCoQ == X-Google-Smtp-Source: AGHT+IFb/bAhpEKJ/FBvurZ3ngymv1jIbjyeCuWNWFx0Ku04wvextCGWwGr4AETbratHm/u6QoIvxw== X-Received: by 2002:a05:600c:3f10:b0:46e:5cb6:b904 with SMTP id 5b1f17b1804b1-46fa9b079f7mr131209665e9.28.1760302753575; Sun, 12 Oct 2025 13:59:13 -0700 (PDT) Received: from Ansuel-XPS24 (93-34-92-177.ip49.fastwebnet.it. [93.34.92.177]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-46fb489197dsm156506505e9.10.2025.10.12.13.59.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Oct 2025 13:59:12 -0700 (PDT) From: Christian Marangi To: Ryder Lee , Jianjun Wang , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Christian Marangi , linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, upstream@airoha.com Subject: [PATCH v5 4/5] PCI: mediatek: convert bool to single flags entry and bitmap Date: Sun, 12 Oct 2025 22:56:58 +0200 Message-ID: <20251012205900.5948-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251012205900.5948-1-ansuelsmth@gmail.com> References: <20251012205900.5948-1-ansuelsmth@gmail.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" To clean Mediatek SoC PCIe struct, convert all the bool to a bitmap and use a single flags to reference all the values. This permits cleaner addition of new flag without having to define a new bool in the struct. Signed-off-by: Christian Marangi --- drivers/pci/controller/pcie-mediatek.c | 28 +++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controlle= r/pcie-mediatek.c index 24cc30a2ab6c..1678461e56d3 100644 --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c @@ -142,24 +142,29 @@ =20 struct mtk_pcie_port; =20 +enum mtk_pcie_flags { + NEED_FIX_CLASS_ID =3D BIT(0), /* host's class ID needed to be fixed */ + NEED_FIX_DEVICE_ID =3D BIT(1), /* host's device ID needed to be fixed */ + NO_MSI =3D BIT(2), /* Bridge has no MSI support, and relies on an + * external block + */ +}; + /** * struct mtk_pcie_soc - differentiate between host generations - * @need_fix_class_id: whether this host's class ID needed to be fixed or = not - * @need_fix_device_id: whether this host's device ID needed to be fixed o= r not * @no_msi: Bridge has no MSI support, and relies on an external block * @device_id: device ID which this host need to be fixed * @ops: pointer to configuration access functions * @startup: pointer to controller setting functions * @setup_irq: pointer to initialize IRQ functions + * @flags: pcie device flags. */ struct mtk_pcie_soc { - bool need_fix_class_id; - bool need_fix_device_id; - bool no_msi; unsigned int device_id; struct pci_ops *ops; int (*startup)(struct mtk_pcie_port *port); int (*setup_irq)(struct mtk_pcie_port *port, struct device_node *node); + u32 flags; }; =20 /** @@ -703,7 +708,7 @@ static int mtk_pcie_startup_port_v2(struct mtk_pcie_por= t *port) writel(val, port->base + PCIE_RST_CTRL); =20 /* Set up vendor ID and class code */ - if (soc->need_fix_class_id) { + if (soc->flags & NEED_FIX_CLASS_ID) { val =3D PCI_VENDOR_ID_MEDIATEK; writew(val, port->base + PCIE_CONF_VEND_ID); =20 @@ -711,7 +716,7 @@ static int mtk_pcie_startup_port_v2(struct mtk_pcie_por= t *port) writew(val, port->base + PCIE_CONF_CLASS_ID); } =20 - if (soc->need_fix_device_id) + if (soc->flags & NEED_FIX_DEVICE_ID) writew(soc->device_id, port->base + PCIE_CONF_DEVICE_ID); =20 /* 100ms timeout value should be enough for Gen1/2 training */ @@ -1099,7 +1104,7 @@ static int mtk_pcie_probe(struct platform_device *pde= v) =20 host->ops =3D pcie->soc->ops; host->sysdata =3D pcie; - host->msi_domain =3D pcie->soc->no_msi; + host->msi_domain =3D !!(pcie->soc->flags & NO_MSI); =20 err =3D pci_host_probe(host); if (err) @@ -1187,9 +1192,9 @@ static const struct dev_pm_ops mtk_pcie_pm_ops =3D { }; =20 static const struct mtk_pcie_soc mtk_pcie_soc_v1 =3D { - .no_msi =3D true, .ops =3D &mtk_pcie_ops, .startup =3D mtk_pcie_startup_port, + .flags =3D NO_MSI, }; =20 static const struct mtk_pcie_soc mtk_pcie_soc_mt2712 =3D { @@ -1199,19 +1204,18 @@ static const struct mtk_pcie_soc mtk_pcie_soc_mt271= 2 =3D { }; =20 static const struct mtk_pcie_soc mtk_pcie_soc_mt7622 =3D { - .need_fix_class_id =3D true, .ops =3D &mtk_pcie_ops_v2, .startup =3D mtk_pcie_startup_port_v2, .setup_irq =3D mtk_pcie_setup_irq, + .flags =3D NEED_FIX_CLASS_ID, }; =20 static const struct mtk_pcie_soc mtk_pcie_soc_mt7629 =3D { - .need_fix_class_id =3D true, - .need_fix_device_id =3D true, .device_id =3D PCI_DEVICE_ID_MEDIATEK_7629, .ops =3D &mtk_pcie_ops_v2, .startup =3D mtk_pcie_startup_port_v2, .setup_irq =3D mtk_pcie_setup_irq, + .flags =3D NEED_FIX_CLASS_ID | NEED_FIX_DEVICE_ID, }; =20 static const struct of_device_id mtk_pcie_ids[] =3D { --=20 2.51.0 From nobody Fri Dec 19 13:49:06 2025 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDBBA24634F for ; Sun, 12 Oct 2025 20:59:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760302759; cv=none; b=uoDZTbXgtcQablqFcbsNcEGetstWUNm+AK1X5CF9W+KQnqlKlavjLxQ1pQPl96N7rmzjnsQ+ReCDfOluYGyEGtZwACBod5Ld3m7eAl5WnqxZ4Y+Z+GvvxLYYBboFl0x9pB4VbeSipCMcfM27VNLbcV5JCxuMqNP4FV6tgMFe2D0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760302759; c=relaxed/simple; bh=Y9B4pzLzBUoQ9UIuQ9tIIiCjBmPz1CktqXuCtCWM/sI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xv9+vsEyfYURp0pdW57TQ/cfe3iRCt7K5Tb95Ce+6J4k5k5R12VPe/AUjAYqIMInJemiON3Mjc28M4X9A6MisCbCB/fvfWLU3eSFY9+pZff2iCGs76nS0SRblgBgviicU8DIK9YES+7Tjs4IKDQ9KvGJLIXegUj3CilBlX0yePY= 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=nsc6IO06; arc=none smtp.client-ip=209.85.221.41 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="nsc6IO06" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-3fa528f127fso2568219f8f.1 for ; Sun, 12 Oct 2025 13:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760302755; x=1760907555; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=HfCCKZmM8pHKKYsT+xDhYQD00mwQ4CthcxXjlQ/ajbw=; b=nsc6IO06Tlyq7aYcLRg/jr0M5+naBwyxEy3UUtJgdS2QAN7AeRMzf966b4s3JQMt+u jikZHsnMSBBTUO1c0LPzA8f5RwKmwOqmLgGrYeZM/7uCJGxaal7l/JGi9wqzk0K1vsNh 7qL6dJ3PvoajOHpb4MoTHGOH7TvWfes4ndwnpU8a0fgEv1Pr5htOAvsi2Qpvj41JobjL JMrCydbyzBvNlOvh5G1zQVfRuKVAO9/gdo78K0b3XDqFV/2STAfeMurhyvZtRc7SwG42 X7NeznZn6ivEjz8TKQScgYgmCImPpV7AI4CGFAiql6XhwuwOT4Xcsd759VXRVFqtdI6M dTww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760302755; x=1760907555; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HfCCKZmM8pHKKYsT+xDhYQD00mwQ4CthcxXjlQ/ajbw=; b=BiigQGJQx2wqNEMOlSCz5RF70wOj6eNo15ZYGqZbXMpTlrTmaDVs8ukbJ6iMl6nWkd VjKxx5rqVKqmEzG2HuGLn7s5WLF60gL88VnvVBdoqRuYPPO3bLFwS7QxynX/iN4lqVVL oO2TbTiz5T9XHE63CqA4q0p5fmDbCKn+QpLoDXMuXEdQYFSn0aRBAHp6eZg5hn16mGNI TdRkTJRj8KY7w2P/yCq9DPOLLrItacfY+q+NZcwK/niUlwUCjkNc5gzwyaJ0e41JlklZ G0I0KTPz3Lwdafpraq9MXNlA2lngF7kLmKg+qD0kOiAFtodgiCvjr/DOe7gLz5iBElWC 0DUA== X-Forwarded-Encrypted: i=1; AJvYcCX9CFS3eaJ062KMhGTLTPC99Fb9cS+YxVomOz2tZsHvTicmZHc8GnaEX8Z1OzTp5nGB2bhWOT5T/XO+kY4=@vger.kernel.org X-Gm-Message-State: AOJu0YwAKs9H6mg+pYeybHOre7IOmpvSEplqA3e1swUYvqRqg5vUwfsK UTS1StWigpQswq2iSd0iA3dXMgfnHC/u46SlzZaBDfYPEd6PmtxsSRVy X-Gm-Gg: ASbGncuSK717u8HQyalYD7IAy+J+GshLKU/wuvDMCHENxbZCVLtraW/Rq3jqGEVcr3g c6LyNuvNo44fX4yX+sN2oZYjDGZ6tEIqPwh95QrhjNxdZL0jWR/cGsGqVcw8bLiXKfoNS8jKR6b xocdTADNXwkH/+9aIHVcfMEv/oHVTNAFhwVTkzeGiNybcLtiAfvT79t4KbszX4PnxKxwp/n90T4 gZZXyjWllhFiLGZ1kC58Y6ca2t200axxzKMlr6c2u5jbRL+YQnFJ1kggCCCy4aRmNbVTcwb39X6 9WtYQ2odO4d60NBX+4+GPu82BcHqHo216/6mr2uVoBARidAFnhOvbZuEPRDELvjUGtsnnOr1GVR FCPx+jdH+YNNTrQyC5PtMhw+G2Loa7b9YrCfTHysqWNU3YU5SuthXXdoMIKA6phYiP72mW/0ntv FvxHRCTogG X-Google-Smtp-Source: AGHT+IH7sgN1Uipv2qIehYyfPkgfd4Xy/W9AcNWaxkV0fmExJBTYScLNQstD+s0qCJYHU+iZtjXiGQ== X-Received: by 2002:a05:6000:4027:b0:401:2cbf:ccad with SMTP id ffacd0b85a97d-425829e78e9mr16695402f8f.17.1760302754926; Sun, 12 Oct 2025 13:59:14 -0700 (PDT) Received: from Ansuel-XPS24 (93-34-92-177.ip49.fastwebnet.it. [93.34.92.177]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-46fb489197dsm156506505e9.10.2025.10.12.13.59.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Oct 2025 13:59:14 -0700 (PDT) From: Christian Marangi To: Ryder Lee , Jianjun Wang , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Christian Marangi , linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, upstream@airoha.com Subject: [PATCH v5 5/5] PCI: mediatek: add support for Airoha AN7583 SoC Date: Sun, 12 Oct 2025 22:56:59 +0200 Message-ID: <20251012205900.5948-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251012205900.5948-1-ansuelsmth@gmail.com> References: <20251012205900.5948-1-ansuelsmth@gmail.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" Add support for the second PCIe Root Complex present on Airoha AN7583 SoC. This is based on the Mediatek Gen1/2 PCIe driver and similar to Gen3 also require workaround for the reset signals. Introduce a new flag to skip having to reset signals and also introduce some additional logic to configure the PBUS registers required for Airoha SoC. While at it, also add additional info on the PERST# Signal delay comments and use dedicated macro. Signed-off-by: Christian Marangi --- drivers/pci/controller/pcie-mediatek.c | 92 ++++++++++++++++++++------ 1 file changed, 70 insertions(+), 22 deletions(-) diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controlle= r/pcie-mediatek.c index 1678461e56d3..3340c005da4b 100644 --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c @@ -148,6 +148,7 @@ enum mtk_pcie_flags { NO_MSI =3D BIT(2), /* Bridge has no MSI support, and relies on an * external block */ + SKIP_PCIE_RSTB =3D BIT(3), /* Skip calling RSTB bits on PCIe probe */ }; =20 /** @@ -684,28 +685,32 @@ static int mtk_pcie_startup_port_v2(struct mtk_pcie_p= ort *port) regmap_update_bits(pcie->cfg, PCIE_SYS_CFG_V2, val, val); } =20 - /* Assert all reset signals */ - writel(0, port->base + PCIE_RST_CTRL); - - /* - * Enable PCIe link down reset, if link status changed from link up to - * link down, this will reset MAC control registers and configuration - * space. - */ - writel(PCIE_LINKDOWN_RST_EN, port->base + PCIE_RST_CTRL); - - /* - * Described in PCIe CEM specification sections 2.2 (PERST# Signal) and - * 2.2.1 (Initial Power-Up (G3 to S0)). The deassertion of PERST# should - * be delayed 100ms (TPVPERL) for the power and clock to become stable. - */ - msleep(100); - - /* De-assert PHY, PE, PIPE, MAC and configuration reset */ - val =3D readl(port->base + PCIE_RST_CTRL); - val |=3D PCIE_PHY_RSTB | PCIE_PERSTB | PCIE_PIPE_SRSTB | - PCIE_MAC_SRSTB | PCIE_CRSTB; - writel(val, port->base + PCIE_RST_CTRL); + if (!(soc->flags & SKIP_PCIE_RSTB)) { + /* Assert all reset signals */ + writel(0, port->base + PCIE_RST_CTRL); + + /* + * Enable PCIe link down reset, if link status changed from + * link up to link down, this will reset MAC control registers + * and configuration space. + */ + writel(PCIE_LINKDOWN_RST_EN, port->base + PCIE_RST_CTRL); + + /* + * Described in PCIe CEM specification revision 3.0 sections + * 2.2 (PERST# Signal) and 2.2.1 (Initial Power-Up (G3 to S0)). + * + * The deassertion of PERST# should be delayed 100ms (TPVPERL) + * for the power and clock to become stable. + */ + msleep(PCIE_T_PVPERL_MS); + + /* De-assert PHY, PE, PIPE, MAC and configuration reset */ + val =3D readl(port->base + PCIE_RST_CTRL); + val |=3D PCIE_PHY_RSTB | PCIE_PERSTB | PCIE_PIPE_SRSTB | + PCIE_MAC_SRSTB | PCIE_CRSTB; + writel(val, port->base + PCIE_RST_CTRL); + } =20 /* Set up vendor ID and class code */ if (soc->flags & NEED_FIX_CLASS_ID) { @@ -826,6 +831,41 @@ static int mtk_pcie_startup_port(struct mtk_pcie_port = *port) return 0; } =20 +static int mtk_pcie_startup_port_an7583(struct mtk_pcie_port *port) +{ + struct mtk_pcie *pcie =3D port->pcie; + struct device *dev =3D pcie->dev; + struct pci_host_bridge *host; + struct resource_entry *entry; + struct regmap *pbus_regmap; + resource_size_t addr; + u32 args[2], size; + + /* + * Configure PBus base address and base address mask to allow + * the hw to detect if a given address is accessible on PCIe + * controller. + */ + pbus_regmap =3D syscon_regmap_lookup_by_phandle_args(dev->of_node, + "mediatek,pbus-csr", + ARRAY_SIZE(args), + args); + if (IS_ERR(pbus_regmap)) + return PTR_ERR(pbus_regmap); + + host =3D pci_host_bridge_from_priv(pcie); + entry =3D resource_list_first_type(&host->windows, IORESOURCE_MEM); + if (!entry) + return -ENODEV; + + addr =3D entry->res->start - entry->offset; + regmap_write(pbus_regmap, args[0], lower_32_bits(addr)); + size =3D lower_32_bits(resource_size(entry->res)); + regmap_write(pbus_regmap, args[1], GENMASK(31, __fls(size))); + + return mtk_pcie_startup_port_v2(port); +} + static void mtk_pcie_enable_port(struct mtk_pcie_port *port) { struct mtk_pcie *pcie =3D port->pcie; @@ -1210,6 +1250,13 @@ static const struct mtk_pcie_soc mtk_pcie_soc_mt7622= =3D { .flags =3D NEED_FIX_CLASS_ID, }; =20 +static const struct mtk_pcie_soc mtk_pcie_soc_an7583 =3D { + .ops =3D &mtk_pcie_ops_v2, + .startup =3D mtk_pcie_startup_port_an7583, + .setup_irq =3D mtk_pcie_setup_irq, + .flags =3D NEED_FIX_CLASS_ID | SKIP_PCIE_RSTB, +}; + static const struct mtk_pcie_soc mtk_pcie_soc_mt7629 =3D { .device_id =3D PCI_DEVICE_ID_MEDIATEK_7629, .ops =3D &mtk_pcie_ops_v2, @@ -1219,6 +1266,7 @@ static const struct mtk_pcie_soc mtk_pcie_soc_mt7629 = =3D { }; =20 static const struct of_device_id mtk_pcie_ids[] =3D { + { .compatible =3D "airoha,an7583-pcie", .data =3D &mtk_pcie_soc_an7583 }, { .compatible =3D "mediatek,mt2701-pcie", .data =3D &mtk_pcie_soc_v1 }, { .compatible =3D "mediatek,mt7623-pcie", .data =3D &mtk_pcie_soc_v1 }, { .compatible =3D "mediatek,mt2712-pcie", .data =3D &mtk_pcie_soc_mt2712 = }, --=20 2.51.0