From patchwork Mon Jan 31 08:52:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Horatiu Vultur X-Patchwork-Id: 12730481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D68F4C433F5 for ; Mon, 31 Jan 2022 08:51:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=DvlsZN/jkCccy5RjaPHKQFijCXya47uDR440X6J0QWo=; b=Jh3zL6kT/d3bbp wA0rRexdB3nMJJxWXx55Cuyf7VgTHzUCIi6lxCO7sWNEsXh9WoLeaePlPErYAbBMLn+weAacvI1XZ fkl6P5q2zPcK/Nj4NxaPGs5y0FR0FQqqBwRDuI+2pqCPlB9RJ1ovs9A+O8qGlFa2mMN2NYUqjD0gV RMLk3x+5GNLvXnF7PtOyKazXBMZ2BKcEWZeHfOvhPV7qxW4C8bMg9E+5coEPFY8piM4753d90u204 //A5RSXaV8pEWsIUq7pQBaN1lQtxRWLaDDnlSRdVYFKSKclcFukbCy3ORka6aH/cPUjPds16TmNEl Cs7YY0FM762AgusHjqHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nESNw-008XiZ-76; Mon, 31 Jan 2022 08:50:04 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nESNs-008XhH-TX for linux-arm-kernel@lists.infradead.org; Mon, 31 Jan 2022 08:50:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643619000; x=1675155000; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=02ugfjiLkbxnQcgKy8zAdct+rc6P0z1PKGXJP2Nzrk8=; b=mz6skxHjNBtXH3MRHBLMWQZ3GuRi80VFd0PaWZL3gikrODJskysDfD+S dxKyUm4WJ2Q1lzBomUbi2jV52Aq+YdyUEOPdFz7fvMCM/heia0LT1Fg9Q +x7DYLD6xHzdy8+niikr5gAVK+NtG/fsOtL4TOTi0SPgDJqtxScIe5z/J Arwrlc30Oo64FtOk3AuNBwu5l12GVEOREyo6gj6Su4B9hsu6RxuAHswIo 1bTAf/JwuGjGWEdd0ycnl3GydMHBnwrrPJ/igZ+n0H+Sh1N8b86fQ2xBb NTSnBsyovETN6S+I9yrG7iky0RJMItoZgzSKC9fTYPtq1uRX6l5tFOFq3 A==; IronPort-SDR: oVEZb1MW5E0wmtu4Nw39uvOCXk0CK9r7Y275ZeoncAfHScYDdqFGfQUDbKiJlUqXfl+Lh1sDwL kPFXi5Pubd6WGMd9QkQOxNkPjjcyRpfL3yxl+N7QrnLaWVgfnXCumzdCSBSw0QGxxN5y83FAoD mMcJ5KP4zn5yr7fC/TpXzw3TNo4NVRDU9QAcimBt9Hdn4CMGd0QSMuztM6sYpAP+NBzIWH7l0/ zoioU7XID3gDPgigFVLnP4Y+1FEkPVH/rcBvnZK9YDudBjz9t7sFT6uejQ09eGOpzwzGwvCuLR RTMj2ZSybQsE+BIQaALRcw1p X-IronPort-AV: E=Sophos;i="5.88,330,1635231600"; d="scan'208";a="84168654" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 31 Jan 2022 01:49:58 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 31 Jan 2022 01:49:57 -0700 Received: from soft-dev3-1.microsemi.net (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Mon, 31 Jan 2022 01:49:56 -0700 From: Horatiu Vultur To: , CC: , , , , , , Horatiu Vultur Subject: [PATCH v2] pinctrl: microchip-sgpio: Fix support for regmap Date: Mon, 31 Jan 2022 09:52:01 +0100 Message-ID: <20220131085201.307031-1-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220131_005001_087927_6739322A X-CRM114-Status: GOOD ( 12.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Initially the driver accessed the registers using u32 __iomem but then in the blamed commit it changed it to use regmap. The problem is that now the offset of the registers is not calculated anymore at word offset but at byte offset. Therefore make sure to multiply the offset with word size. Acked-by: Steen Hegelund Reviewed-by: Colin Foster Fixes: 2afbbab45c261a ("pinctrl: microchip-sgpio: update to support regmap") Signed-off-by: Horatiu Vultur Reviewed-by: Andy Shevchenko --- v1->v2: - use regmap_get_reg_stride() instead of regmap_config.reg_stride --- drivers/pinctrl/pinctrl-microchip-sgpio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c index 8e081c90bdb2..639f1130e989 100644 --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c @@ -137,7 +137,8 @@ static inline int sgpio_addr_to_pin(struct sgpio_priv *priv, int port, int bit) static inline u32 sgpio_get_addr(struct sgpio_priv *priv, u32 rno, u32 off) { - return priv->properties->regoff[rno] + off; + return (priv->properties->regoff[rno] + off) * + regmap_get_reg_stride(priv->regs); } static u32 sgpio_readl(struct sgpio_priv *priv, u32 rno, u32 off)