mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
lib: Add support for generic packing operations
This provides an unified API for accessing register bit fields regardless of memory layout. The basic unit of data for these API functions is the u64. The process of transforming an u64 from native CPU encoding into the peripheral's encoding is called 'pack', and transforming it from peripheral to native CPU encoding is 'unpack'. Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
8b95274784
commit
554aae3500
6 changed files with 437 additions and 0 deletions
17
lib/Kconfig
17
lib/Kconfig
|
|
@ -18,6 +18,23 @@ config RAID6_PQ_BENCHMARK
|
|||
Benchmark all available RAID6 PQ functions on init and choose the
|
||||
fastest one.
|
||||
|
||||
config PACKING
|
||||
bool "Generic bitfield packing and unpacking"
|
||||
default n
|
||||
help
|
||||
This option provides the packing() helper function, which permits
|
||||
converting bitfields between a CPU-usable representation and a
|
||||
memory representation that can have any combination of these quirks:
|
||||
- Is little endian (bytes are reversed within a 32-bit group)
|
||||
- The least-significant 32-bit word comes first (within a 64-bit
|
||||
group)
|
||||
- The most significant bit of a byte is at its right (bit 0 of a
|
||||
register description is numerically 2^7).
|
||||
Drivers may use these helpers to match the bit indices as described
|
||||
in the data sheets of the peripherals they are in control of.
|
||||
|
||||
When in doubt, say N.
|
||||
|
||||
config BITREVERSE
|
||||
tristate
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue