Skip to contentSkip to conversation

add regmap-spi-avmm & Intel Max10 BMC chip support

PATCH Superseded Xu Yilun 4 participants 15 messages Aug 19, 2020 – Sep 9, 2020

Subsystems (4)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Xu Yilun

author maintainer
#0 lore raw

v4 cover add regmap-spi-avmm & Intel Max10 BMC chip support

This patchset adds the regmap-spi-avmm to support the Intel SPI Slave to AVMM Bus Bridge (spi-avmm) IP block. It also implements the usercase - the driver of Intel Max10 BMC chip which integrates this IP block.

Patch #1 implements the regmap-spi-avmm.
Patch #2 implements the mfd driver of Intel Max10 BMC chip.

Main changes from v1:
- Split out the regmap-spi-avmm module out of intel-m10-bmc module.

Main changes from v2:
- Refactor the code of regmap-spi-avmm.
- Rewrites the rx flow and simplifies the implementation, collapse some function calls.
- Add bounds checking every time we fill trans_buf & phy_buf.
- Try to configure spi mode on regmap init
- delete regmap_bus.reg_write/reg_read callbacks.
- Squash the bug fixing patch.
- Add the sub devices in mfd_cell for Max10 bmc driver.
- Improve comments and some minor fixes.

Main changes from v3:
- Rebased to 5.9-rc1.
- Collapse the phy buf padding code in br_pkt_phy_tx_prepare().

Xu Yilun (2):
regmap: add Intel SPI Slave to AVMM Bus Bridge support
mfd: intel-m10-bmc: add Max10 BMC chip support for Intel FPGA PAC

 .../ABI/testing/sysfs-driver-intel-m10-bmc         |  15 +
 drivers/base/regmap/Kconfig                        |   6 +-
 drivers/base/regmap/Makefile                       |   1 +
 drivers/base/regmap/regmap-spi-avmm.c              | 719 +++++++++++++++++++++
 drivers/mfd/Kconfig                                |  13 +
 drivers/mfd/Makefile                               |   2 +
 drivers/mfd/intel-m10-bmc.c                        | 169 +++++
 include/linux/mfd/intel-m10-bmc.h                  |  57 ++
 include/linux/regmap.h                             |  36 ++
 9 files changed, 1017 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-intel-m10-bmc
 create mode 100644 drivers/base/regmap/regmap-spi-avmm.c
 create mode 100644 drivers/mfd/intel-m10-bmc.c
 create mode 100644 include/linux/mfd/intel-m10-bmc.h
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH v4 1/2 regmap: add Intel SPI Slave to AVMM Bus Bridge support

This patch add support for regmap APIs that are intended to be used by the drivers of some SPI slave chips which integrate the "SPI slave to Avalon Master Bridge" (spi-avmm) IP.

The spi-avmm IP acts as a bridge to convert encoded streams of bytes from the host to the chip's internal register read/write on Avalon bus. The driver implements the register read/write operations for a generic SPI master to access the sub devices behind spi-avmm bridge.

---
v2: Split out the regmap-spi-avmm as an independent module.
v3: rewrite the rx flow, now the driver reads one word and parse it
immediately into trans_buf. This simplifies the rx handling.
collapse some function calls.
Add bounds checking every time we fill trans_buf & phy_buf. Try to configure spi mode on regmap init.
delete regmap_bus.reg_write/reg_read callbacks. squash the bug fixing patch.
improve comments and minor fixes.
v4: collapse the phy buf padding code in br_pkt_phy_tx_prepare().

---
 drivers/base/regmap/Kconfig           |   6 +-
 drivers/base/regmap/Makefile          |   1 +
 drivers/base/regmap/regmap-spi-avmm.c | 719 ++++++++++++++++++++++++++++++++++
 include/linux/regmap.h                |  36 ++
 4 files changed, 761 insertions(+), 1 deletion(-)
 create mode 100644 drivers/base/regmap/regmap-spi-avmm.c
drivers/base/regmap/Kconfig +5 -1
index 1d1d26b..bcb90d8 100644
@@ -4,7 +4,7 @@
 # subsystems should select the appropriate symbols.
 
 config REGMAP
-	default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SOUNDWIRE || REGMAP_SCCB || REGMAP_I3C)
+	default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SOUNDWIRE || REGMAP_SCCB || REGMAP_I3C || REGMAP_SPI_AVMM)
 	select IRQ_DOMAIN if REGMAP_IRQ
 	bool
 
@@ -53,3 +53,7 @@ config REGMAP_SCCB
 config REGMAP_I3C
 	tristate
 	depends on I3C
+
+config REGMAP_SPI_AVMM
+	tristate
+	depends on SPI
drivers/base/regmap/Makefile +1 -0
index ff6c7d8..ac1b69e 100644
@@ -17,3 +17,4 @@ obj-$(CONFIG_REGMAP_W1) += regmap-w1.o
 obj-$(CONFIG_REGMAP_SOUNDWIRE) += regmap-sdw.o
 obj-$(CONFIG_REGMAP_SCCB) += regmap-sccb.o
 obj-$(CONFIG_REGMAP_I3C) += regmap-i3c.o
+obj-$(CONFIG_REGMAP_SPI_AVMM) += regmap-spi-avmm.o
drivers/base/regmap/regmap-spi-avmm.c new file +719 -0

719 lines not on this page · raw message

include/linux/regmap.h +36 -0
index 1970ed5..d865d8f 100644
@@ -567,6 +567,10 @@ struct regmap *__regmap_init_sdw(struct sdw_slave *sdw,
 				 const struct regmap_config *config,
 				 struct lock_class_key *lock_key,
 				 const char *lock_name);
