Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4109652imw; Thu, 7 Jul 2022 12:56:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t73PGL7B2GzSl9QB6epu8roviRvnhxNF61cMT9yL5Tzim0oFwlX5Vfph1oz/L+UqS8EFJ6 X-Received: by 2002:a63:1d20:0:b0:411:9f92:43c3 with SMTP id d32-20020a631d20000000b004119f9243c3mr37047957pgd.115.1657223795232; Thu, 07 Jul 2022 12:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657223795; cv=none; d=google.com; s=arc-20160816; b=gegTxYu3MtIAbBqTWpTF2X1dp9421aFwkrkwh/MBzJ3/BCRDKeJg2sSY7X39cDstA2 AmR1AGfTHnHqUT2jgV5wpQzDaLl3makCDrvAUh+n3GNnCCNefVIvRQ28mTB6AsyDudNA Fd3Pomn1/+Y1+64SRWzKH5TfVDhcU/pkp6EVOxH0YlM0NRpWM2a+rsZJ+VuPkEmFw2XN M/GBjjqH4fqc+Q5Z9mxUcOhH1Dg4NjEyGyiEC62w9iGNlv8nv6cB2t4GQ+kcEZ+hVV6Y uwoRH6iY5FovxY6lzg6pUKRBPP40dtoMUSNRPmWEftk0+aWT44rPGGCnT8ycCLLwuZJQ iE6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W9H/PjcYThl6xK+EBS7M0sK+7yjvIjT+p3M7zaFKqp8=; b=fEK8ZYlIWO1+FCMC7voOj57GN/jNRFddSJ6Fof1/H0yBWNPmaJkdYbO+7/91l6Qo3X VNgFDkPWEtT7mA2P3tqCo1/CMbkX9bxGzOlGS4NGKLB5T5QvvJ//rAejIDaDZCGijg0Y QSe+PyqtueHAE8JoTomJAQCMuPt+SpcGXqp6vvhPmrslzDnpCtq4f40it0+n6yRV3X4x FodZyrEA6F1kRc8nar6oGjtpOIv+xUOkxhDvCG8WrzayzCE7mMuOsQ2T6VqSDCiFP4jN JfLmJ3JffB86OGi3pzxcFKLTtkmzfqpwBHV6Yau51ztnN/O30Fvf99puLVqrzgJmFQUa HwNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=dbD1ar8x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u15-20020a170903124f00b0016ba5689997si5574584plh.327.2022.07.07.12.56.18; Thu, 07 Jul 2022 12:56:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=dbD1ar8x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236482AbiGGSuD (ORCPT + 99 others); Thu, 7 Jul 2022 14:50:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236089AbiGGSt6 (ORCPT ); Thu, 7 Jul 2022 14:49:58 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E57D201A6; Thu, 7 Jul 2022 11:49:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1657219796; x=1688755796; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lLRTGNYtwXnxq+fPi8sGlOmQc4+DsD09icLC+QCdOPI=; b=dbD1ar8xBIuMsYp+8uG0Kl4rIw+lOBs4tU4q6T79Fd3/8kaE/1ZWociQ pG02Wvzs9jgxA8UBl6zA8XTdX+CmLJTasUi2fcQwJeZGPyvCi4XC2yTSz G5EMeBl/v8EbYSn86dnUN74c0yDOGaLxlIBo3MZ5hLzw/MefqHBy0QWYr 3DIcuDBfl+98nyyDHNJrIYalqI9Xz7Gv2q7JssX2yOmi3vxt4D5mkC6TX vkpe+Fu3mLa2m6ZXq8D3BqRsz5XtvcTAmk88fSWJaAMQD/3SY3B6zUO8x OpsbKzic4m9knWoYyZqGYjb8y7QJoA56qnKxcZUbxpoz4q/FVsy9iJgZJ w==; X-IronPort-AV: E=Sophos;i="5.92,253,1650956400"; d="scan'208";a="171212514" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 07 Jul 2022 11:49:55 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Thu, 7 Jul 2022 11:49:55 -0700 Received: from soft-dev3-1.microsemi.net (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Thu, 7 Jul 2022 11:49:53 -0700 From: Horatiu Vultur To: , CC: , , , , , , "Horatiu Vultur" Subject: [PATCH 2/2] pinctrl: ocelot: Fix pincfg Date: Thu, 7 Jul 2022 20:53:42 +0200 Message-ID: <20220707185342.2697569-3-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220707185342.2697569-1-horatiu.vultur@microchip.com> References: <20220707185342.2697569-1-horatiu.vultur@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The blamed commit changed to use regmaps instead of __iomem. But it didn't update the register offsets to be at word offset, so it uses byte offset. Fixes: 076d9e71bcf8 ("pinctrl: ocelot: convert pinctrl to regmap") Signed-off-by: Horatiu Vultur --- drivers/pinctrl/pinctrl-ocelot.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c index 6212abe2b66f..e84f2f82901f 100644 --- a/drivers/pinctrl/pinctrl-ocelot.c +++ b/drivers/pinctrl/pinctrl-ocelot.c @@ -303,6 +303,13 @@ static const char *const ocelot_function_names[] = { [FUNC_RCVRD_CLK] = "rcvrd_clk", }; +const struct regmap_config regmap_pincfg = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, + .name = "pincfg", +}; + struct ocelot_pmx_func { const char **groups; unsigned int ngroups; @@ -1334,7 +1341,8 @@ static int ocelot_hw_get_value(struct ocelot_pinctrl *info, if (info->pincfg) { u32 regcfg; - ret = regmap_read(info->pincfg, pin, ®cfg); + ret = regmap_read(info->pincfg, pin * regmap_pincfg.reg_stride, + ®cfg); if (ret) return ret; @@ -1368,14 +1376,16 @@ static int ocelot_pincfg_clrsetbits(struct ocelot_pinctrl *info, u32 regaddr, u32 val; int ret; - ret = regmap_read(info->pincfg, regaddr, &val); + ret = regmap_read(info->pincfg, regaddr * regmap_pincfg.reg_stride, + &val); if (ret) return ret; val &= ~clrbits; val |= setbits; - ret = regmap_write(info->pincfg, regaddr, val); + ret = regmap_write(info->pincfg, regaddr * regmap_pincfg.reg_stride, + val); return ret; } @@ -1940,21 +1950,13 @@ static struct regmap *ocelot_pinctrl_create_pincfg(struct platform_device *pdev) { void __iomem *base; - const struct regmap_config regmap_config = { - .reg_bits = 32, - .val_bits = 32, - .reg_stride = 4, - .max_register = 32, - .name = "pincfg", - }; - - base = devm_platform_ioremap_resource(pdev, 1); + base = devm_platform_ioremap_resource(pdev, 1); if (IS_ERR(base)) { dev_dbg(&pdev->dev, "Failed to ioremap config registers (no extended pinconf)\n"); return NULL; } - return devm_regmap_init_mmio(&pdev->dev, base, ®map_config); + return devm_regmap_init_mmio(&pdev->dev, base, ®map_pincfg); } static int ocelot_pinctrl_probe(struct platform_device *pdev) -- 2.33.0