Skip to contentSkip to conversation

Add support for Cavium Octeon-TX CN80XX/CN81XX

PATCH In review Tim Harvey 5 participants 38 messages Mar 4, 2019 – Oct 29, 2019 1 message not in the archive

Subsystems (16)
lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

cover Add support for Cavium Octeon-TX CN80XX/CN81XX

The Cavium Octeon-TX 64-bit ARM based SoCs include the CN80XX and CN81XX. These SoC's have peripheral drivers based on PCI ECAM.

This series has been tested on the the following Gateworks SBC's:
- GW6100 - CN8021 dual A53 800MHz
- GW6104 - CN8031 quad A53 1500MHz
- GW6300 - CN8020 dual A53 800MHz
- GW6304 - CN8030 quad A53 1500MHz

These patches all came originally from Cavium's SDK based on a 2017 version of U-Boot and have been refactored a bit to strip out things that didn't make sense that I saw in the original code.

These patches apply on top of U-Boot 2018.11 and if needed I can do minor cleanup and rebase on top of master but I can't be the maintainer.

I'm also looking for comments on the PCI related patches as I am by far not a PCI expert and am not sure what I've done here is correct for this SoC and the others some of the changes would affect.

I'm looking for a maintainer for this - I only have boards with the above SoC's and can't test anything else. I also don't have the resources to be a maintainer of this arch - I'm looking at you Cavium/Marvell as your SDK's use old forks of U-Boot with a slew of patches and there is no reason to not mainline this code. I've added all the cavium/marvell contacts I could find from previous threads about OcteonTX support in U-Boot.

The way I'm using this on the above boards is to build u-boot-nodtb.bin and package it into a FIP image that the ATF loads. I can document this process if needed.

You can find this series on github [1]

Best Regards,

Tim

[1] https://github.com/Gateworks/uboot-newport/tree/v2018.11-newport-rc1

Tim Harvey (22):
arm: introduce ARCH_THUNDERX
arm: add thunderx_81xx
thunderx: add FDT support
thunderx: add thunderx register definitions and misc functions
thunderx: move DRAM prints to debug
dm: pci: add PCI SR-IOV EA support
fdt: add fdtdec_get_pci_bus_range
pci: add thunderx pci/ecam driver
pci: fix pce enumeration on thunderx
arm: include 64bit io accessors
gpio: add thunderx gpio driver
i2c: add thunderx I2C driver
spi: add thunderx SPI driver
xhci: add support for cavium thunderx XHCI
thunderx_81xx: add support for XHCI
thunderx_81xx: enable usb mass storage and usb ethernet
ahci: support 64bit systems
ahci: set n_ports from host caps
ahci: add support for ThunderX AHCI
thunderx_81xx: add AHCI support
net: add thunderx vnic drivers
pci: auto probe thunderx NIC devices

 arch/arm/Kconfig                              |    6 +-
 arch/arm/Makefile                             |    1 +
 arch/arm/dts/Makefile                         |    3 +-
 arch/arm/dts/thunderx-81xx.dts                |   36 +
 arch/arm/dts/thunderx-81xx.dtsi               |  440 +++++
 .../arm/include/asm/arch-thunderx}/atf.h      |    2 +-
 .../arm/include/asm/arch-thunderx}/atf_part.h |    0
 arch/arm/include/asm/arch-thunderx/fdt.h      |   12 +
 arch/arm/include/asm/arch-thunderx/thunderx.h |  300 ++++
 .../include/asm/arch-thunderx}/thunderx_svc.h |    0
 .../include/asm/arch-thunderx/thunderx_vnic.h |   15 +
 arch/arm/include/asm/gpio.h                   |    2 +-
 arch/arm/include/asm/io.h                     |    8 +
 arch/arm/mach-thunderx/Makefile               |    2 +
 .../thunderx => arch/arm/mach-thunderx}/atf.c |    6 +-
 arch/arm/mach-thunderx/fdt.c                  |  218 +++
 arch/arm/mach-thunderx/lowlevel_init.S        |   31 +
 arch/arm/mach-thunderx/misc.c                 |   33 +
 arch/x86/cpu/baytrail/cpu.c                   |    3 +-
 board/cavium/thunderx/Kconfig                 |   23 +-
 board/cavium/thunderx/Makefile                |    2 +-
 board/cavium/thunderx/thunderx.c              |   60 +-
 configs/thunderx_81xx_defconfig               |   65 +
 configs/thunderx_88xx_defconfig               |    9 +-
 drivers/ata/ahci.c                            |   46 +-
 drivers/gpio/Kconfig                          |    7 +
 drivers/gpio/Makefile                         |    1 +
 drivers/gpio/thunderx_gpio.c                  |  189 ++
 drivers/i2c/Kconfig                           |    7 +
 drivers/i2c/Makefile                          |    1 +
 drivers/i2c/designware_i2c.c                  |    4 +-
 drivers/i2c/intel_i2c.c                       |    3 +-
 drivers/i2c/thunderx_i2c.c                    |  878 ++++++++++
 drivers/mmc/pci_mmc.c                         |    3 +-
 drivers/net/Kconfig                           |   34 +
 drivers/net/Makefile                          |    1 +
 drivers/net/cavium/Makefile                   |    8 +
 drivers/net/cavium/nic.h                      |  569 ++++++
 drivers/net/cavium/nic_main.c                 |  795 +++++++++
 drivers/net/cavium/nic_reg.h                  |  228 +++
 drivers/net/cavium/nicvf_main.c               |  553 ++++++
 drivers/net/cavium/nicvf_queues.c             | 1123 ++++++++++++
 drivers/net/cavium/nicvf_queues.h             |  364 ++++
 drivers/net/cavium/q_struct.h                 |  692 ++++++++
 drivers/net/cavium/thunder_bgx.c              | 1529 +++++++++++++++++
 drivers/net/cavium/thunder_bgx.h              |  259 +++
 drivers/net/cavium/thunder_xcv.c              |  190 ++
 drivers/net/cavium/thunderx_smi.c             |  388 +++++
 drivers/net/e1000.c                           |    5 +-
 drivers/net/pch_gbe.c                         |    3 +-
 drivers/nvme/nvme.c                           |    3 +-
 drivers/pci/Kconfig                           |    9 +
 drivers/pci/Makefile                          |    1 +
 drivers/pci/pci-uclass.c                      |  316 +++-
 drivers/pci/pci_auto.c                        |   18 +
 drivers/pci/pci_thunderx.c                    |  160 ++
 drivers/spi/Kconfig                           |    6 +
 drivers/spi/Makefile                          |    1 +
 drivers/spi/thunderx_spi.c                    |  448 +++++
 drivers/usb/host/ehci-pci.c                   |    3 +-
 drivers/usb/host/xhci-pci.c                   |   10 +-
 include/ahci.h                                |    3 +
 include/configs/thunderx_81xx.h               |   82 +
 include/fdtdec.h                              |   11 +
 include/pci.h                                 |   58 +-
 include/pci_ids.h                             |   15 +
 lib/fdtdec.c                                  |   13 +
 net/eth_legacy.c                              |    3 +
 68 files changed, 10248 insertions(+), 69 deletions(-)
 create mode 100644 arch/arm/dts/thunderx-81xx.dts
 create mode 100644 arch/arm/dts/thunderx-81xx.dtsi
 rename {include/cavium => arch/arm/include/asm/arch-thunderx}/atf.h (96%)
 rename {include/cavium => arch/arm/include/asm/arch-thunderx}/atf_part.h (100%)
 create mode 100644 arch/arm/include/asm/arch-thunderx/fdt.h
 create mode 100644 arch/arm/include/asm/arch-thunderx/thunderx.h
 rename {include/cavium => arch/arm/include/asm/arch-thunderx}/thunderx_svc.h (100%)
 create mode 100644 arch/arm/include/asm/arch-thunderx/thunderx_vnic.h
 create mode 100644 arch/arm/mach-thunderx/Makefile
 rename {board/cavium/thunderx => arch/arm/mach-thunderx}/atf.c (98%)
 create mode 100644 arch/arm/mach-thunderx/fdt.c
 create mode 100644 arch/arm/mach-thunderx/lowlevel_init.S
 create mode 100644 arch/arm/mach-thunderx/misc.c
 create mode 100644 configs/thunderx_81xx_defconfig
 create mode 100644 drivers/gpio/thunderx_gpio.c
 create mode 100644 drivers/i2c/thunderx_i2c.c
 create mode 100644 drivers/net/cavium/Makefile
 create mode 100644 drivers/net/cavium/nic.h
 create mode 100644 drivers/net/cavium/nic_main.c
 create mode 100644 drivers/net/cavium/nic_reg.h
 create mode 100644 drivers/net/cavium/nicvf_main.c
 create mode 100644 drivers/net/cavium/nicvf_queues.c
 create mode 100644 drivers/net/cavium/nicvf_queues.h
 create mode 100644 drivers/net/cavium/q_struct.h
 create mode 100644 drivers/net/cavium/thunder_bgx.c
 create mode 100644 drivers/net/cavium/thunder_bgx.h
 create mode 100644 drivers/net/cavium/thunder_xcv.c
 create mode 100644 drivers/net/cavium/thunderx_smi.c
 create mode 100644 drivers/pci/pci_thunderx.c
 create mode 100755 drivers/spi/thunderx_spi.c
 create mode 100644 include/configs/thunderx_81xx.h
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/22 arm: introduce ARCH_THUNDERX

---
 arch/arm/Kconfig                                  |  6 +++---
 arch/arm/Makefile                                 |  1 +
 arch/arm/dts/Makefile                             |  2 +-
 .../arm/include/asm/arch-thunderx}/atf.h          |  2 +-
 .../arm/include/asm/arch-thunderx}/atf_part.h     |  0
 .../arm/include/asm/arch-thunderx}/thunderx_svc.h |  0
 arch/arm/include/asm/gpio.h                       |  2 +-
 arch/arm/mach-thunderx/Makefile                   |  2 ++
 .../thunderx => arch/arm/mach-thunderx}/atf.c     |  6 +++---
 board/cavium/thunderx/Kconfig                     | 15 ++++++++++++---
 board/cavium/thunderx/Makefile                    |  2 +-
 board/cavium/thunderx/thunderx.c                  |  2 +-
 configs/thunderx_88xx_defconfig                   |  3 ++-
 13 files changed, 28 insertions(+), 15 deletions(-)
 rename {include/cavium => arch/arm/include/asm/arch-thunderx}/atf.h (96%)
 rename {include/cavium => arch/arm/include/asm/arch-thunderx}/atf_part.h (100%)
 rename {include/cavium => arch/arm/include/asm/arch-thunderx}/thunderx_svc.h (100%)
 create mode 100644 arch/arm/mach-thunderx/Makefile
 rename {board/cavium/thunderx => arch/arm/mach-thunderx}/atf.c (98%)
arch/arm/Kconfig +3 -3
index 1f3fa1575a..9f6f5a41da 100644
@@ -393,7 +393,7 @@ config SPL_USE_ARCH_MEMSET
 
 config ARM64_SUPPORT_AARCH32
 	bool "ARM64 system support AArch32 execution state"
-	default y if ARM64 && !TARGET_THUNDERX_88XX
+	default y if ARM64 && !ARCH_THUNDERX
 	help
 	  This ARM64 system supports AArch32 execution state.
 
@@ -1359,8 +1359,8 @@ config ARCH_ROCKCHIP
 	imply TPL_SYSRESET
 	imply USB_FUNCTION_FASTBOOT
 
-config TARGET_THUNDERX_88XX
-	bool "Support ThunderX 88xx"
+config ARCH_THUNDERX
+	bool "Support ThunderX"
 	select ARM64
 	select OF_CONTROL
 	select PL01X_SERIAL
arch/arm/Makefile +1 -0
index 4b6c5e1935..f58e2cd29c 100644
@@ -79,6 +79,7 @@ machine-$(CONFIG_STM32)			+= stm32
 machine-$(CONFIG_ARCH_STM32MP)		+= stm32mp
 machine-$(CONFIG_TEGRA)			+= tegra
 machine-$(CONFIG_ARCH_UNIPHIER)		+= uniphier
+machine-$(CONFIG_ARCH_THUNDERX)		+= thunderx
 machine-$(CONFIG_ARCH_ZYNQ)		+= zynq
 machine-$(CONFIG_ARCH_VERSAL)		+= versal
 machine-$(CONFIG_ARCH_ZYNQMP_R5)	+= zynqmp-r5
arch/arm/dts/Makefile +1 -1
index d36447d18d..87ccd96596 100644
@@ -192,7 +192,7 @@ dtb-$(CONFIG_AM43XX) += am437x-gp-evm.dtb am437x-sk-evm.dtb	\
 	am437x-idk-evm.dtb \
 	am4372-generic.dtb
 dtb-$(CONFIG_TI816X) += dm8168-evm.dtb
-dtb-$(CONFIG_THUNDERX) += thunderx-88xx.dtb
+dtb-$(CONFIG_THUNDERX_88XX) += thunderx-88xx.dtb
 
 dtb-$(CONFIG_ARCH_SOCFPGA) +=				\
 	socfpga_arria5_socdk.dtb			\
arch/arm/include/asm/arch-thunderx/atf.h renamed from include/cavium/atf.h +1 -1
similarity index 96%
rename from include/cavium/atf.h
rename to arch/arm/include/asm/arch-thunderx/atf.h
index 3cf05c43d7..cda42d6140 100644
@@ -4,7 +4,7 @@
 **/
 #ifndef __ATF_H__
 #define __ATF_H__
-#include <cavium/atf_part.h>
+#include "atf_part.h"
 
 ssize_t atf_read_mmc(uintptr_t offset, void *buffer, size_t size);
 ssize_t atf_read_nor(uintptr_t offset, void *buffer, size_t size);
arch/arm/include/asm/arch-thunderx/atf_part.h renamed from include/cavium/atf_part.h +0 -0
similarity index 100%
rename from include/cavium/atf_part.h
rename to arch/arm/include/asm/arch-thunderx/atf_part.h
arch/arm/include/asm/arch-thunderx/thunderx_svc.h renamed from include/cavium/thunderx_svc.h +0 -0
similarity index 100%
rename from include/cavium/thunderx_svc.h
rename to arch/arm/include/asm/arch-thunderx/thunderx_svc.h
arch/arm/include/asm/gpio.h +1 -1
index 3039e66bf9..420f253c1b 100644
@@ -1,5 +1,5 @@
 #if !defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARCH_STI) && \
-	!defined(CONFIG_ARCH_K3)
+	!defined(CONFIG_ARCH_K3) && !defined(CONFIG_ARCH_THUNDERX)
 #include <asm/arch/gpio.h>
 #endif
 #include <asm-generic/gpio.h>
