Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c831dd73 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull regmap updates from Mark Brown:
 "The main update this time around is the addition of a standard DT
  binding for specifying the endianness of devices.  This allows drivers
  to support any endianness of device register map without any code,
  useful for configurable IP blocks.

  There's also a few bug fixes that I didn't get round to sending, none
  of them terribly severe or new, and a reduction in size for struct
  regmap"

* tag 'regmap-v3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
  regmap: Fix debugfs-file 'registers' mode
  regmap: fix possible ZERO_SIZE_PTR pointer dereferencing error.
  regmap: debugfs: fix possbile NULL pointer dereference
  regmap: fix NULL pointer dereference in _regmap_write/read
  regmap: fix NULL pointer dereference in regmap_get_val_endian
  regmap: cache: Do not fail silently from regcache_sync calls
  regmap: change struct regmap's internal locks as union
  regmap: Split regmap_get_endian() in two functions
  regmap: of_regmap_get_endian() cleanup
  regmap: Fix DT endianess parsing logic
  regmap: Add explicit dependencies to catch "select" misuse
  regmap: Restore L: linux-kernel@vger.kernel.org entry
  regmap: Add the DT binding documentation for endianness
  regmap: add DT endianness binding support.
parents 2b425a3f f5b313a2
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
Device-Tree binding for regmap

The endianness mode of CPU & Device scenarios:
Index     Device     Endianness properties
---------------------------------------------------
1         BE         'big-endian'
2         LE         'little-endian'

For one device driver, which will run in different scenarios above
on different SoCs using the devicetree, we need one way to simplify
this.

Required properties:
- {big,little}-endian: these are boolean properties, if absent
  meaning that the CPU and the Device are in the same endianness mode,
  these properties are for register values and all the buffers only.

Examples:
Scenario 1 : CPU in LE mode & device in LE mode.
dev: dev@40031000 {
	      compatible = "name";
	      reg = <0x40031000 0x1000>;
	      ...
};

Scenario 2 : CPU in LE mode & device in BE mode.
dev: dev@40031000 {
	      compatible = "name";
	      reg = <0x40031000 0x1000>;
	      ...
	      big-endian;
};

Scenario 3 : CPU in BE mode & device in BE mode.
dev: dev@40031000 {
	      compatible = "name";
	      reg = <0x40031000 0x1000>;
	      ...
};

Scenario 4 : CPU in BE mode & device in LE mode.
dev: dev@40031000 {
	      compatible = "name";
	      reg = <0x40031000 0x1000>;
	      ...
	      little-endian;
};
+1 −0
Original line number Diff line number Diff line
@@ -7595,6 +7595,7 @@ F: fs/reiserfs/

REGISTER MAP ABSTRACTION
M:	Mark Brown <broonie@kernel.org>
L:	linux-kernel@vger.kernel.org
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git
S:	Supported
F:	drivers/base/regmap/
+3 −0
Original line number Diff line number Diff line
@@ -11,12 +11,15 @@ config REGMAP

config REGMAP_I2C
	tristate
	depends on I2C

config REGMAP_SPI
	tristate
	depends on SPI

config REGMAP_SPMI
	tristate
	depends on SPMI

config REGMAP_MMIO
	tristate
+4 −2
Original line number Diff line number Diff line
@@ -49,8 +49,10 @@ struct regmap_async {
};

struct regmap {
	union {
		struct mutex mutex;
		spinlock_t spinlock;
	};
	unsigned long spinlock_flags;
	regmap_lock lock;
	regmap_unlock unlock;
+11 −2
Original line number Diff line number Diff line
@@ -269,8 +269,11 @@ static int regcache_default_sync(struct regmap *map, unsigned int min,
		map->cache_bypass = 1;
		ret = _regmap_write(map, reg, val);
		map->cache_bypass = 0;
		if (ret)
		if (ret) {
			dev_err(map->dev, "Unable to sync register %#x. %d\n",
				reg, ret);
			return ret;
		}
		dev_dbg(map->dev, "Synced register %#x, value %#x\n", reg, val);
	}

@@ -615,8 +618,11 @@ static int regcache_sync_block_single(struct regmap *map, void *block,
		ret = _regmap_write(map, regtmp, val);

		map->cache_bypass = 0;
		if (ret != 0)
		if (ret != 0) {
			dev_err(map->dev, "Unable to sync register %#x. %d\n",
				regtmp, ret);
			return ret;
		}
		dev_dbg(map->dev, "Synced register %#x, value %#x\n",
			regtmp, val);
	}
@@ -641,6 +647,9 @@ static int regcache_sync_block_raw_flush(struct regmap *map, const void **data,
	map->cache_bypass = 1;

	ret = _regmap_raw_write(map, base, *data, count * val_bytes);
	if (ret)
		dev_err(map->dev, "Unable to sync registers %#x-%#x. %d\n",
			base, cur - map->reg_stride, ret);

	map->cache_bypass = 0;

Loading