From patchwork Wed Jan 27 13:51:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Kuske X-Patchwork-Id: 8133941 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 54D039F818 for ; Wed, 27 Jan 2016 13:53:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9F344202E6 for ; Wed, 27 Jan 2016 13:53:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 136BA2026D for ; Wed, 27 Jan 2016 13:53:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aOQWA-0007SQ-7z; Wed, 27 Jan 2016 13:52:18 +0000 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aOQVv-0007C5-Au for linux-arm-kernel@lists.infradead.org; Wed, 27 Jan 2016 13:52:06 +0000 Received: by mail-wm0-x22a.google.com with SMTP id l66so3550472wml.0 for ; Wed, 27 Jan 2016 05:51:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=FicPC4x4uX2+10/tNDNxLd2cQPQh4YLzdAE5gi6GnQQ=; b=nRyVWZH9prRoq4EvER0JL/q2CiVbo+/kVN90/z3xjXTLPzk6DbJFRmQVmQ6luB+dJH 9Nj5ZL70T8xo69Nm7Qr0tiP0LKw3lQj7s9ZRiL/h7ZXcU/EXxvR087T/8kHsc/sY0YdX ky0MAwS87DixSchUu8MxpRGFhfUp5dRcAdnghXWx0tZzzzUzBlx4Yk3fL6pG8PuGfp44 a0ozNb75RyzVe0bZOTM0hD9n7UW7sBFAgs8yd2Q3KDUu1nVpdhA+3Bb5m8SERYVw5NrX chHzQxh6RIb7+5b/+1Xivm4okXf+lj614s0u5hUTUd/oQIDVxIA8ReOgBAo/QsF/tJjb UbTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=FicPC4x4uX2+10/tNDNxLd2cQPQh4YLzdAE5gi6GnQQ=; b=Ya2CwiLVVSLfu5SOywuy/cBBxOnFbyNx6eP0HaRATCzSGXK+thUz2bANIVI91e8087 SSWilepEZzCCMFUTAd8EfvIiOVW577dkdyz1YVNdnhzah/S7RKkfsimku8oTmuYwZqUR h+wdvqioWs8AEB8jI7hOxA3NNKFSo90fLUwO3J/Sg7A7DiAh+gXWlFDeWk5FmBte75Vm VypdkJHAc7M0GFLgnPFA6Wx2TQ81LFN3oP6UhtNFpSrhS8GXtyvUVb3oEpqSMDwCk4Zn IXz6+I23nk2JoVvZ2/hbVQuhaVESfS9cepeP0O6pe8A1ITJJrGlFJ5JUpFaX1UgW4BCH it9A== X-Gm-Message-State: AG10YOQTIuPCckHQ77bMoNmRRrK2LzQWAkeVW/hIrt/FtDvXegmdVHlBgkB1iEilQUmRCg== X-Received: by 10.194.20.5 with SMTP id j5mr28909553wje.71.1453902700909; Wed, 27 Jan 2016 05:51:40 -0800 (PST) Received: from pc-jens.localdomain (p5B2E9D8C.dip0.t-ipconnect.de. [91.46.157.140]) by smtp.gmail.com with ESMTPSA id t199sm7777760wmt.23.2016.01.27.05.51.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Jan 2016 05:51:40 -0800 (PST) From: Jens Kuske To: Maxime Ripard , Chen-Yu Tsai Subject: [PATCH] drivers: soc: sunxi: Fix mask generation for SRAM mapping Date: Wed, 27 Jan 2016 14:51:13 +0100 Message-Id: <1453902673-10734-1-git-send-email-jenskuske@gmail.com> X-Mailer: git-send-email 2.7.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160127_055203_998936_271654BA X-CRM114-Status: GOOD ( 10.94 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-sunxi@googlegroups.com, linux-arm-kernel@lists.infradead.org, Arnd Bergmann , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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),