+struct regmap *__regmap_init_spi_avmm(struct spi_device *spi,
+				      const struct regmap_config *config,
+				      struct lock_class_key *lock_key,
+				      const char *lock_name);
 
 struct regmap *__devm_regmap_init(struct device *dev,
 				  const struct regmap_bus *bus,
@@ -620,6 +624,10 @@ struct regmap *__devm_regmap_init_i3c(struct i3c_device *i3c,
 				 const struct regmap_config *config,
 				 struct lock_class_key *lock_key,
 				 const char *lock_name);
+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);
 /*
  * Wrapper for regmap_init macros to include a unique lockdep key and name
  * for each call. No-op if CONFIG_LOCKDEP is not set.
@@ -806,6 +814,19 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
 	__regmap_lockdep_wrapper(__regmap_init_sdw, #config,		\
 				sdw, config)
 
+/**
+ * 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.
+ */
+#define regmap_init_spi_avmm(spi, config)					\
+	__regmap_lockdep_wrapper(__regmap_init_spi_avmm, #config,		\
+				 spi, config)
 
 /**
  * devm_regmap_init() - Initialise managed register map
@@ -993,6 +1014,21 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
 	__regmap_lockdep_wrapper(__devm_regmap_init_i3c, #config,	\
 				i3c, config)
 
+/**
+ * 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)
+
 int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk);
 void regmap_mmio_detach_clk(struct regmap *map);
 void regmap_exit(struct regmap *map);
Signature · 1 line
2.7.4
author maintainer
#2 lore raw

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

In reply to 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 direct register access from FPGA, the "SPI slave to Avalon Master Bridge" (spi-avmm) IP is integrated in the chip. It converts encoded streams of bytes from the host to the internal register read/write on Avalon bus. So This driver uses the regmap-spi-avmm for register accessing.

---
v2: Split out the regmap-spi-avmm part.
Rename the file intel-m10-bmc-main.c to intel-m10-bmc.c, cause
there is only one source file left for this module now.
v3: add the sub devices in mfd_cell.
some minor fixes.
v4: no change.

---
 .../ABI/testing/sysfs-driver-intel-m10-bmc         |  15 ++
 drivers/mfd/Kconfig                                |  13 ++
 drivers/mfd/Makefile                               |   2 +
 drivers/mfd/intel-m10-bmc.c                        | 169 +++++++++++++++++++++
 include/linux/mfd/intel-m10-bmc.h                  |  57 +++++++
 5 files changed, 256 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-intel-m10-bmc
 create mode 100644 drivers/mfd/intel-m10-bmc.c
 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..979a2d6
@@ -0,0 +1,15 @@
+What:		/sys/bus/spi/devices/.../bmc_version
+Date:		June 2020
+KernelVersion:	5.10
+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.10
+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 33df083..57745f5 100644
@@ -2118,5 +2118,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_SPI_AVMM
+	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 +2 -0
index a60e5f8..dd2cc7b 100644
@@ -264,3 +264,5 @@ obj-$(CONFIG_MFD_STMFX) 	+= stmfx.o
 obj-$(CONFIG_MFD_KHADAS_MCU) 	+= khadas-mcu.o
 
 obj-$(CONFIG_SGI_MFD_IOC3)	+= ioc3.o
+
+obj-$(CONFIG_MFD_INTEL_M10_BMC)   += intel-m10-bmc.o
drivers/mfd/intel-m10-bmc.c new file +169 -0

169 lines not on this page · raw message

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
#3 lore raw

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

Quoted 3 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.

Nit: "Intel MAX 10"

Quoted 1 line

This BMC chip is connected to FPGA by a SPI bus. To provide direct

Nit: "to *the* FPGA"

Quoted 1 line

register access from FPGA, the "SPI slave to Avalon Master Bridge"

Nit: "from *the* FPGA"

Quoted 2 lines

(spi-avmm) IP is integrated in the chip. It converts encoded streams of bytes from the host to the internal register read/write on Avalon bus.

Nit: "on *the* Avalon bus"

Quoted 85 lines

So This driver uses the regmap-spi-avmm for register accessing.

---
v2: Split out the regmap-spi-avmm part.
Rename the file intel-m10-bmc-main.c to intel-m10-bmc.c, cause
there is only one source file left for this module now.
v3: add the sub devices in mfd_cell.
some minor fixes.
v4: no change.

---
 .../ABI/testing/sysfs-driver-intel-m10-bmc         |  15 ++
 drivers/mfd/Kconfig                                |  13 ++
 drivers/mfd/Makefile                               |   2 +
 drivers/mfd/intel-m10-bmc.c                        | 169 +++++++++++++++++++++
 include/linux/mfd/intel-m10-bmc.h                  |  57 +++++++
 5 files changed, 256 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-intel-m10-bmc
 create mode 100644 drivers/mfd/intel-m10-bmc.c
 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..979a2d6
@@ -0,0 +1,15 @@
+What:		/sys/bus/spi/devices/.../bmc_version
+Date:		June 2020
+KernelVersion:	5.10
+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.10
+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 33df083..57745f5 100644
@@ -2118,5 +2118,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_SPI_AVMM
+	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 +2 -0
index a60e5f8..dd2cc7b 100644
@@ -264,3 +264,5 @@ obj-$(CONFIG_MFD_STMFX) 	+= stmfx.o
 obj-$(CONFIG_MFD_KHADAS_MCU) 	+= khadas-mcu.o
 
 obj-$(CONFIG_SGI_MFD_IOC3)	+= ioc3.o
+
+obj-$(CONFIG_MFD_INTEL_M10_BMC)   += intel-m10-bmc.o
drivers/mfd/intel-m10-bmc.c new file +0 -0
new file mode 100644
index 0000000..0dfd73a

drivers/mfd/intel-m10-bmc.c line 3

Quoted 3 lines
drivers/mfd/intel-m10-bmc.c new file +3 -0
@@ -0,0 +1,169 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Intel Max10 Board Management Controller chip

"Intel MAX 10"

drivers/mfd/intel-m10-bmc.c line 6

Quoted 2 lines
drivers/mfd/intel-m10-bmc.c new file +2 -0
+ * Copyright (C) 2018-2020 Intel Corporation. All rights reserved.
+ *

Remove this line.

drivers/mfd/intel-m10-bmc.c line 15

Quoted 9 lines
drivers/mfd/intel-m10-bmc.c new file +9 -0
+ */
+#include <linux/bitfield.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/mfd/core.h>
+#include <linux/mfd/intel-m10-bmc.h>
+#include <linux/mutex.h>
+#include <linux/regmap.h>
+#include <linux/spi/spi.h>

