#include <mapmem.h>
#include <regmap.h>
+#include <asm/io.h>
+
DECLARE_GLOBAL_DATA_PTR;
static struct regmap *regmap_alloc_count(int count)
int parent;
int len;
- parent = dev->parent->of_offset;
+ parent = dev_of_offset(dev->parent);
addr_len = fdt_address_cells(blob, parent);
size_len = fdt_size_cells(blob, parent);
both_len = addr_len + size_len;
- cell = fdt_getprop(blob, dev->of_offset, "reg", &len);
+ cell = fdt_getprop(blob, dev_of_offset(dev), "reg", &len);
len /= sizeof(*cell);
count = len / both_len;
if (!cell || !count)
return 0;
}
+
+int regmap_read(struct regmap *map, uint offset, uint *valp)
+{
+ uint32_t *ptr = map_physmem(map->base + offset, 4, MAP_NOCACHE);
+
+ *valp = le32_to_cpu(readl(ptr));
+
+ return 0;
+}
+
+int regmap_write(struct regmap *map, uint offset, uint val)
+{
+ uint32_t *ptr = map_physmem(map->base + offset, 4, MAP_NOCACHE);
+
+ writel(cpu_to_le32(val), ptr);
+
+ return 0;
+}