summaryrefslogtreecommitdiffstats
path: root/include/linux/regmap.h
Commit message (Collapse)AuthorAgeFilesLines
*-. Merge branches 'regmap-core', 'regmap-irq' and 'regmap-page' into regmap-nextMark Brown2012-07-221-0/+41
|\ \ | | | | | | | | | | | | | | | Conflicts (trivial context stuff): drivers/base/regmap/regmap.c include/linux/regmap.h
| | * regmap: Add support for register indirect addressing.Krystian Garbaciak2012-06-171-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Devices with register paging or indirectly accessed registers can configure register mapping to map those on virtual address range. During access to virtually mapped register range, indirect addressing is processed automatically, in following steps: 1. selector for page or indirect register is updated (when needed); 2. register in data window is accessed. Configuration should provide minimum and maximum register for virtual range, details of selector field for page selection, minimum and maximum register of data window for indirect access. Virtual range registers are managed by cache as well as direct access registers. In order to make indirect access more efficient, selector register should be declared as non-volatile, if possible. struct regmap_config is extended with the following: struct regmap_range_cfg *ranges; unsigned int n_ranges; [Also reordered debugfs init to later on since the cleanup code was conflicting with the new cleanup code for ranges anyway -- broonie] Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | regmap: Implement support for wake IRQsMark Brown2012-06-051-0/+2
| |/ | | | | | | | | | | | | | | Allow chips to provide a bank of registers for controlling the wake state in a similar fashion to the masks and propagate the wake count to the parent interrupt controller. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | regmap: Remove warning on stubbed dev_get_regmap()Mark Brown2012-06-131-1/+0
| | | | | | | | | | | | | | | | It's perfectly sensible to ask if there's a regmap for a device which doesn't have one so the stubbed version shouldn't complain, the caller should be prepared for this. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | regmap: Constify regmap_irq_chipMark Brown2012-06-031-1/+1
| | | | | | | | | | | | We should never be modifying it and it lets drivers declare it const. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | regmap: allow busses to request formatting with specific endiannessStephen Warren2012-06-031-0/+25
|/ | | | | | | | | | | | | Add a field to struct regmap_bus that allows bus drivers to request that register addresses and values be formatted with a specific endianness. The default endianness is unchanged from current operation: Big. Implement native endian formatting/parsing for 16- and 32-bit values. This will be enough to support regmap-mmio.c. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: add support for non contiguous status to regmap-irqGraeme Gregory2012-05-141-0/+2
| | | | | | | | | | In some chips the IRQ status registers are not contiguous in the register map but spaced at even spaces. This is an easy case to handle with minor changes. It is assume for this purpose that the stride for status is equal to the stride for mask/ack registers as well. Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: Convert regmap_irq to use irq_domainMark Brown2012-05-131-0/+1
| | | | | | | | | | | | | | | | This gets us up to date with the recommended current kernel infrastructure and should transparently give us device tree interrupt bindings for any devices using the framework. If an explicit IRQ mapping is passed in then a legacy interrupt range is created, otherwise a simple linear mapping is used. Previously a mapping was mandatory so existing drivers should not be affected. A function regmap_irq_get_virq() is provided to allow drivers to map individual IRQs which should be used in preference to the existing regmap_irq_chip_get_base() which is only valid if a legacy IRQ range is provided. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
*-. Merge branches 'regmap-core', 'regmap-stride', 'regmap-mmio' and ↵Mark Brown2012-05-131-3/+38
|\ \ | | | | | | | | | 'regmap-irq' into regmap-next
| | * regmap: Implement dev_get_regmap()Mark Brown2012-05-081-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use devres to implement dev_get_regmap(). This should mean that in almost all cases devices wishing to take advantage of framework features based on regmap shouldn't need to explicitly pass the regmap into the framework. This simplifies device setup a bit. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | regmap: Converts group operation into single read write operationsAshish Jangam2012-04-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some devices does not support bulk read and write operations, for them we have series of single write and read operations. Signed-off-by: Anthony Olech <Anthony.Olech@diasemi.com> Signed-off-by: Ashish Jangam <ashish.jangam@kpitcummins.com> [Fixed coding style, don't check use_single_rw before assign --broonie ] Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | regmap: implement register stridingStephen Warren2012-04-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | regmap_config.reg_stride is introduced. All extant register addresses are a multiple of this value. Users of serial-oriented regmap busses will typically set this to 1. Users of the MMIO regmap bus will typically set this based on the value size of their registers, in bytes, so 4 for a 32-bit register. Throughout the regmap code, actual register addresses are used. Wherever the register address is used to index some array of values, the address is divided by the stride to determine the index, or vice-versa. Error- checking is added to all entry-points for register address data to ensure that register addresses actually satisfy the specified stride. The MMIO bus ensures that the specified stride is large enough for the register size. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| | |
| | \
| *-. \ Merge branches 'regmap-core', 'regmap-mmio' and 'regmap-naming' into ↵Mark Brown2012-04-101-3/+21
| |\ \ \ |/ / / / | | | _ | | | regmap-stride
| | * regmap: allow regmap instances to be namedStephen Warren2012-04-101-0/+5
| |/ |/| | | | | | | | | | | | | | | | | | | Some devices have multiple separate register regions. Logically, one regmap would be created per region. One issue that prevents this is that each instance will attempt to create the same debugfs files. Avoid this by allowing regmaps to be named, and use the name to construct the debugfs directory name. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: add MMIO bus supportStephen Warren2012-04-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a basic memory-mapped-IO bus for regmap. It has the following features and limitations: * Registers themselves may be 8, 16, 32, or 64-bit. 64-bit is only supported on 64-bit platforms. * Register offsets are limited to precisely 32-bit. * IO is performed using readl/writel, with no provision for using the __raw_readl or readl_relaxed variants. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: introduce fast_io busses, and use a spinlock for themStephen Warren2012-04-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | Some bus types have very fast IO. For these, acquiring a mutex for every IO operation is a significant overhead. Allow busses to indicate their IO is fast, and enhance regmap to use a spinlock for those busses. [Currently limited to native endian registers -- broonie] Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: introduce explicit bus_context for bus callbacksStephen Warren2012-04-061-3/+7
|/ | | | | | | | | | | | | 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>
* Merge tag 'device-for-3.4' of ↵Linus Torvalds2012-03-241-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux Pull <linux/device.h> avoidance patches from Paul Gortmaker: "Nearly every subsystem has some kind of header with a proto like: void foo(struct device *dev); and yet there is no reason for most of these guys to care about the sub fields within the device struct. This allows us to significantly reduce the scope of headers including headers. For this instance, a reduction of about 40% is achieved by replacing the include with the simple fact that the device is some kind of a struct. Unlike the much larger module.h cleanup, this one is simply two commits. One to fix the implicit <linux/device.h> users, and then one to delete the device.h includes from the linux/include/ dir wherever possible." * tag 'device-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: device.h: audit and cleanup users in main include dir device.h: cleanup users outside of linux/include (C files)
| * device.h: audit and cleanup users in main include dirPaul Gortmaker2012-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The <linux/device.h> header includes a lot of stuff, and it in turn gets a lot of use just for the basic "struct device" which appears so often. Clean up the users as follows: 1) For those headers only needing "struct device" as a pointer in fcn args, replace the include with exactly that. 2) For headers not really using anything from device.h, simply delete the include altogether. 3) For headers relying on getting device.h implicitly before being included themselves, now explicitly include device.h 4) For files in which doing #1 or #2 uncovers an implicit dependency on some other header, fix by explicitly adding the required header(s). Any C files that were implicitly relying on device.h to be present have already been dealt with in advance. Total removals from #1 and #2: 51. Total additions coming from #3: 9. Total other implicit dependencies from #4: 7. As of 3.3-rc1, there were 110, so a net removal of 42 gives about a 38% reduction in device.h presence in include/* Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
* | Merge remote-tracking branch 'regmap/topic/bulk' into regmap-nextMark Brown2012-03-141-0/+2
|\ \
| * | regmap: add regmap_bulk_write() for register writeLaxman Dewangan2012-02-141-0/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | The bulk_write() supports the data transfer to multi register which takes the data into cpu_endianness format and does formatting of data to device format before sending to device. The transfer can be completed in single transfer or multiple transfer based on data formatting. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | Merge remote-tracking branch 'regmap/topic/introspection' into regmap-nextMark Brown2012-03-141-0/+1
|\ \ | | | | | | | | | | | | Simple add/add conflict: drivers/base/regmap/regmap.c
| * | regmap: Allow users to query the size of register valuesMark Brown2012-02-201-0/+1
| |/ | | | | | | | | | | | | | | Generic infrastructure based on top of regmap may want to operate on blocks of data and therefore find it useful to find the size of the register values. Provide an accessor operation for this. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | Merge remote-tracking branches 'regmap/topic/patch' and 'regmap/topic/sync' ↵Mark Brown2012-03-141-0/+2
|\ \ | | | | | | | | | into regmap-next
| * | regmap: Allow drivers to sync only part of the register cacheMark Brown2012-02-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide a regcache_sync_region() operation which allows drivers to write only part of the cache back to the hardware. This is intended for use in cases like power domains or DSP memories where part of the device register map may be reset without fully resetting the device. Fully supporting these devices is likely to require additional work to make specific regions of the register map cache only while they are in reset, but this is enough for most devices. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | | Merge remote-tracking branch 'regmap/topic/drivers' into regmap-nextMark Brown2012-03-141-0/+3
|\ \ \ | | | | | | | | | | | | | | | | | | | | Resolved simple add/add conflicts: drivers/base/regmap/internal.h drivers/base/regmap/regmap.c
| * \ \ Merge branch 'topic/patch' of ↵Mark Brown2012-02-201-0/+3
| |\ \ \ | | |/ / | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap into regmap-drivers
| | * | regmap: Support register patch setsMark Brown2012-01-231-0/+3
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Device manufacturers frequently provide register sequences, usually not fully documented, to be run at startup in order to provide better defaults for devices (for example, improving performance in the light of silicon evaluation). Support such updates by allowing drivers to register update sets with the core. These updates will be written to the device immediately and will also be rewritten when the cache is synced. The assumption is that the reason for resyncing the cache will always be that the device has been powered off. If this turns out to not be the case then a separate operation can be provided. Currently the implementation only allows a single set of updates to be specified for a device, this could be extended in future. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | | Merge remote-tracking branches 'regmap/topic/core' and 'regmap/topic/devm' ↵Mark Brown2012-03-141-0/+8
|\ \ \ | |/ / | | | | | | into regmap-next
| * | regmap: Implement managed regmap_init()Mark Brown2012-01-301-0/+8
| |/ | | | | | | | | | | | | 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>
* | regmap: Rejig struct declarations for stubbed APIMark Brown2012-03-111-2/+3
| | | | | | | | | | | | | | | | | | Ensure we have a forward declaration of struct regmap that isn't just the return value of regmap_init() and make the definition of the register defaults available. Reported-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | regmap: Add stub for regcache_sync_region()Mark Brown2012-03-011-0/+7
| | | | | | | | | | | | Added on another branch. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | regmap: Add stub regmap calls as a build crutch for infrastructure usersMark Brown2012-02-171-0/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | Make life easier for subsystems which build infrastructure on top of the regmap API by providing stub definitions for most of the API so that users can at least build even if the regmap API is not enabled without having to add ifdefs if they don't want to. These stubs are not expected to be useful and should never actually get called, they just exist so that we can link so there are WARN_ONCE()s in the stubs. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | regmap: Add support for padding between register and addressMark Brown2012-01-201-0/+2
|/ | | | | | | | | | Some devices, especially those with high speed control interfaces, require padding between the register and the data. Support this in the regmap API by providing a pad_bits configuration parameter. Only devices with integer byte counts are supported. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* Merge branch 'regmap/irq' into regmap-nextMark Brown2011-12-051-0/+1
|\
| * regmap: Add irq_base accessor to regmap_irqMark Brown2011-12-051-0/+1
| | | | | | | | | | | | | | Allows devices to discover their own interrupt without having to remember it themselves. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | Merge branch 'topic/cache' of ↵Mark Brown2011-12-051-0/+2
|\ \ | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap into regmap-next
| * | regmap: Allow drivers to reinitialise the register cache at runtimeMark Brown2011-12-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes the register map information may change in ways that drivers can discover at runtime. For example, new revisions of a device may add new registers. Support runtime discovery by drivers by allowing the register cache to be reinitialised with a new function regmap_reinit_cache() which discards the existing cache and creates a new one. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | | regmap: Allow regmap_update_bits() users to detect changesMark Brown2011-11-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some users of regmap_update_bits() would like to be able to tell their users if they actually did an update so provide a variant which also returns a flag indicating if an update took place. We could return a tristate in the return value of regmap_update_bits() but this makes the API more cumbersome to use and doesn't fit with the general zero for success idiom we have. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | | regmap: Remove indexed cache typeMark Brown2011-11-201-1/+0
| | | | | | | | | | | | | | | | | | | | | There should be no situation where it offers any advantage over rbtree and there are no current users so remove the code for simplicity. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | | regmap: Make reg_config reg_defaults constLars-Peter Clausen2011-11-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reg_defaults field usually points to a static per driver array, which should not be modified. Make requirement this explicit by making reg_defaults const. To allow this the regcache_init code needs some minor changes. Previoulsy the reg_config was not available in regcache_init and regmap->reg_defaults was used to pass the default register set to regcache_init. Now that the reg_config is available we can work on it directly. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| | |
| \ \
*-. \ \ Merge branches 'regmap/irq' and 'regmap/cache' into regmap-nextMark Brown2011-11-081-1/+49
|\ \ \ \ | | |/ / | | | / | | |/ | |/|
| | * regmap: Rename LZO cache type to compressedMark Brown2011-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Users probably don't care about the specific compression algorithm and we might want to use a different algorithm (snappy being the one I'm thinking of right now) so update the public interface to have a more generic name. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| | * regmap: Track if the register cache is dirty and suppress unneeded syncsMark Brown2011-11-081-0/+1
| |/ |/| | | | | | | | | | | | | | | Allow drivers to optimise out the register cache sync if they didn't need to do one. If the hardware is desynced from the register cache (by power loss for example) then the driver should call regcache_mark_dirty() to let the core know about this. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Add a reusable irq_chip for regmap based interrupt controllersMark Brown2011-11-081-0/+47
|/ | | | | | | | | | | | | | | | | There seem to be lots of regmap-using devices with very similar interrupt controllers with a small bank of interrupt registers and mask registers with an interrupt per bit. This won't cover everything but it's a good start. Each chip supplies a base for the status registers, a base for the mask registers, an optional base for writing acknowledgements (which may be the same as the status registers) and an array of bits within each of these register banks which indicate the interrupt. There is an assumption that the bit for each interrupt will be the same in each of the register bank. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* include: replace linux/module.h with "struct module" wherever possiblePaul Gortmaker2011-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | | The <linux/module.h> pretty much brings in the kitchen sink along with it, so it should be avoided wherever reasonably possible in terms of being included from other commonly used <linux/something.h> files, as it results in a measureable increase on compile times. The worst culprit was probably device.h since it is used everywhere. This file also had an implicit dependency/usage of mutex.h which was masked by module.h, and is also fixed here at the same time. There are over a dozen other headers that simply declare the struct instead of pulling in the whole file, so follow their lead and simply make it a few more. Most of the implicit dependencies on module.h being present by these headers pulling it in have been now weeded out, so we can finally make this change with hopefully minimal breakage. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
* regmap: Implement regcache_cache_bypass helper functionDimitris Papastamos2011-09-301-0/+1
| | | | | | | | Ensure we've got a function so users can enable/disable the cache bypass option. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: Allow drivers to control cache_only flagMark Brown2011-09-191-0/+2
| | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: Prototype regcache_sync()Mark Brown2011-09-191-0/+1
| | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: Add the LZO cache supportDimitris Papastamos2011-09-191-0/+1
| | | | | | | | | | | | | | | | | | This patch adds support for LZO compression when storing the register cache. For a typical device whose register map would normally occupy 25kB or 50kB by using the LZO compression technique, one can get down to ~5-7kB. There might be a performance penalty associated with each individual read/write due to decompressing/compressing the underlying cache, however that should not be noticeable. These memory benefits depend on whether the target architecture can get rid of the memory occupied by the original register defaults cache which is marked as __devinitconst. Nevertheless there will be some memory gain even if the target architecture can't get rid of the original register map, this should be around ~30-32kB instead of 50kB. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
OpenPOWER on IntegriCloud