arch/arm/mach-thunderx/Makefile new file +2 -0
new file mode 100644
index 0000000000..34b6ecc2f9
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0+
+obj-y	:= atf.o
arch/arm/mach-thunderx/atf.c renamed from board/cavium/thunderx/atf.c +3 -3
similarity index 98%
rename from board/cavium/thunderx/atf.c
rename to arch/arm/mach-thunderx/atf.c
index 2e7ba69d76..cebd84b0e1 100644
@@ -7,9 +7,9 @@
 #include <asm/io.h>
 
 #include <asm/system.h>
-#include <cavium/thunderx_svc.h>
-#include <cavium/atf.h>
-#include <cavium/atf_part.h>
+#include <asm/arch-thunderx/thunderx_svc.h>
+#include <asm/arch-thunderx/atf.h>
+#include <asm/arch-thunderx/atf_part.h>
 
 #include <asm/psci.h>
 
board/cavium/thunderx/Kconfig +12 -3
index 927d8765d6..5fa367ac35 100644
@@ -1,4 +1,4 @@
-if TARGET_THUNDERX_88XX
+if ARCH_THUNDERX
 
 config SYS_CPU
 	string
@@ -10,11 +10,20 @@ config SYS_BOARD
 
 config SYS_VENDOR
 	string
-	default "cavium"
+	default	"cavium"
+
+choice
+	prompt "ThunderX board select"
+	optional
+
+config THUNDERX_88XX
+	bool "ThunderX 88xx family"
+
+endchoice
 
 config SYS_CONFIG_NAME
 	string
-	default "thunderx_88xx"
+	default "thunderx_88xx" if THUNDERX_88XX
 
 config CMD_ATF
 	bool "Enable ATF query commands"
board/cavium/thunderx/Makefile +1 -1
index 4088c7678d..6da877fa60 100644
@@ -3,4 +3,4 @@
 #
 #
 
-obj-y	:= thunderx.o atf.o
+obj-y	:= thunderx.o
board/cavium/thunderx/thunderx.c +1 -1
index cf55b633c3..2b80dc56f1 100644
@@ -9,7 +9,7 @@
 #include <errno.h>
 #include <linux/compiler.h>
 
-#include <cavium/atf.h>
+#include <asm/arch-thunderx/atf.h>
 #include <asm/armv8/mmu.h>
 
 #if !CONFIG_IS_ENABLED(OF_CONTROL)
configs/thunderx_88xx_defconfig +2 -1
index b00179a9c8..fe4643f52e 100644
@@ -1,8 +1,9 @@
 CONFIG_ARM=y
-CONFIG_TARGET_THUNDERX_88XX=y
+CONFIG_ARCH_THUNDERX=y
 CONFIG_SYS_TEXT_BASE=0x00500000
 CONFIG_DEBUG_UART_BASE=0x87e024000000
 CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_THUNDERX_88XX=y
 CONFIG_IDENT_STRING=" for Cavium Thunder CN88XX ARM v8 Multi-Core"
 CONFIG_DEBUG_UART=y
 CONFIG_NR_DRAM_BANKS=1
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/22 arm: introduce ARCH_THUNDERX

We will be submitting OcteonTX/OcteonTX2 support soon to mainline, these are very old changes, please wait till then.

Chandra

________________________________
From: Tim Harvey <[email protected]>
Sent: Monday, March 4, 2019 9:34:16 AM
To: Aaron Williams; Chris Packham; Alexander Graf; Zi Shen Lim; Maen Suleiman; Suneel Garapati; chandrakala.chavva at cavium.com; prasun.kapoor at cavium.com; Sergey Temerkhanov
Cc: u-boot; Tim Harvey
Subject: [U-Boot] [RFC/RESEND 01/22] arm: introduce ARCH_THUNDERX

---
 arch/arm/Kconfig                                  |  6 +++---
 arch/arm/Makefile                                 |  1 +
 arch/arm/dts/Makefile                             |  2 +-
 .../arm/include/asm/arch-thunderx}/atf.h          |  2 +-
 .../arm/include/asm/arch-thunderx}/atf_part.h     |  0
 .../arm/include/asm/arch-thunderx}/thunderx_svc.h |  0
 arch/arm/include/asm/gpio.h                       |  2 +-
 arch/arm/mach-thunderx/Makefile                   |  2 ++
 .../thunderx => arch/arm/mach-thunderx}/atf.c     |  6 +++---
 board/cavium/thunderx/Kconfig                     | 15 ++++++++++++---
 board/cavium/thunderx/Makefile                    |  2 +-
 board/cavium/thunderx/thunderx.c                  |  2 +-
 configs/thunderx_88xx_defconfig                   |  3 ++-
 13 files changed, 28 insertions(+), 15 deletions(-)
 rename {include/cavium => arch/arm/include/asm/arch-thunderx}/atf.h (96%)
 rename {include/cavium => arch/arm/include/asm/arch-thunderx}/atf_part.h (100%)
 rename {include/cavium => arch/arm/include/asm/arch-thunderx}/thunderx_svc.h (100%)
 create mode 100644 arch/arm/mach-thunderx/Makefile
 rename {board/cavium/thunderx => arch/arm/mach-thunderx}/atf.c (98%)
arch/arm/Kconfig +3 -3
index 1f3fa1575a..9f6f5a41da 100644
@@ -393,7 +393,7 @@ config SPL_USE_ARCH_MEMSET
 
 config ARM64_SUPPORT_AARCH32
         bool "ARM64 system support AArch32 execution state"
-       default y if ARM64 && !TARGET_THUNDERX_88XX
+       default y if ARM64 && !ARCH_THUNDERX
         help
           This ARM64 system supports AArch32 execution state.
 
@@ -1359,8 +1359,8 @@ config ARCH_ROCKCHIP
         imply TPL_SYSRESET
         imply USB_FUNCTION_FASTBOOT
 
-config TARGET_THUNDERX_88XX
-       bool "Support ThunderX 88xx"
+config ARCH_THUNDERX
+       bool "Support ThunderX"
         select ARM64
         select OF_CONTROL
         select PL01X_SERIAL
arch/arm/Makefile +1 -0
index 4b6c5e1935..f58e2cd29c 100644
@@ -79,6 +79,7 @@ machine-$(CONFIG_STM32)                       += stm32
 machine-$(CONFIG_ARCH_STM32MP)          += stm32mp
 machine-$(CONFIG_TEGRA)                 += tegra
 machine-$(CONFIG_ARCH_UNIPHIER)         += uniphier
+machine-$(CONFIG_ARCH_THUNDERX)                += thunderx
 machine-$(CONFIG_ARCH_ZYNQ)             += zynq
 machine-$(CONFIG_ARCH_VERSAL)           += versal
 machine-$(CONFIG_ARCH_ZYNQMP_R5)        += zynqmp-r5
arch/arm/dts/Makefile +1 -1
index d36447d18d..87ccd96596 100644
@@ -192,7 +192,7 @@ dtb-$(CONFIG_AM43XX) += am437x-gp-evm.dtb am437x-sk-evm.dtb \
         am437x-idk-evm.dtb \
         am4372-generic.dtb
 dtb-$(CONFIG_TI816X) += dm8168-evm.dtb
-dtb-$(CONFIG_THUNDERX) += thunderx-88xx.dtb
+dtb-$(CONFIG_THUNDERX_88XX) += thunderx-88xx.dtb
 
 dtb-$(CONFIG_ARCH_SOCFPGA) +=                           \
         socfpga_arria5_socdk.dtb                        \
arch/arm/include/asm/arch-thunderx/atf.h renamed from include/cavium/atf.h +1 -1
similarity index 96%
rename from include/cavium/atf.h
rename to arch/arm/include/asm/arch-thunderx/atf.h
index 3cf05c43d7..cda42d6140 100644
@@ -4,7 +4,7 @@
 **/
 #ifndef __ATF_H__
 #define __ATF_H__
-#include <cavium/atf_part.h>
+#include "atf_part.h"
 
 ssize_t atf_read_mmc(uintptr_t offset, void *buffer, size_t size);
 ssize_t atf_read_nor(uintptr_t offset, void *buffer, size_t size);
arch/arm/include/asm/arch-thunderx/atf_part.h renamed from include/cavium/atf_part.h +0 -0
similarity index 100%
rename from include/cavium/atf_part.h
rename to arch/arm/include/asm/arch-thunderx/atf_part.h
arch/arm/include/asm/arch-thunderx/thunderx_svc.h renamed from include/cavium/thunderx_svc.h +0 -0
similarity index 100%
rename from include/cavium/thunderx_svc.h
rename to arch/arm/include/asm/arch-thunderx/thunderx_svc.h
arch/arm/include/asm/gpio.h +1 -1
index 3039e66bf9..420f253c1b 100644
@@ -1,5 +1,5 @@
 #if !defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARCH_STI) && \
-       !defined(CONFIG_ARCH_K3)
+       !defined(CONFIG_ARCH_K3) && !defined(CONFIG_ARCH_THUNDERX)
 #include <asm/arch/gpio.h>
 #endif
 #include <asm-generic/gpio.h>
arch/arm/mach-thunderx/Makefile new file +2 -0
new file mode 100644
index 0000000000..34b6ecc2f9
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0+
+obj-y  := atf.o
arch/arm/mach-thunderx/atf.c renamed from board/cavium/thunderx/atf.c +3 -3
similarity index 98%
rename from board/cavium/thunderx/atf.c
rename to arch/arm/mach-thunderx/atf.c
index 2e7ba69d76..cebd84b0e1 100644
@@ -7,9 +7,9 @@
 #include <asm/io.h>
 
 #include <asm/system.h>
-#include <cavium/thunderx_svc.h>
-#include <cavium/atf.h>
-#include <cavium/atf_part.h>
+#include <asm/arch-thunderx/thunderx_svc.h>
+#include <asm/arch-thunderx/atf.h>
+#include <asm/arch-thunderx/atf_part.h>
 
 #include <asm/psci.h>
 
board/cavium/thunderx/Kconfig +12 -3
index 927d8765d6..5fa367ac35 100644
@@ -1,4 +1,4 @@
-if TARGET_THUNDERX_88XX
+if ARCH_THUNDERX
 
 config SYS_CPU
         string
@@ -10,11 +10,20 @@ config SYS_BOARD
 
 config SYS_VENDOR
         string
-       default "cavium"
+       default "cavium"
+
+choice
+       prompt "ThunderX board select"
+       optional
+
+config THUNDERX_88XX
+       bool "ThunderX 88xx family"
+
+endchoice
 
 config SYS_CONFIG_NAME
         string
-       default "thunderx_88xx"
+       default "thunderx_88xx" if THUNDERX_88XX
 
 config CMD_ATF
         bool "Enable ATF query commands"
board/cavium/thunderx/Makefile +1 -1
index 4088c7678d..6da877fa60 100644
@@ -3,4 +3,4 @@
 #
 #
 
-obj-y  := thunderx.o atf.o
+obj-y  := thunderx.o
board/cavium/thunderx/thunderx.c +1 -1
index cf55b633c3..2b80dc56f1 100644
@@ -9,7 +9,7 @@
 #include <errno.h>
 #include <linux/compiler.h>
 
-#include <cavium/atf.h>
+#include <asm/arch-thunderx/atf.h>
 #include <asm/armv8/mmu.h>
 
 #if !CONFIG_IS_ENABLED(OF_CONTROL)
configs/thunderx_88xx_defconfig +2 -1
index b00179a9c8..fe4643f52e 100644
@@ -1,8 +1,9 @@
 CONFIG_ARM=y
-CONFIG_TARGET_THUNDERX_88XX=y
+CONFIG_ARCH_THUNDERX=y
 CONFIG_SYS_TEXT_BASE=0x00500000
 CONFIG_DEBUG_UART_BASE=0x87e024000000
 CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_THUNDERX_88XX=y
 CONFIG_IDENT_STRING=" for Cavium Thunder CN88XX ARM v8 Multi-Core"
 CONFIG_DEBUG_UART=y
 CONFIG_NR_DRAM_BANKS=1

--
2.17.1

author
#3 lore raw

PATCH 1/22 arm: introduce ARCH_THUNDERX

Quoted 5 lines · Chandrakala Chavva

We will be submitting OcteonTX/OcteonTX2 support soon to mainline, these are very old changes, please wait till then.

Chandra

Chandra,

Thanks for the reply. Can you elaborate on what 'soon' might be... weeks or months?

Regards,

Tim

author
#4 lore raw

PATCH 1/22 arm: introduce ARCH_THUNDERX

Tim Harvey - Principal Software EngineerGateworks Corporation -
http://www.gateworks.com/3026 S. Higuera St. San Luis Obispo CA 93401805-781-2000

Quoted 6 lines · Tim Harvey
Quoted 4 lines · Chandrakala Chavva

We will be submitting OcteonTX/OcteonTX2 support soon to mainline, these are very old changes, please wait till then.

Quoted 7 lines
Quoted 1 line

Chandra

Chandra,

Thanks for the reply. Can you elaborate on what 'soon' might be... weeks or months?

Chandra,

Any response with regards to what 'soon' means? We have SUSE users wanting to the UEFI support/fixes in modern U-Boot and the U-Boot from your latest SDK is based on U-Boot 2017.07.

Tim

#5 lore raw

PATCH 1/22 arm: introduce ARCH_THUNDERX

Hi Tim,

First series will be out week ending April 20th.

Regards,
Suneel

Quoted 26 lines · Tim Harvey

Tim Harvey - Principal Software EngineerGateworks Corporation -
http://www.gateworks.com/3026 S. Higuera St. San Luis Obispo CA 93401805-781-2000

Quoted 6 lines · Tim Harvey
Quoted 4 lines · Chandrakala Chavva

We will be submitting OcteonTX/OcteonTX2 support soon to mainline, these are very old changes, please wait till then.

Quoted 7 lines
Quoted 1 line

Chandra

Chandra,

Thanks for the reply. Can you elaborate on what 'soon' might be... weeks or months?

Chandra,

Any response with regards to what 'soon' means? We have SUSE users wanting to the UEFI support/fixes in modern U-Boot and the U-Boot from your latest SDK is based on U-Boot 2017.07.

Tim

author
#6 lore raw

PATCH 1/22 arm: introduce ARCH_THUNDERX

Quoted 7 lines · Suneel Garapati

Hi Tim,

First series will be out week ending April 20th.

Regards,
Suneel

Suneel,

Any update on a Marvell submitted/maintained patch series for Octeon-TX support?

Best Regards,

Tim

#7 lore raw

PATCH 1/22 arm: introduce ARCH_THUNDERX

Hi Tim,

Missed aggressive timeline, first RFC series should be out in three weeks time as priority.

Regards,
Suneel

Quoted 2 lines · Tim Harvey

On Fri, Mar 22, 2019 at 11:23 AM Suneel Garapati <[email protected]>

Quoted 11 lines · wrote:
Quoted 7 lines

Hi Tim,

First series will be out week ending April 20th.

Regards,
Suneel

Suneel,

Any update on a Marvell submitted/maintained patch series for Octeon-TX

support?

Quoted 4 lines

Best Regards,

Tim

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

