From patchwork Wed Jan 15 07:06:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Wang X-Patchwork-Id: 13939924 X-Patchwork-Delegate: kw@linux.com Received: from mail-oo1-f43.google.com (mail-oo1-f43.google.com [209.85.161.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 A828C22E406; Wed, 15 Jan 2025 07:06:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736924809; cv=none; b=Vp7pcsLBVOaNAeBin5MMfuPOgf2H/KQK5uiixFgT66Y2eBXPPxZZMrUlmn0MpP9IaXwE2XrgjGqjl1zS+wkQ+uquVqJWN32x5+sM2KY2K4IMlxC/JLic+wWDrd8ZKmM4HZ/kRtj+CRSF0GNoYs6aSvPCezx2N2Z4uEtUg62IEYQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736924809; c=relaxed/simple; bh=kwMnNoWh9WbWQ6ib+RUMP650V9rwYjD2EYIvkhy7+dQ=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=s2tJO012orgpuFM5AJoa+IwE5JazLw2WyhYvEtEyYmB8EaMwRzhoLpcRVnN7gtzqwffn7YJl6N9n2T4GIUQOtapztRq/WEofZMu6H3cuyBIDtRNarJDiRM+WCxtNi8w41+PwFazscaSLPlDNDDT4StMMr+hoQ/S0pDBdDV9MmKQ= 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=jxhsAHBz; arc=none smtp.client-ip=209.85.161.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="jxhsAHBz" Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-5f321876499so327359eaf.1; Tue, 14 Jan 2025 23:06:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736924806; x=1737529606; 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=A6LsDSRxso3EvoawgFxcfFBhG8RtxCRF21ny5YM/h+8=; b=jxhsAHBzfN1qiWsEw+dbZa7pjNCKTt51N07tswoifVJornCnio0SiOfy3eGPl9M0Hq WQAStwVqxWQCq4vpoFt1W0AvjsreosM5ScpG1oXzw5yE6vhgiGCGoQbmD9zxwrcGVFD9 +yAVw1owOWIwxkViAXvMELweVGoTaQHflQWCsm9yvqyxO/WyZZe9HapEj4UfuOdKGgzF DVvx5UhChsajQHEvy4OomcHZbk2bzMix/iZBJs6NH87MOzKJTszAJZbUA3yy8H5P+kxI LTmn1BAWeqL3+fTzTCV8x9a30P8Zxx7k4RLEuK+xhk62Mki4iR7ss9blBLz0C/BOp8IT ZkEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736924806; x=1737529606; 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=A6LsDSRxso3EvoawgFxcfFBhG8RtxCRF21ny5YM/h+8=; b=JAYsll4KQbO/PwUbpq49vUggHGwO6TCXxJi5Hrvi0IDdxfhNaS6klAw/hHC1m4P/i9 uuKi8XpzsxsbEZGnNk/ZTLzXijT5kB6DX4VNz25w5hcXmOpgUsrnjsnfLLoe6eyVum19 l4mPPRe8JnV8R7p5hXCMKWtCRb9FFsPjabpHNdfuxLE1/fMx3WPh3WnH42zWkA2WkfBf jTYI2uks+CXmgKG0i+Q6D7E+YX68Nm53jgzwS1tp5jzRdcX4VNDWpQTG6WFR/bSL3pEy vylsTZV3zyiCDxZF5fDMcf7m8r0JflZCKYA79OR9fl1oWmiptKMDmZ7nYZuwL5hH8j1l XtYw== X-Forwarded-Encrypted: i=1; AJvYcCUr3C86Clu8gaElG3oOdFK6WIFjSQH5x3HqpMMz4PBLqg70jLNiHnoQL0mkuLXzS/5W9r0wrIOZAbwi@vger.kernel.org, AJvYcCVANAGWSCBjKT90FGGHGdMciLKBEweRWjTMJC6zU8YulZT5wP182yo/j8n5rgEldN5OshN/mqRWfq56@vger.kernel.org, AJvYcCWksKS8TuDOnWlmglk3XdHDrVIhXytKoPZoJl9oxOeSqcO7yPl1D2/YXGqrF7wA+YFaBflILTnTTS226Wi/@vger.kernel.org X-Gm-Message-State: AOJu0Yw/zrqmcb9td0Acm6HeWKHSYXPtVA3HkKUoWMGAloUMYNjvqxFA 9KH6qgV58rgV1sT+xI8uc2ioO/4g0kNoFcncM5qrcBEH0VHLrkjx X-Gm-Gg: ASbGncviWEYCHWALq1ZkgwIeM8WQaKZf99B9n/BgLBxUZcm7Ve7xV5Y368WGULC+EGC 0isSa5WT/TzmvuMLDIFuAgdSk9h2C0X3vTl36FFG+N7UC1hbGM3Xv0a1tybSCPc+cCce6DshiYx meNHGuepS/OHseQnWI/fLb9tnYNyComAbXcbcE77piwQ5lT/ngKGIe538VTx8EC24u12vVDkwQ+ BVrZGGfatLi520SpdfLEdgk/kwuHGNtsZCyQJrAcxLZBi4Odg/aNYVLDw+544FCkoE= X-Google-Smtp-Source: AGHT+IG1BnRm1bURx9ei4lbPam8um8KU2KsMP9ifZa/V7dvLXRAArhlchv75sptxdIonaHl6GhtQiA== X-Received: by 2002:a4a:d682:0:b0:5f3:3d75:7d8f with SMTP id 006d021491bc7-5f8fa888b40mr1218310eaf.2.1736924806485; Tue, 14 Jan 2025 23:06:46 -0800 (PST) Received: from localhost.localdomain ([122.8.183.87]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-723185383e7sm5428507a34.11.2025.01.14.23.06.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:06:45 -0800 (PST) From: Chen Wang To: kw@linux.com, u.kleine-koenig@baylibre.com, aou@eecs.berkeley.edu, arnd@arndb.de, bhelgaas@google.com, unicorn_wang@outlook.com, conor+dt@kernel.org, guoren@kernel.org, inochiama@outlook.com, krzk+dt@kernel.org, lee@kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, palmer@dabbelt.com, paul.walmsley@sifive.com, pbrobinson@gmail.com, robh@kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org, chao.wei@sophgo.com, xiaoguang.xing@sophgo.com, fengchun.li@sophgo.com, helgaas@kernel.org Subject: [PATCH v3 1/5] dt-bindings: pci: Add Sophgo SG2042 PCIe host Date: Wed, 15 Jan 2025 15:06:37 +0800 Message-Id: <5a784afde48c44b5a8f376f02c5f30ccff8a3312.1736923025.git.unicorn_wang@outlook.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chen Wang Add binding for Sophgo SG2042 PCIe host controller. Signed-off-by: Chen Wang --- .../bindings/pci/sophgo,sg2042-pcie-host.yaml | 147 ++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2042-pcie-host.yaml diff --git a/Documentation/devicetree/bindings/pci/sophgo,sg2042-pcie-host.yaml b/Documentation/devicetree/bindings/pci/sophgo,sg2042-pcie-host.yaml new file mode 100644 index 000000000000..f98e71822144 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/sophgo,sg2042-pcie-host.yaml @@ -0,0 +1,147 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/sophgo,sg2042-pcie-host.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Sophgo SG2042 PCIe Host (Cadence PCIe Wrapper) + +description: + Sophgo SG2042 PCIe host controller is based on the Cadence PCIe core. + +maintainers: + - Chen Wang + +properties: + compatible: + const: sophgo,sg2042-pcie-host + + reg: + maxItems: 2 + + reg-names: + items: + - const: reg + - const: cfg + + vendor-id: + const: 0x1f1c + + device-id: + const: 0x2042 + + msi: + type: object + $ref: /schemas/interrupt-controller/msi-controller.yaml# + unevaluatedProperties: false + + properties: + compatible: + items: + - const: sophgo,sg2042-pcie-msi + + interrupts: + maxItems: 1 + + interrupt-names: + const: msi + + msi-parent: true + + sophgo,link-id: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + SG2042 uses Cadence IP, every IP is composed of 2 cores (called link0 + & link1 as Cadence's term). Each core corresponds to a host bridge, + and each host bridge has only one root port. Their configuration + registers are completely independent. SG2042 integrates two Cadence IPs, + so there can actually be up to four host bridges. "sophgo,link-id" is + used to identify which core/link the PCIe host bridge node corresponds to. + + The Cadence IP has two modes of operation, selected by a strap pin. + + In the single-link mode, the Cadence PCIe core instance associated + with Link0 is connected to all the lanes and the Cadence PCIe core + instance associated with Link1 is inactive. + + In the dual-link mode, the Cadence PCIe core instance associated + with Link0 is connected to the lower half of the lanes and the + Cadence PCIe core instance associated with Link1 is connected to + the upper half of the lanes. + + SG2042 contains 2 Cadence IPs and configures the Cores as below: + + +-- Core (Link0) <---> pcie_rc0 +-----------------+ + | | | + Cadence IP 1 --+ | cdns_pcie0_ctrl | + | | | + +-- Core (Link1) <---> disabled +-----------------+ + + +-- Core (Link0) <---> pcie_rc1 +-----------------+ + | | | + Cadence IP 2 --+ | cdns_pcie1_ctrl | + | | | + +-- Core (Link1) <---> pcie_rc2 +-----------------+ + + pcie_rcX is PCIe node ("sophgo,sg2042-pcie-host") defined in DTS. + + Sophgo defines some new register files to add support for their MSI + controller inside PCIe. These new register files are defined in DTS as + syscon node ("sophgo,sg2042-pcie-ctrl"), i.e. "cdns_pcie0_ctrl" / + "cdns_pcie1_ctrl". cdns_pcieX_ctrl contains some registers shared by + pcie_rcX, even two RC (Link)s may share different bits of the same + register. For example, cdns_pcie1_ctrl contains registers shared by + link0 & link1 for Cadence IP 2. + + "sophgo,link-id" is defined to distinguish the two RC's in one Cadence IP, + so we can know what registers (bits) we should use. + + sophgo,syscon-pcie-ctrl: + $ref: /schemas/types.yaml#/definitions/phandle + description: + Phandle to the PCIe System Controller DT node. It's required to + access some MSI operation registers shared by PCIe RCs. + +allOf: + - $ref: cdns-pcie-host.yaml# + +required: + - compatible + - reg + - reg-names + - vendor-id + - device-id + - sophgo,link-id + - sophgo,syscon-pcie-ctrl + +unevaluatedProperties: false + +examples: + - | + #include + + pcie@62000000 { + compatible = "sophgo,sg2042-pcie-host"; + device_type = "pci"; + reg = <0x62000000 0x00800000>, + <0x48000000 0x00001000>; + reg-names = "reg", "cfg"; + #address-cells = <3>; + #size-cells = <2>; + ranges = <0x81000000 0 0x00000000 0xde000000 0 0x00010000>, + <0x82000000 0 0xd0400000 0xd0400000 0 0x0d000000>; + bus-range = <0x00 0xff>; + vendor-id = <0x1f1c>; + device-id = <0x2042>; + cdns,no-bar-match-nbits = <48>; + sophgo,link-id = <0>; + sophgo,syscon-pcie-ctrl = <&cdns_pcie1_ctrl>; + msi-parent = <&msi_pcie>; + msi_pcie: msi { + compatible = "sophgo,sg2042-pcie-msi"; + msi-controller; + interrupt-parent = <&intc>; + interrupts = <123 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "msi"; + }; + }; From patchwork Wed Jan 15 07:06:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Wang X-Patchwork-Id: 13939925 X-Patchwork-Delegate: kw@linux.com Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.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 A52091BEF9E; Wed, 15 Jan 2025 07:07:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736924829; cv=none; b=EkirXYgoqaJIw/K2C5PAkZng5MCaaybmBTzJbkTcgBgHcqvNT/dgt6zpETtx/PIWCLeeNPQH7DDWZExkVN8OIlJEeIu1D7gG3SkgBXRTILPg+rs+kdddV5EVM1OWIIa6WAU0EzloV0XLF2O4+/W/v/UtFycgkywiQHmpkStJFHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736924829; c=relaxed/simple; bh=gF/M0n0QNPR53j6burAtsSWpReBGRHG1J0tkSyad8dM=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OCHuU0VAdsmlsLgKe+QqiLDwqbotX8bAQyZ81ekM9oab47FXhqiqBdPXVjvgpL7puDkG/LmktbdV7PE3jAp67KWYMv2wEbt6H+by9gyYNR84DOeHJKII6hq4gT6sIF8Oo+iQckWdAA/B2xfq9xuzz/qMqML+okJgKr2W3bdtqHw= 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=D4we7FB4; arc=none smtp.client-ip=209.85.161.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="D4we7FB4" Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5f4cc48ab37so1835018eaf.1; Tue, 14 Jan 2025 23:07:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736924826; x=1737529626; 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=abobXy0SXY71oXKljRUVM/MN4IZYip5SxUDW7tMtbSU=; b=D4we7FB4c5EA0SXgdojkkGE05nRImyrOxpzMALP8QyGLkLjvGbPrvNuUeSnUgY8Mco zN6gx0FNsImrTqlnwtItNowMJUcTZ72IMmdSkRHQlvRUwDznmVuBHiOdTjhmO3eo7gMM Rx7/plusy22Zt/wcpQvc2uYlb0jlCz9AXgiYLOPfLhTRV5YQ1B3ur4FWrMCRcTb3sEBn JEFZqrG2FDFT/3QFqINo1P5Ik5c0EvESq84afvfHD315mrgUPKiVeZddkTW8AkWnzn4n y78sqO56CKsXeC5kf339quhQ1aFWrGJtYforI5E55Wb88FmpkhlLNwoDvSbGOhNKhg1a O8zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736924826; x=1737529626; 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=abobXy0SXY71oXKljRUVM/MN4IZYip5SxUDW7tMtbSU=; b=ZeqPw2otJj7y3A2lCsRrlaoPanPLDDmx6V8XSDr0P8rSM0PMdDk1d6+hGSVfBp0ogZ +fxeTg7BcMZNXqLiHgZN9Hi28NRJ3cqqWL+gob45fmRfiIzuewFFItawppeX9/VYMPQm cSZhcej2+jsPdfOcjPK3TM9KmCq/i5Hq7oSOn1uR7LkKGSWBXNbtBzZ8NeVPKwu2Qhz0 sP2WYtOQlA7oqrP+HQJk5tUNyLJzw2pww0Hl9pV0Fs00Pq1HmiJ5mKzUp7aWrUPKaXZI rz4Mdttl4Nm0TC8CaigJOVwY3dvfEneJADUJ4AWmeNc4+I7YWoct0BIXeakMpVqS238i H4ig== X-Forwarded-Encrypted: i=1; AJvYcCVjrLeNNem04mY46024ud+klNHpxRMAgdmGlVZGPA6GGWRI45THVmCWcgWF8cubvNuY5pTnwldRCHJlIE8i@vger.kernel.org, AJvYcCX29alJaho+xWk+6P5BdHY2/uujbDnYYuJZxEqmLYbOQamvzDy6CIdXcuejZiDUe8LYntZ2dyzLCrhp@vger.kernel.org, AJvYcCXhfJJ5E/t9B7/zqIwrbBQMYaVsn2PwVKFjRAzA//PbhRszG1DGjK2SphuD97MdzXBXAQN998vBiraR@vger.kernel.org X-Gm-Message-State: AOJu0Yx2JY43vcAMXe5OFtfAifjLQULYIGHw+Ug0va5veuahGsfByORp 9S9HS6X2s/HnEpL1ehHcoTGDqDwr2gV7SqUa4+IvyGodq8SuCqQU X-Gm-Gg: ASbGnctKopBtgFm19PcYh/d5kaUtBhUF0kCAmzNE/iJ2VzlOlxJ3BsjQylcXV8l2P+l q8Kh6P0hNKnMFnrM/eFiRW0XX431emmcZxj9HPgJe6Hd+pmISyRTUUVnAWApIAnvPjsWwoyNsFY vsrfwpagsYvogLgTwHiD98v5kKv6+TVTh8FD1TDLDbKualasjTxUiufnio/zyvUPN1AeuE900xD H80ikz5BcZ+NgFO5zsL1ZyIHR+LVAf55GPzke9ZnSGDp6JSpOhQhHZD3JfsSu2cY3M= X-Google-Smtp-Source: AGHT+IGvjn4v1+QVeijX68j9UlTXjSg+4mSDzzJHyrs4Sxhtm8AkRzw+g+ojXPw3T9jDHtbkdIFdrw== X-Received: by 2002:a4a:a503:0:b0:5f7:30bf:dc61 with SMTP id 006d021491bc7-5f730bfe0b6mr11797499eaf.5.1736924826321; Tue, 14 Jan 2025 23:07:06 -0800 (PST) Received: from localhost.localdomain ([122.8.183.87]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7231861bf71sm5382880a34.52.2025.01.14.23.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:07:05 -0800 (PST) From: Chen Wang To: kw@linux.com, u.kleine-koenig@baylibre.com, aou@eecs.berkeley.edu, arnd@arndb.de, bhelgaas@google.com, unicorn_wang@outlook.com, conor+dt@kernel.org, guoren@kernel.org, inochiama@outlook.com, krzk+dt@kernel.org, lee@kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, palmer@dabbelt.com, paul.walmsley@sifive.com, pbrobinson@gmail.com, robh@kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org, chao.wei@sophgo.com, xiaoguang.xing@sophgo.com, fengchun.li@sophgo.com, helgaas@kernel.org Subject: [PATCH v3 2/5] PCI: sg2042: Add Sophgo SG2042 PCIe driver Date: Wed, 15 Jan 2025 15:06:57 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chen Wang Add support for PCIe controller in SG2042 SoC. The controller uses the Cadence PCIe core programmed by pcie-cadence*.c. The PCIe controller will work in host mode only. Signed-off-by: Chen Wang --- drivers/pci/controller/cadence/Kconfig | 13 + drivers/pci/controller/cadence/Makefile | 1 + drivers/pci/controller/cadence/pcie-sg2042.c | 528 +++++++++++++++++++ 3 files changed, 542 insertions(+) create mode 100644 drivers/pci/controller/cadence/pcie-sg2042.c diff --git a/drivers/pci/controller/cadence/Kconfig b/drivers/pci/controller/cadence/Kconfig index 8a0044bb3989..292eb2b20e9c 100644 --- a/drivers/pci/controller/cadence/Kconfig +++ b/drivers/pci/controller/cadence/Kconfig @@ -42,6 +42,18 @@ config PCIE_CADENCE_PLAT_EP endpoint mode. This PCIe controller may be embedded into many different vendors SoCs. +config PCIE_SG2042 + bool "Sophgo SG2042 PCIe controller (host mode)" + depends on ARCH_SOPHGO || COMPILE_TEST + depends on OF + select IRQ_MSI_LIB + select PCI_MSI + select PCIE_CADENCE_HOST + help + Say Y here if you want to support the Sophgo SG2042 PCIe platform + controller in host mode. Sophgo SG2042 PCIe controller uses Cadence + PCIe core. + config PCI_J721E bool @@ -67,4 +79,5 @@ config PCI_J721E_EP Say Y here if you want to support the TI J721E PCIe platform controller in endpoint mode. TI J721E PCIe controller uses Cadence PCIe core. + endmenu diff --git a/drivers/pci/controller/cadence/Makefile b/drivers/pci/controller/cadence/Makefile index 9bac5fb2f13d..4df4456d9539 100644 --- a/drivers/pci/controller/cadence/Makefile +++ b/drivers/pci/controller/cadence/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_PCIE_CADENCE_HOST) += pcie-cadence-host.o obj-$(CONFIG_PCIE_CADENCE_EP) += pcie-cadence-ep.o obj-$(CONFIG_PCIE_CADENCE_PLAT) += pcie-cadence-plat.o obj-$(CONFIG_PCI_J721E) += pci-j721e.o +obj-$(CONFIG_PCIE_SG2042) += pcie-sg2042.o diff --git a/drivers/pci/controller/cadence/pcie-sg2042.c b/drivers/pci/controller/cadence/pcie-sg2042.c new file mode 100644 index 000000000000..56797c2af755 --- /dev/null +++ b/drivers/pci/controller/cadence/pcie-sg2042.c @@ -0,0 +1,528 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * pcie-sg2042 - PCIe controller driver for Sophgo SG2042 SoC + * + * Copyright (C) 2024 Sophgo Technology Inc. + * Copyright (C) 2024 Chen Wang + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../../irqchip/irq-msi-lib.h" + +#include "pcie-cadence.h" + +/* + * SG2042 PCIe controller supports two ways to report MSI: + * + * - Method A, the PCIe controller implements an MSI interrupt controller + * inside, and connect to PLIC upward through one interrupt line. + * Provides memory-mapped MSI address, and by programming the upper 32 + * bits of the address to zero, it can be compatible with old PCIe devices + * that only support 32-bit MSI address. + * + * - Method B, the PCIe controller connects to PLIC upward through an + * independent MSI controller "sophgo,sg2042-msi" on the SOC. The MSI + * controller provides multiple(up to 32) interrupt sources to PLIC. + * Compared with the first method, the advantage is that the interrupt + * source is expanded, but because for SG2042, the MSI address provided by + * the MSI controller is fixed and only supports 64-bit address(> 2^32), + * it is not compatible with old PCIe devices that only support 32-bit MSI + * address. + * + * Method A & B can be configured in DTS, default is Method B. + */ + +#define MAX_MSI_IRQS 8 +#define MAX_MSI_IRQS_PER_CTRL 1 +#define MAX_MSI_CTRLS (MAX_MSI_IRQS / MAX_MSI_IRQS_PER_CTRL) +#define MSI_DEF_NUM_VECTORS MAX_MSI_IRQS +#define BYTE_NUM_PER_MSI_VEC 4 + +#define REG_CLEAR 0x0804 +#define REG_STATUS 0x0810 +#define REG_LINK0_MSI_ADDR_SIZE 0x085C +#define REG_LINK1_MSI_ADDR_SIZE 0x080C +#define REG_LINK0_MSI_ADDR_LOW 0x0860 +#define REG_LINK0_MSI_ADDR_HIGH 0x0864 +#define REG_LINK1_MSI_ADDR_LOW 0x0868 +#define REG_LINK1_MSI_ADDR_HIGH 0x086C + +#define REG_CLEAR_LINK0_BIT 2 +#define REG_CLEAR_LINK1_BIT 3 +#define REG_STATUS_LINK0_BIT 2 +#define REG_STATUS_LINK1_BIT 3 + +#define REG_LINK0_MSI_ADDR_SIZE_MASK GENMASK(15, 0) +#define REG_LINK1_MSI_ADDR_SIZE_MASK GENMASK(31, 16) + +struct sg2042_pcie { + struct cdns_pcie *cdns_pcie; + + struct regmap *syscon; + + u32 link_id; + + struct irq_domain *msi_domain; + + int msi_irq; + + dma_addr_t msi_phys; + void *msi_virt; + + u32 num_applied_vecs; /* used to speed up ISR */ + + raw_spinlock_t msi_lock; + DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS); +}; + +static void sg2042_pcie_msi_clear_status(struct sg2042_pcie *pcie) +{ + u32 status, clr_msi_in_bit; + + if (pcie->link_id == 1) + clr_msi_in_bit = BIT(REG_CLEAR_LINK1_BIT); + else + clr_msi_in_bit = BIT(REG_CLEAR_LINK0_BIT); + + regmap_read(pcie->syscon, REG_CLEAR, &status); + status |= clr_msi_in_bit; + regmap_write(pcie->syscon, REG_CLEAR, status); + + /* need write 0 to reset, hardware can not reset automatically */ + status &= ~clr_msi_in_bit; + regmap_write(pcie->syscon, REG_CLEAR, status); +} + +static int sg2042_pcie_msi_irq_set_affinity(struct irq_data *d, + const struct cpumask *mask, + bool force) +{ + if (d->parent_data) + return irq_chip_set_affinity_parent(d, mask, force); + + return -EINVAL; +} + +static void sg2042_pcie_msi_irq_compose_msi_msg(struct irq_data *d, + struct msi_msg *msg) +{ + struct sg2042_pcie *pcie = irq_data_get_irq_chip_data(d); + struct device *dev = pcie->cdns_pcie->dev; + + msg->address_lo = lower_32_bits(pcie->msi_phys) + BYTE_NUM_PER_MSI_VEC * d->hwirq; + msg->address_hi = upper_32_bits(pcie->msi_phys); + msg->data = 1; + + if (d->hwirq > pcie->num_applied_vecs) + pcie->num_applied_vecs = d->hwirq; + + dev_dbg(dev, "compose MSI msg hwirq[%ld] address_hi[%#x] address_lo[%#x]\n", + d->hwirq, msg->address_hi, msg->address_lo); +} + +static void sg2042_pcie_msi_irq_ack(struct irq_data *d) +{ + struct sg2042_pcie *pcie = irq_data_get_irq_chip_data(d); + + sg2042_pcie_msi_clear_status(pcie); +} + +static struct irq_chip sg2042_pcie_msi_bottom_chip = { + .name = "SG2042 PCIe PLIC-MSI translator", + .irq_ack = sg2042_pcie_msi_irq_ack, + .irq_compose_msi_msg = sg2042_pcie_msi_irq_compose_msi_msg, + .irq_set_affinity = sg2042_pcie_msi_irq_set_affinity, +}; + +static int sg2042_pcie_irq_domain_alloc(struct irq_domain *domain, + unsigned int virq, unsigned int nr_irqs, + void *args) +{ + struct sg2042_pcie *pcie = domain->host_data; + unsigned long flags; + u32 i; + int bit; + + raw_spin_lock_irqsave(&pcie->msi_lock, flags); + + bit = bitmap_find_free_region(pcie->msi_irq_in_use, MSI_DEF_NUM_VECTORS, + order_base_2(nr_irqs)); + + raw_spin_unlock_irqrestore(&pcie->msi_lock, flags); + + if (bit < 0) + return -ENOSPC; + + for (i = 0; i < nr_irqs; i++) + irq_domain_set_info(domain, virq + i, bit + i, + &sg2042_pcie_msi_bottom_chip, + pcie, handle_edge_irq, + NULL, NULL); + + return 0; +} + +static void sg2042_pcie_irq_domain_free(struct irq_domain *domain, + unsigned int virq, unsigned int nr_irqs) +{ + struct irq_data *d = irq_domain_get_irq_data(domain, virq); + struct sg2042_pcie *pcie = irq_data_get_irq_chip_data(d); + unsigned long flags; + + raw_spin_lock_irqsave(&pcie->msi_lock, flags); + + bitmap_release_region(pcie->msi_irq_in_use, d->hwirq, + order_base_2(nr_irqs)); + + raw_spin_unlock_irqrestore(&pcie->msi_lock, flags); +} + +static const struct irq_domain_ops sg2042_pcie_msi_domain_ops = { + .alloc = sg2042_pcie_irq_domain_alloc, + .free = sg2042_pcie_irq_domain_free, +}; + +static int sg2042_pcie_init_msi_data(struct sg2042_pcie *pcie) +{ + struct device *dev = pcie->cdns_pcie->dev; + u32 value; + int ret; + + raw_spin_lock_init(&pcie->msi_lock); + + /* + * Though the PCIe controller can address >32-bit address space, to + * facilitate endpoints that support only 32-bit MSI target address, + * the mask is set to 32-bit to make sure that MSI target address is + * always a 32-bit address + */ + ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); + if (ret < 0) + return ret; + + pcie->msi_virt = dma_alloc_coherent(dev, BYTE_NUM_PER_MSI_VEC * MAX_MSI_IRQS, + &pcie->msi_phys, GFP_KERNEL); + if (!pcie->msi_virt) + return -ENOMEM; + + /* Program the MSI address and size */ + if (pcie->link_id == 1) { + regmap_write(pcie->syscon, REG_LINK1_MSI_ADDR_LOW, + lower_32_bits(pcie->msi_phys)); + regmap_write(pcie->syscon, REG_LINK1_MSI_ADDR_HIGH, + upper_32_bits(pcie->msi_phys)); + + regmap_read(pcie->syscon, REG_LINK1_MSI_ADDR_SIZE, &value); + value = (value & REG_LINK1_MSI_ADDR_SIZE_MASK) | MAX_MSI_IRQS; + regmap_write(pcie->syscon, REG_LINK1_MSI_ADDR_SIZE, value); + } else { + regmap_write(pcie->syscon, REG_LINK0_MSI_ADDR_LOW, + lower_32_bits(pcie->msi_phys)); + regmap_write(pcie->syscon, REG_LINK0_MSI_ADDR_HIGH, + upper_32_bits(pcie->msi_phys)); + + regmap_read(pcie->syscon, REG_LINK0_MSI_ADDR_SIZE, &value); + value = (value & REG_LINK0_MSI_ADDR_SIZE_MASK) | (MAX_MSI_IRQS << 16); + regmap_write(pcie->syscon, REG_LINK0_MSI_ADDR_SIZE, value); + } + + return 0; +} + +static irqreturn_t sg2042_pcie_msi_handle_irq(struct sg2042_pcie *pcie) +{ + u32 i, pos; + unsigned long val; + u32 status, num_vectors; + irqreturn_t ret = IRQ_NONE; + + num_vectors = pcie->num_applied_vecs; + for (i = 0; i <= num_vectors; i++) { + status = readl((void *)(pcie->msi_virt + i * BYTE_NUM_PER_MSI_VEC)); + if (!status) + continue; + + ret = IRQ_HANDLED; + val = status; + pos = 0; + while ((pos = find_next_bit(&val, MAX_MSI_IRQS_PER_CTRL, + pos)) != MAX_MSI_IRQS_PER_CTRL) { + generic_handle_domain_irq(pcie->msi_domain, + (i * MAX_MSI_IRQS_PER_CTRL) + + pos); + pos++; + } + writel(0, ((void *)(pcie->msi_virt) + i * BYTE_NUM_PER_MSI_VEC)); + } + return ret; +} + +static void sg2042_pcie_msi_chained_isr(struct irq_desc *desc) +{ + struct irq_chip *chip = irq_desc_get_chip(desc); + u32 status, st_msi_in_bit; + struct sg2042_pcie *pcie; + + chained_irq_enter(chip, desc); + + pcie = irq_desc_get_handler_data(desc); + if (pcie->link_id == 1) + st_msi_in_bit = REG_STATUS_LINK1_BIT; + else + st_msi_in_bit = REG_STATUS_LINK0_BIT; + + regmap_read(pcie->syscon, REG_STATUS, &status); + if ((status >> st_msi_in_bit) & 0x1) { + sg2042_pcie_msi_clear_status(pcie); + + sg2042_pcie_msi_handle_irq(pcie); + } + + chained_irq_exit(chip, desc); +} + +#define SG2042_PCIE_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \ + MSI_FLAG_USE_DEF_CHIP_OPS) + +#define SG2042_PCIE_MSI_FLAGS_SUPPORTED MSI_GENERIC_FLAGS_MASK + +static struct msi_parent_ops sg2042_pcie_msi_parent_ops = { + .required_flags = SG2042_PCIE_MSI_FLAGS_REQUIRED, + .supported_flags = SG2042_PCIE_MSI_FLAGS_SUPPORTED, + .bus_select_mask = MATCH_PCI_MSI, + .bus_select_token = DOMAIN_BUS_NEXUS, + .prefix = "SG2042-", + .init_dev_msi_info = msi_lib_init_dev_msi_info, +}; + +static int sg2042_pcie_setup_msi(struct sg2042_pcie *pcie, + struct device_node *msi_node) +{ + struct device *dev = pcie->cdns_pcie->dev; + struct fwnode_handle *fwnode = of_node_to_fwnode(dev->of_node); + struct irq_domain *parent_domain; + int ret = 0; + + if (!of_property_read_bool(msi_node, "msi-controller")) + return -ENODEV; + + ret = of_irq_get_byname(msi_node, "msi"); + if (ret <= 0) { + dev_err(dev, "%pOF: failed to get MSI irq\n", msi_node); + return ret; + } + pcie->msi_irq = ret; + + irq_set_chained_handler_and_data(pcie->msi_irq, + sg2042_pcie_msi_chained_isr, pcie); + + parent_domain = irq_domain_create_linear(fwnode, MSI_DEF_NUM_VECTORS, + &sg2042_pcie_msi_domain_ops, pcie); + if (!parent_domain) { + dev_err(dev, "%pfw: Failed to create IRQ domain\n", fwnode); + return -ENOMEM; + } + irq_domain_update_bus_token(parent_domain, DOMAIN_BUS_NEXUS); + + parent_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; + parent_domain->msi_parent_ops = &sg2042_pcie_msi_parent_ops; + + pcie->msi_domain = parent_domain; + + ret = sg2042_pcie_init_msi_data(pcie); + if (ret) { + dev_err(dev, "Failed to initialize MSI data!\n"); + return ret; + } + + return 0; +} + +static void sg2042_pcie_free_msi(struct sg2042_pcie *pcie) +{ + struct device *dev = pcie->cdns_pcie->dev; + + if (pcie->msi_irq) + irq_set_chained_handler_and_data(pcie->msi_irq, NULL, NULL); + + if (pcie->msi_virt) + dma_free_coherent(dev, BYTE_NUM_PER_MSI_VEC * MAX_MSI_IRQS, + pcie->msi_virt, pcie->msi_phys); +} + +/* + * SG2042 only support 4-byte aligned access, so for the rootbus (i.e. to read + * the Root Port itself, read32 is required. For non-rootbus (i.e. to read + * the PCIe peripheral registers, supports 1/2/4 byte aligned access, so + * directly using read should be fine. + * + * The same is true for write. + */ +static int sg2042_pcie_config_read(struct pci_bus *bus, unsigned int devfn, + int where, int size, u32 *value) +{ + if (pci_is_root_bus(bus)) + return pci_generic_config_read32(bus, devfn, where, size, + value); + + return pci_generic_config_read(bus, devfn, where, size, value); +} + +static int sg2042_pcie_config_write(struct pci_bus *bus, unsigned int devfn, + int where, int size, u32 value) +{ + if (pci_is_root_bus(bus)) + return pci_generic_config_write32(bus, devfn, where, size, + value); + + return pci_generic_config_write(bus, devfn, where, size, value); +} + +static struct pci_ops sg2042_pcie_host_ops = { + .map_bus = cdns_pci_map_bus, + .read = sg2042_pcie_config_read, + .write = sg2042_pcie_config_write, +}; + +/* Dummy ops which will be assigned to cdns_pcie.ops, which must be !NULL. */ +static const struct cdns_pcie_ops sg2042_cdns_pcie_ops = {}; + +static int sg2042_pcie_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct pci_host_bridge *bridge; + struct device_node *np_syscon; + struct device_node *msi_node; + struct cdns_pcie *cdns_pcie; + struct sg2042_pcie *pcie; + struct cdns_pcie_rc *rc; + struct regmap *syscon; + int ret; + + pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); + if (!pcie) + return -ENOMEM; + + bridge = devm_pci_alloc_host_bridge(dev, sizeof(*rc)); + if (!bridge) { + dev_err(dev, "Failed to alloc host bridge!\n"); + return -ENOMEM; + } + + bridge->ops = &sg2042_pcie_host_ops; + + rc = pci_host_bridge_priv(bridge); + cdns_pcie = &rc->pcie; + cdns_pcie->dev = dev; + cdns_pcie->ops = &sg2042_cdns_pcie_ops; + pcie->cdns_pcie = cdns_pcie; + + np_syscon = of_parse_phandle(np, "sophgo,syscon-pcie-ctrl", 0); + if (!np_syscon) { + dev_err(dev, "Failed to get syscon node\n"); + return -ENOMEM; + } + syscon = syscon_node_to_regmap(np_syscon); + if (IS_ERR(syscon)) { + dev_err(dev, "Failed to get regmap for syscon\n"); + return -ENOMEM; + } + pcie->syscon = syscon; + + if (of_property_read_u32(np, "sophgo,link-id", &pcie->link_id)) { + dev_err(dev, "Unable to parse sophgo,link-id\n"); + return -EINVAL; + } + + platform_set_drvdata(pdev, pcie); + + pm_runtime_enable(dev); + + ret = pm_runtime_get_sync(dev); + if (ret < 0) { + dev_err(dev, "pm_runtime_get_sync failed\n"); + goto err_get_sync; + } + + msi_node = of_parse_phandle(dev->of_node, "msi-parent", 0); + if (!msi_node) { + dev_err(dev, "Failed to get msi-parent!\n"); + return -1; + } + + if (of_device_is_compatible(msi_node, "sophgo,sg2042-pcie-msi")) { + ret = sg2042_pcie_setup_msi(pcie, msi_node); + if (ret < 0) + goto err_setup_msi; + } + + ret = cdns_pcie_init_phy(dev, cdns_pcie); + if (ret) { + dev_err(dev, "Failed to init phy!\n"); + goto err_setup_msi; + } + + ret = cdns_pcie_host_setup(rc); + if (ret < 0) { + dev_err(dev, "Failed to setup host!\n"); + goto err_host_setup; + } + + return 0; + +err_host_setup: + cdns_pcie_disable_phy(cdns_pcie); + +err_setup_msi: + sg2042_pcie_free_msi(pcie); + +err_get_sync: + pm_runtime_put(dev); + pm_runtime_disable(dev); + + return ret; +} + +static void sg2042_pcie_shutdown(struct platform_device *pdev) +{ + struct sg2042_pcie *pcie = platform_get_drvdata(pdev); + struct cdns_pcie *cdns_pcie = pcie->cdns_pcie; + struct device *dev = &pdev->dev; + + sg2042_pcie_free_msi(pcie); + + cdns_pcie_disable_phy(cdns_pcie); + + pm_runtime_put(dev); + pm_runtime_disable(dev); +} + +static const struct of_device_id sg2042_pcie_of_match[] = { + { .compatible = "sophgo,sg2042-pcie-host" }, + {}, +}; + +static struct platform_driver sg2042_pcie_driver = { + .driver = { + .name = "sg2042-pcie", + .of_match_table = sg2042_pcie_of_match, + .pm = &cdns_pcie_pm_ops, + }, + .probe = sg2042_pcie_probe, + .shutdown = sg2042_pcie_shutdown, +}; +builtin_platform_driver(sg2042_pcie_driver); From patchwork Wed Jan 15 07:07:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Wang X-Patchwork-Id: 13939926 X-Patchwork-Delegate: kw@linux.com Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (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 4E3071BEF9E; Wed, 15 Jan 2025 07:07:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736924846; cv=none; b=dZEwswHr9JIoho79HL/GHXfgXsbvLrbD/dHDxzyO3yDhuTiYtmNCl1i9T0GYVUiTiOJNa+BsM2WkC9YrAlkcsnCDJd9XmVakmTTZP1rF+oxe+SEOHxAeZcW9CHxMCPGnIygqwRBo/Z0cnFzMKoWGA8xTjRIserlWMpu/Y5vWeBw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736924846; c=relaxed/simple; bh=XTuQq9QFoztAZFck9lS8cUE2dpg3yJxM/NZEEUI5JPc=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uq6+UnV8AqKrE+XH2hADLD47nUUP0Ub4b71U1/FVCeGiGCenbWashdRrVLXSGo8lyddyFMY2vYxL8PSLKF+lXwDLHpzzIHC+j/0YYpzdgn+dP5Aq9dAfLLdD7MT4a5ZBeG8nbJ4KU2U+mhe3X2lPafQhNgQolewGOJFt9gOmzNA= 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=gZ7r0sXV; arc=none smtp.client-ip=209.85.210.50 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="gZ7r0sXV" Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-71fbb0d035dso3544967a34.2; Tue, 14 Jan 2025 23:07:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736924844; x=1737529644; 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=DlFqZHbRMZQIsl21pBG7gtzE+yobsjoVl3cax1/kql0=; b=gZ7r0sXV/lguvpWLk1rTTEw6yU+nLsfUTxdRmFwcr8XijnGVYLLfkRCf2eQoIEDnso Nbk+vmYZp7aiTDBvDyJwEH5WVs5y8+LDjs8QtL/X+YCBifcedZSHA1Aj1ICjOqEVjn7Z inKYom+idrBWaTkaHXT7LsXrxnO8kaqT8G+XnYNt4IChWq3ple8gAHBvT3MBp4WxuK29 2TjBXWNfqTF+udA8cOILbIe/GCOaJ6EA51j13TV1sgCOLfMWjyw6gfuuwCo/TBy2IIvS hkPrNvLfcVVB8vZoZhlzX8l7sJp9sx4WXZxwV2JfArtYmlgX1P+GVT0a/hgC8wRWtxQo IeUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736924844; x=1737529644; 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=DlFqZHbRMZQIsl21pBG7gtzE+yobsjoVl3cax1/kql0=; b=BfeT4b7nRdiYhrlgRCPWXiI02iyvjiTEpYuQDzh1mGAX/kXmG701woRh0BPg0rOuYS 2DJytYFyFU/Z7QaPV+J3wKq/lIG5bGitBTlK3udJiXfPJ4E2UNOx5JO90+2k6v6pd/m5 Bgqcrhs/M6ET3RcIcv9b7TmowJRO4F+RdgVTwphmyXbk6bGtKkuzRz6gcTbpeUpIG1BF MziOW9MqsdQmRA8YijUxOX/OhogE44HOWsscUst5R49TLj0MKKh7jxahr2GUzcFFlnQ8 V21oVt1/Iw+yO7eH9wqQ7iXi6ZDi5wLZx4cXGjdq3B3pKhoCIovRYwxg6qeDOGaCaT63 60kg== X-Forwarded-Encrypted: i=1; AJvYcCVMruDuTYr1xK9E/0ilP9SlZnu+VIm8R/rJd0mk1VJBVexLGFuRaXAdrHFUpaLjSn7rRsi9B8Z1MjIq@vger.kernel.org, AJvYcCWW/mbi1i2Mt+omJiWmFWeOpygatsl33BDvmE5XKhYDJ+3wvoWUCrgyB/JIMXGca8el2PX3QoqCRdcjxqf1@vger.kernel.org, AJvYcCXWKCoZJ3V64P/SYei0l9cAL0H47bwXmTwAAvBONuUkE+Fy5A6dH8IisfLj0O37gr5/KJFxNCF06zrm@vger.kernel.org X-Gm-Message-State: AOJu0YwErOEtsbnWgr74XY1ABzYWXQgzfDuPc30KcfYSDKEeOXyEgndk 7bP1ekX0phx9vEP2QLoMEhrIbM4KvxS0xqh3/huYdev+AJsGfpgV X-Gm-Gg: ASbGncvW+8VYdx4vP8u2r36cRsLl+ViJjUBmvGmCKXsD1Kb8u5xRN/tzu9D/HiAiUOn NYz957jPb72UWVVdk/pfzbKbi5iCwQKIQoy5CCBVg7ULJbiUIjaC30vrllh/P7JqealOQcFDzpx MkTLPMqXI1+Q4d5ZnopEMw4PTwVrBSmd9wCPq2MFYNhVrZoeCVHWc5t/+qaL9/bxs5JB3RRnoyn 3QJAbG9yq/urQVdR7v3bcIUTVneqb7sD0AdZcDXgTDxKMop2PmzhKSDMWgo1ac2zzo= X-Google-Smtp-Source: AGHT+IH2zwPcOIBs8+fceXZ8ucN4/6KD5TvWigTV1j9AmgF5uoZNytOQGOluCGEdhsiy5ijULWUSuw== X-Received: by 2002:a05:6871:6507:b0:29e:63b3:8e2b with SMTP id 586e51a60fabf-2aa069b19e7mr15263626fac.37.1736924844191; Tue, 14 Jan 2025 23:07:24 -0800 (PST) Received: from localhost.localdomain ([122.8.183.87]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2ad80599052sm5992749fac.24.2025.01.14.23.07.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:07:23 -0800 (PST) From: Chen Wang To: kw@linux.com, u.kleine-koenig@baylibre.com, aou@eecs.berkeley.edu, arnd@arndb.de, bhelgaas@google.com, unicorn_wang@outlook.com, conor+dt@kernel.org, guoren@kernel.org, inochiama@outlook.com, krzk+dt@kernel.org, lee@kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, palmer@dabbelt.com, paul.walmsley@sifive.com, pbrobinson@gmail.com, robh@kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org, chao.wei@sophgo.com, xiaoguang.xing@sophgo.com, fengchun.li@sophgo.com, helgaas@kernel.org Subject: [PATCH v3 3/5] dt-bindings: mfd: syscon: Add sg2042 pcie ctrl compatible Date: Wed, 15 Jan 2025 15:07:14 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chen Wang Document SOPHGO SG2042 compatible for PCIe control registers. These registers are shared by PCIe controller nodes. Signed-off-by: Chen Wang Acked-by: Rob Herring (Arm) --- Documentation/devicetree/bindings/mfd/syscon.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/syscon.yaml b/Documentation/devicetree/bindings/mfd/syscon.yaml index b414de4fa779..afd89aa0ae8b 100644 --- a/Documentation/devicetree/bindings/mfd/syscon.yaml +++ b/Documentation/devicetree/bindings/mfd/syscon.yaml @@ -107,6 +107,7 @@ select: - rockchip,rk3576-qos - rockchip,rk3588-qos - rockchip,rv1126-qos + - sophgo,sg2042-pcie-ctrl - st,spear1340-misc - stericsson,nomadik-pmu - starfive,jh7100-sysmain @@ -205,6 +206,7 @@ properties: - rockchip,rk3576-qos - rockchip,rk3588-qos - rockchip,rv1126-qos + - sophgo,sg2042-pcie-ctrl - st,spear1340-misc - stericsson,nomadik-pmu - starfive,jh7100-sysmain From patchwork Wed Jan 15 07:07:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Wang X-Patchwork-Id: 13939927 X-Patchwork-Delegate: kw@linux.com Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.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 65F8C22F392; Wed, 15 Jan 2025 07:07:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736924864; cv=none; b=DCk2TT8S8a4fZWe/SFu/cyuCb9pYFDgNCBF6/fE9Xlw2i61ROEydXhAY567blef0v2H3ASvHqnf3WNopmncZ0udAHlOSxs8Qimfg0xzTgh7+Eh+LY9f3H1+HfAzC3H/WscZ/ws27cJwnmWNHawy0Wts6GShXJ5JEUpkUa8clRuM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736924864; c=relaxed/simple; bh=SlB0hnEn9u8stsy2BoPMV79lOHeHUA1/Xlh3UU238Tk=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ha0o+drNCCBArdMDEjZCEq8HEij3o8Ed1yk2KC0DQ6XA4jgHpsRWesSpmBAlYV2K2cOhydvJV3RIIqx+yo0N77kCDSjJgMB2ssXEbF+bNIqxpPK7RRtou0NSnF4mP9XHO8vXCVDk075uiuj7NE6F7vfCr3A4veb/m5aXH1ei0E8= 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=VWUlc4Lp; arc=none smtp.client-ip=209.85.210.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="VWUlc4Lp" Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-71e2a32297dso321420a34.0; Tue, 14 Jan 2025 23:07:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736924861; x=1737529661; 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=V0fASG0X/uQZD/W9OMmNQn0p1YDVNMMVIY7/O8Icnnw=; b=VWUlc4Lp7G5kuIMB8GfzRM5HNStuEzrYYwuKpmHRhXlKxw6TCpR0aLvdyFUsudVf7h L/oBbGZrYdGJy0TgM8mP9Qz77TMbAXAEOhQU0dPkT2v+7FLAcV681Br7Dp4IiKh8YtMx LahAwFPdptmIWkE/ZF4k+JeY0AU0RNlwX7Mz0Y8WWKGjhszIv6GC8/rBPgcvp2fORNA9 QyMywN48002NWiv4bQdDiG5QP9sdLE0pO2um3p9+01ejMqeoMMo6SIQKQjsWPxvZEZvf z52oA+978YSKFMvhppUH1jt/JxBvijYscosMh61ORV4RnWHsqQovxrcu/PG618ymbaXk ROqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736924861; x=1737529661; 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=V0fASG0X/uQZD/W9OMmNQn0p1YDVNMMVIY7/O8Icnnw=; b=KAw51PB5QqUATs3vZitqJj4gDv+TMBS8ncVJmi6vqTIVy9jtpNdWSjKW0DNL8EWT1m ui1XEwBO/1YBQ18HT8SE3cxXpaI5dOqQ6FuMuPIHvSt2CZjs9lCwUt0nkgog71AyWIyQ nKj+IWLOlPTGq3v/BoC+6fGFJ+Ke3kObcI/EbcsgPIVOpLIbGebIhOXT6/kgFBWQonuw XzNpCXD0sUrqmB3eqVHhQJlPcNMXF35IY8jOZMMu2ABa0CrjWRj+ZZC4/qQEseK4MsdE UnIkv2BVHPhHf0XfNZBDNGOn2Os8QPVxRQL0SE7Y4ILpcZUpkKWKSnIL9LpO5WGzpKWW WsPw== X-Forwarded-Encrypted: i=1; AJvYcCUBhdnpugdLGw2TKsZfVJOdmTAxtEi5uXeAB6dy3Ff99hWovmfo58+jlf5TGu0XjSzz0CtuoN1nSSviqqsJ@vger.kernel.org, AJvYcCWVpktOWvOH4omU7Ok2Jo1Xcnk+YeV6HV85TdvivtGyIhMyr8vhuWwqPyeQt+Ql9lrCyQPcmVWnrH+O@vger.kernel.org, AJvYcCXYDdLcyBB/qTMVTMo2yNcFF5YEKpqDIweUuEENpTSlkl2VOCNzpoC0/tRMzS6b07usPLZZ5YTco+zn@vger.kernel.org X-Gm-Message-State: AOJu0YxnrcPRyWdS46GYFLqusxqJSqhUDRHCqZ+iTxJ+2ls0lbMyG0eg h1GcZmNoLAsRpaUrNW9cquZiGFNDN00MkbLDaxWe0lx79xFD3Acu X-Gm-Gg: ASbGncvYklTCSMJerXXZhjOf7GsE8V/QLoosnE9cr7Fi/BK/03czXOT38x+ParCRBDR ywQGEc7dOhNSQUKgSijVL+IB7OA7zi5YYfTqkja0EJcDTRHdlXnQOpijlGdfygpIP8C2OxX0rZ0 azFmaaeWIkiwK5ec/++eEJo2tre4y45zOJvVjyRBNItQrzas6yn5ATON1zjB2xbNNpJiGtkg54F JxwRLGhwJ13pd9q+mkE8lTzfqr0g/egRmp9yfWNnqxzRBmBeZdta/ji2sMjWbY5fdk= X-Google-Smtp-Source: AGHT+IH3l04BzTwOQOVeVceAZhDLzmEf3VzEspec1E1UGUxl7qEL3KQJ4fTf/YoGkK/x9urtKw3yFw== X-Received: by 2002:a05:6830:6882:b0:71d:f7d8:225 with SMTP id 46e09a7af769-7248594ac72mr939861a34.12.1736924861369; Tue, 14 Jan 2025 23:07:41 -0800 (PST) Received: from localhost.localdomain ([122.8.183.87]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-723185481b1sm5445257a34.22.2025.01.14.23.07.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:07:40 -0800 (PST) From: Chen Wang To: kw@linux.com, u.kleine-koenig@baylibre.com, aou@eecs.berkeley.edu, arnd@arndb.de, bhelgaas@google.com, unicorn_wang@outlook.com, conor+dt@kernel.org, guoren@kernel.org, inochiama@outlook.com, krzk+dt@kernel.org, lee@kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, palmer@dabbelt.com, paul.walmsley@sifive.com, pbrobinson@gmail.com, robh@kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org, chao.wei@sophgo.com, xiaoguang.xing@sophgo.com, fengchun.li@sophgo.com, helgaas@kernel.org Subject: [PATCH v3 4/5] riscv: sophgo: dts: add pcie controllers for SG2042 Date: Wed, 15 Jan 2025 15:07:32 +0800 Message-Id: <4a1f23e5426bfb56cad9c07f90d4efaad5eab976.1736923025.git.unicorn_wang@outlook.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chen Wang Add PCIe controller nodes in DTS for Sophgo SG2042. Default they are disabled. Signed-off-by: Chen Wang --- arch/riscv/boot/dts/sophgo/sg2042.dtsi | 89 ++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/arch/riscv/boot/dts/sophgo/sg2042.dtsi b/arch/riscv/boot/dts/sophgo/sg2042.dtsi index 02fbb978973c..3db46bfa1a06 100644 --- a/arch/riscv/boot/dts/sophgo/sg2042.dtsi +++ b/arch/riscv/boot/dts/sophgo/sg2042.dtsi @@ -205,6 +205,95 @@ clkgen: clock-controller@7030012000 { #clock-cells = <1>; }; + pcie_rc0: pcie@7060000000 { + compatible = "sophgo,sg2042-pcie-host"; + device_type = "pci"; + reg = <0x70 0x60000000 0x0 0x02000000>, + <0x40 0x00000000 0x0 0x00001000>; + reg-names = "reg", "cfg"; + linux,pci-domain = <0>; + #address-cells = <3>; + #size-cells = <2>; + ranges = <0x01000000 0x0 0xc0000000 0x40 0xc0000000 0x0 0x00400000>, + <0x42000000 0x0 0xd0000000 0x40 0xd0000000 0x0 0x10000000>, + <0x02000000 0x0 0xe0000000 0x40 0xe0000000 0x0 0x20000000>, + <0x43000000 0x42 0x00000000 0x42 0x00000000 0x2 0x00000000>, + <0x03000000 0x41 0x00000000 0x41 0x00000000 0x1 0x00000000>; + bus-range = <0x0 0xff>; + vendor-id = <0x1f1c>; + device-id = <0x2042>; + cdns,no-bar-match-nbits = <48>; + sophgo,link-id = <0>; + sophgo,syscon-pcie-ctrl = <&cdns_pcie0_ctrl>; + msi-parent = <&msi>; + status = "disabled"; + }; + + cdns_pcie0_ctrl: syscon@7061800000 { + compatible = "sophgo,sg2042-pcie-ctrl", "syscon"; + reg = <0x70 0x61800000 0x0 0x800000>; + }; + + pcie_rc1: pcie@7062000000 { + compatible = "sophgo,sg2042-pcie-host"; + device_type = "pci"; + reg = <0x70 0x62000000 0x0 0x00800000>, + <0x48 0x00000000 0x0 0x00001000>; + reg-names = "reg", "cfg"; + linux,pci-domain = <1>; + #address-cells = <3>; + #size-cells = <2>; + ranges = <0x01000000 0x0 0xc0800000 0x48 0xc0800000 0x0 0x00400000>, + <0x42000000 0x0 0xd0000000 0x48 0xd0000000 0x0 0x10000000>, + <0x02000000 0x0 0xe0000000 0x48 0xe0000000 0x0 0x20000000>, + <0x03000000 0x49 0x00000000 0x49 0x00000000 0x1 0x00000000>, + <0x43000000 0x4a 0x00000000 0x4a 0x00000000 0x2 0x00000000>; + bus-range = <0x0 0xff>; + vendor-id = <0x1f1c>; + device-id = <0x2042>; + cdns,no-bar-match-nbits = <48>; + sophgo,link-id = <0>; + sophgo,syscon-pcie-ctrl = <&cdns_pcie1_ctrl>; + msi-parent = <&msi_pcie>; + status = "disabled"; + msi_pcie: msi { + compatible = "sophgo,sg2042-pcie-msi"; + msi-controller; + interrupt-parent = <&intc>; + interrupts = <123 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "msi"; + }; + }; + + pcie_rc2: pcie@7062800000 { + compatible = "sophgo,sg2042-pcie-host"; + device_type = "pci"; + reg = <0x70 0x62800000 0x0 0x00800000>, + <0x4c 0x00000000 0x0 0x00001000>; + reg-names = "reg", "cfg"; + linux,pci-domain = <2>; + #address-cells = <3>; + #size-cells = <2>; + ranges = <0x01000000 0x0 0xc0c00000 0x4c 0xc0c00000 0x0 0x00400000>, + <0x42000000 0x0 0xf8000000 0x4c 0xf8000000 0x0 0x04000000>, + <0x02000000 0x0 0xfc000000 0x4c 0xfc000000 0x0 0x04000000>, + <0x43000000 0x4e 0x00000000 0x4e 0x00000000 0x2 0x00000000>, + <0x03000000 0x4d 0x00000000 0x4d 0x00000000 0x1 0x00000000>; + bus-range = <0x0 0xff>; + vendor-id = <0x1f1c>; + device-id = <0x2042>; + cdns,no-bar-match-nbits = <48>; + sophgo,link-id = <1>; + sophgo,syscon-pcie-ctrl = <&cdns_pcie1_ctrl>; + msi-parent = <&msi>; + status = "disabled"; + }; + + cdns_pcie1_ctrl: syscon@7063800000 { + compatible = "sophgo,sg2042-pcie-ctrl", "syscon"; + reg = <0x70 0x63800000 0x0 0x800000>; + }; + clint_mswi: interrupt-controller@7094000000 { compatible = "sophgo,sg2042-aclint-mswi", "thead,c900-aclint-mswi"; reg = <0x00000070 0x94000000 0x00000000 0x00004000>; From patchwork Wed Jan 15 07:07:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Wang X-Patchwork-Id: 13939928 X-Patchwork-Delegate: kw@linux.com Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.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 2679622E406; Wed, 15 Jan 2025 07:08:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736924882; cv=none; b=Ri64iRzitwO4K6gZ+tag56FaHyVVPKm/MJ8Fx3InmayJT+p9Tk5r1pP9F6eoDXR7hj56qH/hYhv8QIQOT2KGxZwqyVdvrP3MvMcDtx4sgzofUt0RI+ytbUCCN4oW7nAUnh8jRE2cEL+Q78Imqzysm0bBr/SLoO5MZZxaBXj/jTc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736924882; c=relaxed/simple; bh=3Y0qnShoAPTndhTD1AZiRjsbhyrdHNiZJdUViFf5U9Q=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=H2e6wHwprPq1jYRLjS+i2QV2dB20QVFpghZfgTwXZyou1rgEpKDqt7ROeSyYhFr9RKbZ6Xp7quSEKhYJd+caTVhiFIrvfOLCAaWn8bFAM+mDHM61/DbwU03+WwqjnwScbabv3og9QBu0kqy4I4P9dyZJSzH2wYhq/b9Qj9g361E= 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=amgsQF67; arc=none smtp.client-ip=209.85.210.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="amgsQF67" Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-71e3167b90dso3521625a34.0; Tue, 14 Jan 2025 23:08:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736924880; x=1737529680; 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=Sywd5ibf/76z5+rkZ7ijeWmGFF2MBuEBBfOcYOD/r6A=; b=amgsQF67BSJz3dEkGm+n4qxWddupfEQNg6KGhu9URXDnDTd6bmenXrWDM/x+N9WYvk BGSNQa22IDvh92La4DjSOWuRn9EvNnGC8emMOkVbRiHf3AutdtKFeMafdm0l9RRpjF41 e4EpvsKrMn5DBhpxev44h2nkFcWdQ1UxQ2MI6iI2J7/Dz2XudjVarnBmrxxuNlmBsMHq IdKSOj/Q8XK1ZsXzLfPvL7kU5U9miRMr5ZWchiBRlYbUrFeGMaq3SDF8rzxlkkZxI3jZ YMaFReVMgsjS2RloXrA+IUarnxhI6wVdw0/LnmNxDq8h/NR5+nIcthZtaeIckcMBIAdH GvjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736924880; x=1737529680; 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=Sywd5ibf/76z5+rkZ7ijeWmGFF2MBuEBBfOcYOD/r6A=; b=agpv7ZiuCAq75TQV/gIGhZR9qEm8/yAIalxbBe2JOHbJTGzfcqU0i1L2eP+ApyZyQH NLMo+yL8d1hWfqLtdh0WVGOTXVdwmwe30QX8u/PWNDk4NMzFdbse2TABsweIi/4vQaAt ttdKhB61aHgKFYIwj03HJv4eAi/LlzJyADhHXI9KBDZVEBzDMV1X17IQMdH3OylRahB2 7sADa7AygTlg5qsvXmpNUvqfhh/KwAyjh81sYz7ZUHyBnGhGGet8J6tECWHRDdN0AvCe ddL5fgEcXkk3PIRzdgick+AsIBCZgNn4zal7bbqHxvW/U18m1/tLxhCZNTgSsc29WNdc FzmQ== X-Forwarded-Encrypted: i=1; AJvYcCVkZhbipjmA4OE0JPdFgkjgfStuBjiNe24U9M1V3/SO1cjZ7psQBKM7A50FIgQe1nfcEJLgQZLPdosu+NNb@vger.kernel.org, AJvYcCXjvyWFmvHwWeIrC3vO9Hn7BCORqRUG2Z3AZYhy0+i0oqvH1PWRYty+W1UhA0AGxVhICcoE2GDeXH7g@vger.kernel.org, AJvYcCXqe3jBkYk0WDraZd3qXuW4M4wd6YPnPYfqlN7c7Nk7RH1as/faselRUwxnlkZ6Sdyl7vUcLz0sLEeB@vger.kernel.org X-Gm-Message-State: AOJu0YwMgbfXxavDTlDYdnLKxOUdgieDy88l4LueFldaNSImNaoc+bPF xiiSfOsyiAHDW9LB8PycRo+1SLL3MY4pMrzRAiD3kMpu7HbRxvhp X-Gm-Gg: ASbGncv7Gz2tSj3DZ3az2XvYzaKvdsi4MoQrztho5tBHO7GUnbkceTK8ghmbNRRDatt wBVGcHmh3btyqvTmyXsTqc9Ir3mkTkx3bzmYN+3RARyvf9zSs+XSdtcrN13DAwRdOL9zc44wihl h5293sdhGOr5hNWmKd5mFNEk15HOV+jwGvSEIAYjxyNNHqg/Gyc3ZLYKiunoUr7qYdhL4c63tcK 5IxPfUOKgqjHkprsJ6srVaWM7UEYhPviyDllz8m5K5ZMCFY0Dsh37XdsF1b0n2KNNE= X-Google-Smtp-Source: AGHT+IGnl0S3Vd8pXkdIN3HJE5SIE22G/XRqd7+QGJZecFn/BIUmK5lpK0e90tA5t6cvwvK4WGpw4g== X-Received: by 2002:a05:6830:670f:b0:71d:6543:e83f with SMTP id 46e09a7af769-721e2e2e8f8mr16534130a34.11.1736924880145; Tue, 14 Jan 2025 23:08:00 -0800 (PST) Received: from localhost.localdomain ([122.8.183.87]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-72318538401sm5407820a34.7.2025.01.14.23.07.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 23:07:59 -0800 (PST) From: Chen Wang To: kw@linux.com, u.kleine-koenig@baylibre.com, aou@eecs.berkeley.edu, arnd@arndb.de, bhelgaas@google.com, unicorn_wang@outlook.com, conor+dt@kernel.org, guoren@kernel.org, inochiama@outlook.com, krzk+dt@kernel.org, lee@kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, palmer@dabbelt.com, paul.walmsley@sifive.com, pbrobinson@gmail.com, robh@kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org, chao.wei@sophgo.com, xiaoguang.xing@sophgo.com, fengchun.li@sophgo.com, helgaas@kernel.org Subject: [PATCH v3 5/5] riscv: sophgo: dts: enable pcie for PioneerBox Date: Wed, 15 Jan 2025 15:07:50 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chen Wang Enable pcie controllers for PioneerBox, which uses SG2042 SoC. Signed-off-by: Chen Wang --- arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts b/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts index be596d01ff8d..e63445cc7d18 100644 --- a/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts +++ b/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts @@ -60,6 +60,18 @@ mcu: syscon@17 { }; }; +&pcie_rc0 { + status = "okay"; +}; + +&pcie_rc1 { + status = "okay"; +}; + +&pcie_rc2 { + status = "okay"; +}; + &sd { bus-width = <4>; no-sdio;