|
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1, v6.14, v6.14-rc7, v6.14-rc6, v6.14-rc5, v6.14-rc4, v6.14-rc3, v6.14-rc2, v6.14-rc1, v6.13, v6.13-rc7, v6.13-rc6, v6.13-rc5, v6.13-rc4, v6.13-rc3 |
|
| #
eb708cd6 |
| 11-Dec-2024 |
Richard Fitzgerald <[email protected]> |
regmap: regmap_multi_reg_read(): make register list const
Mark the list of registers passed into regmap_multi_reg_read() as a pointer to const. This allows the caller to define the register list as
regmap: regmap_multi_reg_read(): make register list const
Mark the list of registers passed into regmap_multi_reg_read() as a pointer to const. This allows the caller to define the register list as const data.
This requires making the same change to _regmap_bulk_read(), which is called by regmap_multi_reg_read().
Signed-off-by: Richard Fitzgerald <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.13-rc2, v6.13-rc1 |
|
| #
9b3cd5c7 |
| 21-Nov-2024 |
Andy Shevchenko <[email protected]> |
regmap: place foo / 8 and foo % 8 closer to each other
On x86 the compiler (gcc (Debian 14.2.0-8) 14.2.0) may generate a better code if it sees division and modulo goes together.
Function
regmap: place foo / 8 and foo % 8 closer to each other
On x86 the compiler (gcc (Debian 14.2.0-8) 14.2.0) may generate a better code if it sees division and modulo goes together.
Function old new delta __regmap_init 3740 3732 -8 Total: Before=31159, After=31151, chg -0.03%
clang (Debian clang version 18.1.8) on x86_64 still shows better code
Function old new delta __regmap_init 3582 3579 -3 Total: Before=39854, After=39851, chg -0.01%
Signed-off-by: Andy Shevchenko <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
| #
a4a7d86b |
| 21-Nov-2024 |
Andy Shevchenko <[email protected]> |
regmap: Use BITS_TO_BYTES()
BITS_TO_BYTES() is the existing macro which takes care about full bytes that may fully hold the given amount of bits. Use it.
Signed-off-by: Andy Shevchenko <andriy.shev
regmap: Use BITS_TO_BYTES()
BITS_TO_BYTES() is the existing macro which takes care about full bytes that may fully hold the given amount of bits. Use it.
Signed-off-by: Andy Shevchenko <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
| #
3061e170 |
| 28-Nov-2024 |
Cosmin Tanislav <[email protected]> |
regmap: detach regmap from dev on regmap_exit
At the end of __regmap_init(), if dev is not NULL, regmap_attach_dev() is called, which adds a devres reference to the regmap, to be able to retrieve a
regmap: detach regmap from dev on regmap_exit
At the end of __regmap_init(), if dev is not NULL, regmap_attach_dev() is called, which adds a devres reference to the regmap, to be able to retrieve a dev's regmap by name using dev_get_regmap().
When calling regmap_exit, the opposite does not happen, and the reference is kept until the dev is detached.
Add a regmap_detach_dev() function and call it in regmap_exit() to make sure that the devres reference is not kept.
Cc: [email protected] Fixes: 72b39f6f2b5a ("regmap: Implement dev_get_regmap()") Signed-off-by: Cosmin Tanislav <[email protected]> Rule: add Link: https://lore.kernel.org/stable/20241128130554.362486-1-demonsingur%40gmail.com Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
| #
3f1aa0c5 |
| 27-Nov-2024 |
Mark Brown <[email protected]> |
regmap: Use correct format specifier for logging range errors
The register addresses are unsigned ints so we should use %u not %d to log them.
Signed-off-by: Mark Brown <[email protected]> Link: h
regmap: Use correct format specifier for logging range errors
The register addresses are unsigned ints so we should use %u not %d to log them.
Signed-off-by: Mark Brown <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.12, v6.12-rc7, v6.12-rc6 |
|
| #
1ed9b927 |
| 31-Oct-2024 |
Cristian Ciocaltea <[email protected]> |
regmap: maple: Provide lockdep (sub)class for maple tree's internal lock
In some cases when using the maple tree register cache, the lockdep validator might complain about invalid deadlocks:
[7.131
regmap: maple: Provide lockdep (sub)class for maple tree's internal lock
In some cases when using the maple tree register cache, the lockdep validator might complain about invalid deadlocks:
[7.131886] Possible interrupt unsafe locking scenario:
[7.131890] CPU0 CPU1 [7.131893] ---- ---- [7.131896] lock(&mt->ma_lock); [7.131904] local_irq_disable(); [7.131907] lock(rockchip_drm_vop2:3114:(&vop2_regmap_config)->lock); [7.131916] lock(&mt->ma_lock); [7.131925] <Interrupt> [7.131928] lock(rockchip_drm_vop2:3114:(&vop2_regmap_config)->lock); [7.131936] *** DEADLOCK ***
[7.131939] no locks held by swapper/0/0. [7.131944] the shortest dependencies between 2nd lock and 1st lock: [7.131950] -> (&mt->ma_lock){+.+.}-{2:2} { [7.131966] HARDIRQ-ON-W at: [7.131973] lock_acquire+0x200/0x330 [7.131986] _raw_spin_lock+0x50/0x70 [7.131998] regcache_maple_write+0x68/0xe0 [7.132010] regcache_write+0x6c/0x90 [7.132019] _regmap_read+0x19c/0x1d0 [7.132029] _regmap_update_bits+0xc0/0x148 [7.132038] regmap_update_bits_base+0x6c/0xa8 [7.132048] rk8xx_probe+0x22c/0x3d8 [7.132057] rk8xx_spi_probe+0x74/0x88 [7.132065] spi_probe+0xa8/0xe0
[...]
[7.132675] } [7.132678] ... key at: [<ffff800082943c20>] __key.0+0x0/0x10 [7.132691] ... acquired at: [7.132695] _raw_spin_lock+0x50/0x70 [7.132704] regcache_maple_write+0x68/0xe0 [7.132714] regcache_write+0x6c/0x90 [7.132724] _regmap_read+0x19c/0x1d0 [7.132732] _regmap_update_bits+0xc0/0x148 [7.132741] regmap_field_update_bits_base+0x74/0xb8 [7.132751] vop2_plane_atomic_update+0x480/0x14d8 [rockchipdrm] [7.132820] drm_atomic_helper_commit_planes+0x1a0/0x320 [drm_kms_helper]
[...]
[7.135112] -> (rockchip_drm_vop2:3114:(&vop2_regmap_config)->lock){-...}-{2:2} { [7.135130] IN-HARDIRQ-W at: [7.135136] lock_acquire+0x200/0x330 [7.135147] _raw_spin_lock_irqsave+0x6c/0x98 [7.135157] regmap_lock_spinlock+0x20/0x40 [7.135166] regmap_read+0x44/0x90 [7.135175] vop2_isr+0x90/0x290 [rockchipdrm] [7.135225] __handle_irq_event_percpu+0x124/0x2d0
In the example above, the validator seems to get the scope of dependencies wrong, since the regmap instance used in rk8xx-spi driver has nothing to do with the instance from vop2.
Improve validation by sharing the regmap's lockdep class with the maple tree's internal lock, while also providing a subclass for the latter.
Signed-off-by: Cristian Ciocaltea <[email protected]> Link: https://patch.msgid.link/20241031-regmap-maple-lockdep-fix-v2-1-06a3710f3623@collabora.com Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.12-rc5, v6.12-rc4, v6.12-rc3, v6.12-rc2 |
|
| #
5f60d5f6 |
| 01-Oct-2024 |
Al Viro <[email protected]> |
move asm/unaligned.h to linux/unaligned.h
asm/unaligned.h is always an include of asm-generic/unaligned.h; might as well move that thing to linux/unaligned.h and include that - there's nothing arch-
move asm/unaligned.h to linux/unaligned.h
asm/unaligned.h is always an include of asm-generic/unaligned.h; might as well move that thing to linux/unaligned.h and include that - there's nothing arch-specific in that header.
auto-generated by the following:
for i in `git grep -l -w asm/unaligned.h`; do sed -i -e "s/asm\/unaligned.h/linux\/unaligned.h/" $i done for i in `git grep -l -w asm-generic/unaligned.h`; do sed -i -e "s/asm-generic\/unaligned.h/linux\/unaligned.h/" $i done git mv include/asm-generic/unaligned.h include/linux/unaligned.h git mv tools/include/asm-generic/unaligned.h tools/include/linux/unaligned.h sed -i -e "/unaligned.h/d" include/asm-generic/Kbuild sed -i -e "s/__ASM_GENERIC/__LINUX/" include/linux/unaligned.h tools/include/linux/unaligned.h
show more ...
|
|
Revision tags: v6.12-rc1, v6.11, v6.11-rc7, v6.11-rc6, v6.11-rc5 |
|
| #
fd4ebc07 |
| 22-Aug-2024 |
Mark Brown <[email protected]> |
regmap: Hold the regmap lock when allocating and freeing the cache
For the benefit of the maple tree's lockdep checking hold the lock while creating and exiting the cache.
Signed-off-by: Mark Brown
regmap: Hold the regmap lock when allocating and freeing the cache
For the benefit of the maple tree's lockdep checking hold the lock while creating and exiting the cache.
Signed-off-by: Mark Brown <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.11-rc4, v6.11-rc3, v6.11-rc2, v6.11-rc1, v6.10 |
|
| #
3c1ff93b |
| 10-Jul-2024 |
Guenter Roeck <[email protected]> |
regmap: Implement regmap_multi_reg_read()
regmap_multi_reg_read() is similar to regmap_bilk_read() but reads from an array of non-sequential registers.
Signed-off-by: Guenter Roeck <linux@roeck-us.
regmap: Implement regmap_multi_reg_read()
regmap_multi_reg_read() is similar to regmap_bilk_read() but reads from an array of non-sequential registers.
Signed-off-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.10-rc7, v6.10-rc6, v6.10-rc5, v6.10-rc4, v6.10-rc3 |
|
| #
f6841d41 |
| 06-Jun-2024 |
Andy Shevchenko <[email protected]> |
regmap: Switch to use kmemdup_array()
Let the kememdup_array() take care about multiplication and possible overflows.
Signed-off-by: Andy Shevchenko <[email protected]> Link: https:
regmap: Switch to use kmemdup_array()
Let the kememdup_array() take care about multiplication and possible overflows.
Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.10-rc2, v6.10-rc1, v6.9, v6.9-rc7, v6.9-rc6, v6.9-rc5, v6.9-rc4 |
|
| #
70ee853e |
| 08-Apr-2024 |
Richard Fitzgerald <[email protected]> |
regmap: Add regmap_read_bypassed()
Add a regmap_read_bypassed() to allow reads from the hardware registers while the regmap is in cache-only mode.
A typical use for this is to keep the cache in cac
regmap: Add regmap_read_bypassed()
Add a regmap_read_bypassed() to allow reads from the hardware registers while the regmap is in cache-only mode.
A typical use for this is to keep the cache in cache-only mode until the hardware has reached a valid state, but one or more status registers must be polled to determine when this state is reached.
For example, firmware download on the cs35l56 can take several seconds if there are multiple amps sharing limited bus bandwidth. This is too long to block in probe() so it is done as a background task. The device must be soft-reset to reboot the firmware and during this time the registers are not accessible, so the cache should be in cache-only. But the driver must poll a register to detect when reboot has completed.
Signed-off-by: Richard Fitzgerald <[email protected]> Fixes: 8a731fd37f8b ("ASoC: cs35l56: Move utility functions to shared file") Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.9-rc3, v6.9-rc2, v6.9-rc1, v6.8, v6.8-rc7, v6.8-rc6, v6.8-rc5, v6.8-rc4, v6.8-rc3, v6.8-rc2 |
|
| #
0ec74ad3 |
| 26-Jan-2024 |
Jan Dakinevich <[email protected]> |
regmap: rework ->max_register handling
When regmap consists of single register, 'regmap' subsystem is unable to understand whether ->max_register is set or not, because in both cases it is equal to
regmap: rework ->max_register handling
When regmap consists of single register, 'regmap' subsystem is unable to understand whether ->max_register is set or not, because in both cases it is equal to zero. It leads to that the logic based on value of ->max_register doesn't work. For example using of REGCACHE_FLAT fails.
This patch introduces an extra parameter to regmap config, indicating that zero value in ->max_register is authentic.
Signed-off-by: Jan Dakinevich <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.8-rc1, v6.7, v6.7-rc8, v6.7-rc7, v6.7-rc6, v6.7-rc5, v6.7-rc4, v6.7-rc3 |
|
| #
1957b92a |
| 21-Nov-2023 |
Hugo Villeneuve <[email protected]> |
regmap: fix regmap_noinc_write() description
Change "Write data from" -> "Write data to".
Signed-off-by: Hugo Villeneuve <[email protected]> Link: https://lore.kernel.org/r/20231121230900.37
regmap: fix regmap_noinc_write() description
Change "Write data from" -> "Write data to".
Signed-off-by: Hugo Villeneuve <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.7-rc2, v6.7-rc1 |
|
| #
984a4afd |
| 01-Nov-2023 |
Ben Wolsieffer <[email protected]> |
regmap: prevent noinc writes from clobbering cache
Currently, noinc writes are cached as if they were standard incrementing writes, overwriting unrelated register values in the cache. Instead, we wa
regmap: prevent noinc writes from clobbering cache
Currently, noinc writes are cached as if they were standard incrementing writes, overwriting unrelated register values in the cache. Instead, we want to cache the last value written to the register, as is done in the accelerated noinc handler (regmap_noinc_readwrite).
Fixes: cdf6b11daa77 ("regmap: Add regmap_noinc_write API") Signed-off-by: Ben Wolsieffer <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.6, v6.6-rc7, v6.6-rc6, v6.6-rc5 |
|
| #
c6df8433 |
| 06-Oct-2023 |
Johan Hovold <[email protected]> |
regmap: fix NULL deref on lookup
Not all regmaps have a name so make sure to check for that to avoid dereferencing a NULL pointer when dev_get_regmap() is used to lookup a named regmap.
Fixes: e848
regmap: fix NULL deref on lookup
Not all regmaps have a name so make sure to check for that to avoid dereferencing a NULL pointer when dev_get_regmap() is used to lookup a named regmap.
Fixes: e84861fec32d ("regmap: dev_get_regmap_match(): fix string comparison") Cc: [email protected] # 5.8 Cc: Marc Kleine-Budde <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.6-rc4, v6.6-rc3, v6.6-rc2, v6.6-rc1, v6.5, v6.5-rc7, v6.5-rc6, v6.5-rc5, v6.5-rc4, v6.5-rc3 |
|
| #
e02a4ccb |
| 21-Jul-2023 |
Mark Brown <[email protected]> |
regmap: Remove dynamic allocation warnings for rbtree and maple
Thanks to Dan and Guenter's very prompt updates of the rbtree and maple caches to support GPF_ATOMIC allocations and since the update
regmap: Remove dynamic allocation warnings for rbtree and maple
Thanks to Dan and Guenter's very prompt updates of the rbtree and maple caches to support GPF_ATOMIC allocations and since the update shook out a bunch of users at least some of whom have been suitably careful about ensuring that the cache is prepoulated so there are no dynamic allocations after init let's revert the warnings.
Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected]
show more ...
|
| #
ee43f5bb |
| 20-Jul-2023 |
Guenter Roeck <[email protected]> |
regmap: Reject fast_io regmap configurations with RBTREE and MAPLE caches
REGCACHE_RBTREE and REGCACHE_MAPLE dynamically allocate memory for regmap operations. This is incompatible with spinlock bas
regmap: Reject fast_io regmap configurations with RBTREE and MAPLE caches
REGCACHE_RBTREE and REGCACHE_MAPLE dynamically allocate memory for regmap operations. This is incompatible with spinlock based locking which is used for fast_io operations. Reject affected configurations.
Signed-off-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.5-rc2 |
|
| #
bc647348 |
| 12-Jul-2023 |
Mark Brown <[email protected]> |
regmap: Drop initial version of maximum transfer length fixes
When problems were noticed with the register address not being taken into account when limiting raw transfers with I2C devices we fixed
regmap: Drop initial version of maximum transfer length fixes
When problems were noticed with the register address not being taken into account when limiting raw transfers with I2C devices we fixed this in the core. Unfortunately it has subsequently been realised that a lot of buses were relying on the prior behaviour, partly due to unclear documentation not making it obvious what was intended in the core. This is all more involved to fix than is sensible for a fix commit so let's just drop the original fixes, a separate commit will fix the originally observed problem in an I2C specific way
Fixes: 3981514180c9 ("regmap: Account for register length when chunking") Fixes: c8e796895e23 ("regmap: spi-avmm: Fix regmap_bus max_raw_write") Signed-off-by: Mark Brown <[email protected]> Reviewed-by: Xu Yilun <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.5-rc1, v6.4 |
|
| #
1425bdd7 |
| 22-Jun-2023 |
Andy Shevchenko <[email protected]> |
regmap: Revert "add 64-bit mode support" and Co.
With unsigned int type we never ever can pass 64-bit value. Remove never properly worked code.
Note, there are no users in kernel for this size of r
regmap: Revert "add 64-bit mode support" and Co.
With unsigned int type we never ever can pass 64-bit value. Remove never properly worked code.
Note, there are no users in kernel for this size of register offsets or data.
This reverts commit afcc00b91f1865f6d0bbdb687dd642ce8a3c3c9e.
Also revert other 64-bit code excerpts in the regmap implementation that had been induced by the false impression made by the above mentioned change that there is a support of that data size.
Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.4-rc7 |
|
| #
3e47b887 |
| 15-Jun-2023 |
Mark Brown <[email protected]> |
regmap: Drop early readability check
We have some drivers that have a use case for cached write only registers, doing read/modify/writes on read only registers in order to work more easily with bitf
regmap: Drop early readability check
We have some drivers that have a use case for cached write only registers, doing read/modify/writes on read only registers in order to work more easily with bitfields. Go back to trying the cache before we check if we can read from the device.
Fixes: eab5abdeb79f0 ("regmap: Check for register readability before checking cache during read") Reported-by: Konrad Dybcio <[email protected]> Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/20230615-regmap-drop-early-readability-v1-1-8135094362de@kernel.org Signed-off-by: Mark Brown <[email protected]>
show more ...
|
| #
eab5abde |
| 13-Jun-2023 |
Mark Brown <[email protected]> |
regmap: Check for register readability before checking cache during read
Ensure that we don't return a spurious cache hit for unreadable registers (eg, with the flat cache which doesn't understand s
regmap: Check for register readability before checking cache during read
Ensure that we don't return a spurious cache hit for unreadable registers (eg, with the flat cache which doesn't understand sparseness) by checking for readability before we do a cache lookup.
Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/20230613-b4-regmap-check-readability-before-cache-v1-1-b144c0b01ed9@kernel.org Signed-off-by: Mark Brown <[email protected]>
show more ...
|
| #
b629c698 |
| 13-Jun-2023 |
Waqar Hameed <[email protected]> |
regmap: Add debugfs file for forcing field writes
`_regmap_update_bits()` checks if the current register value differs from the new value, and only writes to the register if they differ. When testin
regmap: Add debugfs file for forcing field writes
`_regmap_update_bits()` checks if the current register value differs from the new value, and only writes to the register if they differ. When testing hardware drivers, it might be desirable to always force a register write, for example when writing to a `regmap_field`. This enables and simplifies testing and verification of the hardware interaction. For example, when using a hardware mock/simulation model, one can then more easily verify that the driver makes the correct expected register writes during certain events.
Add a bool variable `force_write_field` and a corresponding debugfs entry to enable this. Since this feature could interfere with driver operation, guard it with a macro.
Signed-off-by: Waqar Hameed <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.4-rc6, v6.4-rc5 |
|
| #
99e8dd39 |
| 01-Jun-2023 |
Charles Keepax <[email protected]> |
regmap: Add missing cache_only checks
The current behaviour around cache_only is slightly inconsistent, most paths will only check cache_only if cache_bypass is false, and will return -EBUSY if a re
regmap: Add missing cache_only checks
The current behaviour around cache_only is slightly inconsistent, most paths will only check cache_only if cache_bypass is false, and will return -EBUSY if a read attempts to go to the hardware whilst cache_only is true. However, a couple of paths will not check cache_only at all. The most notable of these being regmap_raw_read which will check cache_only in the case it processes the transaction one register at a time, but not in the case it handles them as a block. In the typical case a device has been put into cache_only whilst powered down this can cause physical reads to happen whilst the device is unavailable.
Add a check in regmap_raw_read and move the check in regmap_noinc_read, adding a check for cache_bypass, such that all paths are covered and consistent.
Signed-off-by: Charles Keepax <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|
|
Revision tags: v6.4-rc4, v6.4-rc3 |
|
| #
39815141 |
| 17-May-2023 |
Jim Wylder <[email protected]> |
regmap: Account for register length when chunking
Currently, when regmap_raw_write() splits the data, it uses the max_raw_write value defined for the bus. For any bus that includes the target regis
regmap: Account for register length when chunking
Currently, when regmap_raw_write() splits the data, it uses the max_raw_write value defined for the bus. For any bus that includes the target register address in the max_raw_write value, the chunked transmission will always exceed the maximum transmission length. To avoid this problem, subtract the length of the register and the padding from the maximum transmission.
Signed-off-by: Jim Wylder <[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]
show more ...
|
|
Revision tags: v6.4-rc2, v6.4-rc1, v6.3, v6.3-rc7, v6.3-rc6 |
|
| #
4a670ac3 |
| 07-Apr-2023 |
Maxime Chevallier <[email protected]> |
regmap: allow upshifting register addresses before performing operations
Similar to the existing reg_downshift mechanism, that is used to translate register addresses on busses that have a smaller a
regmap: allow upshifting register addresses before performing operations
Similar to the existing reg_downshift mechanism, that is used to translate register addresses on busses that have a smaller address stride, it's also possible to want to upshift register addresses.
Such a case was encountered when network PHYs and PCS that usually sit on a MDIO bus (16-bits register with a stride of 1) are integrated directly as memory-mapped devices. Here, the same register layout defined in 802.3 is used, but the register now have a larger stride.
Introduce a mechanism to also allow upshifting register addresses. Re-purpose reg_downshift into a more generic, signed reg_shift, whose sign indicates the direction of the shift. To avoid confusion, also introduce macros to explicitly indicate if we want to downshift or upshift.
For bisectability, change any use of reg_downshift to use reg_shift.
Signed-off-by: Maxime Chevallier <[email protected]> Tested-by: Colin Foster <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
show more ...
|