From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatolij Gustschin Date: Thu, 2 Aug 2018 00:01:27 +0200 Subject: [U-Boot] [PATCH v3 07/13] regmap: Add raw read/write functions In-Reply-To: <20180731100110.4852-7-mario.six@gdsys.cc> References: <20180731100110.4852-1-mario.six@gdsys.cc> <20180731100110.4852-7-mario.six@gdsys.cc> Message-ID: <20180802000127.0cd31200@crub> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Mario, On Tue, 31 Jul 2018 12:01:04 +0200 Mario Six mario.six at gdsys.cc wrote: > The regmap functions currently assume that all register map accesses > have a data width of 32 bits, but there are maps that have different > widths. > > To rectify this, implement the regmap_raw_read and regmap_raw_write > functions from the Linux kernel API that specify the width of a desired > read or write operation on a regmap. > > Implement the regmap_read and regmap_write functions using these raw > functions in a backwards-compatible manner. > > Signed-off-by: Mario Six Reviewed-by: Anatolij Gustschin Please see some comments below. ... > +int regmap_raw_read(struct regmap *map, uint offset, void *valp, size_t val_len) > +{ > + void *ptr; > + > + ptr = map_physmem(map->ranges[0] + offset, val_len, MAP_NOCACHE); shouldn't this be ptr = map_physmem(map->ranges[0].start + offset, val_len, MAP_NOCACHE); ? It works as is, but it is better to be explicit about the start address. ... > +int regmap_raw_write(struct regmap *map, uint offset, const void *val, > + size_t val_len) > +{ > + void *ptr; > + > + ptr = map_physmem(map->ranges[0] + offset, val_len, MAP_NOCACHE); map->ranges[0].start + offset ? -- Anatolij