PATCH 1/22 arm: introduce ARCH_THUNDERX

Hi Matthias,

Hard deadline is Aug 15th, so you should see first series before that.

Regards,
Suneel

Quoted 45 lines · Matthias Brugger

Hi Suneel,
Hi Chandrakala,

Quoted 5 lines · Suneel Garapati

Hi Tim,

Missed aggressive timeline, first RFC series should be out in three weeks time as priority.

Any news on the patch set?

Regards,
Matthias

Quoted 29 lines

Regards,
Suneel

Quoted 2 lines · Tim Harvey

On Fri, Mar 22, 2019 at 11:23 AM Suneel Garapati <[email protected]>

Quoted 11 lines · wrote:
Quoted 7 lines

Hi Tim,

First series will be out week ending April 20th.

Regards,
Suneel

Suneel,

Any update on a Marvell submitted/maintained patch series for Octeon-TX

support?

Quoted 4 lines

Best Regards,

Tim

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

author
#10 lore raw

PATCH 1/22 arm: introduce ARCH_THUNDERX

Quoted 5 lines · Suneel Garapati

Hi Matthias,

Hard deadline is Aug 15th, so you should see first series before that.

Suneel,

Update? I'm really wishing my patches posted last March were considered instead of all of this waiting.

Regards,

Tim

#11 lore raw

[U-Boot] [EXT] Re: [RFC/RESEND 01/22] arm: introduce ARCH_THUNDERX

Tim,

It was scheduled to post the patches on August 15th, it got delayed as Suneel got sick, he will post in 2 weeks.

Chandra
________________________________
From: Tim Harvey <[email protected]>
Sent: Monday, August 26, 2019 10:54:34 AM
To: Suneel Garapati <[email protected]>
Cc: Matthias Brugger <[email protected]>; Chandrakala Chavva <[email protected]>; prasun.kapoor at cavium.com <[email protected]>; Sergey Temerkhanov <[email protected]>; u-boot <[email protected]>; chandrakala.chavva at cavium.com <[email protected]>; Zi Shen Lim <[email protected]>; Maen Suleiman <[email protected]>; Aaron Williams <[email protected]>; Chris Packham <[email protected]>
Subject: [EXT] Re: [U-Boot] [RFC/RESEND 01/22] arm: introduce ARCH_THUNDERX

External Email

----------------------------------------------------------------------

Quoted 5 lines · Suneel Garapati

Hi Matthias,

Hard deadline is Aug 15th, so you should see first series before that.

Suneel,

Update? I'm really wishing my patches posted last March were considered instead of all of this waiting.

Regards,

Tim

#12 lore raw

[U-Boot] [EXT] Re: [RFC/RESEND 01/22] arm: introduce ARCH_THUNDERX

Hi Suneel,

Quoted 4 lines · Chandrakala Chavva

Tim,

It was scheduled to post the patches on August 15th, it got delayed as Suneel got sick, he will post in 2 weeks.

Hope you are fine again. Do you have an update about the patches?

Best regards,
Matthias

Quoted 31 lines

Chandra
________________________________
From: Tim Harvey <[email protected]>
Sent: Monday, August 26, 2019 10:54:34 AM
To: Suneel Garapati <[email protected]>
Cc: Matthias Brugger <[email protected]>; Chandrakala Chavva <[email protected]>; prasun.kapoor at cavium.com <[email protected]>; Sergey Temerkhanov <[email protected]>; u-boot <[email protected]>; chandrakala.chavva at cavium.com <[email protected]>; Zi Shen Lim <[email protected]>; Maen Suleiman <[email protected]>; Aaron Williams <[email protected]>; Chris Packham <[email protected]>
Subject: [EXT] Re: [U-Boot] [RFC/RESEND 01/22] arm: introduce ARCH_THUNDERX

External Email

----------------------------------------------------------------------

Quoted 5 lines · Suneel Garapati

Hi Matthias,

Hard deadline is Aug 15th, so you should see first series before that.

Suneel,

Update? I'm really wishing my patches posted last March were considered instead of all of this waiting.

Regards,

Tim
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#13 lore raw

[U-Boot] [EXT] Re: [RFC/RESEND 01/22] arm: introduce ARCH_THUNDERX

Hi Matthias,

Thank you for your concern. I picked up things last week. So will post by this weekend.
Apologies for the delay.

Regards,
Suneel

Quoted 45 lines · Matthias Brugger

Hi Suneel,

Quoted 4 lines · Chandrakala Chavva

Tim,

It was scheduled to post the patches on August 15th, it got delayed as Suneel got sick, he will post in 2 weeks.

Hope you are fine again. Do you have an update about the patches?

Best regards,
Matthias

Quoted 31 lines

Chandra
________________________________
From: Tim Harvey <[email protected]>
Sent: Monday, August 26, 2019 10:54:34 AM
To: Suneel Garapati <[email protected]>
Cc: Matthias Brugger <[email protected]>; Chandrakala Chavva <[email protected]>; prasun.kapoor at cavium.com <[email protected]>; Sergey Temerkhanov <[email protected]>; u-boot <[email protected]>; chandrakala.chavva at cavium.com <[email protected]>; Zi Shen Lim <[email protected]>; Maen Suleiman <[email protected]>; Aaron Williams <[email protected]>; Chris Packham <[email protected]>
Subject: [EXT] Re: [U-Boot] [RFC/RESEND 01/22] arm: introduce ARCH_THUNDERX

External Email

----------------------------------------------------------------------

Quoted 5 lines · Suneel Garapati

Hi Matthias,

Hard deadline is Aug 15th, so you should see first series before that.

Suneel,

Update? I'm really wishing my patches posted last March were considered instead of all of this waiting.

Regards,

Tim
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#14 lore raw

[U-Boot] [EXT] Re: [RFC/RESEND 01/22] arm: introduce ARCH_THUNDERX

Hi Suneel,

Quoted 5 lines · Suneel Garapati

Hi Matthias,

Thank you for your concern. I picked up things last week. So will post by this weekend.
Apologies for the delay.

Any update on this? It's a long time since you said you want to provide the patches, is there anything I can help you with?
I have access to the HW, if you want me to test code etc.

Regards,
Matthias

Quoted 55 lines

Regards,
Suneel

Quoted 6 lines · Matthias Brugger

Hi Suneel,

Quoted 2 lines · Chandrakala Chavva

Tim,

Quoted 39 lines
Quoted 2 lines

It was scheduled to post the patches on August 15th, it got delayed as Suneel got sick, he will post in 2 weeks.

Hope you are fine again. Do you have an update about the patches?

Best regards,
Matthias

Quoted 31 lines

Chandra
________________________________
From: Tim Harvey <[email protected]>
Sent: Monday, August 26, 2019 10:54:34 AM
To: Suneel Garapati <[email protected]>
Cc: Matthias Brugger <[email protected]>; Chandrakala Chavva <[email protected]>; prasun.kapoor at cavium.com <[email protected]>; Sergey Temerkhanov <[email protected]>; u-boot <[email protected]>; chandrakala.chavva at cavium.com <[email protected]>; Zi Shen Lim <[email protected]>; Maen Suleiman <[email protected]>; Aaron Williams <[email protected]>; Chris Packham <[email protected]>
Subject: [EXT] Re: [U-Boot] [RFC/RESEND 01/22] arm: introduce ARCH_THUNDERX

External Email

----------------------------------------------------------------------

Quoted 5 lines · Suneel Garapati

Hi Matthias,

Hard deadline is Aug 15th, so you should see first series before that.

Suneel,

Update? I'm really wishing my patches posted last March were considered instead of all of this waiting.

Regards,

Tim
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#15 lore raw

[U-Boot] [EXT] Re: [RFC/RESEND 01/22] arm: introduce ARCH_THUNDERX

Hi Matthias,

Thanks for your patience. Sorry for the delay.

I will post the patch-set tomorrow.

Regards,
Suneel

Quoted 81 lines · On Fri, Sep 27, 2019 at 01:59 Matthias Brugger <[email protected]> wrote:

Hi Suneel,

Quoted 5 lines · Suneel Garapati

Hi Matthias,

Thank you for your concern. I picked up things last week. So will post by this weekend.
Apologies for the delay.

Any update on this? It's a long time since you said you want to provide the patches, is there anything I can help you with?
I have access to the HW, if you want me to test code etc.

Regards,
Matthias

Quoted 5 lines

Regards,
Suneel

On Mon, Sep 2, 2019 at 7:19 AM Matthias Brugger <[email protected]>

Quoted 7 lines · wrote:
Quoted 7 lines

Hi Suneel,

Quoted 3 lines · Chandrakala Chavva

Tim,

It was scheduled to post the patches on August 15th, it got delayed as

Suneel got sick, he will post in 2 weeks.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Hope you are fine again. Do you have an update about the patches?

Best regards,
Matthias

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Chandra
________________________________
From: Tim Harvey <[email protected]>
Sent: Monday, August 26, 2019 10:54:34 AM
To: Suneel Garapati <[email protected]>
Cc: Matthias Brugger <[email protected]>; Chandrakala Chavva <

cchavva at marvell.com>; prasun.kapoor at cavium.com <[email protected]>; Sergey Temerkhanov <[email protected]>; u-boot <[email protected]>; chandrakala.chavva at cavium.com <[email protected]>; Zi Shen Lim <[email protected]>; Maen Suleiman <[email protected]>; Aaron Williams <[email protected]>; Chris Packham <[email protected]>

Quoted 1 line
Quoted 1 line
Quoted 1 line

Subject: [EXT] Re: [U-Boot] [RFC/RESEND 01/22] arm: introduce

ARCH_THUNDERX

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

External Email

----------------------------------------------------------------------
On Wed, Jul 31, 2019 at 5:32 PM Suneel Garapati <

Quoted 24 lines · suneelglinux at gmail.com> wrote:
Quoted 11 lines
Quoted 11 lines
Quoted 5 lines

Hi Matthias,

Hard deadline is Aug 15th, so you should see first series before that.

Suneel,

Update? I'm really wishing my patches posted last March were considered instead of all of this waiting.

Quoted 8 lines
Quoted 8 lines

Regards,

Tim
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

author
#16 lore raw

[U-Boot] [EXT] Re: [RFC/RESEND 01/22] arm: introduce ARCH_THUNDERX

Quoted 7 lines · Suneel Garapati

Hi Matthias,

Thanks for your patience. Sorry for the delay.

I will post the patch-set tomorrow.

Suneel,

I haven't seen anything yet but I'm happy to test this on our Newport boards running on CN8020/CN8030. We've been waiting quite a while.

Is there some hold-up with posting a series? Post early and often as people say!

I know Aaron has posted some info and questions regarding Octeon support but I assume you're working on OcteonTX (thunderx) which perhaps doesn't have that much overlap?

Regards,

Tim

#17 lore raw

[U-Boot] [EXT] Re: [RFC/RESEND 01/22] arm: introduce ARCH_THUNDERX

Thanks Tim, sent the series.

Regards,
Suneel

Quoted 24 lines · Tim Harvey
Quoted 7 lines · Suneel Garapati

Hi Matthias,

Thanks for your patience. Sorry for the delay.

I will post the patch-set tomorrow.

Suneel,

I haven't seen anything yet but I'm happy to test this on our Newport boards running on CN8020/CN8030. We've been waiting quite a while.

Is there some hold-up with posting a series? Post early and often as people say!

I know Aaron has posted some info and questions regarding Octeon support but I assume you're working on OcteonTX (thunderx) which perhaps doesn't have that much overlap?

Regards,

Tim

author
#18 lore raw

PATCH 2/22 arm: add thunderx_81xx

In reply to Tim Harvey

The thunderx-81xx is a device-tree implementation supporting the Cavium Octeon-TX CN80xx/CN81xx SoC which combines 64bit ARM cores with thunderx peripherals.

---
 arch/arm/dts/Makefile           |   1 +
 arch/arm/dts/thunderx-81xx.dts  |  36 +++
 arch/arm/dts/thunderx-81xx.dtsi | 440 ++++++++++++++++++++++++++++++++
 board/cavium/thunderx/Kconfig   |   4 +
 configs/thunderx_81xx_defconfig |  29 +++
 include/configs/thunderx_81xx.h |  71 ++++++
 6 files changed, 581 insertions(+)
 create mode 100644 arch/arm/dts/thunderx-81xx.dts
 create mode 100644 arch/arm/dts/thunderx-81xx.dtsi
 create mode 100644 configs/thunderx_81xx_defconfig
 create mode 100644 include/configs/thunderx_81xx.h
arch/arm/dts/Makefile +1 -0
index 87ccd96596..64e1ee77d0 100644
@@ -193,6 +193,7 @@ dtb-$(CONFIG_AM43XX) += am437x-gp-evm.dtb am437x-sk-evm.dtb	\
 	am4372-generic.dtb
 dtb-$(CONFIG_TI816X) += dm8168-evm.dtb
 dtb-$(CONFIG_THUNDERX_88XX) += thunderx-88xx.dtb
+dtb-$(CONFIG_THUNDERX_81XX) += thunderx-81xx.dtb
 
 dtb-$(CONFIG_ARCH_SOCFPGA) +=				\
 	socfpga_arria5_socdk.dtb			\