Alphabetical.

drivers/mfd/intel-m10-bmc.c line 19

Quoted 3 lines
drivers/mfd/intel-m10-bmc.c new file +3 -0
+enum m10bmc_type {
+	M10_N3000,
+};

Seems over-kill. Will there be others?

drivers/mfd/intel-m10-bmc.c line 30

Quoted 10 lines
drivers/mfd/intel-m10-bmc.c new file +10 -0
+static struct mfd_cell m10bmc_pacn3000_subdevs[] = {
+	{
+		.name = "n3000bmc-hwmon",
+	},
+	{
+		.name = "n3000bmc-pkvl",
+	},
+	{
+		.name = "m10bmc-secure",
+	},

Each entry on one line please.

drivers/mfd/intel-m10-bmc.c line 28

Quoted 1 line
drivers/mfd/intel-m10-bmc.c new file +1 -0
+

Remove this line.

drivers/mfd/intel-m10-bmc.c line 43

Quoted 12 lines
drivers/mfd/intel-m10-bmc.c new file +12 -0
+};
+
+static struct regmap_config intel_m10bmc_regmap_config = {
+	.reg_bits = 32,
+	.val_bits = 32,
+	.reg_stride = 4,
+	.max_register = M10BMC_MEM_END,
+};
+
+static ssize_t bmc_version_show(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{

Does this line up to the '(' in code?

drivers/mfd/intel-m10-bmc.c line 52

Quoted 9 lines
drivers/mfd/intel-m10-bmc.c new file +9 -0
+	struct intel_m10bmc *m10bmc = dev_get_drvdata(dev);
+	unsigned int val;
+	int ret;
+
+	ret = m10bmc_sys_read(m10bmc, M10BMC_BUILD_VER, &val);
+	if (ret)
+		return ret;
+
+	return sprintf(buf, "0x%x\n", val);

Is this safe? Have you considered snprintf()?

Quoted 5 lines
drivers/mfd/intel-m10-bmc.c new file +5 -0
+}
+static DEVICE_ATTR_RO(bmc_version);
+
+static ssize_t bmcfw_version_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)

drivers/mfd/intel-m10-bmc.c line 67

Quoted 10 lines
drivers/mfd/intel-m10-bmc.c new file +10 -0
+{
+	struct intel_m10bmc *max10 = dev_get_drvdata(dev);
+	unsigned int val;
+	int ret;
+
+	ret = m10bmc_sys_read(max10, NIOS2_FW_VERSION, &val);
+	if (ret)
+		return ret;
+
+	return sprintf(buf, "0x%x\n", val);

As above.

drivers/mfd/intel-m10-bmc.c line 75

Quoted 8 lines
drivers/mfd/intel-m10-bmc.c new file +8 -0
+}
+static DEVICE_ATTR_RO(bmcfw_version);
+
+static struct attribute *m10bmc_attrs[] = {
+	&dev_attr_bmc_version.attr,
+	&dev_attr_bmcfw_version.attr,
+	NULL,
+};

Can this be const?

drivers/mfd/intel-m10-bmc.c line 79

Quoted 3 lines
drivers/mfd/intel-m10-bmc.c new file +3 -0
+static struct attribute_group m10bmc_attr_group = {
+	.attrs = m10bmc_attrs,
+};

Can this be const?

drivers/mfd/intel-m10-bmc.c line 83

Quoted 3 lines
drivers/mfd/intel-m10-bmc.c new file +3 -0
+static const struct attribute_group *m10bmc_dev_groups[] = {
+	&m10bmc_attr_group,
+	NULL

Comma (like above).

drivers/mfd/intel-m10-bmc.c line 92

Quoted 9 lines
drivers/mfd/intel-m10-bmc.c new file +9 -0
+};
+
+static int check_m10bmc_version(struct intel_m10bmc *m10bmc)
+{
+	unsigned int v;
+
+	if (m10bmc_raw_read(m10bmc, M10BMC_LEGACY_SYS_BASE + M10BMC_BUILD_VER,
+			    &v))
+		return -ENODEV;

Please break functions out of if statements.

Does m10bmc_raw_read() return 0 on success?

Seems odd for a read function.

drivers/mfd/intel-m10-bmc.c line 97

Quoted 4 lines
drivers/mfd/intel-m10-bmc.c new file +4 -0
+	if (v != 0xffffffff) {
+		dev_err(m10bmc->dev, "bad version M10BMC detected\n");
+		return -ENODEV;
+	}

The only acceptable version is -1?

drivers/mfd/intel-m10-bmc.c line 107

Quoted 9 lines
drivers/mfd/intel-m10-bmc.c new file +9 -0
+	return 0;
+}
+
+static int intel_m10_bmc_spi_probe(struct spi_device *spi)
+{
+	const struct spi_device_id *id = spi_get_device_id(spi);
+	struct device *dev = &spi->dev;
+	struct mfd_cell *cells;
+	struct intel_m10bmc *m10bmc;

Prefer the generic 'ddata'.

Quoted 22 lines
drivers/mfd/intel-m10-bmc.c new file +22 -0
+	int ret, n_cell;
+
+	m10bmc = devm_kzalloc(dev, sizeof(*m10bmc), GFP_KERNEL);
+	if (!m10bmc)
+		return -ENOMEM;
+
+	m10bmc->dev = dev;
+
+	m10bmc->regmap =
+		devm_regmap_init_spi_avmm(spi, &intel_m10bmc_regmap_config);
+	if (IS_ERR(m10bmc->regmap)) {
+		ret = PTR_ERR(m10bmc->regmap);
+		dev_err(dev, "Failed to allocate regmap: %d\n", ret);
+		return ret;
+	}
+
+	spi_set_drvdata(spi, m10bmc);
+
+	ret = check_m10bmc_version(m10bmc);
+	if (ret) {
+		dev_err(dev, "Failed to identify m10bmc hardware\n");
+		return ret;

drivers/mfd/intel-m10-bmc.c line 139

Quoted 10 lines
drivers/mfd/intel-m10-bmc.c new file +10 -0
+	}
+
+	switch (id->driver_data) {
+	case M10_N3000:
+		cells = m10bmc_pacn3000_subdevs;
+		n_cell = ARRAY_SIZE(m10bmc_pacn3000_subdevs);
+		break;
+	default:
+		return -ENODEV;
+	}

Will there be other versions?

Quoted 13 lines
drivers/mfd/intel-m10-bmc.c new file +13 -0
+	ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, cells, n_cell,
+				   NULL, 0, NULL);
+	if (ret)
+		dev_err(dev, "Failed to register sub-devices: %d\n", ret);
+
+	return ret;
+}
+
+static const struct spi_device_id m10bmc_spi_id[] = {
+	{ "m10-n3000", M10_N3000 },
+	{ }
+};
+MODULE_DEVICE_TABLE(spi, m10bmc_spi_id);

drivers/mfd/intel-m10-bmc.c line 163

Quoted 10 lines
drivers/mfd/intel-m10-bmc.c new file +10 -0
+
+static struct spi_driver intel_m10bmc_spi_driver = {
+	.driver = {
+		.name = "intel-m10-bmc",
+		.dev_groups = m10bmc_dev_groups,
+	},
+	.probe = intel_m10_bmc_spi_probe,
+	.id_table = m10bmc_spi_id,
+};
+

Remove this line.

drivers/mfd/intel-m10-bmc.c line 166

Quoted 3 lines
drivers/mfd/intel-m10-bmc.c new file +3 -0
+module_spi_driver(intel_m10bmc_spi_driver);
+
+MODULE_DESCRIPTION("Intel Max10 BMC Device Driver");

"Intel MAX 10"

include/linux/mfd/intel-m10-bmc.h line 3

Quoted 12 lines
drivers/mfd/intel-m10-bmc.c new file +3 -0
+MODULE_AUTHOR("Intel Corporation");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("spi:intel-m10-bmc");
include/linux/mfd/intel-m10-bmc.h new file +3 -0
new file mode 100644
index 0000000..4979756
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Driver Header File for Intel Max10 Board Management Controller chip.

Please drop the "Driver Header File for" part.

include/linux/mfd/intel-m10-bmc.h line 5

Quoted 2 lines
include/linux/mfd/intel-m10-bmc.h new file +2 -0
+ * Copyright (C) 2018-2020 Intel Corporation, Inc.
+ *

Remove this line.

include/linux/mfd/intel-m10-bmc.h line 9

Quoted 3 lines
include/linux/mfd/intel-m10-bmc.h new file +3 -0
+ */
+#ifndef __INTEL_M10_BMC_H
+#define __INTEL_M10_BMC_H

"__MFD_INTEL..."

Quoted 5 lines
include/linux/mfd/intel-m10-bmc.h new file +5 -0
+#include <linux/regmap.h>
+
+#define M10BMC_LEGACY_SYS_BASE	0x300400
+#define M10BMC_SYS_BASE		0x300800
+#define M10BMC_MEM_END		0x200000fc

include/linux/mfd/intel-m10-bmc.h line 25

Quoted 10 lines
include/linux/mfd/intel-m10-bmc.h new file +10 -0
+
+/* Register offset of system registers */
+#define NIOS2_FW_VERSION	0x0
+#define M10BMC_TEST_REG		0x3c
+#define M10BMC_BUILD_VER	0x68
+#define M10BMC_VER_MAJOR_MSK	GENMASK(23, 16)
+#define M10BMC_VER_PCB_INFO_MSK	GENMASK(31, 24)
+
+/**
+ * struct intel_m10bmc - Intel Max10 BMC MFD device private data structure

"Intel MAX 10 BMC parent driver data structure"

Quoted 20 lines
include/linux/mfd/intel-m10-bmc.h new file +20 -0
+ * @dev: this device
+ * @regmap: the regmap used to access registers by m10bmc itself
+ */
+struct intel_m10bmc {
+	struct device *dev;
+	struct regmap *regmap;
+};
+
+/*
+ * register access helper functions.
+ *
+ * m10bmc_raw_read - read m10bmc register per addr
+ * m10bmc_sys_read - read m10bmc system register per offset
+ */
+static inline int
+m10bmc_raw_read(struct intel_m10bmc *m10bmc, unsigned int addr,
+		unsigned int *val)
+{
+	int ret;
+

include/linux/mfd/intel-m10-bmc.h line 55

Quoted 10 lines
include/linux/mfd/intel-m10-bmc.h new file +10 -0
+	ret = regmap_read(m10bmc->regmap, addr, val);
+	if (ret)
+		dev_err(m10bmc->dev, "fail to read raw reg %x: %d\n",
+			addr, ret);
+
+	return ret;
+}
+
+#define m10bmc_sys_read(m10bmc, offset, val) \
+	m10bmc_raw_read(m10bmc, M10BMC_SYS_BASE + (offset), val)

