29 Aug, 2013

1 commit

  • With devices which have a dense and small register map but placed at a large
    offset the global cache_present bitmap imposes a huge memory overhead. Making
    the cache_present per rbtree node avoids the issue and easily reduces the memory
    footprint by a factor of ten. For devices with a more sparse map or without a
    large base register offset the memory usage might increase slightly by a few
    bytes, but not significantly. E.g. for a device which has ~50 registers at
    offset 0x4000 the memory footprint of the register cache goes down form 2496
    bytes to 175 bytes.

    Moving the bitmap to a per node basis means that the handling of the bitmap is
    now cache implementation specific and can no longer be managed by the core. The
    regcache_sync_block() function is extended by a additional parameter so that the
    cache implementation can tell the core which registers in the block are set and
    which are not. The parameter is optional and if NULL the core assumes that all
    registers are set. The rbtree cache also needs to implement its own drop
    callback instead of relying on the core to handle this.

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Mark Brown

    Lars-Peter Clausen
     

09 Aug, 2013

1 commit

  • In the initial case when no reg_defaults values are
    provided and no register value was added to the cache
    yet, the cache_present bitmap is NULL. If this function
    is invoked for any register it should return false
    (i.e. the register is not cached) instead of true.

    Signed-off-by: Ionut Nicu
    Signed-off-by: Mark Brown

    Ionut Nicu
     

30 Jun, 2013

1 commit


12 Jun, 2013

1 commit

  • It is common to access regmap registers at bit level, using
    regmap_update_bits or regmap_read functions, however the end user has to
    take care of a mask or shifting. This becomes overhead when such use
    cases are high. Having a common function to do this is much convenient
    and less error prone.

    The idea of regmap_field is simple, regmap_field gives a logical
    structure to bits of the regmap register, and the driver can use this
    logical entity without the knowledge of the bit positions and masks all
    over the code. This way code looks much neat and it need not handle the
    masks, shifts every time it access the those entities.

    With this new regmap_field_read/write apis the end user can setup a
    regmap field using regmap_field_init and use the return regmap_field to
    read write the register field without worrying about the masks or
    shifts.

    Also this apis will be useful for drivers which are based on regmaps,
    like some clocks or pinctrls which can work on the regmap_fields
    directly without having to worry about bit positions.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Mark Brown

    Srinivas Kandagatla
     

25 May, 2013

1 commit

  • regmap-mmio uses a spinlock with spin_lock() and spin_unlock() for locking.
    To be able to use the regmap API from different contexts (atomic vs non-atomic),
    without the risk of race conditions, we need to use spin_lock_irqsave() and
    spin_lock_irqrestore() instead. A new field, the spinlock_flags field, is added
    to regmap struct to store the flags between regmap_{,un}lock_spinlock(). The
    spinlock_flags field itself is also protected by the spinlock.

    Thanks to Stephen Warren for the suggestion of this particular solution.

    Signed-off-by: Lars-Peter Clausen
    Reviewed-by: Stephen Warren
    Signed-off-by: Mark Brown

    Lars-Peter Clausen
     

12 May, 2013

1 commit


16 Apr, 2013

1 commit


30 Mar, 2013

2 commits

  • The idea of holding blocks of registers in device format is shared between
    at least rbtree and lzo cache formats so split out the loop that does the
    sync from the rbtree code so optimisations on it can be reused.

    Signed-off-by: Mark Brown
    Reviewed-by: Dimitris Papastamos

    Mark Brown
     
  • The idea of maintaining a bitmap of present registers is something that
    can usefully be used by other cache types that maintain blocks of cached
    registers so move the code out of the rbtree cache and into the generic
    regcache code.

    Refactor the interface slightly as we go to wrap the set bit and enlarge
    bitmap operations (since we never do one without the other) and make it
    more robust for reads of uncached registers by bounds checking before we
    look at the bitmap.

    Signed-off-by: Mark Brown
    Reviewed-by: Dimitris Papastamos

    Mark Brown
     

27 Mar, 2013

2 commits


04 Mar, 2013

3 commits


15 Feb, 2013

3 commits


11 Feb, 2013

1 commit


29 Jan, 2013

2 commits

  • Some use cases like firmware download can transfer a lot of data in quick
    succession. With high speed buses these use cases can benefit from having
    multiple transfers scheduled at once since this allows the bus to minimise
    the delay between transfers.

    Support this by adding regmap_raw_write_async(), allowing raw transfers to
    be scheduled, and regmap_async_complete() to wait for them to finish.

    Signed-off-by: Mark Brown

    Mark Brown
     
  • This commit adds provision for "no-bus" usage of the regmap API. In
    this configuration user can provide API with two callbacks 'reg_read'
    and 'reg_write' which are to be called when reads and writes to one of
    device's registers is performed. This is useful for devices that
    expose registers but whose register access sequence does not fit the 'bus'
    abstraction.

    Signed-off-by: Andrey Smirnov
    Signed-off-by: Mark Brown

    Andrey Smirnov
     

14 Jan, 2013

2 commits


02 Jan, 2013

1 commit

  • While for I2C and SPI devices the overhead of using rbtree for devices with
    only one block of registers is negligible the same isn't always going to
    be true for MMIO devices where the I/O costs are very much lower. Cater
    for these devices by adding a simple flat array type for them where the
    lookups are simple array accesses, taking us right back to the original
    ASoC cache implementation.

    Thanks to Magnus Damm for the discussion which prompted this.

    Signed-off-by: Mark Brown

    Mark Brown
     

11 Dec, 2012

3 commits


06 Dec, 2012

1 commit


21 Nov, 2012

2 commits


17 Oct, 2012

1 commit

  • It is sometimes convenient for a regmap user to override the standard
    regmap lock/unlock functions with custom functions.
    For instance this can be useful in case an already existing spinlock
    or mutex has to be used for locking a set of registers instead of the
    internal regmap spinlock/mutex.
    Note that the fast_io field of struct regmap_bus is ignored in case
    custom locking functions are used.

    Signed-off-by: Davide Ciminaghi
    Signed-off-by: Mark Brown

    Davide Ciminaghi
     

15 Oct, 2012

2 commits


18 Jun, 2012

1 commit

  • 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
    Signed-off-by: Mark Brown

    Krystian Garbaciak
     

14 May, 2012

1 commit


09 May, 2012

1 commit

  • 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

    Mark Brown
     

01 May, 2012

1 commit


10 Apr, 2012

4 commits

  • 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
    Signed-off-by: Mark Brown

    Stephen Warren
     
  • Mark Brown
     
  • Commit 79c64d5 "regmap: allow regmap instances to be named" changed the
    prototype of regmap_debugfs_init, but didn't update the dummy inline used
    when !CONFIG_DEBUGFS. Fix this.

    Signed-off-by: Stephen Warren
    Signed-off-by: Mark Brown

    Stephen Warren
     
  • 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
    Signed-off-by: Mark Brown

    Stephen Warren