参照元

説明

参考

実装

/**
 * Configuration for the register map of a device.
 *
 * @name: Optional name of the regmap. Useful when a device has multiple
 *        register regions.
 *
 * @reg_bits: Number of bits in a register address, mandatory.
 * @reg_stride: The register address stride. Valid register addresses are a
 *              multiple of this value. If set to 0, a value of 1 will be
 *              used.
 * @pad_bits: Number of bits of padding between register and value.
 * @val_bits: Number of bits in a register value, mandatory.
 *
 * @writeable_reg: Optional callback returning true if the register
 *                 can be written to. If this field is NULL but wr_table
 *                 (see below) is not, the check is performed on such table
 *                 (a register is writeable if it belongs to one of the ranges
 *                  specified by wr_table).
 * @readable_reg: Optional callback returning true if the register
 *                can be read from. If this field is NULL but rd_table
 *                 (see below) is not, the check is performed on such table
 *                 (a register is readable if it belongs to one of the ranges
 *                  specified by rd_table).
 * @volatile_reg: Optional callback returning true if the register
 *                value can't be cached. If this field is NULL but
 *                volatile_table (see below) is not, the check is performed on
 *                such table (a register is volatile if it belongs to one of
 *                the ranges specified by volatile_table).
 * @precious_reg: Optional callback returning true if the register
 *                should not be read outside of a call from the driver
 *                (e.g., a clear on read interrupt status register). If this
 *                field is NULL but precious_table (see below) is not, the
 *                check is performed on such table (a register is precious if
 *                it belongs to one of the ranges specified by precious_table).
 * @lock:         Optional lock callback (overrides regmap's default lock
 *                function, based on spinlock or mutex).
 * @unlock:       As above for unlocking.
 * @lock_arg:     this field is passed as the only argument of lock/unlock
 *                functions (ignored in case regular lock/unlock functions
 *                are not overridden).
 * @reg_read:     Optional callback that if filled will be used to perform
 *                all the reads from the registers. Should only be provided for
 *                devices whose read operation cannot be represented as a simple
 *                read operation on a bus such as SPI, I2C, etc. Most of the
 *                devices do not need this.
 * @reg_write:    Same as above for writing.
 * @fast_io:      Register IO is fast. Use a spinlock instead of a mutex
 *                to perform locking. This field is ignored if custom lock/unlock
 *                functions are used (see fields lock/unlock of struct regmap_config).
 *                This field is a duplicate of a similar file in
 *                'struct regmap_bus' and serves exact same purpose.
 *                 Use it only for "no-bus" cases.
 * @max_register: Optional, specifies the maximum valid register index.
 * @wr_table:     Optional, points to a struct regmap_access_table specifying
 *                valid ranges for write access.
 * @rd_table:     As above, for read access.
 * @volatile_table: As above, for volatile registers.
 * @precious_table: As above, for precious registers.
 * @reg_defaults: Power on reset values for registers (for use with
 *                register cache support).
 * @num_reg_defaults: Number of elements in reg_defaults.
 *
 * @read_flag_mask: Mask to be set in the top byte of the register when doing
 *                  a read.
 * @write_flag_mask: Mask to be set in the top byte of the register when doing
 *                   a write. If both read_flag_mask and write_flag_mask are
 *                   empty the regmap_bus default masks are used.
 * @use_single_rw: If set, converts the bulk read and write operations into
 *                  a series of single read and write operations. This is useful
 *                  for device that does not support bulk read and write.
 * @can_multi_write: If set, the device supports the multi write mode of bulk
 *                   write operations, if clear multi write requests will be
 *                   split into individual write operations
 *
 * @cache_type: The actual cache type.
 * @reg_defaults_raw: Power on reset values for registers (for use with
 *                    register cache support).
 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw.
 * @reg_format_endian: Endianness for formatted register addresses. If this is
 *                     DEFAULT, the @reg_format_endian_default value from the
 *                     regmap bus is used.
 * @val_format_endian: Endianness for formatted register values. If this is
 *                     DEFAULT, the @reg_format_endian_default value from the
 *                     regmap bus is used.
 *
 * @ranges: Array of configuration entries for virtual address ranges.
 * @num_ranges: Number of range configuration entries.
 */
struct regmap_config {
        const char *name;

        int reg_bits;
        int reg_stride;
        int pad_bits;
        int val_bits;

        bool (*writeable_reg)(struct device *dev, unsigned int reg);
        bool (*readable_reg)(struct device *dev, unsigned int reg);
        bool (*volatile_reg)(struct device *dev, unsigned int reg);
        bool (*precious_reg)(struct device *dev, unsigned int reg);
        regmap_lock lock;
        regmap_unlock unlock;
        void *lock_arg;
        int (*reg_read)(void *context, unsigned int reg, unsigned int *val);
        int (*reg_write)(void *context, unsigned int reg, unsigned int val);

        bool fast_io;

        unsigned int max_register;
        const struct regmap_access_table *wr_table;
        const struct regmap_access_table *rd_table;
        const struct regmap_access_table *volatile_table;
        const struct regmap_access_table *precious_table;
        const struct reg_default *reg_defaults;
        unsigned int num_reg_defaults;
        enum regcache_type cache_type;
        const void *reg_defaults_raw;
        unsigned int num_reg_defaults_raw;
        u8 read_flag_mask;
        u8 write_flag_mask;

        bool use_single_rw;
        bool can_multi_write;

        enum regmap_endian reg_format_endian;
        enum regmap_endian val_format_endian;
        const struct regmap_range_cfg *ranges;
        unsigned int num_ranges;
};

コメント


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2016-04-28 (木) 17:16:24