Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'regmap-fix-v4.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap

Pull regmap fixes from Mark Brown:
"This is rather too late so it'd be completely understandable if you
don't want to pull it at this point, I had thought I'd sent this
earlier but it seems I didn't. Everything has been in -next for some
time now.

The main set of fixes here are mopping up some more issues with MMIO,
fixing handling of endianness configuration in DT (which just wasn't
working at all) and cases where the register and value endianness are
different.

There is also a fix for bulk register reads on SPMI"

* tag 'regmap-fix-v4.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
regmap: spmi: Fix regmap_spmi_ext_read in multi-byte case
regmap: mmio: Explicitly say little endian is the defualt in the bus config
regmap: mmio: Parse endianness definitions from DT
regmap: Fix implicit inclusion of device.h
regmap: mmio: Fix value endianness selection
regmap: fix documentation to match code

+26 -43
+20 -41
Documentation/devicetree/bindings/regmap/regmap.txt
··· 1 - Device-Tree binding for regmap 2 - 3 - The endianness mode of CPU & Device scenarios: 4 - Index Device Endianness properties 5 - --------------------------------------------------- 6 - 1 BE 'big-endian' 7 - 2 LE 'little-endian' 8 - 3 Native 'native-endian' 9 - 10 - For one device driver, which will run in different scenarios above 11 - on different SoCs using the devicetree, we need one way to simplify 12 - this. 1 + Devicetree binding for regmap 13 2 14 3 Optional properties: 15 - - {big,little,native}-endian: these are boolean properties, if absent 16 - then the implementation will choose a default based on the device 17 - being controlled. These properties are for register values and all 18 - the buffers only. Native endian means that the CPU and device have 19 - the same endianness. 4 + 5 + little-endian, 6 + big-endian, 7 + native-endian: See common-properties.txt for a definition 8 + 9 + Note: 10 + Regmap defaults to little-endian register access on MMIO based 11 + devices, this is by far the most common setting. On CPU 12 + architectures that typically run big-endian operating systems 13 + (e.g. PowerPC), registers can be defined as big-endian and must 14 + be marked that way in the devicetree. 15 + 16 + On SoCs that can be operated in both big-endian and little-endian 17 + modes, with a single hardware switch controlling both the endianess 18 + of the CPU and a byteswap for MMIO registers (e.g. many Broadcom MIPS 19 + chips), "native-endian" is used to allow using the same device tree 20 + blob in both cases. 20 21 21 22 Examples: 22 - Scenario 1 : CPU in LE mode & device in LE mode. 23 + Scenario 1 : a register set in big-endian mode. 23 24 dev: dev@40031000 { 24 - compatible = "name"; 25 + compatible = "syscon"; 25 26 reg = <0x40031000 0x1000>; 26 - ... 27 - }; 28 - 29 - Scenario 2 : CPU in LE mode & device in BE mode. 30 - dev: dev@40031000 { 31 - compatible = "name"; 32 - reg = <0x40031000 0x1000>; 33 - ... 34 27 big-endian; 35 - }; 36 - 37 - Scenario 3 : CPU in BE mode & device in BE mode. 38 - dev: dev@40031000 { 39 - compatible = "name"; 40 - reg = <0x40031000 0x1000>; 41 28 ... 42 - }; 43 - 44 - Scenario 4 : CPU in BE mode & device in LE mode. 45 - dev: dev@40031000 { 46 - compatible = "name"; 47 - reg = <0x40031000 0x1000>; 48 - ... 49 - little-endian; 50 29 };
+1
drivers/base/regmap/internal.h
··· 13 13 #ifndef _REGMAP_INTERNAL_H 14 14 #define _REGMAP_INTERNAL_H 15 15 16 + #include <linux/device.h> 16 17 #include <linux/regmap.h> 17 18 #include <linux/fs.h> 18 19 #include <linux/list.h>
+4 -1
drivers/base/regmap/regmap-mmio.c
··· 23 23 #include <linux/regmap.h> 24 24 #include <linux/slab.h> 25 25 26 + #include "internal.h" 27 + 26 28 struct regmap_mmio_context { 27 29 void __iomem *regs; 28 30 unsigned val_bytes; ··· 214 212 .reg_write = regmap_mmio_write, 215 213 .reg_read = regmap_mmio_read, 216 214 .free_context = regmap_mmio_free_context, 215 + .val_format_endian_default = REGMAP_ENDIAN_LITTLE, 217 216 }; 218 217 219 218 static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev, ··· 248 245 ctx->val_bytes = config->val_bits / 8; 249 246 ctx->clk = ERR_PTR(-ENODEV); 250 247 251 - switch (config->reg_format_endian) { 248 + switch (regmap_get_val_endian(dev, &regmap_mmio, config)) { 252 249 case REGMAP_ENDIAN_DEFAULT: 253 250 case REGMAP_ENDIAN_LITTLE: 254 251 #ifdef __LITTLE_ENDIAN
+1 -1
drivers/base/regmap/regmap-spmi.c
··· 142 142 while (val_size) { 143 143 len = min_t(size_t, val_size, 8); 144 144 145 - err = spmi_ext_register_readl(context, addr, val, val_size); 145 + err = spmi_ext_register_readl(context, addr, val, len); 146 146 if (err) 147 147 goto err_out; 148 148