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

Merge remote-tracking branches 'regmap/fix/be', 'regmap/fix/doc' and 'regmap/fix/spmi' into regmap-linus

+25 -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>
+3 -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; ··· 248 246 ctx->val_bytes = config->val_bits / 8; 249 247 ctx->clk = ERR_PTR(-ENODEV); 250 248 251 - switch (config->reg_format_endian) { 249 + switch (regmap_get_val_endian(dev, &regmap_mmio, config)) { 252 250 case REGMAP_ENDIAN_DEFAULT: 253 251 case REGMAP_ENDIAN_LITTLE: 254 252 #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