No unnecessary abstractions.

Just use the Regmap API directly please.

Quoted 1 line
include/linux/mfd/intel-m10-bmc.h new file +1 -0
+#endif /* __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
reviewer
#4 lore raw

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

Quoted 13 lines

drivers/mfd/intel-m10-bmc.c line 92

Quoted 9 lines
drivers/mfd/intel-m10-bmc.c new file +8 -0
+
+static int check_m10bmc_version(struct intel_m10bmc *m10bmc)
+{
+	unsigned int v;
+
+	if (m10bmc_raw_read(m10bmc, M10BMC_LEGACY_SYS_BASE + M10BMC_BUILD_VER,
+			    &v))
+		return -ENODEV;

Please break functions out of if statements.

Does m10bmc_raw_read() return 0 on success?

Quoted 7 lines

Seems odd for a read function.

drivers/mfd/intel-m10-bmc.c line 97

Quoted 4 lines
drivers/mfd/intel-m10-bmc.c new file +4 -0
+	if (v != 0xffffffff) {
+		dev_err(m10bmc->dev, "bad version M10BMC detected\n");
+		return -ENODEV;
+	}

The only acceptable version is -1?

I ran into this in testing.  This is a check if the board is using a very old legacy bmc version. The M10BMC_LEGACY_SYS_BASE is the offset to this old block of mmio regs.  On the old boards, v would have not been f's, on the current boards it is f's. The check is necessary because future calls use the M10BMC_SYS_BASE offset which was not valid on the old boards.

Tom

#5 lore raw

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

Quoted 21 lines · Tom Rix
Quoted 13 lines

drivers/mfd/intel-m10-bmc.c line 92

Quoted 9 lines
drivers/mfd/intel-m10-bmc.c new file +8 -0
+
+static int check_m10bmc_version(struct intel_m10bmc *m10bmc)
+{
+	unsigned int v;
+
+	if (m10bmc_raw_read(m10bmc, M10BMC_LEGACY_SYS_BASE + M10BMC_BUILD_VER,
+			    &v))
+		return -ENODEV;

Please break functions out of if statements.

Does m10bmc_raw_read() return 0 on success?

Quoted 7 lines

Seems odd for a read function.

drivers/mfd/intel-m10-bmc.c line 97

Quoted 4 lines
drivers/mfd/intel-m10-bmc.c new file +4 -0
+	if (v != 0xffffffff) {
+		dev_err(m10bmc->dev, "bad version M10BMC detected\n");
+		return -ENODEV;
+	}

The only acceptable version is -1?

Quoted 6 lines

I ran into this in testing.  This is a check if the board is using a very old legacy bmc version. The M10BMC_LEGACY_SYS_BASE is the offset to this old block of mmio regs.  On the old boards, v would have not been f's, on the current boards it is f's. The check is necessary because future calls use the M10BMC_SYS_BASE offset which was not valid on the old boards.

This should be made more clear. Either as a comment or as a define.

Preferably both!

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

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

In reply to Lee Jones

Thanks for your comments, I'll fix them. Some comments inline.

Quoted 8 lines · Lee Jones

drivers/mfd/intel-m10-bmc.c line 19

Quoted 3 lines · Xu Yilun
drivers/mfd/intel-m10-bmc.c new file +3 -0
+enum m10bmc_type {
+	M10_N3000,
+};

Seems over-kill. Will there be others?

There will be another version of the BMC which support the Intel PAC D5005. The functionalities are similar with N3000. So I defined the device type enum here.

Quoted 5 lines

drivers/mfd/intel-m10-bmc.c line 43

Quoted 3 lines
drivers/mfd/intel-m10-bmc.c new file +3 -0
+static ssize_t bmc_version_show(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{

Does this line up to the '(' in code?

Yes, It does.

Quoted 12 lines

drivers/mfd/intel-m10-bmc.c line 52

Quoted 10 lines
drivers/mfd/intel-m10-bmc.c new file +9 -0
+	struct intel_m10bmc *m10bmc = dev_get_drvdata(dev);
+	unsigned int val;
+	int ret;
+
+	ret = m10bmc_sys_read(m10bmc, M10BMC_BUILD_VER, &val);
+	if (ret)
+		return ret;
+
+	return sprintf(buf, "0x%x\n", val);

Is this safe? Have you considered snprintf()?

It formats a 32 bits value to string, so the strlen should be 8 chars at most. So I think it should be safe here.

I see in Documentation/filesystems/sysfs.rst:
- show() must not use snprintf() when formatting the value to be returned to user space. If you can guarantee that an overflow will never happen you can use sprintf() otherwise you must use scnprintf().

And seeing from this mail https://lkml.org/lkml/2019/4/25/1050
Greg is discouraging use of scnprintf for sysfs attributes where it's not needed.

Quoted 10 lines

drivers/mfd/intel-m10-bmc.c line 75

Quoted 8 lines
drivers/mfd/intel-m10-bmc.c new file +8 -0
+}
+static DEVICE_ATTR_RO(bmcfw_version);
+
+static struct attribute *m10bmc_attrs[] = {
+	&dev_attr_bmc_version.attr,
+	&dev_attr_bmcfw_version.attr,
+	NULL,
+};

Can this be const?

Seems we can not const this pointer or this array.

If we const the array, static const struct attribute *m10bmc_attrs[], then:
error: initialization from incompatible pointer type

If we const the pointer, static struct attribute * const m10bmc_attrs[], then:
warning: initialization discards ‘const’ qualifier from pointer
target type

Quoted 6 lines

drivers/mfd/intel-m10-bmc.c line 79

Quoted 4 lines
drivers/mfd/intel-m10-bmc.c new file +3 -0
+static struct attribute_group m10bmc_attr_group = {
+	.attrs = m10bmc_attrs,
+};

Can this be const?

Yes, we can const it.

Quoted 15 lines

drivers/mfd/intel-m10-bmc.c line 92

Quoted 12 lines
drivers/mfd/intel-m10-bmc.c new file +10 -0
+static const struct attribute_group *m10bmc_dev_groups[] = {
+	&m10bmc_attr_group,
+	NULL
 
+static int check_m10bmc_version(struct intel_m10bmc *m10bmc)
+{
+	unsigned int v;
+
+	if (m10bmc_raw_read(m10bmc, M10BMC_LEGACY_SYS_BASE + M10BMC_BUILD_VER,
+			    &v))
+		return -ENODEV;

Please break functions out of if statements.

Quoted 1 line

Does m10bmc_raw_read() return 0 on success?

Yes, this function just wrappered the regmap_read()

Quoted 9 lines

Seems odd for a read function.

drivers/mfd/intel-m10-bmc.c line 97

Quoted 4 lines
drivers/mfd/intel-m10-bmc.c new file +4 -0
+	if (v != 0xffffffff) {
+		dev_err(m10bmc->dev, "bad version M10BMC detected\n");
+		return -ENODEV;
+	}

The only acceptable version is -1?

As mentioned by Tom, this is a check if the board is using a very old legacy bmc version, the driver doesn't mean to support this old legacy bmc version.

Quoted 9 lines

drivers/mfd/intel-m10-bmc.c line 139

Quoted 7 lines
drivers/mfd/intel-m10-bmc.c new file +7 -0
+	case M10_N3000:
+		cells = m10bmc_pacn3000_subdevs;
+		n_cell = ARRAY_SIZE(m10bmc_pacn3000_subdevs);
+		break;
+	default:
+		return -ENODEV;
+	}

Will there be other versions?

There will be a M10_D5005, we haven't fully prepared the code yet, but I mean to reserve the place for it.

Quoted 22 lines
Quoted 9 lines

+ * m10bmc_raw_read - read m10bmc register per addr
+ * m10bmc_sys_read - read m10bmc system register per offset
+ */

include/linux/mfd/intel-m10-bmc.h new file +6 -0
+static inline int
+m10bmc_raw_read(struct intel_m10bmc *m10bmc, unsigned int addr,
+		unsigned int *val)
+{
+	int ret;
+

include/linux/mfd/intel-m10-bmc.h line 55

Quoted 10 lines
include/linux/mfd/intel-m10-bmc.h new file +10 -0
+	ret = regmap_read(m10bmc->regmap, addr, val);
+	if (ret)
+		dev_err(m10bmc->dev, "fail to read raw reg %x: %d\n",
+			addr, ret);
+
+	return ret;
+}
+
+#define m10bmc_sys_read(m10bmc, offset, val) \
+	m10bmc_raw_read(m10bmc, M10BMC_SYS_BASE + (offset), val)

No unnecessary abstractions.

Quoted 1 line

Just use the Regmap API directly please.

Could we keep the 2 definition?

For m10bmc_raw_read(), we make it to help print some error info if regmap RW fail. So we don't have to write "if (ret) dev_err" every time we use regmap.

For m10bmc_sys_read(), the offset of BMC system registers could be configured by HW developers (The MAX 10 is an CPLD, it could be easily reprogrammed). And the HW SPEC will not add the offset when describing the addresses of system registers. So:
1. It makes the definition of system registers in code align with HW SPEC.
2. It makes developers easier to make changes when the offset is adjusted in HW (I've been told by HW guys, it is sometimes necessary to adjust the offset when changing RTL, required by Altera EDA tool - Quartus).

Thanks,
Yilun

Quoted 6 lines
Signature · 5 lines
-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
#7 lore raw

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

Quoted 10 lines
Quoted 10 lines

drivers/mfd/intel-m10-bmc.c line 92

Quoted 7 lines
drivers/mfd/intel-m10-bmc.c new file +7 -0
+static int check_m10bmc_version(struct intel_m10bmc *m10bmc)
+{
+	unsigned int v;
+
+	if (m10bmc_raw_read(m10bmc, M10BMC_LEGACY_SYS_BASE + M10BMC_BUILD_VER,
+			    &v))
+		return -ENODEV;

Please break functions out of if statements.

Quoted 3 lines
Quoted 1 line

Does m10bmc_raw_read() return 0 on success?

Yes, this function just wrappered the regmap_read()

Avoid unnecessarily wrapping functions if possible.

Quoted 9 lines
Quoted 8 lines

Seems odd for a read function.

drivers/mfd/intel-m10-bmc.c line 97

Quoted 4 lines
drivers/mfd/intel-m10-bmc.c new file +4 -0
+	if (v != 0xffffffff) {
+		dev_err(m10bmc->dev, "bad version M10BMC detected\n");
+		return -ENODEV;
+	}

The only acceptable version is -1?

Quoted 3 lines

As mentioned by Tom, this is a check if the board is using a very old legacy bmc version, the driver doesn't mean to support this old legacy bmc version.

Please add a descriptive comment and define the value.

Quoted 22 lines
Quoted 22 lines
Quoted 9 lines

+ * m10bmc_raw_read - read m10bmc register per addr
+ * m10bmc_sys_read - read m10bmc system register per offset
+ */

include/linux/mfd/intel-m10-bmc.h new file +6 -0
+static inline int
+m10bmc_raw_read(struct intel_m10bmc *m10bmc, unsigned int addr,
+		unsigned int *val)
+{
+	int ret;
+

include/linux/mfd/intel-m10-bmc.h line 55

Quoted 10 lines
include/linux/mfd/intel-m10-bmc.h new file +10 -0
+	ret = regmap_read(m10bmc->regmap, addr, val);
+	if (ret)
+		dev_err(m10bmc->dev, "fail to read raw reg %x: %d\n",
+			addr, ret);
+
+	return ret;
+}
+
+#define m10bmc_sys_read(m10bmc, offset, val) \
+	m10bmc_raw_read(m10bmc, M10BMC_SYS_BASE + (offset), val)

No unnecessary abstractions.

Quoted 7 lines
Quoted 1 line

Just use the Regmap API directly please.

Could we keep the 2 definition?

For m10bmc_raw_read(), we make it to help print some error info if regmap RW fail. So we don't have to write "if (ret) dev_err" every time we use regmap.

How many call sites are there?

Quoted 8 lines

For m10bmc_sys_read(), the offset of BMC system registers could be configured by HW developers (The MAX 10 is an CPLD, it could be easily reprogrammed). And the HW SPEC will not add the offset when describing the addresses of system registers. So:
1. It makes the definition of system registers in code align with HW SPEC.
2. It makes developers easier to make changes when the offset is adjusted in HW (I've been told by HW guys, it is sometimes necessary to adjust the offset when changing RTL, required by Altera EDA tool - Quartus).

Make sure you justify this for the function(s) you keep.

I'll take a closer look on the next submission.

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
#8 lore raw

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

Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 9 lines

+ * m10bmc_raw_read - read m10bmc register per addr
+ * m10bmc_sys_read - read m10bmc system register per offset
+ */

include/linux/mfd/intel-m10-bmc.h new file +6 -0
+static inline int
+m10bmc_raw_read(struct intel_m10bmc *m10bmc, unsigned int addr,
+		unsigned int *val)
+{
+	int ret;
+

include/linux/mfd/intel-m10-bmc.h line 55

Quoted 10 lines
include/linux/mfd/intel-m10-bmc.h new file +10 -0
+	ret = regmap_read(m10bmc->regmap, addr, val);
+	if (ret)
+		dev_err(m10bmc->dev, "fail to read raw reg %x: %d\n",
+			addr, ret);
+
+	return ret;
+}
+
+#define m10bmc_sys_read(m10bmc, offset, val) \
+	m10bmc_raw_read(m10bmc, M10BMC_SYS_BASE + (offset), val)

No unnecessary abstractions.

Just use the Regmap API directly please.

Quoted 7 lines
Quoted 5 lines

Could we keep the 2 definition?

For m10bmc_raw_read(), we make it to help print some error info if regmap RW fail. So we don't have to write "if (ret) dev_err" every time we use regmap.

How many call sites are there?

There are about 20 calls of the register read in m10bmc base driver and sub device drivers. Most of them calls m10bmc_sys_read().
I prefer to keep the function for unified error log, but I'm also good to follow your opinion. How do you think?

I also realize that it is not necessary that we define so many m10bmc_raw_bulk_read/bulk_write/update_bits ... which are not frequently used. We could change them.

Quoted 11 lines
Quoted 9 lines

For m10bmc_sys_read(), the offset of BMC system registers could be configured by HW developers (The MAX 10 is an CPLD, it could be easily reprogrammed). And the HW SPEC will not add the offset when describing the addresses of system registers. So:
1. It makes the definition of system registers in code align with HW SPEC.
2. It makes developers easier to make changes when the offset is adjusted in HW (I've been told by HW guys, it is sometimes necessary to adjust the offset when changing RTL, required by Altera EDA tool - Quartus).

Make sure you justify this for the function(s) you keep.

Yes, I could add some comments.

Thanks,
Yilun

#9 lore raw

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

Quoted 30 lines · Xu Yilun
Quoted 30 lines
Quoted 29 lines
Quoted 22 lines
Quoted 9 lines

+ * m10bmc_raw_read - read m10bmc register per addr
+ * m10bmc_sys_read - read m10bmc system register per offset
+ */

include/linux/mfd/intel-m10-bmc.h new file +6 -0
+static inline int
+m10bmc_raw_read(struct intel_m10bmc *m10bmc, unsigned int addr,
+		unsigned int *val)
+{
+	int ret;
+

include/linux/mfd/intel-m10-bmc.h line 55

Quoted 10 lines
include/linux/mfd/intel-m10-bmc.h new file +10 -0
+	ret = regmap_read(m10bmc->regmap, addr, val);
+	if (ret)
+		dev_err(m10bmc->dev, "fail to read raw reg %x: %d\n",
+			addr, ret);
+
+	return ret;
+}
+
+#define m10bmc_sys_read(m10bmc, offset, val) \
+	m10bmc_raw_read(m10bmc, M10BMC_SYS_BASE + (offset), val)

No unnecessary abstractions.

Quoted 1 line

Just use the Regmap API directly please.

Could we keep the 2 definition?

For m10bmc_raw_read(), we make it to help print some error info if regmap RW fail. So we don't have to write "if (ret) dev_err" every time we use regmap.

Quoted 6 lines
Quoted 1 line

How many call sites are there?

There are about 20 calls of the register read in m10bmc base driver and sub device drivers. Most of them calls m10bmc_sys_read().
I prefer to keep the function for unified error log, but I'm also good to follow your opinion. How do you think?

Avoidable abstraction is one of my pet hates. However, unified/centralised error handling is a valid(ish) reason for abstraction to exist. Do you really need to know which read failed? Is there a case where a read from only a particular register would fail where others succeed?

Quoted 3 lines

I also realize that it is not necessary that we define so many m10bmc_raw_bulk_read/bulk_write/update_bits ... which are not frequently used. We could change them.

Yes please.

Quoted 15 lines
Quoted 10 lines
Quoted 8 lines

For m10bmc_sys_read(), the offset of BMC system registers could be configured by HW developers (The MAX 10 is an CPLD, it could be easily reprogrammed). And the HW SPEC will not add the offset when describing the addresses of system registers. So:
1. It makes the definition of system registers in code align with HW SPEC.
2. It makes developers easier to make changes when the offset is adjusted in HW (I've been told by HW guys, it is sometimes necessary to adjust the offset when changing RTL, required by Altera EDA tool - Quartus).

Make sure you justify this for the function(s) you keep.

Yes, I could add some comments.

Thanks,
Yilun

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
#10 lore raw

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

Quoted 39 lines · Lee Jones
Quoted 30 lines · Xu Yilun
Quoted 30 lines
Quoted 29 lines
Quoted 22 lines
Quoted 9 lines

+ * m10bmc_raw_read - read m10bmc register per addr
+ * m10bmc_sys_read - read m10bmc system register per offset
+ */

include/linux/mfd/intel-m10-bmc.h new file +6 -0
+static inline int
+m10bmc_raw_read(struct intel_m10bmc *m10bmc, unsigned int addr,
+		unsigned int *val)
+{
+	int ret;
+

include/linux/mfd/intel-m10-bmc.h line 55

Quoted 10 lines
include/linux/mfd/intel-m10-bmc.h new file +10 -0
+	ret = regmap_read(m10bmc->regmap, addr, val);
+	if (ret)
+		dev_err(m10bmc->dev, "fail to read raw reg %x: %d\n",
+			addr, ret);
+
+	return ret;
+}
+
+#define m10bmc_sys_read(m10bmc, offset, val) \
+	m10bmc_raw_read(m10bmc, M10BMC_SYS_BASE + (offset), val)

No unnecessary abstractions.

Quoted 1 line

Just use the Regmap API directly please.

Could we keep the 2 definition?

For m10bmc_raw_read(), we make it to help print some error info if regmap RW fail. So we don't have to write "if (ret) dev_err" every time we use regmap.

Quoted 6 lines
Quoted 1 line

How many call sites are there?

There are about 20 calls of the register read in m10bmc base driver and sub device drivers. Most of them calls m10bmc_sys_read().
I prefer to keep the function for unified error log, but I'm also good to follow your opinion. How do you think?

Quoted 5 lines

Avoidable abstraction is one of my pet hates. However, unified/centralised error handling is a valid(ish) reason for abstraction to exist. Do you really need to know which read failed? Is there a case where a read from only a particular register would fail where others succeed?

I think it do helps we know which read failed in the first place when communication error happens between FPGA & BMC.

Generally, if the error happens randomly on all registers, it may be the problem of SPI bus.

But it is possible in some case error happens on some registers while others are fine. The BMC has a internal Avalon mmio bus inside, and sub devices connect on the bus. But the sub devices may response to the bus read/write request differently according to hardware design. Once I run into a case that the sub device stucks on one particular register read for long time cause it prepares data so slowly. And the driver always timeout on that register.

Thanks,
Yilun

Quoted 7 lines
Quoted 4 lines

I also realize that it is not necessary that we define so many m10bmc_raw_bulk_read/bulk_write/update_bits ... which are not frequently used. We could change them.

Yes please.

maintainer
#11 lore raw
In reply to Xu Yilun
Quoted 8 lines · Xu Yilun

This patchset adds the regmap-spi-avmm to support the Intel SPI Slave to AVMM Bus Bridge (spi-avmm) IP block. It also implements the usercase - the driver of Intel Max10 BMC chip which integrates this IP block.

Patch #1 implements the regmap-spi-avmm.
Patch #2 implements the mfd driver of Intel Max10 BMC chip.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next

Thanks!

[1/2] regmap: add Intel SPI Slave to AVMM Bus Bridge support

      commit: 7f9fb67358a2bcaacbdfeee12e0f19e98c8bdf55
[2/2] mfd: intel-m10-bmc: add Max10 BMC chip support for Intel FPGA PAC
      commit: 53be8bbc2f4058d4a6bfff3dadf34164bcaafa87

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

#12 lore raw
Quoted 14 lines · Mark Brown
Quoted 8 lines · Xu Yilun

This patchset adds the regmap-spi-avmm to support the Intel SPI Slave to AVMM Bus Bridge (spi-avmm) IP block. It also implements the usercase - the driver of Intel Max10 BMC chip which integrates this IP block.

Patch #1 implements the regmap-spi-avmm.
Patch #2 implements the mfd driver of Intel Max10 BMC chip.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next

Quoted 7 lines

Thanks!

[1/2] regmap: add Intel SPI Slave to AVMM Bus Bridge support

      commit: 7f9fb67358a2bcaacbdfeee12e0f19e98c8bdf55

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

      commit: 53be8bbc2f4058d4a6bfff3dadf34164bcaafa87

Que? This is yet to be reviewed.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
maintainer
#13 lore raw
Quoted 6 lines · Lee Jones
Quoted 2 lines · Mark Brown

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

      commit: 53be8bbc2f4058d4a6bfff3dadf34164bcaafa87

Que? This is yet to be reviewed.

Sorry, meant to only fetch the first patch. Dropped now.

#14 lore raw
Quoted 9 lines · Mark Brown
Quoted 6 lines · Lee Jones
Quoted 2 lines · Mark Brown

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

      commit: 53be8bbc2f4058d4a6bfff3dadf34164bcaafa87

Que? This is yet to be reviewed.

Sorry, meant to only fetch the first patch. Dropped now.

Thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog