X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fregmap.h;h=6a574eaa41294a740a688f3bc717c0ba68afcf8f;hb=fbe502e9aba098b5ad500d1cdb6b376f56f9ddbb;hp=493a5d8eff84d0d443c680604bb495ba9835c7fd;hpb=c07f38208a73bbe3efaa939d6742096c1cb7e0ce;p=u-boot diff --git a/include/regmap.h b/include/regmap.h index 493a5d8eff..6a574eaa41 100644 --- a/include/regmap.h +++ b/include/regmap.h @@ -1,8 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (c) 2015 Google, Inc * Written by Simon Glass - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef __REGMAP_H @@ -22,15 +21,12 @@ struct regmap_range { /** * struct regmap - a way of accessing hardware/bus registers * - * @base: Base address of register map * @range_count: Number of ranges available within the map - * @range: Pointer to the list of ranges, allocated if @range_count > 1 - * @base_range: If @range_count is <= 1, @range points here + * @ranges: Array of ranges */ struct regmap { - phys_addr_t base; int range_count; - struct regmap_range *range, base_range; + struct regmap_range ranges[0]; }; /* @@ -46,15 +42,25 @@ int regmap_read(struct regmap *map, uint offset, uint *valp); #define regmap_read32(map, ptr, member, valp) \ regmap_read(map, (uint32_t *)(ptr)->member - (uint32_t *)(ptr), valp) +/** + * regmap_update_bits() - Perform a read/modify/write using a mask + * + * @map: The map returned by regmap_init_mem*() + * @offset: Offset of the memory + * @mask: Mask to apply to the read value + * @val: Value to apply to the value to write + */ +int regmap_update_bits(struct regmap *map, uint offset, uint mask, uint val); + /** * regmap_init_mem() - Set up a new register map that uses memory access * * Use regmap_uninit() to free it. * - * @dev: Device that uses this map + * @node: Device node that uses this map * @mapp: Returns allocated map */ -int regmap_init_mem(struct udevice *dev, struct regmap **mapp); +int regmap_init_mem(ofnode node, struct regmap **mapp); /** * regmap_init_mem_platdata() - Set up a new memory register map for of-platdata