From nobody Wed Oct 1 23:30:11 2025 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C2E6306491 for ; Thu, 25 Sep 2025 16:23:48 +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=1758817430; cv=none; b=emUpd6OACcXtduAXoFh59Bp/8rft/wTT6wHB7RzigoPtvEqWoblU67QhL2U66wpR5E7dE1jDsi+YBZ6kOg4O9QZtW7RyUtAA8VVTmJionyhwXneRjT6JrCMCoNphbjLsBWaU4HCEZALL+cktk5YFn0y8aocpoHKBO1Jz3tbxsqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758817430; c=relaxed/simple; bh=59SyfGUG6nSEzjiJE1uCa6wYniUO5aKzhiQrG33uKX8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ByQvolsfKZbH4Si3JmZxoh1wPCkQKUhr+AEl73Di3VRzU09P1svfFTTbgFuXjLKBs4+dhJqrEc/WRBeUSTKE1Oh6TAVG1cTVbK2LSFBubUisS7g240mHG4yrIOK16Fj2lmjLi2T4QE6qpyokfrHSuSIPD4hDC2kx0hi96hiZwd8= 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=nowPuaMz; 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="nowPuaMz" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-45f2cf99bbbso5781635e9.0 for ; Thu, 25 Sep 2025 09:23:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758817427; x=1759422227; 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=bhfgeWKTTFehUL5ME9QvRLQsevmzrNA8iD7btwmAz3g=; b=nowPuaMzywjIrzGc5zq1Ws1553kNgA/t0BWdtAo7mGlD1A38EWNDdoOSULUaSFkxOn 9qcn2EcxxYPq8CX6GGwZabBoL1jIzNllOcUrCQKnA/15vqtnB4XPHms4DICcMe3vi/nM MXLsHlx1mf1wodbQxEl0uMx7HaDW5V00hEwadU1SPb6Xj1SIpLLv5CERov5qeo+OXn60 GrYrsVS+y6gcYhVFb7QzkKCgOZ4TokXjCYBzpiRH9u7ohIUQ/jF5QOfd6aL0wGw51sm6 hRctnqop+3n93XV/73OE3aKLJNoK/eVRKpSSqTZ58Lg/OA220vvZomo+LpXyoLTFgGxS dekQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758817427; x=1759422227; 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=bhfgeWKTTFehUL5ME9QvRLQsevmzrNA8iD7btwmAz3g=; b=K40yE/r3P8QGoZIK44RkAx90OkDhL1sqjf6gYZ98BK0KGJ8nNBN1vCkUecqK7V6iHP dryFhviT1WzSXyZp76jDJJxaUf9DZcMcUxsMWvaytJvSfRnw83Xe5xpjnMAETpd/SGn8 9Vs6mveYEIkLVho9eL77HANZSLvhBjsQ5oHAAJSqxAHx2akVRO5kCwoBSEtPytJ9Z7BU 9fX63WN26fzWouM7H8UjEiRjwaP4lgRwEDVZcAqroJ50V4z2eBfcj8Z9MOra1+K/TuTN KogpFv9sUgIWGPOQ/vKoSwjIaycNgTVqbYOagnpTnGTDxixY6NJKtNS9ys8R33AZ0fzk LjwQ== X-Forwarded-Encrypted: i=1; AJvYcCUjINKI1tG7CA+GkJM1Htf2K7WNtiVzun45tS2eKoqrPprRSrC0NTsAGnu41asHdvqr4BoyuOEgAXDX1io=@vger.kernel.org X-Gm-Message-State: AOJu0YzsR1iEVNzGez3xAbZGUEl9IjW4wOq4Llb6vXOja1fTrqBRlIed pQo8OmKq1iE0MIoOVtl7/TqcPfCuesHTgeM340HmwKC65lD/LBP8g1TF X-Gm-Gg: ASbGncul4Q7tY6x+xOhHnvaadJWJeFa1F5XOiHjSSDPzaqHMMfFj+9VVAoCDGzl2LhD vNnxnxSwUZ9e94srxlQv/IaCH1RlMRi25MpOHfCAd50t5LOi4FiCxA5lqmXfYae6/CV6jOke2Ff SEplHcRHSY2cvBlHi09j3gK1Tgc6TXNksFelG61qKEXTGd15psnaci5Em8vXnRMw4wZkXqrr80X XgLCp1GwHVF5F6a/K2/O6odErWS9u+IZTdPIzHeXUdjTUMmD3q4T2ZR6IPsdt3RHeLJSGf3jwjC HKJQRNUS8mMtGhmrs5vmyEdv23t12d05IugKXr7C/zqazL8buHl0TU1+IfX8jsMLxLB5Delt8Y6 duHITofTeoNxviW9G9EUqSli00SVzrjHYmW01E4p6g68nMudaHGbm62o5drGHOipDBoaSJO0= X-Google-Smtp-Source: AGHT+IE30qlsw+LGQbGsOMA9cwguph9rKHkg04I434dGAXsnLJ3Ub8ZjYMz0XZC+8/ecQZtZP2gmGQ== X-Received: by 2002:adf:f10e:0:b0:413:46a6:6a51 with SMTP id ffacd0b85a97d-41346a66a66mr555231f8f.38.1758817426788; Thu, 25 Sep 2025 09:23:46 -0700 (PDT) Received: from Ansuel-XPS24 (host-95-249-236-54.retail.telecomitalia.it. [95.249.236.54]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-40fb985e080sm3534819f8f.24.2025.09.25.09.23.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Sep 2025 09:23:46 -0700 (PDT) From: Christian Marangi To: Ryder Lee , Jianjun Wang , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , 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 v3 1/4] ARM: dts: mediatek: drop wrong syscon hifsys compatible for MT2701/7623 Date: Thu, 25 Sep 2025 18:23:15 +0200 Message-ID: <20250925162332.9794-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250925162332.9794-1-ansuelsmth@gmail.com> References: <20250925162332.9794-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 does against the schema for hifsys amnd cause dtbs_check warning. Drop the "syscon" compatible to mute the warning and reflect the compatible property described in the mediatek,mt2701-hifsys.yaml schema. Signed-off-by: Christian Marangi Reviewed-by: AngeloGioacchino Del Regno --- 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 Wed Oct 1 23:30:11 2025 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 A661F306B0C for ; Thu, 25 Sep 2025 16:23:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758817433; cv=none; b=Yt4iwBT9uO67dWI7129/mqDpWmqde1GjlzHCxxb7mRqN/R//V4yiXFHiN3cP8QsvprhCJJF/zwf3PbaNE0KjmOnPA3eycJODyeIIZjuglwnjboU45E6DXpsoDDE0m2X6ySj/rqkyW1hq1pkYuDUkxye+1BI17speqfYqEElItoQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758817433; c=relaxed/simple; bh=rrkRAJwO9hx6jYPM9O50w/IhSWYxpkME8Xc2KPtC5mE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VI8U8Htj0AcnkXEjMZgoz6hAZVgpeHM3O7FKHWlM5k5G7Fozzrgq53BDvCCqw32WrnhJuXBrb9RmRsbKleszwoFWHGAIJzNeQAB7wb6qpFDAxFkn9TyioQcJ2jeSmIOEgsvLRuuHkByP1P5cFcUndIKHrslfAvcsUsvc6TI274o= 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=LTATxDp8; arc=none smtp.client-ip=209.85.221.48 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="LTATxDp8" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3fc36b99e92so1429455f8f.0 for ; Thu, 25 Sep 2025 09:23:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758817429; x=1759422229; 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=cMJ3WopK8a5niskiRP0SzUJlGCXuhbpau4KCX70OMIU=; b=LTATxDp8t/XrxoXvLamJaEqtDcLxyxxwm7dFtBI5fZAsV1Yjbo3dD5V4bSNpHCFSBE kTr0VombRo98BNPd7Rv94upXKiVgem+nbtjX897fPJXgoDzihSmIUeskWjI/PrqHTllp IHriCRqgFINlqehTU0WvCk/trbHF4v/qSRO9bt3xuIgcEIMY+D9zf2sk6QmLvhy+WoNv EtavUbJTKW518pgqjOskgA3I05bYtnd+OZvqlfCxzer+5LH17uwGgzv8N9HaGISjtB84 5eAJliwKd/ceifz1MkHwjrbyl+GMy3IIP3QtYla2A/FV87vdHwxQZ+PDkIN11fTG219/ a8hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758817429; x=1759422229; 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=cMJ3WopK8a5niskiRP0SzUJlGCXuhbpau4KCX70OMIU=; b=piWqm5aJz6S+CMjEsv3I+qoTriJtjBd+0ZATrLN6y3u++w29DUuEcp/kxYFTxK9k99 +4mZ7XM7kTZXo5ZI0YXnOF313M3a6NqpQSSRye8iVWQrNGe2nBNDGbXpzGyrDAeJ0O/u VExTPrJu5gBYYwT/kpxlGaJoSjlIDhCfOVRoa8+TA2MzS/P86qfos6s+sNuUAJ4FXoCv R4oaYtcWAUl9lYRUAZa7Vgdl5uyX5JRPjIoVfujqJKTfKKDLjHJDiht8UZ+8Jf1LEKro ym5xZP3CqM0uPiVI1tNh93CnO+ey2wAR7QCJhj7gfoX/W0lbBvZ/lUVcqW2DvccN5M9h /L+w== X-Forwarded-Encrypted: i=1; AJvYcCVR/mZ1BEmG0/h/aCJHMOQ9YbT1kSifU5NL78U5PDXsmngaNEbx0nu277oZS5UsrRjsJeMZv/xV6fs4548=@vger.kernel.org X-Gm-Message-State: AOJu0YwGfU56fUmJ+ndE5HHSX0WTG4iox7AgSi51m6kxzEny2fnfbRpM Kyxiw0IOzQIOTnO4Fekc0w4l8Z6P5c4jyY7tF2VZFdPCCZ8jXKHyefQL X-Gm-Gg: ASbGncsaNLJylbO+9Gyb2MfId573XcNCrkU3y4too0C2ufEOfD3h9PhPzRMZ7opPsaW HSlwQKSlyNvlJHQhuh/Yxjgl/q59pfiB4qLYdHrcQRKP85MFEoiotUzcXP9BcB0XQOliiz5K6NZ njDdmmyr3RBXNCDJ2cR1Rr0X5kaiZ+gQ+OhIuXaF+eV6inQerulMYPPyXewScY0jLzr/6OXG2Mv gcM8jfLYV33WKljTPAG5T8AaWWio+eTlKQzKP9x74NRyfiDD2ON94qgQVEby0iIHZqcjMOc3LEK CFqzh2xLOYaLFctkWQtyNWZofwMm/+V6Pnzjey1hsw0iBh/189MZSAY6eJpsudux7WLOaALwBoV /bvKPUruhbgBBSe3jzOsI2UKwPa8UcmPLvAaAHc5yJX3+iGBjsZC/vvjQii+VoCXUNFsYNAM= X-Google-Smtp-Source: AGHT+IG4vLNUquEStWizenNmR9p3VJxttVYUn2b4fxFHoL1R1svjHmU9USmjFsPnRBzY3dNa7FzKUA== X-Received: by 2002:a05:6000:2dc1:b0:3d0:e221:892e with SMTP id ffacd0b85a97d-40f6617670dmr3441522f8f.27.1758817428633; Thu, 25 Sep 2025 09:23:48 -0700 (PDT) Received: from Ansuel-XPS24 (host-95-249-236-54.retail.telecomitalia.it. [95.249.236.54]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-40fb985e080sm3534819f8f.24.2025.09.25.09.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Sep 2025 09:23:48 -0700 (PDT) From: Christian Marangi To: Ryder Lee , Jianjun Wang , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , 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 v3 2/4] dt-bindings: PCI: mediatek: Convert to YAML schema Date: Thu, 25 Sep 2025 18:23:16 +0200 Message-ID: <20250925162332.9794-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250925162332.9794-1-ansuelsmth@gmail.com> References: <20250925162332.9794-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 --- .../bindings/pci/mediatek-pcie-mt7623.yaml | 173 ++++++++ .../devicetree/bindings/pci/mediatek-pcie.txt | 289 ------------- .../bindings/pci/mediatek-pcie.yaml | 404 ++++++++++++++++++ 3 files changed, 577 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..2f201c84e29a --- /dev/null +++ b/Documentation/devicetree/bindings/pci/mediatek-pcie-mt7623.yaml @@ -0,0 +1,173 @@ +# 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>; + + 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@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..e3afedb77a01 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/mediatek-pcie.yaml @@ -0,0 +1,404 @@ +# 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: + minItems: 1 + maxItems: 4 + + reg-names: + minItems: 1 + maxItems: 4 + + clocks: + minItems: 1 + maxItems: 6 + + clock-names: + minItems: 1 + maxItems: 6 + + interrupts: + maxItems: 1 + + interrupt-names: + const: pcie_irq + + resets: + minItems: 1 + maxItems: 3 + + reset-names: + minItems: 1 + maxItems: 3 + + phys: + minItems: 1 + maxItems: 3 + + phy-names: + minItems: 1 + maxItems: 3 + + 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: + reg: + maxItems: 1 + + reg-names: + items: + - enum: [ port0, port1 ] + + clocks: + minItems: 2 + maxItems: 2 + + clock-names: + items: + - enum: [ sys_ck0, sys_ck1 ] + - enum: [ ahb_ck0, ahb_ck1 ] + + reset: false + + reset-names: false + + phys: + maxItems: 1 + + phy-names: + items: + - enum: [ pcie-phy0, pcie-phy1 ] + + power-domains: false + + required: + - phys + - phy-names + + - if: + properties: + compatible: + const: mediatek,mt7622-pcie + then: + properties: + reg: + maxItems: 1 + + reg-names: + items: + - enum: [ port0, port1 ] + + clocks: + minItems: 6 + maxItems: 6 + + clock-names: + 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 ] + + reset: false + + reset-names: false + + phys: false + + phy-names: false + + required: + - power-domains + + - if: + properties: + compatible: + const: mediatek,mt7629-pcie + then: + properties: + reg: + maxItems: 1 + + reg-names: + items: + - enum: [ port0, port1 ] + + clocks: + minItems: 6 + maxItems: 6 + + clock-names: + 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 ] + + reset: false + + reset-names: false + + phys: + maxItems: 1 + + phy-names: + items: + - enum: [ pcie-phy0, pcie-phy1 ] + + required: + - power-domains + + - if: + properties: + compatible: + contains: + const: airoha,en7523-pcie + then: + properties: + reg: + maxItems: 1 + + reg-names: + items: + - enum: [ port0, port1 ] + + clocks: + maxItems: 1 + + clock-names: + items: + - enum: [ sys_ck0, sys_ck1 ] + + reset: false + + reset-names: false + + 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 Wed Oct 1 23:30:11 2025 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 860C83081BD for ; Thu, 25 Sep 2025 16:23:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758817434; cv=none; b=r7ZrzPoBuxn0FnNsVCA3TPnvOPzHwy9nmusSo/9KbGhtuTBl9JcJRtcAgBGaMO2qq6DvkJp78uIbmrubAMbE1DobuNn9ViXTDIW+JlhRiaXRpVSjV5+OONAjC6k7inecvZWlNP9C0ZwSo/Y+uB818fsWwUGOaj1u7THMHyik9gU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758817434; c=relaxed/simple; bh=wI2EgBAstfuh0Lwsj21CyJ/ou9l4B9diH54Sb1sikXo=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KeYHyAZycPxaDACgJfjse2TgXcEeq5/90ff/j2Lqzd2V+mHGNpa1TiQKATPKKkaQXJ8nOXhCUue7Bd96e1AN7J5Tik9T/fV0LUxsNGrHMIsCh8x7cg6j4uVuYy36wGAxM6atLArwDn3EK9BJ7kBEQfc/9XBZ/Mry6xnwQe94t8w= 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=Uifd6ReT; 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="Uifd6ReT" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-46e1cc6299cso11403715e9.1 for ; Thu, 25 Sep 2025 09:23:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758817431; x=1759422231; 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=ojrSKhmG/fxO+GWCa4ng/6S+zCuiK4Lwk2+N5nW6KeM=; b=Uifd6ReTOoiTKNi4QE0vkUHTl245ESxhb8Djo5pMbndfskumdfSYzrEuD2d5xFWfgb y+MwpvfgJPlGAyaSCjO9ciUdMaFhhQABZflnfctYSIYwni1DX7ryWsDbBRoxIXIa+4dr HZH8Wsy+x4WN8803jYttJug1ZJxAOoO9tOn4zAjYaUf3q8+lIytC7+CWl8lSGJqU+s7U CjCiqfQkN8z++hWxvxCq+/4ILveWEiAtUj6fqyClXvCDF2WVOKFSQmSSSVhGtS3yfF2F qZC4/Uyxi+LiiSAf/o9ka0jFeXQ+uhDIFOvEmn3n1MGu4nWRaAtxT19wWc37P0+lt4Xe p7tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758817431; x=1759422231; 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=ojrSKhmG/fxO+GWCa4ng/6S+zCuiK4Lwk2+N5nW6KeM=; b=tr/Ae9ca7c10LdTkYk/OkFBQVP5di8Q34M/3zHFWf1Tzd2SuyAd2H5b0nAzyCIijRp BQcg1WNgWnRN51T5rgIIWUBHfuUIC7sknI9w6f2LOq9tsYXN9GcMoINVvEz2GA7amVsS ylb4HDhAhtVCS2bOE8B4bBV1Yw7DgvdRk+aK9rZscwnmiLLQkHcpQly/JEi8lUxn+Tvw TDsTntgZDrT/6ujj6rlwdWGTX02QEC1osskF/oBwRbL8fM/Xp6w1pMyXa8Lad3QCsitz GYRzO2SMU7vbXn0yhSP56BNSN9dZYUlWcPOu6PL3IQievbTkBD0b/UjdmTX4j+IY3XFJ I0mA== X-Forwarded-Encrypted: i=1; AJvYcCXr2RoqLJLZVB+vzLEaVty2440nq1kBj12J8MpappOrCVA0TOWdrrl2s83v2c76Cnp+MfiV6gMuJBpqZ5I=@vger.kernel.org X-Gm-Message-State: AOJu0Yw7twAndvDCrnXgq4adZw5NX6aXp0e0uKPPjUVbV+mj9Mb304d8 TELfTTZs8UYMPe6TTPBC8LBeb2G9JZCyPtUuOa3xZlQAvHEFYLQ87I77 X-Gm-Gg: ASbGncuFblMLMnIuEuM9c0pU3bGvZyQxab7J+hm4WtaKV8ekWo6FxxBcz5ee7wtPFqJ 1+Oq49dl/ovC4XmKloZe3RUH/R6VxF09lMx4gkW6j3TXlrr9r+wrmHV5Ta8DDqz0+kE9Z+jnS6c lXjJQXGY3ftHWOtmm2wfvD5KhjNu02BBMBstj5cOqYQCRypB1tBffvRFWgpPrshNc2oFbOviZIy jnwR1PUIEIAGsyQFLy0Xw/hBE16LFx5OoKyF4XtCC2Yqha0XAbQeuAtmgDh6md6bhBMPYLWkOZd VWTWQoe8o4wDASNF2F3/6UAMZ4N6mMlY0ZEMRcL8aPwcoBNpX8yVfNCMdCLTORT4Ub1NhA99FeX XDgFXxp5DIccTYwGtqMP7KUl0pJJvG59D8qgl9YGjhPkZqU45EHrdXH6n69v0r0SM60vVWek= X-Google-Smtp-Source: AGHT+IGoQEBIl1V2qVvXVjckSIeQJSaJ6Q4rOdOHbSTXBeT0yFthNPrs3b6Al9NZzt3gqkVk7xB4/w== X-Received: by 2002:a05:600c:5290:b0:46e:394b:4991 with SMTP id 5b1f17b1804b1-46e394b4b1emr10436875e9.11.1758817430492; Thu, 25 Sep 2025 09:23:50 -0700 (PDT) Received: from Ansuel-XPS24 (host-95-249-236-54.retail.telecomitalia.it. [95.249.236.54]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-40fb985e080sm3534819f8f.24.2025.09.25.09.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Sep 2025 09:23:50 -0700 (PDT) From: Christian Marangi To: Ryder Lee , Jianjun Wang , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , 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 v3 3/4] dt-bindings: PCI: mediatek: Add support for Airoha AN7583 Date: Thu, 25 Sep 2025 18:23:17 +0200 Message-ID: <20250925162332.9794-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250925162332.9794-1-ansuelsmth@gmail.com> References: <20250925162332.9794-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 --- .../bindings/pci/mediatek-pcie.yaml | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/mediatek-pcie.yaml b/Doc= umentation/devicetree/bindings/pci/mediatek-pcie.yaml index e3afedb77a01..46000049a6c5 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 @@ -61,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 @@ -96,6 +108,45 @@ required: allOf: - $ref: /schemas/pci/pci-host-bridge.yaml# =20 + - if: + properties: + compatible: + const: airoha,an7583-pcie + then: + properties: + reg: + maxItems: 1 + + reg-names: + const: port1 + + clocks: + maxItems: 1 + + clock-names: + const: sys_ck1 + + reset: + maxItems: 1 + + reset-names: + const: pcie-rst1 + + phys: + maxItems: 1 + + phy-names: + const: pcie-phy1 + + power-domain: false + + required: + - resets + - reset-names + - phys + - phy-names + - mediatek,pbus-csr + - if: properties: compatible: @@ -131,6 +182,8 @@ allOf: =20 power-domains: false =20 + mediatek,pbus-csr: false + required: - phys - phy-names @@ -169,6 +222,8 @@ allOf: =20 phy-names: false =20 + mediatek,pbus-csr: false + required: - power-domains =20 @@ -209,6 +264,8 @@ allOf: items: - enum: [ pcie-phy0, pcie-phy1 ] =20 + mediatek,pbus-csr: false + required: - power-domains =20 @@ -243,6 +300,8 @@ allOf: =20 power-domain: false =20 + mediatek,pbus-csr: false + unevaluatedProperties: false =20 examples: @@ -402,3 +461,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 Wed Oct 1 23:30:11 2025 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E253306491 for ; Thu, 25 Sep 2025 16:23:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758817436; cv=none; b=KBukXNb58q1XAm8QHtFPyc+YN2P60NCQPqbMFyFecozq+YTUaXJWgrfWD+LyU6nks2BKU10nAGNExz1BuIGlqNDFnMbENx5Ty7iOEPEJFktKD9x9byFoI/OhrO3TAfM4Fz2Yt5AD9XBkQJgSXZR3Cqrz77eBj9ZkW0UKtsed310= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758817436; c=relaxed/simple; bh=gQpZKL9PYN00DxqOhZ2zLTrFv9ZJsPxReul3Hvo1omc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ne0XSThVPRPWMoQyWPFjGjXdeKNEs9AXB5HTLgBMZLVY2wu+z83rMLMLVQXEU3se7J5vdfv9Vlo06q30csLvpheJumue+N0p5AE60MlzQvDkz+4Q8hlsb2ZvLYMVo+zlZiSCbFATLP7otEjXfqduQM2NFKxjBIIcoM54g8eFLpE= 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=RwcIO6K4; arc=none smtp.client-ip=209.85.128.42 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="RwcIO6K4" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-46e384dfde0so7913505e9.2 for ; Thu, 25 Sep 2025 09:23:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758817432; x=1759422232; 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=aly97HE4DbfA98BoW1r98QzzxmSOsTSspnaWMcDHFeI=; b=RwcIO6K4UkCEIzl3A+n2uk8TzfU+nJlneRBdYxKx3rk+WkD10IRJG/jY09S0gZhkWY 5QveVH3Akfc8KD2o/jnCVYOo/SxQR8A8MrhTmRXCRn2ouMB5145n/JtTrbTXr9CFXM5r OMBnteRFgfZIOy+YHL7YUjxVAKEVypqZncVErVp2uSHBeND+ZiwO29xi/4uWtzY/XDdM XfTRv8W06+/uAr9rX+TMvLf/3epqGAHURMexrLpo8g6yxAiRX+7AP7hFqMoAIlrHTLqs ljkiLeqrGGQZyPlw/WGOH/u27rInhEhB56mL8yD/IJyFJm1M0PPKVqgB3ga5BsWO2A9d 6Yhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758817432; x=1759422232; 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=aly97HE4DbfA98BoW1r98QzzxmSOsTSspnaWMcDHFeI=; b=WDgHSPuj2fGHoFXxMrY1BnJBSf+2IHKOI6IzVZ+y+iSIJc67roLxgZOpz3yMlNcjln SLBukYprc3mSLOrZqkTFlCSlo1W+SBxT+KKgo/sg3VO6yeNV1qDNxY3+5P4Z09jV+sm0 uaQIEqWQ+6UHFXk3c7E/QVMVy+sIvzboAzp41AJErHVDwbCwXmNNTEfOYI52vyd9g06l WiZu9BfoTZvrO1bp37JCm7xdq1/OnDqG5wYsXXlxt9emCWA0koIJbTD48I2N3GywzTVr wH5rafCb2SwuvyWoXlXbSu+LZrZRpZJyhx9co5CaxtUQ/GwoazXsiWL6QpmiGOQ6b94+ kZtg== X-Forwarded-Encrypted: i=1; AJvYcCWghmSNu+kAInyYSl5+hALpd50xGKBxR+3n7ULKujnYa+7TjcybFIqSrG/R1SSHjliJ3DhBRVFnsfZgFqo=@vger.kernel.org X-Gm-Message-State: AOJu0YzHMf+IkLUFgl/OLnV1EFjO1LZPkyanL9gVgJfXA7So3HNc/Occ 5Jz7+QHFI4cdmqP7dooNJCSqvXYfP2N4f+Ahe/spidfU3je1Qhwnga+c X-Gm-Gg: ASbGncsgPts3SkLJQ9/NEZpPJbilZMEAEY/g7jeAzL/33UvXZWPOzgyochxCNlwQzGg olksbiK8xNBUHcpqiS/7OacZUL5c2UwGgGvjf2VOOYoI4+ktRsBL2iGNY6M3eRL1ajDyDxDioMa f8EBFuiSGRlXhO9YFYA+rB4VynlG6VrdZROjiEWcXdkUPusTPVnbaVk/T9SRz+/xP5u0ltEV1su wHPScECW5aSEk1AbH8LBh/A2fkDKhgLtSljXd9LDukI5JAq4EqG5hwFFBlF5GFA1TbdwWxcZpoH 22Q1mB2XYabY5vV//JjQzhx5AnR+ji9GgEeBJAi7KSjn8k4HRP77x6LPqbdlTtKTWZdRNajJUpm WHGjDk+1FRQlO7c7kNMjnrBt9NV2L1BaMoaTZj+8fRfm3kaw9gUb8jUtBj1h5Yo8IyhRwzw0= X-Google-Smtp-Source: AGHT+IFhkM3OKIYZ93q3zFo4tpZKrSRaN1CT2/veh5W7Rq8BDbOwn+wtTdHslVzv0uNMo1/McPbcEg== X-Received: by 2002:a05:600c:489a:b0:459:d8c2:80b2 with SMTP id 5b1f17b1804b1-46e329af060mr29111225e9.7.1758817432312; Thu, 25 Sep 2025 09:23:52 -0700 (PDT) Received: from Ansuel-XPS24 (host-95-249-236-54.retail.telecomitalia.it. [95.249.236.54]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-40fb985e080sm3534819f8f.24.2025.09.25.09.23.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Sep 2025 09:23:51 -0700 (PDT) From: Christian Marangi To: Ryder Lee , Jianjun Wang , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , 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 v3 4/4] PCI: mediatek: add support for Airoha AN7583 SoC Date: Thu, 25 Sep 2025 18:23:18 +0200 Message-ID: <20250925162332.9794-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250925162332.9794-1-ansuelsmth@gmail.com> References: <20250925162332.9794-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 line 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 bool to skip having to reset signals and also introduce some additional logic to configure the PBUS registers required for Airoha SoC. Signed-off-by: Christian Marangi Reviewed-by: AngeloGioacchino Del Regno --- drivers/pci/controller/pcie-mediatek.c | 85 +++++++++++++++++++------- 1 file changed, 63 insertions(+), 22 deletions(-) diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controlle= r/pcie-mediatek.c index 24cc30a2ab6c..640d1f1a6478 100644 --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c @@ -147,6 +147,7 @@ struct mtk_pcie_port; * @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 + * @skip_pcie_rstb: Skip calling RSTB bits on PCIe probe * @device_id: device ID which this host need to be fixed * @ops: pointer to configuration access functions * @startup: pointer to controller setting functions @@ -156,6 +157,7 @@ struct mtk_pcie_soc { bool need_fix_class_id; bool need_fix_device_id; bool no_msi; + bool skip_pcie_rstb; unsigned int device_id; struct pci_ops *ops; int (*startup)(struct mtk_pcie_port *port); @@ -679,28 +681,30 @@ 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->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 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); + } =20 /* Set up vendor ID and class code */ if (soc->need_fix_class_id) { @@ -1105,6 +1109,33 @@ static int mtk_pcie_probe(struct platform_device *pd= ev) if (err) goto put_resources; =20 + if (device_is_compatible(dev, "airoha,an7583-pcie")) { + 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); + + 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 0; =20 put_resources: @@ -1205,6 +1236,15 @@ static const struct mtk_pcie_soc mtk_pcie_soc_mt7622= =3D { .setup_irq =3D mtk_pcie_setup_irq, }; =20 +static const struct mtk_pcie_soc mtk_pcie_soc_an7583 =3D { + .skip_pcie_rstb =3D true, + .need_fix_class_id =3D true, + .need_fix_device_id =3D false, + .ops =3D &mtk_pcie_ops_v2, + .startup =3D mtk_pcie_startup_port_v2, + .setup_irq =3D mtk_pcie_setup_irq, +}; + static const struct mtk_pcie_soc mtk_pcie_soc_mt7629 =3D { .need_fix_class_id =3D true, .need_fix_device_id =3D true, @@ -1215,6 +1255,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