From nobody Wed Apr 1 22:19:12 2026 Received: from Atcsqr.andestech.com (unknown [60.248.187.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2618C328B56; Wed, 25 Feb 2026 08:56:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.248.187.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772009821; cv=none; b=X832SE5QdymM6eHaN4DynqdnhmxS9XqNKxv/nqSIdEMs+f+MjgkIUKurvKwVPtRTxrg32QNkgu/x9RpFoZgwEmKcnJW8zRrsqLdU1cY6fNsx6WljBdjxgfnFvrcklHwdIo3yvFya4ybgw16Z4LKbUch7oCGX773Mke/e8iRhCm0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772009821; c=relaxed/simple; bh=z8EhQONkGW4jc1SEbEcwLrmbuYQePNKNbvhq/nTWy1s=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cPlBlXWk0O0nlXh9O3rlNl05/oQRV8xWRzmLxP063qWN4b2FqAjMaxCDmCsr8xAwibeDZ0JotDi4jwaQ+XHZoRFtX2N6G3e0KHFjHUye2g5HWVXgt6FhW40Qds2NyxHLzSfKxi7rUbejcttFoc2Ae8Vm+JFCnCsGGQiS1j2ZXQM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=permerror header.from=andestech.com; spf=pass smtp.mailfrom=andestech.com; arc=none smtp.client-ip=60.248.187.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=permerror header.from=andestech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=andestech.com Received: from mail.andestech.com (ATCPCS34.andestech.com [10.0.1.134]) by Atcsqr.andestech.com with ESMTP id 61P8tBd5077809; Wed, 25 Feb 2026 16:55:11 +0800 (+08) (envelope-from randolph@andestech.com) Received: from swlinux02.andestech.com (10.0.15.183) by ATCPCS34.andestech.com (10.0.1.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 25 Feb 2026 16:55:10 +0800 From: Randolph To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Randolph Lin Subject: [PATCH v11 1/4] dt-bindings: PCI: Add Andes QiLai PCIe support Date: Wed, 25 Feb 2026 16:55:01 +0800 Message-ID: <20260225085504.3757601-2-randolph@andestech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260225085504.3757601-1-randolph@andestech.com> References: <20260225085504.3757601-1-randolph@andestech.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 X-ClientProxiedBy: ATCPCS33.andestech.com (10.0.1.100) To ATCPCS34.andestech.com (10.0.1.134) X-DKIM-Results: atcpcs34.andestech.com; dkim=none; X-DNSRBL: X-SPAM-SOURCE-CHECK: pass X-MAIL: Atcsqr.andestech.com 61P8tBd5077809 Content-Type: text/plain; charset="utf-8" From: Randolph Lin Add the Andes QiLai PCIe node, which includes 3 Root Complexes. Only one example is required in the DTS bindings YAML file. Signed-off-by: Randolph Lin Reviewed-by: Rob Herring (Arm) --- .../bindings/pci/andestech,qilai-pcie.yaml | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/andestech,qilai-p= cie.yaml diff --git a/Documentation/devicetree/bindings/pci/andestech,qilai-pcie.yam= l b/Documentation/devicetree/bindings/pci/andestech,qilai-pcie.yaml new file mode 100644 index 000000000000..97ba97fdc5a9 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/andestech,qilai-pcie.yaml @@ -0,0 +1,89 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/andestech,qilai-pcie.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Andes QiLai PCIe host controller + +description: + Andes QiLai PCIe host controller is based on the Synopsys DesignWare + PCI core. + +maintainers: + - Randolph Lin + +allOf: + - $ref: /schemas/pci/snps,dw-pcie.yaml# + +properties: + compatible: + const: andestech,qilai-pcie + + reg: + items: + - description: Data Bus Interface (DBI) registers. + - description: APB registers. + - description: PCIe configuration space region. + + reg-names: + items: + - const: dbi + - const: apb + - const: config + + dma-coherent: true + + ranges: + maxItems: 2 + + interrupts: + maxItems: 1 + + interrupt-names: + items: + - const: msi + +required: + - reg + - reg-names + - interrupts + - interrupt-names + +unevaluatedProperties: false + +examples: + - | + #include + + soc { + #address-cells =3D <2>; + #size-cells =3D <2>; + + pcie@80000000 { + compatible =3D "andestech,qilai-pcie"; + device_type =3D "pci"; + reg =3D <0x0 0x80000000 0x0 0x20000000>, + <0x0 0x04000000 0x0 0x00001000>, + <0x0 0x00000000 0x0 0x00010000>; + reg-names =3D "dbi", "apb", "config"; + dma-coherent; + + linux,pci-domain =3D <0>; + #address-cells =3D <3>; + #size-cells =3D <2>; + ranges =3D <0x02000000 0x00 0x10000000 0x00 0x10000000 0x00 0xf000= 0000>, + <0x43000000 0x01 0x00000000 0x01 0x00000000 0x02 0x000000= 00>; + + #interrupt-cells =3D <1>; + interrupts =3D <0xf>; + interrupt-names =3D "msi"; + interrupt-parent =3D <&plic0>; + interrupt-map-mask =3D <0 0 0 0>; + interrupt-map =3D <0 0 0 1 &plic0 0xf IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 2 &plic0 0xf IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 3 &plic0 0xf IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 4 &plic0 0xf IRQ_TYPE_LEVEL_HIGH>; + }; + }; +... --=20 2.34.1 From nobody Wed Apr 1 22:19:12 2026 Received: from Atcsqr.andestech.com (unknown [60.248.187.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B451325708; Wed, 25 Feb 2026 08:56:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.248.187.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772009818; cv=none; b=f/C1XGTJ1ekp+i6JRweKknDGtI1yuY+p/zzYH5CYM0/mSilGFn8loU413OHj4jr2UcBVcudIen30blbFhzDS9ZHanRoR7NI8MFXPLomeDynnOXfGfpxhxxusHnx6hTATAVuCEGfe5+vLInwB0/d7muyrVKthYKdB5Rtp/TurfQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772009818; c=relaxed/simple; bh=yhGs3eKg5h2wSBv4DZuGKN4+n0eP4/2qxR0ajVtwHRQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WnFVEkUYX1aCVqEezBSCdp9MTxt4zG/aAdX0DOeNeIvAf7e2wGNPMEhXWZDgzR3WDr8sd+l9GPXn20lxxHBUKiGAXNBtt1ItQZnMtzvqItl5id5v4XWn9nyMG0DugaFp0I1X55A6/aMohZH/WJ1LpVoMFyIw31Rk1ZfcaXpqeNw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=permerror header.from=andestech.com; spf=pass smtp.mailfrom=andestech.com; arc=none smtp.client-ip=60.248.187.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=permerror header.from=andestech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=andestech.com Received: from mail.andestech.com (ATCPCS34.andestech.com [10.0.1.134]) by Atcsqr.andestech.com with ESMTP id 61P8tBd6077809; Wed, 25 Feb 2026 16:55:12 +0800 (+08) (envelope-from randolph@andestech.com) Received: from swlinux02.andestech.com (10.0.15.183) by ATCPCS34.andestech.com (10.0.1.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 25 Feb 2026 16:55:11 +0800 From: Randolph To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Randolph Lin Subject: [PATCH v11 2/4] riscv: dts: qilai: Add PCIe node into the QiLai SoC Date: Wed, 25 Feb 2026 16:55:02 +0800 Message-ID: <20260225085504.3757601-3-randolph@andestech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260225085504.3757601-1-randolph@andestech.com> References: <20260225085504.3757601-1-randolph@andestech.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 X-ClientProxiedBy: ATCPCS33.andestech.com (10.0.1.100) To ATCPCS34.andestech.com (10.0.1.134) X-DKIM-Results: atcpcs34.andestech.com; dkim=none; X-DNSRBL: X-SPAM-SOURCE-CHECK: pass X-MAIL: Atcsqr.andestech.com 61P8tBd6077809 Content-Type: text/plain; charset="utf-8" From: Randolph Lin Add the Andes QiLai PCIe node, which includes 3 Root Complexes. Signed-off-by: Randolph Lin Acked-by: Manivannan Sadhasivam --- arch/riscv/boot/dts/andes/qilai.dtsi | 109 +++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/arch/riscv/boot/dts/andes/qilai.dtsi b/arch/riscv/boot/dts/and= es/qilai.dtsi index de3de32f8c39..731ba12ccc95 100644 --- a/arch/riscv/boot/dts/andes/qilai.dtsi +++ b/arch/riscv/boot/dts/andes/qilai.dtsi @@ -123,6 +123,7 @@ cpu3_intc: interrupt-controller { soc { compatible =3D "simple-bus"; ranges; + dma-ranges; interrupt-parent =3D <&plic>; #address-cells =3D <2>; #size-cells =3D <2>; @@ -182,5 +183,113 @@ uart0: serial@30300000 { reg-io-width =3D <4>; no-loopback-test; }; + + bus@80000000 { + compatible =3D "simple-bus"; + #address-cells =3D <2>; + #size-cells =3D <2>; + dma-ranges =3D <0x44 0x00000000 0x04 0x00000000 0x04 0x00000000>; + ranges =3D <0x00 0x80000000 0x00 0x80000000 0x00 0x20000000>, + <0x00 0x04000000 0x00 0x04000000 0x00 0x00001000>, + <0x00 0x00000000 0x20 0x00000000 0x20 0x00000000>; + + pcie@80000000 { + compatible =3D "andestech,qilai-pcie"; + device_type =3D "pci"; + reg =3D <0x00 0x80000000 0x00 0x20000000>, /* DBI registers */ + <0x00 0x04000000 0x00 0x00001000>, /* APB registers */ + <0x00 0x00000000 0x00 0x00010000>; /* Configuration registers */ + reg-names =3D "dbi", "apb", "config"; + dma-coherent; + + linux,pci-domain =3D <0>; + #address-cells =3D <3>; + #size-cells =3D <2>; + ranges =3D <0x02000000 0x00 0x10000000 0x00 0x10000000 0x00 0xf0000000= >, + <0x43000000 0x01 0x00000000 0x01 0x00000000 0x02 0x00000000>; + + #interrupt-cells =3D <1>; + interrupts =3D <0xf 0x4>; + interrupt-names =3D "msi"; + interrupt-parent =3D <&plic>; + interrupt-map-mask =3D <0 0 0 0>; + interrupt-map =3D <0 0 0 1 &plic 0xf 0x4>, + <0 0 0 2 &plic 0xf 0x4>, + <0 0 0 3 &plic 0xf 0x4>, + <0 0 0 4 &plic 0xf 0x4>; + }; + }; + + bus@a0000000 { + compatible =3D "simple-bus"; + #address-cells =3D <2>; + #size-cells =3D <2>; + dma-ranges =3D <0x44 0x00000000 0x04 0x00000000 0x04 0x00000000>; + ranges =3D <0x00 0xa0000000 0x00 0xa0000000 0x00 0x20000000>, + <0x00 0x04001000 0x00 0x04001000 0x00 0x00001000>, + <0x00 0x00000000 0x10 0x00000000 0x08 0x00000000>; + + pcie@a0000000 { + compatible =3D "andestech,qilai-pcie"; + device_type =3D "pci"; + reg =3D <0x00 0xa0000000 0x00 0x20000000>, /* DBI registers */ + <0x00 0x04001000 0x00 0x00001000>, /* APB registers */ + <0x00 0x00000000 0x00 0x00010000>; /* Configuration registers */ + reg-names =3D "dbi", "apb", "config"; + dma-coherent; + + linux,pci-domain =3D <1>; + #address-cells =3D <3>; + #size-cells =3D <2>; + ranges =3D <0x02000000 0x00 0x10000000 0x00 0x10000000 0x00 0xf0000000= >, + <0x43000000 0x01 0x00000000 0x01 0x00000000 0x02 0x00000000>; + + #interrupt-cells =3D <1>; + interrupts =3D <0xe 0x4>; + interrupt-names =3D "msi"; + interrupt-parent =3D <&plic>; + interrupt-map-mask =3D <0 0 0 0>; + interrupt-map =3D <0 0 0 1 &plic 0xe 0x4>, + <0 0 0 2 &plic 0xe 0x4>, + <0 0 0 3 &plic 0xe 0x4>, + <0 0 0 4 &plic 0xe 0x4>; + }; + }; + + bus@c0000000 { + compatible =3D "simple-bus"; + #address-cells =3D <2>; + #size-cells =3D <2>; + dma-ranges =3D <0x44 0x00000000 0x04 0x00000000 0x04 0x00000000>; + ranges =3D <0x00 0xc0000000 0x00 0xc0000000 0x00 0x20000000>, + <0x00 0x04002000 0x00 0x04002000 0x00 0x00001000>, + <0x00 0x00000000 0x18 0x00000000 0x08 0x00000000>; + + pcie@c0000000 { + compatible =3D "andestech,qilai-pcie"; + device_type =3D "pci"; + reg =3D <0x00 0xc0000000 0x00 0x20000000>, /* DBI registers */ + <0x00 0x04002000 0x00 0x00001000>, /* APB registers */ + <0x00 0x00000000 0x00 0x00010000>; /* Configuration registers */ + reg-names =3D "dbi", "apb", "config"; + dma-coherent; + + linux,pci-domain =3D <2>; + #address-cells =3D <3>; + #size-cells =3D <2>; + ranges =3D <0x02000000 0x00 0x10000000 0x00 0x10000000 0x00 0xf0000000= >, + <0x43000000 0x01 0x00000000 0x01 0x00000000 0x02 0x00000000>; + + #interrupt-cells =3D <1>; + interrupts =3D <0xd 0x4>; + interrupt-names =3D "msi"; + interrupt-parent =3D <&plic>; + interrupt-map-mask =3D <0 0 0 0>; + interrupt-map =3D <0 0 0 1 &plic 0xd 0x4>, + <0 0 0 2 &plic 0xd 0x4>, + <0 0 0 3 &plic 0xd 0x4>, + <0 0 0 4 &plic 0xd 0x4>; + }; + }; }; }; --=20 2.34.1 From nobody Wed Apr 1 22:19:12 2026 Received: from Atcsqr.andestech.com (unknown [60.248.187.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B28A0326931; Wed, 25 Feb 2026 08:56:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.248.187.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772009821; cv=none; b=lmrC7APwIlLHAQTFvL6WCeTzdILFn6Z12SAKPh79jRuQ3QkN99vuGzXv8m0bw75lKWjsodcwdYJyGX96Id0Eevn0EKmAfe2jztzzAGH2H0Us8jFNOK4DmFqrOB4jO3rWESdJ0bYihfpfj7o+d1UG9AVYxYJG5why2TmAom0+MR8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772009821; c=relaxed/simple; bh=Q2+eln8AOytxLuSyo1ljLJzo0e/fMmCnx58iBBB8z/M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SX3DxEOJ7zuWlM6svgSNUYi82Q9NC6UB8pnOcSmlL/WhQm298o/iNKH6K6//yuaT8sPbp1aLdITnKRZ6f7MUpSSo69WDVoxHDsVdd0rkpaiPKPgcsLbQhAgYo955oFKvkngagvu6ATTn9lLFfwOs6lrNpfCLdpqSSDUCZ25mC68= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=permerror header.from=andestech.com; spf=pass smtp.mailfrom=andestech.com; arc=none smtp.client-ip=60.248.187.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=permerror header.from=andestech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=andestech.com Received: from mail.andestech.com (ATCPCS34.andestech.com [10.0.1.134]) by Atcsqr.andestech.com with ESMTP id 61P8tBd7077809; Wed, 25 Feb 2026 16:55:12 +0800 (+08) (envelope-from randolph@andestech.com) Received: from swlinux02.andestech.com (10.0.15.183) by ATCPCS34.andestech.com (10.0.1.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 25 Feb 2026 16:55:11 +0800 From: Randolph To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Randolph Lin Subject: [PATCH v11 3/4] PCI: qilai: Add Andes QiLai SoC PCIe host driver support Date: Wed, 25 Feb 2026 16:55:03 +0800 Message-ID: <20260225085504.3757601-4-randolph@andestech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260225085504.3757601-1-randolph@andestech.com> References: <20260225085504.3757601-1-randolph@andestech.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 X-ClientProxiedBy: ATCPCS33.andestech.com (10.0.1.100) To ATCPCS34.andestech.com (10.0.1.134) X-DKIM-Results: atcpcs34.andestech.com; dkim=none; X-DNSRBL: X-SPAM-SOURCE-CHECK: pass X-MAIL: Atcsqr.andestech.com 61P8tBd7077809 Content-Type: text/plain; charset="utf-8" From: Randolph Lin Add driver support for DesignWare based PCIe controller in Andes QiLai SoC. The driver only supports the Root Complex mode. Signed-off-by: Randolph Lin --- drivers/pci/controller/dwc/Kconfig | 13 ++ drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-andes-qilai.c | 197 ++++++++++++++++++ 3 files changed, 211 insertions(+) create mode 100644 drivers/pci/controller/dwc/pcie-andes-qilai.c diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controller/dw= c/Kconfig index d0aa031397fa..95bfb60d73a4 100644 --- a/drivers/pci/controller/dwc/Kconfig +++ b/drivers/pci/controller/dwc/Kconfig @@ -61,6 +61,19 @@ config PCI_MESON and therefore the driver re-uses the DesignWare core functions to implement the driver. =20 +config PCIE_ANDES_QILAI + tristate "Andes QiLai PCIe controller" + depends on ARCH_ANDES || COMPILE_TEST + depends on PCI_MSI + select PCIE_DW_HOST + help + Say Y here to enable PCIe controller support on Andes QiLai SoCs, + which operate in Root Complex mode. The Andes QiLai SoC PCIe + controller is based on DesignWare IP and therefore the driver + re-uses the DesignWare core functions to implement the driver. + The Andes QiLai SoC features three Root Complexes, each operating + on PCIe 4.0. + config PCIE_ARTPEC6 bool =20 diff --git a/drivers/pci/controller/dwc/Makefile b/drivers/pci/controller/d= wc/Makefile index 67ba59c02038..9e61458dff00 100644 --- a/drivers/pci/controller/dwc/Makefile +++ b/drivers/pci/controller/dwc/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_PCIE_DW_HOST) +=3D pcie-designware-host.o obj-$(CONFIG_PCIE_DW_EP) +=3D pcie-designware-ep.o obj-$(CONFIG_PCIE_DW_PLAT) +=3D pcie-designware-plat.o obj-$(CONFIG_PCIE_AMD_MDB) +=3D pcie-amd-mdb.o +obj-$(CONFIG_PCIE_ANDES_QILAI) +=3D pcie-andes-qilai.o obj-$(CONFIG_PCIE_BT1) +=3D pcie-bt1.o obj-$(CONFIG_PCI_DRA7XX) +=3D pci-dra7xx.o obj-$(CONFIG_PCI_EXYNOS) +=3D pci-exynos.o diff --git a/drivers/pci/controller/dwc/pcie-andes-qilai.c b/drivers/pci/co= ntroller/dwc/pcie-andes-qilai.c new file mode 100644 index 000000000000..bd1588be44e0 --- /dev/null +++ b/drivers/pci/controller/dwc/pcie-andes-qilai.c @@ -0,0 +1,197 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Driver for the PCIe Controller in QiLai from Andes + * + * Copyright (C) 2026 Andes Technology Corporation + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pcie-designware.h" + +#define PCIE_INTR_CONTROL1 0x15c +#define PCIE_MSI_CTRL_INT_EN BIT(28) + +#define PCIE_LOGIC_COHERENCY_CONTROL3 0x8e8 + +/* + * Refer to Table A4-5 (Memory type encoding) in the + * AMBA AXI and ACE Protocol Specification. + * + * The selected value corresponds to the Memory type field: + * "Write-back, Read and Write-allocate". + * + * The last three rows in the table A4-5 in + * AMBA AXI and ACE Protocol Specification: + * ARCACHE AWCACHE Memory type + * ------------------------------------------------------------------ + * 1111 (0111) 0111 Write-back Read-allocate + * 1011 1111 (1011) Write-back Write-allocate + * 1111 1111 Write-back Read and Write-allocate (selec= ted) + */ +#define IOCP_ARCACHE 0b1111 +#define IOCP_AWCACHE 0b1111 + +#define PCIE_CFG_MSTR_ARCACHE_MODE GENMASK(6, 3) +#define PCIE_CFG_MSTR_AWCACHE_MODE GENMASK(14, 11) +#define PCIE_CFG_MSTR_ARCACHE_VALUE GENMASK(22, 19) +#define PCIE_CFG_MSTR_AWCACHE_VALUE GENMASK(30, 27) + +#define PCIE_GEN_CONTROL2 0x54 +#define PCIE_CFG_LTSSM_EN BIT(0) + +#define PCIE_REGS_PCIE_SII_PM_STATE 0xc0 +#define SMLH_LINK_UP BIT(6) +#define RDLH_LINK_UP BIT(7) + +struct qilai_pcie { + struct dw_pcie pci; + void __iomem *apb_base; +}; + +#define to_qilai_pcie(_pci) container_of(_pci, struct qilai_pcie, pci) + +static bool qilai_pcie_link_up(struct dw_pcie *pci) +{ + struct qilai_pcie *pcie =3D to_qilai_pcie(pci); + u32 val; + + val =3D readl(pcie->apb_base + PCIE_REGS_PCIE_SII_PM_STATE); + + return FIELD_GET(SMLH_LINK_UP, val) && FIELD_GET(RDLH_LINK_UP, val); +} + +static int qilai_pcie_start_link(struct dw_pcie *pci) +{ + struct qilai_pcie *pcie =3D to_qilai_pcie(pci); + u32 val; + + val =3D readl(pcie->apb_base + PCIE_GEN_CONTROL2); + val |=3D PCIE_CFG_LTSSM_EN; + writel(val, pcie->apb_base + PCIE_GEN_CONTROL2); + + return 0; +} + +static const struct dw_pcie_ops qilai_pcie_ops =3D { + .link_up =3D qilai_pcie_link_up, + .start_link =3D qilai_pcie_start_link, +}; + +/* + * Set up the QiLai PCIe IOCP (IO Coherence Port) Read/Write Behaviors to = the + * Write-Back, Read and Write Allocate mode. + * + * The IOCP HW target is SoC last-level cache (L2 Cache), which serves as = the + * system cache. The IOCP HW helps maintain cache monitoring, ensuring that + * the device can snoop data from/to the cache. + */ +static void qilai_pcie_iocp_cache_setup(struct dw_pcie_rp *pp) +{ + struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); + u32 val; + + dw_pcie_dbi_ro_wr_en(pci); + + val =3D dw_pcie_readl_dbi(pci, PCIE_LOGIC_COHERENCY_CONTROL3); + FIELD_MODIFY(PCIE_CFG_MSTR_ARCACHE_MODE, &val, IOCP_ARCACHE); + FIELD_MODIFY(PCIE_CFG_MSTR_AWCACHE_MODE, &val, IOCP_AWCACHE); + FIELD_MODIFY(PCIE_CFG_MSTR_ARCACHE_VALUE, &val, IOCP_ARCACHE); + FIELD_MODIFY(PCIE_CFG_MSTR_AWCACHE_VALUE, &val, IOCP_AWCACHE); + dw_pcie_writel_dbi(pci, PCIE_LOGIC_COHERENCY_CONTROL3, val); + + dw_pcie_dbi_ro_wr_dis(pci); +} + +static void qilai_pcie_enable_msi(struct qilai_pcie *pcie) +{ + u32 val; + + val =3D readl(pcie->apb_base + PCIE_INTR_CONTROL1); + val |=3D PCIE_MSI_CTRL_INT_EN; + writel(val, pcie->apb_base + PCIE_INTR_CONTROL1); +} + +static int qilai_pcie_host_init(struct dw_pcie_rp *pp) +{ + struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); + struct qilai_pcie *pcie =3D to_qilai_pcie(pci); + + qilai_pcie_enable_msi(pcie); + + return 0; +} + +static void qilai_pcie_host_post_init(struct dw_pcie_rp *pp) +{ + qilai_pcie_iocp_cache_setup(pp); +} + +static const struct dw_pcie_host_ops qilai_pcie_host_ops =3D { + .init =3D qilai_pcie_host_init, + .post_init =3D qilai_pcie_host_post_init, +}; + +static int qilai_pcie_probe(struct platform_device *pdev) +{ + struct qilai_pcie *pcie; + struct dw_pcie *pci; + struct device *dev =3D &pdev->dev; + int ret; + + pcie =3D devm_kzalloc(&pdev->dev, sizeof(*pcie), GFP_KERNEL); + if (!pcie) + return -ENOMEM; + + platform_set_drvdata(pdev, pcie); + + pci =3D &pcie->pci; + pcie->pci.dev =3D dev; + pcie->pci.ops =3D &qilai_pcie_ops; + pcie->pci.pp.ops =3D &qilai_pcie_host_ops; + pci->use_parent_dt_ranges =3D true; + + dw_pcie_cap_set(&pcie->pci, REQ_RES); + + pcie->apb_base =3D devm_platform_ioremap_resource_byname(pdev, "apb"); + if (IS_ERR(pcie->apb_base)) + return PTR_ERR(pcie->apb_base); + + pm_runtime_set_active(dev); + pm_runtime_no_callbacks(dev); + devm_pm_runtime_enable(dev); + + ret =3D dw_pcie_host_init(&pcie->pci.pp); + if (ret) + return dev_err_probe(dev, ret, "Failed to initialize PCIe host\n"); + + return 0; +} + +static const struct of_device_id qilai_pcie_of_match[] =3D { + { .compatible =3D "andestech,qilai-pcie" }, + {}, +}; +MODULE_DEVICE_TABLE(of, qilai_pcie_of_match); + +static struct platform_driver qilai_pcie_driver =3D { + .probe =3D qilai_pcie_probe, + .driver =3D { + .name =3D "qilai-pcie", + .of_match_table =3D qilai_pcie_of_match, + .probe_type =3D PROBE_PREFER_ASYNCHRONOUS, + }, +}; + +builtin_platform_driver(qilai_pcie_driver); + +MODULE_AUTHOR("Randolph Lin "); +MODULE_DESCRIPTION("Andes QiLai PCIe driver"); +MODULE_LICENSE("GPL"); --=20 2.34.1 From nobody Wed Apr 1 22:19:12 2026 Received: from Atcsqr.andestech.com (unknown [60.248.187.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB1A93254AE; Wed, 25 Feb 2026 08:57:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.248.187.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772009822; cv=none; b=LUD7cFsR/1xd9b67fGHOmRSXBUunYH5gya8lhreDj/oVpB1VZFmqWsE2K6J9/VULGwNDm4wuuEZhEUAT2CtTkN/csaqBtumrikyes3Ygqfhu4xTV0Tryw3L+QRPhVgo2G/1aAE8VyZRFFUFYtnChshgc1cgxKr+7QRmkh5/1s/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772009822; c=relaxed/simple; bh=1BnSrFvydFUNEuCzk0fuUYpROalpDTdPuWt6oUAC7uw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q8ZTFWE42vmgB3vT4jHBkPzM8y2IykPq5lqQzcSaW2JEvCf1v10eTVDbNE+k5a1oCR97V3hDfymEXb7M7RQJ3qIhpoF6XBhWPmOlNS8FPP1Lq9GeAonFC9uw2xD8P4aRmHp4blu9XnaL9l+ITN+vOmqmrHSiOELfeGzwm3qy6eI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=permerror header.from=andestech.com; spf=pass smtp.mailfrom=andestech.com; arc=none smtp.client-ip=60.248.187.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=permerror header.from=andestech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=andestech.com Received: from mail.andestech.com (ATCPCS34.andestech.com [10.0.1.134]) by Atcsqr.andestech.com with ESMTP id 61P8tBd8077809; Wed, 25 Feb 2026 16:55:12 +0800 (+08) (envelope-from randolph@andestech.com) Received: from swlinux02.andestech.com (10.0.15.183) by ATCPCS34.andestech.com (10.0.1.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 25 Feb 2026 16:55:11 +0800 From: Randolph To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Randolph Lin Subject: [PATCH v11 4/4] MAINTAINERS: Add maintainers for Andes QiLai PCIe driver Date: Wed, 25 Feb 2026 16:55:04 +0800 Message-ID: <20260225085504.3757601-5-randolph@andestech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260225085504.3757601-1-randolph@andestech.com> References: <20260225085504.3757601-1-randolph@andestech.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 X-ClientProxiedBy: ATCPCS33.andestech.com (10.0.1.100) To ATCPCS34.andestech.com (10.0.1.134) X-DKIM-Results: atcpcs34.andestech.com; dkim=none; X-DNSRBL: X-SPAM-SOURCE-CHECK: pass X-MAIL: Atcsqr.andestech.com 61P8tBd8077809 Content-Type: text/plain; charset="utf-8" From: Randolph Lin Here add maintainer information for Andes QiLai PCIe driver. Signed-off-by: Randolph Lin --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 55af015174a5..02619b84e6ee 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20128,6 +20128,13 @@ S: Supported F: Documentation/devicetree/bindings/pci/altr,pcie-root-port.yaml F: drivers/pci/controller/pcie-altera.c =20 +PCI DRIVER FOR ANDES QILAI PCIE +M: Randolph Lin +L: linux-pci@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/pci/andestech,qilai-pcie.yaml +F: drivers/pci/controller/dwc/pcie-andes-qilai.c + PCI DRIVER FOR APPLIEDMICRO XGENE M: Toan Le L: linux-pci@vger.kernel.org --=20 2.34.1