mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/5] add regmap helpers for NVMEM and i2c
@ 2021-05-31  7:24 Ahmad Fatoum
  2021-05-31  7:24 ` [PATCH 1/5] regmap: implement regmap_init_i2c Ahmad Fatoum
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2021-05-31  7:24 UTC (permalink / raw)
  To: barebox

Incoming BeagleV support should support an i2c-connected PMIC and
a fuse bank for retrieval of the MAC address. On the STM32MP1, we
also support an i2c-connected PMIC and a fuse bank for MAC address.

Instead of duplicating too much code, add some helpers, so drivers can
drop common boilerplate. The relevant STM32 drivers are ported to make
use of it.

Ahmad Fatoum (5):
  regmap: implement regmap_init_i2c
  mfd: stpmic1: simplify using regmap_init_i2c
  nvmem: provider: align read/write callback prototype with upstream
  nvmem: add nvmem_regmap_register helper
  nvmem: stm32-bsec: simplify using new nvmem_regmap_register

 drivers/base/regmap/Makefile     |  1 +
 drivers/base/regmap/regmap-i2c.c | 44 +++++++++++++++
 drivers/base/regmap/regmap.c     |  5 ++
 drivers/eeprom/at24.c            | 17 ++----
 drivers/mfd/stpmic1.c            | 47 +---------------
 drivers/net/phy/mv88e6xxx/chip.c | 11 ++--
 drivers/nvmem/Makefile           |  2 +-
 drivers/nvmem/bsec.c             | 94 ++++----------------------------
 drivers/nvmem/core.c             | 14 +++--
 drivers/nvmem/eeprom_93xx46.c    | 13 ++---
 drivers/nvmem/ocotp.c            | 12 ++--
 drivers/nvmem/rave-sp-eeprom.c   | 15 ++---
 drivers/nvmem/regmap.c           | 78 ++++++++++++++++++++++++++
 drivers/nvmem/snvs_lpgpr.c       | 13 ++---
 drivers/rtc/rtc-imxdi.c          | 13 ++---
 include/linux/nvmem-provider.h   | 15 +++--
 include/regmap.h                 | 14 +++++
 17 files changed, 211 insertions(+), 197 deletions(-)
 create mode 100644 drivers/base/regmap/regmap-i2c.c
 create mode 100644 drivers/nvmem/regmap.c

-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] regmap: implement regmap_init_i2c
  2021-05-31  7:24 [PATCH 0/5] add regmap helpers for NVMEM and i2c Ahmad Fatoum
@ 2021-05-31  7:24 ` Ahmad Fatoum
  2021-05-31  7:24 ` [PATCH 2/5] mfd: stpmic1: simplify using regmap_init_i2c Ahmad Fatoum
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2021-05-31  7:24 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Linux offers a helper for creating regmaps over i2c. Add a similar
helper for barebox to ease driver porting.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/base/regmap/Makefile     |  1 +
 drivers/base/regmap/regmap-i2c.c | 44 ++++++++++++++++++++++++++++++++
 include/regmap.h                 | 13 ++++++++++
 3 files changed, 58 insertions(+)
 create mode 100644 drivers/base/regmap/regmap-i2c.c

diff --git a/drivers/base/regmap/Makefile b/drivers/base/regmap/Makefile
index ab2387037d37..b12b69531156 100644
--- a/drivers/base/regmap/Makefile
+++ b/drivers/base/regmap/Makefile
@@ -1,2 +1,3 @@
 obj-y	+= regmap.o
 obj-y	+= regmap-mmio.o
+obj-$(CONFIG_I2C)	+= regmap-i2c.o
diff --git a/drivers/base/regmap/regmap-i2c.c b/drivers/base/regmap/regmap-i2c.c
new file mode 100644
index 000000000000..88b24ae6a825
--- /dev/null
+++ b/drivers/base/regmap/regmap-i2c.c
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2021, Ahmad Fatoum, Pengutronix
+ */
+
+#include <i2c/i2c.h>
+#include <regmap.h>
+
+
+static int regmap_i2c_reg_read(void *client, unsigned int reg, unsigned int *val)
+{
+	u8 buf[1];
+	int ret;
+
+	ret = i2c_read_reg(client, reg, buf, 1);
+	if (ret != 1)
+		return ret;
+
+	*val = buf[0];
+	return 0;
+}
+
+static int regmap_i2c_reg_write(void *client, unsigned int reg, unsigned int val)
+{
+	u8 buf[] = { val & 0xff };
+	int ret;
+
+	ret = i2c_write_reg(client, reg, buf, 1);
+	if (ret != 1)
+		return ret;
+
+	return 0;
+}
+
+static const struct regmap_bus regmap_regmap_i2c_bus = {
+	.reg_write = regmap_i2c_reg_write,
+	.reg_read = regmap_i2c_reg_read,
+};
+
+struct regmap *regmap_init_i2c(struct i2c_client *client,
+			       const struct regmap_config *config)
+{
+	return  regmap_init(&client->dev, &regmap_regmap_i2c_bus, client, config);
+}
diff --git a/include/regmap.h b/include/regmap.h
index b43cd936fa61..c5cf954ad6d9 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -76,6 +76,19 @@ struct regmap *regmap_init_mmio_clk(struct device_d *dev, const char *clk_id,
 				    void __iomem *regs,
 				    const struct regmap_config *config);
 
+/**
+ * regmap_init_i2c() - Initialise i2c register map
+ *
+ * @i2c: 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.
+ */
+struct i2c_client;
+struct regmap *regmap_init_i2c(struct i2c_client *i2c,
+			       const struct regmap_config *config);
+
 /**
  * regmap_init_mmio() - Initialise register map
  *
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/5] mfd: stpmic1: simplify using regmap_init_i2c
  2021-05-31  7:24 [PATCH 0/5] add regmap helpers for NVMEM and i2c Ahmad Fatoum
  2021-05-31  7:24 ` [PATCH 1/5] regmap: implement regmap_init_i2c Ahmad Fatoum
