Add StarFive JH7110 PCIe drvier support
PATCH v8 3/4 configs: starfive-jh7110: Add support for PCIe host driver
In reply to Minda ChenFrom: Mason Huo <[email protected]>
Add PCIe host driver and nvme driver in configure file.
--- configs/starfive_visionfive2_defconfig | 7 +++++++ 1 file changed, 7 insertions(+)
configs/starfive_visionfive2_defconfig +7 -0
@@ -19,6 +19,8 @@ CONFIG_SPL=y CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0x82000000 +CONFIG_SYS_PCI_64BIT=y +CONFIG_PCI=y CONFIG_TARGET_STARFIVE_VISIONFIVE2=y CONFIG_SPL_OPENSBI_LOAD_ADDR=0x40000000 CONFIG_ARCH_RV64I=y
@@ -62,6 +64,7 @@ CONFIG_SYS_EEPROM_PAGE_WRITE_BITS=4 CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS=5 CONFIG_CMD_MEMINFO=y CONFIG_CMD_I2C=y +CONFIG_CMD_PCI=y CONFIG_CMD_TFTPPUT=y CONFIG_OF_BOARD=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y
@@ -92,6 +95,10 @@ CONFIG_DWC_ETH_QOS=y CONFIG_DWC_ETH_QOS_STARFIVE=y CONFIG_RGMII=y CONFIG_RMII=y +CONFIG_NVME_PCI=y +CONFIG_DM_PCI_COMPAT=y +CONFIG_PCI_REGION_MULTI_ENTRY=y +CONFIG_PCIE_STARFIVE_JH7110=y CONFIG_PINCTRL=y CONFIG_PINCONF=y CONFIG_SPL_PINCTRL=y
Signature · 1 line
2.17.1
PATCH v8 2/4 starfive: pci: Add StarFive JH7110 pcie driver
In reply to Minda ChenFrom: Mason Huo <[email protected]>
Add pcie driver for StarFive JH7110, Also add PLDA PCIe controller common driver functions.
Several devices are tested:
a) M.2 NVMe SSD
b) Realtek 8169 Ethernet adapter.
--- drivers/pci/Kconfig | 13 ++ drivers/pci/Makefile | 2 + drivers/pci/pcie_plda_common.c | 116 +++++++++++ drivers/pci/pcie_plda_common.h | 118 +++++++++++ drivers/pci/pcie_starfive_jh7110.c | 317 +++++++++++++++++++++++++++++ 5 files changed, 566 insertions(+) create mode 100644 drivers/pci/pcie_plda_common.c create mode 100644 drivers/pci/pcie_plda_common.h create mode 100644 drivers/pci/pcie_starfive_jh7110.c
drivers/pci/Kconfig +13 -0
@@ -387,4 +387,17 @@ config PCIE_XILINX_NWL Say 'Y' here if you want support for Xilinx / AMD NWL PCIe controller as Root Port. +config PCIE_PLDA_COMMON + bool + +config PCIE_STARFIVE_JH7110 + bool "Enable Starfive JH7110 PCIe driver" + select PCIE_PLDA_COMMON + imply STARFIVE_JH7110 + imply CLK_JH7110 + imply RESET_JH7110 + help + Say Y here if you want to enable PLDA XpressRich PCIe controller + support on StarFive JH7110 SoC. + endif
drivers/pci/Makefile +2 -0
@@ -50,3 +50,5 @@ obj-$(CONFIG_PCIE_OCTEON) += pcie_octeon.o obj-$(CONFIG_PCIE_DW_SIFIVE) += pcie_dw_sifive.o obj-$(CONFIG_PCIE_UNIPHIER) += pcie_uniphier.o obj-$(CONFIG_PCIE_XILINX_NWL) += pcie-xilinx-nwl.o +obj-$(CONFIG_PCIE_PLDA_COMMON) += pcie_plda_common.o +obj-$(CONFIG_PCIE_STARFIVE_JH7110) += pcie_starfive_jh7110.o
drivers/pci/pcie_plda_common.c new file +116 -0
116 lines not on this page · raw message
drivers/pci/pcie_plda_common.h new file +118 -0
118 lines not on this page · raw message
drivers/pci/pcie_starfive_jh7110.c new file +317 -0
317 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v8 4/4 riscv: dts: starfive: Enable PCIe host controller
In reply to Minda ChenFrom: Mason Huo <[email protected]>
Enable and add pinctrl configuration for PCIe host controller.
--- .../dts/jh7110-starfive-visionfive-2.dtsi | 11 +++ arch/riscv/dts/jh7110.dtsi | 74 +++++++++++++++++++ 2 files changed, 85 insertions(+)
arch/riscv/dts/jh7110-starfive-visionfive-2.dtsi +11 -0
@@ -7,6 +7,7 @@ #include "jh7110.dtsi" #include <dt-bindings/pinctrl/pinctrl-starfive-jh7110.h> +#include <dt-bindings/gpio/gpio.h> / { aliases { serial0 = &uart0;
@@ -308,6 +309,16 @@ }; }; +&pcie0 { + reset-gpios = <&sysgpio 26 GPIO_ACTIVE_LOW>; + status = "disabled"; +}; + +&pcie1 { + reset-gpios = <&sysgpio 28 GPIO_ACTIVE_LOW>; + status = "okay"; +}; + &syscrg { assigned-clocks = <&syscrg JH7110_SYSCLK_CPU_ROOT>, <&syscrg JH7110_SYSCLK_BUS_ROOT>,
arch/riscv/dts/jh7110.dtsi +74 -0
79 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v8 1/4 i2c: designware: Add Kconfig for designware_i2c_pci.c
In reply to Minda ChenAs the Designware_i2c_pci.c uses ACPI APIs, If some SoCs (StarFive JH7110) contain Designware i2c and PCI but do not use ACPI, This file will be can't be compiled. So add a new Kconfig for designware_i2c_pci.c, which depends on ACPIGEN
--- drivers/i2c/Kconfig | 9 +++++++++ drivers/i2c/Makefile | 4 +--- 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/i2c/Kconfig +9 -0
@@ -231,6 +231,15 @@ config SYS_I2C_DW controller is used in various SoCs, e.g. the ST SPEAr, Altera SoCFPGA, Synopsys ARC700 and some Intel x86 SoCs. +config SYS_I2C_DW_PCI + bool "Designware PCI I2C Controller" + depends on SYS_I2C_DW && PCI && ACPIGEN + default y + help + Say yes here to select the Designware PCI I2C Host Controller. + This PCI I2C controller is the base on Desigware I2C host + controller. + config SYS_I2C_AST2600 bool "AST2600 I2C Controller" depends on DM_I2C && ARCH_ASPEED
drivers/i2c/Makefile +1 -3
@@ -18,9 +18,7 @@ obj-$(CONFIG_SYS_I2C_CADENCE) += i2c-cdns.o obj-$(CONFIG_SYS_I2C_CA) += i2c-cortina.o obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o obj-$(CONFIG_SYS_I2C_DW) += designware_i2c.o -ifdef CONFIG_PCI -obj-$(CONFIG_SYS_I2C_DW) += designware_i2c_pci.o -endif +obj-$(CONFIG_SYS_I2C_DW_PCI) += designware_i2c_pci.o obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o obj-$(CONFIG_SYS_I2C_IHS) += ihs_i2c.o obj-$(CONFIG_SYS_I2C_INTEL) += intel_i2c.o
Signature · 1 line
2.17.1
v7 cover Add StarFive JH7110 PCIe drvier support
These PCIe series patches are based on the JH7110 RISC-V SoC and VisionFive V2 board.
The PCIe driver depends on gpio, pinctrl, clk and reset driver to do init. The PCIe dts configuation includes all these setting.
The PCIe drivers codes has been tested on the VisionFive V2 boards. The test devices includes M.2 NVMe SSD and Realtek 8169 Ethernet adapter.
patch1 is for fixing the compile error in designware_i2c_pci.c while enable designware i2c and PCI.
previous patch version
v1: https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
v2: https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
v3: https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
v4: https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
v5: https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
v6: https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
v7: https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
changes
v8
patch1: Add Kconfig for designware_i2c_pci.c
v7
Add patch1 to fix compiling error while enable PCI. patch 2 and patch 3 rebase to latest mainline codes.
v6
patch 3
1. Change one VisionFive2 config file.
patch 4
1. remove the pcie interrupt-controller. interrupts setting revert to origin.
setting.
v5
patch 2
1. split PLDA controller driver codes to pcie_plda_common.c
2. correct the codes of record secondary number.
patch 4
1. change the pcie dtsi config. make them the same with kernel.
v4
patch 2
1. Remove the IDS_REVISION_ID macros.
2. Replace sec_busno to first_busno in starfive_pcie
3. Remove starfive_pcie_off_conf function.
4. Replace "imply" to "depends on" in PCIe Kconfig. 5 .Check sec_busno in starfive_pcie_addr_valid.
v3
patch 2
1. remove the read vendor ID delay
2. remove starfive_pcie_hide_rc_bar function. do not hide host
bridge BAR write.
3. Using PCIE_ECAM_OFFSET and PCI_CLASS_BRIDGE_PCI_NORMAL macros.
4. Add comments for bus and address limitation reason in function starfive_pcie_addr_valid
5. Change the multiple line comments in Line 373
6. Using gpio_request_by_name to get PCIe reset gpio,and using dm_gpio_set_value set GPIO value.
patch 3
1. support PCIeboth 12a and 13b vf2 board.
patch 4
1. reset dts change to reset-gpio.
v2
1. remove clock commit. The pcie clocks change has been includeded in [1].
2. Using GENMASK marco1 in patch1.
3. remove the syscon dts node in patch3. The syscon dts dts node has been included in [1].
Mason Huo (3):
starfive: pci: Add StarFive JH7110 pcie driver
configs: starfive-jh7110: Add support for PCIe host driver
riscv: dts: starfive: Enable PCIe host controller
Minda Chen (1):
i2c: designware: Add Kconfig for designware_i2c_pci.c
.../dts/jh7110-starfive-visionfive-2.dtsi | 11 + arch/riscv/dts/jh7110.dtsi | 74 ++++ configs/starfive_visionfive2_defconfig | 7 + drivers/i2c/Kconfig | 9 + drivers/i2c/Makefile | 4 +- drivers/pci/Kconfig | 13 + drivers/pci/Makefile | 2 + drivers/pci/pcie_plda_common.c | 116 +++++++ drivers/pci/pcie_plda_common.h | 118 +++++++ drivers/pci/pcie_starfive_jh7110.c | 317 ++++++++++++++++++ 10 files changed, 668 insertions(+), 3 deletions(-) create mode 100644 drivers/pci/pcie_plda_common.c create mode 100644 drivers/pci/pcie_plda_common.h create mode 100644 drivers/pci/pcie_starfive_jh7110.c
base-commit: e6e67bb9e0a40f3eb3c87d16935192821987c3e0
Signature · 1 line
2.17.1
Re: [PATCH v8 1/4] i2c: designware: Add Kconfig for designware_i2c_pci.c
In reply to Minda ChenQuoted 10 lines · Minda Chen
As the
Designware_i2c_pci.cuses ACPI APIs, If some SoCs (StarFive JH7110) contain Designware i2c and PCI but do not use ACPI, This file will be can't be compiled. So add a newKconfigfordesignware_i2c_pci.c, which depends on ACPIGENSigned-off-by Minda Chen <[email protected]>--- drivers/i2c/Kconfig | 9 +++++++++ drivers/i2c/Makefile | 4 +--- 2 files changed, 10 insertions(+), 3 deletions(-)
Re: [PATCH v8 1/4] i2c: designware: Add Kconfig for designware_i2c_pci.c
Quoted 6 lines · Leo Liang
Quoted 5 lines · Minda Chen
As the
Designware_i2c_pci.cuses ACPI APIs, If some SoCs (StarFive JH7110) contain Designware i2c and PCI but do not use ACPI, This file will be can't be compiled. So add a newKconfigfordesignware_i2c_pci.c, which depends on ACPIGEN
Quoted 7 lines
Quoted 5 lines
Signed-off-by Minda Chen <[email protected]>--- drivers/i2c/Kconfig | 9 +++++++++ drivers/i2c/Makefile | 4 +--- 2 files changed, 10 insertions(+), 3 deletions(-)Reviewed-by Leo Yu-Chi Liang <[email protected]>
Thanks. Does this patch require Heiko review?
Re: [PATCH v8 1/4] i2c: designware: Add Kconfig for designware_i2c_pci.c
In reply to Minda ChenHi,
Quoted 11 lines · Minda Chen
As the
Designware_i2c_pci.cuses ACPI APIs, If some SoCs (StarFive JH7110) contain Designware i2c and PCI but do not use ACPI, This file will be can't be compiled. So add a newKconfigfordesignware_i2c_pci.c, which depends on ACPIGENSigned-off-by Minda Chen <[email protected]>--- drivers/i2c/Kconfig | 9 +++++++++ drivers/i2c/Makefile | 4 +--- 2 files changed, 10 insertions(+), 3 deletions(-)
with nit below
Quoted 6 lines
drivers/i2c/Kconfig +0
-0
drivers/i2c/Kconfig config SYS_I2C_DW · line 240
Quoted 10 lines
drivers/i2c/Kconfig +7
-0@@ -231,6 +231,15 @@ config SYS_I2C_DW controller is used in various SoCs, e.g. the ST SPEAr, Altera SoCFPGA, Synopsys ARC700 and some Intel x86 SoCs. +config SYS_I2C_DW_PCI + bool "Designware PCI I2C Controller" + depends on SYS_I2C_DW && PCI && ACPIGEN + default y + help + Say yes here to select the Designware PCI I2C Host Controller. + This PCI I2C controller is the base on Desigware I2C host
spelling
Quoted 21 lines
drivers/i2c/Kconfig +2
-0+ controller. + config SYS_I2C_AST2600 bool "AST2600 I2C Controller" depends on DM_I2C && ARCH_ASPEEDdrivers/i2c/Makefile +1
-4@@ -18,9 +18,7 @@ obj-$(CONFIG_SYS_I2C_CADENCE) += i2c-cdns.o obj-$(CONFIG_SYS_I2C_CA) += i2c-cortina.o obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o obj-$(CONFIG_SYS_I2C_DW) += designware_i2c.o -ifdef CONFIG_PCI -obj-$(CONFIG_SYS_I2C_DW) += designware_i2c_pci.o -endif +obj-$(CONFIG_SYS_I2C_DW_PCI) += designware_i2c_pci.o obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o obj-$(CONFIG_SYS_I2C_IHS) += ihs_i2c.o obj-$(CONFIG_SYS_I2C_INTEL) += intel_i2c.o --
Quoted 2 lines
2.17.1
Regards,
SImon