arch/arm/dts/thunderx-81xx.dts new file +36 -0
new file mode 100644
index 0000000000..d065a36f96
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0+ OR X11
+/*
+ * Cavium Thunder DTS file - Thunder board description
+ *
+ * Copyright (C) 2018, Cavium Inc.
+ *
+ */
+
+/dts-v1/;
+
+/include/ "thunderx-81xx.dtsi"
+
+/ {
+	model = "Cavium ThunderX CN81XX board";
+	compatible = "cavium,thunder-81xx";
+
+	aliases {
+		serial0 = &uaa0;
+		serial1 = &uaa1;
+		serial2 = &uaa2;
+		serial3 = &uaa3;
+		i2c0 = &i2c_9_0;
+		i2c1 = &i2c_9_1;
+		spi0 = &spi_7_0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory at 0 {
+		device_type = "memory";
+		reg = <0x0 0x01400000 0x0 0x7EC00000>;
+		numa-node-id = <0>;
+	};
+};
arch/arm/dts/thunderx-81xx.dtsi new file +440 -0

440 lines not on this page · raw message

board/cavium/thunderx/Kconfig +4 -0
index 5fa367ac35..16df1a9fc2 100644
@@ -19,11 +19,15 @@ choice
 config THUNDERX_88XX
 	bool "ThunderX 88xx family"
 
+config THUNDERX_81XX
+	bool "ThunderX 81xx family"
+
 endchoice
 
 config SYS_CONFIG_NAME
 	string
 	default "thunderx_88xx" if THUNDERX_88XX
+	default "thunderx_81xx" if THUNDERX_81XX
 
 config CMD_ATF
 	bool "Enable ATF query commands"
configs/thunderx_81xx_defconfig new file +29 -0
new file mode 100644
index 0000000000..4f6b4ad18c
@@ -0,0 +1,29 @@
+CONFIG_ARM=y
+CONFIG_ARCH_THUNDERX=y
+CONFIG_SYS_TEXT_BASE=0x00500000
+CONFIG_DEBUG_UART_BASE=0x87e028000000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_IDENT_STRING=" for Cavium Thunder CN81XX ARM v8 Multi-Core"
+CONFIG_THUNDERX_81XX=y
+CONFIG_DEBUG_UART=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_BOOTDELAY=5
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyAMA0,115200n8 earlycon=pl011,0x87e028000000 debug maxcpus=4 rootwait rw root=/dev/mmcblk0p2 coherent_pool=16M"
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="ThunderX_81XX> "
+# CONFIG_CMD_EXPORTENV is not set
+# CONFIG_CMD_IMPORTENV is not set
+# CONFIG_CMD_EDITENV is not set
+# CONFIG_CMD_SAVEENV is not set
+# CONFIG_CMD_ENV_EXISTS is not set
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_NET is not set
+CONFIG_DEFAULT_DEVICE_TREE="thunderx-81xx"
+CONFIG_DM=y
+# CONFIG_MMC is not set
+CONFIG_DM_SERIAL=y
+CONFIG_DEBUG_UART_PL011=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
include/configs/thunderx_81xx.h new file +71 -0

71 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#19 lore raw

PATCH 3/22 thunderx: add FDT support

In reply to Tim Harvey

The thunderx boards use the Cavium Bringup and Diagnostics Kit (BDK) as a secondary program loader (SPL). This initial boot firmware loads the device-tree and passes it to the next layer of software in X1.

---
 arch/arm/mach-thunderx/Makefile        |  2 +-
 arch/arm/mach-thunderx/fdt.c           | 50 ++++++++++++++++++++++++++
 arch/arm/mach-thunderx/lowlevel_init.S | 31 ++++++++++++++++
 board/cavium/thunderx/thunderx.c       | 12 +++++--
 4 files changed, 92 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-thunderx/fdt.c
 create mode 100644 arch/arm/mach-thunderx/lowlevel_init.S
arch/arm/mach-thunderx/Makefile +1 -1
index 34b6ecc2f9..fb457cb3e0 100644
@@ -1,2 +1,2 @@
 # SPDX-License-Identifier: GPL-2.0+
-obj-y	:= atf.o
+obj-y	:= atf.o lowlevel_init.o fdt.o
arch/arm/mach-thunderx/fdt.c new file +50 -0

50 lines not on this page · raw message

arch/arm/mach-thunderx/lowlevel_init.S new file +31 -0
new file mode 100644
index 0000000000..fb81ac4fd0
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier:	GPL-2.0+
+/*
+ * Copyright (C) 2018, Cavium Inc.
+ */
+
+#include <linux/linkage.h>
+#include <asm/macro.h>
+
+.align 8
+.global fdt_base_addr
+fdt_base_addr:
+	.dword 0x0
+
+.global save_boot_params
+save_boot_params:
+	/* Read FDT base from x1 register passed by ATF */
+	adr	x21, fdt_base_addr
+	str	x1, [x21]
+
+	/* Returns */
+	b	save_boot_params_ret
+
+ENTRY(lowlevel_init)
+	mov	x29, lr			/* Save LR */
+
+	/* any lowlevel init should go here */
+
+	mov	lr, x29			/* Restore LR */
+	ret
+ENDPROC(lowlevel_init)
+
board/cavium/thunderx/thunderx.c +10 -2
index 2b80dc56f1..57dce5aee0 100644
@@ -5,8 +5,9 @@
 
 #include <common.h>
 #include <dm.h>
-#include <malloc.h>
 #include <errno.h>
+#include <fdt_support.h>
+#include <malloc.h>
 #include <linux/compiler.h>
 
 #include <asm/arch-thunderx/atf.h>
@@ -38,7 +39,10 @@ U_BOOT_DEVICE(thunderx_serial1) = {
 	.name = "serial_pl01x",
 	.platdata = &serial1,
 };
-#endif
+#else
+/* From lowlevel_init.S */
+extern unsigned long fdt_base_addr;
+#endif // !CONFIG_IS_ENABLED(OF_CONTROL)
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -70,6 +74,10 @@ struct mm_region *mem_map = thunderx_mem_map;
 
 int board_init(void)
 {
+#if CONFIG_IS_ENABLED(OF_CONTROL)
+	ulong fdt_addr = (ulong)fdt_base_addr;
+	set_working_fdt_addr(fdt_addr);
+#endif
 	return 0;
 }
 
Signature · 1 line
2.17.1
author
#20 lore raw

PATCH 4/22 thunderx: add thunderx register definitions and misc functions

In reply to Tim Harvey

Add Cavium Thunderx common registers, structures, and helper functions

---
 arch/arm/include/asm/arch-thunderx/thunderx.h | 300 ++++++++++++++++++
 arch/arm/mach-thunderx/Makefile               |   2 +-
 arch/arm/mach-thunderx/misc.c                 |  33 ++
 3 files changed, 334 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/arch-thunderx/thunderx.h
 create mode 100644 arch/arm/mach-thunderx/misc.c
arch/arm/include/asm/arch-thunderx/thunderx.h new file +300 -0
new file mode 100644
index 0000000000..58f36c6cdc
@@ -0,0 +1,300 @@
+// SPDX-License-Identifier:	GPL-2.0+
+/*
+ * Copyright (C) 2018, Cavium Inc.
+ */
+#ifndef __THUNDERX_H__
+#define __THUNDERX_H__
+
+/* Registers */
+#define CAVM_RST_BOOT		0x87e006001600ll
+#define CAVM_MIO_FUS_DAT2	0x87e003001410ll
+#define CAVM_XCVX_RESET		0x87e0db000000ll
+
+/*
+ * Flag bits in top byte. The top byte of MIDR_EL1 is defined
+ * as ox43, the Cavium implementer code. In this number, bits
+ * 7,5,4 are defiend as zero. We use these bits to signal
+ * that revision numbers should be ignored. It isn't ideal
+ * that these are in the middle of an already defined field,
+ * but this keeps the model numbers as 32 bits
+ */
+#define __OM_IGNORE_REVISION		0x80000000
+#define __OM_IGNORE_MINOR_REVISION	0x20000000
+#define __OM_IGNORE_MODEL		0x10000000
+
+#define CAVIUM_CN88XX_PASS1_0	0x430f0a10
+#define CAVIUM_CN88XX_PASS1_1	0x430f0a11
+#define CAVIUM_CN88XX_PASS2_0	0x431f0a10
+#define CAVIUM_CN88XX_PASS2_1	0x431f0a11
+#define CAVIUM_CN88XX_PASS2_2	0x431f0a12
+#define CAVIUM_CN88XX		(CAVIUM_CN88XX_PASS1_0 | __OM_IGNORE_REVISION)
+#define CAVIUM_CN88XX_PASS1_X	(CAVIUM_CN88XX_PASS1_0 | __OM_IGNORE_MINOR_REVISION)
+#define CAVIUM_CN88XX_PASS2_X	(CAVIUM_CN88XX_PASS2_0 | __OM_IGNORE_MINOR_REVISION)
+
+#define CAVIUM_CN83XX_PASS1_0	0x430f0a30
+#define CAVIUM_CN83XX		(CAVIUM_CN83XX_PASS1_0 | __OM_IGNORE_REVISION)
+#define CAVIUM_CN83XX_PASS1_X	(CAVIUM_CN83XX_PASS1_0 | __OM_IGNORE_MINOR_REVISION)
+
+#define CAVIUM_CN81XX_PASS1_0	0x430f0a20
+#define CAVIUM_CN81XX		(CAVIUM_CN81XX_PASS1_0 | __OM_IGNORE_REVISION)
+#define CAVIUM_CN81XX_PASS1_X	(CAVIUM_CN81XX_PASS1_0 | __OM_IGNORE_MINOR_REVISION)
+
+#define CAVIUM_CN98XX_PASS1_0	0x430f0b10
+#define CAVIUM_CN98XX		(CAVIUM_CN98XX_PASS1_0 | __OM_IGNORE_REVISION)
+#define CAVIUM_CN98XX_PASS1_X	(CAVIUM_CN98XX_PASS1_0 | __OM_IGNORE_MINOR_REVISION)
+
+/* These match entire families of chips */
+#define CAVIUM_CN8XXX		(CAVIUM_CN88XX_PASS1_0 | __OM_IGNORE_MODEL)
+#define CAVIUM_CN9XXX		(CAVIUM_CN98XX_PASS1_0 | __OM_IGNORE_MODEL)
+
+static inline uint64_t cavium_get_model(void)
+{
+	uint64_t result;
+
+	__asm ("mrs %[rd],MIDR_EL1" : [rd] "=r" (result));
+
+	return result;
+}
+
+/**
+ * Return non-zero if the chip matched the passed model.
+ *
+ * @param arg_model One of the CAVIUM_* constants for chip models and passes
+ * @return Non-zero if match
+ */
+static inline int CAVIUM_IS_MODEL(uint32_t arg_model)
+{
+	const uint32_t FAMILY = 0xff00;		/* Bits 15:8 */
+	const uint32_t PARTNUM = 0xfff0;	/* Bits 15:4 */
+	const uint32_t VARIANT = 0xf00000;	/* Bits 23:20 */
+	const uint32_t REVISION = 0xf;		/* Bits 3:0 */
+
+	uint32_t my_model = cavium_get_model();
+	uint32_t mask;
+
+	if (arg_model & __OM_IGNORE_MODEL)
+		mask = FAMILY;
+	else if (arg_model & __OM_IGNORE_REVISION)
+		mask = PARTNUM;
+	else if (arg_model & __OM_IGNORE_MINOR_REVISION)
+		mask = PARTNUM | VARIANT;
+	else
+		mask = PARTNUM | VARIANT | REVISION;
+	return ((arg_model & mask) == (my_model & mask));
+}
+
+/**
+ * Register (RSL) rst_boot
+ *
+ * RST Boot Register
+ */
+union cavm_rst_boot
+{
+	u64 u;
+	struct cavm_rst_boot_s {
+#if __BYTE_ORDER == __BIG_ENDIAN /* Word 0 - Big Endian */
+		u64 chipkill:1;
+		u64 jtcsrdis:1;
+		u64 ejtagdis:1;
+		u64 trusted_mode:1;
+		u64 ckill_ppdis:1;
+		u64 jt_tstmode:1;
+		u64 vrm_err:1;
+		u64 dis_huk:1;
+		u64 dis_scan:1;
+		u64 reserved_47_54:8;
+		u64 c_mul:7;
+		u64 reserved_39:1;
+		u64 pnr_mul:6;
+		u64 lboot_oci:3;
+		u64 lboot_pf_flr:4;
+		u64 lboot_ckill:1;
+		u64 lboot_jtg:1;
+		u64 lboot_ext45:6;
+		u64 lboot_ext23:6;
+		u64 lboot:10;
+		u64 rboot:1;
+		u64 rboot_pin:1;
+#else /* Word 0 - Little Endian */
+		u64 rboot_pin:1;
+		u64 rboot:1;
+		u64 lboot:10;
+		u64 lboot_ext23:6;
+		u64 lboot_ext45:6;
+		u64 lboot_jtg:1;
+		u64 lboot_ckill:1;
+		u64 lboot_pf_flr:4;
+		u64 lboot_oci:3;
+		u64 pnr_mul:6;
+		u64 reserved_39:1;
+		u64 c_mul:7;
+		u64 reserved_47_54:8;
+		u64 dis_scan:1;
+		u64 dis_huk:1;
+		u64 vrm_err:1;
+		u64 jt_tstmode:1;
+		u64 ckill_ppdis:1;
+		u64 trusted_mode:1;
+		u64 ejtagdis:1;
+		u64 jtcsrdis:1;
+		u64 chipkill:1;
+#endif /* Word 0 - End */
+	} s;
+	struct cavm_rst_boot_cn81xx {
+#if __BYTE_ORDER == __BIG_ENDIAN /* Word 0 - Big Endian */
+		u64 chipkill:1;
+		u64 jtcsrdis:1;
+		u64 ejtagdis:1;
+		u64 trusted_mode:1;
+		u64 ckill_ppdis:1;
+		u64 jt_tstmode:1;
+		u64 vrm_err:1;
+		u64 dis_huk:1;
+		u64 dis_scan:1;
+		u64 reserved_47_54:8;
+		u64 c_mul:7;
+		u64 reserved_39:1;
+		u64 pnr_mul:6;
+		u64 lboot_oci:3;
+		u64 reserved_26_29:4;
+		u64 lboot_ckill:1;
+		u64 lboot_jtg:1;
+		u64 lboot_ext45:6;
+		u64 lboot_ext23:6;
+		u64 lboot:10;
+		u64 rboot:1;
+		u64 rboot_pin:1;
+#else /* Word 0 - Little Endian */
+		u64 rboot_pin:1;
+		u64 rboot:1;
+		u64 lboot:10;
+		u64 lboot_ext23:6;
+		u64 lboot_ext45:6;
+		u64 lboot_jtg:1;
+		u64 lboot_ckill:1;
+		u64 reserved_26_29:4;
+		u64 lboot_oci:3;
+		u64 pnr_mul:6;
+		u64 reserved_39:1;
+		u64 c_mul:7;
+		u64 reserved_47_54:8;
+		u64 dis_scan:1;
+		u64 dis_huk:1;
+		u64 vrm_err:1;
+		u64 jt_tstmode:1;
+		u64 ckill_ppdis:1;
+		u64 trusted_mode:1;
+		u64 ejtagdis:1;
+		u64 jtcsrdis:1;
+		u64 chipkill:1;
+#endif /* Word 0 - End */
+	} cn81xx;
+	struct cavm_rst_boot_cn88xx {
+#if __BYTE_ORDER == __BIG_ENDIAN /* Word 0 - Big Endian */
+		u64 chipkill:1;
+		u64 jtcsrdis:1;
+		u64 ejtagdis:1;
+		u64 trusted_mode:1;
+		u64 ckill_ppdis:1;
+		u64 jt_tstmode:1;
+		u64 vrm_err:1;
+		u64 dis_huk:1;
+		u64 dis_scan:1;
+		u64 reserved_47_54:8;
+		u64 c_mul:7;
+		u64 reserved_39:1;
+		u64 pnr_mul:6;
+		u64 lboot_oci:3;
+		u64 reserved_26_29:4;
+		u64 reserved_24_25:2;
+		u64 lboot_ext45:6;
+		u64 lboot_ext23:6;
+		u64 lboot:10;
+		u64 rboot:1;
+		u64 rboot_pin:1;
+#else /* Word 0 - Little Endian */
+		u64 rboot_pin:1;
+		u64 rboot:1;
+		u64 lboot:10;
+		u64 lboot_ext23:6;
+		u64 lboot_ext45:6;
+		u64 reserved_24_25:2;
+		u64 reserved_26_29:4;
+		u64 lboot_oci:3;
+		u64 pnr_mul:6;
+		u64 reserved_39:1;
+		u64 c_mul:7;
+		u64 reserved_47_54:8;
+		u64 dis_scan:1;
+		u64 dis_huk:1;
+		u64 vrm_err:1;
+		u64 jt_tstmode:1;
+		u64 ckill_ppdis:1;
+		u64 trusted_mode:1;
+		u64 ejtagdis:1;
+		u64 jtcsrdis:1;
+		u64 chipkill:1;
+#endif /* Word 0 - End */
+	} cn88xx;
+	struct cavm_rst_boot_cn83xx {
+#if __BYTE_ORDER == __BIG_ENDIAN /* Word 0 - Big Endian */
+		u64 chipkill:1;
+		u64 jtcsrdis:1;
+		u64 ejtagdis:1;
+		u64 trusted_mode:1;
+		u64 ckill_ppdis:1;
+		u64 jt_tstmode:1;
+		u64 vrm_err:1;
+		u64 dis_huk:1;
+		u64 dis_scan:1;
+		u64 reserved_47_54:8;
+		u64 c_mul:7;
+		u64 reserved_39:1;
+		u64 pnr_mul:6;
+		u64 lboot_oci:3;
+		u64 lboot_pf_flr:4;
+		u64 lboot_ckill:1;
+		u64 lboot_jtg:1;
+		u64 lboot_ext45:6;
+		u64 lboot_ext23:6;
+		u64 lboot:10;
+		u64 rboot:1;
+		u64 rboot_pin:1;
+#else /* Word 0 - Little Endian */
+		u64 rboot_pin:1;
+		u64 rboot:1;
+		u64 lboot:10;
+		u64 lboot_ext23:6;
+		u64 lboot_ext45:6;
+		u64 lboot_jtg:1;
+		u64 lboot_ckill:1;
+		u64 lboot_pf_flr:4;
+		u64 lboot_oci:3;
+		u64 pnr_mul:6;
+		u64 reserved_39:1;
+		u64 c_mul:7;
+		u64 reserved_47_54:8;
+		u64 dis_scan:1;
+		u64 dis_huk:1;
+		u64 vrm_err:1;
+		u64 jt_tstmode:1;
+		u64 ckill_ppdis:1;
+		u64 trusted_mode:1;
+		u64 ejtagdis:1;
+		u64 jtcsrdis:1;
+		u64 chipkill:1;
+#endif /* Word 0 - End */
+	} cn83xx;
+};
+
+/**
+ * Returns the I/O clock speed in Hz
+ */
+u64 thunderx_get_io_clock(void);
+
+/**
+ * Returns the core clock speed in Hz
+ */
+u64 thunderx_get_core_clock(void);
+
+#endif
arch/arm/mach-thunderx/Makefile +1 -1
index fb457cb3e0..b3328f4e08 100644
@@ -1,2 +1,2 @@
 # SPDX-License-Identifier: GPL-2.0+
-obj-y	:= atf.o lowlevel_init.o fdt.o
+obj-y	:= atf.o lowlevel_init.o fdt.o misc.o
arch/arm/mach-thunderx/misc.c new file +33 -0
new file mode 100644
index 0000000000..25ac154a9a
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier:     GPL-2.0+
+/*
+ * Copyright (C) 2018, Cavium Inc.
+ */
+
+#include <common.h>
+
+#include <asm/arch-thunderx/thunderx.h>
+#include <asm/io.h>
+
+/**
+ * Returns the I/O clock speed in Hz
+ */
+u64 thunderx_get_io_clock(void)
+{
+	union cavm_rst_boot rst_boot;
+
+	rst_boot.u = readq(CAVM_RST_BOOT);
+
+	return rst_boot.s.pnr_mul * PLL_REF_CLK;
+}
+
+/**
+ * Returns the core clock speed in Hz
+ */
+u64 thunderx_get_core_clock(void)
+{
+	union cavm_rst_boot rst_boot;
+
+	rst_boot.u = readq(CAVM_RST_BOOT);
+
+	return rst_boot.s.c_mul * PLL_REF_CLK;
+}
Signature · 1 line
2.17.1
author
#21 lore raw

PATCH 5/22 thunderx: move DRAM prints to debug

In reply to Tim Harvey
---
 board/cavium/thunderx/thunderx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/cavium/thunderx/thunderx.c +2 -2
index 57dce5aee0..0cc03a463f 100644
@@ -92,13 +92,13 @@ int dram_init(void)
 	ssize_t dram_size;
 	int node;
 
-	printf("Initializing\nNodes in system: %zd\n", node_count);
+	debug("Initializing\nNodes in system: %zd\n", node_count);
 
 	gd->ram_size = 0;
 
 	for (node = 0; node < node_count; node++) {
 		dram_size = atf_dram_size(node);
-		printf("Node %d: %zd MBytes of DRAM\n", node, dram_size >> 20);
+		debug("Node %d: %zd MBytes of DRAM\n", node, dram_size >> 20);
 		gd->ram_size += dram_size;
 	}
 
Signature · 1 line
2.17.1
author
#22 lore raw

PATCH 6/22 dm: pci: add PCI SR-IOV EA support

In reply to Tim Harvey

Add Single Root I/O Virtualization (SR-IOV) and Enhanced Allocation support

---
 arch/x86/cpu/baytrail/cpu.c  |   3 +-
 drivers/ata/ahci.c           |   8 +-
 drivers/i2c/designware_i2c.c |   4 +-
 drivers/i2c/intel_i2c.c      |   3 +-
 drivers/mmc/pci_mmc.c        |   3 +-
 drivers/net/e1000.c          |   5 +-
 drivers/net/pch_gbe.c        |   3 +-
 drivers/nvme/nvme.c          |   3 +-
 drivers/pci/pci-uclass.c     | 304 +++++++++++++++++++++++++++++++++--
 drivers/usb/host/ehci-pci.c  |   3 +-
 drivers/usb/host/xhci-pci.c  |   3 +-
 include/pci.h                |  56 ++++++-
 12 files changed, 370 insertions(+), 28 deletions(-)
arch/x86/cpu/baytrail/cpu.c +2 -1
index 56e98131d7..cc3eae6cb2 100644
@@ -46,6 +46,7 @@ int arch_cpu_init_dm(void)
 {
 	struct udevice *dev;
 	void *base;
+	size_t size;
 	int ret;
 	int i;
 
@@ -53,7 +54,7 @@ int arch_cpu_init_dm(void)
 	for (i = 0; i < 2; i++) {
 		ret = dm_pci_bus_find_bdf(PCI_BDF(0, 0x1e, 3 + i), &dev);
 		if (!ret) {
-			base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0,
+			base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, &size,
 					      PCI_REGION_MEM);
 			hsuart_clock_set(base);
 		}
drivers/ata/ahci.c +5 -3
index 5fafb63aeb..d6753f140d 100644
@@ -455,8 +455,9 @@ static int ahci_init_one(struct ahci_uc_priv *uc_priv, pci_dev_t dev)
 	uc_priv->udma_mask = 0x7f;	/*Fixme,assume to support UDMA6 */
 
 #if !defined(CONFIG_DM_SCSI)
+	size_t size;
 #ifdef CONFIG_DM_PCI
-	uc_priv->mmio_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_5,
+	uc_priv->mmio_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_5, &size,
 					      PCI_REGION_MEM);
 
 	/* Take from kernel:
@@ -467,7 +468,7 @@ static int ahci_init_one(struct ahci_uc_priv *uc_priv, pci_dev_t dev)
 	if (vendor == 0x197b)
 		dm_pci_write_config8(dev, 0x41, 0xa1);
 #else
-	uc_priv->mmio_base = pci_map_bar(dev, PCI_BASE_ADDRESS_5,
+	uc_priv->mmio_base = pci_map_bar(dev, PCI_BASE_ADDRESS_5, &size,
 					   PCI_REGION_MEM);
 
 	/* Take from kernel:
@@ -1189,8 +1190,9 @@ int ahci_probe_scsi(struct udevice *ahci_dev, ulong base)
 int ahci_probe_scsi_pci(struct udevice *ahci_dev)
 {
 	ulong base;
+	size_t size;
 
-	base = (ulong)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_5,
+	base = (ulong)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_5, &size,
 				     PCI_REGION_MEM);
 
 	return ahci_probe_scsi(ahci_dev, base);
drivers/i2c/designware_i2c.c +3 -1
index dbc3326b5a..bd6f4416ab 100644
@@ -540,8 +540,10 @@ static int designware_i2c_probe(struct udevice *bus)
 	if (device_is_on_pci_bus(bus)) {
 #ifdef CONFIG_DM_PCI
 		/* Save base address from PCI BAR */
+		size_t size;
 		priv->regs = (struct i2c_regs *)
-			dm_pci_map_bar(bus, PCI_BASE_ADDRESS_0, PCI_REGION_MEM);
+			dm_pci_map_bar(bus, PCI_BASE_ADDRESS_0, &size,
+				       PCI_REGION_MEM);
 #ifdef CONFIG_X86
 		/* Use BayTrail specific timing values */
 		priv->scl_sda_cfg = &byt_config;
drivers/i2c/intel_i2c.c +2 -1
index f5509fef16..f9de161356 100644
@@ -247,10 +247,11 @@ static int intel_i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
 static int intel_i2c_probe(struct udevice *dev)
 {
 	struct intel_i2c *priv = dev_get_priv(dev);
+	size_t size;
 	ulong base;
 
 	/* Save base address from PCI BAR */
-	priv->base = (ulong)dm_pci_map_bar(dev, PCI_BASE_ADDRESS_4,
+	priv->base = (ulong)dm_pci_map_bar(dev, PCI_BASE_ADDRESS_4, &size,
 					   PCI_REGION_IO);
 	base = priv->base;
 
drivers/mmc/pci_mmc.c +2 -1
index 182d41637f..84701713a7 100644
@@ -28,9 +28,10 @@ static int pci_mmc_probe(struct udevice *dev)
 	struct pci_mmc_plat *plat = dev_get_platdata(dev);
 	struct pci_mmc_priv *priv = dev_get_priv(dev);
 	struct sdhci_host *host = &priv->host;
+	size_t size;
 	int ret;
 
-	host->ioaddr = (void *)dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0,
+	host->ioaddr = (void *)dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, &size,
 					      PCI_REGION_MEM);
 	host->name = dev->name;
 	ret = sdhci_setup_cfg(&plat->cfg, host, 0, 0);
drivers/net/e1000.c +4 -1
index a34f697461..fbfb9052d8 100644
@@ -5501,6 +5501,9 @@ static int e1000_init_one(struct e1000_hw *hw, int cardnum, pci_dev_t devno,
 #endif
 {
 	u32 val;
+#ifdef CONFIG_DM_ETH
+	size_t size;
+#endif
 
 	/* Assign the passed-in values */
 #ifdef CONFIG_DM_ETH
@@ -5551,7 +5554,7 @@ static int e1000_init_one(struct e1000_hw *hw, int cardnum, pci_dev_t devno,
 	hw->eeprom_semaphore_present = true;
 #endif
 #ifdef CONFIG_DM_ETH
-	hw->hw_addr = dm_pci_map_bar(devno,	PCI_BASE_ADDRESS_0,
+	hw->hw_addr = dm_pci_map_bar(devno,	PCI_BASE_ADDRESS_0, &size,
 						PCI_REGION_MEM);
 #else
 	hw->hw_addr = pci_map_bar(devno,	PCI_BASE_ADDRESS_0,
drivers/net/pch_gbe.c +2 -1
index 2286dd07e9..3194221796 100644
@@ -434,6 +434,7 @@ static int pch_gbe_probe(struct udevice *dev)
 	struct pch_gbe_priv *priv;
 	struct eth_pdata *plat = dev_get_platdata(dev);
 	void *iobase;
+	size_t size;
 	int err;
 
 	/*
@@ -445,7 +446,7 @@ static int pch_gbe_probe(struct udevice *dev)
 
 	priv->dev = dev;
 
-	iobase = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_1, PCI_REGION_MEM);
+	iobase = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_1, &size, PCI_REGION_MEM);
 
 	plat->iobase = (ulong)iobase;
 	priv->mac_regs = (struct pch_gbe_regs *)iobase;
drivers/nvme/nvme.c +2 -1
index eb6fdeda50..49d8b12b2d 100644
@@ -768,12 +768,13 @@ static int nvme_bind(struct udevice *udev)
 static int nvme_probe(struct udevice *udev)
 {
 	int ret;
+	size_t size;
 	struct nvme_dev *ndev = dev_get_priv(udev);
 
 	ndev->instance = trailing_strtol(udev->name);
 
 	INIT_LIST_HEAD(&ndev->namespaces);
-	ndev->bar = dm_pci_map_bar(udev, PCI_BASE_ADDRESS_0,
+	ndev->bar = dm_pci_map_bar(udev, PCI_BASE_ADDRESS_0, &size,
 			PCI_REGION_MEM);
 	if (readl(&ndev->bar->csts) == -1) {
 		ret = -ENODEV;
drivers/pci/pci-uclass.c +289 -15

347 lines not on this page · raw message

drivers/usb/host/ehci-pci.c +2 -1
index 6150f3d888..db55d136b6 100644
@@ -26,6 +26,7 @@ static int ehci_pci_init(struct udevice *dev, struct ehci_hccr **ret_hccr,
 	struct ehci_pci_priv *priv = dev_get_priv(dev);
 	struct ehci_hccr *hccr;
 	struct ehci_hcor *hcor;
+	size_t size;
 	int ret;
 	u32 cmd;
 
@@ -34,7 +35,7 @@ static int ehci_pci_init(struct udevice *dev, struct ehci_hccr **ret_hccr,
 		return ret;
 
 	hccr = (struct ehci_hccr *)dm_pci_map_bar(dev,
-			PCI_BASE_ADDRESS_0, PCI_REGION_MEM);
+			PCI_BASE_ADDRESS_0, &size, PCI_REGION_MEM);
 	hcor = (struct ehci_hcor *)((uintptr_t) hccr +
 			HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
 
drivers/usb/host/xhci-pci.c +2 -1
index b995aef997..d42f06bc32 100644
@@ -16,10 +16,11 @@ static void xhci_pci_init(struct udevice *dev, struct xhci_hccr **ret_hccr,
 {
 	struct xhci_hccr *hccr;
 	struct xhci_hcor *hcor;
+	size_t size;
 	u32 cmd;
 
 	hccr = (struct xhci_hccr *)dm_pci_map_bar(dev,
-			PCI_BASE_ADDRESS_0, PCI_REGION_MEM);
+			PCI_BASE_ADDRESS_0, &size, PCI_REGION_MEM);
 	hcor = (struct xhci_hcor *)((uintptr_t) hccr +
 			HC_LENGTH(xhci_readl(&hccr->cr_capbase)));
 
include/pci.h +55 -1

83 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#23 lore raw

PATCH 7/22 fdt: add fdtdec_get_pci_bus_range

In reply to Tim Harvey
---
 include/fdtdec.h | 11 +++++++++++
 lib/fdtdec.c     | 13 +++++++++++++
 2 files changed, 24 insertions(+)
include/fdtdec.h +11 -0
index c26df50543..b56be097eb 100644
@@ -460,6 +460,17 @@ int fdtdec_get_pci_vendev(const void *blob, int node,
 int fdtdec_get_pci_bar32(struct udevice *dev, struct fdt_pci_addr *addr,
 			 u32 *bar);
 
+/**
+ * Look at the bus range property of a device node and return the pci bus
+ * range for this node.
+ * The property must hold one fdt_pci_addr with a lengh.
+ * @param blob		FDT blob
+ * @param node		node to examine
+ * @param res		the resource structure to return the bus range
+ */
+int fdtdec_get_pci_bus_range(const void *blob, int node,
+			     struct fdt_resource *res);
+
 /**
  * Look up a 32-bit integer property in a node and return it. The property
  * must have at least 4 bytes of data. The value of the first cell is
lib/fdtdec.c +13 -0
index a420ba1885..7f63b1a312 100644
@@ -305,6 +305,19 @@ int fdtdec_get_pci_bar32(struct udevice *dev, struct fdt_pci_addr *addr,
 
 	return 0;
 }
+
+int fdtdec_get_pci_bus_range(const void *blob, int node,
+			     struct fdt_resource *res)
+{
+	const u32 *values;
+	int len;
+	values = fdt_getprop(blob, node, "bus-range", &len);
+	if (!values || len < sizeof(*values) * 2)
+		return -EINVAL;
+	res->start = be32_to_cpup(values++);
+	res->end = be32_to_cpup(values);
+	return 0;
+}
 #endif
 
 uint64_t fdtdec_get_uint64(const void *blob, int node, const char *prop_name,
Signature · 1 line
2.17.1
author
#24 lore raw

PATCH 8/22 pci: add thunderx pci/ecam driver

In reply to Tim Harvey
---
 board/cavium/thunderx/Kconfig    |   4 +
 board/cavium/thunderx/thunderx.c |  16 ++--
 configs/thunderx_81xx_defconfig  |   6 ++
 configs/thunderx_88xx_defconfig  |   6 ++
 drivers/pci/Kconfig              |   9 ++
 drivers/pci/Makefile             |   1 +
 drivers/pci/pci_thunderx.c       | 160 +++++++++++++++++++++++++++++++
 include/pci_ids.h                |  15 +++
 8 files changed, 210 insertions(+), 7 deletions(-)
 create mode 100644 drivers/pci/pci_thunderx.c
board/cavium/thunderx/Kconfig +4 -0
index 16df1a9fc2..c840f9c1ed 100644
@@ -1,5 +1,9 @@
 if ARCH_THUNDERX
 
+config SYS_PCI_64BIT
+	bool
+	default y
+
 config SYS_CPU
 	string
 	default "armv8"
board/cavium/thunderx/thunderx.c +9 -7
index 0cc03a463f..28cf2aee22 100644
@@ -72,6 +72,15 @@ static struct mm_region thunderx_mem_map[] = {
 
 struct mm_region *mem_map = thunderx_mem_map;
 
+#ifdef CONFIG_BOARD_EARLY_INIT_R
+int board_early_init_r(void)
+{
+	pci_init();
+
+	return 0;
+}
+#endif
+
 int board_init(void)
 {
 #if CONFIG_IS_ENABLED(OF_CONTROL)
@@ -127,10 +136,3 @@ int board_eth_init(bd_t *bis)
 
 	return rc;
 }
-
-#ifdef CONFIG_PCI
-void pci_init_board(void)
-{
-	printf("DEBUG: PCI Init TODO *****\n");
-}
-#endif
configs/thunderx_81xx_defconfig +6 -0
index 4f6b4ad18c..3ec7d6cd4f 100644
@@ -12,6 +12,7 @@ CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyAMA0,115200n8 earlycon=pl011,0x87e028000000 debug maxcpus=4 rootwait rw root=/dev/mmcblk0p2 coherent_pool=16M"
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_BOARD_EARLY_INIT_R=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="ThunderX_81XX> "
 # CONFIG_CMD_EXPORTENV is not set
@@ -20,10 +21,15 @@ CONFIG_SYS_PROMPT="ThunderX_81XX> "
 # CONFIG_CMD_SAVEENV is not set
 # CONFIG_CMD_ENV_EXISTS is not set
 # CONFIG_CMD_FLASH is not set
+CONFIG_CMD_PCI=y
 # CONFIG_CMD_NET is not set
 CONFIG_DEFAULT_DEVICE_TREE="thunderx-81xx"
 CONFIG_DM=y
 # CONFIG_MMC is not set
+CONFIG_PCI=y
+CONFIG_DM_PCI=y
+CONFIG_DM_PCI_COMPAT=y
+CONFIG_PCI_THUNDERX=y
 CONFIG_DM_SERIAL=y
 CONFIG_DEBUG_UART_PL011=y
 CONFIG_DEBUG_UART_SKIP_INIT=y
configs/thunderx_88xx_defconfig +6 -0
index fe4643f52e..e30d549896 100644
@@ -12,6 +12,7 @@ CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyAMA0,115200n8 earlycon=pl011,0x87e024000000 debug maxcpus=48 rootwait rw root=/dev/sda2 coherent_pool=16M"
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_BOARD_EARLY_INIT_R=y
 CONFIG_HUSH_PARSER=y
 # CONFIG_AUTO_COMPLETE is not set
 CONFIG_SYS_PROMPT="ThunderX_88XX> "
@@ -21,10 +22,15 @@ CONFIG_SYS_PROMPT="ThunderX_88XX> "
 # CONFIG_CMD_SAVEENV is not set
 # CONFIG_CMD_ENV_EXISTS is not set
 # CONFIG_CMD_FLASH is not set
+CONFIG_CMD_PCI=y
 # CONFIG_CMD_NET is not set
 CONFIG_DEFAULT_DEVICE_TREE="thunderx-88xx"
 CONFIG_DM=y
 # CONFIG_MMC is not set
+CONFIG_PCI=y
+CONFIG_DM_PCI=y
+CONFIG_DM_PCI_COMPAT=y
+CONFIG_PCI_THUNDERX=y
 CONFIG_DM_SERIAL=y
 CONFIG_DEBUG_UART_PL011=y
 CONFIG_DEBUG_UART_SKIP_INIT=y
drivers/pci/Kconfig +9 -0
index f59803dbd6..7be97addc4 100644
@@ -90,6 +90,15 @@ config PCI_TEGRA
 	  with a total of 5 lanes. Some boards require this for Ethernet
 	  support to work (e.g. beaver, jetson-tk1).
 
+config PCI_THUNDERX
+	bool "ThunderX PCI support"
+	depends on ARCH_THUNDERX
+	select PCIE_ECAM_GENERIC
+	help
+	  Enable support for the Cavium ThunderX SoC family PCI controllers.
+	  These controllers provide PCI configuration access to all on-board
+	  peripherals so it should only be disabled for testing purposes
+
 config PCI_XILINX
 	bool "Xilinx AXI Bridge for PCI Express"
 	depends on DM_PCI
drivers/pci/Makefile +1 -0
index 4923641895..0974e77789 100644
@@ -31,6 +31,7 @@ obj-$(CONFIG_PCI_TEGRA) += pci_tegra.o
 obj-$(CONFIG_PCI_AARDVARK) += pci-aardvark.o
 obj-$(CONFIG_PCIE_DW_MVEBU) += pcie_dw_mvebu.o
 obj-$(CONFIG_PCIE_LAYERSCAPE) += pcie_layerscape.o
+obj-$(CONFIG_PCI_THUNDERX) += pci_thunderx.o
 obj-$(CONFIG_PCIE_LAYERSCAPE) += pcie_layerscape_fixup.o
 obj-$(CONFIG_PCI_XILINX) += pcie_xilinx.o
 obj-$(CONFIG_PCIE_INTEL_FPGA) += pcie_intel_fpga.o
drivers/pci/pci_thunderx.c new file +160 -0

160 lines not on this page · raw message

include/pci_ids.h +15 -0
index fdda679cc0..948771271e 100644
@@ -3109,6 +3109,21 @@
 
 #define PCI_VENDOR_ID_3COM_2		0xa727
 
+#define PCI_VENDOR_ID_CAVIUM		0x177d
+#define PCI_DEVICE_ID_THUNDERX_NIC_VF_1	0x0011
+#define PCI_DEVICE_ID_THUNDERX_GPIO	0xa00a
+#define PCI_DEVICE_ID_THUNDERX_SPI	0xa00b
+#define PCI_DEVICE_ID_THUNDERX_MMC	0xa010
+#define PCI_DEVICE_ID_THUNDERX_TWSI	0xa012
+#define PCI_DEVICE_ID_THUNDERX_AHCI	0xa01c
+#define PCI_DEVICE_ID_THUNDERX_NIC_PF	0xa01e
+#define PCI_DEVICE_ID_THUNDERX_SMI	0xa02b
+#define PCI_DEVICE_ID_THUNDERX_BGX	0xa026
+#define PCI_DEVICE_ID_THUNDERX_NIC_VF	0xa034
+#define PCI_DEVICE_ID_THUNDERX_RGX	0xa054
+#define PCI_DEVICE_ID_THUNDERX_XHCI	0xa055
+#define PCI_DEVICE_ID_THUNDERX_NIC_XCV  0xa056
+
 #define PCI_VENDOR_ID_DIGIUM		0xd161
 #define PCI_DEVICE_ID_DIGIUM_HFC4S	0xb410
 
Signature · 1 line
2.17.1
author
#25 lore raw

PATCH 9/22 pci: fix pce enumeration on thunderx

In reply to Tim Harvey

TODO:
- determine proper workaround for disabling found_multi
- determine proper workaround for decode_regions

---
 drivers/pci/pci-uclass.c | 12 ++++++++++++
 include/pci.h            |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
drivers/pci/pci-uclass.c +12 -0
index 0720ffe5b4..845e280a60 100644
@@ -783,8 +783,11 @@ int pci_bind_bus_devices(struct udevice *bus)
 		struct udevice *dev;
 		ulong class;
 
+/* causes devices beyond the internal bridge on the Octeon TX to not enum */
+#if !defined(CONFIG_ARCH_THUNDERX)
 		if (!PCI_FUNC(bdf))
 			found_multi = false;
+#endif
 		if (PCI_FUNC(bdf) && !found_multi)
 			continue;
 		/* Check only the first access, we don't expect problems */
@@ -910,6 +913,9 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
 			continue;
 		}
 
+#if defined(CONFIG_ARCH_THUNDERX)
+		pos = hose->region_count++;
+#else
 		pos = -1;
 		for (i = 0; i < hose->region_count; i++) {
 			if (hose->regions[i].flags == type)
@@ -917,10 +923,16 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
 		}
 		if (pos == -1)
 			pos = hose->region_count++;
+#endif
 		debug(" - type=%d, pos=%d\n", type, pos);
 		pci_set_region(hose->regions + pos, pci_addr, addr, size, type);
 	}
 
+	if (hose->region_count == MAX_PCI_REGIONS) {
+		printf("PCI region count reached limit, cannot add local memory region");
+		return;
+	}
+
 	/* Add a region for our local memory */
 #ifdef CONFIG_NR_DRAM_BANKS
 	bd_t *bd = gd->bd;
include/pci.h +1 -1
index 033d5adf2a..38d44d5b67 100644
@@ -567,7 +567,7 @@ extern void pci_cfgfunc_do_nothing(struct pci_controller* hose, pci_dev_t dev,
 extern void pci_cfgfunc_config_device(struct pci_controller* hose, pci_dev_t dev,
 				      struct pci_config_table *);
 
-#define MAX_PCI_REGIONS		7
+#define MAX_PCI_REGIONS		10
 
 #define INDIRECT_TYPE_NO_PCIE_LINK	1
 
Signature · 1 line
2.17.1
author
#26 lore raw

PATCH 10/22 arm: include 64bit io accessors

In reply to Tim Harvey
---
 arch/arm/include/asm/io.h | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/include/asm/io.h +8 -0
index 5df74728de..5699e6f23a 100644
@@ -172,6 +172,14 @@ static inline void __raw_readsl(unsigned long addr, void *data, int longlen)
 #define clrsetbits(type, addr, clear, set) \
 	out_##type((addr), (in_##type(addr) & ~(clear)) | (set))
 
+#define clrbits_be64(addr, clear) clrbits(be64, addr, clear)
+#define setbits_be64(addr, set) setbits(be64, addr, set)
+#define clrsetbits_be64(addr, clear, set) clrsetbits(be64, addr, clear, set)
+
+#define clrbits_le64(addr, clear) clrbits(le64, addr, clear)
+#define setbits_le64(addr, set) setbits(le64, addr, set)
+#define clrsetbits_le64(addr, clear, set) clrsetbits(le64, addr, clear, set)
+
 #define clrbits_be32(addr, clear) clrbits(be32, addr, clear)
 #define setbits_be32(addr, set) setbits(be32, addr, set)
 #define clrsetbits_be32(addr, clear, set) clrsetbits(be32, addr, clear, set)
Signature · 1 line
2.17.1
author
#27 lore raw

PATCH 11/22 gpio: add thunderx gpio driver

In reply to Tim Harvey
---
 configs/thunderx_81xx_defconfig |   4 +
 drivers/gpio/Kconfig            |   7 ++
 drivers/gpio/Makefile           |   1 +
 drivers/gpio/thunderx_gpio.c    | 189 ++++++++++++++++++++++++++++++++
 4 files changed, 201 insertions(+)
 create mode 100644 drivers/gpio/thunderx_gpio.c
configs/thunderx_81xx_defconfig +4 -0
index 3ec7d6cd4f..d07b0e5804 100644
@@ -21,10 +21,14 @@ CONFIG_SYS_PROMPT="ThunderX_81XX> "
 # CONFIG_CMD_SAVEENV is not set
 # CONFIG_CMD_ENV_EXISTS is not set
 # CONFIG_CMD_FLASH is not set
+CONFIG_CMD_GPIO=y
 CONFIG_CMD_PCI=y
 # CONFIG_CMD_NET is not set
 CONFIG_DEFAULT_DEVICE_TREE="thunderx-81xx"
 CONFIG_DM=y
+CONFIG_DM_GPIO=y
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
 # CONFIG_MMC is not set
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
drivers/gpio/Kconfig +7 -0
index 5cd8b34400..b34f66969a 100644
@@ -238,6 +238,13 @@ config PIC32_GPIO
 	help
 	  Say yes here to support Microchip PIC32 GPIOs.
 
+config THUNDERX_GPIO
+	bool "Cavium ThunderX GPIO driver"
+	depends on DM_GPIO
+	default y
+	help
+	  Say yes here to support Cavium ThunderX GPIOs.
+
 config STM32F7_GPIO
 	bool "ST STM32 GPIO driver"
 	depends on DM_GPIO && (STM32 || ARCH_STM32MP)
drivers/gpio/Makefile +1 -0
index f186120684..4c22c5f1d2 100644
@@ -54,6 +54,7 @@ obj-$(CONFIG_HIKEY_GPIO)	+= hi6220_gpio.o
 obj-$(CONFIG_HSDK_CREG_GPIO)	+= hsdk-creg-gpio.o
 obj-$(CONFIG_IMX_RGPIO2P)	+= imx_rgpio2p.o
 obj-$(CONFIG_PIC32_GPIO)	+= pic32_gpio.o
+obj-$(CONFIG_THUNDERX_GPIO)	+= thunderx_gpio.o
 obj-$(CONFIG_MVEBU_GPIO)	+= mvebu_gpio.o
 obj-$(CONFIG_MSM_GPIO)		+= msm_gpio.o
 obj-$(CONFIG_$(SPL_)PCF8575_GPIO)	+= pcf8575_gpio.o
drivers/gpio/thunderx_gpio.c new file +189 -0

189 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#28 lore raw

PATCH 12/22 i2c: add thunderx I2C driver

In reply to Tim Harvey
---
 configs/thunderx_81xx_defconfig |   2 +
 drivers/i2c/Kconfig             |   7 +
 drivers/i2c/Makefile            |   1 +
 drivers/i2c/thunderx_i2c.c      | 878 ++++++++++++++++++++++++++++++++
 include/configs/thunderx_81xx.h |   2 +
 5 files changed, 890 insertions(+)
 create mode 100644 drivers/i2c/thunderx_i2c.c
configs/thunderx_81xx_defconfig +2 -0
index d07b0e5804..e43aa9750d 100644
@@ -22,11 +22,13 @@ CONFIG_SYS_PROMPT="ThunderX_81XX> "
 # CONFIG_CMD_ENV_EXISTS is not set
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
 CONFIG_CMD_PCI=y
 # CONFIG_CMD_NET is not set
 CONFIG_DEFAULT_DEVICE_TREE="thunderx-81xx"
 CONFIG_DM=y
 CONFIG_DM_GPIO=y
+CONFIG_DM_I2C=y
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
 # CONFIG_MMC is not set
drivers/i2c/Kconfig +7 -0
index 1ef22e6bcd..0424b54eb4 100644
@@ -374,6 +374,13 @@ config SYS_I2C_SANDBOX
 	  bus. Devices can be attached to the bus using the device tree
 	  which specifies the driver to use.  See sandbox.dts as an example.
 
+config SYS_I2C_THUNDERX
+	bool "ThunderX i2c driver"
+	depends on ARCH_THUNDERX && DM_I2C
+	default y
+	help
+	  Enable I2C support for Cavium ThunderX line of processors.
+
 config SYS_I2C_S3C24X0
 	bool "Samsung I2C driver"
 	depends on ARCH_EXYNOS4 && DM_I2C
drivers/i2c/Makefile +1 -0
index d3637bcd8d..27087f1814 100644
@@ -34,6 +34,7 @@ obj-$(CONFIG_SYS_I2C_SH) += sh_i2c.o
 obj-$(CONFIG_SYS_I2C_SOFT) += soft_i2c.o
 obj-$(CONFIG_SYS_I2C_STM32F7) += stm32f7_i2c.o
 obj-$(CONFIG_SYS_I2C_TEGRA) += tegra_i2c.o
+obj-$(CONFIG_SYS_I2C_THUNDERX) += thunderx_i2c.o
 obj-$(CONFIG_SYS_I2C_UNIPHIER) += i2c-uniphier.o
 obj-$(CONFIG_SYS_I2C_UNIPHIER_F) += i2c-uniphier-f.o
 obj-$(CONFIG_SYS_I2C_VERSATILE) += i2c-versatile.o
drivers/i2c/thunderx_i2c.c new file +878 -0

878 lines not on this page · raw message

include/configs/thunderx_81xx.h +2 -0
index 10c4a89232..7a2c0adde2 100644
@@ -68,4 +68,6 @@
 #define PLL_REF_CLK			50000000	/* 50 MHz */
 #define NS_PER_REF_CLK_TICK		(1000000000/PLL_REF_CLK)
 
+#define CONFIG_SYS_I2C_SPEED		100000
+
 #endif /* __THUNDERX_81XX_H__ */
Signature · 1 line
2.17.1
author
#29 lore raw

PATCH 13/22 spi: add thunderx SPI driver

In reply to Tim Harvey
---
 configs/thunderx_81xx_defconfig |   4 +
 drivers/spi/Kconfig             |   6 +
 drivers/spi/Makefile            |   1 +
 drivers/spi/thunderx_spi.c      | 448 ++++++++++++++++++++++++++++++++
 4 files changed, 459 insertions(+)
 create mode 100755 drivers/spi/thunderx_spi.c
configs/thunderx_81xx_defconfig +4 -0
index e43aa9750d..48f57ecf1b 100644
@@ -24,6 +24,7 @@ CONFIG_SYS_PROMPT="ThunderX_81XX> "
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_PCI=y
+CONFIG_CMD_SPI=y
 # CONFIG_CMD_NET is not set
 CONFIG_DEFAULT_DEVICE_TREE="thunderx-81xx"
 CONFIG_DM=y
@@ -39,3 +40,6 @@ CONFIG_PCI_THUNDERX=y
 CONFIG_DM_SERIAL=y
 CONFIG_DEBUG_UART_PL011=y
 CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_THUNDERX_SPI=y
drivers/spi/Kconfig +6 -0
index 516188ea88..d1d5463909 100644
@@ -233,6 +233,12 @@ config TEGRA210_QSPI
 	  be used to access SPI chips on platforms embedding this
 	  NVIDIA Tegra210 IP core.
 
+config THUNDERX_SPI
+	bool "Cavium ThunderX SPI driver"
+	help
+	  Enable the Cavium ThunderX SPI driver. This driver can be used to
+	  access the SPI NOR flash on ThunderX SoC platforms.
+
 config XILINX_SPI
 	bool "Xilinx SPI driver"
 	help
drivers/spi/Makefile +1 -0
index 7242ea7e40..ea99775094 100644
@@ -52,6 +52,7 @@ obj-$(CONFIG_TEGRA114_SPI) += tegra114_spi.o
 obj-$(CONFIG_TEGRA20_SFLASH) += tegra20_sflash.o
 obj-$(CONFIG_TEGRA20_SLINK) += tegra20_slink.o
 obj-$(CONFIG_TEGRA210_QSPI) += tegra210_qspi.o
+obj-$(CONFIG_THUNDERX_SPI) += thunderx_spi.o
 obj-$(CONFIG_TI_QSPI) += ti_qspi.o
 obj-$(CONFIG_XILINX_SPI) += xilinx_spi.o
 obj-$(CONFIG_ZYNQ_SPI) += zynq_spi.o
drivers/spi/thunderx_spi.c new file +448 -0

448 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#30 lore raw

PATCH 14/22 xhci: add support for cavium thunderx XHCI

In reply to Tim Harvey
---
 drivers/usb/host/xhci-pci.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +8 -1
index d42f06bc32..3605357d33 100644
@@ -18,9 +18,16 @@ static void xhci_pci_init(struct udevice *dev, struct xhci_hccr **ret_hccr,
 	struct xhci_hcor *hcor;
 	size_t size;
 	u32 cmd;
+	u16 vendor, device;
+	int bar = PCI_BASE_ADDRESS_0;
 
+	dm_pci_read_config16(dev, PCI_VENDOR_ID, &vendor);
+	dm_pci_read_config16(dev, PCI_DEVICE_ID, &device);
+	if ((vendor == PCI_VENDOR_ID_CAVIUM) &&
+	    (device == PCI_DEVICE_ID_THUNDERX_XHCI))
+		bar = 0;
 	hccr = (struct xhci_hccr *)dm_pci_map_bar(dev,
-			PCI_BASE_ADDRESS_0, &size, PCI_REGION_MEM);
+			bar, &size, PCI_REGION_MEM);
 	hcor = (struct xhci_hcor *)((uintptr_t) hccr +
 			HC_LENGTH(xhci_readl(&hccr->cr_capbase)));
 
Signature · 1 line
2.17.1
author
#31 lore raw

PATCH 15/22 thunderx_81xx: add support for XHCI

In reply to Tim Harvey
---
 configs/thunderx_81xx_defconfig | 5 +++++
 include/configs/thunderx_81xx.h | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)
configs/thunderx_81xx_defconfig +5 -0
index 48f57ecf1b..8538f63181 100644
@@ -25,6 +25,7 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_PCI=y
 CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
 # CONFIG_CMD_NET is not set
 CONFIG_DEFAULT_DEVICE_TREE="thunderx-81xx"
 CONFIG_DM=y
@@ -43,3 +44,7 @@ CONFIG_DEBUG_UART_SKIP_INIT=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_THUNDERX_SPI=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_PCI=y
include/configs/thunderx_81xx.h +2 -1
index 7a2c0adde2..dbca775699 100644
@@ -55,7 +55,8 @@
 	"ramdisk_addr_r=0x03300000\0" \
 	BOOTENV
 
-#define BOOT_TARGET_DEVICES(func)
+#define BOOT_TARGET_DEVICES(func) \
+	func(USB, usb, 0)
 
 #include <config_distro_bootcmd.h>
 
Signature · 1 line
2.17.1
author
#32 lore raw

PATCH 16/22 thunderx_81xx: enable usb mass storage and usb ethernet

In reply to Tim Harvey
---
 configs/thunderx_81xx_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/thunderx_81xx_defconfig +3 -0
index 8538f63181..bb374b741a 100644
@@ -48,3 +48,6 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_PCI=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_HOST_ETHER=y
+CONFIG_USB_ETHER_ASIX=y
Signature · 1 line
2.17.1
author
#33 lore raw

PATCH 17/22 ahci: support 64bit systems

In reply to Tim Harvey
---
 drivers/ata/ahci.c | 26 +++++++++++++++++---------
 include/ahci.h     |  3 +++
 2 files changed, 20 insertions(+), 9 deletions(-)
drivers/ata/ahci.c +17 -9
index d6753f140d..81d16925dd 100644
@@ -26,6 +26,9 @@
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 
+#define LOWER32(val)	(u32)((u64)(val) & 0xffffffff)
+#define UPPER32(val)	(u32)(((u64)(val) & 0xffffffff00000000) >> 32)
+
 static int ata_io_flush(struct ahci_uc_priv *uc_priv, u8 port);
 
 #ifndef CONFIG_DM_SCSI
@@ -517,8 +520,9 @@ static int ahci_fill_sg(struct ahci_uc_priv *uc_priv, u8 port,
 
 	for (i = 0; i < sg_count; i++) {
 		ahci_sg->addr =
-		    cpu_to_le32((unsigned long) buf + i * MAX_DATA_BYTE_COUNT);
-		ahci_sg->addr_hi = 0;
+			cpu_to_le32(LOWER32(buf + i * MAX_DATA_BYTE_COUNT));
+		ahci_sg->addr_hi =
+			cpu_to_le32(UPPER32(buf + i * MAX_DATA_BYTE_COUNT));
 		ahci_sg->flags_size = cpu_to_le32(0x3fffff &
 					  (buf_len < MAX_DATA_BYTE_COUNT
 					   ? (buf_len - 1)
@@ -535,11 +539,8 @@ static void ahci_fill_cmd_slot(struct ahci_ioports *pp, u32 opts)
 {
 	pp->cmd_slot->opts = cpu_to_le32(opts);
 	pp->cmd_slot->status = 0;
-	pp->cmd_slot->tbl_addr = cpu_to_le32((u32)pp->cmd_tbl & 0xffffffff);
-#ifdef CONFIG_PHYS_64BIT
-	pp->cmd_slot->tbl_addr_hi =
-	    cpu_to_le32((u32)(((pp->cmd_tbl) >> 16) >> 16));
-#endif
+	pp->cmd_slot->tbl_addr = cpu_to_le32(LOWER32(pp->cmd_tbl));
+	pp->cmd_slot->tbl_addr_hi = cpu_to_le32(UPPER32(pp->cmd_tbl));
 }
 
 static int wait_spinup(void __iomem *port_mmio)
@@ -609,10 +610,17 @@ static int ahci_port_start(struct ahci_uc_priv *uc_priv, u8 port)
 	pp->cmd_tbl_sg =
 			(struct ahci_sg *)(uintptr_t)virt_to_phys((void *)mem);
 
-	writel_with_flush((unsigned long)pp->cmd_slot,
+	if (uc_priv->cap & HOST_CAP_64)
+		writel_with_flush(cpu_to_le32(UPPER32(pp->cmd_slot)),
+				  port_mmio + PORT_LST_ADDR_HI);
+	writel_with_flush(cpu_to_le32(LOWER32(pp->cmd_slot)),
 			  port_mmio + PORT_LST_ADDR);
 
-	writel_with_flush(pp->rx_fis, port_mmio + PORT_FIS_ADDR);
+	if (uc_priv->cap & HOST_CAP_64)
+		writel_with_flush(cpu_to_le32(UPPER32(pp->rx_fis)),
+				  port_mmio + PORT_FIS_ADDR_HI);
+	writel_with_flush(cpu_to_le32(LOWER32(pp->rx_fis)),
+			  port_mmio + PORT_FIS_ADDR);
 
 #ifdef CONFIG_SUNXI_AHCI
 	sunxi_dma_init(port_mmio);
include/ahci.h +3 -0
index b42df6c77e..6e439c184c 100644
@@ -40,6 +40,9 @@
 #define HOST_IRQ_EN		(1 << 1)  /* global IRQ enable */
 #define HOST_AHCI_EN		(1 << 31) /* AHCI enabled */
 
+/* HOST_CAP bits */
+#define HOST_CAP_64		(1 << 31) /* 64-bit addressing supported */
+
 /* Registers for each SATA port */
 #define PORT_LST_ADDR		0x00 /* command list DMA addr */
 #define PORT_LST_ADDR_HI	0x04 /* command list DMA addr hi */
Signature · 1 line
2.17.1
author
#34 lore raw

PATCH 18/22 ahci: set n_ports from host caps

In reply to Tim Harvey

Instead of assuming 2 devices, get the max from the host controller.

---
 drivers/ata/ahci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/ahci.c +1 -1
index 81d16925dd..e7d590f69a 100644
@@ -1181,12 +1181,12 @@ int ahci_probe_scsi(struct udevice *ahci_dev, ulong base)
 	uc_plat = dev_get_uclass_platdata(dev);
 	uc_plat->base = base;
 	uc_plat->max_lun = 1;
-	uc_plat->max_id = 2;
 
 	uc_priv = dev_get_uclass_priv(ahci_dev);
 	ret = ahci_init_one(uc_priv, dev);
 	if (ret)
 		return ret;
+	uc_plat->max_id = uc_priv->n_ports;
 	ret = ahci_start_ports(uc_priv);
 	if (ret)
 		return ret;
Signature · 1 line
2.17.1
author
#35 lore raw

PATCH 19/22 ahci: add support for ThunderX AHCI

In reply to Tim Harvey
---
 configs/thunderx_81xx_defconfig |  7 +++++++
 drivers/ata/ahci.c              | 12 +++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)
configs/thunderx_81xx_defconfig +7 -0
index bb374b741a..dbdadde5fc 100644
@@ -6,6 +6,7 @@ CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_IDENT_STRING=" for Cavium Thunder CN81XX ARM v8 Multi-Core"
 CONFIG_THUNDERX_81XX=y
 CONFIG_DEBUG_UART=y
+CONFIG_AHCI=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
@@ -29,6 +30,10 @@ CONFIG_CMD_USB=y
 # CONFIG_CMD_NET is not set
 CONFIG_DEFAULT_DEVICE_TREE="thunderx-81xx"
 CONFIG_DM=y
+CONFIG_SATA=y
+CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_PCI=y
+CONFIG_BLK=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_LED=y
@@ -38,6 +43,8 @@ CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCI_THUNDERX=y
+CONFIG_SCSI=y
+CONFIG_DM_SCSI=y
 CONFIG_DM_SERIAL=y
 CONFIG_DEBUG_UART_PL011=y
 CONFIG_DEBUG_UART_SKIP_INIT=y
drivers/ata/ahci.c +9 -3
index e7d590f69a..efbd509807 100644
@@ -1199,9 +1199,15 @@ int ahci_probe_scsi_pci(struct udevice *ahci_dev)
 {
 	ulong base;
 	size_t size;
-
-	base = (ulong)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_5, &size,
-				     PCI_REGION_MEM);
+	u16 vendor, device;
+	int bar = PCI_BASE_ADDRESS_5;
+
+	dm_pci_read_config16(ahci_dev, PCI_VENDOR_ID, &vendor);
+	dm_pci_read_config16(ahci_dev, PCI_DEVICE_ID, &device);
+	if ((vendor == PCI_VENDOR_ID_CAVIUM) &&
+	    (device == PCI_DEVICE_ID_THUNDERX_AHCI))
+		bar = 0;
+	base = (ulong)dm_pci_map_bar(ahci_dev, bar, &size, PCI_REGION_MEM);
 
 	return ahci_probe_scsi(ahci_dev, base);
 }
Signature · 1 line
2.17.1
author
#36 lore raw

PATCH 20/22 thunderx_81xx: add AHCI support

In reply to Tim Harvey
---
 include/configs/thunderx_81xx.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/configs/thunderx_81xx.h +2 -1
index dbca775699..c32aa7844c 100644
@@ -56,7 +56,8 @@
 	BOOTENV
 
 #define BOOT_TARGET_DEVICES(func) \
-	func(USB, usb, 0)
+	func(USB, usb, 0) \
+	func(SCSI, scsi, 0)
 
 #include <config_distro_bootcmd.h>
 
Signature · 1 line
2.17.1
author
#37 lore raw

PATCH 21/22 net: add thunderx vnic drivers

In reply to Tim Harvey

Note we move eth init to early init and disable it in later legacy in order to make sure its initialized in time for the pci NIC.

---
 arch/arm/include/asm/arch-thunderx/fdt.h      |   12 +
 .../include/asm/arch-thunderx/thunderx_vnic.h |   15 +
 arch/arm/mach-thunderx/fdt.c                  |  170 +-
 board/cavium/thunderx/thunderx.c              |   30 +-
 configs/thunderx_81xx_defconfig               |    7 +-
 drivers/net/Kconfig                           |   34 +
 drivers/net/Makefile                          |    1 +
 drivers/net/cavium/Makefile                   |    8 +
 drivers/net/cavium/nic.h                      |  569 ++++++
 drivers/net/cavium/nic_main.c                 |  795 +++++++++
 drivers/net/cavium/nic_reg.h                  |  228 +++
 drivers/net/cavium/nicvf_main.c               |  553 ++++++
 drivers/net/cavium/nicvf_queues.c             | 1123 ++++++++++++
 drivers/net/cavium/nicvf_queues.h             |  364 ++++
 drivers/net/cavium/q_struct.h                 |  692 ++++++++
 drivers/net/cavium/thunder_bgx.c              | 1529 +++++++++++++++++
 drivers/net/cavium/thunder_bgx.h              |  259 +++
 drivers/net/cavium/thunder_xcv.c              |  190 ++
 drivers/net/cavium/thunderx_smi.c             |  388 +++++
 include/configs/thunderx_81xx.h               |   11 +-
 net/eth_legacy.c                              |    3 +
 21 files changed, 6973 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-thunderx/fdt.h
 create mode 100644 arch/arm/include/asm/arch-thunderx/thunderx_vnic.h
 create mode 100644 drivers/net/cavium/Makefile
 create mode 100644 drivers/net/cavium/nic.h
 create mode 100644 drivers/net/cavium/nic_main.c
 create mode 100644 drivers/net/cavium/nic_reg.h
 create mode 100644 drivers/net/cavium/nicvf_main.c
 create mode 100644 drivers/net/cavium/nicvf_queues.c
 create mode 100644 drivers/net/cavium/nicvf_queues.h
 create mode 100644 drivers/net/cavium/q_struct.h
 create mode 100644 drivers/net/cavium/thunder_bgx.c
 create mode 100644 drivers/net/cavium/thunder_bgx.h
 create mode 100644 drivers/net/cavium/thunder_xcv.c
 create mode 100644 drivers/net/cavium/thunderx_smi.c
arch/arm/include/asm/arch-thunderx/fdt.h new file +12 -0
new file mode 100644
index 0000000000..7f61e7694e
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2018 (C) Cavium Inc.
+ */
+#ifndef __THUNDERX_FDT_H__
+#define __THUNDERX_FDT_H__
+
+void thunderx_parse_phy_info(void);
+void thunderx_parse_mac_addr(void);
+
+#endif
+
arch/arm/include/asm/arch-thunderx/thunderx_vnic.h new file +15 -0
new file mode 100644
index 0000000000..f1e372c61e
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2018 (C) Cavium Inc.
+ */
+#ifndef VNIC_H_
+#define VNIC_H_
+
+int nicvf_initialize(struct udevice *dev, int vf_num);
+int thunderx_bgx_initialize(unsigned int bgx_idx, unsigned int node);
+void bgx_get_count(int node, int *bgx_count);
+int bgx_get_lmac_count(int node, int bgx_idx);
+void bgx_set_board_info(int bgx_id, int *mdio_bus, int *phy_addr,
+			bool *autoneg_dis, bool *lmac_reg, bool *lmac_enable);
+
+#endif /* VNIC_H_ */
arch/arm/mach-thunderx/fdt.c +169 -1

179 lines not on this page · raw message

board/cavium/thunderx/thunderx.c +26 -4
index 28cf2aee22..9f9ac7ea10 100644
@@ -8,9 +8,12 @@
 #include <errno.h>
 #include <fdt_support.h>
 #include <malloc.h>
+#include <netdev.h>
 #include <linux/compiler.h>
 
 #include <asm/arch-thunderx/atf.h>
+#include <asm/arch-thunderx/fdt.h>
+#include <asm/arch-thunderx/thunderx.h>
 #include <asm/armv8/mmu.h>
 
 #if !CONFIG_IS_ENABLED(OF_CONTROL)
@@ -73,8 +76,10 @@ static struct mm_region thunderx_mem_map[] = {
 struct mm_region *mem_map = thunderx_mem_map;
 
 #ifdef CONFIG_BOARD_EARLY_INIT_R
+extern void eth_common_init(void);
 int board_early_init_r(void)
 {
+	eth_common_init();
 	pci_init();
 
 	return 0;
@@ -87,6 +92,10 @@ int board_init(void)
 	ulong fdt_addr = (ulong)fdt_base_addr;
 	set_working_fdt_addr(fdt_addr);
 #endif
+#if defined(CONFIG_THUNDERX_VNIC)
+	thunderx_parse_phy_info();
+#endif
+
 	return 0;
 }
 
@@ -127,12 +136,25 @@ void reset_cpu(ulong addr)
 {
 }
 
-/*
+#if defined(CONFIG_THUNDERX_VNIC)
+#if defined(CONFIG_BOARD_LATE_INIT)
+/**
+ * Board late initialization routine.
+ */
+int board_late_init(void)
+{
+	thunderx_parse_mac_addr();
+
+	return 0;
+}
+#endif
+
+/**
  * Board specific ethernet initialization routine.
  */
 int board_eth_init(bd_t *bis)
 {
-	int rc = 0;
-
-	return rc;
+	/* this will init non dt, pci based enet devices that are enabled */
+	return pci_eth_init(bis);
 }
+#endif // if defined(CONFIG_THUNDERX_VNIC)
configs/thunderx_81xx_defconfig +6 -1
index dbdadde5fc..7ecf658734 100644
@@ -27,7 +27,10 @@ CONFIG_CMD_I2C=y
 CONFIG_CMD_PCI=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
-# CONFIG_CMD_NET is not set
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_PXE=y
 CONFIG_DEFAULT_DEVICE_TREE="thunderx-81xx"
 CONFIG_DM=y
 CONFIG_SATA=y
@@ -39,6 +42,8 @@ CONFIG_DM_I2C=y
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
 # CONFIG_MMC is not set
+CONFIG_THUNDERX_VNIC=y
+CONFIG_THUNDERX_BGX=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_DM_PCI_COMPAT=y
drivers/net/Kconfig +34 -0
index 39687431fb..68fec42f4a 100644
@@ -327,6 +327,40 @@ config DRIVER_TI_EMAC
 	help
 	   Support for davinci emac
 
+config THUNDERX_VNIC
+        bool "Cavium ThunderX VNIC support"
+        depends on ARCH_THUNDERX
+	select PHYLIB
+	select MISC
+        help
+          This driver supports the Cavium ThunderX VNIC ethernet MAC/PHY/MDIO.
+	  It can be found in CN80XX/CN81XX/CN88XX/CN93XX based SoCs.
+
+if THUNDERX_VNIC
+
+config MAX_BGX_PER_NODE
+	hex "Maximum number of BGX interfaces per CPU node"
+	default 3
+
+config MAX_BGX
+	hex "Maximum number of BGX interfaces across all nodes"
+	default 3
+
+config THUNDERX_XCV 
+	bool
+	default y
+
+config THUNDERX_SMI
+	bool
+	default y
+
+config THUNDERX_BGX
+	select THUNDERX_XCV
+	select THUNDERX_SMI
+	bool "Enable ThunderX BGX networking support"
+
+endif
+
 config XILINX_AXIEMAC
 	depends on DM_ETH && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP)
 	select PHYLIB
drivers/net/Makefile +1 -0
index 48a2878071..922b8cdd94 100644
@@ -58,6 +58,7 @@ obj-$(CONFIG_SMC91111) += smc91111.o
 obj-$(CONFIG_SMC911X) += smc911x.o
 obj-$(CONFIG_DRIVER_TI_EMAC) += davinci_emac.o
 obj-$(CONFIG_TSEC_ENET) += tsec.o fsl_mdio.o
+obj-$(CONFIG_THUNDERX_VNIC) += cavium/
 obj-$(CONFIG_DRIVER_TI_CPSW) += cpsw.o cpsw-common.o
 obj-$(CONFIG_FMAN_ENET) += fsl_mdio.o
 obj-$(CONFIG_ULI526X) += uli526x.o
drivers/net/cavium/Makefile new file +8 -0
new file mode 100644
index 0000000000..af1834e387
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for Cavium's Thunder ethernet device
+#
+obj-y = nic_main.o nicvf_queues.o nicvf_main.o
+obj-$(CONFIG_THUNDERX_BGX) += thunder_bgx.o
+obj-$(CONFIG_THUNDERX_XCV) += thunder_xcv.o
+obj-$(CONFIG_THUNDERX_SMI) += thunderx_smi.o
drivers/net/cavium/nic.h new file +569 -0

569 lines not on this page · raw message

drivers/net/cavium/nic_main.c new file +795 -0

795 lines not on this page · raw message

drivers/net/cavium/nic_reg.h new file +228 -0

228 lines not on this page · raw message

drivers/net/cavium/nicvf_main.c new file +553 -0

553 lines not on this page · raw message

drivers/net/cavium/nicvf_queues.c new file +1123 -0

514 lines not on this page · raw message

drivers/net/cavium/nicvf_queues.h new file +364 -0

364 lines not on this page · raw message

drivers/net/cavium/q_struct.h new file +692 -0

692 lines not on this page · raw message

drivers/net/cavium/thunder_bgx.c new file +1529 -0

1,529 lines not on this page · raw message

drivers/net/cavium/thunder_bgx.h new file +259 -0

259 lines not on this page · raw message

drivers/net/cavium/thunder_xcv.c new file +190 -0

190 lines not on this page · raw message

drivers/net/cavium/thunderx_smi.c new file +388 -0

388 lines not on this page · raw message

include/configs/thunderx_81xx.h +9 -2
index c32aa7844c..30c2dc404e 100644

Lines of this file are not shown. View the raw message.

net/eth_legacy.c +3 -0
index 2a9caa3509..a556dc4224 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

author
#38 lore raw

PATCH 22/22 pci: auto probe thunderx NIC devices

In reply to Tim Harvey

For boards with soc peripherals via the pci devices some devices require probing during config to be available (ie VNIC on ThunderX SoCs).

---
 drivers/pci/pci_auto.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/pci/pci_auto.c +18 -0
index d7237f6eee..7ab0e06cc7 100644
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <dm/device-internal.h>
 #include <errno.h>
 #include <pci.h>
 
@@ -128,6 +129,23 @@ void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
 	}
 
 	if (!enum_only) {
+		u16 device, vendor;
+
+		dm_pci_read_config16(dev, PCI_DEVICE_ID, &device);
+		dm_pci_read_config16(dev, PCI_VENDOR_ID, &vendor);
+		if ( (vendor == PCI_VENDOR_ID_CAVIUM) &&
+		     ((device == PCI_DEVICE_ID_THUNDERX_SMI) ||
+		      (device == PCI_DEVICE_ID_THUNDERX_RGX) ||
+		      (device == PCI_DEVICE_ID_THUNDERX_BGX) ||
+		      (device == PCI_DEVICE_ID_THUNDERX_NIC_PF) ||
+		      (device == PCI_DEVICE_ID_THUNDERX_NIC_VF_1) ||
+		      (device == PCI_DEVICE_ID_THUNDERX_NIC_VF)) )
+		{
+			debug("Probing 0x%04x:0x%04x %s\n", vendor, device,
+			      dev->name);
+			device_probe(dev);
+		}
+
 		/* Configure the expansion ROM address */
 		dm_pci_read_config8(dev, PCI_HEADER_TYPE, &header_type);
 		header_type &= 0x7f;
Signature · 1 line
2.17.1