Skip to content

Commit

Permalink
drivers: soc: sunxi: Fix mask generation for SRAM mapping
Browse files Browse the repository at this point in the history
GENMASK is inclusive on both ends, therefor one has to be
subtracted from the width.
Also fixes the mask for debug output.

Signed-off-by: Jens Kuske <jenskuske@gmail.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
  • Loading branch information
Jens Kuske authored and Maxime Ripard committed Jan 27, 2016
1 parent 2d3e8f7 commit febe656
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/soc/sunxi/sunxi_sram.c
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ static int sunxi_sram_show(struct seq_file *s, void *data)

val = readl(base + sram_data->reg);
val >>= sram_data->offset;
val &= sram_data->width;
val &= GENMASK(sram_data->width - 1, 0);

for (func = sram_data->func; func->func; func++) {
seq_printf(s, "\t\t%s%c\n", func->func,
@@ -208,7 +208,8 @@ int sunxi_sram_claim(struct device *dev)
return -EBUSY;
}

mask = GENMASK(sram_data->offset + sram_data->width, sram_data->offset);
mask = GENMASK(sram_data->offset + sram_data->width - 1,
sram_data->offset);
val = readl(base + sram_data->reg);
val &= ~mask;
writel(val | ((device << sram_data->offset) & mask),

0 comments on commit febe656

Please sign in to comment.