@ 2021-05-31  7:24 ` Ahmad Fatoum
  2021-05-31  7:24 ` [PATCH 3/5] nvmem: provider: align read/write callback prototype with upstream Ahmad Fatoum
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2021-05-31  7:24 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

With the new regmap_init_i2c, we can drop opencoding the regmap
accessors for the i2c registers.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/mfd/stpmic1.c | 47 +++----------------------------------------
 1 file changed, 3 insertions(+), 44 deletions(-)

diff --git a/drivers/mfd/stpmic1.c b/drivers/mfd/stpmic1.c
index d22758bd6105..11154e742e5d 100644
--- a/drivers/mfd/stpmic1.c
+++ b/drivers/mfd/stpmic1.c
@@ -8,47 +8,10 @@
 #include <errno.h>
 #include <i2c/i2c.h>
 #include <init.h>
-#include <malloc.h>
 #include <of.h>
 #include <regmap.h>
-#include <xfuncs.h>
 #include <linux/mfd/stpmic1.h>
 
-struct stpmic1 {
-	struct device_d		*dev;
-	struct i2c_client	*client;
-};
-
-static int stpmic1_i2c_reg_read(void *ctx, unsigned int reg, unsigned int *val)
-{
-	struct stpmic1 *stpmic1 = ctx;
-	u8 buf[1];
-	int ret;
-
-	ret = i2c_read_reg(stpmic1->client, reg, buf, 1);
-	*val = buf[0];
-
-	return ret == 1 ? 0 : ret;
-}
-
-static int stpmic1_i2c_reg_write(void *ctx, unsigned int reg, unsigned int val)
-{
-	struct stpmic1 *stpmic1 = ctx;
-	u8 buf[] = {
-		val & 0xff,
-	};
-	int ret;
-
-	ret = i2c_write_reg(stpmic1->client, reg, buf, 1);
-
-	return ret == 1 ? 0 : ret;
-}
-
-static struct regmap_bus regmap_stpmic1_i2c_bus = {
-	.reg_write = stpmic1_i2c_reg_write,
-	.reg_read = stpmic1_i2c_reg_read,
-};
-
 static const struct regmap_config stpmic1_regmap_i2c_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
