#
f5723cfc |
|
18-Aug-2022 |
Cristian Ciocaltea <cristian.ciocaltea@collabora.com> |
regmap: spi: Reserve space for register address/padding Currently the max_raw_read and max_raw_write limits in regmap_spi struct do not take into account the additional size of the transmitted register address and padding. This may result in exceeding the maximum permitted SPI message size, which could cause undefined behaviour, e.g. data corruption. Fix regmap_get_spi_bus() to properly adjust the above mentioned limits by reserving space for the register address/padding as set in the regmap configuration. Fixes: f231ff38b7b2 ("regmap: spi: Set regmap max raw r/w from max_transfer_size") Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Reviewed-by: Lucas Tanure <tanureal@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220818104851.429479-1-cristian.ciocaltea@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
f231ff38 |
|
21-Oct-2021 |
Lucas Tanure <tanureal@opensource.cirrus.com> |
regmap: spi: Set regmap max raw r/w from max_transfer_size Set regmap raw read/write from spi max_transfer_size so regmap_raw_read/write can split the access into chunks Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> [André: fix build warning] Signed-off-by: André Almeida <andrealmeid@collabora.com> Link: https://lore.kernel.org/r/20211021132721.13669-1-andrealmeid@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
37613fa5 |
|
25-Apr-2019 |
Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
regmap: add proper SPDX identifiers on files that did not have them. There were a few files in the regmap code that did not have SPDX identifiers on them, so fix that up. At the same time, remove the "free form" text that specified the license of the file, as that is impossible for any tool to properly parse. Also, as Mark loves // comment markers, convert all of the headers to be the same to make things look consistent :) Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
9c2e5cb3 |
|
11-Aug-2017 |
Julia Lawall <Julia.Lawall@lip6.fr> |
regmap: constify regmap_bus structures These regmap_bus structures are only passed as the second argument to __devm_regmap_init or __regmap_init, both of which are const, so the regmap_bus structures can be const too. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
1ed81114 |
|
11-Aug-2015 |
Nicolas Boichat <drinkcat@chromium.org> |
regmap: Move documentation to regmap.h Init functions defined in regmap*.c files are now prefixed with __, take lockdep key and class parameters, and should not be called directly: move the documentation to regmap.h, where the macros are defined. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
3cfe7a74 |
|
08-Jul-2015 |
Nicolas Boichat <drinkcat@chromium.org> |
regmap: Use different lockdep class for each regmap init call Lockdep validator complains about recursive locking and deadlock when two different regmap instances are called in a nested order. That happens anytime a regmap read/write call needs to access another regmap. This is because, for performance reason, lockdep groups all locks initialized by the same mutex_init() in the same lock class. Therefore all regmap mutexes are in the same lock class, leading to lockdep "nested locking" warnings if a regmap accesses another regmap. In general, it is impossible to establish in advance the hierarchy of regmaps, so we make sure that each regmap init call initializes its own static lock_class_key. This is done by wrapping all regmap_init calls into macros. This also allows us to give meaningful names to the lock_class_key. For example, in rt5677 case, we have in /proc/lockdep_chains: irq_context: 0 [ffffffc0018d2198] &dev->mutex [ffffffc0018d2198] &dev->mutex [ffffffc001bd7f60] rt5677:5104:(&rt5677_regmap)->_lock [ffffffc001bd7f58] rt5677:5096:(&rt5677_regmap_physical)->_lock [ffffffc001b95448] &(&base->lock)->rlock The above would have resulted in a lockdep recursive warning previously. This is not the case anymore as the lockdep validator now clearly identifies the 2 regmaps as separate. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
|
#
d647c199 |
|
14-Jul-2014 |
Xiubo Li <Li.Xiubo@freescale.com> |
regmap: add DT endianness binding support. For many drivers which will support rich endianness of Devices need define DT properties by itself with the binding support. The endianness using regmap: Index Device Properties if needs bytes-swap, or just ignore it ------------------------------------------------------------- 1 BE 'big-endian' 2 LE 'little-endian' The properties include all the register values and the buffers. And these properties are very usful for the MMIO devices: Such as: a memory-mapped device, on one SoC is in BE mode, while in another SoC will be in LE mode, and the CPU will always in LE mode. For the first case, we must use cpu_to_be32/be32_to_cpu for 32-bit registers accessing, so the 'big-endian' property is needed. For the second case, we can just ignore the bytes-swap functions like cpu_to_le32/le32_to_cpu, so the 'little-endian' property could be abscent. And vice versa... Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
|
#
4272b961 |
|
21-Jan-2014 |
Paul Gortmaker <paul.gortmaker@windriver.com> |
drivers/base: delete non-required instances of include <linux/init.h> None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Cc: Len Brown <len.brown@intel.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Acked-by: Pavel Machek <pavel@ucw.cz> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Mark Brown <broonie@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
#
cd1b9dd0 |
|
10-Oct-2013 |
Mark Brown <broonie@linaro.org> |
regmap: spi: Handle async writes of only one buffer If the value is zero then assume it has been included in the register data and don't send anything, minimising the number of interactions with the hardware. Signed-off-by: Mark Brown <broonie@linaro.org>
|
#
95601d65 |
|
05-Feb-2013 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: spi: Handle allocation failures gracefully Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
#
e0356dfe |
|
28-Jan-2013 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: spi: Support asynchronous I/O for SPI Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
#
26b5e74d |
|
04-Apr-2012 |
Stephen Warren <swarren@nvidia.com> |
regmap: introduce explicit bus_context for bus callbacks The only context needed by I2C and SPI bus definitions is the device itself; this can be converted to an i2c_client or spi_device in order to perform IO on the device. However, other bus types may need more context in order to perform IO. Enable this by having regmap_init accept a bus_context parameter, and pass this to all bus callbacks. The existing callbacks simply pass the struct device here. Future bus types may pass something else. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
#
0135bbcc |
|
04-Apr-2012 |
Stephen Warren <swarren@nvidia.com> |
regmap: introduce explicit bus_context for bus callbacks The only context needed by I2C and SPI bus definitions is the device itself; this can be converted to an i2c_client or spi_device in order to perform IO on the device. However, other bus types may need more context in order to perform IO. Enable this by having regmap_init accept a bus_context parameter, and pass this to all bus callbacks. The existing callbacks simply pass the struct device here. Future bus types may pass something else. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
#
c0eb4676 |
|
30-Jan-2012 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: Implement managed regmap_init() Save error handling and unwinding code in drivers by providing managed versions of the regmap init functions, simplifying usage. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
#
5b457e39 |
|
05-Sep-2011 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: Remove redundant owner field from the bus type struct No longer used as users link directly with the bus types so the core module infrastructure does refcounting for us. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
#
b5ddbf46 |
|
15-Aug-2011 |
Stephen Rothwell <sfr@canb.auug.org.au> |
regmap: using module facilities requires module.h Commit b33f9cbd67ba ("regmap: Specify a module license") added a MODULES_LICENSE to this file without adding an include of module.h. module.h should have been included anyway, since this file has EXPORT_SYMBOLs as well. With the pending module.h split up, this would probably have caused build problems. Cc: Stephen Warren <swarren@nvidia.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
#
b33f9cbd |
|
11-Aug-2011 |
Stephen Warren <swarren@nvidia.com> |
regmap: Specify a module license CONFIG_REGMAP_I2C/SPI are set to m when selected by a tristate config option that's set to m. The regmap modules don't specify a license, so fail to link to regmap_init at load time, since that is EXPORT_SYMBOL_GPL. Fix this by specifying a license for the regmap modules. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
#
790923e5 |
|
08-Aug-2011 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: Remove unused type and list fields from bus interface We no longer enumerate the bus types, we rely on the driver telling us this on init. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
#
a676f083 |
|
12-May-2011 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: Add SPI bus support Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Grant Likely <grant.likely@secretlab.ca>
|