From patchwork Wed Feb 14 16:24:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 201009 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp1333546dyb; Wed, 14 Feb 2024 08:27:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXe2cjeGvJRHuC9BRu1aWO8Ufz60PI2+Gfy0mbSXmlmt1TxeHjafPMcycJw8/YiPqLNAMyqA+qSg7tqWUMtfe3ty37DVA== X-Google-Smtp-Source: AGHT+IFd6xjFPCx/kCKisz+S4OstqpsfgJIpVn56kGuFeGzbns6yksMMfLhlqjfrE/z5K7wQ8Oys X-Received: by 2002:a17:906:e45:b0:a38:537:9598 with SMTP id q5-20020a1709060e4500b00a3805379598mr2257602eji.17.1707928074216; Wed, 14 Feb 2024 08:27:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707928074; cv=pass; d=google.com; s=arc-20160816; b=yenG2In5ffRyhmvP7UHmRKskBi4w3y0k8vMEo/2CREGlWQAM+32EIQz/jzwfWsm4rQ 3Wl6XZvaCW/oBQ5hQF8AaKWZYBuw4D8ePTcIp/ft2f4Q2KFQC9ZjQBjGrB6QuqcUq52A r2i9nkUiILcHvJ3jN//x6lgSTJbUdfqty5iz+3jwk6K3qwDTMtrxpiNNq2hHPlDAYRNY +Q33DdwAsyl5UyJOtrWwnHpod0dFtruZtgtnSEksmbTF7TP0rS3Jy1Oz5XoeZYt1nhpS qcoxuDjmh4WAaqndNDMKmRSTfJN3fXoVZst6f2/1f42n6E/N3gMk1aTad0vylsXq5EH6 5Rdw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=bLoA0P9RlkSFaslaKEMQVpOFEKtcgMw82K3D06dO8ZY=; fh=2eioTuYuOBrLXIIox+Cbn8FiHVS5OnSinGCijCQ8H7k=; b=xkd0uuz7+46zpFURG7NvHVLKAJmTZ+b2Kyildf3cl9k5tX6L+f4fp9ZtE6jastiU8s +spnthCfn6xZu2a3fH6jogJtuRqpPJJ8mhwoJAcFMaDcfAW126mzD0IREe6MJXXISC12 VrGG1Lx9fP0aF8ewCh5tso882cgdnz3LeQvWkHkHhu89XTmmquyd/PUy7jOLfYSs+G7J 6E64B/k5rKsWKS0i8ZvZJB1rhSlzJTnoUEqOV8lZ/TAVt2R5ytnCrUQE4VlkSbLpZ8wm DqOF3jNiTAvAFF9InBboRqzNEpD4yEtBTv6/egwPDz8LgWo4GaoG3JfPCzmhepmJSEw5 EkzA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=pkVxLA+O; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-65523-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65523-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com X-Forwarded-Encrypted: i=2; AJvYcCUOv1Zcka3C7LMJ8bTyP4mI19HKaCKlnlvpNp21U9PLkPjbB+Z5aGdPuMyvyuTdLDK4syMCDVSogOMAdd/yNY0E2E4mlw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id qw37-20020a1709066a2500b00a3d6f1ccea1si173272ejc.854.2024.02.14.08.27.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 08:27:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65523-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=pkVxLA+O; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-65523-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65523-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CF0E01F21686 for ; Wed, 14 Feb 2024 16:27:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 93C7D612D5; Wed, 14 Feb 2024 16:25:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="pkVxLA+O" Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 170005FF03; Wed, 14 Feb 2024 16:24:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707927898; cv=none; b=WEOqSDUp6fekcU/pVegmePu8wQmC5YldyyTaoBUYM5ZdjxVSa929kVsg7oltvWfcJF0DzD5shiaWX4qMu8a2ZWcAD5ZFdC2BJYDpW6OJQ6JXUADl6lFAci1xB51UxYb7qaR4in+DS5bcM+9CCAc6Eo/swf+4OqidEoeQy63D08g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707927898; c=relaxed/simple; bh=PiULlxoY9sFSzbUhnnrxaXNFppXlk4suqKPpxb9RyTg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VJwyFOOkLGVbN957m+qQ1uPNiC0VNUrlKRNLqLmVjLad0GcTtfpdKaZuiAM77/mOQ33jTpzgi/iwL0cjR1RF0lOvQw1GwLnX/HqPDqOhSBuRANjWgM2RZZHwfCa8k7/5U6DtjNHKuX1kZ/elnMwAuIPGQDWj7zjqviONye/4vAw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=pkVxLA+O; arc=none smtp.client-ip=217.70.183.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 9A9E060017; Wed, 14 Feb 2024 16:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1707927894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bLoA0P9RlkSFaslaKEMQVpOFEKtcgMw82K3D06dO8ZY=; b=pkVxLA+Oeupka39b5nAyT6X7owzZdCh7sz2tRioW4gOKFg6LOSuzSoRvOvv6cSs8l8HX6b L78roBLoJfUNtfVyWoJ0C4nPrzuYvQK9YOReklchCWkrZT/OdcNZqTZLTsEVntgPb1Awiz +9qsQRqqzKVRaEfmXLnuLs6fMqxXsvudZ4fAdEbMm8Pn8oHe/RBCZ5kjOE7YUDjbEZxeGa uivzinwAqD0crB4C+h7y91mnI+yDgy/tCN2fUjPG4TEq96Ksyw34p1jNRrrn1DK8MxSfBB 7beHuHVwPzjXKvj2KYg95MwjMKpq1V01I/u7uvvyUcvDyHnsrimEqMxfdzLoOA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 14 Feb 2024 17:24:06 +0100 Subject: [PATCH 13/23] gpio: nomadik: fix offset bug in nmk_pmx_set() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240214-mbly-gpio-v1-13-f88c0ccf372b@bootlin.com> References: <20240214-mbly-gpio-v1-0-f88c0ccf372b@bootlin.com> In-Reply-To: <20240214-mbly-gpio-v1-0-f88c0ccf372b@bootlin.com> To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Thomas Bogendoerfer Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, Gregory CLEMENT , Vladimir Kondratiev , Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.12.4 X-GND-Sasl: theo.lebrun@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790892387857965072 X-GMAIL-MSGID: 1790892387857965072 Previously, the statement looked like: slpm[x] &= ~BIT(g->pins[i]); Where: - slpm is a unsigned int pointer; - g->pins[i] is a pin number which can grow to more than 32. The expected shift amount is a pin bank offset. This bug does not occur on every group or pin: the altsetting must be NMK_GPIO_ALT_C and the pin must be 32 or above. It is possible that it occurred. For example, in pinctrl-nomadik-db8500.c, pin group i2c3_c_2 has the right altsetting and has pins 229 and 230. Signed-off-by: Théo Lebrun Reviewed-by: Linus Walleij --- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c index c7693fbc0484..99bdb25f358d 100644 --- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c +++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c @@ -913,8 +913,9 @@ static int nmk_pmx_set(struct pinctrl_dev *pctldev, unsigned int function, */ for (i = 0; i < g->grp.npins; i++) { struct nmk_gpio_chip *nmk_chip; + unsigned int bit; - nmk_chip = find_nmk_gpio_from_pin(g->grp.pins[i], NULL); + nmk_chip = find_nmk_gpio_from_pin(g->grp.pins[i], &bit); if (!nmk_chip) { dev_err(npct->dev, "invalid pin offset %d in group %s at index %d\n", @@ -922,7 +923,7 @@ static int nmk_pmx_set(struct pinctrl_dev *pctldev, unsigned int function, goto out_pre_slpm_init; } - slpm[nmk_chip->bank] &= ~BIT(g->grp.pins[i]); + slpm[nmk_chip->bank] &= ~BIT(bit); } nmk_gpio_glitch_slpm_init(slpm); }