@@ -57,17 +20,13 @@ static const struct regmap_config stpmic1_regmap_i2c_config = {
 
 static int __init stpmic1_probe(struct device_d *dev)
 {
-	struct stpmic1 *stpmic1;
 	struct regmap *regmap;
 	u32 reg;
 	int ret;
 
-	stpmic1 = xzalloc(sizeof(*stpmic1));
-	stpmic1->dev = dev;
-
-	stpmic1->client = to_i2c_client(dev);
-	regmap = regmap_init(dev, &regmap_stpmic1_i2c_bus,
-			     stpmic1, &stpmic1_regmap_i2c_config);
+	regmap = regmap_init_i2c(to_i2c_client(dev), &stpmic1_regmap_i2c_config);
+	if (IS_ERR(regmap))
+		return PTR_ERR(regmap);
 
 	ret = regmap_register_cdev(regmap, NULL);
 	if (ret)
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/5] nvmem: provider: align read/write callback prototype with upstream
  2021-05-31  7:24 [PATCH 0/5] add regmap helpers for NVMEM and i2c Ahmad Fatoum
  2021-05-31  7:24 ` [PATCH 1/5] regmap: implement regmap_init_i2c Ahmad Fatoum
  2021-05-31  7:24 ` [PATCH 2/5] mfd: stpmic1: simplify using regmap_init_i2c Ahmad Fatoum
@ 2021-05-31  7:24 ` Ahmad Fatoum
  2021-05-31  7:24 ` [PATCH 4/5] nvmem: add nvmem_regmap_register helper Ahmad Fatoum
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2021-05-31  7:24 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

barebox allocates a NVMEM device as part of nvmem_register, which it
passes along to the callbacks. Callbacks then use dev->parent->priv
to retrieve the driver private data. This indirection makes definition
of nvmem helpers inconvenient, because they would need to hijack the
->priv member of the hardware device. Avoid this by passing along
some private data pointer defined at registration time, just like Linux
does. This will be used in a follow up commit.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/eeprom/at24.c            | 17 +++++------------
 drivers/net/phy/mv88e6xxx/chip.c | 11 +++++------
 drivers/nvmem/bsec.c             | 12 +++++-------
 drivers/nvmem/core.c             | 14 ++++++++------
 drivers/nvmem/eeprom_93xx46.c    | 13 +++++--------
 drivers/nvmem/ocotp.c            | 12 +++++-------
 drivers/nvmem/rave-sp-eeprom.c   | 15 +++++----------
 drivers/nvmem/snvs_lpgpr.c       | 13 +++++--------
 drivers/rtc/rtc-imxdi.c          | 13 +++++--------
 include/linux/nvmem-provider.h   |  7 +++----
 10 files changed, 51 insertions(+), 76 deletions(-)

diff --git a/drivers/eeprom/at24.c b/drivers/eeprom/at24.c
index 8c04c5684b61..1d35088c6bbc 100644
--- a/drivers/eeprom/at24.c
+++ b/drivers/eeprom/at24.c
@@ -245,12 +245,9 @@ static ssize_t at24_read(struct at24_data *at24,
 	return retval;
 }
 
-static int at24_nvmem_read(struct device_d *dev, int off,
-			       void *buf, int count)
+static int at24_nvmem_read(void *ctx, unsigned off, void *buf, size_t count)
 {
-	struct at24_data *at24 = dev->parent->priv;
-
-	return at24_read(at24, buf, off, count);
+	return at24_read(ctx, buf, off, count);
 }
 
 /*
@@ -363,12 +360,9 @@ static ssize_t at24_write(struct at24_data *at24, const char *buf, loff_t off,
 	return retval;
 }
 
-static int at24_nvmem_write(struct device_d *dev, const int off,
-			       const void *buf, int count)
+static int at24_nvmem_write(void *ctx, unsigned off, const void *buf, size_t count)
 {
-	struct at24_data *at24 = dev->parent->priv;
-
-	return at24_write(at24, buf, off, count);
+	return at24_write(ctx, buf, off, count);
 }
 
 static const struct nvmem_bus at24_nvmem_bus = {
@@ -495,14 +489,13 @@ static int at24_probe(struct device_d *dev)
 
 	at24->nvmem_config.name = devname;
 	at24->nvmem_config.dev = dev;
+	at24->nvmem_config.priv = at24;
 	at24->nvmem_config.read_only = !writable;
 	at24->nvmem_config.bus = &at24_nvmem_bus;
 	at24->nvmem_config.stride = 1;
 	at24->nvmem_config.word_size = 1;
 	at24->nvmem_config.size = chip.byte_len;
 
-	dev->priv = at24;
-
 	at24->nvmem = nvmem_register(&at24->nvmem_config);
 	err = PTR_ERR_OR_ZERO(at24->nvmem);
 	if (err)
diff --git a/drivers/net/phy/mv88e6xxx/chip.c b/drivers/net/phy/mv88e6xxx/chip.c
index b1bffe5cbc4e..873c6f84634b 100644
--- a/drivers/net/phy/mv88e6xxx/chip.c
+++ b/drivers/net/phy/mv88e6xxx/chip.c
@@ -779,10 +779,9 @@ static int mv88e6xxx_switch_reset(struct mv88e6xxx_chip *chip)
 	return 0;
 }
 
-static int mv88e6xxx_eeprom_read(struct device_d *dev, const int offset,
-				 void *val, int bytes)
+static int mv88e6xxx_eeprom_read(void *ctx, unsigned offset, void *val, size_t bytes)
 {
-	struct mv88e6xxx_chip *chip = dev->parent->priv;
+	struct mv88e6xxx_chip *chip = ctx;
 	struct ethtool_eeprom eeprom = {
 		.offset = offset,
 		.len = bytes,
@@ -794,10 +793,9 @@ static int mv88e6xxx_eeprom_read(struct device_d *dev, const int offset,
 	return chip->info->ops->get_eeprom(chip, &eeprom, val);
 }
 
-static int mv88e6xxx_eeprom_write(struct device_d *dev, const int offset,
-				  const void *val, int bytes)
+static int mv88e6xxx_eeprom_write(void *ctx, unsigned offset, const void *val, size_t bytes)
 {
-	struct mv88e6xxx_chip *chip = dev->parent->priv;
+	struct mv88e6xxx_chip *chip = ctx;
 	struct ethtool_eeprom eeprom = {
 		.offset = offset,
 		.len = bytes,
@@ -883,6 +881,7 @@ static int mv88e6xxx_probe(struct device_d *dev)
 		struct nvmem_config config = {
 			.name = basprintf("%s-eeprom", dev_name(dev)),
 			.dev = dev,
+			.priv = chip,
 			.word_size = 1,
 			.stride = 1,
 			.size = eeprom_len,
diff --git a/drivers/nvmem/bsec.c b/drivers/nvmem/bsec.c
index 836e62ecbcc7..f154864d266e 100644
--- a/drivers/nvmem/bsec.c
+++ b/drivers/nvmem/bsec.c
@@ -72,10 +72,9 @@ static struct regmap_bus stm32_bsec_regmap_bus = {
 	.reg_read = stm32_bsec_read_shadow,
 };
 
-static int stm32_bsec_write(struct device_d *dev, int offset,
-			    const void *val, int bytes)
+static int stm32_bsec_write(void *ctx, unsigned offset, const void *val, size_t bytes)
 {
-	struct bsec_priv *priv = dev->parent->priv;
+	struct bsec_priv *priv = ctx;
 
 	/* Allow only writing complete 32-bits aligned words */
 	if ((bytes % 4) || (offset % 4))
@@ -84,10 +83,9 @@ static int stm32_bsec_write(struct device_d *dev, int offset,
 	return regmap_bulk_write(priv->map, offset, val, bytes);
 }
 
-static int stm32_bsec_read(struct device_d *dev, int offset,
-			   void *buf, int bytes)
+static int stm32_bsec_read(void *ctx, unsigned offset, void *buf, size_t bytes)
 {
-	struct bsec_priv *priv = dev->parent->priv;
+	struct bsec_priv *priv = ctx;
 	u32 roffset, rbytes, val;
 	u8 *buf8 = buf, *val8 = (u8 *)&val;
 	int i, j = 0, ret, skip_bytes, size;
@@ -218,12 +216,12 @@ static int stm32_bsec_probe(struct device_d *dev)
 		return PTR_ERR(priv->map);
 
 	priv->config.name = "stm32-bsec";
+	priv->config.priv = priv;
 	priv->config.dev = dev;
 	priv->config.stride = 1;
 	priv->config.word_size = 1;
 	priv->config.size = data->num_regs;
 	priv->config.bus = &stm32_bsec_nvmem_bus;
-	dev->priv = priv;
 
 	nvmem = nvmem_register(&priv->config);
 	if (IS_ERR(nvmem))
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 2a1c4b694145..cfeecf70cd5d 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -33,6 +33,7 @@ struct nvmem_device {
 	size_t			size;
 	bool			read_only;
 	struct cdev		cdev;
+	void			*priv;
 };
 
 struct nvmem_cell {
@@ -206,6 +207,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
 	nvmem->bus = config->bus;
 	np = config->dev->device_node;
 	nvmem->dev.device_node = np;
+	nvmem->priv = config->priv;
 
 	nvmem->read_only = of_property_read_bool(np, "read-only") |
 			   config->read_only;
@@ -507,7 +509,7 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
 {
 	int rc;
 
-	rc = nvmem->bus->read(&nvmem->dev, cell->offset, buf, cell->bytes);
+	rc = nvmem->bus->read(nvmem->priv, cell->offset, buf, cell->bytes);
 	if (IS_ERR_VALUE(rc))
 		return rc;
 
@@ -572,7 +574,7 @@ static inline void *nvmem_cell_prepare_write_buffer(struct nvmem_cell *cell,
 		*b <<= bit_offset;
 
 		/* setup the first byte with lsb bits from nvmem */
-		rc = nvmem->bus->read(&nvmem->dev, cell->offset, &v, 1);
+		rc = nvmem->bus->read(nvmem->priv, cell->offset, &v, 1);
 		*b++ |= GENMASK(bit_offset - 1, 0) & v;
 
 		/* setup rest of the byte if any */
@@ -589,7 +591,7 @@ static inline void *nvmem_cell_prepare_write_buffer(struct nvmem_cell *cell,
 	/* if it's not end on byte boundary */
 	if ((nbits + bit_offset) % BITS_PER_BYTE) {
 		/* setup the last byte with msb bits from nvmem */
-		rc = nvmem->bus->read(&nvmem->dev, cell->offset + cell->bytes - 1,
+		rc = nvmem->bus->read(nvmem->priv, cell->offset + cell->bytes - 1,
 				      &v, 1);
 		*p |= GENMASK(7, (nbits + bit_offset) % BITS_PER_BYTE) & v;
 
@@ -622,7 +624,7 @@ int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len)
 			return PTR_ERR(buf);
 	}
 
-	rc = nvmem->bus->write(&nvmem->dev, cell->offset, buf, cell->bytes);
+	rc = nvmem->bus->write(nvmem->priv, cell->offset, buf, cell->bytes);
 
 	/* free the tmp buffer */
 	if (cell->bit_offset || cell->nbits)
@@ -719,7 +721,7 @@ int nvmem_device_read(struct nvmem_device *nvmem,
 	if (!bytes)
 		return 0;
 
-	rc = nvmem->bus->read(&nvmem->dev, offset, buf, bytes);
+	rc = nvmem->bus->read(nvmem->priv, offset, buf, bytes);
 
 	if (IS_ERR_VALUE(rc))
 		return rc;
@@ -753,7 +755,7 @@ int nvmem_device_write(struct nvmem_device *nvmem,
 	if (!bytes)
 		return 0;
 
-	rc = nvmem->bus->write(&nvmem->dev, offset, buf, bytes);
+	rc = nvmem->bus->write(nvmem->priv, offset, buf, bytes);
 
 	if (IS_ERR_VALUE(rc))
 		return rc;
diff --git a/drivers/nvmem/eeprom_93xx46.c b/drivers/nvmem/eeprom_93xx46.c
index 49ed396dc210..5833cb0d86ab 100644
--- a/drivers/nvmem/eeprom_93xx46.c
+++ b/drivers/nvmem/eeprom_93xx46.c
@@ -79,10 +79,9 @@ static inline bool has_quirk_instruction_length(struct eeprom_93xx46_dev *edev)
 	return edev->pdata->quirks & EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH;
 }
 
-static int eeprom_93xx46_read(struct device_d *dev, int off,
-			      void *val, int count)
+static int eeprom_93xx46_read(void *ctx, unsigned off, void *val, size_t count)
 {
-	struct eeprom_93xx46_dev *edev = dev->parent->priv;
+	struct eeprom_93xx46_dev *edev = ctx;
 	char *buf = val;
 	int err = 0;
 
@@ -241,10 +240,9 @@ eeprom_93xx46_write_word(struct eeprom_93xx46_dev *edev,
 	return ret;
 }
 
-static int eeprom_93xx46_write(struct device_d *dev, const int off,
-			       const void *val, int count)
+static int eeprom_93xx46_write(void *ctx, unsigned off, const void *val, size_t count)
 {
-	struct eeprom_93xx46_dev *edev = dev->parent->priv;
+	struct eeprom_93xx46_dev *edev = ctx;
 	const char *buf = val;
 	int i, ret, step = 1;
 
@@ -411,14 +409,13 @@ static int eeprom_93xx46_probe(struct device_d *dev)
 	edev->size = 128;
 	edev->nvmem_config.name = dev_name(&spi->dev);
 	edev->nvmem_config.dev = &spi->dev;
+	edev->nvmem_config.priv = edev;
 	edev->nvmem_config.read_only = pd->flags & EE_READONLY;
 	edev->nvmem_config.bus = &eeprom_93xx46_nvmem_bus;
 	edev->nvmem_config.stride = 4;
 	edev->nvmem_config.word_size = 1;
 	edev->nvmem_config.size = edev->size;
 
-	dev->priv = edev;
-
 	edev->nvmem = nvmem_register(&edev->nvmem_config);
 	if (IS_ERR(edev->nvmem)) {
 		err = PTR_ERR(edev->nvmem);
diff --git a/drivers/nvmem/ocotp.c b/drivers/nvmem/ocotp.c
index cee50955e97f..b2fad3c68770 100644
--- a/drivers/nvmem/ocotp.c
+++ b/drivers/nvmem/ocotp.c
@@ -673,18 +673,16 @@ static void imx_ocotp_init_dt(struct ocotp_priv *priv)
 	}
 }
 
-static int imx_ocotp_write(struct device_d *dev, const int offset,
-			    const void *val, int bytes)
+static int imx_ocotp_write(void *ctx, unsigned offset, const void *val, size_t bytes)
 {
-	struct ocotp_priv *priv = dev->parent->priv;
+	struct ocotp_priv *priv = ctx;
 
 	return regmap_bulk_write(priv->map, offset, val, bytes);
 }
 
-static int imx_ocotp_read(struct device_d *dev, const int offset, void *val,
-			   int bytes)
+static int imx_ocotp_read(void *ctx, unsigned offset, void *val, size_t bytes)
 {
-	struct ocotp_priv *priv = dev->parent->priv;
+	struct ocotp_priv *priv = ctx;
 
 	return regmap_bulk_read(priv->map, offset, val, bytes);
 }
@@ -746,11 +744,11 @@ static int imx_ocotp_probe(struct device_d *dev)
 
 	priv->config.name = "imx-ocotp";
 	priv->config.dev = dev;
+	priv->config.priv = priv;
 	priv->config.stride = 4;
 	priv->config.word_size = 4;
 	priv->config.size = data->num_regs;
 	priv->config.bus = &imx_ocotp_nvmem_bus;
-	dev->priv = priv;
 
 	nvmem = nvmem_register(&priv->config);
 	if (IS_ERR(nvmem))
diff --git a/drivers/nvmem/rave-sp-eeprom.c b/drivers/nvmem/rave-sp-eeprom.c
index 6c6ed17f18f6..f27491e5472b 100644
--- a/drivers/nvmem/rave-sp-eeprom.c
+++ b/drivers/nvmem/rave-sp-eeprom.c
@@ -280,19 +280,15 @@ static int rave_sp_eeprom_access(struct rave_sp_eeprom *eeprom,
 	return 0;
 }
 
-static int rave_sp_eeprom_read(struct device_d *dev, const int offset,
-			       void *val, int bytes)
+static int rave_sp_eeprom_read(void *ctx, unsigned offset, void *val, size_t bytes)
 {
-	return rave_sp_eeprom_access(dev->parent->priv,
-				     RAVE_SP_EEPROM_READ,
+	return rave_sp_eeprom_access(ctx, RAVE_SP_EEPROM_READ,
 				     offset, val, bytes);
 }
 
-static int rave_sp_eeprom_write(struct device_d *dev, const int offset,
-				const void *val, int bytes)
+static int rave_sp_eeprom_write(void *ctx, unsigned offset, const void *val, size_t bytes)
 {
-	return rave_sp_eeprom_access(dev->parent->priv,
-				     RAVE_SP_EEPROM_WRITE,
+	return rave_sp_eeprom_access(ctx, RAVE_SP_EEPROM_WRITE,
 				     offset, (void *)val, bytes);
 }
 
@@ -329,8 +325,6 @@ static int rave_sp_eeprom_probe(struct device_d *dev)
 	eeprom->address = reg[0];
 	eeprom->sp      = sp;
 
-	dev->priv = eeprom;
-
 	if (size > SZ_8K)
 		eeprom->header_size = RAVE_SP_EEPROM_HEADER_BIG;
 	else
@@ -343,6 +337,7 @@ static int rave_sp_eeprom_probe(struct device_d *dev)
 	of_property_read_string(dev->device_node, "zii,eeprom-name",
 				&config.name);
 	config.dev       = dev;
+	config.priv      = eeprom;
 	config.word_size = 1;
 	config.stride    = 1;
 	config.size      = reg[1];
diff --git a/drivers/nvmem/snvs_lpgpr.c b/drivers/nvmem/snvs_lpgpr.c
index fe7fe599f65e..1890af135d61 100644
--- a/drivers/nvmem/snvs_lpgpr.c
+++ b/drivers/nvmem/snvs_lpgpr.c
@@ -42,10 +42,9 @@ static const struct snvs_lpgpr_cfg snvs_lpgpr_cfg_imx6q = {
 	.offset_lplr	= IMX6Q_SNVS_LPLR,
 };
 
-static int snvs_lpgpr_write(struct device_d *dev, const int offset,
-			    const void *val, int bytes)
+static int snvs_lpgpr_write(void *ctx, unsigned offset, const void *val, size_t bytes)
 {
-	struct snvs_lpgpr_priv *priv = dev->parent->priv;
+	struct snvs_lpgpr_priv *priv = ctx;
 	const struct snvs_lpgpr_cfg *dcfg = priv->dcfg;
 	unsigned int lock_reg;
 	int ret;
@@ -68,10 +67,9 @@ static int snvs_lpgpr_write(struct device_d *dev, const int offset,
 				 bytes);
 }
 
-static int snvs_lpgpr_read(struct device_d *dev, const int offset, void *val,
-			   int bytes)
+static int snvs_lpgpr_read(void *ctx, unsigned offset, void *val, size_t bytes)
 {
-	struct snvs_lpgpr_priv *priv = dev->parent->priv;
+	struct snvs_lpgpr_priv *priv = ctx;
 	const struct snvs_lpgpr_cfg *dcfg = priv->dcfg;
 
 	return regmap_bulk_read(priv->regmap, dcfg->offset + offset,
@@ -113,6 +111,7 @@ static int snvs_lpgpr_probe(struct device_d *dev)
 	cfg = &priv->cfg;
 	cfg->name = dev_name(dev);
 	cfg->dev = dev;
+	cfg->priv = priv;
 	cfg->stride = 4;
 	cfg->word_size = 4;
 	cfg->size = 4;
@@ -124,8 +123,6 @@ static int snvs_lpgpr_probe(struct device_d *dev)
 		return PTR_ERR(nvmem);
 	}
 
-	dev->priv = priv;
-
 	return 0;
 }
 
diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c
index 8fcaf631fff9..82ed6d500753 100644
--- a/drivers/rtc/rtc-imxdi.c
+++ b/drivers/rtc/rtc-imxdi.c
@@ -511,10 +511,9 @@ static const struct rtc_class_ops dryice_rtc_ops = {
 	.set_time = dryice_rtc_set_time,
 };
 
-static int nvstore_write(struct device_d *dev, const int reg, const void *val,
-			 int bytes)
+static int nvstore_write(void *ctx, unsigned reg, const void *val, size_t bytes)
 {
-	struct imxdi_dev *imxdi = dev->parent->priv;
+	struct imxdi_dev *imxdi = ctx;
 	const u32 *val32 = val;
 
 	if (bytes != 4)
@@ -525,10 +524,9 @@ static int nvstore_write(struct device_d *dev, const int reg, const void *val,
 	return 0;
 }
 
-static int nvstore_read(struct device_d *dev, const int reg, void *val,
-			int bytes)
+static int nvstore_read(void *ctx, unsigned reg, void *val, size_t bytes)
 {
-	struct imxdi_dev *imxdi = dev->parent->priv;
+	struct imxdi_dev *imxdi = ctx;
 	u32 *val32 = val;
 
 	if (bytes != 4)
@@ -588,9 +586,8 @@ static int __init dryice_rtc_probe(struct device_d *dev)
 	if (ret)
 		goto err;
 
-	dev->priv = imxdi;
-
 	nvstore_nvmem_config.dev = dev;
+	nvstore_nvmem_config.priv = imxdi;
 
 	imxdi->nvmem = nvmem_register(&nvstore_nvmem_config);
 	if (IS_ENABLED(CONFIG_NVMEM) && IS_ERR(imxdi->nvmem)) {
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
index 6ef5ea6854d9..ac9ad21711aa 100644
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -18,10 +18,8 @@
 struct nvmem_device;
 
 struct nvmem_bus {
-	int (*write)(struct device_d *dev, const int reg, const void *val,
-		     int val_size);
-	int (*read)(struct device_d *dev, const int reg, void *val,
-		    int val_size);
+	int (*write)(void *ctx, unsigned int reg, const void *val, size_t val_size);
+	int (*read)(void *ctx, unsigned int reg, void *val, size_t val_size);
 };
 
 struct nvmem_config {
@@ -32,6 +30,7 @@ struct nvmem_config {
 	int			word_size;
 	int			size;
 	const struct nvmem_bus	*bus;
+	void			*priv;
 };
 
 #if IS_ENABLED(CONFIG_NVMEM)
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/5] nvmem: add nvmem_regmap_register helper
  2021-05-31  7:24 [PATCH 0/5] add regmap helpers for NVMEM and i2c Ahmad Fatoum
                   ` (2 preceding siblings ...)
  2021-05-31  7:24 ` [PATCH 3/5] nvmem: provider: align read/write callback prototype with upstream Ahmad Fatoum
@ 2021-05-31  7:24 ` Ahmad Fatoum
  2021-05-31  7:24 ` [PATCH 5/5] nvmem: stm32-bsec: simplify using new nvmem_regmap_register Ahmad Fatoum
  2021-06-02  6:36 ` [PATCH 0/5] add regmap helpers for NVMEM and i2c Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2021-05-31  7:24 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Registering a nvmem device for a regmap involves some boilerplate that
doesn't need to change from driver to driver:

  - Reads are made aligned, to support normal use with md
  - Writes are passed along as is
  - nvmem parameters can be extracted from regmap

Instead of having to replicate this driver by driver, add one helper to
make this adaptation easier.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/base/regmap/regmap.c   |  5 +++
 drivers/nvmem/Makefile         |  2 +-
 drivers/nvmem/regmap.c         | 78 ++++++++++++++++++++++++++++++++++
 include/linux/nvmem-provider.h |  8 ++++
 include/regmap.h               |  1 +
 5 files changed, 93 insertions(+), 1 deletion(-)
 create mode 100644 drivers/nvmem/regmap.c

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 6613670263f6..1af0c15a7baf 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -132,6 +132,11 @@ struct regmap *dev_get_regmap(struct device_d *dev, const char *name)
 	return ERR_PTR(-ENOENT);
 }
 
+struct device_d *regmap_get_device(struct regmap *map)
+{
+	return map->dev;
+}
+
 /*
  * regmap_write - write a register in a map
  *
diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile
index 7101c5aca44c..617e3725a726 100644
--- a/drivers/nvmem/Makefile
+++ b/drivers/nvmem/Makefile
@@ -3,7 +3,7 @@
 #
 
 obj-$(CONFIG_NVMEM)		+= nvmem_core.o
-nvmem_core-y			:= core.o
+nvmem_core-y			:= core.o regmap.o
 
 # Devices
 obj-$(CONFIG_NVMEM_SNVS_LPGPR)	+= nvmem_snvs_lpgpr.o
diff --git a/drivers/nvmem/regmap.c b/drivers/nvmem/regmap.c
new file mode 100644
index 000000000000..346d2516f3c3
--- /dev/null
+++ b/drivers/nvmem/regmap.c
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <common.h>
+#include <driver.h>
+#include <malloc.h>
+#include <xfuncs.h>
+#include <errno.h>
+#include <init.h>
+#include <io.h>
+#include <regmap.h>
+#include <linux/nvmem-provider.h>
+
+static int nvmem_regmap_write(void *ctx, unsigned offset, const void *val, size_t bytes)
+{
+	return regmap_bulk_write(ctx, offset, val, bytes);
+}
+
+static int nvmem_regmap_read(void *ctx, unsigned offset, void *buf, size_t bytes)
+{
+	struct regmap *map = ctx;
+	size_t rbytes, stride, skip_bytes;
+	u32 roffset, val;
+	u8 *buf8 = buf, *val8 = (u8 *)&val;
+	int i, j = 0, ret, size;
+
+	stride = regmap_get_reg_stride(map);
+
+	roffset = rounddown(offset, stride);
+	skip_bytes = offset & (stride - 1);
+	rbytes = roundup(bytes + skip_bytes, stride);
+
+	if (roffset + rbytes > stride * regmap_get_max_register(map))
+		return -EINVAL;
+
+	for (i = roffset; i < roffset + rbytes; i += stride) {
+		ret = regmap_bulk_read(map, i, &val, stride);
+		if (ret) {
+			dev_err(regmap_get_device(map), "Can't read data%d (%d)\n", i, ret);
+			return ret;
+		}
+
+		/* skip first bytes in case of unaligned read */
+		if (skip_bytes)
+			size = min(bytes, stride - skip_bytes);
+		else
+			size = min(bytes, stride);
+
+		memcpy(&buf8[j], &val8[skip_bytes], size);
+		bytes -= size;
+		j += size;
+		skip_bytes = 0;
+	}
+
+	return 0;
+}
+
+static struct nvmem_bus nvmem_regmap_bus = {
+	.read = nvmem_regmap_read,
+	.write = nvmem_regmap_write,
+};
+
+struct nvmem_device *nvmem_regmap_register(struct regmap *map, const char *name)
+{
+	struct nvmem_config config;
+
+	/* Can be retrofitted if needed */
+	if (regmap_get_reg_stride(map) != regmap_get_val_bytes(map))
+		return ERR_PTR(-EINVAL);
+
+	config.name = name;
+	config.dev = regmap_get_device(map);
+	config.priv = map;
+	config.stride = 1;
+	config.word_size = 1;
+	config.size = regmap_get_max_register(map) * regmap_get_reg_stride(map);
+	config.bus = &nvmem_regmap_bus;
+
+	return nvmem_register(&config);
+}
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
index ac9ad21711aa..2d738983736e 100644
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -33,9 +33,12 @@ struct nvmem_config {
 	void			*priv;
 };
 
+struct regmap;
+
 #if IS_ENABLED(CONFIG_NVMEM)
 
 struct nvmem_device *nvmem_register(const struct nvmem_config *cfg);
+struct nvmem_device *nvmem_regmap_register(struct regmap *regmap, const char *name);
 
 #else
 
@@ -44,5 +47,10 @@ static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c)
 	return ERR_PTR(-ENOSYS);
 }
 
+static inline struct nvmem_device *nvmem_regmap_register(struct regmap *regmap, const char *name)
+{
+	return ERR_PTR(-ENOSYS);
+}
+
 #endif /* CONFIG_NVMEM */
 #endif  /* ifndef _LINUX_NVMEM_PROVIDER_H */
diff --git a/include/regmap.h b/include/regmap.h
index c5cf954ad6d9..f04319f20482 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -109,6 +109,7 @@ void regmap_mmio_detach_clk(struct regmap *map);
 void regmap_exit(struct regmap *map);
 
 struct regmap *dev_get_regmap(struct device_d *dev, const char *name);
+struct device_d *regmap_get_device(struct regmap *map);
 
 int regmap_register_cdev(struct regmap *map, const char *name);
 
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 5/5] nvmem: stm32-bsec: simplify using new nvmem_regmap_register
  2021-05-31  7:24 [PATCH 0/5] add regmap helpers for NVMEM and i2c Ahmad Fatoum
                   ` (3 preceding siblings ...)
  2021-05-31  7:24 ` [PATCH 4/5] nvmem: add nvmem_regmap_register helper Ahmad Fatoum
@ 2021-05-31  7:24 ` Ahmad Fatoum
  2021-06-02  6:36 ` [PATCH 0/5] add regmap helpers for NVMEM and i2c Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2021-05-31  7:24 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The nvmem_regmap_register code is mostly copy-pasted from the stm32-bsec
driver, so have it use the new helper.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/nvmem/bsec.c | 92 ++++++--------------------------------------
 1 file changed, 11 insertions(+), 81 deletions(-)

diff --git a/drivers/nvmem/bsec.c b/drivers/nvmem/bsec.c
index f154864d266e..509a5fa872f7 100644
--- a/drivers/nvmem/bsec.c
+++ b/drivers/nvmem/bsec.c
@@ -21,9 +21,7 @@
 #define BSEC_OTP_SERIAL	13
 
 struct bsec_priv {
-	struct regmap *map;
 	u32 svc_id;
-	struct device_d dev;
 	struct regmap_config map_config;
 	struct nvmem_config config;
 };
@@ -72,59 +70,6 @@ static struct regmap_bus stm32_bsec_regmap_bus = {
 	.reg_read = stm32_bsec_read_shadow,
 };
 
-static int stm32_bsec_write(void *ctx, unsigned offset, const void *val, size_t bytes)
-{
-	struct bsec_priv *priv = ctx;
-
-	/* Allow only writing complete 32-bits aligned words */
-	if ((bytes % 4) || (offset % 4))
-		return -EINVAL;
-
-	return regmap_bulk_write(priv->map, offset, val, bytes);
-}
-
-static int stm32_bsec_read(void *ctx, unsigned offset, void *buf, size_t bytes)
-{
-	struct bsec_priv *priv = ctx;
-	u32 roffset, rbytes, val;
-	u8 *buf8 = buf, *val8 = (u8 *)&val;
-	int i, j = 0, ret, skip_bytes, size;
-
-	/* Round unaligned access to 32-bits */
-	roffset = rounddown(offset, 4);
-	skip_bytes = offset & 0x3;
-	rbytes = roundup(bytes + skip_bytes, 4);
-
-	if (roffset + rbytes > priv->config.size)
-		return -EINVAL;
-
-	for (i = roffset; i < roffset + rbytes; i += 4) {
-		ret = regmap_bulk_read(priv->map, i, &val, 4);
-		if (ret) {
-			dev_err(dev, "Can't read data%d (%d)\n", i, ret);
-			return ret;
-		}
-
-		/* skip first bytes in case of unaligned read */
-		if (skip_bytes)
-			size = min(bytes, 4 - skip_bytes);
-		else
-			size = min(bytes, 4);
-
-		memcpy(&buf8[j], &val8[skip_bytes], size);
-		bytes -= size;
-		j += size;
-		skip_bytes = 0;
-	}
-
-	return 0;
-}
-
-static const struct nvmem_bus stm32_bsec_nvmem_bus = {
-	.write = stm32_bsec_write,
-	.read  = stm32_bsec_read,
-};
-
 static void stm32_bsec_set_unique_machine_id(struct regmap *map)
 {
 	u32 unique_id[3];
@@ -151,9 +96,9 @@ static int stm32_bsec_read_mac(struct regmap *map, int offset, u8 *mac)
 	return 0;
 }
 
-static void stm32_bsec_init_dt(struct bsec_priv *priv)
+static void stm32_bsec_init_dt(struct device_d *dev, struct regmap *map)
 {
-	struct device_node *node = priv->dev.parent->device_node;
+	struct device_node *node = dev->device_node;
 	struct device_node *rnode;
 	u32 phandle, offset;
 	char mac[ETH_ALEN];
@@ -162,9 +107,6 @@ static void stm32_bsec_init_dt(struct bsec_priv *priv)
 	int len;
 	int ret;
 
-	if (!node)
-		return;
-
 	prop = of_get_property(node, "barebox,provide-mac-address", &len);
 	if (!prop)
 		return;
@@ -177,10 +119,9 @@ static void stm32_bsec_init_dt(struct bsec_priv *priv)
 	rnode = of_find_node_by_phandle(phandle);
 	offset = be32_to_cpup(prop++);
 
-	ret = stm32_bsec_read_mac(priv->map, offset, mac);
+	ret = stm32_bsec_read_mac(map, offset, mac);
 	if (ret) {
-		dev_warn(&priv->dev, "error setting MAC address: %s\n",
-			 strerror(-ret));
+		dev_warn(dev, "error setting MAC address: %s\n", strerror(-ret));
 		return;
 	}
 
@@ -189,6 +130,7 @@ static void stm32_bsec_init_dt(struct bsec_priv *priv)
 
 static int stm32_bsec_probe(struct device_d *dev)
 {
+	struct regmap *map;
 	struct bsec_priv *priv;
 	int ret = 0;
 	const struct stm32_bsec_data *data;
@@ -202,35 +144,23 @@ static int stm32_bsec_probe(struct device_d *dev)
 
 	priv->svc_id = data->svc_id;
 
-	dev_set_name(&priv->dev, "bsec");
-	priv->dev.parent = dev;
-	register_device(&priv->dev);
-
 	priv->map_config.reg_bits = 32;
 	priv->map_config.val_bits = 32;
 	priv->map_config.reg_stride = 4;
 	priv->map_config.max_register = data->num_regs;
 
-	priv->map = regmap_init(dev, &stm32_bsec_regmap_bus, priv, &priv->map_config);
-	if (IS_ERR(priv->map))
-		return PTR_ERR(priv->map);
-
-	priv->config.name = "stm32-bsec";
-	priv->config.priv = priv;
-	priv->config.dev = dev;
-	priv->config.stride = 1;
-	priv->config.word_size = 1;
-	priv->config.size = data->num_regs;
-	priv->config.bus = &stm32_bsec_nvmem_bus;
+	map = regmap_init(dev, &stm32_bsec_regmap_bus, priv, &priv->map_config);
+	if (IS_ERR(map))
+		return PTR_ERR(map);
 
-	nvmem = nvmem_register(&priv->config);
+	nvmem = nvmem_regmap_register(map, "stm32-bsec");
 	if (IS_ERR(nvmem))
 		return PTR_ERR(nvmem);
 
 	if (IS_ENABLED(CONFIG_MACHINE_ID))
-		stm32_bsec_set_unique_machine_id(priv->map);
+		stm32_bsec_set_unique_machine_id(map);
 
-	stm32_bsec_init_dt(priv);
+	stm32_bsec_init_dt(dev, map);
 
 	return 0;
 }
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/5] add regmap helpers for NVMEM and i2c
  2021-05-31  7:24 [PATCH 0/5] add regmap helpers for NVMEM and i2c Ahmad Fatoum
                   ` (4 preceding siblings ...)
  2021-05-31  7:24 ` [PATCH 5/5] nvmem: stm32-bsec: simplify using new nvmem_regmap_register Ahmad Fatoum
@ 2021-06-02  6:36 ` Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2021-06-02  6:36 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, May 31, 2021 at 09:24:01AM +0200, Ahmad Fatoum wrote:
> Incoming BeagleV support should support an i2c-connected PMIC and
> a fuse bank for retrieval of the MAC address. On the STM32MP1, we
> also support an i2c-connected PMIC and a fuse bank for MAC address.
> 
> Instead of duplicating too much code, add some helpers, so drivers can
> drop common boilerplate. The relevant STM32 drivers are ported to make
> use of it.
> 
> Ahmad Fatoum (5):
>   regmap: implement regmap_init_i2c
>   mfd: stpmic1: simplify using regmap_init_i2c
>   nvmem: provider: align read/write callback prototype with upstream
>   nvmem: add nvmem_regmap_register helper
>   nvmem: stm32-bsec: simplify using new nvmem_regmap_register

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-06-02  6:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31  7:24 [PATCH 0/5] add regmap helpers for NVMEM and i2c Ahmad Fatoum
2021-05-31  7:24 ` [PATCH 1/5] regmap: implement regmap_init_i2c Ahmad Fatoum
2021-05-31  7:24 ` [PATCH 2/5] mfd: stpmic1: simplify using regmap_init_i2c Ahmad Fatoum
2021-05-31  7:24 ` [PATCH 3/5] nvmem: provider: align read/write callback prototype with upstream Ahmad Fatoum
2021-05-31  7:24 ` [PATCH 4/5] nvmem: add nvmem_regmap_register helper Ahmad Fatoum
2021-05-31  7:24 ` [PATCH 5/5] nvmem: stm32-bsec: simplify using new nvmem_regmap_register Ahmad Fatoum
2021-06-02  6:36 ` [PATCH 0/5] add regmap helpers for NVMEM and i2c Sascha Hauer

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git