The Linux DSA driver supports both I2C and SPI as management interface by using regmaps as abstraction. barebox regmaps were not quite that powerful yet, so we rework our regmaps to support optional formatting and then use that to make the KSZ driver work with either I2C or SPI transports. This series has been tested with both an I2C-connected KSZ8563 and a SPI-connected KSZ9563, both of which are supported by the barebox KSZ9477 driver. Ahmad Fatoum (11): regmap: consolidate reg/val format into regmap_format regmap: support formatted read and write regmap: port regmap_init_spi regmap: factor out regmap cdev size calculation net: dsa: ksz9477: switch to regmap_init_spi net: dsa: ksz9477: create regmap cdev for switch registers drivers: base: regmap: introduce REGMAP_I2C dev: add dev_bus_is_spi/i2c helpers net: dsa: ksz9477: refactor to prepare i2c support regmap: i2c: use formatted I/O net: ksz9477: add I2C support drivers/base/Kconfig | 2 + drivers/base/regmap/Kconfig | 14 + drivers/base/regmap/Makefile | 5 +- drivers/base/regmap/internal.h | 35 +- drivers/base/regmap/regmap-fmt.c | 577 +++++++++++++++++++++++++++++ drivers/base/regmap/regmap-i2c.c | 50 ++- drivers/base/regmap/regmap-multi.c | 81 ++++ drivers/base/regmap/regmap-spi.c | 42 +++ drivers/base/regmap/regmap.c | 66 +++- drivers/mfd/Kconfig | 4 + drivers/net/Kconfig | 4 +- drivers/net/ksz9477.c | 189 +++------- drivers/net/ksz_common.h | 154 ++++++++ drivers/rtc/Kconfig | 1 + drivers/video/ssd1307fb.c | 4 +- include/i2c/i2c.h | 5 + include/regmap.h | 63 ++++ include/spi/spi.h | 5 + 18 files changed, 1126 insertions(+), 175 deletions(-) create mode 100644 drivers/base/regmap/Kconfig create mode 100644 drivers/base/regmap/regmap-fmt.c create mode 100644 drivers/base/regmap/regmap-multi.c create mode 100644 drivers/base/regmap/regmap-spi.c create mode 100644 drivers/net/ksz_common.h -- 2.30.2