Skip to contentSkip to conversation

add Intel Max10 BMC chip support

PATCH Superseded Xu Yilun 2 participants 7 messages Jul 13, 2020 – Jul 14, 2020

Subsystems (2)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Xu Yilun

author maintainer
#0 lore raw

cover add Intel Max10 BMC chip support

This patchset add basic functions for Intel Max10 BMC chip. Patch #1 implements the main feature.
Patch #2 is a fix for the HW issue lies in the "SPI Slave to Avalon Master bridge" IP block, which is used for communication between host and the BMC chip.

Matthew Gerlach (1):
mfd: intel-m10-bmc: start with the last SOP on phy rx buffer parsing

Xu Yilun (1):
mfd: intel-m10-bmc: add Max10 BMC chip support for Intel FPGA PAC

 .../ABI/testing/sysfs-driver-intel-m10-bmc         |  15 +
 drivers/mfd/Kconfig                                |  13 +
 drivers/mfd/Makefile                               |   3 +
 drivers/mfd/intel-m10-bmc-main.c                   | 176 ++++
 drivers/mfd/intel-spi-avmm.c                       | 904 +++++++++++++++++++++
 drivers/mfd/intel-spi-avmm.h                       |  35 +
 include/linux/mfd/intel-m10-bmc.h                  |  57 ++
 7 files changed, 1203 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-intel-m10-bmc
 create mode 100644 drivers/mfd/intel-m10-bmc-main.c
 create mode 100644 drivers/mfd/intel-spi-avmm.c
 create mode 100644 drivers/mfd/intel-spi-avmm.h
 create mode 100644 include/linux/mfd/intel-m10-bmc.h
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH 1/2 mfd: intel-m10-bmc: add Max10 BMC chip support for Intel FPGA PAC

This patch implements the basic functions of the BMC chip for some Intel FPGA PCIe Acceleration Cards (PAC). The BMC is implemented using the intel max10 CPLD.

This BMC chip is connected to FPGA by a SPI bus. To provide reliable register access from FPGA, an Avalon Memory-Mapped (Avmm) transaction protocol over the SPI bus is used between host and slave.

This driver implements the basic register access with the regmap framework. The mfd cells array is empty now as a placeholder.

---
 .../ABI/testing/sysfs-driver-intel-m10-bmc         |  15 +
 drivers/mfd/Kconfig                                |  13 +
 drivers/mfd/Makefile                               |   3 +
 drivers/mfd/intel-m10-bmc-main.c                   | 176 ++++
 drivers/mfd/intel-spi-avmm.c                       | 904 +++++++++++++++++++++
 drivers/mfd/intel-spi-avmm.h                       |  35 +
 include/linux/mfd/intel-m10-bmc.h                  |  57 ++
 7 files changed, 1203 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-intel-m10-bmc
 create mode 100644 drivers/mfd/intel-m10-bmc-main.c
 create mode 100644 drivers/mfd/intel-spi-avmm.c
 create mode 100644 drivers/mfd/intel-spi-avmm.h
 create mode 100644 include/linux/mfd/intel-m10-bmc.h
Documentation/ABI/testing/sysfs-driver-intel-m10-bmc new file +15 -0
new file mode 100644
index 0000000..54cf5bc
@@ -0,0 +1,15 @@
+What:		/sys/bus/spi/devices/.../bmc_version
+Date:		June 2020
+KernelVersion:	5.9
+Contact:	Xu Yilun <[email protected]>
+Description:	Read only. Returns the hardware build version of Intel
+		MAX10 BMC chip.
+		Format: "0x%x".
+
+What:		/sys/bus/spi/devices/.../bmcfw_version
+Date:		June 2020
+KernelVersion:	5.9
+Contact:	Xu Yilun <[email protected]>
+Description:	Read only. Returns the firmware version of Intel MAX10
+		BMC chip.
+		Format: "0x%x".
drivers/mfd/Kconfig +13 -0
index d13bb0a..9c478d7 100644
@@ -2130,5 +2130,18 @@ config SGI_MFD_IOC3
 	  If you have an SGI Origin, Octane, or a PCI IOC3 card,
 	  then say Y. Otherwise say N.
 
+config MFD_INTEL_M10_BMC
+	tristate "Intel MAX10 board management controller"
+	depends on SPI_MASTER
+	select REGMAP
+	select MFD_CORE
+	help
+	  Support for the Intel MAX10 board management controller using the
+	  SPI interface.
+
+	  This driver provides common support for accessing the device,
+	  additional drivers must be enabled in order to use the functionality
+	  of the device.
+
 endmenu
 endif
drivers/mfd/Makefile +3 -0
index 1c8d6be..fb15cde 100644
@@ -265,3 +265,6 @@ obj-$(CONFIG_MFD_STMFX) 	+= stmfx.o
 obj-$(CONFIG_MFD_KHADAS_MCU) 	+= khadas-mcu.o
 
 obj-$(CONFIG_SGI_MFD_IOC3)	+= ioc3.o
+
+intel-m10-bmc-objs                := intel-m10-bmc-main.o intel-spi-avmm.o
+obj-$(CONFIG_MFD_INTEL_M10_BMC)   += intel-m10-bmc.o
drivers/mfd/intel-m10-bmc-main.c new file +176 -0

176 lines not on this page · raw message

drivers/mfd/intel-spi-avmm.c new file +904 -0

904 lines not on this page · raw message

drivers/mfd/intel-spi-avmm.h new file +35 -0
new file mode 100644
index 0000000..df46dff
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Driver Header File for Intel SPI Slave to AVMM Bus Bridge
+ *
+ * Copyright (C) 2018-2020 Intel Corporation. All rights reserved.
+ *
+ */
+
+#ifndef __INTEL_SPI_AVMM_H
+#define __INTEL_SPI_AVMM_H
+
+#include <linux/spi/spi.h>
+#include <linux/regmap.h>
+
+struct regmap *__devm_regmap_init_spi_avmm(struct spi_device *spi,
+					   const struct regmap_config *config,
+					   struct lock_class_key *lock_key,
+					   const char *lock_name);
+
+/**
+ * devm_regmap_init_spi_avmm() - Initialize register map for Intel SPI Slave
+ * to AVMM Bus Bridge
+ *
+ * @spi: Device that will be interacted with
+ * @config: Configuration for register map
+ *
+ * The return value will be an ERR_PTR() on error or a valid pointer
+ * to a struct regmap.  The map will be automatically freed by the
+ * device management code.
+ */
+#define devm_regmap_init_spi_avmm(spi, config)				\
+	__regmap_lockdep_wrapper(__devm_regmap_init_spi_avmm, #config,	\
+				 spi, config)
+
+#endif /* __INTEL_SPI_AVMM_H */
include/linux/mfd/intel-m10-bmc.h new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 1/2] mfd: intel-m10-bmc: add Max10 BMC chip support for Intel FPGA PAC

Quoted 16 lines · Xu Yilun

This patch implements the basic functions of the BMC chip for some Intel FPGA PCIe Acceleration Cards (PAC). The BMC is implemented using the intel max10 CPLD.

This BMC chip is connected to FPGA by a SPI bus. To provide reliable register access from FPGA, an Avalon Memory-Mapped (Avmm) transaction protocol over the SPI bus is used between host and slave.

This driver implements the basic register access with the regmap framework. The mfd cells array is empty now as a placeholder.

Quoted 7 lines
---
 .../ABI/testing/sysfs-driver-intel-m10-bmc         |  15 +
 drivers/mfd/Kconfig                                |  13 +
 drivers/mfd/Makefile                               |   3 +
 drivers/mfd/intel-m10-bmc-main.c                   | 176 ++++
 drivers/mfd/intel-spi-avmm.c                       | 904 +++++++++++++++++++++

This does not belong in MFD.

Please consider moving it to drivers/spi.

