fsi: Add regmap and refactor sbefifo
Subsystems (3)
Eddie James
maintainerv2 cover fsi: Add regmap and refactor sbefifo
The SBEFIFO hardware can now be attached over a new I2C endpoint interface called the I2C Responder (I2CR). In order to use the existing SBEFIFO driver, add a regmap driver for the FSI bus and an endpoint driver for the I2CR. Then, refactor the SBEFIFO and OCC drivers to clean up and use the new regmap driver or the I2CR interface.
Changes since v1:
- Instead of a regmap driver for the I2CR, just have a private interface driver for FSI, since SBEFIFO is likely the only user.
Eddie James (5):
regmap: Add FSI bus support
drivers: fsi: Add I2C Responder driver
drivers: fsi: Rename sbefifo and occ sources
drivers: fsi: separate char device code for occ and sbefifo
drivers: fsi: occ and sbefifo refactor
drivers/base/regmap/Kconfig | 6 +- drivers/base/regmap/Makefile | 1 + drivers/base/regmap/regmap-fsi.c | 231 ++++++ drivers/fsi/Kconfig | 32 +- drivers/fsi/Makefile | 9 +- drivers/fsi/fsi-occ.c | 766 -------------------- drivers/fsi/fsi-sbefifo.c | 1144 ------------------------------ drivers/fsi/i2cr.c | 116 +++ drivers/fsi/i2cr.h | 19 + drivers/fsi/occ-cdev.c | 157 ++++ drivers/fsi/occ.c | 536 ++++++++++++++ drivers/fsi/occ.h | 57 ++ drivers/fsi/sbefifo-cdev.c | 218 ++++++ drivers/fsi/sbefifo-fsi.c | 68 ++ drivers/fsi/sbefifo-i2c.c | 73 ++ drivers/fsi/sbefifo.c | 797 +++++++++++++++++++++ drivers/fsi/sbefifo.h | 50 ++ include/linux/regmap.h | 37 + 18 files changed, 2398 insertions(+), 1919 deletions(-) create mode 100644 drivers/base/regmap/regmap-fsi.c delete mode 100644 drivers/fsi/fsi-occ.c delete mode 100644 drivers/fsi/fsi-sbefifo.c create mode 100644 drivers/fsi/i2cr.c create mode 100644 drivers/fsi/i2cr.h create mode 100644 drivers/fsi/occ-cdev.c create mode 100644 drivers/fsi/occ.c create mode 100644 drivers/fsi/occ.h create mode 100644 drivers/fsi/sbefifo-cdev.c create mode 100644 drivers/fsi/sbefifo-fsi.c create mode 100644 drivers/fsi/sbefifo-i2c.c create mode 100644 drivers/fsi/sbefifo.c create mode 100644 drivers/fsi/sbefifo.h
Signature · 1 line
2.31.1
Eddie James
maintainerPATCH v2 1/5 regmap: Add FSI bus support
Add regmap support for the FSI bus.
--- drivers/base/regmap/Kconfig | 6 +- drivers/base/regmap/Makefile | 1 + drivers/base/regmap/regmap-fsi.c | 231 +++++++++++++++++++++++++++++++ include/linux/regmap.h | 37 +++++ 4 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 drivers/base/regmap/regmap-fsi.c
drivers/base/regmap/Kconfig +5 -1
@@ -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_SOUNDWIRE_MBQ || REGMAP_SCCB || REGMAP_I3C || REGMAP_SPI_AVMM || REGMAP_MDIO) + default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SOUNDWIRE || REGMAP_SOUNDWIRE_MBQ || REGMAP_SCCB || REGMAP_I3C || REGMAP_SPI_AVMM || REGMAP_MDIO || REGMAP_FSI) select IRQ_DOMAIN if REGMAP_IRQ select MDIO_BUS if REGMAP_MDIO bool
@@ -65,3 +65,7 @@ config REGMAP_I3C config REGMAP_SPI_AVMM tristate depends on SPI + +config REGMAP_FSI + tristate + depends on FSI
drivers/base/regmap/Makefile +1 -0
@@ -20,3 +20,4 @@ obj-$(CONFIG_REGMAP_SCCB) += regmap-sccb.o obj-$(CONFIG_REGMAP_I3C) += regmap-i3c.o obj-$(CONFIG_REGMAP_SPI_AVMM) += regmap-spi-avmm.o obj-$(CONFIG_REGMAP_MDIO) += regmap-mdio.o +obj-$(CONFIG_REGMAP_FSI) += regmap-fsi.o
drivers/base/regmap/regmap-fsi.c new file +231 -0
231 lines not on this page · raw message
include/linux/regmap.h +37 -0
@@ -24,6 +24,7 @@ struct module;struct clk ;struct device ;struct device_node ; +struct fsi_device ;struct i2c_client ;struct i3c_device ;struct irq_domain ;
@@ -628,6 +629,10 @@ 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 *__regmap_init_fsi (struct fsi_device *fsi_dev, +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,
@@ -693,6 +698,11 @@ 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); +struct regmap *__devm_regmap_init_fsi (struct fsi_device *fsi_dev, +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.
@@ -919,6 +929,19 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); __regmap_lockdep_wrapper(__regmap_init_spi_avmm, #config, \ spi, config) +/** +* regmap_init_fsi() - Initialise register map +* +* @fsi_dev: 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_fsi (fsi_dev, config) \ + __regmap_lockdep_wrapper(__regmap_init_fsi, #config, fsi_dev, \ + config) +/** * devm_regmap_init() - Initialise managed register map *
@@ -1148,6 +1171,20 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); __regmap_lockdep_wrapper(__devm_regmap_init_spi_avmm, #config, \ spi, config) +/** +* devm_regmap_init_fsi() - Initialise managed register map +* +* @fsi_dev: 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 regmap will be automatically freed by the +* device management code. + */ +#define devm_regmap_init_fsi (fsi_dev, config) \ + __regmap_lockdep_wrapper(__devm_regmap_init_fsi, #config, \ + fsi_dev, 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.31.1
Eddie James
maintainerPATCH v2 2/5 drivers: fsi: Add I2C Responder driver
In reply to Eddie JamesAdd a regmap driver for the I2C Responder (I2CR) which provides access to an FSI CFAM through an I2C endpoint device. Since no userspace access is needed, simply provide a regmap bus for the CFAM address space through the I2CR.
--- drivers/fsi/Kconfig | 6 +++ drivers/fsi/Makefile | 1 + drivers/fsi/i2cr.c | 116 +++++++++++++++++++++++++++++++++++++++++++ drivers/fsi/i2cr.h | 19 +++++++ 4 files changed, 142 insertions(+) create mode 100644 drivers/fsi/i2cr.c create mode 100644 drivers/fsi/i2cr.h
drivers/fsi/Kconfig +6 -0
@@ -67,6 +67,12 @@ config FSI_SCOM help This option enables an FSI based SCOM device driver. +config FSI_I2CR + tristate "I2C Responder device driver" + help + This option enables the I2C client driver for the IBM POWER I2C + responder which gives access to CFAM address space. + config FSI_SBEFIFO tristate "SBEFIFO FSI client device driver" depends on OF_ADDRESS
drivers/fsi/Makefile +1 -0
@@ -6,5 +6,6 @@ obj-$(CONFIG_FSI_MASTER_ASPEED) += fsi-master-aspeed.o obj-$(CONFIG_FSI_MASTER_GPIO) += fsi-master-gpio.o obj-$(CONFIG_FSI_MASTER_AST_CF) += fsi-master-ast-cf.o obj-$(CONFIG_FSI_SCOM) += fsi-scom.o +obj-$(CONFIG_FSI_I2CR) += i2cr.o obj-$(CONFIG_FSI_SBEFIFO) += fsi-sbefifo.o obj-$(CONFIG_FSI_OCC) += fsi-occ.o
drivers/fsi/i2cr.c new file +116 -0
116 lines not on this page · raw message
drivers/fsi/i2cr.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (C) IBM Corporation 2022 */ + +#ifndef DRIVERS_I2CR_H +#define DRIVERS_I2CR_H + +#include <linux/i2c.h> +#include <linux/regmap.h> + +extern const struct regmap_bus regmap_bus_i2cr; + +#define init_i2cr (client, config) \ + __regmap_lockdep_wrapper(__regmap_init, #config, &(client)->dev, ®map_bus_i2cr, \ + client, config) +#define devm_init_i2cr (client, config) \ + __regmap_lockdep_wrapper(__devm_regmap_init, #config, &(client)->dev, ®map_bus_i2cr, \ + client, config) + +#endif /* DRIVERS_I2CR_H */
Signature · 1 line
2.31.1
Eddie James
maintainerPATCH v2 3/5 drivers: fsi: Rename sbefifo and occ sources
In reply to Eddie JamesIn preparation for some refactoring and adding multiple underlying bus support for the SBEFIFO, rename the sources.
---
drivers/fsi/Makefile | 4 ++--
drivers/fsi/{fsi-occ.c => occ.c} | 0
drivers/fsi/{fsi-sbefifo.c => sbefifo.c} | 0
3 files changed, 2 insertions(+), 2 deletions(-)
rename drivers/fsi/{fsi-occ.c => occ.c} (100%)
rename drivers/fsi/{fsi-sbefifo.c => sbefifo.c} (100%)drivers/fsi/Makefile +2 -2
@@ -7,5 +7,5 @@ obj-$(CONFIG_FSI_MASTER_GPIO) += fsi-master-gpio.o obj-$(CONFIG_FSI_MASTER_AST_CF) += fsi-master-ast-cf.o obj-$(CONFIG_FSI_SCOM) += fsi-scom.o obj-$(CONFIG_FSI_I2CR) += i2cr.o -obj-$(CONFIG_FSI_SBEFIFO) += fsi-sbefifo.o -obj-$(CONFIG_FSI_OCC) += fsi-occ.o +obj-$(CONFIG_FSI_SBEFIFO) += sbefifo.o +obj-$(CONFIG_FSI_OCC) += occ.o
drivers/fsi/occ.c renamed from drivers/fsi/fsi-occ.c +0 -0
drivers/fsi/sbefifo.c renamed from drivers/fsi/fsi-sbefifo.c +0 -0
Signature · 1 line
2.31.1
Eddie James
maintainerPATCH v2 4/5 drivers: fsi: separate char device code for occ and sbefifo
In reply to Eddie James--- drivers/fsi/Makefile | 4 +- drivers/fsi/occ-cdev.c | 139 ++++++++++++++++++++++++ drivers/fsi/occ.c | 137 ----------------------- drivers/fsi/sbefifo-cdev.c | 217 +++++++++++++++++++++++++++++++++++++ drivers/fsi/sbefifo.c | 215 ------------------------------------ 5 files changed, 358 insertions(+), 354 deletions(-) create mode 100644 drivers/fsi/occ-cdev.c create mode 100644 drivers/fsi/sbefifo-cdev.c
drivers/fsi/Makefile +2 -2
@@ -7,5 +7,5 @@ obj-$(CONFIG_FSI_MASTER_GPIO) += fsi-master-gpio.o obj-$(CONFIG_FSI_MASTER_AST_CF) += fsi-master-ast-cf.o obj-$(CONFIG_FSI_SCOM) += fsi-scom.o obj-$(CONFIG_FSI_I2CR) += i2cr.o -obj-$(CONFIG_FSI_SBEFIFO) += sbefifo.o -obj-$(CONFIG_FSI_OCC) += occ.o +obj-$(CONFIG_FSI_SBEFIFO) += sbefifo.o sbefifo-cdev.o +obj-$(CONFIG_FSI_OCC) += occ.o occ-cdev.o
drivers/fsi/occ-cdev.c new file +139 -0
140 lines not on this page · raw message
drivers/fsi/occ.c +0 -137
143 lines not on this page · raw message
drivers/fsi/sbefifo-cdev.c new file +217 -0
217 lines not on this page · raw message
drivers/fsi/sbefifo.c +0 -215
221 lines not on this page · raw message
Signature · 1 line
2.31.1
Eddie James
maintainerPATCH v2 5/5 drivers: fsi: occ and sbefifo refactor
In reply to Eddie JamesRework the drivers to allow for SBEFIFO connected over FSI or I2C.
--- drivers/fsi/Kconfig | 26 +- drivers/fsi/Makefile | 6 +- drivers/fsi/occ-cdev.c | 178 ++++++----- drivers/fsi/occ.c | 495 +++++++++++++------------------ drivers/fsi/occ.h | 57 ++++ drivers/fsi/sbefifo-cdev.c | 239 +++++++-------- drivers/fsi/sbefifo-fsi.c | 68 +++++ drivers/fsi/sbefifo-i2c.c | 73 +++++ drivers/fsi/sbefifo.c | 588 ++++++++++++++----------------------- drivers/fsi/sbefifo.h | 50 ++++ 10 files changed, 920 insertions(+), 860 deletions(-) create mode 100644 drivers/fsi/occ.h create mode 100644 drivers/fsi/sbefifo-fsi.c create mode 100644 drivers/fsi/sbefifo-i2c.c create mode 100644 drivers/fsi/sbefifo.h
drivers/fsi/Kconfig +20 -6
@@ -75,15 +75,29 @@ config FSI_I2CR config FSI_SBEFIFO tristate "SBEFIFO FSI client device driver" - depends on OF_ADDRESS + select REGMAP_FSI + select SBEFIFO_CORE help - This option enables an FSI based SBEFIFO device driver. The SBEFIFO is - a pipe-like FSI device for communicating with the self boot engine - (SBE) on POWER processors. + This option enables an FSI based SBEFIFO device driver. The SBEFIFO is + a pipe-like device for communicating with the self boot engine + (SBE) on POWER processors. + +config I2C_SBEFIFO + tristate "SBEFIFO I2C client device driver" + select FSI_I2CR + select SBEFIFO_CORE + help + This option enables an I2C based SBEFIFO device driver. The SBEFIFO is + a pipe-like device for communicating with the self boot engine + (SBE) on POWER processors. + +config SBEFIFO_CORE + tristate + select FSI_OCC config FSI_OCC - tristate "OCC SBEFIFO client device driver" - depends on FSI_SBEFIFO + tristate "OCC communications driver" + depends on SBEFIFO_CORE help This option enables an SBEFIFO based On-Chip Controller (OCC) device driver. The OCC is a device embedded on a POWER processor that collects
drivers/fsi/Makefile +5 -1
@@ -7,5 +7,9 @@ obj-$(CONFIG_FSI_MASTER_GPIO) += fsi-master-gpio.o obj-$(CONFIG_FSI_MASTER_AST_CF) += fsi-master-ast-cf.o obj-$(CONFIG_FSI_SCOM) += fsi-scom.o obj-$(CONFIG_FSI_I2CR) += i2cr.o -obj-$(CONFIG_FSI_SBEFIFO) += sbefifo.o sbefifo-cdev.o obj-$(CONFIG_FSI_OCC) += occ.o occ-cdev.o + +sbefifo-core-objs := sbefifo.o sbefifo-cdev.o + +obj-$(CONFIG_FSI_SBEFIFO) += sbefifo-core.o sbefifo-fsi.o +obj-$(CONFIG_I2C_SBEFIFO) += sbefifo-core.o sbefifo-i2c.o
drivers/fsi/occ-cdev.c +98 -80
235 lines not on this page · raw message
drivers/fsi/occ.c +201 -294
732 lines not on this page · raw message
drivers/fsi/occ.h new file +57 -0
57 lines not on this page · raw message
drivers/fsi/sbefifo-cdev.c +120 -119
337 lines not on this page · raw message
drivers/fsi/sbefifo-fsi.c new file +68 -0
68 lines not on this page · raw message
drivers/fsi/sbefifo-i2c.c new file +73 -0
73 lines not on this page · raw message
drivers/fsi/sbefifo.c +228 -360
1,023 lines not on this page · raw message
drivers/fsi/sbefifo.h new file +50 -0
50 lines not on this page · raw message
Signature · 1 line
2.31.1
Mark Brown
maintainerRe: [PATCH v2 1/5] regmap: Add FSI bus support
In reply to Eddie JamesQuoted 8 lines · Eddie James
Add regmap support for the FSI bus.
Signed-off-by Eddie James <[email protected]>--- drivers/base/regmap/Kconfig | 6 +- drivers/base/regmap/Makefile | 1 + drivers/base/regmap/regmap-fsi.c | 231 +++++++++++++++++++++++++++++++ include/linux/regmap.h | 37 +++++
I thought the plan was to put this in the MFD since that's the only user?
Eddie James
maintainerRe: [PATCH v2 1/5] regmap: Add FSI bus support
Quoted 11 lines · Mark Brown
Quoted 8 lines · Eddie James
Add regmap support for the FSI bus.
Signed-off-by Eddie James <[email protected]>--- drivers/base/regmap/Kconfig | 6 +- drivers/base/regmap/Makefile | 1 + drivers/base/regmap/regmap-fsi.c | 231 +++++++++++++++++++++++++++++++ include/linux/regmap.h | 37 +++++I thought the plan was to put this in the MFD since that's the only user?
For the I2C responder regmap, yes, that's what I've done. The FSI regmap could be used anywhere in the future. We could switch a number of drivers to use the FSI regmap if desired, so I feel it's worth it to put it in the regmap properly.
Thanks,
Eddie
Mark Brown
maintainerRe: (subset) [PATCH v2 0/5] fsi: Add regmap and refactor sbefifo
In reply to Eddie JamesQuoted 11 lines · Eddie James
The SBEFIFO hardware can now be attached over a new I2C endpoint interface called the I2C Responder (I2CR). In order to use the existing SBEFIFO driver, add a regmap driver for the FSI bus and an endpoint driver for the I2CR. Then, refactor the SBEFIFO and OCC drivers to clean up and use the new regmap driver or the I2CR interface.
Changes since v1:
- Instead of a regmap driver for the I2CR, just have a private interface driver for FSI, since SBEFIFO is likely the only user.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next
Thanks!
[1/5] regmap: Add FSI bus support
commit: bf0d29fb51ff5e6c13097dbfed7b99e0e35b4a15
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
Eddie James
maintainerQuoted 5 lines · Eddie James
The SBEFIFO hardware can now be attached over a new I2C endpoint interface called the I2C Responder (I2CR). In order to use the existing SBEFIFO driver, add a regmap driver for the FSI bus and an endpoint driver for the I2CR. Then, refactor the SBEFIFO and OCC drivers to clean up and use the new regmap driver or the I2CR interface.
I'm abandoning the rest of this series in favor of an FSI master driver through the I2C responder. It makes a lot more sense to implement a master driver here because then we get all the engine drivers for free, rather than rework them to talk over i2c.
Thanks,
Eddie
Quoted 45 lines
Changes since v1:
- Instead of a regmap driver for the I2CR, just have a private interface driver for FSI, since SBEFIFO is likely the only user.Eddie James (5):
regmap: Add FSI bus support
drivers: fsi: Add I2C Responder driver
drivers: fsi: Rename sbefifo and occ sources
drivers: fsi: separate char device code for occ and sbefifo
drivers: fsi: occ and sbefifo refactordrivers/base/regmap/Kconfig | 6 +- drivers/base/regmap/Makefile | 1 + drivers/base/regmap/regmap-fsi.c | 231 ++++++ drivers/fsi/Kconfig | 32 +- drivers/fsi/Makefile | 9 +- drivers/fsi/fsi-occ.c | 766 -------------------- drivers/fsi/fsi-sbefifo.c | 1144 ------------------------------ drivers/fsi/i2cr.c | 116 +++ drivers/fsi/i2cr.h | 19 + drivers/fsi/occ-cdev.c | 157 ++++ drivers/fsi/occ.c | 536 ++++++++++++++ drivers/fsi/occ.h | 57 ++ drivers/fsi/sbefifo-cdev.c | 218 ++++++ drivers/fsi/sbefifo-fsi.c | 68 ++ drivers/fsi/sbefifo-i2c.c | 73 ++ drivers/fsi/sbefifo.c | 797 +++++++++++++++++++++ drivers/fsi/sbefifo.h | 50 ++ include/linux/regmap.h | 37 + 18 files changed, 2398 insertions(+), 1919 deletions(-)create mode 100644
drivers/base/regmap/regmap-fsi.cdelete mode 100644drivers/fsi/fsi-occ.cdelete mode 100644drivers/fsi/fsi-sbefifo.ccreate mode 100644drivers/fsi/i2cr.ccreate mode 100644drivers/fsi/i2cr.hcreate mode 100644drivers/fsi/occ-cdev.ccreate mode 100644drivers/fsi/occ.c
create mode 100644drivers/fsi/occ.h
create mode 100644drivers/fsi/sbefifo-cdev.ccreate mode 100644drivers/fsi/sbefifo-fsi.ccreate mode 100644drivers/fsi/sbefifo-i2c.ccreate mode 100644drivers/fsi/sbefifo.ccreate mode 100644drivers/fsi/sbefifo.h