linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: soc: sunxi: Fix mask generation for SRAM mapping
@ 2016-01-27 13:51 Jens Kuske
  2016-01-27 19:29 ` Maxime Ripard
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Kuske @ 2016-01-27 13:51 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---
 drivers/soc/sunxi/sunxi_sram.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c
index bc52670..99e354c 100644
--- a/drivers/soc/sunxi/sunxi_sram.c
+++ b/drivers/soc/sunxi/sunxi_sram.c
@@ -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),
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] drivers: soc: sunxi: Fix mask generation for SRAM mapping
  2016-01-27 13:51 [PATCH] drivers: soc: sunxi: Fix mask generation for SRAM mapping Jens Kuske
@ 2016-01-27 19:29 ` Maxime Ripard
  0 siblings, 0 replies; 2+ messages in thread
From: Maxime Ripard @ 2016-01-27 19:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jan 27, 2016 at 02:51:13PM +0100, Jens Kuske wrote:
> 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>

Applied, thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160127/7ec89987/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-27 19:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27 13:51 [PATCH] drivers: soc: sunxi: Fix mask generation for SRAM mapping Jens Kuske
2016-01-27 19:29 ` Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).