Quoted 8 lines
 drivers/mfd/intel-spi-avmm.h                       |  35 +
 include/linux/mfd/intel-m10-bmc.h                  |  57 ++
 7 files changed, 1203 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-intel-m10-bmc
 create mode 100644 drivers/mfd/intel-m10-bmc-main.c
 create mode 100644 drivers/mfd/intel-spi-avmm.c
 create mode 100644 drivers/mfd/intel-spi-avmm.h
 create mode 100644 include/linux/mfd/intel-m10-bmc.h
Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#3 lore raw

Re: [PATCH 1/2] mfd: intel-m10-bmc: add Max10 BMC chip support for Intel FPGA PAC

Quoted 24 lines · Lee Jones
Quoted 21 lines · Xu Yilun

This patch implements the basic functions of the BMC chip for some Intel FPGA PCIe Acceleration Cards (PAC). The BMC is implemented using the intel max10 CPLD.

This BMC chip is connected to FPGA by a SPI bus. To provide reliable register access from FPGA, an Avalon Memory-Mapped (Avmm) transaction protocol over the SPI bus is used between host and slave.

This driver implements the basic register access with the regmap framework. The mfd cells array is empty now as a placeholder.

---
 .../ABI/testing/sysfs-driver-intel-m10-bmc         |  15 +
 drivers/mfd/Kconfig                                |  13 +
 drivers/mfd/Makefile                               |   3 +
 drivers/mfd/intel-m10-bmc-main.c                   | 176 ++++
Quoted 5 lines
Quoted 1 line
 drivers/mfd/intel-spi-avmm.c                       | 904 +++++++++++++++++++++

This does not belong in MFD.

Please consider moving it to drivers/spi.

OK, I could make the intel-spi-avmm.c as a separate module in other folder.

Since it is an implementation of regmap, is it better we move it to drivers/base/regmap?

Quoted 15 lines
Quoted 9 lines
 drivers/mfd/intel-spi-avmm.h                       |  35 +
 include/linux/mfd/intel-m10-bmc.h                  |  57 ++
 7 files changed, 1203 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-intel-m10-bmc
 create mode 100644 drivers/mfd/intel-m10-bmc-main.c
 create mode 100644 drivers/mfd/intel-spi-avmm.c
 create mode 100644 drivers/mfd/intel-spi-avmm.h
 create mode 100644 include/linux/mfd/intel-m10-bmc.h
Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
#4 lore raw

Re: [PATCH 1/2] mfd: intel-m10-bmc: add Max10 BMC chip support for Intel FPGA PAC

Quoted 29 lines · Xu Yilun
Quoted 28 lines · Lee Jones
Quoted 16 lines · Xu Yilun

This patch implements the basic functions of the BMC chip for some Intel FPGA PCIe Acceleration Cards (PAC). The BMC is implemented using the intel max10 CPLD.

This BMC chip is connected to FPGA by a SPI bus. To provide reliable register access from FPGA, an Avalon Memory-Mapped (Avmm) transaction protocol over the SPI bus is used between host and slave.

This driver implements the basic register access with the regmap framework. The mfd cells array is empty now as a placeholder.

Quoted 7 lines
---
 .../ABI/testing/sysfs-driver-intel-m10-bmc         |  15 +
 drivers/mfd/Kconfig                                |  13 +
 drivers/mfd/Makefile                               |   3 +
 drivers/mfd/intel-m10-bmc-main.c                   | 176 ++++
 drivers/mfd/intel-spi-avmm.c                       | 904 +++++++++++++++++++++

This does not belong in MFD.

Quoted 7 lines
Quoted 1 line

Please consider moving it to drivers/spi.

OK, I could make the intel-spi-avmm.c as a separate module in other folder.

Since it is an implementation of regmap, is it better we move it to drivers/base/regmap?

Either way, you need to speak to Mark Brown.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
 drivers/mfd/intel-spi-avmm.h                       |  35 +
 include/linux/mfd/intel-m10-bmc.h                  |  57 ++
 7 files changed, 1203 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-intel-m10-bmc
 create mode 100644 drivers/mfd/intel-m10-bmc-main.c
 create mode 100644 drivers/mfd/intel-spi-avmm.c
 create mode 100644 drivers/mfd/intel-spi-avmm.h
 create mode 100644 include/linux/mfd/intel-m10-bmc.h
Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#5 lore raw

Re: [PATCH 1/2] mfd: intel-m10-bmc: add Max10 BMC chip support for Intel FPGA PAC

Quoted 33 lines · Lee Jones
Quoted 31 lines · Xu Yilun
Quoted 29 lines · Lee Jones
Quoted 16 lines · Xu Yilun

This patch implements the basic functions of the BMC chip for some Intel FPGA PCIe Acceleration Cards (PAC). The BMC is implemented using the intel max10 CPLD.

This BMC chip is connected to FPGA by a SPI bus. To provide reliable register access from FPGA, an Avalon Memory-Mapped (Avmm) transaction protocol over the SPI bus is used between host and slave.

This driver implements the basic register access with the regmap framework. The mfd cells array is empty now as a placeholder.

Quoted 7 lines
---
 .../ABI/testing/sysfs-driver-intel-m10-bmc         |  15 +
 drivers/mfd/Kconfig                                |  13 +
 drivers/mfd/Makefile                               |   3 +
 drivers/mfd/intel-m10-bmc-main.c                   | 176 ++++
 drivers/mfd/intel-spi-avmm.c                       | 904 +++++++++++++++++++++

This does not belong in MFD.

Please consider moving it to drivers/spi.

Quoted 7 lines
Quoted 5 lines

OK, I could make the intel-spi-avmm.c as a separate module in other folder.

Since it is an implementation of regmap, is it better we move it to drivers/base/regmap?

Either way, you need to speak to Mark Brown.

Thanks for your suggestion, I'll contact him.

Yilun.

Quoted 16 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
 drivers/mfd/intel-spi-avmm.h                       |  35 +
 include/linux/mfd/intel-m10-bmc.h                  |  57 ++
 7 files changed, 1203 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-intel-m10-bmc
 create mode 100644 drivers/mfd/intel-m10-bmc-main.c
 create mode 100644 drivers/mfd/intel-spi-avmm.c
 create mode 100644 drivers/mfd/intel-spi-avmm.h
 create mode 100644 include/linux/mfd/intel-m10-bmc.h
Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#6 lore raw

PATCH 2/2 mfd: intel-m10-bmc: start with the last SOP on phy rx buffer parsing

In reply to Xu Yilun

From: Matthew Gerlach <[email protected]>

This patch works around a bug in the SPI Slave to Avalon Master bridge. The SPI slave will send an unexpected extra SOP in the following case.

One in approximately one million read requests results in an apparant stall on the avalon bus where the SPI slave inserts IDLE characters. When the stall is over, the slave sends an extra SOP character instead of the 0x7c indicating channel. The other characters are correct.

To eliminate the impact of the bug, this patch changes to look for the last SOP as the start point of the valid phy rx data.

---
 drivers/mfd/intel-spi-avmm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/mfd/intel-spi-avmm.c +5 -5
index 2604657..e4443b7 100644
@@ -431,14 +431,14 @@ static int pkt_phy_rx_parse(struct device *dev,
 {
 	char *b, *p;
 
-	b = phy_buf;
 	p = trans_buf;
 
-	/* Find the SOP */
-	while (b < phy_buf + phy_len && *b != PKT_SOP)
-		b++;
+	/* Find the last SOP */
+	b = (phy_buf + phy_len) - 1;
+	while (b >= phy_buf && *b != PKT_SOP)
+		b--;
 
-	if (b >= phy_buf + phy_len) {
+	if (b < phy_buf) {
 		dev_err(dev, "%s no SOP\n", __func__);
 		return -EINVAL;
 	}
Signature · 1 line
2.7.4