Skip to content

feat: add SG2042 support for 6.16 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 43 commits into
base: aosc/v6.16
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
fe522e2
UPSTREAM: riscv: dts: sophgo: Add xtheadvector to the sg2042 devicetree
RevySR Jul 5, 2025
7b1d795
UPSTREAM: riscv: dts: sophgo: add ziccrse for sg2042
RevySR Jul 5, 2025
45978ea
UPSTREAM: riscv: dts: sophgo: add zfh for sg2042
RevySR Jul 5, 2025
86c84c8
UPSTREAM: dt-bindings: net: sophgo,sg2044-dwmac: Add support for Soph…
inochisa Jul 8, 2025
b4ae2b4
UPSTREAM: net: stmmac: dwmac-sophgo: Add support for Sophgo SG2042 SoC
inochisa Jul 8, 2025
4ffe5aa
UPSTREAM: net: stmmac: platform: Add snps,dwmac-5.00a IP compatible s…
inochisa Jul 8, 2025
1818c78
UPSTREAM: riscv: dts: sophgo: add ethernet GMAC device for sg2042
inochisa Jul 8, 2025
1ccc57d
UPSTREAM: dt-bindings: soc: sophgo: Move SoCs/boards from riscv into …
sverdlin Jun 12, 2025
4ed2afe
UPSTREAM: dt-bindings: riscv: add Sophgo SG2042_EVB_V1.X/V2.0 bindings
RevySR Jul 5, 2025
e25e26b
UPSTREAM: riscv: dts: sophgo: add Sophgo SG2042_EVB_V1.X board device…
RevySR Jul 5, 2025
6e2f9da
UPSTREAM: riscv: dts: sophgo: add Sophgo SG2042_EVB_V2.0 board device…
RevySR Jul 5, 2025
93e6a25
UPSTREAM: spi: dt-bindings: spi-sg2044-nor: Change SOPHGO SG2042
sycamoremoon Jul 20, 2025
0447b10
UPSTREAM: spi: spi-sg2044-nor: Add configurable chip_info
sycamoremoon Jul 20, 2025
744728e
UPSTREAM: spi: spi-sg2044-nor: Add SPI-NOR controller for SG2042
sycamoremoon Jul 20, 2025
f99c86e
FROMLIST: riscv: mmap(): use unsigned offset type in riscv_sys_mmap
Jul 7, 2025
4f67506
FROMLIST: riscv: Move vendor errata definitions to new header
guoren83 Jul 13, 2025
90438d5
FROMLIST: riscv: errata: Add ERRATA_THEAD_WRITE_ONCE fixup
guoren83 Jul 13, 2025
10c8963
FROMLIST: riscv: dts: sophgo: Add SPI NOR node for SG2042
sycamoremoon Jul 20, 2025
b28b4a5
FROMLIST: dt-bindings: pci: Add Sophgo SG2042 PCIe host
unicornx Jun 4, 2025
7d5270a
FROMLIST: PCI: sg2042: Add Sophgo SG2042 PCIe driver
unicornx Jun 4, 2025
3056386
FROMLIST: dt-bindings: mfd: syscon: Add sg2042 pcie ctrl compatible
unicornx Jun 4, 2025
a8188f5
FROMLIST: riscv: sophgo: dts: add pcie controllers for SG2042
unicornx Jun 4, 2025
054f1e3
FROMLIST: riscv: sophgo: dts: enable pcie for PioneerBox
unicornx Jun 4, 2025
169584a
FROMLIST: riscv: introduce ioremap_wc()
cuiyunhui Jul 22, 2025
c0c7540
FROMLIST: drm/ttm: add pgprot handling for RISC-V
Icenowy Jul 22, 2025
8fc1922
FROMLIST: irqchip/sifive-plic: Respect mask state when setting affinity
inochisa Aug 11, 2025
972f90f
FROMLIST: genirq: Add irq_chip_(startup/shutdown)_parent
inochisa Aug 7, 2025
b37a8d3
FROMLIST: PCI/MSI: Add startup/shutdown support for per device MSI[X]…
inochisa Aug 7, 2025
5c4b7ea
FROMLIST: irqchip/sg2042-msi: Fix broken affinity setting
inochisa Aug 7, 2025
19311a3
FROMLIST: irqchip/sg2042-msi: Set MSI_FLAG_MULTI_PCI_MSI flags for SG…
inochisa Aug 7, 2025
2654183
FROMLIST: PCI: hide mysterious 8MB 64-bit pref BAR on Intel Arc PCIe …
Icenowy Jul 21, 2025
cc58680
REVYOS: pcie: sg2042: pcie_rc1 use msi as msi-parent
RevySR Jun 4, 2025
049c245
REVYOS: dts: sophgo: sg2042: move pcie domain config into board devic…
inochisa Jun 4, 2025
6a9f863
REVYOS: dts: sophgo: sg2042: add pcie port for sg2042 EVB V1.X/V2.0
inochisa Jun 4, 2025
b8e426a
REVYOS: riscv: dts: sophgo: enable pcie_rc for Sophgo SG2042_EVB_V1.X
RevySR Jun 4, 2025
435d4b0
REVYOS: riscv: dts: sophgo: enable pcie_rc for Sophgo SG2042_EVB_V2.0
RevySR Jun 4, 2025
f8c9816
REVYOS: riscv: dts: sophgo: Enable SPI NOR node for SG2042_EVB_V1/V2
RevySR Jun 4, 2025
ec2982e
RISCV64: REVYOS: dts: sophgo: sg2042: sync old kernel numa-id
RevySR Jun 4, 2025
02f891e
RISCV64: SG2042: HACK: pcie: sg2042: add PCIE_SG2042_HACK option
RevySR Jun 4, 2025
f5c174f
RISCV64: SG2042: HACK: ttm: disallow cached mapping
Icenowy Jun 4, 2025
b511f49
RISCV64: SG2042: HACK: radeon: force 64-bit msi to fit top intc
Icenowy Jun 4, 2025
88df99d
RISCV64: SG2042: HACK: nvidia hda: force msi
Icenowy Jun 4, 2025
b248cba
RISCV64: SG2042: HACK: disable Warning firmware error detected FWSM: …
unicornx Jun 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/mfd/syscon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ select:
- rockchip,rk3576-qos
- rockchip,rk3588-qos
- rockchip,rv1126-qos
- sophgo,sg2042-pcie-ctrl
- st,spear1340-misc
- stericsson,nomadik-pmu
- starfive,jh7100-sysmain
Expand Down Expand Up @@ -222,6 +223,7 @@ properties:
- rockchip,rk3576-qos
- rockchip,rk3588-qos
- rockchip,rv1126-qos
- sophgo,sg2042-pcie-ctrl
- st,spear1340-misc
- stericsson,nomadik-pmu
- starfive,jh7100-sysmain
Expand Down
4 changes: 4 additions & 0 deletions Documentation/devicetree/bindings/net/snps,dwmac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ select:
- snps,dwmac-4.00
- snps,dwmac-4.10a
- snps,dwmac-4.20a
- snps,dwmac-5.00a
- snps,dwmac-5.10a
- snps,dwmac-5.20
- snps,dwmac-5.30a
Expand Down Expand Up @@ -98,11 +99,13 @@ properties:
- snps,dwmac-4.00
- snps,dwmac-4.10a
- snps,dwmac-4.20a
- snps,dwmac-5.00a
- snps,dwmac-5.10a
- snps,dwmac-5.20
- snps,dwmac-5.30a
- snps,dwxgmac
- snps,dwxgmac-2.10
- sophgo,sg2042-dwmac
- sophgo,sg2044-dwmac
- starfive,jh7100-dwmac
- starfive,jh7110-dwmac
Expand Down Expand Up @@ -641,6 +644,7 @@ allOf:
- snps,dwmac-4.00
- snps,dwmac-4.10a
- snps,dwmac-4.20a
- snps,dwmac-5.00a
- snps,dwmac-5.10a
- snps,dwmac-5.20
- snps,dwmac-5.30a
Expand Down
11 changes: 8 additions & 3 deletions Documentation/devicetree/bindings/net/sophgo,sg2044-dwmac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ select:
contains:
enum:
- sophgo,sg2044-dwmac
- sophgo,sg2042-dwmac
required:
- compatible

properties:
compatible:
items:
- const: sophgo,sg2044-dwmac
- const: snps,dwmac-5.30a
oneOf:
- items:
- const: sophgo,sg2042-dwmac
- const: snps,dwmac-5.00a
- items:
- const: sophgo,sg2044-dwmac
- const: snps,dwmac-5.30a

reg:
maxItems: 1
Expand Down
147 changes: 147 additions & 0 deletions Documentation/devicetree/bindings/pci/sophgo,sg2042-pcie-host.yaml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>

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 <dt-bindings/interrupt-controller/irq.h>

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";
};
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/riscv/sophgo.yaml#
$id: http://devicetree.org/schemas/soc/sophgo/sophgo.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Sophgo SoC-based boards
Expand All @@ -26,6 +26,11 @@ properties:
- enum:
- sophgo,huashan-pi
- const: sophgo,cv1812h
- items:
- enum:
- milkv,duo-module-01-evb
- const: milkv,duo-module-01
- const: sophgo,sg2000
- items:
- enum:
- sipeed,licheerv-nano-b
Expand All @@ -34,6 +39,8 @@ properties:
- items:
- enum:
- milkv,pioneer
- sophgo,sg2042-evb-v1
- sophgo,sg2042-evb-v2
- const: sophgo,sg2042
- items:
- enum:
Expand Down
9 changes: 3 additions & 6 deletions Documentation/devicetree/bindings/spi/spi-sg2044-nor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ allOf:

properties:
compatible:
oneOf:
- const: sophgo,sg2044-spifmc-nor
- items:
- enum:
- sophgo,sg2042-spifmc-nor
- const: sophgo,sg2044-spifmc-nor
enum:
- sophgo,sg2042-spifmc-nor
- sophgo,sg2044-spifmc-nor

reg:
maxItems: 1
Expand Down
17 changes: 17 additions & 0 deletions arch/riscv/Kconfig.errata
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,21 @@ config ERRATA_THEAD_GHOSTWRITE

If you don't know what to do here, say "Y".

config ERRATA_THEAD_WRITE_ONCE
bool "Apply T-Head WRITE_ONCE errata"
depends on ERRATA_THEAD
default y
help
The early version of T-Head C9xx cores of sg2042 & th1520 have a store
merge buffer delay problem. The store merge buffer could improve the
store queue performance by merging multi-store requests, but when there
are no continued store requests, the prior single store request would be
waiting in the store queue for a long time. That would cause signifi-
cant problems for communication between multi-cores. Appending a
fence w.o could immediately flush the store merge buffer and let other
cores see the write result.

This will apply the WRITE_ONCE errata to handle the non-standard beh-
avior via appending a fence w.o instruction for WRITE_ONCE().

endmenu # "CPU errata selection"
2 changes: 2 additions & 0 deletions arch/riscv/boot/dts/sophgo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ dtb-$(CONFIG_ARCH_SOPHGO) += cv1800b-milkv-duo.dtb
dtb-$(CONFIG_ARCH_SOPHGO) += cv1812h-huashan-pi.dtb
dtb-$(CONFIG_ARCH_SOPHGO) += sg2002-licheerv-nano-b.dtb
dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-milkv-pioneer.dtb
dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-evb-v1.dtb
dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-evb-v2.dtb
dtb-$(CONFIG_ARCH_SOPHGO) += sg2044-sophgo-srd3-10.dtb
Loading