Skip to contentSkip to conversation

arm: Introduce Marvell/Cavium OcteonTX

RFC PATCH New Suneel Garapati 6 participants 64 messages Oct 29, 2019 – Nov 20, 2019

Subsystems (15)
lore
Share & tools
lore
#0 lore raw

cover arm: Introduce Marvell/Cavium OcteonTX

This series will add support for OcteonTX and OcteonTX2 processsor based platforms. The Marvell/Cavium Octeon-TX 64-bit ARM based SoCs include the CN80XX, CN81XX and CN83XX while Octeon-TX2 64-bit ARM based SoCs include support for CN96XX and CN95XX.
These SoC's have peripheral drivers based on PCI ECAM.

Patches
[1 -10] Add requied changes to PCI framework
- [6] Add support for multi-memory region range
- [7] EA in bridges
- [8] SR-IOV
[12] Add driver model support for RTC DS1337 driver [15 - 17] AHCI changes
[18 - 27] Add OcteonTX drivers
[28 - 29] Add OcteonTX/TX2 board files and configurations

Suneel Garapati (29):
include: pci_ids: add vendor ID for Cavium
include: pci: Increase max pci region limit
fdtdec: add API to read pci bus-range property
drivers: pci-uclass: fix incorrect argument in map_sysmem
drivers: pci-uclass: make DT subnode parse optional
drivers: pci-uclass: add multi entry support for pci regions
drivers: pci-uclass: add support for Enhanced Allocation in Bridges
drivers: pci-uclass: add support for Single-Root I/O Virtualizaiton
drivers: pci-uclass: add VF map_bar support for Enhanced Allocation
drivers: pci-uclass: Add support for Alternate-RoutingID capability
include: arm: asm: io: add 64bit clrbits and setbits helpers
drivers: rtc: ds1337: add driver model support
arch: include: octeontx: add headers for OcteonTX
arch: include: octeontx2: add headers for OcteonTX2
drivers: ata: ahci: update max id if it is more than available ports
drivers: ata: ahci: fill upper 32bit buffer address in sg descriptor
drivers: ata: ahci: add BAR index quirk for OcteonTX
drivers: pci: add PCI controller driver for OcteonTX
drivers: gpio: add GPIO controller driver for OcteonTX
drivers: i2c: add I2C controller driver for OcteonTX
drivers: spi: add SPI controller driver for OcteonTX
drivers: mmc: remove static qualifier on mmc_power_init
drivers: mmc: add MMC controller driver for OcteonTX
drivers: mtd: nand: add NAND controller driver for OcteonTX
drivers: net: add NIC controller driver for OcteonTX
drivers: net: add NIC controller driver for OcteonTX2
drivers: watchdog: add reset support for OcteonTX
octeontx: Add support for OcteonTX SoC platforms
octeontx2: Add support for OcteonTX2 SoC platforms

 arch/arm/Kconfig                              |    22 +
 arch/arm/Makefile                             |     2 +
 arch/arm/include/asm/arch-octeontx/board.h    |   121 +
 arch/arm/include/asm/arch-octeontx/clock.h    |    25 +
 .../asm/arch-octeontx/csrs/csrs-mio_emm.h     |  1193 ++
 .../include/asm/arch-octeontx/csrs/csrs-xcv.h |   428 +
 arch/arm/include/asm/arch-octeontx/gpio.h     |     6 +
 arch/arm/include/asm/arch-octeontx/smc.h      |    20 +
 arch/arm/include/asm/arch-octeontx/soc.h      |    31 +
 arch/arm/include/asm/arch-octeontx2/board.h   |   123 +
 arch/arm/include/asm/arch-octeontx2/clock.h   |    24 +
 .../asm/arch-octeontx2/csrs/csrs-cgx.h        |  7835 ++++++++++++
 .../asm/arch-octeontx2/csrs/csrs-lmt.h        |    60 +
 .../asm/arch-octeontx2/csrs/csrs-mio_emm.h    |  1193 ++
 .../asm/arch-octeontx2/csrs/csrs-nix.h        | 10482 ++++++++++++++++
 .../asm/arch-octeontx2/csrs/csrs-npa.h        |  2296 ++++
 .../asm/arch-octeontx2/csrs/csrs-npc.h        |  1930 +++
 .../asm/arch-octeontx2/csrs/csrs-rvu.h        |  2430 ++++
 arch/arm/include/asm/arch-octeontx2/gpio.h    |     6 +
 arch/arm/include/asm/arch-octeontx2/smc-id.h  |    32 +
 arch/arm/include/asm/arch-octeontx2/smc.h     |    18 +
 arch/arm/include/asm/arch-octeontx2/soc.h     |    31 +
 arch/arm/include/asm/io.h                     |     8 +
 arch/arm/mach-octeontx/Kconfig                |    23 +
 arch/arm/mach-octeontx/Makefile               |     9 +
 arch/arm/mach-octeontx/clock.c                |    35 +
 arch/arm/mach-octeontx/cpu.c                  |    76 +
 arch/arm/mach-octeontx/lowlevel_init.S        |    33 +
 arch/arm/mach-octeontx2/Kconfig               |    23 +
 arch/arm/mach-octeontx2/Makefile              |     9 +
 arch/arm/mach-octeontx2/clock.c               |    35 +
 arch/arm/mach-octeontx2/config.mk             |     4 +
 arch/arm/mach-octeontx2/cpu.c                 |    72 +
 arch/arm/mach-octeontx2/lowlevel_init.S       |    33 +
 board/Marvell/octeontx/Kconfig                |    14 +
 board/Marvell/octeontx/MAINTAINERS            |     9 +
 board/Marvell/octeontx/Makefile               |     9 +
 board/Marvell/octeontx/board-fdt.c            |   271 +
 board/Marvell/octeontx/board.c                |   137 +
 board/Marvell/octeontx/smc.c                  |    30 +
 board/Marvell/octeontx/soc-utils.c            |    53 +
 board/Marvell/octeontx2/Kconfig               |    15 +
 board/Marvell/octeontx2/MAINTAINERS           |     9 +
 board/Marvell/octeontx2/Makefile              |     9 +
 board/Marvell/octeontx2/board-fdt.c           |   155 +
 board/Marvell/octeontx2/board.c               |   232 +
 board/Marvell/octeontx2/smc.c                 |    62 +
 board/Marvell/octeontx2/soc-utils.c           |    49 +
 configs/octeontx2_95xx_defconfig              |   105 +
 configs/octeontx2_96xx_defconfig              |   131 +
 configs/octeontx_81xx_defconfig               |   133 +
 configs/octeontx_83xx_defconfig               |   130 +
 drivers/ata/ahci.c                            |    15 +
 drivers/gpio/Kconfig                          |     7 +
 drivers/gpio/Makefile                         |     1 +
 drivers/gpio/octeontx_gpio.c                  |   218 +
 drivers/i2c/Kconfig                           |     7 +
 drivers/i2c/Makefile                          |     1 +
 drivers/i2c/octeontx_i2c.c                    |   968 ++
 drivers/mmc/Kconfig                           |     9 +
 drivers/mmc/Makefile                          |     1 +
 drivers/mmc/mmc.c                             |     2 +-
 drivers/mmc/octeontx_hsmmc.c                  |  3233 +++++
 drivers/mmc/octeontx_hsmmc.h                  |   191 +
 drivers/mtd/nand/raw/Kconfig                  |    16 +
 drivers/mtd/nand/raw/Makefile                 |     2 +
 drivers/mtd/nand/raw/octeontx_bch.c           |   424 +
 drivers/mtd/nand/raw/octeontx_bch.h           |   142 +
 drivers/mtd/nand/raw/octeontx_bch_regs.h      |   169 +
 drivers/mtd/nand/raw/octeontx_nand.c          |  2261 ++++
 drivers/net/Kconfig                           |    29 +
 drivers/net/Makefile                          |     4 +
 drivers/net/octeontx/Makefile                 |     9 +
 drivers/net/octeontx/bgx.c                    |  1546 +++
 drivers/net/octeontx/bgx.h                    |   259 +
 drivers/net/octeontx/nic.h                    |   518 +
 drivers/net/octeontx/nic_main.c               |   777 ++
 drivers/net/octeontx/nic_reg.h                |   252 +
 drivers/net/octeontx/nicvf_main.c             |   575 +
 drivers/net/octeontx/nicvf_queues.c           |  1141 ++
 drivers/net/octeontx/nicvf_queues.h           |   355 +
 drivers/net/octeontx/q_struct.h               |   697 +
 drivers/net/octeontx/smi.c                    |   382 +
 drivers/net/octeontx/xcv.c                    |   129 +
 drivers/net/octeontx2/Makefile                |    11 +
 drivers/net/octeontx2/cgx.c                   |   297 +
 drivers/net/octeontx2/cgx.h                   |   105 +
 drivers/net/octeontx2/cgx_intf.c              |   421 +
 drivers/net/octeontx2/cgx_intf.h              |   370 +
 drivers/net/octeontx2/lmt.h                   |    51 +
 drivers/net/octeontx2/nix.c                   |   824 ++
 drivers/net/octeontx2/nix.h                   |   355 +
 drivers/net/octeontx2/nix_af.c                |  1103 ++
 drivers/net/octeontx2/npc.h                   |    92 +
 drivers/net/octeontx2/rvu.h                   |   127 +
 drivers/net/octeontx2/rvu_af.c                |   172 +
 drivers/net/octeontx2/rvu_common.c            |    74 +
 drivers/net/octeontx2/rvu_pf.c                |   118 +
 drivers/pci/Kconfig                           |    17 +
 drivers/pci/Makefile                          |     1 +
 drivers/pci/pci-uclass.c                      |   211 +-
 drivers/pci/pci_octeontx.c                    |   538 +
 drivers/rtc/Kconfig                           |     7 +
 drivers/rtc/ds1337.c                          |   170 +
 drivers/spi/Kconfig                           |     6 +
 drivers/spi/Makefile                          |     1 +
 drivers/spi/octeontx_spi.c                    |   750 ++
 drivers/watchdog/Kconfig                      |    10 +
 drivers/watchdog/Makefile                     |     1 +
 drivers/watchdog/octeontx_wdt.c               |    76 +
 include/configs/octeontx2_95xx.h              |    80 +
 include/configs/octeontx2_96xx.h              |    90 +
 include/configs/octeontx_common.h             |    98 +
 include/fdtdec.h                              |    12 +
 include/mmc.h                                 |     1 +
 include/pci.h                                 |    23 +-
 include/pci_ids.h                             |     2 +
 lib/fdtdec.c                                  |    16 +
 118 files changed, 50774 insertions(+), 17 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-octeontx/board.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/clock.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/csrs/csrs-mio_emm.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/csrs/csrs-xcv.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/gpio.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/smc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/soc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/board.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/clock.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-cgx.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-lmt.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-mio_emm.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-nix.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-npa.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-npc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-rvu.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/gpio.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/smc-id.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/smc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/soc.h
 create mode 100644 arch/arm/mach-octeontx/Kconfig
 create mode 100644 arch/arm/mach-octeontx/Makefile
 create mode 100644 arch/arm/mach-octeontx/clock.c
 create mode 100644 arch/arm/mach-octeontx/cpu.c
 create mode 100644 arch/arm/mach-octeontx/lowlevel_init.S
 create mode 100644 arch/arm/mach-octeontx2/Kconfig
 create mode 100644 arch/arm/mach-octeontx2/Makefile
 create mode 100644 arch/arm/mach-octeontx2/clock.c
 create mode 100644 arch/arm/mach-octeontx2/config.mk
 create mode 100644 arch/arm/mach-octeontx2/cpu.c
 create mode 100644 arch/arm/mach-octeontx2/lowlevel_init.S
 create mode 100644 board/Marvell/octeontx/Kconfig
 create mode 100644 board/Marvell/octeontx/MAINTAINERS
 create mode 100644 board/Marvell/octeontx/Makefile
 create mode 100644 board/Marvell/octeontx/board-fdt.c
 create mode 100644 board/Marvell/octeontx/board.c
 create mode 100644 board/Marvell/octeontx/smc.c
 create mode 100644 board/Marvell/octeontx/soc-utils.c
 create mode 100644 board/Marvell/octeontx2/Kconfig
 create mode 100644 board/Marvell/octeontx2/MAINTAINERS
 create mode 100644 board/Marvell/octeontx2/Makefile
 create mode 100644 board/Marvell/octeontx2/board-fdt.c
 create mode 100644 board/Marvell/octeontx2/board.c
 create mode 100644 board/Marvell/octeontx2/smc.c
 create mode 100644 board/Marvell/octeontx2/soc-utils.c
 create mode 100644 configs/octeontx2_95xx_defconfig
 create mode 100644 configs/octeontx2_96xx_defconfig
 create mode 100644 configs/octeontx_81xx_defconfig
 create mode 100644 configs/octeontx_83xx_defconfig
 create mode 100644 drivers/gpio/octeontx_gpio.c
 create mode 100644 drivers/i2c/octeontx_i2c.c
 create mode 100644 drivers/mmc/octeontx_hsmmc.c
 create mode 100644 drivers/mmc/octeontx_hsmmc.h
 create mode 100644 drivers/mtd/nand/raw/octeontx_bch.c
 create mode 100644 drivers/mtd/nand/raw/octeontx_bch.h
 create mode 100644 drivers/mtd/nand/raw/octeontx_bch_regs.h
 create mode 100644 drivers/mtd/nand/raw/octeontx_nand.c
 create mode 100644 drivers/net/octeontx/Makefile
 create mode 100644 drivers/net/octeontx/bgx.c
 create mode 100644 drivers/net/octeontx/bgx.h
 create mode 100644 drivers/net/octeontx/nic.h
 create mode 100644 drivers/net/octeontx/nic_main.c
 create mode 100644 drivers/net/octeontx/nic_reg.h
 create mode 100644 drivers/net/octeontx/nicvf_main.c
 create mode 100644 drivers/net/octeontx/nicvf_queues.c
 create mode 100644 drivers/net/octeontx/nicvf_queues.h
 create mode 100644 drivers/net/octeontx/q_struct.h
 create mode 100644 drivers/net/octeontx/smi.c
 create mode 100644 drivers/net/octeontx/xcv.c
 create mode 100644 drivers/net/octeontx2/Makefile
 create mode 100644 drivers/net/octeontx2/cgx.c
 create mode 100644 drivers/net/octeontx2/cgx.h
 create mode 100644 drivers/net/octeontx2/cgx_intf.c
 create mode 100644 drivers/net/octeontx2/cgx_intf.h
 create mode 100644 drivers/net/octeontx2/lmt.h
 create mode 100644 drivers/net/octeontx2/nix.c
 create mode 100644 drivers/net/octeontx2/nix.h
 create mode 100644 drivers/net/octeontx2/nix_af.c
 create mode 100644 drivers/net/octeontx2/npc.h
 create mode 100644 drivers/net/octeontx2/rvu.h
 create mode 100644 drivers/net/octeontx2/rvu_af.c
 create mode 100644 drivers/net/octeontx2/rvu_common.c
 create mode 100644 drivers/net/octeontx2/rvu_pf.c
 create mode 100644 drivers/pci/pci_octeontx.c
 create mode 100644 drivers/spi/octeontx_spi.c
 create mode 100644 drivers/watchdog/octeontx_wdt.c
 create mode 100644 include/configs/octeontx2_95xx.h
 create mode 100644 include/configs/octeontx2_96xx.h
 create mode 100644 include/configs/octeontx_common.h
Signature · 1 line
2.23.0
#1 lore raw

RFC PATCH 1/29 include: pci_ids: add vendor ID for Cavium

From: Suneel Garapati <[email protected]>

---
 include/pci_ids.h | 2 ++
 1 file changed, 2 insertions(+)
include/pci_ids.h +2 -0
index bd59578ccb..f8b4f28996 100644
@@ -2360,6 +2360,8 @@
 #define PCI_DEVICE_ID_ALTIMA_AC9100	0x03ea
 #define PCI_DEVICE_ID_ALTIMA_AC1003	0x03eb
 
+#define PCI_VENDOR_ID_CAVIUM		0x177d
+
 #define PCI_VENDOR_ID_BELKIN		0x1799
 #define PCI_DEVICE_ID_BELKIN_F5D7010V7	0x701f
 
Signature · 1 line
2.23.0
#3 lore raw

RFC PATCH 2/29 include: pci: Increase max pci region limit

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Increase MAX_PCI_REGIONS limit from 7 to 10. For some SoC's like OcteonTX/TX2 where everything is on PCI bus there is need for extra entries to support required peripherals.

---
 include/pci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/pci.h +1 -1
index ff59ac0e69..0b14842285 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.23.0
#4 lore raw

RFC PATCH 2/29 include: pci: Increase max pci region limit

Hi Suneel,

Quoted 17 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

Increase MAX_PCI_REGIONS limit from 7 to 10. For some SoC's like OcteonTX/TX2 where everything is on PCI bus there is need for extra entries to support required peripherals.

---
 include/pci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/pci.h +0 -0
index ff59ac0e69..0b14842285 100644

include/pci.h extern void pci_cfgfunc_do_nothing(struct pci_controller* hose, pci_dev_t dev, · line 570

Quoted 5 lines
include/pci.h +1 -1
@@ -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

This needs to be dynamic, with malloc() used to allocate the space in struct pci_controller, after calculating how many entries there are. The current scheme and your patch breaks x86 devices with limited pre-reloc memory.

Regards,
Simon

#5 lore raw

RFC PATCH 3/29 fdtdec: add API to read pci bus-range property

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Add fdtdec_get_pci_bus_range to read bus-range property values.

---
 include/fdtdec.h | 12 ++++++++++++
 lib/fdtdec.c     | 16 ++++++++++++++++
 2 files changed, 28 insertions(+)
include/fdtdec.h +12 -0
index f1e58f9732..afbd22b25a 100644
@@ -441,6 +441,18 @@ 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 length.
+ * @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 +16 -0
index 17736ce665..fb61eda1fd 100644
@@ -237,6 +237,22 @@ 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.23.0
#6 lore raw

RFC PATCH 3/29 fdtdec: add API to read pci bus-range property

Hi Suneel,

Quoted 17 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

Add fdtdec_get_pci_bus_range to read bus-range property values.

---
 include/fdtdec.h | 12 ++++++++++++
 lib/fdtdec.c     | 16 ++++++++++++++++
 2 files changed, 28 insertions(+)
include/fdtdec.h +0 -0
index f1e58f9732..afbd22b25a 100644

include/fdtdec.h int fdtdec_get_pci_vendev(const void *blob, int node, · line 450

Quoted 10 lines
include/fdtdec.h +7 -0
@@ -441,6 +441,18 @@ 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 length.
+ * @param blob         FDT blob
+ * @param node         node to examine
+ * @param res          the resource structure to return the bus range

@return

Quoted 13 lines
include/fdtdec.h +5 -0
+ */
+
+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 +0 -0
index 17736ce665..fb61eda1fd 100644

lib/fdtdec.c int fdtdec_get_pci_bar32(struct udevice *dev, struct fdt_pci_addr *addr, · line 242

Quoted 6 lines
lib/fdtdec.c +3 -0
@@ -237,6 +237,22 @@ 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)

This should have a livetree version too I think and a test.

lib/fdtdec.c int fdtdec_get_pci_bar32(struct udevice *dev, struct fdt_pci_addr *addr, · line 251

Quoted 9 lines
lib/fdtdec.c +9 -0
+{
+       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++);

I think these should use fdt32_ld()

Quoted 10 lines
lib/fdtdec.c +4 -1
+       res->end = be32_to_cpup(values);
+
+       return 0;
+}
 #endif
 
 uint64_t fdtdec_get_uint64(const void *blob, int node, const char *prop_name,
--

2.23.0

Regards,
Simon

#7 lore raw

RFC PATCH 4/29 drivers: pci-uclass: fix incorrect argument in map_sysmem

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Minor spelling correction.

---
 drivers/pci/pci-uclass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/pci-uclass.c +2 -2
index 896cb6b23a..848ac5a65e 100644
@@ -1373,7 +1373,7 @@ static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags,
 		}
 
 		/* size ignored for now */
-		return map_physmem(addr, flags, 0);
+		return map_physmem(addr, 0, flags);
 	}
 
 	return 0;
@@ -1399,7 +1399,7 @@ void *dm_pci_map_bar(struct udevice *dev, int bar, int flags)
 
 	/*
 	 * Pass "0" as the length argument to pci_bus_to_virt.  The arg
-	 * isn't actualy used on any platform because u-boot assumes a static
+	 * isn't actually used on any platform because u-boot assumes a static
 	 * linear mapping.  In the future, this could read the BAR size
 	 * and pass that as the size if needed.
 	 */
Signature · 1 line
2.23.0
#8 lore raw

RFC PATCH 4/29 drivers: pci-uclass: fix incorrect argument in map_sysmem

Hi Suneel,

Quoted 4 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

Minor spelling correction.

Also mention your bug, and ideally add a Fixes: tag.

Quoted 5 lines
---
 drivers/pci/pci-uclass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 24 lines
drivers/pci/pci-uclass.c +2 -3
index 896cb6b23a..848ac5a65e 100644
@@ -1373,7 +1373,7 @@ static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags,
                }
 
                /* size ignored for now */
-               return map_physmem(addr, flags, 0);
+               return map_physmem(addr, 0, flags);
        }
 
        return 0;
@@ -1399,7 +1399,7 @@ void *dm_pci_map_bar(struct udevice *dev, int bar, int flags)
 
        /*
         * Pass "0" as the length argument to pci_bus_to_virt.  The arg
-        * isn't actualy used on any platform because u-boot assumes a static
+        * isn't actually used on any platform because u-boot assumes a static
         * linear mapping.  In the future, this could read the BAR size
         * and pass that as the size if needed.
         */
--
Quoted 2 lines

2.23.0

Regards,
Simon

#9 lore raw

RFC PATCH 5/29 drivers: pci-uclass: make DT subnode parse optional

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Parse subnode DT properties only if parent node is valid. Otherwise, assert is triggered on ofnode_valid in ofnode_first_subnode from dev_for_each_subnode.

---
 drivers/pci/pci-uclass.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/pci-uclass.c +2 -1
index 848ac5a65e..007b7472c6 100644
@@ -675,7 +675,8 @@ static int pci_find_and_bind_driver(struct udevice *parent,
 	      find_id->vendor, find_id->device);
 
 	/* Determine optional OF node */
-	pci_dev_find_ofnode(parent, bdf, &node);
+	if (ofnode_valid(dev_ofnode(parent)))
+		pci_dev_find_ofnode(parent, bdf, &node);
 
 	start = ll_entry_start(struct pci_driver_entry, pci_driver_entry);
 	n_ents = ll_entry_count(struct pci_driver_entry, pci_driver_entry);
Signature · 1 line
2.23.0
#10 lore raw

RFC PATCH 5/29 drivers: pci-uclass: make DT subnode parse optional

Quoted 11 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

Parse subnode DT properties only if parent node is valid. Otherwise, assert is triggered on ofnode_valid in ofnode_first_subnode from dev_for_each_subnode.

---
 drivers/pci/pci-uclass.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
#11 lore raw

RFC PATCH 6/29 drivers: pci-uclass: add multi entry support for pci regions

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Enable PCI memory regions to be of multiple entry. This helps to add support for SoC's like OcteonTX/TX2 where every peripheral is on PCI bus.

---
 drivers/pci/Kconfig      | 9 +++++++++
 drivers/pci/pci-uclass.c | 2 ++
 2 files changed, 11 insertions(+)
drivers/pci/Kconfig +9 -0
index 19e7b50046..752439afcf 100644
@@ -43,6 +43,15 @@ config PCI_PNP
 	help
 	  Enable PCI memory and I/O space resource allocation and assignment.
 
+config PCI_REGION_MULTI_ENTRY
+	bool "Enable Multiple entries of MEMORY region for PCI"
+	depends on PCI || DM_PCI
+	default n
+	help
+	  Enable PCI memory regions to be of multiple entry. This helps to
+	  add support for SoC's like OcteonTX/TX2 where every peripheral is
+	  on PCI bus.
+
 config PCIE_ECAM_GENERIC
 	bool "Generic ECAM-based PCI host controller support"
 	default n
drivers/pci/pci-uclass.c +2 -0
index 007b7472c6..f17e83565c 100644
@@ -902,10 +902,12 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
 		}
 
 		pos = -1;
+#if !CONFIG_IS_ENABLED(PCI_REGION_MULTI_ENTRY)
 		for (i = 0; i < hose->region_count; i++) {
 			if (hose->regions[i].flags == type)
 				pos = i;
 		}
+#endif
 		if (pos == -1)
 			pos = hose->region_count++;
 		debug(" - type=%d, pos=%d\n", type, pos);
Signature · 1 line
2.23.0
#12 lore raw

RFC PATCH 6/29 drivers: pci-uclass: add multi entry support for pci regions

Hi Suneel,

Quoted 19 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

Enable PCI memory regions to be of multiple entry. This helps to add support for SoC's like OcteonTX/TX2 where every peripheral is on PCI bus.

---
 drivers/pci/Kconfig      | 9 +++++++++
 drivers/pci/pci-uclass.c | 2 ++
 2 files changed, 11 insertions(+)
drivers/pci/Kconfig +0 -0
index 19e7b50046..752439afcf 100644
@@ -43,6 +43,15 @@ config PCI_PNP
        help

drivers/pci/Kconfig config PCI_PNP · line 53

Quoted 10 lines
drivers/pci/Kconfig +8 -0
          Enable PCI memory and I/O space resource allocation and assignment.
 
+config PCI_REGION_MULTI_ENTRY
+       bool "Enable Multiple entries of MEMORY region for PCI"
+       depends on PCI || DM_PCI
+       default n
+       help
+         Enable PCI memory regions to be of multiple entry. This helps to
+         add support for SoC's like OcteonTX/TX2 where every peripheral is
+         on PCI bus.

This isn't clear enough. Please expand to explain what 'multiple entry' means.

drivers/pci/pci-uclass.c static void decode_regions(struct pci_controller *hose, ofnode parent_node, · line 905

Quoted 13 lines
drivers/pci/Kconfig +1 -0
+
 config PCIE_ECAM_GENERIC
        bool "Generic ECAM-based PCI host controller support"
        default n
drivers/pci/pci-uclass.c +1 -0
index 007b7472c6..f17e83565c 100644
@@ -902,10 +902,12 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
                }
 
                pos = -1;
+#if !CONFIG_IS_ENABLED(PCI_REGION_MULTI_ENTRY)

Please use if()

Quoted 11 lines
drivers/pci/pci-uclass.c +1 -1
                for (i = 0; i < hose->region_count; i++) {
                        if (hose->regions[i].flags == type)
                                pos = i;
                }
+#endif
                if (pos == -1)
                        pos = hose->region_count++;
                debug(" - type=%d, pos=%d\n", type, pos);
--

2.23.0

Regards,
Simon

#13 lore raw

RFC PATCH 7/29 drivers: pci-uclass: add support for Enhanced Allocation in Bridges

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

If Enhanced Allocation capability is present in bridges, use it to read the fixed sub-ordinate bus number.

---
 drivers/pci/pci-uclass.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)
drivers/pci/pci-uclass.c +19 -6
index f17e83565c..51f7135723 100644
@@ -599,10 +599,20 @@ int dm_pci_hose_probe_bus(struct udevice *bus)
 {
 	int sub_bus;
 	int ret;
+	int ea_pos;
+	u8 reg;
 
 	debug("%s\n", __func__);
 
-	sub_bus = pci_get_bus_max() + 1;
+	ea_pos = dm_pci_find_capability(bus, PCI_CAP_ID_EA);
+
+	if (ea_pos) {
+		dm_pci_read_config8(bus, ea_pos + sizeof(u32) + sizeof(u8),
+				    &reg);
+		sub_bus = reg;
+	} else {
+		sub_bus = pci_get_bus_max() + 1;
+	}
 	debug("%s: bus = %d/%s\n", __func__, sub_bus, bus->name);
 	dm_pciauto_prescan_setup_bridge(bus, sub_bus);
 
@@ -612,12 +622,15 @@ int dm_pci_hose_probe_bus(struct udevice *bus)
 		      ret);
 		return ret;
 	}
-	if (sub_bus != bus->seq) {
-		printf("%s: Internal error, bus '%s' got seq %d, expected %d\n",
-		       __func__, bus->name, bus->seq, sub_bus);
-		return -EPIPE;
+
+	if (!ea_pos) {
+		if (sub_bus != bus->seq) {
+			printf("%s: Internal error, bus '%s' got seq %d, expected %d\n",
+			       __func__, bus->name, bus->seq, sub_bus);
+			return -EPIPE;
+		}
+		sub_bus = pci_get_bus_max();
 	}
-	sub_bus = pci_get_bus_max();
 	dm_pciauto_postscan_setup_bridge(bus, sub_bus);
 
 	return sub_bus;
Signature · 1 line
2.23.0
#14 lore raw

RFC PATCH 7/29 drivers: pci-uclass: add support for Enhanced Allocation in Bridges

Hi Suneel,

Quoted 11 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

If Enhanced Allocation capability is present in bridges, use it to read the fixed sub-ordinate bus number.

---
 drivers/pci/pci-uclass.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)
Quoted 29 lines
drivers/pci/pci-uclass.c +11 -1
index f17e83565c..51f7135723 100644
@@ -599,10 +599,20 @@ int dm_pci_hose_probe_bus(struct udevice *bus)
 {
        int sub_bus;
        int ret;
+       int ea_pos;
+       u8 reg;
 
        debug("%s\n", __func__);
 
-       sub_bus = pci_get_bus_max() + 1;
+       ea_pos = dm_pci_find_capability(bus, PCI_CAP_ID_EA);
+
+       if (ea_pos) {
+               dm_pci_read_config8(bus, ea_pos + sizeof(u32) + sizeof(u8),
+                                   &reg);
+               sub_bus = reg;
+       } else {
+               sub_bus = pci_get_bus_max() + 1;
+       }
        debug("%s: bus = %d/%s\n", __func__, sub_bus, bus->name);
        dm_pciauto_prescan_setup_bridge(bus, sub_bus);
 
@@ -612,12 +622,15 @@ int dm_pci_hose_probe_bus(struct udevice *bus)
                      ret);
                return ret;

drivers/pci/pci-uclass.c int dm_pci_hose_probe_bus(struct udevice *bus) · line 629

Quoted 10 lines
drivers/pci/pci-uclass.c +5 -4
        }
-       if (sub_bus != bus->seq) {
-               printf("%s: Internal error, bus '%s' got seq %d, expected %d\n",
-                      __func__, bus->name, bus->seq, sub_bus);
-               return -EPIPE;
+
+       if (!ea_pos) {
+               if (sub_bus != bus->seq) {
+                       printf("%s: Internal error, bus '%s' got seq %d, expected %d\n",
+                              __func__, bus->name, bus->seq, sub_bus);

Can we change to debug() - for code size?

Quoted 11 lines
drivers/pci/pci-uclass.c +3 -2
+                       return -EPIPE;
+               }
+               sub_bus = pci_get_bus_max();
        }
-       sub_bus = pci_get_bus_max();
        dm_pciauto_postscan_setup_bridge(bus, sub_bus);
 
        return sub_bus;
--

2.23.0

Regards,
Simon

#15 lore raw

RFC PATCH 8/29 drivers: pci-uclass: add support for Single-Root I/O Virtualizaiton

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

If SR-IOV capability is present, use it to initialize Virtual function (VF) PCI device instances. pci_sriov_init function will read SR-IOV registers to create VF devices under the PF PCI device and also bind driver if available. This function needs to be invoked from Physical function device driver which expects VF device support, creating minimal impact on existing framework.

---
 drivers/pci/pci-uclass.c | 113 +++++++++++++++++++++++++++++++++++++++
 include/pci.h            |  18 +++++++
 2 files changed, 131 insertions(+)
drivers/pci/pci-uclass.c +113 -0
index 51f7135723..3be49c7115 100644
@@ -1535,6 +1535,119 @@ int dm_pci_flr(struct udevice *dev)
 	return 0;
 }
 
+int pci_sriov_init(struct udevice *pdev, int vf_en)
+{
+	u16 vendor, device;
+	struct udevice *bus;
+	struct udevice *dev;
+	pci_dev_t bdf;
+	u16 ctrl;
+	u16 num_vfs;
+	u16 total_vf;
+	u16 vf_offset;
+	u16 vf_stride;
+	int vf, ret;
+	int pos;
+
+	pos = dm_pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);
+	if (!pos) {
+		printf("Error: SRIOV capability not found\n");
+		return -ENOENT;
+	}
+
+	dm_pci_read_config16(pdev, pos + PCI_SRIOV_CTRL, &ctrl);
+
+	dm_pci_read_config16(pdev, pos + PCI_SRIOV_TOTAL_VF, &total_vf);
+	if (vf_en > total_vf)
+		vf_en = total_vf;
+	dm_pci_write_config16(pdev, pos + PCI_SRIOV_NUM_VF, vf_en);
+
+	ctrl |= PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE;
+	dm_pci_write_config16(pdev, pos + PCI_SRIOV_CTRL, ctrl);
+
+	dm_pci_read_config16(pdev, pos + PCI_SRIOV_NUM_VF, &num_vfs);
+	if (num_vfs > vf_en)
+		num_vfs = vf_en;
+
+	dm_pci_read_config16(pdev, pos + PCI_SRIOV_VF_OFFSET, &vf_offset);
+	dm_pci_read_config16(pdev, pos + PCI_SRIOV_VF_STRIDE, &vf_stride);
+
+	dm_pci_read_config16(pdev, PCI_VENDOR_ID, &vendor);
+	dm_pci_read_config16(pdev, pos + PCI_SRIOV_VF_DID, &device);
+
+	bdf = dm_pci_get_bdf(pdev);
+
+	pci_get_bus(PCI_BUS(bdf), &bus);
+
+	if (!bus)
+		return -ENODEV;
+
+	bdf += PCI_BDF(0, 0, vf_offset);
+
+	for (vf = 0; vf < num_vfs; vf++) {
+		struct pci_child_platdata *pplat;
+		ulong class;
+
+		pci_bus_read_config(bus, bdf, PCI_CLASS_DEVICE,
+				    &class, PCI_SIZE_16);
+
+		debug("%s: bus %d/%s: found VF %x:%x\n", __func__,
+		      bus->seq, bus->name, PCI_DEV(bdf), PCI_FUNC(bdf));
+
+		/* Find this device in the device tree */
+		ret = pci_bus_find_devfn(bus, PCI_MASK_BUS(bdf), &dev);
+
+		if (ret == -ENODEV) {
+			struct pci_device_id find_id;
+
+			memset(&find_id, 0, sizeof(find_id));
+
+			find_id.vendor = vendor;
+			find_id.device = device;
+			find_id.class = class;
+
+			ret = pci_find_and_bind_driver(bus, &find_id,
+						       bdf, &dev);
+
+			if (ret)
+				return ret;
+		}
+
+		/* Update the platform data */
+		pplat = dev_get_parent_platdata(dev);
+		pplat->devfn = PCI_MASK_BUS(bdf);
+		pplat->vendor = vendor;
+		pplat->device = device;
+		pplat->class = class;
+		pplat->is_virtfn = true;
+		pplat->pfdev = pdev;
+		pplat->virtid = vf * vf_stride + vf_offset;
+
+		debug("%s: bus %d/%s: found VF %x:%x %x:%x class %lx id %x\n",
+		      __func__, dev->seq, dev->name, PCI_DEV(bdf),
+		      PCI_FUNC(bdf), vendor, device, class, pplat->virtid);
+		bdf += PCI_BDF(0, 0, vf_stride);
+	}
+
+	return 0;
+}
+
+int pci_sriov_get_totalvfs(struct udevice *pdev)
+{
+	u16 total_vf;
+	int pos;
+
+	pos = dm_pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);
+	if (!pos) {
+		printf("Error: SRIOV capability not found\n");
+		return -ENOENT;
+	}
+
+	dm_pci_read_config16(pdev, pos + PCI_SRIOV_TOTAL_VF, &total_vf);
+
+	return total_vf;
+}
+
 UCLASS_DRIVER(pci) = {
 	.id		= UCLASS_PCI,
 	.name		= "pci",
include/pci.h +18 -0
index 0b14842285..1343d0e9fb 100644
@@ -475,6 +475,17 @@
 #define  PCI_EXP_DEVCAP_FLR     0x10000000 /* Function Level Reset */
 #define PCI_EXP_DEVCTL		8	/* Device Control */
 #define  PCI_EXP_DEVCTL_BCR_FLR 0x8000  /* Bridge Configuration Retry / FLR */
+/* Single Root I/O Virtualization Registers */
+#define PCI_SRIOV_CAP		0x04	/* SR-IOV Capabilities */
+#define PCI_SRIOV_CTRL		0x08	/* SR-IOV Control */
+#define  PCI_SRIOV_CTRL_VFE	0x01	/* VF Enable */
+#define  PCI_SRIOV_CTRL_MSE	0x08	/* VF Memory Space Enable */
+#define PCI_SRIOV_INITIAL_VF	0x0c	/* Initial VFs */
+#define PCI_SRIOV_TOTAL_VF	0x0e	/* Total VFs */
+#define PCI_SRIOV_NUM_VF	0x10	/* Number of VFs */
+#define PCI_SRIOV_VF_OFFSET	0x14	/* First VF Offset */
+#define PCI_SRIOV_VF_STRIDE	0x16	/* Following VF Stride */
+#define PCI_SRIOV_VF_DID	0x1a	/* VF Device ID */
 
 /* Include the ID list */
 
@@ -868,6 +879,10 @@ struct pci_child_platdata {
 	unsigned short vendor;
 	unsigned short device;
 	unsigned int class;
+
+	bool is_virtfn;
+	struct udevice *pfdev;
+	int virtid;
 };
 
 /* PCI bus operations */
@@ -1178,6 +1193,9 @@ int pci_generic_mmap_read_config(
 	ulong *valuep,
 	enum pci_size_t size);
 
+int pci_sriov_init(struct udevice *pdev, int vf_en);
+int pci_sriov_get_totalvfs(struct udevice *pdev);
+
 #ifdef CONFIG_DM_PCI_COMPAT
 /* Compatibility with old naming */
 static inline int pci_write_config_dword(pci_dev_t pcidev, int offset,
Signature · 1 line
2.23.0
#16 lore raw

RFC PATCH 8/29 drivers: pci-uclass: add support for Single-Root I/O Virtualizaiton

Hi Suneel,

Quoted 9 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

If SR-IOV capability is present, use it to initialize Virtual function (VF) PCI device instances. pci_sriov_init function will read SR-IOV registers to create VF devices under the PF PCI device and also bind driver if available. This function needs to be invoked from Physical function device driver which expects VF device support, creating minimal impact on existing framework.

Please expand your abbreviations .

This seems like a nice implementation overall, but it needs a sandbox test and some documentation.

Quoted 12 lines
---
 drivers/pci/pci-uclass.c | 113 +++++++++++++++++++++++++++++++++++++++
 include/pci.h            |  18 +++++++
 2 files changed, 131 insertions(+)
drivers/pci/pci-uclass.c +0 -0
index 51f7135723..3be49c7115 100644

drivers/pci/pci-uclass.c int dm_pci_flr(struct udevice *dev) · line 1537

Quoted 3 lines
drivers/pci/pci-uclass.c +0 -0
@@ -1535,6 +1535,119 @@ int dm_pci_flr(struct udevice *dev)
        return 0;
 }
 

is this supported to be exported? It needs a comment.

Quoted 7 lines
drivers/pci/pci-uclass.c +7 -0
+int pci_sriov_init(struct udevice *pdev, int vf_en)
+{
+       u16 vendor, device;
+       struct udevice *bus;
+       struct udevice *dev;
+       pci_dev_t bdf;
+       u16 ctrl;

drivers/pci/pci-uclass.c int dm_pci_flr(struct udevice *dev) · line 1554

Quoted 10 lines
drivers/pci/pci-uclass.c +10 -0
+       u16 num_vfs;
+       u16 total_vf;
+       u16 vf_offset;
+       u16 vf_stride;
+       int vf, ret;
+       int pos;
+
+       pos = dm_pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);
+       if (!pos) {
+               printf("Error: SRIOV capability not found\n");

debug()

Quoted 23 lines
drivers/pci/pci-uclass.c +23 -0
+               return -ENOENT;
+       }
+
+       dm_pci_read_config16(pdev, pos + PCI_SRIOV_CTRL, &ctrl);
+
+       dm_pci_read_config16(pdev, pos + PCI_SRIOV_TOTAL_VF, &total_vf);
+       if (vf_en > total_vf)
+               vf_en = total_vf;
+       dm_pci_write_config16(pdev, pos + PCI_SRIOV_NUM_VF, vf_en);
+
+       ctrl |= PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE;
+       dm_pci_write_config16(pdev, pos + PCI_SRIOV_CTRL, ctrl);
+
+       dm_pci_read_config16(pdev, pos + PCI_SRIOV_NUM_VF, &num_vfs);
+       if (num_vfs > vf_en)
+               num_vfs = vf_en;
+
+       dm_pci_read_config16(pdev, pos + PCI_SRIOV_VF_OFFSET, &vf_offset);
+       dm_pci_read_config16(pdev, pos + PCI_SRIOV_VF_STRIDE, &vf_stride);
+
+       dm_pci_read_config16(pdev, PCI_VENDOR_ID, &vendor);
+       dm_pci_read_config16(pdev, pos + PCI_SRIOV_VF_DID, &device);
+

drivers/pci/pci-uclass.c int dm_pci_flr(struct udevice *dev) · line 1587

Quoted 10 lines
drivers/pci/pci-uclass.c +10 -0
+       bdf = dm_pci_get_bdf(pdev);
+
+       pci_get_bus(PCI_BUS(bdf), &bus);
+
+       if (!bus)
+               return -ENODEV;
+
+       bdf += PCI_BDF(0, 0, vf_offset);
+
+       for (vf = 0; vf < num_vfs; vf++) {

This function is way too long - can you please split?

Quoted 6 lines
drivers/pci/pci-uclass.c +6 -0
+               struct pci_child_platdata *pplat;
+               ulong class;
+
+               pci_bus_read_config(bus, bdf, PCI_CLASS_DEVICE,
+                                   &class, PCI_SIZE_16);
+

drivers/pci/pci-uclass.c int dm_pci_flr(struct udevice *dev) · line 1603

Quoted 10 lines
drivers/pci/pci-uclass.c +10 -0
+               debug("%s: bus %d/%s: found VF %x:%x\n", __func__,
+                     bus->seq, bus->name, PCI_DEV(bdf), PCI_FUNC(bdf));
+
+               /* Find this device in the device tree */
+               ret = pci_bus_find_devfn(bus, PCI_MASK_BUS(bdf), &dev);
+
+               if (ret == -ENODEV) {
+                       struct pci_device_id find_id;
+
+                       memset(&find_id, 0, sizeof(find_id));

'\0'

drivers/pci/pci-uclass.c int dm_pci_flr(struct udevice *dev) · line 1610

Quoted 7 lines
drivers/pci/pci-uclass.c +7 -0
+
+                       find_id.vendor = vendor;
+                       find_id.device = device;
+                       find_id.class = class;
+
+                       ret = pci_find_and_bind_driver(bus, &find_id,
+                                                      bdf, &dev);

Can you share any code with pci_bind_bus_devices(), perhaps but pulling part of it into a function?

Quoted 22 lines
drivers/pci/pci-uclass.c +22 -0
+
+                       if (ret)
+                               return ret;
+               }
+
+               /* Update the platform data */
+               pplat = dev_get_parent_platdata(dev);
+               pplat->devfn = PCI_MASK_BUS(bdf);
+               pplat->vendor = vendor;
+               pplat->device = device;
+               pplat->class = class;
+               pplat->is_virtfn = true;
+               pplat->pfdev = pdev;
+               pplat->virtid = vf * vf_stride + vf_offset;
+
+               debug("%s: bus %d/%s: found VF %x:%x %x:%x class %lx id %x\n",
+                     __func__, dev->seq, dev->name, PCI_DEV(bdf),
+                     PCI_FUNC(bdf), vendor, device, class, pplat->virtid);
+               bdf += PCI_BDF(0, 0, vf_stride);
+       }
+
+       return 0;

drivers/pci/pci-uclass.c int dm_pci_flr(struct udevice *dev) · line 1642

Quoted 10 lines
drivers/pci/pci-uclass.c +10 -0
+}
+
+int pci_sriov_get_totalvfs(struct udevice *pdev)
+{
+       u16 total_vf;
+       int pos;
+
+       pos = dm_pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);
+       if (!pos) {
+               printf("Error: SRIOV capability not found\n");

debug()

Quoted 34 lines
drivers/pci/pci-uclass.c +8 -0
+               return -ENOENT;
+       }
+
+       dm_pci_read_config16(pdev, pos + PCI_SRIOV_TOTAL_VF, &total_vf);
+
+       return total_vf;
+}
+
 UCLASS_DRIVER(pci) = {
        .id             = UCLASS_PCI,
        .name           = "pci",
include/pci.h +11 -0
index 0b14842285..1343d0e9fb 100644
@@ -475,6 +475,17 @@
 #define  PCI_EXP_DEVCAP_FLR     0x10000000 /* Function Level Reset */
 #define PCI_EXP_DEVCTL         8       /* Device Control */
 #define  PCI_EXP_DEVCTL_BCR_FLR 0x8000  /* Bridge Configuration Retry / FLR */
+/* Single Root I/O Virtualization Registers */
+#define PCI_SRIOV_CAP          0x04    /* SR-IOV Capabilities */
+#define PCI_SRIOV_CTRL         0x08    /* SR-IOV Control */
+#define  PCI_SRIOV_CTRL_VFE    0x01    /* VF Enable */
+#define  PCI_SRIOV_CTRL_MSE    0x08    /* VF Memory Space Enable */
+#define PCI_SRIOV_INITIAL_VF   0x0c    /* Initial VFs */
+#define PCI_SRIOV_TOTAL_VF     0x0e    /* Total VFs */
+#define PCI_SRIOV_NUM_VF       0x10    /* Number of VFs */
+#define PCI_SRIOV_VF_OFFSET    0x14    /* First VF Offset */
+#define PCI_SRIOV_VF_STRIDE    0x16    /* Following VF Stride */
+#define PCI_SRIOV_VF_DID       0x1a    /* VF Device ID */
 
 /* Include the ID list */
 

include/pci.h struct pci_child_platdata { · line 885

Quoted 7 lines
include/pci.h +4 -0
@@ -868,6 +879,10 @@ struct pci_child_platdata {
        unsigned short vendor;
        unsigned short device;
        unsigned int class;
+
+       bool is_virtfn;
+       struct udevice *pfdev;
+       int virtid;

Add comments. You can see them above!

include/pci.h int pci_generic_mmap_read_config( · line 1197

Quoted 9 lines
include/pci.h +2 -0
 };
 
 /* PCI bus operations */
@@ -1178,6 +1193,9 @@ int pci_generic_mmap_read_config(
        ulong *valuep,
        enum pci_size_t size);
 
+int pci_sriov_init(struct udevice *pdev, int vf_en);
+int pci_sriov_get_totalvfs(struct udevice *pdev);

Comments!

Quoted 7 lines
include/pci.h +1 -1
+
 #ifdef CONFIG_DM_PCI_COMPAT
 /* Compatibility with old naming */
 static inline int pci_write_config_dword(pci_dev_t pcidev, int offset,
--

2.23.0

Regards,
Simon

#17 lore raw

RFC PATCH 9/29 drivers: pci-uclass: add VF map_bar support for Enhanced Allocation

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Makes dm_pci_map_bar API available for Virtual function PCI devices based on SR-IOV capability which support Enhanced Allocation.

---
 drivers/pci/pci-uclass.c | 46 +++++++++++++++++++++++++++++++++++-----
 include/pci.h            |  3 +++
 2 files changed, 44 insertions(+), 5 deletions(-)
drivers/pci/pci-uclass.c +41 -5
index 3be49c7115..f9823231b1 100644
@@ -1359,13 +1359,19 @@ pci_addr_t dm_pci_phys_to_bus(struct udevice *dev, phys_addr_t phys_addr,
 }
 
 static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags,
-			       int ea_off)
+			       int ea_off, struct pci_child_platdata *pdata)
 {
 	int ea_cnt, i, entry_size;
 	int bar_id = (bar - PCI_BASE_ADDRESS_0) >> 2;
 	u32 ea_entry;
 	phys_addr_t addr;
 
+	/* In case of Virtual Function devices, device is Physical function,
+	 * so pdata will point to required VF specific data.
+	 */
+	if (pdata->is_virtfn)
+		bar_id += PCI_EA_BEI_VF_BAR0;
+
 	/* EA capability structure header */
 	dm_pci_read_config32(dev, ea_off, &ea_entry);
 	ea_cnt = (ea_entry >> 16) & PCI_EA_NUM_ENT_MASK;
@@ -1388,6 +1394,26 @@ static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags,
 			addr |= ((u64)ea_entry) << 32;
 		}
 
+		/* In case of Virtual Function devices using BAR
+		 * base and size, add offset for VFn BAR(1, 2, 3...n)
+		 */
+		if (pdata->is_virtfn) {
+			size_t sz;
+
+			/* MaxOffset, 1st DW */
+			dm_pci_read_config32(dev, ea_off + 8, &ea_entry);
+			sz = ea_entry & PCI_EA_FIELD_MASK;
+			/* Fill up lower 2 bits */
+			sz |= (~PCI_EA_FIELD_MASK);
+			if (ea_entry & PCI_EA_IS_64) {
+				/* MaxOffset 2nd DW */
+				dm_pci_read_config32(dev, ea_off + 16,
+						     &ea_entry);
+				sz |= ((u64)ea_entry) << 32;
+			}
+			addr += (pdata->virtid - 1) * (sz + 1);
+		}
+
 		/* size ignored for now */
 		return map_physmem(addr, 0, flags);
 	}
@@ -1400,17 +1426,27 @@ void *dm_pci_map_bar(struct udevice *dev, int bar, int flags)
 	pci_addr_t pci_bus_addr;
 	u32 bar_response;
 	int ea_off;
+	struct udevice *udev = dev;
+	struct pci_child_platdata *pdata = dev_get_parent_platdata(dev);
+
+	/* In case of Virtual Function devices, use PF udevice
+	 * as EA capability is defined in Physical Function
+	 */
+	if (pdata->is_virtfn)
+		udev = pdata->pfdev;
 
 	/*
 	 * if the function supports Enhanced Allocation use that instead of
 	 * BARs
+	 * Incase of virtual functions, pdata will help read VF BEI
+	 * and EA entry size.
 	 */
-	ea_off = dm_pci_find_capability(dev, PCI_CAP_ID_EA);
+	ea_off = dm_pci_find_capability(udev, PCI_CAP_ID_EA);
 	if (ea_off)
-		return dm_pci_map_ea_bar(dev, bar, flags, ea_off);
+		return dm_pci_map_ea_bar(udev, bar, flags, ea_off, pdata);
 
 	/* read BAR address */
-	dm_pci_read_config32(dev, bar, &bar_response);
+	dm_pci_read_config32(udev, bar, &bar_response);
 	pci_bus_addr = (pci_addr_t)(bar_response & ~0xf);
 
 	/*
@@ -1419,7 +1455,7 @@ void *dm_pci_map_bar(struct udevice *dev, int bar, int flags)
 	 * linear mapping.  In the future, this could read the BAR size
 	 * and pass that as the size if needed.
 	 */
-	return dm_pci_bus_to_virt(dev, pci_bus_addr, flags, 0, MAP_NOCACHE);
+	return dm_pci_bus_to_virt(udev, pci_bus_addr, flags, 0, MAP_NOCACHE);
 }
 
 static int _dm_pci_find_next_capability(struct udevice *dev, u8 pos, int cap)
include/pci.h +3 -0
index 1343d0e9fb..27819e86f5 100644
@@ -465,6 +465,9 @@
 #define PCI_EA_FIRST_ENT	4	/* First EA Entry in List */
 #define  PCI_EA_ES		0x00000007 /* Entry Size */
 #define  PCI_EA_BEI		0x000000f0 /* BAR Equivalent Indicator */
+/* 9-14 map to VF BARs 0-5 respectively */
+#define  PCI_EA_BEI_VF_BAR0	9
+#define  PCI_EA_BEI_VF_BAR5	14
 /* Base, MaxOffset registers */
 /* bit 0 is reserved */
 #define  PCI_EA_IS_64		0x00000002	/* 64-bit field flag */
Signature · 1 line
2.23.0
#18 lore raw

RFC PATCH 9/29 drivers: pci-uclass: add VF map_bar support for Enhanced Allocation

Hi Suneel,

Quoted 38 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

Makes dm_pci_map_bar API available for Virtual function PCI devices based on SR-IOV capability which support Enhanced Allocation.

---
 drivers/pci/pci-uclass.c | 46 +++++++++++++++++++++++++++++++++++-----
 include/pci.h            |  3 +++
 2 files changed, 44 insertions(+), 5 deletions(-)
drivers/pci/pci-uclass.c +7 -1
index 3be49c7115..f9823231b1 100644
@@ -1359,13 +1359,19 @@ pci_addr_t dm_pci_phys_to_bus(struct udevice *dev, phys_addr_t phys_addr,
 }
 
 static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags,
-                              int ea_off)
+                              int ea_off, struct pci_child_platdata *pdata)
 {
        int ea_cnt, i, entry_size;
        int bar_id = (bar - PCI_BASE_ADDRESS_0) >> 2;
        u32 ea_entry;
        phys_addr_t addr;
 
+       /* In case of Virtual Function devices, device is Physical function,
+        * so pdata will point to required VF specific data.
+        */
+       if (pdata->is_virtfn)
+               bar_id += PCI_EA_BEI_VF_BAR0;
+
        /* EA capability structure header */
        dm_pci_read_config32(dev, ea_off, &ea_entry);
        ea_cnt = (ea_entry >> 16) & PCI_EA_NUM_ENT_MASK;

drivers/pci/pci-uclass.c static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags, · line 1397

Quoted 4 lines
drivers/pci/pci-uclass.c +1 -0
@@ -1388,6 +1394,26 @@ static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags,
                        addr |= ((u64)ea_entry) << 32;
                }
 
+               /* In case of Virtual Function devices using BAR

/*
* In the case of a ...

drivers/pci/pci-uclass.c static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags, · line 1400

Quoted 3 lines
drivers/pci/pci-uclass.c +3 -0
+                * base and size, add offset for VFn BAR(1, 2, 3...n)
+                */
+               if (pdata->is_virtfn) {

Can this all go in a function?

Also I think this whole feature should be behind a Kconfig option as is increase code size.

Also remember to add sandbox tests.

Quoted 74 lines
drivers/pci/pci-uclass.c +30 -4
+                       size_t sz;
+
+                       /* MaxOffset, 1st DW */
+                       dm_pci_read_config32(dev, ea_off + 8, &ea_entry);
+                       sz = ea_entry & PCI_EA_FIELD_MASK;
+                       /* Fill up lower 2 bits */
+                       sz |= (~PCI_EA_FIELD_MASK);
+                       if (ea_entry & PCI_EA_IS_64) {
+                               /* MaxOffset 2nd DW */
+                               dm_pci_read_config32(dev, ea_off + 16,
+                                                    &ea_entry);
+                               sz |= ((u64)ea_entry) << 32;
+                       }
+                       addr += (pdata->virtid - 1) * (sz + 1);
+               }
+
                /* size ignored for now */
                return map_physmem(addr, 0, flags);
        }
@@ -1400,17 +1426,27 @@ void *dm_pci_map_bar(struct udevice *dev, int bar, int flags)
        pci_addr_t pci_bus_addr;
        u32 bar_response;
        int ea_off;
+       struct udevice *udev = dev;
+       struct pci_child_platdata *pdata = dev_get_parent_platdata(dev);
+
+       /* In case of Virtual Function devices, use PF udevice
+        * as EA capability is defined in Physical Function
+        */
+       if (pdata->is_virtfn)
+               udev = pdata->pfdev;
 
        /*
         * if the function supports Enhanced Allocation use that instead of
         * BARs
+        * Incase of virtual functions, pdata will help read VF BEI
+        * and EA entry size.
         */
-       ea_off = dm_pci_find_capability(dev, PCI_CAP_ID_EA);
+       ea_off = dm_pci_find_capability(udev, PCI_CAP_ID_EA);
        if (ea_off)
-               return dm_pci_map_ea_bar(dev, bar, flags, ea_off);
+               return dm_pci_map_ea_bar(udev, bar, flags, ea_off, pdata);
 
        /* read BAR address */
-       dm_pci_read_config32(dev, bar, &bar_response);
+       dm_pci_read_config32(udev, bar, &bar_response);
        pci_bus_addr = (pci_addr_t)(bar_response & ~0xf);
 
        /*
@@ -1419,7 +1455,7 @@ void *dm_pci_map_bar(struct udevice *dev, int bar, int flags)
         * linear mapping.  In the future, this could read the BAR size
         * and pass that as the size if needed.
         */
-       return dm_pci_bus_to_virt(dev, pci_bus_addr, flags, 0, MAP_NOCACHE);
+       return dm_pci_bus_to_virt(udev, pci_bus_addr, flags, 0, MAP_NOCACHE);
 }
 
 static int _dm_pci_find_next_capability(struct udevice *dev, u8 pos, int cap)
include/pci.h +3 -1
index 1343d0e9fb..27819e86f5 100644
@@ -465,6 +465,9 @@
 #define PCI_EA_FIRST_ENT       4       /* First EA Entry in List */
 #define  PCI_EA_ES             0x00000007 /* Entry Size */
 #define  PCI_EA_BEI            0x000000f0 /* BAR Equivalent Indicator */
+/* 9-14 map to VF BARs 0-5 respectively */
+#define  PCI_EA_BEI_VF_BAR0    9
+#define  PCI_EA_BEI_VF_BAR5    14
 /* Base, MaxOffset registers */
 /* bit 0 is reserved */
 #define  PCI_EA_IS_64          0x00000002      /* 64-bit field flag */
--
Quoted 2 lines

2.23.0

Regards,
Simon

#19 lore raw

RFC PATCH 10/29 drivers: pci-uclass: Add support for Alternate-RoutingID capability

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

If ARI capability is found on device, use it to update next function number in bus scan and also helps to skip unnecessary bdf scans.

---
 drivers/pci/pci-uclass.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/pci/pci-uclass.c +17 -1
index f9823231b1..b02588b552 100644
@@ -773,7 +773,7 @@ int pci_bind_bus_devices(struct udevice *bus)
 	ulong header_type;
 	pci_dev_t bdf, end;
 	bool found_multi;
-	int ret;
+	int ret, ari_off;
 
 	found_multi = false;
 	end = PCI_BDF(bus->seq, PCI_MAX_PCI_DEVICES - 1,
@@ -846,6 +846,22 @@ int pci_bind_bus_devices(struct udevice *bus)
 		pplat->vendor = vendor;
 		pplat->device = device;
 		pplat->class = class;
+
+		ari_off = dm_pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI);
+		if (ari_off) {
+			u16 ari_cap;
+
+			/* Read Next Function number in ARI Cap Register */
+			dm_pci_read_config16(dev, ari_off + 4, &ari_cap);
+			/* Update next scan on this function number,
+			 * subtract 1 in BDF to satisfy loop increment.
+			 */
+			if (ari_cap & 0xff00) {
+				bdf = PCI_BDF(PCI_BUS(bdf), PCI_DEV(ari_cap),
+					      PCI_FUNC(ari_cap));
+				bdf = bdf - 0x100;
+			}
+		}
 	}
 
 	return 0;
Signature · 1 line
2.23.0
#20 lore raw

RFC PATCH 10/29 drivers: pci-uclass: Add support for Alternate-RoutingID capability

Quoted 10 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

If ARI capability is found on device, use it to update next function number in bus scan and also helps to skip unnecessary bdf scans.

---
 drivers/pci/pci-uclass.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
Quoted 16 lines
drivers/pci/pci-uclass.c +1 -1
index f9823231b1..b02588b552 100644
@@ -773,7 +773,7 @@ int pci_bind_bus_devices(struct udevice *bus)
        ulong header_type;
        pci_dev_t bdf, end;
        bool found_multi;
-       int ret;
+       int ret, ari_off;
 
        found_multi = false;
        end = PCI_BDF(bus->seq, PCI_MAX_PCI_DEVICES - 1,
@@ -846,6 +846,22 @@ int pci_bind_bus_devices(struct udevice *bus)
                pplat->vendor = vendor;

drivers/pci/pci-uclass.c int pci_bind_bus_devices(struct udevice *bus) · line 856

Quoted 10 lines
drivers/pci/pci-uclass.c +8 -0
                pplat->device = device;
                pplat->class = class;
+
+               ari_off = dm_pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI);
+               if (ari_off) {
+                       u16 ari_cap;
+
+                       /* Read Next Function number in ARI Cap Register */
+                       dm_pci_read_config16(dev, ari_off + 4, &ari_cap);
+                       /* Update next scan on this function number,

/*
* Update ...

(please fix globally)

Also again I think this needs to be behind a Kconfig.

Quoted 12 lines
drivers/pci/pci-uclass.c +8 -1
+                        * subtract 1 in BDF to satisfy loop increment.
+                        */
+                       if (ari_cap & 0xff00) {
+                               bdf = PCI_BDF(PCI_BUS(bdf), PCI_DEV(ari_cap),
+                                             PCI_FUNC(ari_cap));
+                               bdf = bdf - 0x100;
+                       }
+               }
        }
 
        return 0;
--
Quoted 2 lines

2.23.0

Regards,
Simon

#21 lore raw

RFC PATCH 11/29 include: arm: asm: io: add 64bit clrbits and setbits helpers

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

---
 arch/arm/include/asm/io.h | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/include/asm/io.h +8 -0
index 723f3cf497..e87887c631 100644
@@ -226,6 +226,14 @@ static inline void __raw_readsl(unsigned long addr, void *data, int longlen)
 #define setbits_8(addr, set) setbits(8, addr, set)
 #define clrsetbits_8(addr, clear, set) clrsetbits(8, 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)
+
 /*
  * Now, pick up the machine-defined IO definitions
  */
Signature · 1 line
2.23.0
#23 lore raw

RFC PATCH 12/29 drivers: rtc: ds1337: add driver model support

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Add DM support to dallas 1337 RTC driver.

---
 drivers/rtc/Kconfig  |   7 ++
 drivers/rtc/ds1337.c | 170 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 177 insertions(+)
drivers/rtc/Kconfig +7 -0
index 8778cc7b26..c31c6a3368 100644
@@ -54,6 +54,13 @@ config RTC_DS1307
 	  Support for Dallas Semiconductor (now Maxim) DS1307 and DS1338/9 and
 	  compatible Real Time Clock devices.
 
+config RTC_DS1337
+	bool "Enable DS1337 driver"
+	depends on DM_RTC
+	help
+	  Support for Dallas Semiconductor (now Maxim) DS1337/39 and DS1388 and
+	  compatible Real Time Clock devices.
+
 config RTC_ISL1208
 	bool "Enable ISL1208 driver"
 	depends on DM_RTC
drivers/rtc/ds1337.c +170 -0

193 lines not on this page · raw message

Signature · 1 line
2.23.0
#24 lore raw

RFC PATCH 12/29 drivers: rtc: ds1337: add driver model support

Hi Suneel,

Quoted 10 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

Add DM support to dallas 1337 RTC driver.

---
 drivers/rtc/Kconfig  |   7 ++
 drivers/rtc/ds1337.c | 170 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 177 insertions(+)
Quoted 36 lines
drivers/rtc/Kconfig +7 -0
index 8778cc7b26..c31c6a3368 100644
@@ -54,6 +54,13 @@ config RTC_DS1307
          Support for Dallas Semiconductor (now Maxim) DS1307 and DS1338/9 and
          compatible Real Time Clock devices.
 
+config RTC_DS1337
+       bool "Enable DS1337 driver"
+       depends on DM_RTC
+       help
+         Support for Dallas Semiconductor (now Maxim) DS1337/39 and DS1388 and
+         compatible Real Time Clock devices.
+
 config RTC_ISL1208
        bool "Enable ISL1208 driver"
        depends on DM_RTC
drivers/rtc/ds1337.c +3 -0
index 9b31048e97..a1c63ffa08 100644
@@ -1,8 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
+ * Copyright (C) 2018 Marvell International Ltd.
+ *
  * (C) Copyright 2001-2008
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
  * Keith Outwater, keith_outwater at mvis.com`
+ *
  */
 
 /*

drivers/rtc/ds1337.c line 21

Quoted 5 lines
drivers/rtc/ds1337.c +2 -0
@@ -14,6 +17,10 @@
 #include <command.h>
 #include <rtc.h>
 #include <i2c.h>
+#include <dm.h>
+#include <fdtdec.h>

Can you put these after command.h?

Quoted 104 lines
drivers/rtc/ds1337.c +97 -0
+
+DECLARE_GLOBAL_DATA_PTR;
 
 /*
  * RTC register addresses
@@ -59,6 +66,167 @@
 #define RTC_STAT_BIT_A2F       0x2     /* Alarm 2 flag                 */
 #define RTC_STAT_BIT_OSF       0x80    /* Oscillator stop flag         */
 
+#ifdef CONFIG_DM_RTC
+
+/*
+ * Helper functions
+ */
+static uchar dm_rtc_read(struct udevice *dev, uchar reg)
+{
+       return dm_i2c_reg_read(dev, reg);
+}
+
+static void dm_rtc_write(struct udevice *dev, uchar reg, uchar val)
+{
+       dm_i2c_reg_write(dev, reg, val);
+}
+
+static int ds1337_rtc_get(struct udevice *dev, struct rtc_time *tmp)
+{
+       int rel = 0;
+       uchar sec, min, hour, mday, wday, mon_cent, year, control, status;
+
+       control = dm_rtc_read(dev, RTC_CTL_REG_ADDR);
+       status = dm_rtc_read(dev, RTC_STAT_REG_ADDR);
+       sec = dm_rtc_read(dev, RTC_SEC_REG_ADDR);
+       min = dm_rtc_read(dev, RTC_MIN_REG_ADDR);
+       hour = dm_rtc_read(dev, RTC_HR_REG_ADDR);
+       wday = dm_rtc_read(dev, RTC_DAY_REG_ADDR);
+       mday = dm_rtc_read(dev, RTC_DATE_REG_ADDR);
+       mon_cent = dm_rtc_read(dev, RTC_MON_REG_ADDR);
+       year = dm_rtc_read(dev, RTC_YR_REG_ADDR);
+
+       /* No century bit, assume year 2000 */
+#ifdef CONFIG_RTC_DS1388
+       mon_cent |= 0x80;
+#endif
+
+       debug("Get RTC year: %02x mon/cent: %02x mday: %02x wday: %02x",
+             year, mon_cent, mday, wday);
+       debug(" hr: %02x min: %02x sec: %02x control: %02x status: %02x\n",
+             hour, min, sec, control, status);
+
+       if (status & RTC_STAT_BIT_OSF) {
+               printf("### Warning: RTC oscillator has stopped\n");
+               /* clear the OSF flag */
+               dm_rtc_write(dev, RTC_STAT_REG_ADDR,
+                            dm_rtc_read(dev, RTC_STAT_REG_ADDR) &
+                            ~RTC_STAT_BIT_OSF);
+               rel = -1;
+       }
+
+       tmp->tm_sec  = bcd2bin(sec & 0x7F);
+       tmp->tm_min  = bcd2bin(min & 0x7F);
+       tmp->tm_hour = bcd2bin(hour & 0x3F);
+       tmp->tm_mday = bcd2bin(mday & 0x3F);
+       tmp->tm_mon  = bcd2bin(mon_cent & 0x1F);
+       tmp->tm_year = bcd2bin(year) + ((mon_cent & 0x80) ? 2100 : 2000);
+       tmp->tm_wday = bcd2bin((wday - 1) & 0x07);
+       tmp->tm_yday = 0;
+       tmp->tm_isdst = 0;
+
+       debug("Get DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
+             tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
+             tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+
+       return rel;
+}
+
+static int ds1337_rtc_set(struct udevice *dev, const struct rtc_time *tmp)
+{
+       uchar century;
+
+       debug("Set DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
+             tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
+             tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+
+       if (tmp->tm_year < 2000 || tmp->tm_year > 2199)
+               return -1;
+
+       dm_rtc_write(dev, RTC_YR_REG_ADDR, bin2bcd(tmp->tm_year % 100));
+
+       /* Assume 20YY as base, to fix mismatch with linux */
+       century = (tmp->tm_year >= 2100) ? 0x80 : 0;
+       dm_rtc_write(dev, RTC_MON_REG_ADDR, bin2bcd(tmp->tm_mon) | century);
+
+       dm_rtc_write(dev, RTC_DAY_REG_ADDR, bin2bcd(tmp->tm_wday + 1));
+       dm_rtc_write(dev, RTC_DATE_REG_ADDR, bin2bcd(tmp->tm_mday));
+       dm_rtc_write(dev, RTC_HR_REG_ADDR, bin2bcd(tmp->tm_hour));
+       dm_rtc_write(dev, RTC_MIN_REG_ADDR, bin2bcd(tmp->tm_min));
+       dm_rtc_write(dev, RTC_SEC_REG_ADDR, bin2bcd(tmp->tm_sec));
+
+       return 0;
+}
+
+/*
+ * Reset the RTC.  We also enable the oscillator output on the
+ * SQW/INTB* pin and program it for 32,768 Hz output. Note that

drivers/rtc/ds1337.c line 173

Quoted 10 lines
drivers/rtc/ds1337.c +10 -0
+ * according to the datasheet, turning on the square wave output
+ * increases the current drain on the backup battery from about
+ * 600 nA to 2uA. Define CONFIG_RTC_DS1337_NOOSC if you wish to turn
+ * off the OSC output.
+ */
+static int ds1337_rtc_reset(struct udevice *dev)
+{
+       uchar resetval = RTC_CTL_BIT_RS1 | RTC_CTL_BIT_RS2; /* Default DS1337 */
+
+#ifdef CONFIG_RTC_DS1337_NOOSC

if ()

and below

Quoted 66 lines
drivers/rtc/ds1337.c +58 -1
+       resetval |= RTC_CTL_BIT_INTCN;
+#elif defined CONFIG_RTC_DS1388
+       resetval = 0x0;
+#endif
+       dm_rtc_write(dev, RTC_CTL_REG_ADDR, resetval);
+
+#ifdef CONFIG_DS1339_TCR_VAL
+       dm_rtc_write(dev, RTC_TC_REG_ADDR, CONFIG_SYS_DS1339_TCR_VAL);
+#endif
+#ifdef CONFIG_DS1388_TCR_VAL
+       dm_rtc_write(dev, RTC_TC_REG_ADDR, CONFIG_SYS_DS1388_TCR_VAL);
+#endif
+       return 0;
+}
+
+static int ds1337_rtc_read8(struct udevice *dev, unsigned int reg)
+{
+       return dm_rtc_read(dev, reg);
+}
+
+static int ds1337_rtc_write8(struct udevice *dev, unsigned int reg, int val)
+{
+       dm_rtc_write(dev, reg, val);
+
+       return 0;
+}
+
+static int ds1337_rtc_probe(struct udevice *dev)
+{
+       ds1337_rtc_reset(dev);
+
+       return 0;
+}
+
+static const struct rtc_ops ds1337_rtc_ops = {
+       .get = ds1337_rtc_get,
+       .set = ds1337_rtc_set,
+       .reset = ds1337_rtc_reset,
+       .read8 = ds1337_rtc_read8,
+       .write8 = ds1337_rtc_write8,
+};
+
+static const struct udevice_id ds1337_rtc_ids[] = {
+       { .compatible = "dallas,ds1337" },
+       { }
+};
+
+U_BOOT_DRIVER(ds1337_rtc) = {
+       .name = "rtc-ds1337",
+       .id = UCLASS_RTC,
+       .of_match = ds1337_rtc_ids,
+       .probe = ds1337_rtc_probe,
+       .ops = &ds1337_rtc_ops,
+};
+
+#else /* !CONFIG_DM_RTC */
 
 static uchar rtc_read (uchar reg);
 static void rtc_write (uchar reg, uchar val);
@@ -188,3 +356,5 @@ static void rtc_write (uchar reg, uchar val)
 {
        i2c_reg_write (CONFIG_SYS_I2C_RTC_ADDR, reg, val);
 }
+
+#endif /* !CONFIG_DM_RTC */
--
Quoted 2 lines

2.23.0

Regards,
Simon

#25 lore raw

RFC PATCH 13/29 arch: include: octeontx: add headers for OcteonTX

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

---
 arch/arm/include/asm/arch-octeontx/board.h    |  121 ++
 arch/arm/include/asm/arch-octeontx/clock.h    |   25 +
 .../asm/arch-octeontx/csrs/csrs-mio_emm.h     | 1193 +++++++++++++++++
 .../include/asm/arch-octeontx/csrs/csrs-xcv.h |  428 ++++++
 arch/arm/include/asm/arch-octeontx/gpio.h     |    6 +
 arch/arm/include/asm/arch-octeontx/smc.h      |   20 +
 arch/arm/include/asm/arch-octeontx/soc.h      |   31 +
 7 files changed, 1824 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-octeontx/board.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/clock.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/csrs/csrs-mio_emm.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/csrs/csrs-xcv.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/gpio.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/smc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/soc.h
arch/arm/include/asm/arch-octeontx/board.h new file +121 -0
new file mode 100644
index 0000000000..99a3b71534
@@ -0,0 +1,121 @@
+/* SPDX-License-Identifier:    GPL-2.0
+ *
+ * Copyright (C) 2018 Marvell International Ltd.
+ *
+ * https://spdx.org/licenses
+ */
+
+#ifndef __BOARD_H__
+#define __BOARD_H__
+
+#include <asm/arch/soc.h>
+
+#define MAX_LMAC_PER_BGX 4
+#define LMAC_CNT MAX_LMAC_PER_BGX
+
+#if defined(CONFIG_TARGET_OCTEONTX_81XX)
+
+/** Maximum number of BGX interfaces per CPU node */
+#define MAX_BGX_PER_NODE	3
+#define OCTEONTX_XCV	/* RGMII Interface */
+
+#elif defined(CONFIG_TARGET_OCTEONTX_83XX)
+
+/** Maximum number of BGX interfaces per CPU node */
+#define MAX_BGX_PER_NODE	4
+
+#endif
+
+/** Reg offsets */
+#define RST_BOOT	0x87E006001600ULL
+
+/** Structure definitions */
+
+/**
+ * Register (RSL) rst_boot
+ *
+ * RST Boot Register This register is not accessible through ROM scripts;
+ * see SCR_WRITE32_S[ADDR].
+ */
+union rst_boot {
+	u64 u;
+	struct rst_boot_s {
+		u64 rboot_pin                        : 1;
+		u64 rboot                            : 1;
+		u64 reserved_2_32                    : 31;
+		u64 pnr_mul                          : 6;
+		u64 reserved_39                      : 1;
+		u64 c_mul                            : 7;
+		u64 reserved_47_52                   : 6;
+		u64 gpio_ejtag                       : 1;
+		u64 mcp_jtagdis                      : 1;
+		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 reserved_61_62                   : 2;
+		u64 chipkill                         : 1;
+	} s;
+	struct rst_boot_cn81xx {
+		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;
+	} cn81xx;
+	struct rst_boot_cn83xx {
+		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;
+	} cn83xx;
+};
+
+/** Function definitions */
+void mem_map_fill(void);
+int octeontx_board_has_pmp(void);
+const char *fdt_get_board_model(void);
+void fdt_parse_phy_info(void);
+void fdt_board_get_ethaddr(int bgx, int lmac, unsigned char *eth);
+
+void bgx_set_board_info(int bgx_id, int *mdio_bus, int *phy_addr,
+			bool *autoneg_dis, bool *lmac_reg, bool *lmac_enable);
+
+#endif /* __BOARD_H__ */
arch/arm/include/asm/arch-octeontx/clock.h new file +25 -0
new file mode 100644
index 0000000000..7bf600a1f2
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier:    GPL-2.0
+ *
+ * Copyright (C) 2018 Marvell International Ltd.
+ *
+ * https://spdx.org/licenses
+ */
+
+#ifndef __CLOCK_H__
+#define __CLOCK_H__
+
+/** System PLL reference clock */
+#define PLL_REF_CLK                     50000000        /* 50 MHz */
+#define NS_PER_REF_CLK_TICK             (1000000000 / PLL_REF_CLK)
+
+/**
+ * Returns the I/O clock speed in Hz
+ */
+u64 octeontx_get_io_clock(void);
+
+/**
+ * Returns the core clock speed in Hz
+ */
+u64 octeontx_get_core_clock(void);
+
+#endif /* __CLOCK_H__ */
arch/arm/include/asm/arch-octeontx/csrs/csrs-mio_emm.h new file +1193 -0

1,193 lines not on this page · raw message

arch/arm/include/asm/arch-octeontx/csrs/csrs-xcv.h new file +428 -0

428 lines not on this page · raw message

arch/arm/include/asm/arch-octeontx/gpio.h new file +6 -0
new file mode 100644
index 0000000000..3943ffd952
@@ -0,0 +1,6 @@
+/* SPDX-License-Identifier:    GPL-2.0
+ *
+ * Copyright (C) 2018 Marvell International Ltd.
+ *
+ * https://spdx.org/licenses
+ */
arch/arm/include/asm/arch-octeontx/smc.h new file +20 -0
new file mode 100644
index 0000000000..beff4d158f
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier:    GPL-2.0
+ *
+ * Copyright (C) 2018 Marvell International Ltd.
+ *
+ * https://spdx.org/licenses
+ */
+
+#ifndef __SMC_H__
+#define __SMC_H__
+
+/* OcteonTX Service Calls version numbers */
+#define OCTEONTX_VERSION_MAJOR	0x1
+#define OCTEONTX_VERSION_MINOR	0x0
+
+/* x1 - node number */
+#define OCTEONTX_DRAM_SIZE	0xc2000301
+
+ssize_t smc_dram_size(unsigned int node);
+
+#endif /* __SMC_H__ */
arch/arm/include/asm/arch-octeontx/soc.h new file +31 -0
new file mode 100644
index 0000000000..c16244020c
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier:    GPL-2.0
+ *
+ * Copyright (C) 2018 Marvell International Ltd.
+ *
+ * https://spdx.org/licenses
+ */
+
+#ifndef __SOC_H__
+#define __SOC_H__
+
+/* Product PARTNUM */
+#define CN81XX	0xA2
+#define CN83XX	0xA3
+
+#define otx_is_altpkg()	read_alt_pkg()
+#define otx_is_soc(soc)	(read_partnum() == (soc))
+#define otx_is_board(model) (!strcmp(read_board_name(), model))
+#define otx_is_platform(platform) (read_platform() == (platform))
+
+enum platform {
+	PLATFORM_HW = 0,
+	PLATFORM_EMULATOR = 1,
+	PLATFORM_ASIM = 3,
+};
+
+int read_platform(void);
+u8 read_partnum(void);
+const char *read_board_name(void);
+bool read_alt_pkg(void);
+
+#endif /* __SOC_H */
Signature · 1 line
2.23.0
#26 lore raw

RFC PATCH 13/29 arch: include: octeontx: add headers for OcteonTX

Hi,

Quoted 4 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

Quoted 17 lines
---
 arch/arm/include/asm/arch-octeontx/board.h    |  121 ++
 arch/arm/include/asm/arch-octeontx/clock.h    |   25 +
 .../asm/arch-octeontx/csrs/csrs-mio_emm.h     | 1193 +++++++++++++++++
 .../include/asm/arch-octeontx/csrs/csrs-xcv.h |  428 ++++++
 arch/arm/include/asm/arch-octeontx/gpio.h     |    6 +
 arch/arm/include/asm/arch-octeontx/smc.h      |   20 +
 arch/arm/include/asm/arch-octeontx/soc.h      |   31 +
 7 files changed, 1824 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-octeontx/board.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/clock.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/csrs/csrs-mio_emm.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/csrs/csrs-xcv.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/gpio.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/smc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/soc.h

I think we try to avoid bitfields, but I'm not sure if there is a rule, and this is arch-specific code.

+Tom Rini who will know

Please remember to comment your structs and members.

Regards,
SImon

#27 lore raw

[U-Boot] [EXT] Re: [RFC PATCH 13/29] arch: include: octeontx: add headers for OcteonTX

Hi Simon,

Quoted 6 lines · PST Simon Glass

External Email

----------------------------------------------------------------------
Hi,

On Tue, 29 Oct 2019 at 14:08, Suneel Garapati <[email protected]>

Quoted 21 lines · wrote:
Quoted 5 lines

From: Suneel Garapati <[email protected]>

---

Quoted 15 lines
 arch/arm/include/asm/arch-octeontx/board.h    |  121 ++
 arch/arm/include/asm/arch-octeontx/clock.h    |   25 +
 .../asm/arch-octeontx/csrs/csrs-mio_emm.h     | 1193 +++++++++++++++++
 .../include/asm/arch-octeontx/csrs/csrs-xcv.h |  428 ++++++
 arch/arm/include/asm/arch-octeontx/gpio.h     |    6 +
 arch/arm/include/asm/arch-octeontx/smc.h      |   20 +
 arch/arm/include/asm/arch-octeontx/soc.h      |   31 +
 7 files changed, 1824 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-octeontx/board.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/clock.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/csrs/csrs-mio_emm.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/csrs/csrs-xcv.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/gpio.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/smc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/soc.h
Quoted 2 lines

I think we try to avoid bitfields, but I'm not sure if there is a rule, and this is arch-specific code.

These bitfields are arch specific and often are created by scripts directly from the hardware definitions. We specifically strip out the comments in our register bitfields because otherwise the files would be huge. What would normally be in the comments would match what is in our hardware reference manual.

Quoted 7 lines

+Tom Rini who will know

Please remember to comment your structs and members.

Regards,
SImon

Regards,

Aaron

#28 lore raw

RFC PATCH 14/29 arch: include: octeontx2: add headers for OcteonTX2

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

---
 arch/arm/include/asm/arch-octeontx2/board.h   |   123 +
 arch/arm/include/asm/arch-octeontx2/clock.h   |    24 +
 .../asm/arch-octeontx2/csrs/csrs-cgx.h        |  7835 ++++++++++++
 .../asm/arch-octeontx2/csrs/csrs-lmt.h        |    60 +
 .../asm/arch-octeontx2/csrs/csrs-mio_emm.h    |  1193 ++
 .../asm/arch-octeontx2/csrs/csrs-nix.h        | 10482 ++++++++++++++++
 .../asm/arch-octeontx2/csrs/csrs-npa.h        |  2296 ++++
 .../asm/arch-octeontx2/csrs/csrs-npc.h        |  1930 +++
 .../asm/arch-octeontx2/csrs/csrs-rvu.h        |  2430 ++++
 arch/arm/include/asm/arch-octeontx2/gpio.h    |     6 +
 arch/arm/include/asm/arch-octeontx2/smc-id.h  |    32 +
 arch/arm/include/asm/arch-octeontx2/smc.h     |    18 +
 arch/arm/include/asm/arch-octeontx2/soc.h     |    31 +
 13 files changed, 26460 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-octeontx2/board.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/clock.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-cgx.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-lmt.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-mio_emm.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-nix.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-npa.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-npc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-rvu.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/gpio.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/smc-id.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/smc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/soc.h
arch/arm/include/asm/arch-octeontx2/board.h new file +123 -0
new file mode 100644
index 0000000000..5af911cc5b
@@ -0,0 +1,123 @@
+/* SPDX-License-Identifier:    GPL-2.0
+ *
+ * Copyright (C) 2018 Marvell International Ltd.
+ *
+ * https://spdx.org/licenses
+ */
+
+#ifndef __BOARD_H__
+#define __BOARD_H__
+
+#include <asm/arch/soc.h>
+
+/** Reg offsets */
+#define RST_BOOT		0x87E006001600ULL
+
+#define CPC_BOOT_OWNERX(a)	0x86D000000160ULL + (8 * (a))
+
+/** Structure definitions */
+/**
+ * Register (NCB32b) cpc_boot_owner#
+ *
+ * CPC Boot Owner Registers These registers control an external arbiter
+ * for the boot device (SPI/eMMC) across multiple external devices. There
+ * is a register for each requester: _ \<0\> - SCP          - reset on
+ * SCP reset _ \<1\> - MCP          - reset on MCP reset _ \<2\> - AP
+ * Secure    - reset on core reset _ \<3\> - AP Nonsecure - reset on core
+ * reset  These register is only writable to the corresponding
+ * requestor(s) permitted with CPC_PERMIT.
+ */
+union cpc_boot_ownerx {
+	u32 u;
+	struct cpc_boot_ownerx_s {
+		u32 boot_req		: 1;
+		u32 reserved_1_7	: 7;
+		u32 boot_wait		: 1;
+		u32 reserved_9_31	: 23;
+	} s;
+};
+
+/**
+ * Register (RSL) rst_boot
+ *
+ * RST Boot Register This register is not accessible through ROM scripts;
+ * see SCR_WRITE32_S[ADDR].
+ */
+union rst_boot {
+	u64 u;
+	struct rst_boot_s {
+		u64 rboot_pin                        : 1;
+		u64 rboot                            : 1;
+		u64 reserved_2_32                    : 31;
+		u64 pnr_mul                          : 6;
+		u64 reserved_39                      : 1;
+		u64 c_mul                            : 7;
+		u64 reserved_47_52                   : 6;
+		u64 gpio_ejtag                       : 1;
+		u64 mcp_jtagdis                      : 1;
+		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 reserved_61_62                   : 2;
+		u64 chipkill                         : 1;
+	} s;
+	struct rst_boot_cn96xx {
+		u64 rboot_pin                        : 1;
+		u64 rboot                            : 1;
+		u64 reserved_2_23                    : 22;
+		u64 cpt_mul                          : 7;
+		u64 reserved_31_32                   : 2;
+		u64 pnr_mul                          : 6;
+		u64 reserved_39                      : 1;
+		u64 c_mul                            : 7;
+		u64 reserved_47_52                   : 6;
+		u64 gpio_ejtag                       : 1;
+		u64 mcp_jtagdis                      : 1;
+		u64 dis_scan                         : 1;
+		u64 dis_huk                          : 1;
+		u64 vrm_err                          : 1;
+		u64 reserved_58_59                   : 2;
+		u64 trusted_mode                     : 1;
+		u64 scp_jtagdis                      : 1;
+		u64 jtagdis                          : 1;
+		u64 chipkill                         : 1;
+	} cn96xx;
+	struct rst_boot_cnf95xx {
+		u64 rboot_pin                        : 1;
+		u64 rboot                            : 1;
+		u64 reserved_2_7                     : 6;
+		u64 bphy_mul                         : 7;
+		u64 reserved_15                      : 1;
+		u64 dsp_mul                          : 7;
+		u64 reserved_23                      : 1;
+		u64 cpt_mul                          : 7;
+		u64 reserved_31_32                   : 2;
+		u64 pnr_mul                          : 6;
+		u64 reserved_39                      : 1;
+		u64 c_mul                            : 7;
+		u64 reserved_47_52                   : 6;
+		u64 gpio_ejtag                       : 1;
+		u64 mcp_jtagdis                      : 1;
+		u64 dis_scan                         : 1;
+		u64 dis_huk                          : 1;
+		u64 vrm_err                          : 1;
+		u64 reserved_58_59                   : 2;
+		u64 trusted_mode                     : 1;
+		u64 scp_jtagdis                      : 1;
+		u64 jtagdis                          : 1;
+		u64 chipkill                         : 1;
+	} cnf95xx;
+};
+
+/** Function definitions */
+void mem_map_fill(void);
+int fdt_get_board_mac_cnt(void);
+u64 fdt_get_board_mac_addr(void);
+const char *fdt_get_board_model(void);
+void octeontx2_board_get_mac_addr(u8 index, u8 *mac_addr);
+void acquire_flash_arb(bool acquire);
+
+#endif /* __BOARD_H__ */
arch/arm/include/asm/arch-octeontx2/clock.h new file +24 -0
new file mode 100644
index 0000000000..7be8852a55
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier:    GPL-2.0
+ *
+ * Copyright (C) 2018 Marvell International Ltd.
+ *
+ * https://spdx.org/licenses
+ */
+
+#ifndef __CLOCK_H__
+
+/** System PLL reference clock */
+#define PLL_REF_CLK                     50000000        /* 50 MHz */
+#define NS_PER_REF_CLK_TICK             (1000000000 / PLL_REF_CLK)
+
+/**
+ * Returns the I/O clock speed in Hz
+ */
+u64 octeontx_get_io_clock(void);
+
+/**
+ * Returns the core clock speed in Hz
+ */
+u64 octeontx_get_core_clock(void);
+
+#endif /* __CLOCK_H__ */
arch/arm/include/asm/arch-octeontx2/csrs/csrs-cgx.h new file +7835 -0

2,853 lines not on this page · raw message

arch/arm/include/asm/arch-octeontx2/csrs/csrs-lmt.h new file +60 -0

60 lines not on this page · raw message

arch/arm/include/asm/arch-octeontx2/csrs/csrs-mio_emm.h new file +1193 -0

1,193 lines not on this page · raw message

arch/arm/include/asm/arch-octeontx2/csrs/csrs-nix.h new file +10482 -0

10,482 lines not on this page · raw message

arch/arm/include/asm/arch-octeontx2/csrs/csrs-npa.h new file +2296 -0

2,296 lines not on this page · raw message

arch/arm/include/asm/arch-octeontx2/csrs/csrs-npc.h new file +1930 -0

1,930 lines not on this page · raw message

arch/arm/include/asm/arch-octeontx2/csrs/csrs-rvu.h new file +2430 -0

2,430 lines not on this page · raw message

arch/arm/include/asm/arch-octeontx2/gpio.h new file +6 -0
new file mode 100644
index 0000000000..3943ffd952

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

arch/arm/include/asm/arch-octeontx2/smc-id.h new file +32 -0
new file mode 100644
index 0000000000..93a81b2954

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

arch/arm/include/asm/arch-octeontx2/smc.h new file +18 -0
new file mode 100644
index 0000000000..8e719a2aad

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

arch/arm/include/asm/arch-octeontx2/soc.h new file +31 -0
new file mode 100644
index 0000000000..c44b8ec367

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.23.0

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

#29 lore raw

RFC PATCH 14/29 arch: include: octeontx2: add headers for OcteonTX2

Hi,

Quoted 24 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

---
 arch/arm/include/asm/arch-octeontx2/board.h   |   123 +
 arch/arm/include/asm/arch-octeontx2/clock.h   |    24 +
 .../asm/arch-octeontx2/csrs/csrs-cgx.h        |  7835 ++++++++++++
 .../asm/arch-octeontx2/csrs/csrs-lmt.h        |    60 +
 .../asm/arch-octeontx2/csrs/csrs-mio_emm.h    |  1193 ++
 .../asm/arch-octeontx2/csrs/csrs-nix.h        | 10482 ++++++++++++++++
 .../asm/arch-octeontx2/csrs/csrs-npa.h        |  2296 ++++
 .../asm/arch-octeontx2/csrs/csrs-npc.h        |  1930 +++
 .../asm/arch-octeontx2/csrs/csrs-rvu.h        |  2430 ++++
 arch/arm/include/asm/arch-octeontx2/gpio.h    |     6 +
 arch/arm/include/asm/arch-octeontx2/smc-id.h  |    32 +
 arch/arm/include/asm/arch-octeontx2/smc.h     |    18 +
 arch/arm/include/asm/arch-octeontx2/soc.h     |    31 +
 13 files changed, 26460 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-octeontx2/board.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/clock.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-cgx.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-lmt.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-mio_emm.h
Quoted 9 lines
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-nix.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-npa.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-npc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-rvu.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/gpio.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/smc-id.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/smc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/soc.h

It is possible to reduce the size of these files to only what is used?

Also, are all these files generated? I think the generated files should be in their own patch, if not.

Regards,
Simon

#30 lore raw

RFC PATCH 15/29 drivers: ata: ahci: update max id if it is more than available ports

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

After check for maximum between max id and available ports, also check if available port count is less than max id and update.

---
 drivers/ata/ahci.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/ata/ahci.c +3 -0
index 21a89eba5a..ca075b58bc 100644
@@ -1177,6 +1177,9 @@ int ahci_probe_scsi(struct udevice *ahci_dev, ulong base)
 	 */
 	uc_plat->max_id = max_t(unsigned long, uc_priv->n_ports,
 				uc_plat->max_id);
+	/* If port count is less than max_id, update max_id */
+	if (uc_priv->n_ports < uc_plat->max_id)
+		uc_plat->max_id = uc_priv->n_ports;
 
 	return 0;
 }
Signature · 1 line
2.23.0
#31 lore raw

RFC PATCH 15/29 drivers: ata: ahci: update max id if it is more than available ports

Hi Suneel,

Quoted 16 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

After check for maximum between max id and available ports, also check if available port count is less than max id and update.

---
 drivers/ata/ahci.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/ata/ahci.c +0 -0
index 21a89eba5a..ca075b58bc 100644

drivers/ata/ahci.c int ahci_probe_scsi(struct udevice *ahci_dev, ulong base) · line 1182

Quoted 6 lines
drivers/ata/ahci.c +3 -0
@@ -1177,6 +1177,9 @@ int ahci_probe_scsi(struct udevice *ahci_dev, ulong base)
         */
        uc_plat->max_id = max_t(unsigned long, uc_priv->n_ports,
                                uc_plat->max_id);
+       /* If port count is less than max_id, update max_id */
+       if (uc_priv->n_ports < uc_plat->max_id)
+               uc_plat->max_id = uc_priv->n_ports;

What is the actually change with this code? It looks like it does the same thinas the old code?

Quoted 6 lines
drivers/ata/ahci.c +0 -1
        return 0;
 }
--

2.23.0

Regards,
Simon

#32 lore raw

RFC PATCH 16/29 drivers: ata: ahci: fill upper 32bit buffer address in sg descriptor

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

For platforms that support 64bit physical address, fill upper 32bit of buffer address in scatter-gather descriptor. This is needed for platforms with more than 4GB DRAM.

---
 drivers/ata/ahci.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/ata/ahci.c +5 -0
index ca075b58bc..5f929700c0 100644
@@ -506,6 +506,11 @@ static int ahci_fill_sg(struct ahci_uc_priv *uc_priv, u8 port,
 		ahci_sg->addr =
 		    cpu_to_le32((unsigned long) buf + i * MAX_DATA_BYTE_COUNT);
 		ahci_sg->addr_hi = 0;
+#ifdef CONFIG_PHYS_64BIT
+		ahci_sg->addr_hi =
+		    cpu_to_le32((u32)(((u64)(buf + i * MAX_DATA_BYTE_COUNT)
+				      >> 16) >> 16));
+#endif
 		ahci_sg->flags_size = cpu_to_le32(0x3fffff &
 					  (buf_len < MAX_DATA_BYTE_COUNT
 					   ? (buf_len - 1)
Signature · 1 line
2.23.0
#33 lore raw

RFC PATCH 16/29 drivers: ata: ahci: fill upper 32bit buffer address in sg descriptor

Quoted 17 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

For platforms that support 64bit physical address, fill upper 32bit of buffer address in scatter-gather descriptor. This is needed for platforms with more than 4GB DRAM.

---
 drivers/ata/ahci.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/ata/ahci.c +0 -0
index ca075b58bc..5f929700c0 100644

drivers/ata/ahci.c static int ahci_fill_sg(struct ahci_uc_priv *uc_priv, u8 port, · line 512

Quoted 7 lines
drivers/ata/ahci.c +4 -0
@@ -506,6 +506,11 @@ static int ahci_fill_sg(struct ahci_uc_priv *uc_priv, u8 port,
                ahci_sg->addr =
                    cpu_to_le32((unsigned long) buf + i * MAX_DATA_BYTE_COUNT);
                ahci_sg->addr_hi = 0;
+#ifdef CONFIG_PHYS_64BIT
+               ahci_sg->addr_hi =
+                   cpu_to_le32((u32)(((u64)(buf + i * MAX_DATA_BYTE_COUNT)
+                                     >> 16) >> 16));

How about something like:

ulong addr = (ulong)buf + i * MAX_DATA_BYTE_COUNT;

ahci_sg->addr = cpu_to_le32(addr);
ahci_sg->addr_hi = 0;
#ifdef CONFIG_PHYS_64BIT
ahci_sg->addr_hi = addr >> 32ULL;
#endif

Regards,
Simon

#34 lore raw

RFC PATCH 17/29 drivers: ata: ahci: add BAR index quirk for OcteonTX

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

For SATA controller found on OcteonTX SoC's, use
non-standard PCI BAR0 instead of BAR5.

---
 drivers/ata/ahci.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/ata/ahci.c +7 -0
index 5f929700c0..f8fd2043e3 100644
@@ -1193,10 +1193,17 @@ int ahci_probe_scsi(struct udevice *ahci_dev, ulong base)
 int ahci_probe_scsi_pci(struct udevice *ahci_dev)
 {
 	ulong base;
+	u16 vendor, device;
 
 	base = (ulong)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_5,
 				     PCI_REGION_MEM);
 
+	dm_pci_read_config16(ahci_dev, PCI_VENDOR_ID, &vendor);
+	dm_pci_read_config16(ahci_dev, PCI_DEVICE_ID, &device);
+
+	if (vendor == 0x177d && device == 0xa01c)
+		base = (uintptr_t)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_0,
+						 PCI_REGION_MEM);
 	return ahci_probe_scsi(ahci_dev, base);
 }
 #endif
Signature · 1 line
2.23.0
#35 lore raw

RFC PATCH 17/29 drivers: ata: ahci: add BAR index quirk for OcteonTX

Hi Suneel,

Quoted 18 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

For SATA controller found on OcteonTX SoC's, use
non-standard PCI BAR0 instead of BAR5.

---
 drivers/ata/ahci.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/ata/ahci.c +0 -0
index 5f929700c0..f8fd2043e3 100644
@@ -1193,10 +1193,17 @@ int ahci_probe_scsi(struct udevice *ahci_dev, ulong base)
 int ahci_probe_scsi_pci(struct udevice *ahci_dev)
 {

drivers/ata/ahci.c int ahci_probe_scsi(struct udevice *ahci_dev, ulong base) · line 1204

Quoted 10 lines
drivers/ata/ahci.c +5 -0
        ulong base;
+       u16 vendor, device;
 
        base = (ulong)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_5,
                                     PCI_REGION_MEM);
 
+       dm_pci_read_config16(ahci_dev, PCI_VENDOR_ID, &vendor);
+       dm_pci_read_config16(ahci_dev, PCI_DEVICE_ID, &device);
+
+       if (vendor == 0x177d && device == 0xa01c)

This should use constants from pci_ids.h

Quoted 8 lines
drivers/ata/ahci.c +2 -1
+               base = (uintptr_t)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_0,
+                                                PCI_REGION_MEM);
        return ahci_probe_scsi(ahci_dev, base);
 }
 #endif
--

2.23.0

Regards,
Simon

#36 lore raw

RFC PATCH 18/29 drivers: pci: add PCI controller driver for OcteonTX

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Adds support for PCI ECAM/PEM controllers found on OcteonTX or OcteonTX2 SoC platforms.

---
 drivers/pci/Kconfig        |   8 +
 drivers/pci/Makefile       |   1 +
 drivers/pci/pci_octeontx.c | 538 +++++++++++++++++++++++++++++++++++++
 3 files changed, 547 insertions(+)
 create mode 100644 drivers/pci/pci_octeontx.c
drivers/pci/Kconfig +8 -0
index 752439afcf..e865a06749 100644
@@ -115,6 +115,14 @@ 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_OCTEONTX
+	bool "OcteonTX PCI support"
+	depends on (ARCH_OCTEONTX || ARCH_OCTEONTX2)
+	help
+	  Enable support for the OcteonTX/TX2 SoC family ECAM/PEM 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 b1d3dc8610..7119d8bcb2 100644
@@ -40,3 +40,4 @@ obj-$(CONFIG_PCI_XILINX) += pcie_xilinx.o
 obj-$(CONFIG_PCIE_INTEL_FPGA) += pcie_intel_fpga.o
 obj-$(CONFIG_PCI_KEYSTONE) += pcie_dw_ti.o
 obj-$(CONFIG_PCIE_MEDIATEK) += pcie_mediatek.o
+obj-$(CONFIG_PCI_OCTEONTX) += pci_octeontx.o
drivers/pci/pci_octeontx.c new file +538 -0

538 lines not on this page · raw message

Signature · 1 line
2.23.0
#37 lore raw

RFC PATCH 18/29 drivers: pci: add PCI controller driver for OcteonTX

Hi Suneel,

Quoted 55 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

Adds support for PCI ECAM/PEM controllers found on OcteonTX or OcteonTX2 SoC platforms.

---
 drivers/pci/Kconfig        |   8 +
 drivers/pci/Makefile       |   1 +
 drivers/pci/pci_octeontx.c | 538 +++++++++++++++++++++++++++++++++++++
 3 files changed, 547 insertions(+)
 create mode 100644 drivers/pci/pci_octeontx.c
drivers/pci/Kconfig +8 -0
index 752439afcf..e865a06749 100644
@@ -115,6 +115,14 @@ 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_OCTEONTX
+       bool "OcteonTX PCI support"
+       depends on (ARCH_OCTEONTX || ARCH_OCTEONTX2)
+       help
+         Enable support for the OcteonTX/TX2 SoC family ECAM/PEM 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 b1d3dc8610..7119d8bcb2 100644
@@ -40,3 +40,4 @@ obj-$(CONFIG_PCI_XILINX) += pcie_xilinx.o
 obj-$(CONFIG_PCIE_INTEL_FPGA) += pcie_intel_fpga.o
 obj-$(CONFIG_PCI_KEYSTONE) += pcie_dw_ti.o
 obj-$(CONFIG_PCIE_MEDIATEK) += pcie_mediatek.o
+obj-$(CONFIG_PCI_OCTEONTX) += pci_octeontx.o
drivers/pci/pci_octeontx.c new file +7 -0
new file mode 100644
index 0000000000..d754f98bbd
@@ -0,0 +1,538 @@
+// SPDX-License-Identifier:    GPL-2.0
+/*
+ * Copyright (C) 2018 Marvell International Ltd.
+ *
+ * https://spdx.org/licenses
+ */
+

drivers/pci/pci_octeontx.c line 17

Quoted 10 lines
drivers/pci/pci_octeontx.c new file +10 -0
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <fdtdec.h>
+#include <malloc.h>
+#include <pci.h>
+
+#include <asm/io.h>
+
+#if defined(CONFIG_ARCH_OCTEONTX2)

No need for this. We cannot have #ifdefs in drivers.

Instead, use a .data field in the compatible strings and do the code conditionally at runtime.

e.g.

enum {
TYPE1,
TYPE2,
TYPE3,
};

static const struct udevice_id pci_octeontx_ecam_ids[] = {
{ .compatible = "cavium,pci-host-thunder-ecam", TYPE1 }, { .compatible = "cavium,pci-host-octeontx-ecam",TYPE2 }, { .compatible = "pci-host-ecam-generic", TYPE3 }, { }
};

...

priv->type = dev_get_driver_data(dev);

if (priv->type == TYPE2)
... do something

Quoted 8 lines
drivers/pci/pci_octeontx.c new file +8 -0
+
+#define PEM_CFG_WR 0x18
+#define PEM_CFG_RD 0x20
+
+#define PCIERC_RASDP_DE_ME             0x440
+#define PCIERC_RASDP_EP_CTL            0x420
+#define PCIERC_RAS_EINJ_EN             0x348
+#define PCIERC_RAS_EINJ_CTL6PE         0x3A4

drivers/pci/pci_octeontx.c line 35

Quoted 10 lines
drivers/pci/pci_octeontx.c new file +10 -0
+#define PCIERC_RAS_EINJ_CTL6_CMPP0     0x364
+#define PCIERC_RAS_EINJ_CTL6_CMPV0     0x374
+#define PCIERC_RAS_EINJ_CTL6_CHGP1     0x388
+#define PCIERC_RAS_EINJ_CTL6_CHGV1     0x398
+
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct octeontx_pci {

comments!

drivers/pci/pci_octeontx.c line 40

Quoted 5 lines
drivers/pci/pci_octeontx.c new file +5 -0
+       unsigned int type;
+
+       struct fdt_resource cfg;
+       struct fdt_resource bus;
+#if defined(CONFIG_ARCH_OCTEONTX2)

Again please remove all #ifdefs in drivers

Quoted 8 lines
drivers/pci/pci_octeontx.c new file +8 -0
+       struct fdt_resource pem;
+#endif
+};
+
+static int pci_octeontx_ecam_read_config(struct udevice *bus, pci_dev_t bdf,
+                                        uint offset, ulong *valuep,
+                                        enum pci_size_t size)
+{

drivers/pci/pci_octeontx.c line 58

Quoted 10 lines
drivers/pci/pci_octeontx.c new file +10 -0
+       struct octeontx_pci *pcie = (void *)dev_get_priv(bus);
+       struct pci_controller *hose = dev_get_uclass_priv(bus);
+       uintptr_t address;
+       u32 b, d, f;
+
+       b = PCI_BUS(bdf) + pcie->bus.start - hose->first_busno;
+       d = PCI_DEV(bdf);
+       f = PCI_FUNC(bdf);
+
+       address = (b << 20) | (d << 15) | (f << 12) | offset;

Looks like this all repeats below, so should go in a function.

Also please avoid single-char var names unless they are index variables. E.g. bus, devno, func

Quoted 7 lines
drivers/pci/pci_octeontx.c new file +7 -0
+
+       address += pcie->cfg.start;
+
+       switch (size) {
+       case PCI_SIZE_8:
+               *valuep = readb(address);
+               break;

drivers/pci/pci_octeontx.c line 75

Quoted 10 lines
drivers/pci/pci_octeontx.c new file +10 -0
+       case PCI_SIZE_16:
+               *valuep = readw(address);
+               break;
+       case PCI_SIZE_32:
+               *valuep = readl(address);
+               break;
+       };
+
+       debug("%02x.%02x.%02x: u%d %x -> %lx\n",
+             b, d, f, size, offset, *valuep);

blank line before return (globally please)

Quoted 68 lines
drivers/pci/pci_octeontx.c new file +68 -0
+       return 0;
+}
+
+static int pci_octeontx_ecam_write_config(struct udevice *bus, pci_dev_t bdf,
+                                         uint offset, ulong valuep,
+                                         enum pci_size_t size)
+{
+       struct octeontx_pci *pcie = (void *)dev_get_priv(bus);
+       struct pci_controller *hose = dev_get_uclass_priv(bus);
+       uintptr_t address;
+       u32 b, d, f;
+
+       b = PCI_BUS(bdf) + pcie->bus.start - hose->first_busno;
+       d = PCI_DEV(bdf);
+       f = PCI_FUNC(bdf);
+
+       address = (b << 20) | (d << 15) | (f << 12) | offset;
+
+       address += pcie->cfg.start;
+
+       switch (size) {
+       case PCI_SIZE_8:
+               writeb(valuep, address);
+               break;
+       case PCI_SIZE_16:
+               writew(valuep, address);
+               break;
+       case PCI_SIZE_32:
+               writel(valuep, address);
+               break;
+       };
+
+       debug("%02x.%02x.%02x: u%d %x <- %lx\n",
+             b, d, f, size, offset, valuep);
+       return 0;
+}
+
+static int pci_octeontx_pem_read_config(struct udevice *bus, pci_dev_t bdf,
+                                       uint offset, ulong *valuep,
+                                       enum pci_size_t size)
+{
+       struct octeontx_pci *pcie = (void *)dev_get_priv(bus);
+       struct pci_controller *hose = dev_get_uclass_priv(bus);
+       uintptr_t address;
+       u32 b, d, f;
+       u8  hdrtype;
+       u8  pri_bus = pcie->bus.start + 1 - hose->first_busno;
+       u32 bus_offs = (pri_bus << 16) | (pri_bus << 8) | (pri_bus << 0);
+
+       b = PCI_BUS(bdf) + 1 - hose->first_busno;
+       d = PCI_DEV(bdf);
+       f = PCI_FUNC(bdf);
+
+       address = (b << 24) | (d << 19) | (f << 16);
+
+       address += pcie->cfg.start;
+
+       *valuep = pci_conv_32_to_size(~0UL, offset, size);
+
+       if (b == 1 && d > 0)
+               return 0;
+
+       switch (size) {
+       case PCI_SIZE_8:
+               *valuep = readb(address + offset);
+               break;
+       case PCI_SIZE_16:
+               *valuep = readw(address + offset);

drivers/pci/pci_octeontx.c line 153

Quoted 10 lines
drivers/pci/pci_octeontx.c new file +10 -0
+               break;
+       case PCI_SIZE_32:
+               *valuep = readl(address + offset);
+               break;
+       default:
+               printf("Invalid size\n");
+       }
+
+       hdrtype = readb(address + PCI_HEADER_TYPE);
+

drop blank line...best to group code by related lines.

comment here?

Quoted 27 lines
drivers/pci/pci_octeontx.c new file +27 -0
+       if (hdrtype == PCI_HEADER_TYPE_BRIDGE &&
+           offset >= PCI_PRIMARY_BUS &&
+           offset <= PCI_SUBORDINATE_BUS &&
+           *valuep != pci_conv_32_to_size(~0UL, offset, size)) {
+               *valuep -= pci_conv_32_to_size(bus_offs, offset, size);
+       }
+       debug("%02x.%02x.%02x: u%d %x (%lx) -> %lx\n",
+             b, d, f, size, offset, address, *valuep);
+       return 0;
+}
+
+static int pci_octeontx_pem_write_config(struct udevice *bus, pci_dev_t bdf,
+                                        uint offset, ulong value,
+                                        enum pci_size_t size)
+{
+       struct octeontx_pci *pcie = (void *)dev_get_priv(bus);
+       struct pci_controller *hose = dev_get_uclass_priv(bus);
+       uintptr_t address;
+       u32 b, d, f;
+       u8  hdrtype;
+       u8  pri_bus = pcie->bus.start + 1 - hose->first_busno;
+       u32 bus_offs = (pri_bus << 16) | (pri_bus << 8) | (pri_bus << 0);
+
+       b = PCI_BUS(bdf) + 1 - hose->first_busno;
+       d = PCI_DEV(bdf);
+       f = PCI_FUNC(bdf);
+

drivers/pci/pci_octeontx.c line 190

Quoted 10 lines
drivers/pci/pci_octeontx.c new file +10 -0
+       address = (b << 24) | (d << 19) | (f << 16);
+
+       address += pcie->cfg.start;
+
+       hdrtype = readb(address + PCI_HEADER_TYPE);
+
+       if (hdrtype == PCI_HEADER_TYPE_BRIDGE &&
+           offset >= PCI_PRIMARY_BUS &&
+           offset <= PCI_SUBORDINATE_BUS &&
+           value != pci_conv_32_to_size(~0UL, offset, size)) {

Please run this through patman/checkpatch to fix errors like this.

Quoted 53 lines
drivers/pci/pci_octeontx.c new file +53 -0
+               value +=  pci_conv_32_to_size(bus_offs, offset, size);
+       }
+
+       if (b == 1 && d > 0)
+               return 0;
+
+       switch (size) {
+       case PCI_SIZE_8:
+               writeb(value, address + offset);
+               break;
+       case PCI_SIZE_16:
+               writew(value, address + offset);
+               break;
+       case PCI_SIZE_32:
+               writel(value, address + offset);
+               break;
+       default:
+               printf("Invalid size\n");
+       }
+       debug("%02x.%02x.%02x: u%d %x (%lx) <- %lx\n",
+             b, d, f, size, offset, address, value);
+       return 0;
+}
+
+static int pci_octeontx2_pem_read_config(struct udevice *bus, pci_dev_t bdf,
+                                        uint offset, ulong *valuep,
+                                        enum pci_size_t size)
+{
+       struct octeontx_pci *pcie = (void *)dev_get_priv(bus);
+       struct pci_controller *hose = dev_get_uclass_priv(bus);
+       uintptr_t address;
+       u32 b, d, f;
+
+       b = PCI_BUS(bdf) + 1 - hose->first_busno;
+       d = PCI_DEV(bdf);
+       f = PCI_FUNC(bdf);
+
+       address = (b << 20) | (d << 15) | (f << 12);
+
+       debug("bdf %x %02x.%02x.%02x: u%d %x (%lx)\n",
+             bdf, b, d, f, size, offset, address);
+       address += pcie->cfg.start;
+
+       debug("%02x.%02x.%02x: u%d %x (%lx) %lx\n",
+             b, d, f, size, offset, address, *valuep);
+       *valuep = pci_conv_32_to_size(~0UL, offset, size);
+
+       if (b == 1 && d > 0)
+               return 0;
+
+       switch (size) {
+       case PCI_SIZE_8:
+               debug("byte %lx\n", address + offset);

drivers/pci/pci_octeontx.c line 253

Quoted 10 lines
drivers/pci/pci_octeontx.c new file +10 -0
+               *valuep = readb(address + offset);
+               break;
+       case PCI_SIZE_16:
+               debug("word %lx\n", address + offset);
+               *valuep = readw(address + offset);
+               break;
+       case PCI_SIZE_32:
+               debug("long %lx\n", address + offset);
+               *valuep = readl(address + offset);
+               break;

Instead of repeating this switch () each time, perhaps create:

static ulong readl_size(uintptr_t addr, enum pci_size_t size) {
switch ()
...
}

Quoted 60 lines
drivers/pci/pci_octeontx.c new file +60 -0
+       default:
+               printf("Invalid size\n");
+       }
+
+       debug("%02x.%02x.%02x: u%d %x (%lx) -> %lx\n",
+             b, d, f, size, offset, address, *valuep);
+
+       return 0;
+}
+
+static void pci_octeontx2_pem_workaround(struct udevice *bus, uint offset,
+                                        enum pci_size_t size)
+{
+#if defined(CONFIG_ARCH_OCTEONTX2)
+       struct octeontx_pci *pcie = (void *)dev_get_priv(bus);
+       u64 rval, wval;
+       u32 cfg_off, data;
+       u64 raddr, waddr;
+       u8 shift;
+
+       raddr = pcie->pem.start + PEM_CFG_RD;
+       waddr = pcie->pem.start + PEM_CFG_WR;
+
+       debug("%s raddr %llx waddr %llx\n", __func__, raddr, waddr);
+               cfg_off = PCIERC_RASDP_DE_ME;
+               wval = cfg_off;
+       debug("%s DE_ME raddr %llx wval %llx\n", __func__, raddr, wval);
+               writeq(wval, raddr);
+               rval = readq(raddr);
+       debug("%s DE_ME raddr %llx rval %llx\n", __func__, raddr, rval);
+               data = rval >> 32;
+               if (data & 0x1) {
+                       data = (data & (~0x1));
+                       wval |= ((u64)data << 32);
+       debug("%s DE_ME waddr %llx wval %llx\n", __func__, waddr, wval);
+                       writeq(wval, waddr);
+               }
+
+               cfg_off = PCIERC_RAS_EINJ_CTL6_CMPP0;
+               wval = cfg_off;
+               data = 0xFE000000;
+               wval |= ((u64)data << 32);
+       debug("%s CMPP0 waddr %llx wval %llx\n", __func__, waddr, wval);
+               writeq(wval, waddr);
+
+               cfg_off = PCIERC_RAS_EINJ_CTL6_CMPV0;
+               wval = cfg_off;
+               data = 0x44000000;
+               wval |= ((u64)data << 32);
+       debug("%s CMPV0 waddr %llx wval %llx\n", __func__, waddr, wval);
+               writeq(wval, waddr);
+
+               cfg_off = PCIERC_RAS_EINJ_CTL6_CHGP1;
+               wval = cfg_off;
+               data = 0xFF;
+               wval |= ((u64)data << 32);
+       debug("%s CHGP1 waddr %llx wval %llx\n", __func__, waddr, wval);
+               writeq(wval, waddr);
+
+       cfg_off = PCIERC_RAS_EINJ_EN;

drivers/pci/pci_octeontx.c line 323

Quoted 10 lines
drivers/pci/pci_octeontx.c new file +10 -0
+       wval = cfg_off;
+       data = 0x40;
+       wval |= ((u64)data << 32);
+       debug("%s EINJ_EN waddr %llx wval %llx\n", __func__, waddr, wval);
+       writeq(wval, waddr);
+
+       cfg_off = PCIERC_RAS_EINJ_CTL6PE;
+       wval = cfg_off;
+       data = 0x1;
+       wval |= ((u64)data << 32);

Does this work?
wval |= 1 << 32ULL;

Quoted 5 lines
drivers/pci/pci_octeontx.c new file +5 -0
+       debug("%s EINJ_CTL6PE waddr %llx wval %llx\n", __func__, waddr, wval);
+       writeq(wval, waddr);
+
+       switch (size) {
+       case PCI_SIZE_8:

drivers/pci/pci_octeontx.c line 338

Quoted 10 lines
drivers/pci/pci_octeontx.c new file +10 -0
+               shift = offset % 4;
+               data = (0x1 << shift);
+               break;
+       case PCI_SIZE_16:
+               shift = (offset % 4) ? 2 : 0;
+               data = (0x3 << shift);
+               break;
+       default:
+       case PCI_SIZE_32:
+               data = 0xF;

Please use lower-case hex everywhere.

Quoted 56 lines
drivers/pci/pci_octeontx.c new file +56 -0
+               break;
+       }
+
+       cfg_off = PCIERC_RAS_EINJ_CTL6_CHGV1;
+       wval = cfg_off;
+       wval |= ((u64)data << 32);
+       debug("%s EINJ_CHGV1 waddr %llx <= wval %llx\n", __func__, waddr, wval);
+       writeq(wval, waddr);
+
+       cfg_off = PCIERC_RASDP_EP_CTL;
+       wval = cfg_off;
+       wval |= ((u64)0x1 << 32);
+       debug("%s EP_CTL waddr %llx <= wval %llx\n", __func__, waddr, wval);
+       writeq(wval, waddr);
+
+       wval = readq(waddr);
+       debug("%s EP_CTL waddr %llx => wval %llx\n", __func__, waddr, wval);
+#endif
+}
+
+static int pci_octeontx2_pem_write_config(struct udevice *bus, pci_dev_t bdf,
+                                         uint offset, ulong value,
+                                         enum pci_size_t size)
+{
+       struct octeontx_pci *pcie = (void *)dev_get_priv(bus);
+       struct pci_controller *hose = dev_get_uclass_priv(bus);
+       uintptr_t address, addr;
+       u32 b, d, f;
+       u32 data;
+       int tmp;
+
+       b = PCI_BUS(bdf) + 1 - hose->first_busno;
+       d = PCI_DEV(bdf);
+       f = PCI_FUNC(bdf);
+
+       address = (b << 20) | (d << 15) | (f << 12);
+
+       debug("bdf %x %02x.%02x.%02x: u%d %x (%lx)\n",
+             bdf, b, d, f, size, offset, address);
+       address += pcie->cfg.start;
+
+       debug("%02x.%02x.%02x: u%d %x (%lx) %lx\n",
+             b, d, f, size, offset, address, value);
+
+       if (b == 1 && d > 0)
+               return 0;
+
+       addr = (address + offset) & ~0x3UL;
+       switch (size) {
+       case PCI_SIZE_8:
+               tmp = (address + offset) & 0x3;
+               size = PCI_SIZE_32;
+               data = readl(addr);
+               debug("tmp 8 long %lx %x\n", addr, data);
+               tmp *= 8;
+               value = (data & ~(0xFFUL << tmp)) | ((value & 0xFF) << tmp);

drivers/pci/pci_octeontx.c line 404

Quoted 10 lines
drivers/pci/pci_octeontx.c new file +10 -0
+       break;
+       case PCI_SIZE_16:
+               tmp = (address + offset) & 0x3;
+               size = PCI_SIZE_32;
+               data = readl(addr);
+               debug("tmp 16 long %lx %x\n", addr, data);
+               tmp *= 8;
+               value = (data & 0xFFFF) | (value << tmp);
+       break;
+       case PCI_SIZE_32:

Could you add a comment about why this code is empty?

Quoted 34 lines
drivers/pci/pci_octeontx.c new file +34 -0
+       break;
+       }
+       debug("tmp long %lx %lx\n", addr, value);
+
+       pci_octeontx2_pem_workaround(bus, offset, size);
+
+       switch (size) {
+       case PCI_SIZE_8:
+               debug("byte %lx %lx\n", address + offset, value);
+               writeb(value, address + offset);
+               break;
+       case PCI_SIZE_16:
+               debug("word %lx %lx\n", address + offset, value);
+               writew(value, address + offset);
+               break;
+       case PCI_SIZE_32:
+               debug("long %lx %lx\n", addr, value);
+               writel(value, addr);
+               break;
+       default:
+               printf("Invalid size\n");
+       }
+
+       debug("%02x.%02x.%02x: u%d %x (%lx) <- %lx\n",
+             b, d, f, size, offset, addr, value);
+
+       return 0;
+}
+
+static int pci_octeontx_ofdata_to_platdata(struct udevice *dev)
+{
+       return 0;
+}
+

drivers/pci/pci_octeontx.c line 448

Quoted 10 lines
drivers/pci/pci_octeontx.c new file +10 -0
+static int pci_octeontx_ecam_probe(struct udevice *dev)
+{
+       struct octeontx_pci *pcie = (void *)dev_get_priv(dev);
+       int err;
+
+       err = fdt_get_resource(gd->fdt_blob, dev->node.of_offset, "reg", 0,
+                              &pcie->cfg);
+
+       if (err) {
+               printf("Error reading resource: %s\n", fdt_strerror(err));

debug()

Quoted 91 lines
drivers/pci/pci_octeontx.c new file +90 -1
+               return err;
+       }
+
+#if defined(CONFIG_ARCH_OCTEONTX2)
+       err = fdt_node_check_compatible(gd->fdt_blob, dev->node.of_offset,
+                                       "marvell,pci-host-octeontx2-pem");
+       if (!err) {
+               err = fdt_get_resource(gd->fdt_blob, dev->node.of_offset,
+                                      "reg", 1, &pcie->pem);
+
+               if (err) {
+                       printf("Error reading resource: %s\n",
+                              fdt_strerror(err));
+                       return err;
+               }
+       }
+#endif
+       err = fdtdec_get_pci_bus_range(gd->fdt_blob, dev->node.of_offset,
+                                      &pcie->bus);
+
+       if (err) {
+               printf("Error reading resource: %s\n", fdt_strerror(err));
+               return err;
+       }
+
+       return 0;
+}
+
+static const struct dm_pci_ops pci_octeontx_ecam_ops = {
+       .read_config    = pci_octeontx_ecam_read_config,
+       .write_config   = pci_octeontx_ecam_write_config,
+};
+
+static const struct udevice_id pci_octeontx_ecam_ids[] = {
+       { .compatible = "cavium,pci-host-thunder-ecam" },
+       { .compatible = "cavium,pci-host-octeontx-ecam" },
+       { .compatible = "pci-host-ecam-generic" },
+       { }
+};
+
+static const struct dm_pci_ops pci_octeontx_pem_ops = {
+       .read_config    = pci_octeontx_pem_read_config,
+       .write_config   = pci_octeontx_pem_write_config,
+};
+
+static const struct udevice_id pci_octeontx_pem_ids[] = {
+       { .compatible = "cavium,pci-host-thunder-pem" },
+       { }
+};
+
+static const struct dm_pci_ops pci_octeontx2_pem_ops = {
+       .read_config    = pci_octeontx2_pem_read_config,
+       .write_config   = pci_octeontx2_pem_write_config,
+};
+
+static const struct udevice_id pci_octeontx2_pem_ids[] = {
+       { .compatible = "marvell,pci-host-octeontx2-pem" },
+       { }
+};
+
+U_BOOT_DRIVER(pci_octeontx_ecam) = {
+       .name   = "pci_octeontx_ecam",
+       .id     = UCLASS_PCI,
+       .of_match = pci_octeontx_ecam_ids,
+       .ops    = &pci_octeontx_ecam_ops,
+       .ofdata_to_platdata = pci_octeontx_ofdata_to_platdata,
+       .probe  = pci_octeontx_ecam_probe,
+       .priv_auto_alloc_size = sizeof(struct octeontx_pci),
+       .flags = DM_FLAG_PRE_RELOC,
+};
+
+U_BOOT_DRIVER(pci_octeontx2_pcie) = {
+       .name   = "pci_octeontx2_pem",
+       .id     = UCLASS_PCI,
+       .of_match = pci_octeontx2_pem_ids,
+       .ops    = &pci_octeontx2_pem_ops,
+       .ofdata_to_platdata = pci_octeontx_ofdata_to_platdata,
+       .probe  = pci_octeontx_ecam_probe,
+       .priv_auto_alloc_size = sizeof(struct octeontx_pci),
+};
+
+U_BOOT_DRIVER(pci_octeontx_pcie) = {
+       .name   = "pci_octeontx_pem",
+       .id     = UCLASS_PCI,
+       .of_match = pci_octeontx_pem_ids,
+       .ops    = &pci_octeontx_pem_ops,
+       .ofdata_to_platdata = pci_octeontx_ofdata_to_platdata,
+       .probe  = pci_octeontx_ecam_probe,
+       .priv_auto_alloc_size = sizeof(struct octeontx_pci),
+};
--
Quoted 2 lines

2.23.0

Regards,
Simon

#38 lore raw

RFC PATCH 19/29 drivers: gpio: add GPIO controller driver for OcteonTX

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Adds support for GPIO controllers found on OcteonTX or OcteonTX2 SoC platforms.

---
 drivers/gpio/Kconfig         |   7 ++
 drivers/gpio/Makefile        |   1 +
 drivers/gpio/octeontx_gpio.c | 218 +++++++++++++++++++++++++++++++++++
 3 files changed, 226 insertions(+)
 create mode 100644 drivers/gpio/octeontx_gpio.c
drivers/gpio/Kconfig +7 -0
index c1ad5d64a3..91265180d3 100644
@@ -276,6 +276,13 @@ config PIC32_GPIO
 	help
 	  Say yes here to support Microchip PIC32 GPIOs.
 
+config OCTEONTX_GPIO
+	bool "OcteonTX GPIO driver"
+	depends on DM_GPIO && (ARCH_OCTEONTX || ARCH_OCTEONTX2)
+	default y
+	help
+	  Say yes here to support OcteonTX GPIOs.
+
 config STM32_GPIO
 	bool "ST STM32 GPIO driver"
 	depends on DM_GPIO && (STM32 || ARCH_STM32MP)
drivers/gpio/Makefile +1 -0
index ccc49e2eb0..d7651bff4b 100644
@@ -55,6 +55,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_OCTEONTX_GPIO)	+= octeontx_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/octeontx_gpio.c new file +218 -0

218 lines not on this page · raw message

Signature · 1 line
2.23.0
#39 lore raw

RFC PATCH 19/29 drivers: gpio: add GPIO controller driver for OcteonTX

Hi Suneel,

Quoted 20 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

Adds support for GPIO controllers found on OcteonTX or OcteonTX2 SoC platforms.

---
 drivers/gpio/Kconfig         |   7 ++
 drivers/gpio/Makefile        |   1 +
 drivers/gpio/octeontx_gpio.c | 218 +++++++++++++++++++++++++++++++++++
 3 files changed, 226 insertions(+)
 create mode 100644 drivers/gpio/octeontx_gpio.c
drivers/gpio/Kconfig +0 -0
index c1ad5d64a3..91265180d3 100644

drivers/gpio/Kconfig config PIC32_GPIO · line 284

Quoted 9 lines
drivers/gpio/Kconfig +6 -0
@@ -276,6 +276,13 @@ config PIC32_GPIO
        help
          Say yes here to support Microchip PIC32 GPIOs.
 
+config OCTEONTX_GPIO
+       bool "OcteonTX GPIO driver"
+       depends on DM_GPIO && (ARCH_OCTEONTX || ARCH_OCTEONTX2)
+       default y
+       help
+         Say yes here to support OcteonTX GPIOs.

Please add a bit more detail here - how many GPIOs, what features are supported?

Quoted 41 lines
drivers/gpio/Kconfig +1 -0
+
 config STM32_GPIO
        bool "ST STM32 GPIO driver"
        depends on DM_GPIO && (STM32 || ARCH_STM32MP)
drivers/gpio/Makefile +1 -0
index ccc49e2eb0..d7651bff4b 100644
@@ -55,6 +55,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_OCTEONTX_GPIO)    += octeontx_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/octeontx_gpio.c new file +19 -0
new file mode 100644
index 0000000000..d012044c47
@@ -0,0 +1,218 @@
+// SPDX-License-Identifier:    GPL-2.0
+/*
+ * Copyright (C) 2018 Marvell International Ltd.
+ *
+ * https://spdx.org/licenses
+ *
+ * (C) Copyright 2011
+ * eInfochips Ltd. <www.einfochips.com>
+ * Written-by: Ajay Bhargav <[email protected]>
+ *
+ * (C) Copyright 2010
+ * Marvell Semiconductor <www.marvell.com>
+ *
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <malloc.h>
+#include <errno.h>

drivers/gpio/octeontx_gpio.c line 29

Quoted 10 lines
drivers/gpio/octeontx_gpio.c new file +10 -0
+#include <fdtdec.h>
+#include <asm/io.h>
+#include <asm/gpio.h>
+#include <asm/bitops.h>
+#include <dt-bindings/gpio/gpio.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/** Returns the bit value to write or read based on the offset */
+#define GPIO_BIT(x)            (1ULL << ((x) & 0x3f))

Maybe BIT_ULL(x & 03f)

Again I think patman would probably find these problems.

Also suggest a bit more internal review if someone has time.

drivers/gpio/octeontx_gpio.c line 37

Quoted 8 lines
drivers/gpio/octeontx_gpio.c new file +8 -0
+
+#define GPIO_RX_DAT            (0x0)
+#define GPIO_TX_SET            (0x8)
+#define GPIO_TX_CLR            (0x10)
+#define GPIO_CONST             (0x90)
+#define GPIO_RX1_DAT           (0x1400)
+#define GPIO_TX1_SET           (0x1408)
+#define GPIO_TX1_CLR           (0x1410)

Drop rackets

Quoted 4 lines
drivers/gpio/octeontx_gpio.c new file +4 -0
+
+/** Returns the offset to the output register based on the offset and value */
+#define GPIO_TX_REG(offset, value)                                     \
+       ((offset) >= 64 ? ((value) ? GPIO_TX1_SET : GPIO_TX1_CLR) :     \

drivers/gpio/octeontx_gpio.c line 51

Quoted 10 lines
drivers/gpio/octeontx_gpio.c new file +10 -0
+                         ((value) ? GPIO_TX_SET : GPIO_TX_CLR))
+
+/** Returns the offset to the input data register based on the offset */
+#define GPIO_RX_DAT_REG(offset) (((offset) >= 64) ? GPIO_RX1_DAT : GPIO_RX_DAT)
+
+/** Returns the bit configuration register based on the offset */
+#define GPIO_BIT_CFG(x)                (0x400 + 8 * (x))
+#define GPIO_BIT_CFG_FN(x)     (((x) >> 16) & 0x3ff)
+#define GPIO_BIT_CFG_TX_OE(x)  ((x) & 0x1)
+#define GPIO_BIT_CFG_RX_DAT(x) ((x) & 0x1)

Should use _SHIFT and _MASK registers and open-code things rather than these sort of macros.

drivers/gpio/octeontx_gpio.c line 54

Quoted 3 lines
drivers/gpio/octeontx_gpio.c new file +3 -0
+
+/** PCI ID on NCB bus */
+#define PCI_DEVICE_ID_OCTEONTX_GPIO    0xa00a

What does this mean? If it is a PCI device ID it should go in pci_ids.h

drivers/gpio/octeontx_gpio.c line 56

Quoted 2 lines
drivers/gpio/octeontx_gpio.c new file +2 -0
+
+union gpio_const {

comment for union

drivers/gpio/octeontx_gpio.c line 59

Quoted 3 lines
drivers/gpio/octeontx_gpio.c new file +3 -0
+       u64 u;
+       struct {
+               u64 gpios:8;    /** Number of GPIOs implemented */

/* Number

But maybe use the 'struct' comment style above the struct?

drivers/gpio/octeontx_gpio.c line 60

Quoted 1 line
drivers/gpio/octeontx_gpio.c new file +1 -0
+               u64 pp:8;       /** Number of PP vectors */

What is a PP vector? Please add comments

Quoted 5 lines
drivers/gpio/octeontx_gpio.c new file +5 -0
+               u64:48; /* Reserved */
+       } s;
+};
+
+struct octeontx_gpio {

drivers/gpio/octeontx_gpio.c line 75

Quoted 10 lines
drivers/gpio/octeontx_gpio.c new file +10 -0
+       void __iomem *baseaddr;
+};
+
+static int octeontx_gpio_dir_input(struct udevice *dev, unsigned int offset)
+{
+       struct octeontx_gpio *gpio = dev_get_priv(dev);
+
+       debug("%s(%s, %u)\n", __func__, dev->name, offset);
+       clrbits_le64(gpio->baseaddr + GPIO_BIT_CFG(offset),
+                    (0x3ffUL << 16) | 4UL | 2UL | 1UL);

You don't need the ULs here. Please fix below also

Again, please use blank line before return globally

Quoted 50 lines
drivers/gpio/octeontx_gpio.c new file +50 -0
+       return 0;
+}
+
+static int octeontx_gpio_dir_output(struct udevice *dev, unsigned int offset,
+                                   int value)
+{
+       struct octeontx_gpio *gpio = dev_get_priv(dev);
+
+       debug("%s(%s, %u, %d)\n", __func__, dev->name, offset, value);
+       writeq(GPIO_BIT(offset), gpio->baseaddr + GPIO_TX_REG(offset, value));
+
+       clrsetbits_le64(gpio->baseaddr + GPIO_BIT_CFG(offset),
+                       ((0x3ffUL << 16) | 4UL), 1UL);
+       return 0;
+}
+
+static int octeontx_gpio_get_value(struct udevice *dev,
+                                  unsigned int offset)
+{
+       struct octeontx_gpio *gpio = dev_get_priv(dev);
+       u64 reg = readq(gpio->baseaddr + GPIO_RX_DAT_REG(offset));
+
+       debug("%s(%s, %u): value: %d\n", __func__, dev->name, offset,
+             !!(reg & GPIO_BIT(offset)));
+
+       return !!(reg & GPIO_BIT(offset));
+}
+
+static int octeontx_gpio_set_value(struct udevice *dev,
+                                  unsigned int offset, int value)
+{
+       struct octeontx_gpio *gpio = dev_get_priv(dev);
+
+       debug("%s(%s, %u, %d)\n", __func__, dev->name, offset, value);
+       writeq(GPIO_BIT(offset), gpio->baseaddr + GPIO_TX_REG(offset, value));
+
+       return 0;
+}
+
+static int octeontx_gpio_get_function(struct udevice *dev,
+                                     unsigned int offset)
+{
+       struct octeontx_gpio *gpio = dev_get_priv(dev);
+       u64 pinsel = readl(gpio->baseaddr + GPIO_BIT_CFG(offset));
+
+       debug("%s(%s, %u): pinsel: 0x%llx\n", __func__, dev->name, offset,
+             pinsel);
+       if (GPIO_BIT_CFG_FN(pinsel))
+               return GPIOF_FUNC;
+       else if (GPIO_BIT_CFG_TX_OE(pinsel))

drivers/gpio/octeontx_gpio.c line 135

Quoted 10 lines
drivers/gpio/octeontx_gpio.c new file +10 -0
+               return GPIOF_OUTPUT;
+       else
+               return GPIOF_INPUT;
+}
+
+static int octeontx_gpio_xlate(struct udevice *dev, struct gpio_desc *desc,
+                              struct ofnode_phandle_args *args)
+{
+       if (args->args_count < 1)
+               return -EINVAL;

Could use log_msg_ret("arg_count", -EINVAL) if you want some logging

Quoted 28 lines
drivers/gpio/octeontx_gpio.c new file +28 -0
+
+       desc->offset = args->args[0];
+       desc->flags = 0;
+       if (args->args_count > 1) {
+               if (args->args[1] & GPIO_ACTIVE_LOW)
+                       desc->flags |= GPIOD_ACTIVE_LOW;
+               /* In the future add tri-state flag support */
+       }
+       return 0;
+}
+
+static const struct dm_gpio_ops octeontx_gpio_ops = {
+       .direction_input        = octeontx_gpio_dir_input,
+       .direction_output       = octeontx_gpio_dir_output,
+       .get_value              = octeontx_gpio_get_value,
+       .set_value              = octeontx_gpio_set_value,
+       .get_function           = octeontx_gpio_get_function,
+       .xlate                  = octeontx_gpio_xlate,
+};
+
+static int octeontx_gpio_probe(struct udevice *dev)
+{
+       pci_dev_t bdf = dm_pci_get_bdf(dev);
+       struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
+       struct octeontx_gpio *priv = dev_get_priv(dev);
+       union gpio_const gpio_const;
+       char *end;
+       const char *status;

drivers/gpio/octeontx_gpio.c line 173

Quoted 10 lines
drivers/gpio/octeontx_gpio.c new file +10 -0
+
+       status = ofnode_read_string(dev->node, "status");
+
+       if (status && !strncmp(status, "ok", 2)) {
+               debug("%s(%s): GPIO device disabled in device tree\n",
+                     __func__, dev->name);
+               return -1;
+       }
+
+       dev->req_seq = PCI_FUNC(bdf);

What is that for?

Quoted 46 lines
drivers/gpio/octeontx_gpio.c new file +45 -1
+       priv->baseaddr = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0,
+                                       PCI_REGION_MEM);
+
+       if (!priv->baseaddr) {
+               debug("%s(%s): Could not get base address\n",
+                     __func__, dev->name);
+               return -1;
+       }
+
+       gpio_const.u = readq(priv->baseaddr + GPIO_CONST);
+
+       debug("%s(%s): base address: %p, of_offset: %ld, pin count: %d\n",
+             __func__, dev->name, priv->baseaddr, dev->node.of_offset,
+             gpio_const.s.gpios);
+
+       uc_priv->gpio_count = gpio_const.s.gpios;
+       uc_priv->bank_name  = strdup(dev->name);
+       end = strchr(uc_priv->bank_name, '@');
+       end[0] = 'A' + dev->seq;
+       end[1] = '\0';
+
+       return 0;
+}
+
+static const struct udevice_id octeontx_gpio_ids[] = {
+       { .compatible = "cavium,thunder-8890-gpio" },
+       { }
+};
+
+U_BOOT_DRIVER(octeontx_gpio) = {
+       .name   = "octeontx_gpio",
+       .id     = UCLASS_GPIO,
+       .of_match = of_match_ptr(octeontx_gpio_ids),
+       .probe = octeontx_gpio_probe,
+       .priv_auto_alloc_size = sizeof(struct octeontx_gpio),
+       .ops    = &octeontx_gpio_ops,
+       .flags  = DM_FLAG_PRE_RELOC,
+};
+
+static struct pci_device_id octeontx_gpio_supported[] = {
+       { PCI_VDEVICE(CAVIUM, PCI_DEVICE_ID_OCTEONTX_GPIO) },
+       { },
+};
+
+U_BOOT_PCI_DEVICE(octeontx_gpio, octeontx_gpio_supported);
--
Quoted 2 lines

2.23.0

Regards,
Simon

#40 lore raw

RFC PATCH 20/29 drivers: i2c: add I2C controller driver for OcteonTX

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Adds support for I2C controllers found on OcteonTX or OcteonTX2 SoC platforms.

---
 drivers/i2c/Kconfig        |   7 +
 drivers/i2c/Makefile       |   1 +
 drivers/i2c/octeontx_i2c.c | 968 +++++++++++++++++++++++++++++++++++++
 3 files changed, 976 insertions(+)
 create mode 100644 drivers/i2c/octeontx_i2c.c
drivers/i2c/Kconfig +7 -0
index 03d2fed341..eb47454e76 100644
@@ -366,6 +366,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_OCTEONTX
+	bool "OcteonTX I2C driver"
+	depends on (ARCH_OCTEONTX || ARCH_OCTEONTX2) && DM_I2C
+	default y
+	help
+	 Enable I2C support for OcteonTX/TX2 line of processors.
+
 config SYS_I2C_S3C24X0
 	bool "Samsung I2C driver"
 	depends on ARCH_EXYNOS4 && DM_I2C
drivers/i2c/Makefile +1 -0
index c2f75d8755..e2ae95e770 100644
@@ -33,6 +33,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_OCTEONTX) += octeontx_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/octeontx_i2c.c new file +968 -0

968 lines not on this page · raw message

Signature · 1 line
2.23.0
#41 lore raw

RFC PATCH 20/29 drivers: i2c: add I2C controller driver for OcteonTX

Hi Suneel,

Quoted 20 lines · Suneel Garapati

From: Suneel Garapati <[email protected]>

Adds support for I2C controllers found on OcteonTX or OcteonTX2 SoC platforms.

---
 drivers/i2c/Kconfig        |   7 +
 drivers/i2c/Makefile       |   1 +
 drivers/i2c/octeontx_i2c.c | 968 +++++++++++++++++++++++++++++++++++++
 3 files changed, 976 insertions(+)
 create mode 100644 drivers/i2c/octeontx_i2c.c
drivers/i2c/Kconfig +0 -0
index 03d2fed341..eb47454e76 100644

drivers/i2c/Kconfig config SYS_I2C_SANDBOX · line 374

Quoted 9 lines
drivers/i2c/Kconfig +6 -0
@@ -366,6 +366,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_OCTEONTX
+       bool "OcteonTX I2C driver"
+       depends on (ARCH_OCTEONTX || ARCH_OCTEONTX2) && DM_I2C
+       default y
+       help
+        Enable I2C support for OcteonTX/TX2 line of processors.

Again please expound on capabilities of hardware and driver.

Quoted 26 lines
drivers/i2c/Kconfig +1 -0
+
 config SYS_I2C_S3C24X0
        bool "Samsung I2C driver"
        depends on ARCH_EXYNOS4 && DM_I2C
drivers/i2c/Makefile +1 -0
index c2f75d8755..e2ae95e770 100644
@@ -33,6 +33,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_OCTEONTX) += octeontx_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/octeontx_i2c.c new file +4 -0
new file mode 100644
index 0000000000..b74424a75f
@@ -0,0 +1,968 @@
+// SPDX-License-Identifier:    GPL-2.0
+/*
+ * Copyright (C) 2018 Marvell International Ltd.
+ *

drivers/i2c/octeontx_i2c.c line 14

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+ * https://spdx.org/licenses
+ */
+
+#include <common.h>
+#include <i2c.h>
+#include <dm.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+
+#if defined(CONFIG_ARCH_OCTEONTX)

No, these need to be handled at runtime as mentioned earlier. No #ifdefs please.

Quoted 54 lines
drivers/i2c/octeontx_i2c.c new file +54 -0
+# define TWSI_THP              24
+#else
+# define TWSI_THP              3
+#endif
+
+/**
+ * Slave address to use for Thunder when accessed by another master
+ */
+#ifndef CONFIG_SYS_I2C_OCTEONTX_SLAVE_ADDR
+# define CONFIG_SYS_I2C_OCTEONTX_SLAVE_ADDR    0x77
+#endif
+
+#ifndef CONFIG_SYS_I2C_OCTEONTX_SPEED_0
+# ifdef CONFIG_SYS_I2C_SPEED
+#  define CONFIG_SYS_I2C_OCTEONTX_SPEED_0      CONFIG_SYS_I2C_SPEED
+# else
+#  define CONFIG_SYS_I2C_SPEED                 100000
+#  define CONFIG_SYS_I2C_OCTEONTX_SPEED_0      CONFIG_SYS_I2C_SPEED
+# endif
+#endif
+
+#ifndef CONFIG_SYS_I2C_OCTEONTX_SPEED_1
+# define CONFIG_SYS_I2C_OCTEONTX_SPEED_1       CONFIG_SYS_I2C_OCTEONTX_SPEED_0
+#endif
+
+#ifndef CONFIG_SYS_I2C_OCTEONTX_SPEED_2
+# define CONFIG_SYS_I2C_OCTEONTX_SPEED_2       CONFIG_SYS_I2C_OCTEONTX_SPEED_1
+#endif
+
+#ifndef CONFIG_SYS_I2C_OCTEONTX_SPEED_3
+# define CONFIG_SYS_I2C_OCTEONTX_SPEED_3       CONFIG_SYS_I2C_OCTEONTX_SPEED_2
+#endif
+
+#ifndef CONFIG_SYS_I2C_OCTEONTX_SPEED_4
+# define CONFIG_SYS_I2C_OCTEONTX_SPEED_4       CONFIG_SYS_I2C_OCTEONTX_SPEED_3
+#endif
+
+#ifndef CONFIG_SYS_I2C_OCTEONTX_SPEED_5
+# define CONFIG_SYS_I2C_OCTEONTX_SPEED_5       CONFIG_SYS_I2C_OCTEONTX_SPEED_4
+#endif
+
+#ifndef CONFIG_SYS_I2C_OCTEONTX_SPEED_6
+# define CONFIG_SYS_I2C_OCTEONTX_SPEED_6       CONFIG_SYS_I2C_OCTEONTX_SPEED_5
+#endif
+
+#ifndef CONFIG_SYS_I2C_OCTEONTX_SPEED_7
+# define CONFIG_SYS_I2C_OCTEONTX_SPEED_7       CONFIG_SYS_I2C_OCTEONTX_SPEED_6
+#endif
+
+#ifndef CONFIG_SYS_I2C_OCTEONTX_SPEED_8
+# define CONFIG_SYS_I2C_OCTEONTX_SPEED_8       CONFIG_SYS_I2C_OCTEONTX_SPEED_7
+#endif
+
+#ifndef CONFIG_SYS_I2C_OCTEONTX_SPEED_9

drivers/i2c/octeontx_i2c.c line 78

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+# define CONFIG_SYS_I2C_OCTEONTX_SPEED_9       CONFIG_SYS_I2C_OCTEONTX_SPEED_8
+#endif
+
+#ifndef CONFIG_SYS_I2C_OCTEONTX_SPEED_10
+# define CONFIG_SYS_I2C_OCTEONTX_SPEED_10      CONFIG_SYS_I2C_OCTEONTX_SPEED_9
+#endif
+
+#ifndef CONFIG_SYS_I2C_OCTEONTX_SPEED_11
+# define CONFIG_SYS_I2C_OCTEONTX_SPEED_11      CONFIG_SYS_I2C_OCTEONTX_SPEED_10
+#endif

Drop all of that and use device tree clock-frequency property

drivers/i2c/octeontx_i2c.c line 83

Quoted 5 lines
drivers/i2c/octeontx_i2c.c new file +5 -0
+
+#define TWSI_SW_TWSI           0x1000
+#define TWSI_TWSI_SW           0x1008
+#define TWSI_INT               0x1010
+#define TWSI_SW_TWSI_EXT       0x1018

Should this be a struct variable for a register set?

drivers/i2c/octeontx_i2c.c line 85

Quoted 2 lines
drivers/i2c/octeontx_i2c.c new file +2 -0
+
+union twsx_sw_twsi {

comment

drivers/i2c/octeontx_i2c.c line 86

Quoted 1 line
drivers/i2c/octeontx_i2c.c new file +1 -0
+       u64 u;

Not clear why this is a union at all?

Quoted 16 lines
drivers/i2c/octeontx_i2c.c new file +16 -0
+       struct {
+               u64 data:32;
+               u64 eop_ia:3;
+               u64 ia:5;
+               u64 addr:10;
+               u64 scr:2;
+               u64 size:3;
+               u64 sovr:1;
+               u64 r:1;
+               u64 op:4;
+               u64 eia:1;
+               u64 slonly:1;
+               u64 v:1;
+       } s;
+};
+

drivers/i2c/octeontx_i2c.c line 112

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+union twsx_sw_twsi_ext {
+       u64 u;
+       struct {
+               u64 data:32;
+               u64 ia:8;
+               u64 rsvd:24;
+       } s;
+};
+
+union twsx_int {

Again, comment, and why a union?

Quoted 91 lines
drivers/i2c/octeontx_i2c.c new file +91 -0
+       u64 u;
+       struct {
+               u64 st_int:1;   /** TWSX_SW_TWSI register update int */
+               u64 ts_int:1;   /** TWSX_TWSI_SW register update int */
+               u64 core_int:1; /** TWSI core interrupt, ignored for HLC */
+               u64 rsvd1:5;            /** Reserved */
+               u64 sda_ovr:1;  /** SDA testing override */
+               u64 scl_ovr:1;  /** SCL testing override */
+               u64 sda:1;              /** SDA signal */
+               u64 scl:1;              /** SCL signal */
+               u64 rsvd2:52;           /** Reserved */
+       } s;
+};
+
+enum {
+       TWSI_OP_WRITE   = 0,
+       TWSI_OP_READ    = 1,
+};
+
+enum {
+       TWSI_EOP_SLAVE_ADDR = 0,
+       TWSI_EOP_CLK_CTL = 3,
+       TWSI_SW_EOP_IA   = 6,
+};
+
+enum {
+       TWSI_SLAVEADD     = 0,
+       TWSI_DATA         = 1,
+       TWSI_CTL          = 2,
+       TWSI_CLKCTL       = 3,
+       TWSI_STAT         = 3,
+       TWSI_SLAVEADD_EXT = 4,
+       TWSI_RST          = 7,
+};
+
+enum {
+       TWSI_CTL_AAK    = BIT(2),
+       TWSI_CTL_IFLG   = BIT(3),
+       TWSI_CTL_STP    = BIT(4),
+       TWSI_CTL_STA    = BIT(5),
+       TWSI_CTL_ENAB   = BIT(6),
+       TWSI_CTL_CE     = BIT(7),
+};
+
+enum {
+       /** Bus error */
+       TWSI_STAT_BUS_ERROR             = 0x00,
+       /** Start condition transmitted */
+       TWSI_STAT_START                 = 0x08,
+       /** Repeat start condition transmitted */
+       TWSI_STAT_RSTART                = 0x10,
+       /** Address + write bit transmitted, ACK received */
+       TWSI_STAT_TXADDR_ACK            = 0x18,
+       /** Address + write bit transmitted, /ACK received */
+       TWSI_STAT_TXADDR_NAK            = 0x20,
+       /** Data byte transmitted in master mode, ACK received */
+       TWSI_STAT_TXDATA_ACK            = 0x28,
+       /** Data byte transmitted in master mode, ACK received */
+       TWSI_STAT_TXDATA_NAK            = 0x30,
+       /** Arbitration lost in address or data byte */
+       TWSI_STAT_TX_ARB_LOST           = 0x38,
+       /** Address + read bit transmitted, ACK received */
+       TWSI_STAT_RXADDR_ACK            = 0x40,
+       /** Address + read bit transmitted, /ACK received */
+       TWSI_STAT_RXADDR_NAK            = 0x48,
+       /** Data byte received in master mode, ACK transmitted */
+       TWSI_STAT_RXDATA_ACK_SENT       = 0x50,
+       /** Data byte received, NACK transmitted */
+       TWSI_STAT_RXDATA_NAK_SENT       = 0x58,
+       /** Slave address received, sent ACK */
+       TWSI_STAT_SLAVE_RXADDR_ACK      = 0x60,
+       /**
+        * Arbitration lost in address as master, slave address + write bit
+        * received, ACK transmitted
+        */
+       TWSI_STAT_TX_ACK_ARB_LOST       = 0x68,
+       /** General call address received, ACK transmitted */
+       TWSI_STAT_RX_GEN_ADDR_ACK       = 0x70,
+       /**
+        * Arbitration lost in address as master, general call address
+        * received, ACK transmitted
+        */
+       TWSI_STAT_RX_GEN_ADDR_ARB_LOST  = 0x78,
+       /** Data byte received after slave address received, ACK transmitted */
+       TWSI_STAT_SLAVE_RXDATA_ACK      = 0x80,
+       /** Data byte received after slave address received, /ACK transmitted */
+       TWSI_STAT_SLAVE_RXDATA_NAK      = 0x88,
+       /**
+        * Data byte received after general call address received, ACK
+        * transmitted
+        */

drivers/i2c/octeontx_i2c.c line 213

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+       TWSI_STAT_GEN_RXADDR_ACK        = 0x90,
+       /**
+        * Data byte received after general call address received, /ACK
+        * transmitted
+        */
+       TWSI_STAT_GEN_RXADDR_NAK        = 0x98,
+       /** STOP or repeated START condition received in slave mode */
+       TWSI_STAT_STOP_MULTI_START      = 0xA0,
+       /** Slave address + read bit received, ACK transmitted */
+       TWSI_STAT_SLAVE_RXADDR2_ACK     = 0xA8,

Lower-case hex

drivers/i2c/octeontx_i2c.c line 214

Quoted 1 line
drivers/i2c/octeontx_i2c.c new file +1 -0
+       /**

/** is for functions and structs as I understand it, not for ordinary comments.

Quoted 9 lines
drivers/i2c/octeontx_i2c.c new file +9 -0
+        * Arbitration lost in address as master, slave address + read bit
+        * received, ACK transmitted
+        */
+       TWSI_STAT_RXDATA_ACK_ARB_LOST   = 0xB0,
+       /** Data byte transmitted in slave mode, ACK received */
+       TWSI_STAT_SLAVE_TXDATA_ACK      = 0xB8,
+       /** Data byte transmitted in slave mode, /ACK received */
+       TWSI_STAT_SLAVE_TXDATA_NAK      = 0xC0,
+       /** Last byte transmitted in slave mode, ACK received */

drivers/i2c/octeontx_i2c.c line 233

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+       TWSI_STAT_SLAVE_TXDATA_END_ACK  = 0xC8,
+       /** Second address byte + write bit transmitted, ACK received */
+       TWSI_STAT_TXADDR2DATA_ACK       = 0xD0,
+       /** Second address byte + write bit transmitted, /ACK received */
+       TWSI_STAT_TXADDR2DATA_NAK       = 0xD8,
+       /** No relevant status information */
+       TWSI_STAT_IDLE          = 0xF8
+};
+
+struct octeontx_twsi {

Please add missing comments to structs and functions globally.

Quoted 13 lines
drivers/i2c/octeontx_i2c.c new file +13 -0
+       int                     id;
+       int                     speed;
+       void                    *baseaddr;
+};
+
+/** Array of bus speeds */
+static unsigned int speeds[] = {
+       CONFIG_SYS_I2C_OCTEONTX_SPEED_0,
+       CONFIG_SYS_I2C_OCTEONTX_SPEED_1,
+       CONFIG_SYS_I2C_OCTEONTX_SPEED_2,
+       CONFIG_SYS_I2C_OCTEONTX_SPEED_3,
+       CONFIG_SYS_I2C_OCTEONTX_SPEED_4,
+       CONFIG_SYS_I2C_OCTEONTX_SPEED_5,

drivers/i2c/octeontx_i2c.c line 256

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+       CONFIG_SYS_I2C_OCTEONTX_SPEED_6,
+       CONFIG_SYS_I2C_OCTEONTX_SPEED_7,
+       CONFIG_SYS_I2C_OCTEONTX_SPEED_8,
+       CONFIG_SYS_I2C_OCTEONTX_SPEED_9,
+       CONFIG_SYS_I2C_OCTEONTX_SPEED_10,
+       CONFIG_SYS_I2C_OCTEONTX_SPEED_11,
+};
+
+/** Last i2c id assigned */
+static int last_id;

Cannot declare statics in a driver. Move it to a private structure.

Quoted 5 lines
drivers/i2c/octeontx_i2c.c new file +5 -0
+
+static void twsi_unblock(void *baseaddr);
+static int twsi_stop(void *baseaddr);
+
+/**

drivers/i2c/octeontx_i2c.c line 271

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+ * Converts the i2c status to a meaningful string
+ *
+ * @param      status  status to convert
+ *
+ * @return     string representation of the status
+ */
+static const char *twsi_i2c_status_str(uint8_t status)
+{
+       switch (status) {
+       case TWSI_STAT_BUS_ERROR:

Wow this is a lot of string data. I suppose you have no need for I2C in SPL?

Quoted 116 lines
drivers/i2c/octeontx_i2c.c new file +116 -0
+               return "Bus error";
+       case TWSI_STAT_START:
+               return "START condition transmitted";
+       case TWSI_STAT_RSTART:
+               return "Repeated START condition transmitted";
+       case TWSI_STAT_TXADDR_ACK:
+               return "Address + write bit transmitted, ACK received";
+       case TWSI_STAT_TXADDR_NAK:
+               return "Address + write bit transmitted, NAK received";
+       case TWSI_STAT_TXDATA_ACK:
+               return "Data byte transmitted in master mode, ACK received";
+       case TWSI_STAT_TXDATA_NAK:
+               return "Data byte transmitted in master mode, NAK received";
+       case TWSI_STAT_TX_ARB_LOST:
+               return "Arbitration lost in address or data byte";
+       case TWSI_STAT_RXADDR_ACK:
+               return "Address + read bit transmitted, ACK received";
+       case TWSI_STAT_RXADDR_NAK:
+               return "Address + read bit transmitted, NAK received";
+       case TWSI_STAT_RXDATA_ACK_SENT:
+               return "Data byte received in master mode, ACK transmitted";
+       case TWSI_STAT_RXDATA_NAK_SENT:
+               return "Data byte received in master mode, NAK transmitted";
+       case TWSI_STAT_SLAVE_RXADDR_ACK:
+               return "Slave address + write bit received, ACK transmitted";
+       case TWSI_STAT_TX_ACK_ARB_LOST:
+               return "Arbitration lost in address as master, slave address + write bit received, ACK transmitted";
+       case TWSI_STAT_RX_GEN_ADDR_ACK:
+               return "General call address received, ACK transmitted";
+       case TWSI_STAT_RX_GEN_ADDR_ARB_LOST:
+               return "Arbitration lost in address as master, general call address received, ACK transmitted";
+       case TWSI_STAT_SLAVE_RXDATA_ACK:
+               return "Data byte received after slave address received, ACK transmitted";
+       case TWSI_STAT_SLAVE_RXDATA_NAK:
+               return "Data byte received after slave address received, NAK transmitted";
+       case TWSI_STAT_GEN_RXADDR_ACK:
+               return "Data byte received after general call address received, ACK transmitted";
+       case TWSI_STAT_GEN_RXADDR_NAK:
+               return "Data byte received after general call address received, NAK transmitted";
+       case TWSI_STAT_STOP_MULTI_START:
+               return "STOP or repeated START condition received in slave mode";
+       case TWSI_STAT_SLAVE_RXADDR2_ACK:
+               return "Slave address + read bit received, ACK transmitted";
+       case TWSI_STAT_RXDATA_ACK_ARB_LOST:
+               return "Arbitration lost in address as master, slave address + read bit received, ACK transmitted";
+       case TWSI_STAT_SLAVE_TXDATA_ACK:
+               return "Data byte transmitted in slave mode, ACK received";
+       case TWSI_STAT_SLAVE_TXDATA_NAK:
+               return "Data byte transmitted in slave mode, NAK received";
+       case TWSI_STAT_SLAVE_TXDATA_END_ACK:
+               return "Last byte transmitted in slave mode, ACK received";
+       case TWSI_STAT_TXADDR2DATA_ACK:
+               return "Second address byte + write bit transmitted, ACK received";
+       case TWSI_STAT_TXADDR2DATA_NAK:
+               return "Second address byte + write bit transmitted, NAK received";
+       case TWSI_STAT_IDLE:
+               return "Idle";
+       default:
+               return "Unknown status code";
+       }
+}
+
+/**
+ * Returns true if we lost arbitration
+ *
+ * @param      code            status code
+ * @param      final_read      true if this is the final read operation
+ *
+ * @return     true if arbitration has been lost, false if it hasn't been lost.
+ */
+static int twsi_i2c_lost_arb(u8 code, int final_read)
+{
+       switch (code) {
+       /* Arbitration lost */
+       case TWSI_STAT_TX_ARB_LOST:
+       case TWSI_STAT_TX_ACK_ARB_LOST:
+       case TWSI_STAT_RX_GEN_ADDR_ARB_LOST:
+       case TWSI_STAT_RXDATA_ACK_ARB_LOST:
+               return -EAGAIN;
+
+       /* Being addressed as slave, should back off and listen */
+       case TWSI_STAT_SLAVE_RXADDR_ACK:
+       case TWSI_STAT_RX_GEN_ADDR_ACK:
+       case TWSI_STAT_GEN_RXADDR_ACK:
+       case TWSI_STAT_GEN_RXADDR_NAK:
+               return -EIO;
+
+       /* Core busy as slave */
+       case TWSI_STAT_SLAVE_RXDATA_ACK:
+       case TWSI_STAT_SLAVE_RXDATA_NAK:
+       case TWSI_STAT_STOP_MULTI_START:
+       case TWSI_STAT_SLAVE_RXADDR2_ACK:
+       case TWSI_STAT_SLAVE_TXDATA_ACK:
+       case TWSI_STAT_SLAVE_TXDATA_NAK:
+       case TWSI_STAT_SLAVE_TXDATA_END_ACK:
+               return  -EIO;
+
+       /* Ack allowed on pre-terminal bytes only */
+       case TWSI_STAT_RXDATA_ACK_SENT:
+               if (!final_read)
+                       return 0;
+               return -EAGAIN;
+
+       /* NAK allowed on terminal byte only */
+       case TWSI_STAT_RXDATA_NAK_SENT:
+               if (!final_read)
+                       return 0;
+               return -EAGAIN;
+
+       case TWSI_STAT_TXDATA_NAK:
+       case TWSI_STAT_TXADDR_NAK:
+       case TWSI_STAT_RXADDR_NAK:
+       case TWSI_STAT_TXADDR2DATA_NAK:
+               return -EAGAIN;
+       }
+       return 0;

drivers/i2c/octeontx_i2c.c line 397

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+}
+
+#define RST_BOOT_PNR_MUL(val)  (((val) >> 33) & 0x1F)
+
+/**
+ * Writes to the MIO_TWS(0..5)_SW_TWSI register
+ *
+ * @param      baseaddr        Base address of i2c registers
+ * @param      sw_twsi         value to write
+ *

Drop blank line (globally)

drivers/i2c/octeontx_i2c.c line 404

Quoted 7 lines
drivers/i2c/octeontx_i2c.c new file +7 -0
+ * @return     0 for success, otherwise error
+ */
+static u64 twsi_write_sw(void *baseaddr, union twsx_sw_twsi sw_twsi)
+{
+       unsigned long start = get_timer(0);
+
+       sw_twsi.s.r = 0;

This is really cryptic. Please get rid of single-char members, and try to drop the units

Quoted 24 lines
drivers/i2c/octeontx_i2c.c new file +24 -0
+       sw_twsi.s.v = 1;
+
+       debug("%s(%p, 0x%llx)\n", __func__, baseaddr, sw_twsi.u);
+       writeq(sw_twsi.u, baseaddr + TWSI_SW_TWSI);
+       do {
+               sw_twsi.u = readq(baseaddr + TWSI_SW_TWSI);
+       } while (sw_twsi.s.v != 0 && get_timer(start) < 50);
+
+       if (sw_twsi.s.v)
+               debug("%s: timed out\n", __func__);
+       return sw_twsi.u;
+}
+
+/**
+ * Reads the MIO_TWS(0..5)_SW_TWSI register
+ *
+ * @param      baseaddr        Base address of i2c registers
+ * @param      sw_twsi         value for eia and op, etc. to read
+ *
+ * @return     value of the register
+ */
+static u64 twsi_read_sw(void *baseaddr, union twsx_sw_twsi sw_twsi)
+{
+       unsigned long start = get_timer(0);

drivers/i2c/octeontx_i2c.c line 438

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+
+       sw_twsi.s.r = 1;
+       sw_twsi.s.v = 1;
+
+       debug("%s(%p, 0x%llx)\n", __func__, baseaddr, sw_twsi.u);
+       writeq(sw_twsi.u, baseaddr + TWSI_SW_TWSI);
+
+       do {
+               sw_twsi.u = readq(baseaddr + TWSI_SW_TWSI);
+       } while (sw_twsi.s.v != 0 && get_timer(start) < 50);

Drop != 0

But I think patman will warn about this anyway.

Quoted 36 lines
drivers/i2c/octeontx_i2c.c new file +36 -0
+
+       if (sw_twsi.s.v)
+               debug("%s: Error writing 0x%llx\n", __func__, sw_twsi.u);
+
+       debug("%s: Returning 0x%llx\n", __func__, sw_twsi.u);
+       return sw_twsi.u;
+}
+
+/**
+ * Write control register
+ *
+ * @param      baseaddr        Base address for i2c registers
+ * @param      data            data to write
+ */
+static void twsi_write_ctl(void *baseaddr, u8 data)
+{
+       union twsx_sw_twsi twsi_sw;
+
+       debug("%s(%p, 0x%x)\n", __func__, baseaddr, data);
+       twsi_sw.u = 0;
+
+       twsi_sw.s.op     = TWSI_SW_EOP_IA;
+       twsi_sw.s.eop_ia = TWSI_CTL;
+       twsi_sw.s.data   = data;
+
+       twsi_write_sw(baseaddr, twsi_sw);
+}
+
+/**
+ * Reads the TWSI Control Register
+ *
+ * @param[in]  baseaddr        Base address for i2c
+ *
+ * @return     8-bit TWSI control register
+ */
+static u32 twsi_read_ctl(void *baseaddr)

drivers/i2c/octeontx_i2c.c line 484

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+{
+       union twsx_sw_twsi sw_twsi;
+
+       sw_twsi.u        = 0;
+       sw_twsi.s.op     = TWSI_SW_EOP_IA;
+       sw_twsi.s.eop_ia = TWSI_CTL;
+
+       sw_twsi.u = twsi_read_sw(baseaddr, sw_twsi);
+       debug("%s(%p): 0x%x\n", __func__, baseaddr, sw_twsi.s.data);
+       return sw_twsi.s.data;

What is causing sw_twsi.s.data to be set, here?

Quoted 41 lines
drivers/i2c/octeontx_i2c.c new file +41 -0
+}
+
+/**
+ * Read i2c status register
+ *
+ * @param      baseaddr        Base address of i2c registers
+ *
+ * @return     value of status register
+ */
+static u8 twsi_read_status(void *baseaddr)
+{
+       union twsx_sw_twsi twsi_sw;
+
+       twsi_sw.u       = 0;
+       twsi_sw.s.op    = TWSI_SW_EOP_IA;
+       twsi_sw.s.eop_ia = TWSI_STAT;
+
+       return twsi_read_sw(baseaddr, twsi_sw);
+}
+
+/**
+ * Waits for an i2c operation to complete
+ *
+ * @param      baseaddr        Base address of registers
+ *
+ * @return     0 for success, 1 if timeout
+ */
+static int twsi_wait(void *baseaddr)
+{
+       unsigned long start = get_timer(0);
+       u8 twsi_ctl;
+
+       debug("%s(%p)\n", __func__, baseaddr);
+       do {
+               twsi_ctl = twsi_read_ctl(baseaddr);
+               twsi_ctl &= TWSI_CTL_IFLG;
+       } while (!twsi_ctl && get_timer(start) < 50);
+
+       debug("  return: %u\n", !twsi_ctl);
+       return !twsi_ctl;
+}

drivers/i2c/octeontx_i2c.c line 535

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+
+/**
+ * Unsticks the i2c bus
+ *
+ * @param      baseaddr        base address of registers
+ */
+static int twsi_start_unstick(void *baseaddr)
+{
+       twsi_stop(baseaddr);
+

no need for this blank line

Quoted 37 lines
drivers/i2c/octeontx_i2c.c new file +37 -0
+       twsi_unblock(baseaddr);
+
+       return 0;
+}
+
+/**
+ * Sends an i2c start condition
+ *
+ * @param      baseaddr        base address of registers
+ *
+ * @return     0 for success, otherwise error
+ */
+static int twsi_start(void *baseaddr)
+{
+       int result;
+       u8 stat;
+
+       debug("%s(%p)\n", __func__, baseaddr);
+       twsi_write_ctl(baseaddr, TWSI_CTL_STA | TWSI_CTL_ENAB);
+       result = twsi_wait(baseaddr);
+       if (result) {
+               stat = twsi_read_status(baseaddr);
+               debug("%s: result: 0x%x, status: 0x%x\n", __func__,
+                     result, stat);
+               switch (stat) {
+               case TWSI_STAT_START:
+               case TWSI_STAT_RSTART:
+                       return 0;
+               case TWSI_STAT_RXADDR_ACK:
+               default:
+                       return twsi_start_unstick(baseaddr);
+               }
+       }
+       debug("%s: success\n", __func__);
+       return 0;
+}
+

drivers/i2c/octeontx_i2c.c line 582

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+/**
+ * Sends an i2c stop condition
+ *
+ * @param      baseaddr        register base address
+ *
+ * @return     0 for success, -1 if error
+ */
+static int twsi_stop(void *baseaddr)
+{
+       u8 stat;

uint

Quoted 5 lines
drivers/i2c/octeontx_i2c.c new file +5 -0
+
+       twsi_write_ctl(baseaddr, TWSI_CTL_STP | TWSI_CTL_ENAB);
+
+       stat = twsi_read_status(baseaddr);
+       if (stat != TWSI_STAT_IDLE) {

drivers/i2c/octeontx_i2c.c line 597

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+               debug("%s: Bad status on bus@%p\n", __func__, baseaddr);
+               return -1;
+       }
+       return 0;
+}
+
+/**
+ * Writes data to the i2c bus
+ *
+ * @param      baseraddr       register base address

BTW we tend to use @baseaddr as the style now

Quoted 27 lines
drivers/i2c/octeontx_i2c.c new file +27 -0
+ * @param      slave_addr      address of slave to write to
+ * @param      buffer          Pointer to buffer to write
+ * @param      length          Number of bytes in buffer to write
+ *
+ * @return     0 for success, otherwise error
+ */
+static int twsi_write_data(void *baseaddr, u8  slave_addr,
+                          u8 *buffer, unsigned int length)
+{
+       union twsx_sw_twsi twsi_sw;
+       unsigned int curr = 0;
+       int result;
+
+       debug("%s(%p, 0x%x, %p, 0x%x)\n", __func__, baseaddr, slave_addr,
+             buffer, length);
+       result = twsi_start(baseaddr);
+       if (result) {
+               debug("%s: Could not start BUS transaction\n", __func__);
+               return -1;
+       }
+
+       result = twsi_wait(baseaddr);
+       if (result) {
+               debug("%s: wait failed\n", __func__);
+               return result;
+       }
+

drivers/i2c/octeontx_i2c.c line 634

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+       twsi_sw.u        = 0;
+       twsi_sw.s.op     = TWSI_SW_EOP_IA;
+       twsi_sw.s.eop_ia = TWSI_DATA;
+       twsi_sw.s.data   = (u32)(slave_addr << 1) | TWSI_OP_WRITE;
+
+       twsi_write_sw(baseaddr, twsi_sw);
+       twsi_write_ctl(baseaddr, TWSI_CTL_ENAB);
+
+       debug("%s: Waiting\n", __func__);
+       result = twsi_wait(baseaddr);

How about 'ret' instead of result? It is shorted and easier to read, and that is what driver model uses.

Quoted 44 lines
drivers/i2c/octeontx_i2c.c new file +44 -0
+       if (result) {
+               debug("%s: Timed out writing slave address 0x%x to target\n",
+                     __func__, slave_addr);
+               return result;
+       }
+       result = twsi_read_status(baseaddr);
+       debug("%s: status: (%d) %s\n", __func__, result,
+             twsi_i2c_status_str(result));
+       if (result != TWSI_STAT_TXADDR_ACK) {
+               debug("%s: status: (%d) %s\n", __func__, result,
+                     twsi_i2c_status_str(result));
+               twsi_stop(baseaddr);
+               return twsi_i2c_lost_arb(result, 0);
+       }
+
+       while (curr < length) {
+               twsi_sw.u        = 0;
+               twsi_sw.s.op     = TWSI_SW_EOP_IA;
+               twsi_sw.s.eop_ia = TWSI_DATA;
+               twsi_sw.s.data   = buffer[curr++];
+
+               twsi_write_sw(baseaddr, twsi_sw);
+               twsi_write_ctl(baseaddr, TWSI_CTL_ENAB);
+
+               debug("%s: Writing 0x%x\n", __func__, twsi_sw.s.data);
+
+               result = twsi_wait(baseaddr);
+               if (result) {
+                       debug("%s: Timed out writing data to 0x%x\n",
+                             __func__, slave_addr);
+                       return result;
+               }
+               result = twsi_read_status(baseaddr);
+               debug("%s: status: (%d) %s\n", __func__, result,
+                     twsi_i2c_status_str(result));
+       }
+
+       debug("%s: Stopping\n", __func__);
+       return twsi_stop(baseaddr);
+}
+
+/**
+ * Manually clear the I2C bus and send a stop
+ */

drivers/i2c/octeontx_i2c.c line 688

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+static void twsi_unblock(void *baseaddr)
+{
+       int i;
+       union twsx_int  int_reg;
+
+       int_reg.u = 0;
+       for (i = 0; i < 9; i++) {
+               int_reg.s.scl_ovr = 0;
+               writeq(int_reg.u, baseaddr + TWSI_INT);
+               udelay(5);

Why do we need udelay()? Please at least add a comment.

drivers/i2c/octeontx_i2c.c line 689

Quoted 1 line
drivers/i2c/octeontx_i2c.c new file +1 -0
+               int_reg.s.scl_ovr = 1;

This is way too cryptic - I think you need to rethink the unions.

Quoted 87 lines
drivers/i2c/octeontx_i2c.c new file +87 -0
+               writeq(int_reg.u, baseaddr + TWSI_INT);
+               udelay(5);
+       }
+       int_reg.s.sda_ovr = 1;
+       writeq(int_reg.u, baseaddr + TWSI_INT);
+       udelay(5);
+       int_reg.s.scl_ovr = 0;
+       writeq(int_reg.u, baseaddr + TWSI_INT);
+       udelay(5);
+       int_reg.u = 0;
+       writeq(int_reg.u, baseaddr + TWSI_INT);
+       udelay(5);
+}
+
+/**
+ * Performs a read transaction on the i2c bus
+ *
+ * @param      baseaddr        Base address of twsi registers
+ * @param      slave_addr      i2c bus address to read from
+ * @param      buffer          buffer to read into
+ * @param      length          number of bytes to read
+ *
+ * @return     0 for success, otherwise error
+ */
+static int twsi_read_data(void *baseaddr, u8 slave_addr,
+                         u8 *buffer, unsigned int length)
+{
+       union twsx_sw_twsi twsi_sw;
+       unsigned int curr = 0;
+       int result;
+
+       debug("%s(%p, 0x%x, %p, %u)\n", __func__, baseaddr, slave_addr,
+             buffer, length);
+       result = twsi_start(baseaddr);
+       if (result) {
+               debug("%s: start failed\n", __func__);
+               return result;
+       }
+
+       result = twsi_wait(baseaddr);
+       if (result) {
+               debug("%s: wait failed\n", __func__);
+               return result;
+       }
+
+       twsi_sw.u        = 0;
+       twsi_sw.s.op     = TWSI_SW_EOP_IA;
+       twsi_sw.s.eop_ia = TWSI_DATA;
+
+       twsi_sw.s.data  = (u32)(slave_addr << 1) | TWSI_OP_READ;
+
+       twsi_write_sw(baseaddr, twsi_sw);
+       twsi_write_ctl(baseaddr, TWSI_CTL_ENAB);
+
+       result = twsi_wait(baseaddr);
+       if (result) {
+               debug("%s: waiting for sending addr failed\n", __func__);
+               return result;
+       }
+
+       result = twsi_read_status(baseaddr);
+       debug("%s: status: (%d) %s\n", __func__, result,
+             twsi_i2c_status_str(result));
+       if (result != TWSI_STAT_RXADDR_ACK) {
+               debug("%s: status: (%d) %s\n", __func__, result,
+                     twsi_i2c_status_str(result));
+               twsi_stop(baseaddr);
+               return twsi_i2c_lost_arb(result, 0);
+       }
+
+       while (curr < length) {
+               twsi_write_ctl(baseaddr, TWSI_CTL_ENAB |
+                               ((curr < length - 1) ? TWSI_CTL_AAK : 0));
+
+               result = twsi_wait(baseaddr);
+               if (result) {
+                       debug("%s: waiting for data failed\n", __func__);
+                       return result;
+               }
+
+               twsi_sw.u = twsi_read_sw(baseaddr, twsi_sw);
+               buffer[curr++] = twsi_sw.s.data;
+       }
+
+       twsi_stop(baseaddr);
+
+       return 0;

drivers/i2c/octeontx_i2c.c line 786

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+}
+
+static void twsi_calc_div(unsigned int speed, int *m_div, int *n_div)
+{
+       int io_clock_hz;
+       int tclk, fsamp;
+       int ndiv, mdiv;
+
+#if defined(CONFIG_ARCH_OCTEONTX)
+       io_clock_hz = octeontx_get_io_clock();

Please use a clock driver.

drivers/i2c/octeontx_i2c.c line 795

Quoted 9 lines
drivers/i2c/octeontx_i2c.c new file +9 -0
+       tclk = io_clock_hz / 2 * (TWSI_THP + 1);
+#elif defined(CONFIG_ARCH_OCTEONTX2)
+       /* Refclk src in mode register defaults to 100MHz clock */
+       io_clock_hz = 100000000; /* 100 Mhz */
+       tclk = io_clock_hz / (TWSI_THP + 2);
+#endif
+       debug("%s( io_clock %u)\n", __func__, io_clock_hz);
+
+       /* Set the TWSI clock to a conservative TWSI_BUS_FREQ.

But what does this have to do with TWSI_BUS_FREQ?

Quoted 27 lines
drivers/i2c/octeontx_i2c.c new file +27 -0
+        * Compute the clocks M divider based on the SCLK.
+        *
+        * TWSI freq = (core freq) / (10 x (M+1) x 2 * (thp+1) x 2^N)
+        * M = ((core freq) / (10 x (TWSI freq) x 2 * (thp+1) x 2^N)) - 1
+        *
+        * For OcteonTX2 -
+        * TWSI freq = (core freq) / (10 x (M+1) x (thp+2) x 2^N)
+        * M = ((core freq) / (10 x (TWSI freq) x (thp+2) x 2^N)) - 1
+        */
+       for (ndiv = 0; ndiv < 8; ndiv++) {
+               fsamp = tclk / (1 << ndiv);
+               mdiv = fsamp / speed / 10;
+               mdiv -= 1;
+               if (mdiv < 16)
+                       break;
+       }
+       *m_div = mdiv;
+       *n_div = ndiv;
+}
+
+static int twsi_init(void *baseaddr, unsigned int speed, int slaveaddr)
+{
+       int n_div, m_div;
+       union twsx_sw_twsi sw_twsi;
+
+       debug("%s(%p, %u, 0x%x)\n", __func__, baseaddr, speed, slaveaddr);
+

drivers/i2c/octeontx_i2c.c line 832

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+       twsi_calc_div(speed, &m_div, &n_div);
+       if (m_div >= 16)
+               return -1;
+
+       sw_twsi.u = 0;
+       sw_twsi.s.v = 1;        /* Clear valid bit */
+       sw_twsi.s.op = 0x6;     /* See EOP field */
+       sw_twsi.s.r = 0;        /* Select CLKCTL when R = 0 */
+       sw_twsi.s.eop_ia = 3;   /* R=0 selects CLKCTL, R=1 selects STAT */
+       sw_twsi.s.data = ((m_div & 0xf) << 3) | ((n_div & 0x7) << 0);

This is just awful :-)

Can you pass some parameters to your function instead, perhaps with some flags?

Quoted 34 lines
drivers/i2c/octeontx_i2c.c new file +34 -0
+
+       twsi_write_sw(baseaddr, sw_twsi);
+       /* Only init non-slave ports */
+       debug("%s: Writing 0x%llx to sw_twsi, m_div: 0x%x, n_div: 0x%x\n",
+             __func__, sw_twsi.u, m_div, n_div);
+
+       sw_twsi.u = 0;
+       sw_twsi.s.v = 1;
+       sw_twsi.s.op = TWSI_SW_EOP_IA;
+       sw_twsi.s.r = 0;
+       sw_twsi.s.eop_ia = 0;
+       sw_twsi.s.data = slaveaddr << 1;
+
+       twsi_write_sw(baseaddr, sw_twsi);
+
+       /* Set slave address */
+       sw_twsi.u = 0;
+       sw_twsi.s.v = 1;
+       sw_twsi.s.op = TWSI_SW_EOP_IA;
+       sw_twsi.s.r = 0;
+       sw_twsi.s.eop_ia = TWSI_EOP_SLAVE_ADDR;
+       sw_twsi.s.data = slaveaddr;
+       twsi_write_sw(baseaddr, sw_twsi);
+
+       return 0;
+}
+
+/**
+ * Transfers data over the i2c bus
+ *
+ * @param      bus     i2c bus to transfer data over
+ * @param      msg     Array of i2c messages
+ * @param      nmsgs   Number of messages to send/receive
+ *

drivers/i2c/octeontx_i2c.c line 876

Quoted 10 lines
drivers/i2c/octeontx_i2c.c new file +10 -0
+ * @return     0 for success, otherwise error
+ */
+static int octeontx_i2c_xfer(struct udevice *bus, struct i2c_msg *msg,
+                            int nmsgs)
+{
+       struct octeontx_twsi *twsi = dev_get_priv(bus);
+       int result;
+
+       debug("%s: %d messages\n", __func__, nmsgs);
+       for (; nmsgs > 0; nmsgs--, msg++) {

for (i = 0; i < nmsgs; i++, msg++)

Quoted 93 lines
drivers/i2c/octeontx_i2c.c new file +92 -1
+               debug("%s: chip=0x%x, len=0x%x\n", __func__, msg->addr,
+                     msg->len);
+               if (msg->flags & I2C_M_RD) {
+                       debug("%s: Reading data\n", __func__);
+                       result = twsi_read_data(twsi->baseaddr, msg->addr,
+                                               msg->buf, msg->len);
+               } else {
+                       debug("%s: Writing data\n", __func__);
+                       result = twsi_write_data(twsi->baseaddr, msg->addr,
+                                                msg->buf, msg->len);
+               }
+               if (result) {
+                       debug("%s: error sending\n", __func__);
+                       return -EREMOTEIO;
+               }
+       }
+
+       return 0;
+}
+
+static int octeontx_i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
+{
+       struct octeontx_twsi *twsi = dev_get_priv(bus);
+       int m_div, n_div;
+       union twsx_sw_twsi sw_twsi;
+       void *baseaddr = twsi->baseaddr;
+
+       debug("%s(%p, %u)\n", __func__, bus, speed);
+
+       twsi_calc_div(speed, &m_div, &n_div);
+       if (m_div >= 16)
+               return -1;
+
+       sw_twsi.u = 0;
+       sw_twsi.s.v = 1;                /* Clear valid bit */
+       sw_twsi.s.op = TWSI_SW_EOP_IA;  /* See EOP field */
+       sw_twsi.s.r = 0;                /* Select CLKCTL when R = 0 */
+       sw_twsi.s.eop_ia = TWSI_CLKCTL; /* R=0 selects CLKCTL, R=1 selects STAT */
+       sw_twsi.s.data = ((m_div & 0xf) << 3) | ((n_div & 0x7) << 0);
+
+       /* Only init non-slave ports */
+       writeq(sw_twsi.u, baseaddr + TWSI_SW_TWSI);
+
+       debug("%s: Wrote 0x%llx to sw_twsi\n", __func__, sw_twsi.u);
+       return 0;
+}
+
+static int octeontx_pci_i2c_probe(struct udevice *dev)
+{
+       struct octeontx_twsi *twsi = dev_get_priv(dev);
+       pci_dev_t bdf = dm_pci_get_bdf(dev);
+
+       debug("TWSI PCI device: %x\n", bdf);
+       dev->req_seq = PCI_FUNC(bdf);
+
+       twsi->baseaddr = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0,
+                                       PCI_REGION_MEM);
+       twsi->id = last_id++;
+
+       debug("TWSI bus %d at %p\n", dev->seq, twsi->baseaddr);
+
+       return twsi_init(twsi->baseaddr,
+                        twsi->id < ARRAY_SIZE(speeds) ?
+                        speeds[twsi->id] : CONFIG_SYS_I2C_SPEED,
+                        CONFIG_SYS_I2C_OCTEONTX_SLAVE_ADDR);
+}
+
+static const struct dm_i2c_ops octeontx_i2c_ops = {
+       .xfer           = octeontx_i2c_xfer,
+       .set_bus_speed  = octeontx_i2c_set_bus_speed,
+};
+
+static const struct udevice_id octeontx_i2c_ids[] = {
+       { .compatible = "cavium,thunder-8890-twsi" },
+       { }
+};
+
+U_BOOT_DRIVER(octeontx_pci_twsi) = {
+       .name   = "i2c_octeontx",
+       .id     = UCLASS_I2C,
+       .of_match = octeontx_i2c_ids,
+       .probe  = octeontx_pci_i2c_probe,
+       .priv_auto_alloc_size = sizeof(struct octeontx_twsi),
+       .ops    = &octeontx_i2c_ops,
+};
+
+static struct pci_device_id octeontx_twsi_supported[] = {
+       { PCI_VDEVICE(CAVIUM, 0xa012) },
+       { },
+};
+
+U_BOOT_PCI_DEVICE(octeontx_pci_twsi, octeontx_twsi_supported);
--
Quoted 2 lines

2.23.0

Regards,
Simon

#42 lore raw

RFC PATCH 21/29 drivers: spi: add SPI controller driver for OcteonTX

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Adds support for SPI controllers found on OcteonTX or OcteonTX2 SoC platforms.

---
 drivers/spi/Kconfig        |   6 +
 drivers/spi/Makefile       |   1 +
 drivers/spi/octeontx_spi.c | 750 +++++++++++++++++++++++++++++++++++++
 3 files changed, 757 insertions(+)
 create mode 100644 drivers/spi/octeontx_spi.c
drivers/spi/Kconfig +6 -0
index b8ca2bdedd..e521f10015 100644
@@ -175,6 +175,12 @@ config MVEBU_A3700_SPI
 	  used to access the SPI NOR flash on platforms embedding this
 	  Marvell IP core.
 
+config OCTEONTX_SPI
+	bool "OcteonTX SPI driver"
+	help
+	  Enable the OcteonTX SPI driver. This driver can be used to
+	  access the SPI NOR flash on OcteonTX or OcteonTX2 SoC platforms.
+
 config PIC32_SPI
 	bool "Microchip PIC32 SPI driver"
 	depends on MACH_PIC32
drivers/spi/Makefile +1 -0
index ae4f2958f8..296eb11da8 100644
@@ -24,6 +24,7 @@ obj-$(CONFIG_BCM63XX_HSSPI) += bcm63xx_hsspi.o
 obj-$(CONFIG_BCM63XX_SPI) += bcm63xx_spi.o
 obj-$(CONFIG_BCMSTB_SPI) += bcmstb_spi.o
 obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o
+obj-$(CONFIG_OCTEONTX_SPI) += octeontx_spi.o
 obj-$(CONFIG_CF_SPI) += cf_spi.o
 obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
 obj-$(CONFIG_DESIGNWARE_SPI) += designware_spi.o
drivers/spi/octeontx_spi.c new file +750 -0

750 lines not on this page · raw message

Signature · 1 line
2.23.0
#43 lore raw

RFC PATCH 22/29 drivers: mmc: remove static qualifier on mmc_power_init

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

For platforms with multiple slot support like OcteonTX, this is invoked per slot.

---
 drivers/mmc/mmc.c | 2 +-
 include/mmc.h     | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/mmc.c +1 -1
index f683b52ead..68d6c0d658 100644
@@ -2640,7 +2640,7 @@ __weak void board_mmc_power_init(void)
 }
 #endif
 
-static int mmc_power_init(struct mmc *mmc)
+int mmc_power_init(struct mmc *mmc)
 {
 #if CONFIG_IS_ENABLED(DM_MMC)
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
include/mmc.h +1 -0
index 1a9efe4c38..360bc0e225 100644
@@ -713,6 +713,7 @@ int mmc_unbind(struct udevice *dev);
 int mmc_initialize(bd_t *bis);
 int mmc_init_device(int num);
 int mmc_init(struct mmc *mmc);
+int mmc_power_init(struct mmc *mmc);
 int mmc_send_tuning(struct mmc *mmc, u32 opcode, int *cmd_error);
 
 #if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) || \
Signature · 1 line
2.23.0
#44 lore raw

RFC PATCH 23/29 drivers: mmc: add MMC controller driver for OcteonTX

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Adds support for MMC controllers found on OcteonTX or OcteonTX2 SoC platforms.

---
 drivers/mmc/Kconfig          |    9 +
 drivers/mmc/Makefile         |    1 +
 drivers/mmc/octeontx_hsmmc.c | 3233 ++++++++++++++++++++++++++++++++++
 drivers/mmc/octeontx_hsmmc.h |  191 ++
 4 files changed, 3434 insertions(+)
 create mode 100644 drivers/mmc/octeontx_hsmmc.c
 create mode 100644 drivers/mmc/octeontx_hsmmc.h
drivers/mmc/Kconfig +9 -0
index 85fd1906bd..0a224bd1de 100644
@@ -287,6 +287,15 @@ config MMC_PCI
 	  This selects PCI-based MMC controllers.
 	  If you have an MMC controller on a PCI bus, say Y here.
 
+config MMC_OCTEONTX
+	bool "Marvell OcteonTX Multimedia Card Interface support"
+	depends on (ARCH_OCTEONTX || ARCH_OCTEONTX2)
+	depends on DM_MMC
+	help
+	  This selects the OcteonTX Multimedia card Interface.
+	  If you have an OcteonTX/TX2 board with a Multimedia Card slot,
+	  say Y here.
+
 	  If unsure, say N.
 
 config MMC_OMAP_HS
drivers/mmc/Makefile +1 -0
index 9c1f8e56e2..67d6833502 100644
@@ -35,6 +35,7 @@ obj-$(CONFIG_MVEBU_MMC) += mvebu_mmc.o
 obj-$(CONFIG_MMC_OMAP_HS)		+= omap_hsmmc.o
 obj-$(CONFIG_MMC_MXC)			+= mxcmmc.o
 obj-$(CONFIG_MMC_MXS)			+= mxsmmc.o
+obj-$(CONFIG_MMC_OCTEONTX)		+= octeontx_hsmmc.o
 obj-$(CONFIG_MMC_PCI)			+= pci_mmc.o
 obj-$(CONFIG_PXA_MMC_GENERIC) += pxa_mmc_gen.o
 obj-$(CONFIG_SUPPORT_EMMC_RPMB) += rpmb.o
drivers/mmc/octeontx_hsmmc.c new file +3233 -0

2,978 lines not on this page · raw message

drivers/mmc/octeontx_hsmmc.h new file +191 -0

191 lines not on this page · raw message

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

Signature · 1 line
2.23.0

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

#45 lore raw

RFC PATCH 24/29 drivers: mtd: nand: add NAND controller driver for OcteonTX

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Adds support for NAND controllers found on OcteonTX or OcteonTX2 SoC platforms. Also includes driver to support Hardware ECC using BCH HW engine found on these platforms.

---
 drivers/mtd/nand/raw/Kconfig             |   16 +
 drivers/mtd/nand/raw/Makefile            |    2 +
 drivers/mtd/nand/raw/octeontx_bch.c      |  424 ++++
 drivers/mtd/nand/raw/octeontx_bch.h      |  142 ++
 drivers/mtd/nand/raw/octeontx_bch_regs.h |  169 ++
 drivers/mtd/nand/raw/octeontx_nand.c     | 2261 ++++++++++++++++++++++
 6 files changed, 3014 insertions(+)
 create mode 100644 drivers/mtd/nand/raw/octeontx_bch.c
 create mode 100644 drivers/mtd/nand/raw/octeontx_bch.h
 create mode 100644 drivers/mtd/nand/raw/octeontx_bch_regs.h
 create mode 100644 drivers/mtd/nand/raw/octeontx_nand.c
drivers/mtd/nand/raw/Kconfig +16 -0
index 2000826c79..a173636116 100644
@@ -292,6 +292,22 @@ config NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
 	  This flag prevent U-boot reconfigure NAND flash controller and reuse
 	  the NAND timing from 1st stage bootloader.
 
+config NAND_OCTEONTX
+	bool "Support for OcteonTX NAND controller"
+	select SYS_NAND_SELF_INIT
+	imply CMD_NAND
+	help
+	 This enables Nand flash controller hardware found on the OcteonTX
+	 processors.
+
+config NAND_OCTEONTX_HW_ECC
+	bool "Support Hardware ECC for OcteonTX NAND controller"
+	depends on NAND_OCTEONTX
+	default y
+	help
+	 This enables Hardware BCH engine found on the OcteonTX processors to
+	 support ECC for NAND flash controller.
+
 config NAND_STM32_FMC2
 	bool "Support for NAND controller on STM32MP SoCs"
 	depends on ARCH_STM32MP
drivers/mtd/nand/raw/Makefile +2 -0
index 9337f6482e..24c51b6924 100644
@@ -58,6 +58,8 @@ obj-$(CONFIG_NAND_VF610_NFC) += vf610_nfc.o
 obj-$(CONFIG_NAND_MXC) += mxc_nand.o
 obj-$(CONFIG_NAND_MXS) += mxs_nand.o
 obj-$(CONFIG_NAND_MXS_DT) += mxs_nand_dt.o
+obj-$(CONFIG_NAND_OCTEONTX) += octeontx_nand.o
+obj-$(CONFIG_NAND_OCTEONTX_HW_ECC) += octeontx_bch.o
 obj-$(CONFIG_NAND_PXA3XX) += pxa3xx_nand.o
 obj-$(CONFIG_NAND_SPEAR) += spr_nand.o
 obj-$(CONFIG_TEGRA_NAND) += tegra_nand.o
drivers/mtd/nand/raw/octeontx_bch.c new file +424 -0

424 lines not on this page · raw message

drivers/mtd/nand/raw/octeontx_bch.h new file +142 -0

142 lines not on this page · raw message

drivers/mtd/nand/raw/octeontx_bch_regs.h new file +169 -0

169 lines not on this page · raw message

drivers/mtd/nand/raw/octeontx_nand.c new file +2261 -0

2,235 lines not on this page · raw message

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

Signature · 1 line
2.23.0

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

#46 lore raw

RFC PATCH 25/29 drivers: net: add NIC controller driver for OcteonTX

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Adds support for Network Interface controllers found on OcteonTX SoC platforms.

---
 drivers/net/Kconfig                 |   12 +
 drivers/net/Makefile                |    2 +
 drivers/net/octeontx/Makefile       |    9 +
 drivers/net/octeontx/bgx.c          | 1546 +++++++++++++++++++++++++++
 drivers/net/octeontx/bgx.h          |  259 +++++
 drivers/net/octeontx/nic.h          |  518 +++++++++
 drivers/net/octeontx/nic_main.c     |  777 ++++++++++++++
 drivers/net/octeontx/nic_reg.h      |  252 +++++
 drivers/net/octeontx/nicvf_main.c   |  575 ++++++++++
 drivers/net/octeontx/nicvf_queues.c | 1141 ++++++++++++++++++++
 drivers/net/octeontx/nicvf_queues.h |  355 ++++++
 drivers/net/octeontx/q_struct.h     |  697 ++++++++++++
 drivers/net/octeontx/smi.c          |  382 +++++++
 drivers/net/octeontx/xcv.c          |  129 +++
 14 files changed, 6654 insertions(+)
 create mode 100644 drivers/net/octeontx/Makefile
 create mode 100644 drivers/net/octeontx/bgx.c
 create mode 100644 drivers/net/octeontx/bgx.h
 create mode 100644 drivers/net/octeontx/nic.h
 create mode 100644 drivers/net/octeontx/nic_main.c
 create mode 100644 drivers/net/octeontx/nic_reg.h
 create mode 100644 drivers/net/octeontx/nicvf_main.c
 create mode 100644 drivers/net/octeontx/nicvf_queues.c
 create mode 100644 drivers/net/octeontx/nicvf_queues.h
 create mode 100644 drivers/net/octeontx/q_struct.h
 create mode 100644 drivers/net/octeontx/smi.c
 create mode 100644 drivers/net/octeontx/xcv.c
drivers/net/Kconfig +12 -0
index eb3d7ed45f..3cb5c6c12b 100644
@@ -326,6 +326,18 @@ config MT7628_ETH
 	help
 	  The MediaTek MT7628 ethernet interface is used on MT7628 and
 	  MT7688 based boards.
+config NET_OCTEONTX
+	bool "OcteonTX Ethernet support"
+	depends on ARCH_OCTEONTX
+	help
+	  You must select Y to enable network device support for
+	  OcteonTX SoCs. If unsure, say n
+config OCTEONTX_SMI
+	bool "OcteonTX SMI Device support"
+	depends on ARCH_OCTEONTX || ARCH_OCTEONTX2
+	help
+	  You must select Y to enable SMI controller support for
+	  OcteonTX or OcteonTX2 SoCs. If unsure, say n
 
 config PCH_GBE
 	bool "Intel Platform Controller Hub EG20T GMAC driver"
drivers/net/Makefile +2 -0
index 30991834ec..a0fedc9d9f 100644
@@ -62,6 +62,8 @@ obj-$(CONFIG_RENESAS_RAVB) += ravb.o
 obj-$(CONFIG_SMC91111) += smc91111.o
 obj-$(CONFIG_SMC911X) += smc911x.o
 obj-$(CONFIG_TSEC_ENET) += tsec.o fsl_mdio.o
+obj-$(CONFIG_NET_OCTEONTX) += octeontx/
+obj-$(CONFIG_OCTEONTX_SMI) += octeontx/smi.o
 obj-$(CONFIG_FMAN_ENET) += fsl_mdio.o
 obj-$(CONFIG_ULI526X) += uli526x.o
 obj-$(CONFIG_VSC7385_ENET) += vsc7385.o
drivers/net/octeontx/Makefile new file +9 -0
new file mode 100644
index 0000000000..170f1f41cd
@@ -0,0 +1,9 @@
+#/* SPDX-License-Identifier:    GPL-2.0
+# *
+# * Copyright (C) 2018 Marvell International Ltd.
+# *
+# * https://spdx.org/licenses
+# */
+
+obj-$(CONFIG_NET_OCTEONTX) += bgx.o nic_main.o nicvf_queues.o nicvf_main.o \
+				xcv.o
drivers/net/octeontx/bgx.c new file +1546 -0

1,546 lines not on this page · raw message

drivers/net/octeontx/bgx.h new file +259 -0

259 lines not on this page · raw message

drivers/net/octeontx/nic.h new file +518 -0

518 lines not on this page · raw message

drivers/net/octeontx/nic_main.c new file +777 -0

642 lines not on this page · raw message

drivers/net/octeontx/nic_reg.h new file +252 -0

252 lines not on this page · raw message

drivers/net/octeontx/nicvf_main.c new file +575 -0

575 lines not on this page · raw message

drivers/net/octeontx/nicvf_queues.c new file +1141 -0

1,141 lines not on this page · raw message

drivers/net/octeontx/nicvf_queues.h new file +355 -0

355 lines not on this page · raw message

drivers/net/octeontx/q_struct.h new file +697 -0

697 lines not on this page · raw message

drivers/net/octeontx/smi.c new file +382 -0

382 lines not on this page · raw message

drivers/net/octeontx/xcv.c new file +129 -0

129 lines not on this page · raw message

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

Signature · 1 line
2.23.0

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

#47 lore raw

RFC PATCH 26/29 drivers: net: add NIC controller driver for OcteonTX2

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Adds support for Network Interface controllers found on OcteonTX2 SoC platforms.

---
 drivers/net/Kconfig                |   17 +
 drivers/net/Makefile               |    2 +
 drivers/net/octeontx2/Makefile     |   11 +
 drivers/net/octeontx2/cgx.c        |  297 ++++++++
 drivers/net/octeontx2/cgx.h        |  105 +++
 drivers/net/octeontx2/cgx_intf.c   |  421 +++++++++++
 drivers/net/octeontx2/cgx_intf.h   |  370 ++++++++++
 drivers/net/octeontx2/lmt.h        |   51 ++
 drivers/net/octeontx2/nix.c        |  824 +++++++++++++++++++++
 drivers/net/octeontx2/nix.h        |  355 +++++++++
 drivers/net/octeontx2/nix_af.c     | 1103 ++++++++++++++++++++++++++++
 drivers/net/octeontx2/npc.h        |   92 +++
 drivers/net/octeontx2/rvu.h        |  127 ++++
 drivers/net/octeontx2/rvu_af.c     |  172 +++++
 drivers/net/octeontx2/rvu_common.c |   74 ++
 drivers/net/octeontx2/rvu_pf.c     |  118 +++
 16 files changed, 4139 insertions(+)
 create mode 100644 drivers/net/octeontx2/Makefile
 create mode 100644 drivers/net/octeontx2/cgx.c
 create mode 100644 drivers/net/octeontx2/cgx.h
 create mode 100644 drivers/net/octeontx2/cgx_intf.c
 create mode 100644 drivers/net/octeontx2/cgx_intf.h
 create mode 100644 drivers/net/octeontx2/lmt.h
 create mode 100644 drivers/net/octeontx2/nix.c
 create mode 100644 drivers/net/octeontx2/nix.h
 create mode 100644 drivers/net/octeontx2/nix_af.c
 create mode 100644 drivers/net/octeontx2/npc.h
 create mode 100644 drivers/net/octeontx2/rvu.h
 create mode 100644 drivers/net/octeontx2/rvu_af.c
 create mode 100644 drivers/net/octeontx2/rvu_common.c
 create mode 100644 drivers/net/octeontx2/rvu_pf.c
drivers/net/Kconfig +17 -0
index 3cb5c6c12b..7ba1196ada 100644
@@ -332,6 +332,15 @@ config NET_OCTEONTX
 	help
 	  You must select Y to enable network device support for
 	  OcteonTX SoCs. If unsure, say n
+
+config NET_OCTEONTX2
+	bool "OcteonTX2 Ethernet support"
+	depends on ARCH_OCTEONTX2
+	select OCTEONTX2_CGX_INTF
+	help
+	  You must select Y to enable network device support for
+	  OcteonTX2 SoCs. If unsure, say n
+
 config OCTEONTX_SMI
 	bool "OcteonTX SMI Device support"
 	depends on ARCH_OCTEONTX || ARCH_OCTEONTX2
@@ -339,6 +348,14 @@ config OCTEONTX_SMI
 	  You must select Y to enable SMI controller support for
 	  OcteonTX or OcteonTX2 SoCs. If unsure, say n
 
+config OCTEONTX2_CGX_INTF
+	bool "OcteonTX2 CGX ATF interface support"
+	depends on ARCH_OCTEONTX2
+	default y if ARCH_OCTEONTX2
+	help
+	  You must select Y to enable CGX ATF interface support for
+	  OcteonTX2 SoCs. If unsure, say n
+
 config PCH_GBE
 	bool "Intel Platform Controller Hub EG20T GMAC driver"
 	depends on DM_ETH && DM_PCI
drivers/net/Makefile +2 -0
index a0fedc9d9f..5555594ce4 100644
@@ -63,7 +63,9 @@ obj-$(CONFIG_SMC91111) += smc91111.o
 obj-$(CONFIG_SMC911X) += smc911x.o
 obj-$(CONFIG_TSEC_ENET) += tsec.o fsl_mdio.o
 obj-$(CONFIG_NET_OCTEONTX) += octeontx/
+obj-$(CONFIG_NET_OCTEONTX2) += octeontx2/
 obj-$(CONFIG_OCTEONTX_SMI) += octeontx/smi.o
+obj-$(CONFIG_OCTEONTX2_CGX_INTF) += octeontx2/cgx_intf.o
 obj-$(CONFIG_FMAN_ENET) += fsl_mdio.o
 obj-$(CONFIG_ULI526X) += uli526x.o
 obj-$(CONFIG_VSC7385_ENET) += vsc7385.o
drivers/net/octeontx2/Makefile new file +11 -0
new file mode 100644
index 0000000000..92183ffc3e
@@ -0,0 +1,11 @@
+#/*
+# * Copyright (C) 2018 Marvell International Ltd.
+# *
+# * SPDX-License-Identifier:    GPL-2.0
+# * https://spdx.org/licenses
+# */
+
+
+obj-$(CONFIG_NET_OCTEONTX2) += cgx.o nix_af.o nix.o rvu_pf.o \
+				rvu_af.o rvu_common.o
+
drivers/net/octeontx2/cgx.c new file +297 -0

297 lines not on this page · raw message

drivers/net/octeontx2/cgx.h new file +105 -0

105 lines not on this page · raw message

drivers/net/octeontx2/cgx_intf.c new file +421 -0

421 lines not on this page · raw message

drivers/net/octeontx2/cgx_intf.h new file +370 -0

370 lines not on this page · raw message

drivers/net/octeontx2/lmt.h new file +51 -0

51 lines not on this page · raw message

drivers/net/octeontx2/nix.c new file +824 -0

824 lines not on this page · raw message

drivers/net/octeontx2/nix.h new file +355 -0

355 lines not on this page · raw message

drivers/net/octeontx2/nix_af.c new file +1103 -0

528 lines not on this page · raw message

drivers/net/octeontx2/npc.h new file +92 -0

92 lines not on this page · raw message

drivers/net/octeontx2/rvu.h new file +127 -0

127 lines not on this page · raw message

drivers/net/octeontx2/rvu_af.c new file +172 -0

172 lines not on this page · raw message

drivers/net/octeontx2/rvu_common.c new file +74 -0

74 lines not on this page · raw message

drivers/net/octeontx2/rvu_pf.c new file +118 -0

118 lines not on this page · raw message

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

Signature · 1 line
2.23.0

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

#48 lore raw

RFC PATCH 27/29 drivers: watchdog: add reset support for OcteonTX

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

Adds support for Core 0 poke on OcteonTX and OcteonTX2 platforms.

---
 drivers/watchdog/Kconfig        | 10 +++++
 drivers/watchdog/Makefile       |  1 +
 drivers/watchdog/octeontx_wdt.c | 76 +++++++++++++++++++++++++++++++++
 3 files changed, 87 insertions(+)
 create mode 100644 drivers/watchdog/octeontx_wdt.c
drivers/watchdog/Kconfig +10 -0
index 8c16d69d33..61357a7f0a 100644
@@ -121,6 +121,16 @@ config WDT_MTK
 	  The watchdog timer is stopped when initialized.
 	  It performs full SoC reset.
 
+config WDT_OCTEONTX
+	bool "OcteonTX core watchdog support"
+	depends on WDT && (ARCH_OCTEONTX || ARCH_OCTEONTX2)
+	default y if WDT && ARCH_OCTEONTX || ARCH_OCTEONTX2
+	imply WATCHDOG
+	help
+	  This enables OcteonTX watchdog driver, which can be
+	  found on OcteonTX/TX2 chipsets and inline with driver model.
+	  Only supports watchdog reset.
+
 config WDT_OMAP3
         bool "TI OMAP watchdog timer support"
         depends on WDT && ARCH_OMAP2PLUS
drivers/watchdog/Makefile +1 -0
index 955caef815..66b20b0e98 100644
@@ -25,6 +25,7 @@ obj-$(CONFIG_WDT_CDNS) += cdns_wdt.o
 obj-$(CONFIG_WDT_MPC8xx) += mpc8xx_wdt.o
 obj-$(CONFIG_WDT_MT7621) += mt7621_wdt.o
 obj-$(CONFIG_WDT_MTK) += mtk_wdt.o
+obj-$(CONFIG_WDT_OCTEONTX) += octeontx_wdt.o
 obj-$(CONFIG_WDT_OMAP3) += omap_wdt.o
 obj-$(CONFIG_WDT_SP805) += sp805_wdt.o
 obj-$(CONFIG_WDT_STM32MP) += stm32mp_wdt.o
drivers/watchdog/octeontx_wdt.c new file +76 -0

76 lines not on this page · raw message

Signature · 1 line
2.23.0
#49 lore raw

RFC PATCH 28/29 octeontx: Add support for OcteonTX SoC platforms

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

This patch adds support for all OcteonTX 81xx/83xx boards from Marvell.
For 81xx boards, use octeontx_81xx_defconfig and for 83xx boards, use octeontx_83xx_defconfig.

---
 arch/arm/Kconfig                       |   9 +
 arch/arm/Makefile                      |   1 +
 arch/arm/mach-octeontx/Kconfig         |  23 +++
 arch/arm/mach-octeontx/Makefile        |   9 +
 arch/arm/mach-octeontx/clock.c         |  35 ++++
 arch/arm/mach-octeontx/cpu.c           |  76 +++++++
 arch/arm/mach-octeontx/lowlevel_init.S |  33 +++
 board/Marvell/octeontx/Kconfig         |  14 ++
 board/Marvell/octeontx/MAINTAINERS     |   9 +
 board/Marvell/octeontx/Makefile        |   9 +
 board/Marvell/octeontx/board-fdt.c     | 271 +++++++++++++++++++++++++
 board/Marvell/octeontx/board.c         | 137 +++++++++++++
 board/Marvell/octeontx/smc.c           |  30 +++
 board/Marvell/octeontx/soc-utils.c     |  53 +++++
 configs/octeontx_81xx_defconfig        | 133 ++++++++++++
 configs/octeontx_83xx_defconfig        | 130 ++++++++++++
 include/configs/octeontx_common.h      |  98 +++++++++
 17 files changed, 1070 insertions(+)
 create mode 100644 arch/arm/mach-octeontx/Kconfig
 create mode 100644 arch/arm/mach-octeontx/Makefile
 create mode 100644 arch/arm/mach-octeontx/clock.c
 create mode 100644 arch/arm/mach-octeontx/cpu.c
 create mode 100644 arch/arm/mach-octeontx/lowlevel_init.S
 create mode 100644 board/Marvell/octeontx/Kconfig
 create mode 100644 board/Marvell/octeontx/MAINTAINERS
 create mode 100644 board/Marvell/octeontx/Makefile
 create mode 100644 board/Marvell/octeontx/board-fdt.c
 create mode 100644 board/Marvell/octeontx/board.c
 create mode 100644 board/Marvell/octeontx/smc.c
 create mode 100644 board/Marvell/octeontx/soc-utils.c
 create mode 100644 configs/octeontx_81xx_defconfig
 create mode 100644 configs/octeontx_83xx_defconfig
 create mode 100644 include/configs/octeontx_common.h
arch/arm/Kconfig +9 -0
index 629c5e8c2d..ebe180ad90 100644
@@ -1618,6 +1618,13 @@ config ARCH_ROCKCHIP
 	imply TPL_SYSRESET
 	imply USB_FUNCTION_FASTBOOT
 
+config ARCH_OCTEONTX
+	bool "Support OcteonTX SoCs"
+	select DM
+	select ARM64
+	select OF_CONTROL
+	select BOARD_LATE_INIT
+	select SYS_CACHE_SHIFT_7
 config TARGET_THUNDERX_88XX
 	bool "Support ThunderX 88xx"
 	select ARM64
@@ -1695,6 +1702,7 @@ source "arch/arm/cpu/arm926ejs/lpc32xx/Kconfig"
 
 source "arch/arm/mach-mvebu/Kconfig"
 
+source "arch/arm/mach-octeontx/Kconfig"
 source "arch/arm/cpu/armv7/ls102xa/Kconfig"
 
 source "arch/arm/mach-imx/mx2/Kconfig"
@@ -1772,6 +1780,7 @@ source "board/bosch/guardian/Kconfig"
 source "board/CarMediaLab/flea3/Kconfig"
 source "board/Marvell/aspenite/Kconfig"
 source "board/Marvell/gplugd/Kconfig"
+source "board/Marvell/octeontx/Kconfig"
 source "board/armadeus/apf27/Kconfig"
 source "board/armltd/vexpress/Kconfig"
 source "board/armltd/vexpress64/Kconfig"
arch/arm/Makefile +1 -0
index 5384981c17..271ada99e8 100644
@@ -79,6 +79,7 @@ machine-$(CONFIG_ARCH_ROCKCHIP)		+= rockchip
 machine-$(CONFIG_STM32)			+= stm32
 machine-$(CONFIG_ARCH_STM32MP)		+= stm32mp
 machine-$(CONFIG_TEGRA)			+= tegra
+machine-$(CONFIG_ARCH_OCTEONTX)		+= octeontx
 machine-$(CONFIG_ARCH_UNIPHIER)		+= uniphier
 machine-$(CONFIG_ARCH_ZYNQ)		+= zynq
 machine-$(CONFIG_ARCH_ZYNQMP)		+= zynqmp
arch/arm/mach-octeontx/Kconfig new file +23 -0
new file mode 100644
index 0000000000..28ecf9821f
@@ -0,0 +1,23 @@
+if ARCH_OCTEONTX
+
+choice
+	prompt "OcteonTX board select"
+	optional
+
+config TARGET_OCTEONTX_81XX
+	bool "Marvell OcteonTX CN81XX"
+
+config TARGET_OCTEONTX_83XX
+	bool "Marvell OcteonTX CN83XX"
+
+endchoice
+
+config SYS_SOC
+	string
+	default "octeontx"
+
+config SYS_PCI_64BIT
+	bool
+	default y
+
+endif
arch/arm/mach-octeontx/Makefile new file +9 -0
new file mode 100644
index 0000000000..20cb48ad92
@@ -0,0 +1,9 @@
+#/* SPDX-License-Identifier:    GPL-2.0
+# *
+# * Copyright (C) 2018 Marvell International Ltd.
+# *
+# * https://spdx.org/licenses
+# */
+
+obj-y += lowlevel_init.o clock.o cpu.o
+
arch/arm/mach-octeontx/clock.c new file +35 -0
new file mode 100644
index 0000000000..9da21077ec
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier:    GPL-2.0
+/*
+ * Copyright (C) 2018 Marvell International Ltd.
+ *
+ * https://spdx.org/licenses
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/board.h>
+#include <asm/arch/clock.h>
+
+/**
+ * Returns the I/O clock speed in Hz
+ */
+u64 octeontx_get_io_clock(void)
+{
+	union rst_boot rst_boot;
+
+	rst_boot.u = readq(RST_BOOT);
+
+	return rst_boot.s.pnr_mul * PLL_REF_CLK;
+}
+
+/**
+ * Returns the core clock speed in Hz
+ */
+u64 octeontx_get_core_clock(void)
+{
+	union rst_boot rst_boot;
+
+	rst_boot.u = readq(RST_BOOT);
+
+	return rst_boot.s.c_mul * PLL_REF_CLK;
+}
arch/arm/mach-octeontx/cpu.c new file +76 -0

76 lines not on this page · raw message

arch/arm/mach-octeontx/lowlevel_init.S new file +33 -0
new file mode 100644
index 0000000000..41a9f08aed
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier:    GPL-2.0
+ *
+ * Copyright (C) 2018 Marvell International Ltd.
+ *
+ * https://spdx.org/licenses
+ */
+
+#include <config.h>
+#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/Marvell/octeontx/Kconfig new file +14 -0
new file mode 100644
index 0000000000..45d115916c
@@ -0,0 +1,14 @@
+if TARGET_OCTEONTX_81XX || TARGET_OCTEONTX_83XX
+
+config SYS_VENDOR
+	string
+	default	"Marvell"
+
+config SYS_BOARD
+	string
+	default "octeontx"
+
+config SYS_CONFIG_NAME
+	default "octeontx_common"
+
+endif
board/Marvell/octeontx/MAINTAINERS new file +9 -0
new file mode 100644
index 0000000000..10816c7a03
@@ -0,0 +1,9 @@
+OCTEONTX BOARD
+M:	Suneel Garapati <[email protected]>
+M:	Aaron Williams <[email protected]>
+S:	Maintained
+F:	board/Marvell/octeontx/
+F:	include/configs/octeontx_81xx.h
+F:	include/configs/octeontx_83xx.h
+F:	configs/octeontx_81xx_defconfig
+F:	configs/octeontx_83xx_defconfig
board/Marvell/octeontx/Makefile new file +9 -0
new file mode 100644
index 0000000000..fbe32ae003
@@ -0,0 +1,9 @@
+#/*
+# * Copyright (C) 2018 Marvell International Ltd.
+# *
+# * SPDX-License-Identifier:    GPL-2.0
+# * https://spdx.org/licenses
+# */
+
+obj-y	:= board.o smc.o soc-utils.o
+obj-$(CONFIG_OF_LIBFDT) += board-fdt.o
board/Marvell/octeontx/board-fdt.c new file +271 -0

271 lines not on this page · raw message

board/Marvell/octeontx/board.c new file +137 -0

137 lines not on this page · raw message

board/Marvell/octeontx/smc.c new file +30 -0
new file mode 100644
index 0000000000..f6e6706b57
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier:    GPL-2.0
+/*
+ * Copyright (C) 2018 Marvell International Ltd.
+ *
+ * https://spdx.org/licenses
+ */
+
+#include <common.h>
+#include <asm/io.h>
+
+#include <asm/system.h>
+#include <asm/arch/smc.h>
+
+#include <asm/psci.h>
+
+#include <malloc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+ssize_t smc_dram_size(unsigned int node)
+{
+	struct pt_regs regs;
+
+	regs.regs[0] = OCTEONTX_DRAM_SIZE;
+	regs.regs[1] = node;
+	smc_call(&regs);
+
+	return regs.regs[0];
+}
+
board/Marvell/octeontx/soc-utils.c new file +53 -0

53 lines not on this page · raw message

configs/octeontx_81xx_defconfig new file +133 -0

133 lines not on this page · raw message

configs/octeontx_83xx_defconfig new file +130 -0

130 lines not on this page · raw message

include/configs/octeontx_common.h new file +98 -0

98 lines not on this page · raw message

Signature · 1 line
2.23.0
#50 lore raw

RFC PATCH 29/29 octeontx2: Add support for OcteonTX2 SoC platforms

In reply to Suneel Garapati

From: Suneel Garapati <[email protected]>

This patch adds support for all OcteonTX2 96xx/95xx boards from Marvell.
For 96xx boards, use octeontx_96xx_defconfig and for 95xx boards, use octeontx_95xx_defconfig.

---
 arch/arm/Kconfig                        |  13 ++
 arch/arm/Makefile                       |   1 +
 arch/arm/mach-octeontx2/Kconfig         |  23 +++
 arch/arm/mach-octeontx2/Makefile        |   9 +
 arch/arm/mach-octeontx2/clock.c         |  35 ++++
 arch/arm/mach-octeontx2/config.mk       |   4 +
 arch/arm/mach-octeontx2/cpu.c           |  72 ++++++++
 arch/arm/mach-octeontx2/lowlevel_init.S |  33 ++++
 board/Marvell/octeontx2/Kconfig         |  15 ++
 board/Marvell/octeontx2/MAINTAINERS     |   9 +
 board/Marvell/octeontx2/Makefile        |   9 +
 board/Marvell/octeontx2/board-fdt.c     | 155 ++++++++++++++++
 board/Marvell/octeontx2/board.c         | 232 ++++++++++++++++++++++++
 board/Marvell/octeontx2/smc.c           |  62 +++++++
 board/Marvell/octeontx2/soc-utils.c     |  49 +++++
 configs/octeontx2_95xx_defconfig        | 105 +++++++++++
 configs/octeontx2_96xx_defconfig        | 131 +++++++++++++
 include/configs/octeontx2_95xx.h        |  80 ++++++++
 include/configs/octeontx2_96xx.h        |  90 +++++++++
 19 files changed, 1127 insertions(+)
 create mode 100644 arch/arm/mach-octeontx2/Kconfig
 create mode 100644 arch/arm/mach-octeontx2/Makefile
 create mode 100644 arch/arm/mach-octeontx2/clock.c
 create mode 100644 arch/arm/mach-octeontx2/config.mk
 create mode 100644 arch/arm/mach-octeontx2/cpu.c
 create mode 100644 arch/arm/mach-octeontx2/lowlevel_init.S
 create mode 100644 board/Marvell/octeontx2/Kconfig
 create mode 100644 board/Marvell/octeontx2/MAINTAINERS
 create mode 100644 board/Marvell/octeontx2/Makefile
 create mode 100644 board/Marvell/octeontx2/board-fdt.c
 create mode 100644 board/Marvell/octeontx2/board.c
 create mode 100644 board/Marvell/octeontx2/smc.c
 create mode 100644 board/Marvell/octeontx2/soc-utils.c
 create mode 100644 configs/octeontx2_95xx_defconfig
 create mode 100644 configs/octeontx2_96xx_defconfig
 create mode 100644 include/configs/octeontx2_95xx.h
 create mode 100644 include/configs/octeontx2_96xx.h
arch/arm/Kconfig +13 -0
index ebe180ad90..2b43e2459e 100644
@@ -1625,6 +1625,15 @@ config ARCH_OCTEONTX
 	select OF_CONTROL
 	select BOARD_LATE_INIT
 	select SYS_CACHE_SHIFT_7
+
+config ARCH_OCTEONTX2
+	bool "Support OcteonTX2 SoCs"
+	select DM
+	select ARM64
+	select OF_CONTROL
+	select BOARD_LATE_INIT
+	select SYS_CACHE_SHIFT_7
+
 config TARGET_THUNDERX_88XX
 	bool "Support ThunderX 88xx"
 	select ARM64
@@ -1703,6 +1712,9 @@ source "arch/arm/cpu/arm926ejs/lpc32xx/Kconfig"
 source "arch/arm/mach-mvebu/Kconfig"
 
 source "arch/arm/mach-octeontx/Kconfig"
+
+source "arch/arm/mach-octeontx2/Kconfig"
+
 source "arch/arm/cpu/armv7/ls102xa/Kconfig"
 
 source "arch/arm/mach-imx/mx2/Kconfig"
@@ -1781,6 +1793,7 @@ source "board/CarMediaLab/flea3/Kconfig"
 source "board/Marvell/aspenite/Kconfig"
 source "board/Marvell/gplugd/Kconfig"
 source "board/Marvell/octeontx/Kconfig"
+source "board/Marvell/octeontx2/Kconfig"
 source "board/armadeus/apf27/Kconfig"
 source "board/armltd/vexpress/Kconfig"
 source "board/armltd/vexpress64/Kconfig"
arch/arm/Makefile +1 -0
index 271ada99e8..80c7c61061 100644
@@ -80,6 +80,7 @@ machine-$(CONFIG_STM32)			+= stm32
 machine-$(CONFIG_ARCH_STM32MP)		+= stm32mp
 machine-$(CONFIG_TEGRA)			+= tegra
 machine-$(CONFIG_ARCH_OCTEONTX)		+= octeontx
+machine-$(CONFIG_ARCH_OCTEONTX2)	+= octeontx2
 machine-$(CONFIG_ARCH_UNIPHIER)		+= uniphier
 machine-$(CONFIG_ARCH_ZYNQ)		+= zynq
 machine-$(CONFIG_ARCH_ZYNQMP)		+= zynqmp
arch/arm/mach-octeontx2/Kconfig new file +23 -0
new file mode 100644
index 0000000000..8e5cb0f638
@@ -0,0 +1,23 @@
+if ARCH_OCTEONTX2
+
+choice
+	prompt "OcteonTX2 board select"
+	optional
+
+config TARGET_OCTEONTX2_95XX
+	bool "Marvell OcteonTX2 CN95XX"
+
+config TARGET_OCTEONTX2_96XX
+	bool "Marvell OcteonTX2 CN96XX"
+
+endchoice
+
+config SYS_SOC
+	string
+	default "octeontx2"
+
+config SYS_PCI_64BIT
+	bool
+	default y
+
+endif
arch/arm/mach-octeontx2/Makefile new file +9 -0
new file mode 100644
index 0000000000..c3192343dd
@@ -0,0 +1,9 @@
+#/*
+# * Copyright (C) 2018 Marvell International Ltd.
+# *
+# * SPDX-License-Identifier:    GPL-2.0
+# * https://spdx.org/licenses
+# */
+
+obj-y += lowlevel_init.o clock.o cpu.o
+
arch/arm/mach-octeontx2/clock.c new file +35 -0
new file mode 100644
index 0000000000..9da21077ec
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier:    GPL-2.0
+/*
+ * Copyright (C) 2018 Marvell International Ltd.
+ *
+ * https://spdx.org/licenses
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/board.h>
+#include <asm/arch/clock.h>
+
+/**
+ * Returns the I/O clock speed in Hz
+ */
+u64 octeontx_get_io_clock(void)
+{
+	union rst_boot rst_boot;
+
+	rst_boot.u = readq(RST_BOOT);
+
+	return rst_boot.s.pnr_mul * PLL_REF_CLK;
+}
+
+/**
+ * Returns the core clock speed in Hz
+ */
+u64 octeontx_get_core_clock(void)
+{
+	union rst_boot rst_boot;
+
+	rst_boot.u = readq(RST_BOOT);
+
+	return rst_boot.s.c_mul * PLL_REF_CLK;
+}
arch/arm/mach-octeontx2/config.mk new file +4 -0
new file mode 100644
index 0000000000..9214f6b742
@@ -0,0 +1,4 @@
+ifeq ($(CONFIG_ARCH_OCTEONTX2),y)
+PLATFORM_CPPFLAGS += $(call cc-option,-march=armv8.2-a,)
+PLATFORM_CPPFLAGS += $(call cc-option,-mtune=octeontx2,)
+endif
arch/arm/mach-octeontx2/cpu.c new file +72 -0

72 lines not on this page · raw message

arch/arm/mach-octeontx2/lowlevel_init.S new file +33 -0
new file mode 100644
index 0000000000..41a9f08aed
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier:    GPL-2.0
+ *
+ * Copyright (C) 2018 Marvell International Ltd.
+ *
+ * https://spdx.org/licenses
+ */
+
+#include <config.h>
+#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/Marvell/octeontx2/Kconfig new file +15 -0
new file mode 100644
index 0000000000..e298b4cc85
@@ -0,0 +1,15 @@
+if TARGET_OCTEONTX2_95XX || TARGET_OCTEONTX2_96XX
+
+config SYS_VENDOR
+	string
+	default	"Marvell"
+
+config SYS_BOARD
+	string
+	default "octeontx2"
+
+config SYS_CONFIG_NAME
+	default "octeontx2_96xx" if TARGET_OCTEONTX2_96XX
+	default "octeontx2_95xx" if TARGET_OCTEONTX2_95XX
+
+endif
board/Marvell/octeontx2/MAINTAINERS new file +9 -0
new file mode 100644
index 0000000000..73026ccdc6
@@ -0,0 +1,9 @@
+OCTEONTX2 BOARD
+M:	Suneel Garapati <[email protected]>
+M:	Aaron Williams <[email protected]>
+S:	Maintained
+F:	board/Marvell/octeontx2/
+F:	include/configs/octeontx2_96xx.h
+F:	include/configs/octeontx2_95xx.h
+F:	configs/octeontx2_96xx_defconfig
+F:	configs/octeontx2_95xx_defconfig
board/Marvell/octeontx2/Makefile new file +9 -0
new file mode 100644
index 0000000000..1f763b197b
@@ -0,0 +1,9 @@
+#/* SPDX-License-Identifier:    GPL-2.0
+# *
+# * Copyright (C) 2018 Marvell International Ltd.
+# *
+# * https://spdx.org/licenses
+# */
+
+obj-y	:= board.o smc.o soc-utils.o
+obj-$(CONFIG_OF_LIBFDT) += board-fdt.o
board/Marvell/octeontx2/board-fdt.c new file +155 -0

155 lines not on this page · raw message

board/Marvell/octeontx2/board.c new file +232 -0

232 lines not on this page · raw message

board/Marvell/octeontx2/smc.c new file +62 -0

62 lines not on this page · raw message

board/Marvell/octeontx2/soc-utils.c new file +49 -0

49 lines not on this page · raw message

configs/octeontx2_95xx_defconfig new file +105 -0

105 lines not on this page · raw message

configs/octeontx2_96xx_defconfig new file +131 -0

131 lines not on this page · raw message

include/configs/octeontx2_95xx.h new file +80 -0

80 lines not on this page · raw message

include/configs/octeontx2_96xx.h new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
2.23.0
#51 lore raw

cover arm: Introduce Marvell/Cavium OcteonTX

In reply to Suneel Garapati
Quoted 7 lines · Suneel Garapati

This series will add support for OcteonTX and OcteonTX2 processsor based platforms. The Marvell/Cavium Octeon-TX 64-bit ARM based SoCs include the CN80XX, CN81XX and CN83XX while Octeon-TX2 64-bit ARM based SoCs include support for CN96XX and CN95XX.
These SoC's have peripheral drivers based on PCI ECAM.

Quoted 10 lines

Patches
[1 -10] Add requied changes to PCI framework
- [6] Add support for multi-memory region range
- [7] EA in bridges
- [8] SR-IOV
[12] Add driver model support for RTC DS1337 driver [15 - 17] AHCI changes
[18 - 27] Add OcteonTX drivers
[28 - 29] Add OcteonTX/TX2 board files and configurations

Suneel,

Thanks for submitting this series!

I've applied and built this and am testing on the Gateworks Newport boards with the CN802x/CN803x (octeontx_81xx) and this is what I've found:
- I get hung in the smc_call from smc_dram_size which your calling with the function id of 0xc2000301. The older U-Boot from the Cavium OcteonTX SDK-6.2.0-p3 used 0x43000301 and this works for me. Is there a difference in our ATF version?
- configs/octeontx_81xx_defconfig - I have several changes I want to make here, but perhaps some of these would warrant a custom config for my boards
- you assume there is only a SPI NOR flash for env which we
personally don't use. The env system supports multiple env types so we could just enable MMC as well as SPI but then I find all the hard-coded CONFIG_ENV_* defines restrictive. I wonder if anyone has defined a way for these to come from device-tree?
- you set loadaddr=040080000 which only makes sense for systems with
over 1GiB of DRAM... perhaps we should lower that to loadaddr=020080000 for 1GiB systems (I don't think you can have less than 1GiB?)
- I use DISTRO_DEFAULTS for a standard distro-friendly boot env...
I'm not sure why any board wouldn't do this these days and I think that should be added

I was able to functionally test mmc/i2c/gpio/pci/nic(BGX/RGX) and they were all functioning well.

When I enable SATA I find that it crashes on init:
GW6300-D1> sata info
Target spinup took 0 ms.
AHCI 0001.0300 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
flags: 64bit ncq ilck stag pm led clo only pmp fbss pio slum part ccc apst "Synchronous Abort" handler, esr 0x96000006
elr: 000000000052c240 lr : 00000000005101bc (reloc)
elr: 000000003fecb240 lr : 000000003feaf1bc
x0 : 000000003be91380 x1 : 0000000000000000
x2 : 0000000000000000 x3 : 000000003be9c100
x4 : 0000000000000120 x5 : 000000003be9b800
x6 : 0000000000000001 x7 : 0000000000000000
x8 : 000000003ff46998 x9 : 0000000000000008
x10: 000000003ff2e8c4 x11: 000000003ff2e8ca
x12: 000000003ff2e8cf x13: 000000003ff2e8d5
x14: 000000003ff2e8da x15: 000000003ff2e8e0
x16: 000000003ff2e8e6 x17: 000000003ff43362
x18: 000000003be8ede0 x19: 0000000000000000
x20: 000000003be9ab30 x21: 0000000000000002
x22: 000000003be9ab30 x23: 0000000000000002
x24: 000000003ff63aa4 x25: 000000003be9ab90
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000000000000 x29: 000000003be881f0

Code: 928004a0 d65f03c0 f9400007 f94034e7 (f94008e7)

Resetting CPU ...

I don't have NAND or SPI flash so can't test those.

Best Regards,

Tim

#52 lore raw

Hi Tim,

I think I can answer some of your questions.

Quoted 5 lines · PDT Tim Harvey

External Email

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

On Tue, Oct 29, 2019 at 2:08 PM Suneel Garapati <[email protected]>

Quoted 22 lines · wrote:
Quoted 9 lines

This series will add support for OcteonTX and OcteonTX2 processsor based platforms. The Marvell/Cavium Octeon-TX 64-bit ARM based SoCs include the CN80XX, CN81XX and CN83XX while Octeon-TX2 64-bit ARM based SoCs include support for CN96XX and CN95XX.
These SoC's have peripheral drivers based on PCI ECAM.

Patches
[1 -10] Add requied changes to PCI framework

Quoted 8 lines

- [6] Add support for multi-memory region range
- [7] EA in bridges
- [8] SR-IOV

[12] Add driver model support for RTC DS1337 driver [15 - 17] AHCI changes
[18 - 27] Add OcteonTX drivers
[28 - 29] Add OcteonTX/TX2 board files and configurations

Suneel,

Thanks for submitting this series!

Quoted 7 lines

I've applied and built this and am testing on the Gateworks Newport boards with the CN802x/CN803x (octeontx_81xx) and this is what I've found:
- I get hung in the smc_call from smc_dram_size which your calling with the function id of 0xc2000301. The older U-Boot from the Cavium OcteonTX SDK-6.2.0-p3 used 0x43000301 and this works for me. Is there a difference in our ATF version?

ATF has indeed changed significantly. The current U-Boot requires an up-to- date ATF. I recall this was one of the changes we made with regards to getting the size of memory.

Quoted 8 lines

- configs/octeontx_81xx_defconfig - I have several changes I want to make here, but perhaps some of these would warrant a custom config for my boards
- you assume there is only a SPI NOR flash for env which we
personally don't use. The env system supports multiple env types so we could just enable MMC as well as SPI but then I find all the hard-coded CONFIG_ENV_* defines restrictive. I wonder if anyone has defined a way for these to come from device-tree?

We have not tested loading the environment from eMMC. It would be nice if the environment location could come from the device tree.

Quoted 35 lines

- you set loadaddr=040080000 which only makes sense for systems with
over 1GiB of DRAM... perhaps we should lower that to loadaddr=020080000 for 1GiB systems (I don't think you can have less than 1GiB?)
- I use DISTRO_DEFAULTS for a standard distro-friendly boot env...
I'm not sure why any board wouldn't do this these days and I think that should be added

I was able to functionally test mmc/i2c/gpio/pci/nic(BGX/RGX) and they were all functioning well.

When I enable SATA I find that it crashes on init:
GW6300-D1> sata info
Target spinup took 0 ms.
AHCI 0001.0300 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
flags: 64bit ncq ilck stag pm led clo only pmp fbss pio slum part ccc apst "Synchronous Abort" handler, esr 0x96000006
elr: 000000000052c240 lr : 00000000005101bc (reloc)
elr: 000000003fecb240 lr : 000000003feaf1bc
x0 : 000000003be91380 x1 : 0000000000000000
x2 : 0000000000000000 x3 : 000000003be9c100
x4 : 0000000000000120 x5 : 000000003be9b800
x6 : 0000000000000001 x7 : 0000000000000000
x8 : 000000003ff46998 x9 : 0000000000000008
x10: 000000003ff2e8c4 x11: 000000003ff2e8ca
x12: 000000003ff2e8cf x13: 000000003ff2e8d5
x14: 000000003ff2e8da x15: 000000003ff2e8e0
x16: 000000003ff2e8e6 x17: 000000003ff43362
x18: 000000003be8ede0 x19: 0000000000000000
x20: 000000003be9ab30 x21: 0000000000000002
x22: 000000003be9ab30 x23: 0000000000000002
x24: 000000003ff63aa4 x25: 000000003be9ab90
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000000000000 x29: 000000003be881f0

Quoted 8 lines
Code: 928004a0 d65f03c0 f9400007 f94034e7 (f94008e7)

Resetting CPU ...

I don't have NAND or SPI flash so can't test those.

Best Regards,

Tim

NAND is not very common any more. Most boards use SPI flash, however.

-Aaron

#53 lore raw
Quoted 42 lines · Aaron Williams

Hi Tim,

I think I can answer some of your questions.

Quoted 5 lines · PDT Tim Harvey

External Email

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

On Tue, Oct 29, 2019 at 2:08 PM Suneel Garapati <[email protected]>

Quoted 22 lines · wrote:
Quoted 9 lines

This series will add support for OcteonTX and OcteonTX2 processsor based platforms. The Marvell/Cavium Octeon-TX 64-bit ARM based SoCs include the CN80XX, CN81XX and CN83XX while Octeon-TX2 64-bit ARM based SoCs include support for CN96XX and CN95XX.
These SoC's have peripheral drivers based on PCI ECAM.

Patches
[1 -10] Add requied changes to PCI framework

Quoted 8 lines

- [6] Add support for multi-memory region range
- [7] EA in bridges
- [8] SR-IOV

[12] Add driver model support for RTC DS1337 driver [15 - 17] AHCI changes
[18 - 27] Add OcteonTX drivers
[28 - 29] Add OcteonTX/TX2 board files and configurations

Suneel,

Thanks for submitting this series!

Quoted 7 lines

I've applied and built this and am testing on the Gateworks Newport boards with the CN802x/CN803x (octeontx_81xx) and this is what I've found:
- I get hung in the smc_call from smc_dram_size which your calling with the function id of 0xc2000301. The older U-Boot from the Cavium OcteonTX SDK-6.2.0-p3 used 0x43000301 and this works for me. Is there a difference in our ATF version?

Quoted 3 lines

ATF has indeed changed significantly. The current U-Boot requires an up-to- date ATF. I recall this was one of the changes we made with regards to getting the size of memory.

What ATF should I be using? Is Marvell merging patches to the ATF required for OcteonTX?

Quoted 10 lines
Quoted 9 lines

- configs/octeontx_81xx_defconfig - I have several changes I want to make here, but perhaps some of these would warrant a custom config for my boards
- you assume there is only a SPI NOR flash for env which we
personally don't use. The env system supports multiple env types so we could just enable MMC as well as SPI but then I find all the hard-coded CONFIG_ENV_* defines restrictive. I wonder if anyone has defined a way for these to come from device-tree?

Quoted 2 lines

We have not tested loading the environment from eMMC. It would be nice if the environment location could come from the device tree.

I tested it and it works fine.

The mmc-env partition, offset, and offset-redundant can be set via dts (doc/device-tree-bindings/config.txt and env/mmc.c) and I am setting these in my dts. I'll look into expanding this if necessary so that the defconfigs could just enable both SPI and MMC env and the dt will be able to dictate the details.

Does the 'Octeon' support your working on overlap with 'OcteonTX'?

Regards,

Tim

#54 lore raw

Tim,

You have to get the remaining parts of firmware from Marvell support site, there are no plans of upstream any other software.

Aaron will add MIPS support to the code that is in the mainline, this will take some time.

Chandra
________________________________
From: Tim Harvey <[email protected]>
Sent: Thursday, October 31, 2019 12:12 PM
To: Aaron Williams <[email protected]>
Cc: Suneel Garapati <[email protected]>; u-boot <[email protected]>; Matthias Brugger <[email protected]>; Zi Shen Lim <[email protected]>; Maen Suleiman <[email protected]>; Prasun Kapoor <[email protected]>; Chandrakala Chavva <[email protected]>; Chris Packham <[email protected]>; Tom Rini <[email protected]>; Bin Meng <[email protected]>; Stefan Roese <[email protected]>; Simon Glass <[email protected]>; Joe Hershberger <[email protected]>; Peng Fan <[email protected]>; Jagan Teki <[email protected]>
Subject: Re: [EXT] Re: [U-Boot] [RFC PATCH 00/29] arm: Introduce Marvell/Cavium OcteonTX

Quoted 42 lines · Aaron Williams

Hi Tim,

I think I can answer some of your questions.

Quoted 5 lines · PDT Tim Harvey

External Email

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

On Tue, Oct 29, 2019 at 2:08 PM Suneel Garapati <[email protected]>

Quoted 22 lines · wrote:
Quoted 9 lines

This series will add support for OcteonTX and OcteonTX2 processsor based platforms. The Marvell/Cavium Octeon-TX 64-bit ARM based SoCs include the CN80XX, CN81XX and CN83XX while Octeon-TX2 64-bit ARM based SoCs include support for CN96XX and CN95XX.
These SoC's have peripheral drivers based on PCI ECAM.

Patches
[1 -10] Add requied changes to PCI framework

Quoted 8 lines

- [6] Add support for multi-memory region range
- [7] EA in bridges
- [8] SR-IOV

[12] Add driver model support for RTC DS1337 driver [15 - 17] AHCI changes
[18 - 27] Add OcteonTX drivers
[28 - 29] Add OcteonTX/TX2 board files and configurations

Suneel,

Thanks for submitting this series!

Quoted 7 lines

I've applied and built this and am testing on the Gateworks Newport boards with the CN802x/CN803x (octeontx_81xx) and this is what I've found:
- I get hung in the smc_call from smc_dram_size which your calling with the function id of 0xc2000301. The older U-Boot from the Cavium OcteonTX SDK-6.2.0-p3 used 0x43000301 and this works for me. Is there a difference in our ATF version?

Quoted 3 lines

ATF has indeed changed significantly. The current U-Boot requires an up-to- date ATF. I recall this was one of the changes we made with regards to getting the size of memory.

What ATF should I be using? Is Marvell merging patches to the ATF required for OcteonTX?

Quoted 10 lines
Quoted 9 lines

- configs/octeontx_81xx_defconfig - I have several changes I want to make here, but perhaps some of these would warrant a custom config for my boards
- you assume there is only a SPI NOR flash for env which we
personally don't use. The env system supports multiple env types so we could just enable MMC as well as SPI but then I find all the hard-coded CONFIG_ENV_* defines restrictive. I wonder if anyone has defined a way for these to come from device-tree?

Quoted 2 lines

We have not tested loading the environment from eMMC. It would be nice if the environment location could come from the device tree.

I tested it and it works fine.

The mmc-env partition, offset, and offset-redundant can be set via dts (doc/device-tree-bindings/config.txt and env/mmc.c) and I am setting these in my dts. I'll look into expanding this if necessary so that the defconfigs could just enable both SPI and MMC env and the dt will be able to dictate the details.

Does the 'Octeon' support your working on overlap with 'OcteonTX'?

Regards,

Tim

#55 lore raw
In reply to Tim Harvey

Hi Tim,

Quoted 1 line · PST Tim Harvey

On Wed, Oct 30, 2019 at 5:04 PM Aaron Williams <[email protected]>

Quoted 67 lines · wrote:
Quoted 43 lines

Hi Tim,

I think I can answer some of your questions.

Quoted 5 lines · PDT Tim Harvey

External Email

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

On Tue, Oct 29, 2019 at 2:08 PM Suneel Garapati <[email protected]>

Quoted 23 lines · wrote:
Quoted 10 lines

This series will add support for OcteonTX and OcteonTX2 processsor based
platforms. The Marvell/Cavium Octeon-TX 64-bit ARM based SoCs include the CN80XX, CN81XX and CN83XX while Octeon-TX2 64-bit ARM based SoCs include support for CN96XX and CN95XX.
These SoC's have peripheral drivers based on PCI ECAM.

Patches
[1 -10] Add requied changes to PCI framework

Quoted 8 lines

- [6] Add support for multi-memory region range
- [7] EA in bridges
- [8] SR-IOV

[12] Add driver model support for RTC DS1337 driver [15 - 17] AHCI changes
[18 - 27] Add OcteonTX drivers
[28 - 29] Add OcteonTX/TX2 board files and configurations

Suneel,

Thanks for submitting this series!

Quoted 7 lines

I've applied and built this and am testing on the Gateworks Newport boards with the CN802x/CN803x (octeontx_81xx) and this is what I've found:
- I get hung in the smc_call from smc_dram_size which your calling with the function id of 0xc2000301. The older U-Boot from the Cavium OcteonTX SDK-6.2.0-p3 used 0x43000301 and this works for me. Is there a difference in our ATF version?

Quoted 4 lines

ATF has indeed changed significantly. The current U-Boot requires an up-to-
date ATF. I recall this was one of the changes we made with regards to getting the size of memory.

What ATF should I be using? Is Marvell merging patches to the ATF required for OcteonTX?

Quoted 6 lines
Quoted 6 lines

- configs/octeontx_81xx_defconfig - I have several changes I want to make here, but perhaps some of these would warrant a custom config for my boards

- you assume there is only a SPI NOR flash for env which we

Quoted 7 lines
Quoted 4 lines

personally don't use. The env system supports multiple env types so we could just enable MMC as well as SPI but then I find all the hard-coded CONFIG_ENV_* defines restrictive. I wonder if anyone has defined a way for these to come from device-tree?

We have not tested loading the environment from eMMC. It would be nice if the environment location could come from the device tree.

I tested it and it works fine.

Quoted 7 lines

The mmc-env partition, offset, and offset-redundant can be set via dts (doc/device-tree-bindings/config.txt and env/mmc.c) and I am setting these in my dts. I'll look into expanding this if necessary so that the defconfigs could just enable both SPI and MMC env and the dt will be able to dictate the details.

Does the 'Octeon' support your working on overlap with 'OcteonTX'?

Some of the Octeon support will leverage OcteonTX since some of the drivers are mostly compatible, such as eMMC, SPI and I2C. There is also a lot in Octeon that in the case of OcteonTX is handled by ATF and our BDK bootloader. In these cases there is no overlap.

Quoted 4 lines

Regards,

Tim

Regards,

Aaron

#56 lore raw
Quoted 79 lines · Aaron Williams

Hi Tim,

Quoted 1 line · PST Tim Harvey

On Wed, Oct 30, 2019 at 5:04 PM Aaron Williams <[email protected]>

Quoted 73 lines · wrote:
Quoted 43 lines

Hi Tim,

I think I can answer some of your questions.

Quoted 5 lines · PDT Tim Harvey

External Email

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

On Tue, Oct 29, 2019 at 2:08 PM Suneel Garapati <[email protected]>

Quoted 23 lines · wrote:
Quoted 10 lines

This series will add support for OcteonTX and OcteonTX2 processsor based
platforms. The Marvell/Cavium Octeon-TX 64-bit ARM based SoCs include the CN80XX, CN81XX and CN83XX while Octeon-TX2 64-bit ARM based SoCs include support for CN96XX and CN95XX.
These SoC's have peripheral drivers based on PCI ECAM.

Patches
[1 -10] Add requied changes to PCI framework

Quoted 8 lines

- [6] Add support for multi-memory region range
- [7] EA in bridges
- [8] SR-IOV

[12] Add driver model support for RTC DS1337 driver [15 - 17] AHCI changes
[18 - 27] Add OcteonTX drivers
[28 - 29] Add OcteonTX/TX2 board files and configurations

Suneel,

Thanks for submitting this series!

Quoted 7 lines

I've applied and built this and am testing on the Gateworks Newport boards with the CN802x/CN803x (octeontx_81xx) and this is what I've found:
- I get hung in the smc_call from smc_dram_size which your calling with the function id of 0xc2000301. The older U-Boot from the Cavium OcteonTX SDK-6.2.0-p3 used 0x43000301 and this works for me. Is there a difference in our ATF version?

Quoted 4 lines

ATF has indeed changed significantly. The current U-Boot requires an up-to-
date ATF. I recall this was one of the changes we made with regards to getting the size of memory.

What ATF should I be using? Is Marvell merging patches to the ATF required for OcteonTX?

Quoted 6 lines
Quoted 6 lines

- configs/octeontx_81xx_defconfig - I have several changes I want to make here, but perhaps some of these would warrant a custom config for my boards

- you assume there is only a SPI NOR flash for env which we

Quoted 7 lines
Quoted 4 lines

personally don't use. The env system supports multiple env types so we could just enable MMC as well as SPI but then I find all the hard-coded CONFIG_ENV_* defines restrictive. I wonder if anyone has defined a way for these to come from device-tree?

We have not tested loading the environment from eMMC. It would be nice if the environment location could come from the device tree.

I tested it and it works fine.

The mmc-env partition, offset, and offset-redundant can be set via dts (doc/device-tree-bindings/config.txt and env/mmc.c) and I am setting these in my dts. I'll look into expanding this if necessary so that the defconfigs could just enable both SPI and MMC env and the dt will be able to dictate the details.

Quoted 7 lines
Quoted 1 line

Does the 'Octeon' support your working on overlap with 'OcteonTX'?

Some of the Octeon support will leverage OcteonTX since some of the drivers are mostly compatible, such as eMMC, SPI and I2C. There is also a lot in Octeon that in the case of OcteonTX is handled by ATF and our BDK bootloader. In these cases there is no overlap.

Aaron,

Thanks for the clarification. It sounds like you are working on SPL for Octeon which I was hoping could perhaps also support OcteonTX at some point. I had high hopes of adding SPL support for OcteonTX for our boards but ended up not having the time to work through it and in the end just used the BDK. This makes for an extremely long boot time (about 10 seconds just to get to U-Boot unfortunately).

Regards,

Tim

#57 lore raw

cover arm: Introduce Marvell/Cavium OcteonTX

In reply to Tim Harvey

Hi Tim,

Thanks for testing the series.

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

This series will add support for OcteonTX and OcteonTX2 processsor based platforms. The Marvell/Cavium Octeon-TX 64-bit ARM based SoCs include the CN80XX, CN81XX and CN83XX while Octeon-TX2 64-bit ARM based SoCs include support for CN96XX and CN95XX.
These SoC's have peripheral drivers based on PCI ECAM.

Quoted 10 lines

Patches
[1 -10] Add requied changes to PCI framework
- [6] Add support for multi-memory region range
- [7] EA in bridges
- [8] SR-IOV
[12] Add driver model support for RTC DS1337 driver [15 - 17] AHCI changes
[18 - 27] Add OcteonTX drivers
[28 - 29] Add OcteonTX/TX2 board files and configurations

Suneel,

Thanks for submitting this series!

Quoted 7 lines

I've applied and built this and am testing on the Gateworks Newport boards with the CN802x/CN803x (octeontx_81xx) and this is what I've found:
- I get hung in the smc_call from smc_dram_size which your calling with the function id of 0xc2000301. The older U-Boot from the Cavium OcteonTX SDK-6.2.0-p3 used 0x43000301 and this works for me. Is there a difference in our ATF version?

Yes, difference of ID values in latest ATF.

Quoted 8 lines

- configs/octeontx_81xx_defconfig - I have several changes I want to make here, but perhaps some of these would warrant a custom config for my boards
- you assume there is only a SPI NOR flash for env which we
personally don't use. The env system supports multiple env types so we could just enable MMC as well as SPI but then I find all the hard-coded CONFIG_ENV_* defines restrictive. I wonder if anyone has defined a way for these to come from device-tree?

All of these can go into custom defconfig of gateway_xx_config. octeontx_81xx config targets base board.

Quoted 4 lines

- you set loadaddr=040080000 which only makes sense for systems with
over 1GiB of DRAM... perhaps we should lower that to loadaddr=020080000 for 1GiB systems (I don't think you can have less than 1GiB?)

Will update this variable.

Quoted 3 lines

- I use DISTRO_DEFAULTS for a standard distro-friendly boot env...
I'm not sure why any board wouldn't do this these days and I think that should be added

Again this can go in custom config while I check internally if this can be added
in default ocetontx_81xx.

Quoted 28 lines

I was able to functionally test mmc/i2c/gpio/pci/nic(BGX/RGX) and they were all functioning well.

When I enable SATA I find that it crashes on init:
GW6300-D1> sata info
Target spinup took 0 ms.
AHCI 0001.0300 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
flags: 64bit ncq ilck stag pm led clo only pmp fbss pio slum part ccc apst "Synchronous Abort" handler, esr 0x96000006
elr: 000000000052c240 lr : 00000000005101bc (reloc)
elr: 000000003fecb240 lr : 000000003feaf1bc
x0 : 000000003be91380 x1 : 0000000000000000
x2 : 0000000000000000 x3 : 000000003be9c100
x4 : 0000000000000120 x5 : 000000003be9b800
x6 : 0000000000000001 x7 : 0000000000000000
x8 : 000000003ff46998 x9 : 0000000000000008
x10: 000000003ff2e8c4 x11: 000000003ff2e8ca
x12: 000000003ff2e8cf x13: 000000003ff2e8d5
x14: 000000003ff2e8da x15: 000000003ff2e8e0
x16: 000000003ff2e8e6 x17: 000000003ff43362
x18: 000000003be8ede0 x19: 0000000000000000
x20: 000000003be9ab30 x21: 0000000000000002
x22: 000000003be9ab30 x23: 0000000000000002
x24: 000000003ff63aa4 x25: 000000003be9ab90
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000000000000 x29: 000000003be881f0

Quoted 2 lines
Code: 928004a0 d65f03c0 f9400007 f94034e7 (f94008e7)

Resetting CPU ...

sata command is not enabled in octeontx_81xx, do you have custom changes? I re-checked scsi command on 81xx and did not see this issue.

Regards,
Suneel

Quoted 6 lines

I don't have NAND or SPI flash so can't test those.

Best Regards,

Tim

#58 lore raw

cover arm: Introduce Marvell/Cavium OcteonTX

Quoted 38 lines · Suneel Garapati

Hi Tim,

Thanks for testing the series.

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

This series will add support for OcteonTX and OcteonTX2 processsor based platforms. The Marvell/Cavium Octeon-TX 64-bit ARM based SoCs include the CN80XX, CN81XX and CN83XX while Octeon-TX2 64-bit ARM based SoCs include support for CN96XX and CN95XX.
These SoC's have peripheral drivers based on PCI ECAM.

Quoted 10 lines

Patches
[1 -10] Add requied changes to PCI framework
- [6] Add support for multi-memory region range
- [7] EA in bridges
- [8] SR-IOV
[12] Add driver model support for RTC DS1337 driver [15 - 17] AHCI changes
[18 - 27] Add OcteonTX drivers
[28 - 29] Add OcteonTX/TX2 board files and configurations

Suneel,

Thanks for submitting this series!

Quoted 7 lines

I've applied and built this and am testing on the Gateworks Newport boards with the CN802x/CN803x (octeontx_81xx) and this is what I've found:
- I get hung in the smc_call from smc_dram_size which your calling with the function id of 0xc2000301. The older U-Boot from the Cavium OcteonTX SDK-6.2.0-p3 used 0x43000301 and this works for me. Is there a difference in our ATF version?

Quoted 1 line

Yes, difference of ID values in latest ATF.

I'm told SDK-6-2.0-p3 is out of date so I'll work on finding the update and test again.

Quoted 10 lines
Quoted 9 lines

- configs/octeontx_81xx_defconfig - I have several changes I want to make here, but perhaps some of these would warrant a custom config for my boards
- you assume there is only a SPI NOR flash for env which we
personally don't use. The env system supports multiple env types so we could just enable MMC as well as SPI but then I find all the hard-coded CONFIG_ENV_* defines restrictive. I wonder if anyone has defined a way for these to come from device-tree?

Quoted 2 lines

All of these can go into custom defconfig of gateway_xx_config. octeontx_81xx config targets base board.

Correct these things could be put in a board-specific defconfig, but because 'octeontx_81xx' isn't a 'board' itself (it is a SoC platform) and it supports dt, a good goal would be to have it enable everything supported by the SoC and allow the details to come from dt.

I'll help make that happen once we get basic support accepted. Really the only things I need to tweak for this defconfig to work on our boards is the location and details of the env and the configuration of the RGMII tx delay both of which I can submit patches for after your base support is accepted.

Quoted 7 lines
Quoted 5 lines

- you set loadaddr=040080000 which only makes sense for systems with
over 1GiB of DRAM... perhaps we should lower that to loadaddr=020080000 for 1GiB systems (I don't think you can have less than 1GiB?)

Will update this variable.

Quoted 8 lines
Quoted 3 lines

- I use DISTRO_DEFAULTS for a standard distro-friendly boot env...
I'm not sure why any board wouldn't do this these days and I think that should be added

Again this can go in custom config while I check internally if this can be added
in default ocetontx_81xx.

again, I don't see any reason to require a whole bunch of configs/octeontx_81xx_defconfig variants for a platform that relies on dt.

Yes, it can easily be added to your patch with the following which allows easily booting distros like SUSE for example without mucking with your boot env:

configs/octeontx_81xx_defconfig +2 -0
index 39c9fbc..076ca03 100644
@@ -9,8 +9,10 @@ CONFIG_DEBUG_UART_BASE=0x87e028000000
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_DEBUG_UART=y
 CONFIG_AHCI=y
+CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
+CONFIG_LEGACY_IMAGE_FORMAT=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
(quoted diff) +0 -0

b/include/configs/octeontx_common.h
index 46134bb..b930e41 100644

include/configs/octeontx_common.h +16 -4
@@ -8,11 +8,19 @@
 #ifndef __OCTEONTX_COMMON_H__
 #define __OCTEONTX_COMMON_H__
 
+#ifndef CONFIG_SPL_BUILD
+#define BOOT_TARGET_DEVICES(func) \
+        func(MMC, mmc, 0) \
+        func(MMC, mmc, 1) \
+        func(USB, usb, 0) \
+        func(SATA, sata, 0)
+
+#include <config_distro_bootcmd.h>
+#endif
+
 /* Generic Timer Definitions */
 #define COUNTER_FREQUENCY              (0x1800000)     /* 24MHz */
 
-#define CONFIG_SUPPORT_RAW_INITRD
-
 /** Maximum size of image supported for bootm (and bootable FIT images) */
 #define CONFIG_SYS_BOOTM_LEN           (256 << 20)
 
@@ -60,8 +68,12 @@
 
 /** Extra environment settings */
 #define CONFIG_EXTRA_ENV_SETTINGS      \
-                                       "loadaddr=040080000\0"  \
-                                       "autoload=0\0"
+                                       "loadaddr=020080000\0"  \
+                                       "kernel_addr_r=0x02000000\0" \
+                                       "ramdisk_addr_r=0x03000000\0" \
+                                       "scriptaddr=0x04000000\0" \
+                                       "autoload=0\0" \
+                                       BOOTENV
 
 /** Environment defines */
 #define CONFIG_ENV_SIZE                        0x8000

Generic distro config was created to provide a specified set of bootloader env parameters and a well defined method for searching for bootscripts so that custom env's didn't need to be created for each board.

See doc/README.distro for details

Quoted 29 lines
Quoted 29 lines

I was able to functionally test mmc/i2c/gpio/pci/nic(BGX/RGX) and they were all functioning well.

When I enable SATA I find that it crashes on init:
GW6300-D1> sata info
Target spinup took 0 ms.
AHCI 0001.0300 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
flags: 64bit ncq ilck stag pm led clo only pmp fbss pio slum part ccc apst "Synchronous Abort" handler, esr 0x96000006
elr: 000000000052c240 lr : 00000000005101bc (reloc)
elr: 000000003fecb240 lr : 000000003feaf1bc
x0 : 000000003be91380 x1 : 0000000000000000
x2 : 0000000000000000 x3 : 000000003be9c100
x4 : 0000000000000120 x5 : 000000003be9b800
x6 : 0000000000000001 x7 : 0000000000000000
x8 : 000000003ff46998 x9 : 0000000000000008
x10: 000000003ff2e8c4 x11: 000000003ff2e8ca
x12: 000000003ff2e8cf x13: 000000003ff2e8d5
x14: 000000003ff2e8da x15: 000000003ff2e8e0
x16: 000000003ff2e8e6 x17: 000000003ff43362
x18: 000000003be8ede0 x19: 0000000000000000
x20: 000000003be9ab30 x21: 0000000000000002
x22: 000000003be9ab30 x23: 0000000000000002
x24: 000000003ff63aa4 x25: 000000003be9ab90
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000000000000 x29: 000000003be881f0

Quoted 5 lines
Quoted 2 lines
Code: 928004a0 d65f03c0 f9400007 f94034e7 (f94008e7)

Resetting CPU ...

sata command is not enabled in octeontx_81xx, do you have custom changes? I re-checked scsi command on 81xx and did not see this issue.

Right, but AHCI is enabled and supported by the SoC and you include the driver for it in your patch series, thus you should enable using it (and thus be able to test it):

configs/octeontx_81xx_defconfig +1 -0
index 39c9fbc..b2c2212 100644
@@ -34,6 +34,7 @@ CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_PART=y
 CONFIG_CMD_PCI=y
+CONFIG_CMD_SATA=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SF_TEST=y
 CONFIG_CMD_USB=y

Please enable it and see if you find the reason for the crash.

Regards,

Tim

#59 lore raw

cover arm: Introduce Marvell/Cavium OcteonTX

Hi Tim,

Quoted 189 lines · Tim Harvey
Quoted 38 lines · Suneel Garapati

Hi Tim,

Thanks for testing the series.

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

This series will add support for OcteonTX and OcteonTX2 processsor based platforms. The Marvell/Cavium Octeon-TX 64-bit ARM based SoCs include the CN80XX, CN81XX and CN83XX while Octeon-TX2 64-bit ARM based SoCs include support for CN96XX and CN95XX.
These SoC's have peripheral drivers based on PCI ECAM.

Quoted 10 lines

Patches
[1 -10] Add requied changes to PCI framework
- [6] Add support for multi-memory region range
- [7] EA in bridges
- [8] SR-IOV
[12] Add driver model support for RTC DS1337 driver [15 - 17] AHCI changes
[18 - 27] Add OcteonTX drivers
[28 - 29] Add OcteonTX/TX2 board files and configurations

Suneel,

Thanks for submitting this series!

Quoted 7 lines

I've applied and built this and am testing on the Gateworks Newport boards with the CN802x/CN803x (octeontx_81xx) and this is what I've found:
- I get hung in the smc_call from smc_dram_size which your calling with the function id of 0xc2000301. The older U-Boot from the Cavium OcteonTX SDK-6.2.0-p3 used 0x43000301 and this works for me. Is there a difference in our ATF version?

Quoted 1 line

Yes, difference of ID values in latest ATF.

I'm told SDK-6-2.0-p3 is out of date so I'll work on finding the update and test again.

Quoted 10 lines
Quoted 9 lines

- configs/octeontx_81xx_defconfig - I have several changes I want to make here, but perhaps some of these would warrant a custom config for my boards
- you assume there is only a SPI NOR flash for env which we
personally don't use. The env system supports multiple env types so we could just enable MMC as well as SPI but then I find all the hard-coded CONFIG_ENV_* defines restrictive. I wonder if anyone has defined a way for these to come from device-tree?

Quoted 2 lines

All of these can go into custom defconfig of gateway_xx_config. octeontx_81xx config targets base board.

Correct these things could be put in a board-specific defconfig, but because 'octeontx_81xx' isn't a 'board' itself (it is a SoC platform) and it supports dt, a good goal would be to have it enable everything supported by the SoC and allow the details to come from dt.

I'll help make that happen once we get basic support accepted. Really the only things I need to tweak for this defconfig to work on our boards is the location and details of the env and the configuration of the RGMII tx delay both of which I can submit patches for after your base support is accepted.

Quoted 7 lines
Quoted 5 lines

- you set loadaddr=040080000 which only makes sense for systems with
over 1GiB of DRAM... perhaps we should lower that to loadaddr=020080000 for 1GiB systems (I don't think you can have less than 1GiB?)

Will update this variable.

Quoted 8 lines
Quoted 3 lines

- I use DISTRO_DEFAULTS for a standard distro-friendly boot env...
I'm not sure why any board wouldn't do this these days and I think that should be added

Again this can go in custom config while I check internally if this can be added
in default ocetontx_81xx.

again, I don't see any reason to require a whole bunch of configs/octeontx_81xx_defconfig variants for a platform that relies on dt.

Yes, it can easily be added to your patch with the following which allows easily booting distros like SUSE for example without mucking with your boot env:

configs/octeontx_81xx_defconfig +2 -0
index 39c9fbc..076ca03 100644
@@ -9,8 +9,10 @@ CONFIG_DEBUG_UART_BASE=0x87e028000000
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_DEBUG_UART=y
 CONFIG_AHCI=y
+CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
+CONFIG_LEGACY_IMAGE_FORMAT=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
include/configs/octeontx_common.h +16 -4
index 46134bb..b930e41 100644
@@ -8,11 +8,19 @@
 #ifndef __OCTEONTX_COMMON_H__
 #define __OCTEONTX_COMMON_H__
 
+#ifndef CONFIG_SPL_BUILD
+#define BOOT_TARGET_DEVICES(func) \
+        func(MMC, mmc, 0) \
+        func(MMC, mmc, 1) \
+        func(USB, usb, 0) \
+        func(SATA, sata, 0)
+
+#include <config_distro_bootcmd.h>
+#endif
+
 /* Generic Timer Definitions */
 #define COUNTER_FREQUENCY              (0x1800000)     /* 24MHz */
 
-#define CONFIG_SUPPORT_RAW_INITRD
-
 /** Maximum size of image supported for bootm (and bootable FIT images) */
 #define CONFIG_SYS_BOOTM_LEN           (256 << 20)
 
@@ -60,8 +68,12 @@
 
 /** Extra environment settings */
 #define CONFIG_EXTRA_ENV_SETTINGS      \
-                                       "loadaddr=040080000\0"  \
-                                       "autoload=0\0"
+                                       "loadaddr=020080000\0"  \
+                                       "kernel_addr_r=0x02000000\0" \
+                                       "ramdisk_addr_r=0x03000000\0" \
+                                       "scriptaddr=0x04000000\0" \
+                                       "autoload=0\0" \
+                                       BOOTENV
 
 /** Environment defines */
 #define CONFIG_ENV_SIZE                        0x8000

Generic distro config was created to provide a specified set of bootloader env parameters and a well defined method for searching for bootscripts so that custom env's didn't need to be created for each board.

See doc/README.distro for details

Quoted 31 lines
Quoted 31 lines

I was able to functionally test mmc/i2c/gpio/pci/nic(BGX/RGX) and they were all functioning well.

When I enable SATA I find that it crashes on init:
GW6300-D1> sata info
Target spinup took 0 ms.
AHCI 0001.0300 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
flags: 64bit ncq ilck stag pm led clo only pmp fbss pio slum part ccc apst "Synchronous Abort" handler, esr 0x96000006
elr: 000000000052c240 lr : 00000000005101bc (reloc)
elr: 000000003fecb240 lr : 000000003feaf1bc
x0 : 000000003be91380 x1 : 0000000000000000
x2 : 0000000000000000 x3 : 000000003be9c100
x4 : 0000000000000120 x5 : 000000003be9b800
x6 : 0000000000000001 x7 : 0000000000000000
x8 : 000000003ff46998 x9 : 0000000000000008
x10: 000000003ff2e8c4 x11: 000000003ff2e8ca
x12: 000000003ff2e8cf x13: 000000003ff2e8d5
x14: 000000003ff2e8da x15: 000000003ff2e8e0
x16: 000000003ff2e8e6 x17: 000000003ff43362
x18: 000000003be8ede0 x19: 0000000000000000
x20: 000000003be9ab30 x21: 0000000000000002
x22: 000000003be9ab30 x23: 0000000000000002
x24: 000000003ff63aa4 x25: 000000003be9ab90
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000000000000 x29: 000000003be881f0

Code: 928004a0 d65f03c0 f9400007 f94034e7 (f94008e7)

Resetting CPU ...

Quoted 7 lines
Quoted 3 lines

sata command is not enabled in octeontx_81xx, do you have custom changes? I re-checked scsi command on 81xx and did not see this issue.

Right, but AHCI is enabled and supported by the SoC and you include the driver for it in your patch series, thus you should enable using it (and thus be able to test it):

If you check 'dm tree' dump, ahci_pci/scsi are in use and not native ahci [relate to sata].
Hence scsi commands only will work. And this is correct as 81xx has AHCI on PCI.

Regards,
Suneel

Quoted 19 lines
configs/octeontx_81xx_defconfig +1 -0
index 39c9fbc..b2c2212 100644
@@ -34,6 +34,7 @@ CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_PART=y
 CONFIG_CMD_PCI=y
+CONFIG_CMD_SATA=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SF_TEST=y
 CONFIG_CMD_USB=y

Please enable it and see if you find the reason for the crash.

Regards,

Tim

#60 lore raw

cover arm: Introduce Marvell/Cavium OcteonTX

Quoted 1 line · Suneel Garapati

<snip>

Quoted 35 lines
Quoted 35 lines
Quoted 34 lines
Quoted 29 lines

I was able to functionally test mmc/i2c/gpio/pci/nic(BGX/RGX) and they were all functioning well.

When I enable SATA I find that it crashes on init:
GW6300-D1> sata info
Target spinup took 0 ms.
AHCI 0001.0300 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
flags: 64bit ncq ilck stag pm led clo only pmp fbss pio slum part ccc apst "Synchronous Abort" handler, esr 0x96000006
elr: 000000000052c240 lr : 00000000005101bc (reloc)
elr: 000000003fecb240 lr : 000000003feaf1bc
x0 : 000000003be91380 x1 : 0000000000000000
x2 : 0000000000000000 x3 : 000000003be9c100
x4 : 0000000000000120 x5 : 000000003be9b800
x6 : 0000000000000001 x7 : 0000000000000000
x8 : 000000003ff46998 x9 : 0000000000000008
x10: 000000003ff2e8c4 x11: 000000003ff2e8ca
x12: 000000003ff2e8cf x13: 000000003ff2e8d5
x14: 000000003ff2e8da x15: 000000003ff2e8e0
x16: 000000003ff2e8e6 x17: 000000003ff43362
x18: 000000003be8ede0 x19: 0000000000000000
x20: 000000003be9ab30 x21: 0000000000000002
x22: 000000003be9ab30 x23: 0000000000000002
x24: 000000003ff63aa4 x25: 000000003be9ab90
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000000000000 x29: 000000003be881f0

Quoted 2 lines
Code: 928004a0 d65f03c0 f9400007 f94034e7 (f94008e7)

Resetting CPU ...

sata command is not enabled in octeontx_81xx, do you have custom changes? I re-checked scsi command on 81xx and did not see this issue.

Quoted 8 lines
Quoted 3 lines

Right, but AHCI is enabled and supported by the SoC and you include the driver for it in your patch series, thus you should enable using it (and thus be able to test it):

If you check 'dm tree' dump, ahci_pci/scsi are in use and not native ahci [relate to sata].
Hence scsi commands only will work. And this is correct as 81xx has AHCI on PCI.

Suneel,

Thanks for the explanation.

I tested and using the scsi command works great. I must admit I've been very confused as to why scsi here is used instead of sata. I understand SATA actually talks SCSI but why is dm enumerating it as scsi and not sata?

Regards,

Tim

#61 lore raw

cover arm: Introduce Marvell/Cavium OcteonTX

In reply to Suneel Garapati
Quoted 257 lines · Suneel Garapati

This series will add support for OcteonTX and OcteonTX2 processsor based platforms. The Marvell/Cavium Octeon-TX 64-bit ARM based SoCs include the CN80XX, CN81XX and CN83XX while Octeon-TX2 64-bit ARM based SoCs include support for CN96XX and CN95XX.
These SoC's have peripheral drivers based on PCI ECAM.

Patches
[1 -10] Add requied changes to PCI framework
- [6] Add support for multi-memory region range
- [7] EA in bridges
- [8] SR-IOV
[12] Add driver model support for RTC DS1337 driver [15 - 17] AHCI changes
[18 - 27] Add OcteonTX drivers
[28 - 29] Add OcteonTX/TX2 board files and configurations

Suneel Garapati (29):
include: pci_ids: add vendor ID for Cavium
include: pci: Increase max pci region limit
fdtdec: add API to read pci bus-range property
drivers: pci-uclass: fix incorrect argument in map_sysmem
drivers: pci-uclass: make DT subnode parse optional
drivers: pci-uclass: add multi entry support for pci regions
drivers: pci-uclass: add support for Enhanced Allocation in Bridges
drivers: pci-uclass: add support for Single-Root I/O Virtualizaiton
drivers: pci-uclass: add VF map_bar support for Enhanced Allocation
drivers: pci-uclass: Add support for Alternate-RoutingID capability
include: arm: asm: io: add 64bit clrbits and setbits helpers
drivers: rtc: ds1337: add driver model support
arch: include: octeontx: add headers for OcteonTX
arch: include: octeontx2: add headers for OcteonTX2
drivers: ata: ahci: update max id if it is more than available ports
drivers: ata: ahci: fill upper 32bit buffer address in sg descriptor
drivers: ata: ahci: add BAR index quirk for OcteonTX
drivers: pci: add PCI controller driver for OcteonTX
drivers: gpio: add GPIO controller driver for OcteonTX
drivers: i2c: add I2C controller driver for OcteonTX
drivers: spi: add SPI controller driver for OcteonTX
drivers: mmc: remove static qualifier on mmc_power_init
drivers: mmc: add MMC controller driver for OcteonTX
drivers: mtd: nand: add NAND controller driver for OcteonTX
drivers: net: add NIC controller driver for OcteonTX
drivers: net: add NIC controller driver for OcteonTX2
drivers: watchdog: add reset support for OcteonTX
octeontx: Add support for OcteonTX SoC platforms
octeontx2: Add support for OcteonTX2 SoC platforms

 arch/arm/Kconfig                              |    22 +
 arch/arm/Makefile                             |     2 +
 arch/arm/include/asm/arch-octeontx/board.h    |   121 +
 arch/arm/include/asm/arch-octeontx/clock.h    |    25 +
 .../asm/arch-octeontx/csrs/csrs-mio_emm.h     |  1193 ++
 .../include/asm/arch-octeontx/csrs/csrs-xcv.h |   428 +
 arch/arm/include/asm/arch-octeontx/gpio.h     |     6 +
 arch/arm/include/asm/arch-octeontx/smc.h      |    20 +
 arch/arm/include/asm/arch-octeontx/soc.h      |    31 +
 arch/arm/include/asm/arch-octeontx2/board.h   |   123 +
 arch/arm/include/asm/arch-octeontx2/clock.h   |    24 +
 .../asm/arch-octeontx2/csrs/csrs-cgx.h        |  7835 ++++++++++++
 .../asm/arch-octeontx2/csrs/csrs-lmt.h        |    60 +
 .../asm/arch-octeontx2/csrs/csrs-mio_emm.h    |  1193 ++
 .../asm/arch-octeontx2/csrs/csrs-nix.h        | 10482 ++++++++++++++++
 .../asm/arch-octeontx2/csrs/csrs-npa.h        |  2296 ++++
 .../asm/arch-octeontx2/csrs/csrs-npc.h        |  1930 +++
 .../asm/arch-octeontx2/csrs/csrs-rvu.h        |  2430 ++++
 arch/arm/include/asm/arch-octeontx2/gpio.h    |     6 +
 arch/arm/include/asm/arch-octeontx2/smc-id.h  |    32 +
 arch/arm/include/asm/arch-octeontx2/smc.h     |    18 +
 arch/arm/include/asm/arch-octeontx2/soc.h     |    31 +
 arch/arm/include/asm/io.h                     |     8 +
 arch/arm/mach-octeontx/Kconfig                |    23 +
 arch/arm/mach-octeontx/Makefile               |     9 +
 arch/arm/mach-octeontx/clock.c                |    35 +
 arch/arm/mach-octeontx/cpu.c                  |    76 +
 arch/arm/mach-octeontx/lowlevel_init.S        |    33 +
 arch/arm/mach-octeontx2/Kconfig               |    23 +
 arch/arm/mach-octeontx2/Makefile              |     9 +
 arch/arm/mach-octeontx2/clock.c               |    35 +
 arch/arm/mach-octeontx2/config.mk             |     4 +
 arch/arm/mach-octeontx2/cpu.c                 |    72 +
 arch/arm/mach-octeontx2/lowlevel_init.S       |    33 +
 board/Marvell/octeontx/Kconfig                |    14 +
 board/Marvell/octeontx/MAINTAINERS            |     9 +
 board/Marvell/octeontx/Makefile               |     9 +
 board/Marvell/octeontx/board-fdt.c            |   271 +
 board/Marvell/octeontx/board.c                |   137 +
 board/Marvell/octeontx/smc.c                  |    30 +
 board/Marvell/octeontx/soc-utils.c            |    53 +
 board/Marvell/octeontx2/Kconfig               |    15 +
 board/Marvell/octeontx2/MAINTAINERS           |     9 +
 board/Marvell/octeontx2/Makefile              |     9 +
 board/Marvell/octeontx2/board-fdt.c           |   155 +
 board/Marvell/octeontx2/board.c               |   232 +
 board/Marvell/octeontx2/smc.c                 |    62 +
 board/Marvell/octeontx2/soc-utils.c           |    49 +
 configs/octeontx2_95xx_defconfig              |   105 +
 configs/octeontx2_96xx_defconfig              |   131 +
 configs/octeontx_81xx_defconfig               |   133 +
 configs/octeontx_83xx_defconfig               |   130 +
 drivers/ata/ahci.c                            |    15 +
 drivers/gpio/Kconfig                          |     7 +
 drivers/gpio/Makefile                         |     1 +
 drivers/gpio/octeontx_gpio.c                  |   218 +
 drivers/i2c/Kconfig                           |     7 +
 drivers/i2c/Makefile                          |     1 +
 drivers/i2c/octeontx_i2c.c                    |   968 ++
 drivers/mmc/Kconfig                           |     9 +
 drivers/mmc/Makefile                          |     1 +
 drivers/mmc/mmc.c                             |     2 +-
 drivers/mmc/octeontx_hsmmc.c                  |  3233 +++++
 drivers/mmc/octeontx_hsmmc.h                  |   191 +
 drivers/mtd/nand/raw/Kconfig                  |    16 +
 drivers/mtd/nand/raw/Makefile                 |     2 +
 drivers/mtd/nand/raw/octeontx_bch.c           |   424 +
 drivers/mtd/nand/raw/octeontx_bch.h           |   142 +
 drivers/mtd/nand/raw/octeontx_bch_regs.h      |   169 +
 drivers/mtd/nand/raw/octeontx_nand.c          |  2261 ++++
 drivers/net/Kconfig                           |    29 +
 drivers/net/Makefile                          |     4 +
 drivers/net/octeontx/Makefile                 |     9 +
 drivers/net/octeontx/bgx.c                    |  1546 +++
 drivers/net/octeontx/bgx.h                    |   259 +
 drivers/net/octeontx/nic.h                    |   518 +
 drivers/net/octeontx/nic_main.c               |   777 ++
 drivers/net/octeontx/nic_reg.h                |   252 +
 drivers/net/octeontx/nicvf_main.c             |   575 +
 drivers/net/octeontx/nicvf_queues.c           |  1141 ++
 drivers/net/octeontx/nicvf_queues.h           |   355 +
 drivers/net/octeontx/q_struct.h               |   697 +
 drivers/net/octeontx/smi.c                    |   382 +
 drivers/net/octeontx/xcv.c                    |   129 +
 drivers/net/octeontx2/Makefile                |    11 +
 drivers/net/octeontx2/cgx.c                   |   297 +
 drivers/net/octeontx2/cgx.h                   |   105 +
 drivers/net/octeontx2/cgx_intf.c              |   421 +
 drivers/net/octeontx2/cgx_intf.h              |   370 +
 drivers/net/octeontx2/lmt.h                   |    51 +
 drivers/net/octeontx2/nix.c                   |   824 ++
 drivers/net/octeontx2/nix.h                   |   355 +
 drivers/net/octeontx2/nix_af.c                |  1103 ++
 drivers/net/octeontx2/npc.h                   |    92 +
 drivers/net/octeontx2/rvu.h                   |   127 +
 drivers/net/octeontx2/rvu_af.c                |   172 +
 drivers/net/octeontx2/rvu_common.c            |    74 +
 drivers/net/octeontx2/rvu_pf.c                |   118 +
 drivers/pci/Kconfig                           |    17 +
 drivers/pci/Makefile                          |     1 +
 drivers/pci/pci-uclass.c                      |   211 +-
 drivers/pci/pci_octeontx.c                    |   538 +
 drivers/rtc/Kconfig                           |     7 +
 drivers/rtc/ds1337.c                          |   170 +
 drivers/spi/Kconfig                           |     6 +
 drivers/spi/Makefile                          |     1 +
 drivers/spi/octeontx_spi.c                    |   750 ++
 drivers/watchdog/Kconfig                      |    10 +
 drivers/watchdog/Makefile                     |     1 +
 drivers/watchdog/octeontx_wdt.c               |    76 +
 include/configs/octeontx2_95xx.h              |    80 +
 include/configs/octeontx2_96xx.h              |    90 +
 include/configs/octeontx_common.h             |    98 +
 include/fdtdec.h                              |    12 +
 include/mmc.h                                 |     1 +
 include/pci.h                                 |    23 +-
 include/pci_ids.h                             |     2 +
 lib/fdtdec.c                                  |    16 +
 118 files changed, 50774 insertions(+), 17 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-octeontx/board.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/clock.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/csrs/csrs-mio_emm.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/csrs/csrs-xcv.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/gpio.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/smc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/soc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/board.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/clock.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-cgx.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-lmt.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-mio_emm.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-nix.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-npa.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-npc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-rvu.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/gpio.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/smc-id.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/smc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/soc.h
 create mode 100644 arch/arm/mach-octeontx/Kconfig
 create mode 100644 arch/arm/mach-octeontx/Makefile
 create mode 100644 arch/arm/mach-octeontx/clock.c
 create mode 100644 arch/arm/mach-octeontx/cpu.c
 create mode 100644 arch/arm/mach-octeontx/lowlevel_init.S
 create mode 100644 arch/arm/mach-octeontx2/Kconfig
 create mode 100644 arch/arm/mach-octeontx2/Makefile
 create mode 100644 arch/arm/mach-octeontx2/clock.c
 create mode 100644 arch/arm/mach-octeontx2/config.mk
 create mode 100644 arch/arm/mach-octeontx2/cpu.c
 create mode 100644 arch/arm/mach-octeontx2/lowlevel_init.S
 create mode 100644 board/Marvell/octeontx/Kconfig
 create mode 100644 board/Marvell/octeontx/MAINTAINERS
 create mode 100644 board/Marvell/octeontx/Makefile
 create mode 100644 board/Marvell/octeontx/board-fdt.c
 create mode 100644 board/Marvell/octeontx/board.c
 create mode 100644 board/Marvell/octeontx/smc.c
 create mode 100644 board/Marvell/octeontx/soc-utils.c
 create mode 100644 board/Marvell/octeontx2/Kconfig
 create mode 100644 board/Marvell/octeontx2/MAINTAINERS
 create mode 100644 board/Marvell/octeontx2/Makefile
 create mode 100644 board/Marvell/octeontx2/board-fdt.c
 create mode 100644 board/Marvell/octeontx2/board.c
 create mode 100644 board/Marvell/octeontx2/smc.c
 create mode 100644 board/Marvell/octeontx2/soc-utils.c
 create mode 100644 configs/octeontx2_95xx_defconfig
 create mode 100644 configs/octeontx2_96xx_defconfig
 create mode 100644 configs/octeontx_81xx_defconfig
 create mode 100644 configs/octeontx_83xx_defconfig
 create mode 100644 drivers/gpio/octeontx_gpio.c
 create mode 100644 drivers/i2c/octeontx_i2c.c
 create mode 100644 drivers/mmc/octeontx_hsmmc.c
 create mode 100644 drivers/mmc/octeontx_hsmmc.h
 create mode 100644 drivers/mtd/nand/raw/octeontx_bch.c
 create mode 100644 drivers/mtd/nand/raw/octeontx_bch.h
 create mode 100644 drivers/mtd/nand/raw/octeontx_bch_regs.h
 create mode 100644 drivers/mtd/nand/raw/octeontx_nand.c
 create mode 100644 drivers/net/octeontx/Makefile
 create mode 100644 drivers/net/octeontx/bgx.c
 create mode 100644 drivers/net/octeontx/bgx.h
 create mode 100644 drivers/net/octeontx/nic.h
 create mode 100644 drivers/net/octeontx/nic_main.c
 create mode 100644 drivers/net/octeontx/nic_reg.h
 create mode 100644 drivers/net/octeontx/nicvf_main.c
 create mode 100644 drivers/net/octeontx/nicvf_queues.c
 create mode 100644 drivers/net/octeontx/nicvf_queues.h
 create mode 100644 drivers/net/octeontx/q_struct.h
 create mode 100644 drivers/net/octeontx/smi.c
 create mode 100644 drivers/net/octeontx/xcv.c
 create mode 100644 drivers/net/octeontx2/Makefile
 create mode 100644 drivers/net/octeontx2/cgx.c
 create mode 100644 drivers/net/octeontx2/cgx.h
 create mode 100644 drivers/net/octeontx2/cgx_intf.c
 create mode 100644 drivers/net/octeontx2/cgx_intf.h
 create mode 100644 drivers/net/octeontx2/lmt.h
 create mode 100644 drivers/net/octeontx2/nix.c
 create mode 100644 drivers/net/octeontx2/nix.h
 create mode 100644 drivers/net/octeontx2/nix_af.c
 create mode 100644 drivers/net/octeontx2/npc.h
 create mode 100644 drivers/net/octeontx2/rvu.h
 create mode 100644 drivers/net/octeontx2/rvu_af.c
 create mode 100644 drivers/net/octeontx2/rvu_common.c
 create mode 100644 drivers/net/octeontx2/rvu_pf.c
 create mode 100644 drivers/pci/pci_octeontx.c
 create mode 100644 drivers/spi/octeontx_spi.c
 create mode 100644 drivers/watchdog/octeontx_wdt.c
 create mode 100644 include/configs/octeontx2_95xx.h
 create mode 100644 include/configs/octeontx2_96xx.h
 create mode 100644 include/configs/octeontx_common.h
Quoted 3 lines

--
2.23.0

Tom,

I haven't seen any reviews or comments of any of Suneel's patch series here other than the testing I performed.

What are the next steps in being able to get this code merged? The patches to pci-uclass are perhaps the only ones that would even affect other boards as pretty much everything else is adding a new driver.

Regards,

Tim

#62 lore raw

cover arm: Introduce Marvell/Cavium OcteonTX

Hi Tim,

Quoted 263 lines · Tim Harvey
Quoted 257 lines · Suneel Garapati

This series will add support for OcteonTX and OcteonTX2 processsor based platforms. The Marvell/Cavium Octeon-TX 64-bit ARM based SoCs include the CN80XX, CN81XX and CN83XX while Octeon-TX2 64-bit ARM based SoCs include support for CN96XX and CN95XX.
These SoC's have peripheral drivers based on PCI ECAM.

Patches
[1 -10] Add requied changes to PCI framework
- [6] Add support for multi-memory region range
- [7] EA in bridges
- [8] SR-IOV
[12] Add driver model support for RTC DS1337 driver [15 - 17] AHCI changes
[18 - 27] Add OcteonTX drivers
[28 - 29] Add OcteonTX/TX2 board files and configurations

Suneel Garapati (29):
include: pci_ids: add vendor ID for Cavium
include: pci: Increase max pci region limit
fdtdec: add API to read pci bus-range property
drivers: pci-uclass: fix incorrect argument in map_sysmem
drivers: pci-uclass: make DT subnode parse optional
drivers: pci-uclass: add multi entry support for pci regions
drivers: pci-uclass: add support for Enhanced Allocation in Bridges
drivers: pci-uclass: add support for Single-Root I/O Virtualizaiton
drivers: pci-uclass: add VF map_bar support for Enhanced Allocation
drivers: pci-uclass: Add support for Alternate-RoutingID capability
include: arm: asm: io: add 64bit clrbits and setbits helpers
drivers: rtc: ds1337: add driver model support
arch: include: octeontx: add headers for OcteonTX
arch: include: octeontx2: add headers for OcteonTX2
drivers: ata: ahci: update max id if it is more than available ports
drivers: ata: ahci: fill upper 32bit buffer address in sg descriptor
drivers: ata: ahci: add BAR index quirk for OcteonTX
drivers: pci: add PCI controller driver for OcteonTX
drivers: gpio: add GPIO controller driver for OcteonTX
drivers: i2c: add I2C controller driver for OcteonTX
drivers: spi: add SPI controller driver for OcteonTX
drivers: mmc: remove static qualifier on mmc_power_init
drivers: mmc: add MMC controller driver for OcteonTX
drivers: mtd: nand: add NAND controller driver for OcteonTX
drivers: net: add NIC controller driver for OcteonTX
drivers: net: add NIC controller driver for OcteonTX2
drivers: watchdog: add reset support for OcteonTX
octeontx: Add support for OcteonTX SoC platforms
octeontx2: Add support for OcteonTX2 SoC platforms

 arch/arm/Kconfig                              |    22 +
 arch/arm/Makefile                             |     2 +
 arch/arm/include/asm/arch-octeontx/board.h    |   121 +
 arch/arm/include/asm/arch-octeontx/clock.h    |    25 +
 .../asm/arch-octeontx/csrs/csrs-mio_emm.h     |  1193 ++
 .../include/asm/arch-octeontx/csrs/csrs-xcv.h |   428 +
 arch/arm/include/asm/arch-octeontx/gpio.h     |     6 +
 arch/arm/include/asm/arch-octeontx/smc.h      |    20 +
 arch/arm/include/asm/arch-octeontx/soc.h      |    31 +
 arch/arm/include/asm/arch-octeontx2/board.h   |   123 +
 arch/arm/include/asm/arch-octeontx2/clock.h   |    24 +
 .../asm/arch-octeontx2/csrs/csrs-cgx.h        |  7835 ++++++++++++
 .../asm/arch-octeontx2/csrs/csrs-lmt.h        |    60 +
 .../asm/arch-octeontx2/csrs/csrs-mio_emm.h    |  1193 ++
 .../asm/arch-octeontx2/csrs/csrs-nix.h        | 10482 ++++++++++++++++
 .../asm/arch-octeontx2/csrs/csrs-npa.h        |  2296 ++++
 .../asm/arch-octeontx2/csrs/csrs-npc.h        |  1930 +++
 .../asm/arch-octeontx2/csrs/csrs-rvu.h        |  2430 ++++
 arch/arm/include/asm/arch-octeontx2/gpio.h    |     6 +
 arch/arm/include/asm/arch-octeontx2/smc-id.h  |    32 +
 arch/arm/include/asm/arch-octeontx2/smc.h     |    18 +
 arch/arm/include/asm/arch-octeontx2/soc.h     |    31 +
 arch/arm/include/asm/io.h                     |     8 +
 arch/arm/mach-octeontx/Kconfig                |    23 +
 arch/arm/mach-octeontx/Makefile               |     9 +
 arch/arm/mach-octeontx/clock.c                |    35 +
 arch/arm/mach-octeontx/cpu.c                  |    76 +
 arch/arm/mach-octeontx/lowlevel_init.S        |    33 +
 arch/arm/mach-octeontx2/Kconfig               |    23 +
 arch/arm/mach-octeontx2/Makefile              |     9 +
 arch/arm/mach-octeontx2/clock.c               |    35 +
 arch/arm/mach-octeontx2/config.mk             |     4 +
 arch/arm/mach-octeontx2/cpu.c                 |    72 +
 arch/arm/mach-octeontx2/lowlevel_init.S       |    33 +
 board/Marvell/octeontx/Kconfig                |    14 +
 board/Marvell/octeontx/MAINTAINERS            |     9 +
 board/Marvell/octeontx/Makefile               |     9 +
 board/Marvell/octeontx/board-fdt.c            |   271 +
 board/Marvell/octeontx/board.c                |   137 +
 board/Marvell/octeontx/smc.c                  |    30 +
 board/Marvell/octeontx/soc-utils.c            |    53 +
 board/Marvell/octeontx2/Kconfig               |    15 +
 board/Marvell/octeontx2/MAINTAINERS           |     9 +
 board/Marvell/octeontx2/Makefile              |     9 +
 board/Marvell/octeontx2/board-fdt.c           |   155 +
 board/Marvell/octeontx2/board.c               |   232 +
 board/Marvell/octeontx2/smc.c                 |    62 +
 board/Marvell/octeontx2/soc-utils.c           |    49 +
 configs/octeontx2_95xx_defconfig              |   105 +
 configs/octeontx2_96xx_defconfig              |   131 +
 configs/octeontx_81xx_defconfig               |   133 +
 configs/octeontx_83xx_defconfig               |   130 +
 drivers/ata/ahci.c                            |    15 +
 drivers/gpio/Kconfig                          |     7 +
 drivers/gpio/Makefile                         |     1 +
 drivers/gpio/octeontx_gpio.c                  |   218 +
 drivers/i2c/Kconfig                           |     7 +
 drivers/i2c/Makefile                          |     1 +
 drivers/i2c/octeontx_i2c.c                    |   968 ++
 drivers/mmc/Kconfig                           |     9 +
 drivers/mmc/Makefile                          |     1 +
 drivers/mmc/mmc.c                             |     2 +-
 drivers/mmc/octeontx_hsmmc.c                  |  3233 +++++
 drivers/mmc/octeontx_hsmmc.h                  |   191 +
 drivers/mtd/nand/raw/Kconfig                  |    16 +
 drivers/mtd/nand/raw/Makefile                 |     2 +
 drivers/mtd/nand/raw/octeontx_bch.c           |   424 +
 drivers/mtd/nand/raw/octeontx_bch.h           |   142 +
 drivers/mtd/nand/raw/octeontx_bch_regs.h      |   169 +
 drivers/mtd/nand/raw/octeontx_nand.c          |  2261 ++++
 drivers/net/Kconfig                           |    29 +
 drivers/net/Makefile                          |     4 +
 drivers/net/octeontx/Makefile                 |     9 +
 drivers/net/octeontx/bgx.c                    |  1546 +++
 drivers/net/octeontx/bgx.h                    |   259 +
 drivers/net/octeontx/nic.h                    |   518 +
 drivers/net/octeontx/nic_main.c               |   777 ++
 drivers/net/octeontx/nic_reg.h                |   252 +
 drivers/net/octeontx/nicvf_main.c             |   575 +
 drivers/net/octeontx/nicvf_queues.c           |  1141 ++
 drivers/net/octeontx/nicvf_queues.h           |   355 +
 drivers/net/octeontx/q_struct.h               |   697 +
 drivers/net/octeontx/smi.c                    |   382 +
 drivers/net/octeontx/xcv.c                    |   129 +
 drivers/net/octeontx2/Makefile                |    11 +
 drivers/net/octeontx2/cgx.c                   |   297 +
 drivers/net/octeontx2/cgx.h                   |   105 +
 drivers/net/octeontx2/cgx_intf.c              |   421 +
 drivers/net/octeontx2/cgx_intf.h              |   370 +
 drivers/net/octeontx2/lmt.h                   |    51 +
 drivers/net/octeontx2/nix.c                   |   824 ++
 drivers/net/octeontx2/nix.h                   |   355 +
 drivers/net/octeontx2/nix_af.c                |  1103 ++
 drivers/net/octeontx2/npc.h                   |    92 +
 drivers/net/octeontx2/rvu.h                   |   127 +
 drivers/net/octeontx2/rvu_af.c                |   172 +
 drivers/net/octeontx2/rvu_common.c            |    74 +
 drivers/net/octeontx2/rvu_pf.c                |   118 +
 drivers/pci/Kconfig                           |    17 +
 drivers/pci/Makefile                          |     1 +
 drivers/pci/pci-uclass.c                      |   211 +-
 drivers/pci/pci_octeontx.c                    |   538 +
 drivers/rtc/Kconfig                           |     7 +
 drivers/rtc/ds1337.c                          |   170 +
 drivers/spi/Kconfig                           |     6 +
 drivers/spi/Makefile                          |     1 +
 drivers/spi/octeontx_spi.c                    |   750 ++
 drivers/watchdog/Kconfig                      |    10 +
 drivers/watchdog/Makefile                     |     1 +
 drivers/watchdog/octeontx_wdt.c               |    76 +
 include/configs/octeontx2_95xx.h              |    80 +
 include/configs/octeontx2_96xx.h              |    90 +
 include/configs/octeontx_common.h             |    98 +
 include/fdtdec.h                              |    12 +
 include/mmc.h                                 |     1 +
 include/pci.h                                 |    23 +-
 include/pci_ids.h                             |     2 +
 lib/fdtdec.c                                  |    16 +
 118 files changed, 50774 insertions(+), 17 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-octeontx/board.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/clock.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/csrs/csrs-mio_emm.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/csrs/csrs-xcv.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/gpio.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/smc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/soc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/board.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/clock.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-cgx.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-lmt.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-mio_emm.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-nix.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-npa.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-npc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-rvu.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/gpio.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/smc-id.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/smc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/soc.h
 create mode 100644 arch/arm/mach-octeontx/Kconfig
 create mode 100644 arch/arm/mach-octeontx/Makefile
 create mode 100644 arch/arm/mach-octeontx/clock.c
 create mode 100644 arch/arm/mach-octeontx/cpu.c
 create mode 100644 arch/arm/mach-octeontx/lowlevel_init.S
 create mode 100644 arch/arm/mach-octeontx2/Kconfig
 create mode 100644 arch/arm/mach-octeontx2/Makefile
 create mode 100644 arch/arm/mach-octeontx2/clock.c
 create mode 100644 arch/arm/mach-octeontx2/config.mk
 create mode 100644 arch/arm/mach-octeontx2/cpu.c
 create mode 100644 arch/arm/mach-octeontx2/lowlevel_init.S
 create mode 100644 board/Marvell/octeontx/Kconfig
 create mode 100644 board/Marvell/octeontx/MAINTAINERS
 create mode 100644 board/Marvell/octeontx/Makefile
 create mode 100644 board/Marvell/octeontx/board-fdt.c
 create mode 100644 board/Marvell/octeontx/board.c
 create mode 100644 board/Marvell/octeontx/smc.c
 create mode 100644 board/Marvell/octeontx/soc-utils.c
 create mode 100644 board/Marvell/octeontx2/Kconfig
 create mode 100644 board/Marvell/octeontx2/MAINTAINERS
 create mode 100644 board/Marvell/octeontx2/Makefile
 create mode 100644 board/Marvell/octeontx2/board-fdt.c
 create mode 100644 board/Marvell/octeontx2/board.c
 create mode 100644 board/Marvell/octeontx2/smc.c
 create mode 100644 board/Marvell/octeontx2/soc-utils.c
 create mode 100644 configs/octeontx2_95xx_defconfig
 create mode 100644 configs/octeontx2_96xx_defconfig
 create mode 100644 configs/octeontx_81xx_defconfig
 create mode 100644 configs/octeontx_83xx_defconfig
 create mode 100644 drivers/gpio/octeontx_gpio.c
 create mode 100644 drivers/i2c/octeontx_i2c.c
 create mode 100644 drivers/mmc/octeontx_hsmmc.c
 create mode 100644 drivers/mmc/octeontx_hsmmc.h
 create mode 100644 drivers/mtd/nand/raw/octeontx_bch.c
 create mode 100644 drivers/mtd/nand/raw/octeontx_bch.h
 create mode 100644 drivers/mtd/nand/raw/octeontx_bch_regs.h
 create mode 100644 drivers/mtd/nand/raw/octeontx_nand.c
 create mode 100644 drivers/net/octeontx/Makefile
 create mode 100644 drivers/net/octeontx/bgx.c
 create mode 100644 drivers/net/octeontx/bgx.h
 create mode 100644 drivers/net/octeontx/nic.h
 create mode 100644 drivers/net/octeontx/nic_main.c
 create mode 100644 drivers/net/octeontx/nic_reg.h
 create mode 100644 drivers/net/octeontx/nicvf_main.c
 create mode 100644 drivers/net/octeontx/nicvf_queues.c
 create mode 100644 drivers/net/octeontx/nicvf_queues.h
 create mode 100644 drivers/net/octeontx/q_struct.h
 create mode 100644 drivers/net/octeontx/smi.c
 create mode 100644 drivers/net/octeontx/xcv.c
 create mode 100644 drivers/net/octeontx2/Makefile
 create mode 100644 drivers/net/octeontx2/cgx.c
 create mode 100644 drivers/net/octeontx2/cgx.h
 create mode 100644 drivers/net/octeontx2/cgx_intf.c
 create mode 100644 drivers/net/octeontx2/cgx_intf.h
 create mode 100644 drivers/net/octeontx2/lmt.h
 create mode 100644 drivers/net/octeontx2/nix.c
 create mode 100644 drivers/net/octeontx2/nix.h
 create mode 100644 drivers/net/octeontx2/nix_af.c
 create mode 100644 drivers/net/octeontx2/npc.h
 create mode 100644 drivers/net/octeontx2/rvu.h
 create mode 100644 drivers/net/octeontx2/rvu_af.c
 create mode 100644 drivers/net/octeontx2/rvu_common.c
 create mode 100644 drivers/net/octeontx2/rvu_pf.c
 create mode 100644 drivers/pci/pci_octeontx.c
 create mode 100644 drivers/spi/octeontx_spi.c
 create mode 100644 drivers/watchdog/octeontx_wdt.c
 create mode 100644 include/configs/octeontx2_95xx.h
 create mode 100644 include/configs/octeontx2_96xx.h
 create mode 100644 include/configs/octeontx_common.h
Quoted 3 lines

--
2.23.0

Quoted 8 lines

Tom,

I haven't seen any reviews or comments of any of Suneel's patch series here other than the testing I performed.

What are the next steps in being able to get this code merged? The patches to pci-uclass are perhaps the only ones that would even affect other boards as pretty much everything else is adding a new driver.

I've spent a bit of time looking at these. Some are OK but some need a little work.

Regards,
Simon

#63 lore raw

cover arm: Introduce Marvell/Cavium OcteonTX

Quoted 271 lines · Simon Glass

Hi Tim,

Quoted 268 lines · Tim Harvey
Quoted 257 lines · Suneel Garapati

This series will add support for OcteonTX and OcteonTX2 processsor based platforms. The Marvell/Cavium Octeon-TX 64-bit ARM based SoCs include the CN80XX, CN81XX and CN83XX while Octeon-TX2 64-bit ARM based SoCs include support for CN96XX and CN95XX.
These SoC's have peripheral drivers based on PCI ECAM.

Patches
[1 -10] Add requied changes to PCI framework
- [6] Add support for multi-memory region range
- [7] EA in bridges
- [8] SR-IOV
[12] Add driver model support for RTC DS1337 driver [15 - 17] AHCI changes
[18 - 27] Add OcteonTX drivers
[28 - 29] Add OcteonTX/TX2 board files and configurations

Suneel Garapati (29):
include: pci_ids: add vendor ID for Cavium
include: pci: Increase max pci region limit
fdtdec: add API to read pci bus-range property
drivers: pci-uclass: fix incorrect argument in map_sysmem
drivers: pci-uclass: make DT subnode parse optional
drivers: pci-uclass: add multi entry support for pci regions
drivers: pci-uclass: add support for Enhanced Allocation in Bridges
drivers: pci-uclass: add support for Single-Root I/O Virtualizaiton
drivers: pci-uclass: add VF map_bar support for Enhanced Allocation
drivers: pci-uclass: Add support for Alternate-RoutingID capability
include: arm: asm: io: add 64bit clrbits and setbits helpers
drivers: rtc: ds1337: add driver model support
arch: include: octeontx: add headers for OcteonTX
arch: include: octeontx2: add headers for OcteonTX2
drivers: ata: ahci: update max id if it is more than available ports
drivers: ata: ahci: fill upper 32bit buffer address in sg descriptor
drivers: ata: ahci: add BAR index quirk for OcteonTX
drivers: pci: add PCI controller driver for OcteonTX
drivers: gpio: add GPIO controller driver for OcteonTX
drivers: i2c: add I2C controller driver for OcteonTX
drivers: spi: add SPI controller driver for OcteonTX
drivers: mmc: remove static qualifier on mmc_power_init
drivers: mmc: add MMC controller driver for OcteonTX
drivers: mtd: nand: add NAND controller driver for OcteonTX
drivers: net: add NIC controller driver for OcteonTX
drivers: net: add NIC controller driver for OcteonTX2
drivers: watchdog: add reset support for OcteonTX
octeontx: Add support for OcteonTX SoC platforms
octeontx2: Add support for OcteonTX2 SoC platforms

 arch/arm/Kconfig                              |    22 +
 arch/arm/Makefile                             |     2 +
 arch/arm/include/asm/arch-octeontx/board.h    |   121 +
 arch/arm/include/asm/arch-octeontx/clock.h    |    25 +
 .../asm/arch-octeontx/csrs/csrs-mio_emm.h     |  1193 ++
 .../include/asm/arch-octeontx/csrs/csrs-xcv.h |   428 +
 arch/arm/include/asm/arch-octeontx/gpio.h     |     6 +
 arch/arm/include/asm/arch-octeontx/smc.h      |    20 +
 arch/arm/include/asm/arch-octeontx/soc.h      |    31 +
 arch/arm/include/asm/arch-octeontx2/board.h   |   123 +
 arch/arm/include/asm/arch-octeontx2/clock.h   |    24 +
 .../asm/arch-octeontx2/csrs/csrs-cgx.h        |  7835 ++++++++++++
 .../asm/arch-octeontx2/csrs/csrs-lmt.h        |    60 +
 .../asm/arch-octeontx2/csrs/csrs-mio_emm.h    |  1193 ++
 .../asm/arch-octeontx2/csrs/csrs-nix.h        | 10482 ++++++++++++++++
 .../asm/arch-octeontx2/csrs/csrs-npa.h        |  2296 ++++
 .../asm/arch-octeontx2/csrs/csrs-npc.h        |  1930 +++
 .../asm/arch-octeontx2/csrs/csrs-rvu.h        |  2430 ++++
 arch/arm/include/asm/arch-octeontx2/gpio.h    |     6 +
 arch/arm/include/asm/arch-octeontx2/smc-id.h  |    32 +
 arch/arm/include/asm/arch-octeontx2/smc.h     |    18 +
 arch/arm/include/asm/arch-octeontx2/soc.h     |    31 +
 arch/arm/include/asm/io.h                     |     8 +
 arch/arm/mach-octeontx/Kconfig                |    23 +
 arch/arm/mach-octeontx/Makefile               |     9 +
 arch/arm/mach-octeontx/clock.c                |    35 +
 arch/arm/mach-octeontx/cpu.c                  |    76 +
 arch/arm/mach-octeontx/lowlevel_init.S        |    33 +
 arch/arm/mach-octeontx2/Kconfig               |    23 +
 arch/arm/mach-octeontx2/Makefile              |     9 +
 arch/arm/mach-octeontx2/clock.c               |    35 +
 arch/arm/mach-octeontx2/config.mk             |     4 +
 arch/arm/mach-octeontx2/cpu.c                 |    72 +
 arch/arm/mach-octeontx2/lowlevel_init.S       |    33 +
 board/Marvell/octeontx/Kconfig                |    14 +
 board/Marvell/octeontx/MAINTAINERS            |     9 +
 board/Marvell/octeontx/Makefile               |     9 +
 board/Marvell/octeontx/board-fdt.c            |   271 +
 board/Marvell/octeontx/board.c                |   137 +
 board/Marvell/octeontx/smc.c                  |    30 +
 board/Marvell/octeontx/soc-utils.c            |    53 +
 board/Marvell/octeontx2/Kconfig               |    15 +
 board/Marvell/octeontx2/MAINTAINERS           |     9 +
 board/Marvell/octeontx2/Makefile              |     9 +
 board/Marvell/octeontx2/board-fdt.c           |   155 +
 board/Marvell/octeontx2/board.c               |   232 +
 board/Marvell/octeontx2/smc.c                 |    62 +
 board/Marvell/octeontx2/soc-utils.c           |    49 +
 configs/octeontx2_95xx_defconfig              |   105 +
 configs/octeontx2_96xx_defconfig              |   131 +
 configs/octeontx_81xx_defconfig               |   133 +
 configs/octeontx_83xx_defconfig               |   130 +
 drivers/ata/ahci.c                            |    15 +
 drivers/gpio/Kconfig                          |     7 +
 drivers/gpio/Makefile                         |     1 +
 drivers/gpio/octeontx_gpio.c                  |   218 +
 drivers/i2c/Kconfig                           |     7 +
 drivers/i2c/Makefile                          |     1 +
 drivers/i2c/octeontx_i2c.c                    |   968 ++
 drivers/mmc/Kconfig                           |     9 +
 drivers/mmc/Makefile                          |     1 +
 drivers/mmc/mmc.c                             |     2 +-
 drivers/mmc/octeontx_hsmmc.c                  |  3233 +++++
 drivers/mmc/octeontx_hsmmc.h                  |   191 +
 drivers/mtd/nand/raw/Kconfig                  |    16 +
 drivers/mtd/nand/raw/Makefile                 |     2 +
 drivers/mtd/nand/raw/octeontx_bch.c           |   424 +
 drivers/mtd/nand/raw/octeontx_bch.h           |   142 +
 drivers/mtd/nand/raw/octeontx_bch_regs.h      |   169 +
 drivers/mtd/nand/raw/octeontx_nand.c          |  2261 ++++
 drivers/net/Kconfig                           |    29 +
 drivers/net/Makefile                          |     4 +
 drivers/net/octeontx/Makefile                 |     9 +
 drivers/net/octeontx/bgx.c                    |  1546 +++
 drivers/net/octeontx/bgx.h                    |   259 +
 drivers/net/octeontx/nic.h                    |   518 +
 drivers/net/octeontx/nic_main.c               |   777 ++
 drivers/net/octeontx/nic_reg.h                |   252 +
 drivers/net/octeontx/nicvf_main.c             |   575 +
 drivers/net/octeontx/nicvf_queues.c           |  1141 ++
 drivers/net/octeontx/nicvf_queues.h           |   355 +
 drivers/net/octeontx/q_struct.h               |   697 +
 drivers/net/octeontx/smi.c                    |   382 +
 drivers/net/octeontx/xcv.c                    |   129 +
 drivers/net/octeontx2/Makefile                |    11 +
 drivers/net/octeontx2/cgx.c                   |   297 +
 drivers/net/octeontx2/cgx.h                   |   105 +
 drivers/net/octeontx2/cgx_intf.c              |   421 +
 drivers/net/octeontx2/cgx_intf.h              |   370 +
 drivers/net/octeontx2/lmt.h                   |    51 +
 drivers/net/octeontx2/nix.c                   |   824 ++
 drivers/net/octeontx2/nix.h                   |   355 +
 drivers/net/octeontx2/nix_af.c                |  1103 ++
 drivers/net/octeontx2/npc.h                   |    92 +
 drivers/net/octeontx2/rvu.h                   |   127 +
 drivers/net/octeontx2/rvu_af.c                |   172 +
 drivers/net/octeontx2/rvu_common.c            |    74 +
 drivers/net/octeontx2/rvu_pf.c                |   118 +
 drivers/pci/Kconfig                           |    17 +
 drivers/pci/Makefile                          |     1 +
 drivers/pci/pci-uclass.c                      |   211 +-
 drivers/pci/pci_octeontx.c                    |   538 +
 drivers/rtc/Kconfig                           |     7 +
 drivers/rtc/ds1337.c                          |   170 +
 drivers/spi/Kconfig                           |     6 +
 drivers/spi/Makefile                          |     1 +
 drivers/spi/octeontx_spi.c                    |   750 ++
 drivers/watchdog/Kconfig                      |    10 +
 drivers/watchdog/Makefile                     |     1 +
 drivers/watchdog/octeontx_wdt.c               |    76 +
 include/configs/octeontx2_95xx.h              |    80 +
 include/configs/octeontx2_96xx.h              |    90 +
 include/configs/octeontx_common.h             |    98 +
 include/fdtdec.h                              |    12 +
 include/mmc.h                                 |     1 +
 include/pci.h                                 |    23 +-
 include/pci_ids.h                             |     2 +
 lib/fdtdec.c                                  |    16 +
 118 files changed, 50774 insertions(+), 17 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-octeontx/board.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/clock.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/csrs/csrs-mio_emm.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/csrs/csrs-xcv.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/gpio.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/smc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx/soc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/board.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/clock.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-cgx.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-lmt.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-mio_emm.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-nix.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-npa.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-npc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/csrs/csrs-rvu.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/gpio.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/smc-id.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/smc.h
 create mode 100644 arch/arm/include/asm/arch-octeontx2/soc.h
 create mode 100644 arch/arm/mach-octeontx/Kconfig
 create mode 100644 arch/arm/mach-octeontx/Makefile
 create mode 100644 arch/arm/mach-octeontx/clock.c
 create mode 100644 arch/arm/mach-octeontx/cpu.c
 create mode 100644 arch/arm/mach-octeontx/lowlevel_init.S
 create mode 100644 arch/arm/mach-octeontx2/Kconfig
 create mode 100644 arch/arm/mach-octeontx2/Makefile
 create mode 100644 arch/arm/mach-octeontx2/clock.c
 create mode 100644 arch/arm/mach-octeontx2/config.mk
 create mode 100644 arch/arm/mach-octeontx2/cpu.c
 create mode 100644 arch/arm/mach-octeontx2/lowlevel_init.S
 create mode 100644 board/Marvell/octeontx/Kconfig
 create mode 100644 board/Marvell/octeontx/MAINTAINERS
 create mode 100644 board/Marvell/octeontx/Makefile
 create mode 100644 board/Marvell/octeontx/board-fdt.c
 create mode 100644 board/Marvell/octeontx/board.c
 create mode 100644 board/Marvell/octeontx/smc.c
 create mode 100644 board/Marvell/octeontx/soc-utils.c
 create mode 100644 board/Marvell/octeontx2/Kconfig
 create mode 100644 board/Marvell/octeontx2/MAINTAINERS
 create mode 100644 board/Marvell/octeontx2/Makefile
 create mode 100644 board/Marvell/octeontx2/board-fdt.c
 create mode 100644 board/Marvell/octeontx2/board.c
 create mode 100644 board/Marvell/octeontx2/smc.c
 create mode 100644 board/Marvell/octeontx2/soc-utils.c
 create mode 100644 configs/octeontx2_95xx_defconfig
 create mode 100644 configs/octeontx2_96xx_defconfig
 create mode 100644 configs/octeontx_81xx_defconfig
 create mode 100644 configs/octeontx_83xx_defconfig
 create mode 100644 drivers/gpio/octeontx_gpio.c
 create mode 100644 drivers/i2c/octeontx_i2c.c
 create mode 100644 drivers/mmc/octeontx_hsmmc.c
 create mode 100644 drivers/mmc/octeontx_hsmmc.h
 create mode 100644 drivers/mtd/nand/raw/octeontx_bch.c
 create mode 100644 drivers/mtd/nand/raw/octeontx_bch.h
 create mode 100644 drivers/mtd/nand/raw/octeontx_bch_regs.h
 create mode 100644 drivers/mtd/nand/raw/octeontx_nand.c
 create mode 100644 drivers/net/octeontx/Makefile
 create mode 100644 drivers/net/octeontx/bgx.c
 create mode 100644 drivers/net/octeontx/bgx.h
 create mode 100644 drivers/net/octeontx/nic.h
 create mode 100644 drivers/net/octeontx/nic_main.c
 create mode 100644 drivers/net/octeontx/nic_reg.h
 create mode 100644 drivers/net/octeontx/nicvf_main.c
 create mode 100644 drivers/net/octeontx/nicvf_queues.c
 create mode 100644 drivers/net/octeontx/nicvf_queues.h
 create mode 100644 drivers/net/octeontx/q_struct.h
 create mode 100644 drivers/net/octeontx/smi.c
 create mode 100644 drivers/net/octeontx/xcv.c
 create mode 100644 drivers/net/octeontx2/Makefile
 create mode 100644 drivers/net/octeontx2/cgx.c
 create mode 100644 drivers/net/octeontx2/cgx.h
 create mode 100644 drivers/net/octeontx2/cgx_intf.c
 create mode 100644 drivers/net/octeontx2/cgx_intf.h
 create mode 100644 drivers/net/octeontx2/lmt.h
 create mode 100644 drivers/net/octeontx2/nix.c
 create mode 100644 drivers/net/octeontx2/nix.h
 create mode 100644 drivers/net/octeontx2/nix_af.c
 create mode 100644 drivers/net/octeontx2/npc.h
 create mode 100644 drivers/net/octeontx2/rvu.h
 create mode 100644 drivers/net/octeontx2/rvu_af.c
 create mode 100644 drivers/net/octeontx2/rvu_common.c
 create mode 100644 drivers/net/octeontx2/rvu_pf.c
 create mode 100644 drivers/pci/pci_octeontx.c
 create mode 100644 drivers/spi/octeontx_spi.c
 create mode 100644 drivers/watchdog/octeontx_wdt.c
 create mode 100644 include/configs/octeontx2_95xx.h
 create mode 100644 include/configs/octeontx2_96xx.h
 create mode 100644 include/configs/octeontx_common.h
Quoted 3 lines

--
2.23.0

Tom,

I haven't seen any reviews or comments of any of Suneel's patch series here other than the testing I performed.

Quoted 6 lines
Quoted 3 lines

What are the next steps in being able to get this code merged? The patches to pci-uclass are perhaps the only ones that would even affect other boards as pretty much everything else is adding a new driver.

I've spent a bit of time looking at these. Some are OK but some need a little work.

Thanks Simon. Part of the answer is that I was hoping for someone to have a chance to chime in and look. Otherwise, as a new platform this is going to wait until after v2020.01 is released, JFYI.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191120/e5e58f6a/attachment.sig>