23 Jul, 2012

1 commit


19 Jul, 2012

1 commit


06 Jul, 2012

1 commit


19 Jun, 2012

1 commit


18 Jun, 2012

2 commits

  • 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
     
  • Locks are moved to regmap_update_bits(), which allows to reenter internal
    function _regmap_update_bits() from inside of regmap read/write routines.

    Signed-off-by: Krystian Garbaciak
    Signed-off-by: Mark Brown

    Krystian Garbaciak
     

14 Jun, 2012

1 commit


08 Jun, 2012

1 commit


05 Jun, 2012

2 commits


03 Jun, 2012

5 commits


30 May, 2012

1 commit

  • Since there are uses for I2C_M_NOSTART which are much more sensible and
    standard than most of the protocol mangling functionality (the main one
    being gather writes to devices where something like a register address
    needs to be inserted before a block of data) create a new I2C_FUNC_NOSTART
    for this feature and update all the users to use it.

    Also strengthen the disrecommendation of the protocol mangling while we're
    at it.

    In the case of regmap-i2c we remove the requirement for mangling as
    I2C_M_NOSTART is the only mangling feature which is being used.

    Signed-off-by: Mark Brown
    Acked-by: Wolfram Sang
    Signed-off-by: Jean Delvare

    Mark Brown
     

23 May, 2012

1 commit


18 May, 2012

1 commit


15 May, 2012

1 commit


14 May, 2012

3 commits


12 May, 2012

1 commit

  • regmap: Last minute bug fix for 3.4

    This is a last minute bug fix that was only just noticed since the code
    path that's being exercised here is one that is fairly rarely used. The
    changelog for the change itself is extremely clear and the code itself
    is obvious to inspection so should be pretty safe.

    Conflicts:
    drivers/base/regmap/regmap.c (overlap between the fix and stride code)

    Mark Brown
     

09 May, 2012

2 commits

  • The function regmap_bulk_read() calls the regmap_read() for
    each register if set of register has volatile and cache is
    enabled. In this case, last few register read makes the memory
    corruption if the register size is not the size of unsigned int.
    The regam_read() takes argument as unsigned int for returning
    value and it update the value as
    *val = map->format.parse_val(map->work_buf);
    This causes complete 4 bytes (size of unsigned int) to get written.
    Now if client pass the memory pointer for value which is equal to the
    required size of register count in regmap_bulk_read() then last few
    register read actually update the memory beyond passed pointer size.

    Avoid this by using local variable for read and then do memcpy()
    for actual byte copy to passed pointer based on register size.

    I allocated one pointer ptr and take first 16 bytes dump of that
    pointer then call regmap_bulk_read() with pointer which is just
    on top of this allocated pointer and register count of 128. Here
    register size is 1 byte.
    The memory trace of last 5 register read are as follows:

    [ 5.438589] regmap_bulk_read after regamp_read() for register 122
    [ 5.447421] 0xef993c20 0xef993c00 0x00000000 0x00000001
    [ 5.467535] regmap_bulk_read after regamp_read() for register 123
    [ 5.476374] 0xef993c20 0xef993c00 0x00000000 0x00000001
    [ 5.496425] regmap_bulk_read after regamp_read() for register 124
    [ 5.505260] 0xef993c20 0xef993c00 0x00000000 0x00000001
    [ 5.525372] regmap_bulk_read after regamp_read() for register 125
    [ 5.534205] 0xef993c00 0xef993c00 0x00000000 0x00000001
    [ 5.554258] regmap_bulk_read after regamp_read() for register 126
    [ 5.563100] 0xef990000 0xef993c00 0x00000000 0x00000001
    [ 5.554258] regmap_bulk_read after regamp_read() for register 127
    [ 5.587108] 0xef000000 0xef993c00 0x00000000 0x00000001

    Here it is observed that the memory content at first word started changing
    on last 3 regmap_read() and so corruption happened.

    Signed-off-by: Laxman Dewangan
    Signed-off-by: Mark Brown

    Laxman Dewangan
     
  • 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

3 commits


11 Apr, 2012

1 commit

  • Commit f01ee60fffa4 ("regmap: implement register striding") caused the
    compile errors below. Fix them.

    drivers/base/regmap/regmap-irq.c: In function 'regmap_irq_sync_unlock':
    drivers/base/regmap/regmap-irq.c:62:12: error: 'map' undeclared (first use in this function)
    drivers/base/regmap/regmap-irq.c:62:12: note: each undeclared identifier is reported only once for each function it appears in
    drivers/base/regmap/regmap-irq.c: In function 'regmap_irq_enable':
    drivers/base/regmap/regmap-irq.c:77:37: error: 'map' undeclared (first use in this function)
    drivers/base/regmap/regmap-irq.c: In function 'regmap_irq_disable':
    drivers/base/regmap/regmap-irq.c:85:37: error: 'map' undeclared (first use in this function)

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

    Stephen Warren
     

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
     

08 Apr, 2012

1 commit

  • Pull two more small regmap fixes from Mark Brown:
    - Now we have users for it that aren't running Android it turns out
    that regcache_sync_region() is much more useful to drivers if it's
    exported for use by modules. Who knew?
    - Make sure we don't divide by zero when doing debugfs dumps of
    rbtrees, not visible up until now because everything was providing at
    least some cache on startup.

    * tag 'regmap-3.4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
    regmap: prevent division by zero in rbtree_show
    regmap: Export regcache_sync_region()

    Linus Torvalds
     

07 Apr, 2012

3 commits


06 Apr, 2012

3 commits

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

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

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

    Stephen Warren