summaryrefslogtreecommitdiffstats
path: root/include/regmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/regmap.h')
-rw-r--r--include/regmap.h146
1 files changed, 30 insertions, 116 deletions
diff --git a/include/regmap.h b/include/regmap.h
index 3bcd9fe038..f2c395a896 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -2,121 +2,35 @@
#ifndef __REGMAP_H
#define __REGMAP_H
-/**
- * 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.
- *
- * @max_register: Optional, specifies the maximum valid register index.
- */
-struct regmap_config {
- const char *name;
-
- int reg_bits;
- int reg_stride;
- int pad_bits;
- int val_bits;
-
- unsigned int max_register;
-};
-
-typedef int (*regmap_hw_reg_read)(void *context, unsigned int reg,
- unsigned int *val);
-typedef int (*regmap_hw_reg_write)(void *context, unsigned int reg,
- unsigned int val);
-
-struct regmap_bus {
- regmap_hw_reg_write reg_write;
- regmap_hw_reg_read reg_read;
-};
-
-struct device_d;
-struct device_node;
-
-struct regmap *regmap_init(struct device_d *dev,
- const struct regmap_bus *bus,
- void *bus_context,
- const struct regmap_config *config);
-
-struct clk;
-
-/**
- * of_regmap_init_mmio_clk() - Initialise register map with register clock
- *
- * @np: Device node that will be interacted with
- * @clk_id: register clock consumer ID
- * @regs: Pointer to memory-mapped IO region
- * @config: Configuration for register map
- *
- * The return value will be an ERR_PTR() on error or a valid pointer to
- * a struct regmap.
- */
-struct regmap *of_regmap_init_mmio_clk(struct device_node *np, const char *clk_id,
- void __iomem *regs,
- const struct regmap_config *config);
-
-/**
- * regmap_init_mmio_clk() - Initialise register map with register clock
- *
- * @dev: Device that will be interacted with
- * @clk_id: register clock consumer ID
- * @regs: Pointer to memory-mapped IO region
- * @config: Configuration for register map
- *
- * The return value will be an ERR_PTR() on error or a valid pointer to
- * a struct regmap.
- */
-struct regmap *regmap_init_mmio_clk(struct device_d *dev, const char *clk_id,
- void __iomem *regs,
- const struct regmap_config *config);
-
-/**
- * regmap_init_mmio() - Initialise register map
- *
- * @dev: Device that will be interacted with
- * @regs: Pointer to memory-mapped IO region
- * @config: Configuration for register map
- *
- * The return value will be an ERR_PTR() on error or a valid pointer to
- * a struct regmap.
- */
-#define regmap_init_mmio(dev, regs, config) \
- regmap_init_mmio_clk(dev, NULL, regs, config)
-
-
-int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk);
-void regmap_mmio_detach_clk(struct regmap *map);
-
-void regmap_exit(struct regmap *map);
-
-struct regmap *dev_get_regmap(struct device_d *dev, const char *name);
-struct regmap *of_node_to_regmap(struct device_node *node);
-
-int regmap_register_cdev(struct regmap *map, const char *name);
-
-int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
-int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
-
-int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
- size_t val_len);
-int regmap_bulk_write(struct regmap *map, unsigned int reg,
- const void *val, size_t val_len);
-
-int regmap_get_val_bytes(struct regmap *map);
-int regmap_get_max_register(struct regmap *map);
-int regmap_get_reg_stride(struct regmap *map);
-
-int regmap_write_bits(struct regmap *map, unsigned int reg,
- unsigned int mask, unsigned int val);
-int regmap_update_bits(struct regmap *map, unsigned int reg,
- unsigned int mask, unsigned int val);
+#include <linux/compiler.h>
+#include <linux/types.h>
+
+extern void __compiletime_error("Last argument is now number of registers, not bytes. Fix "
+ "it and include <linux/regmap.h> instead")
+__regmap_bulk_api_changed(void);
+
+struct regmap;
+
+#ifndef regmap_bulk_read
+#define regmap_bulk_read regmap_bulk_read
+static inline int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
+ size_t val_bytes)
+{
+ __regmap_bulk_api_changed();
+ return -1;
+}
+#endif
+
+#ifndef regmap_bulk_write
+#define regmap_bulk_write regmap_bulk_write
+static inline int regmap_bulk_write(struct regmap *map, unsigned int reg,
+ const void *val, size_t val_bytes)
+{
+ __regmap_bulk_api_changed();
+ return -1;
+}
+#endif
+
+#include <linux/regmap.h>
#endif /* __REGMAP_H */