Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6021715pxb; Mon, 14 Feb 2022 13:19:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwjKIY361LFwMyRKCfGa5e1eodu3E9692h6OQoMe8nabzEXHKpF0+Ay6Db+GuQk8zKzoWn9 X-Received: by 2002:a17:903:185:: with SMTP id z5mr686068plg.71.1644873567533; Mon, 14 Feb 2022 13:19:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644873567; cv=none; d=google.com; s=arc-20160816; b=E33zdhODL8+NJhLYIb+T/tEuJHuWSGX/3VNqAqF1lK7RVk6RACivz4WQg4fpd4uFh/ of6nMTvjD4CHrZx+m04ZXdrwkW361fRjUCqOe3JXCwEq33mcg8GZk2s+Im5ok599m7/B 8IqHXhXak73P6kVrtbaFQlIN3dJy91mkJS1Wh3wb4cFQHO/hApNYmxTW6tP0QfP9CFRd e+6RowbrY+Fa3FZddG08F/0m9wbJfpdCcA72YujH+dFoBHvANXdPNxUKPrgpWgRGe5ZS yKbAb1zILpUf10GxBilhsMQg/ia5ZJSAnIIL/JJ3+qV41EETu/+UdBYg4pgi+CUx886c 1PPg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uoGK3DBIAucGVKJhA4KBXofFyTlBUNoz6yhGhlKjbD8=; b=w5/L/XiIUzLw5ob5UMXITyVkhxfmWactcQJEMAd4wmotJgo0/5kvpNKbdAQWzubIDG h01dyTz+0eCPt4V3KaPRJJMpn+Dpd9Xp0lwnqZy+vr8pPcfVYTJojSHWkf9KgjAkHMVt 7aTBPI87M+/588a5MkIchq8n81KYNDRoWT0JouDemcBdfE66njDeduo3ec9EJ25AVzxO OUQ+fXjUth1AB9EmnWVPSAYh1hOE/huQgGu0D5lrNXpHoA5x6bgtw4xtjqW0wJDnjXbV WlT9Fmh5S8gTfHaJzWFNnkfmoM3xhq/3WmBuDSCmOS+PT1EXIi0ahBCK/OCxYyJpBTH6 Ns/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZxexTiaH; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j3si12864789plk.612.2022.02.14.13.19.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 13:19:27 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZxexTiaH; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EFADC2335DD; Mon, 14 Feb 2022 12:38:47 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347919AbiBNKdE (ORCPT + 99 others); Mon, 14 Feb 2022 05:33:04 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347902AbiBNKb2 (ORCPT ); Mon, 14 Feb 2022 05:31:28 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF18C9FAE8; Mon, 14 Feb 2022 02:00:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4B55C60B34; Mon, 14 Feb 2022 10:00:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F57CC340E9; Mon, 14 Feb 2022 10:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832803; bh=p0GSrWSRYFcwVAlTWHkexOEppvNxSNDFbwq10rI/KzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZxexTiaH6PadwzLe2+gcbrqQKardm3Ft7kUfO0UbSyouOWo5YhPo97k6ietqNfksf xiGkulkWDqjbifUqxsBlDwvtrq2En/33cAoQJZpMc7bm1W2uQj+03/81P/mFRQs4kX i9f0vKFvUM4T619jEFgUEnw4G7wIM+W2khmaoHU0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Linus Walleij , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.16 129/203] gpio: sifive: use the correct register to read output values Date: Mon, 14 Feb 2022 10:26:13 +0100 Message-Id: <20220214092514.619622657@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Niklas Cassel [ Upstream commit cc38ef936840ac29204d806deb4d1836ec509594 ] Setting the output of a GPIO to 1 using gpiod_set_value(), followed by reading the same GPIO using gpiod_get_value(), will currently yield an incorrect result. This is because the SiFive GPIO device stores the output values in reg_set, not reg_dat. Supply the flag BGPIOF_READ_OUTPUT_REG_SET to bgpio_init() so that the generic driver reads the correct register. Fixes: 96868dce644d ("gpio/sifive: Add GPIO driver for SiFive SoCs") Signed-off-by: Niklas Cassel Reviewed-by: Linus Walleij [Bartosz: added the Fixes tag] Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpio-sifive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c index 403f9e833d6a3..7d82388b4ab7c 100644 --- a/drivers/gpio/gpio-sifive.c +++ b/drivers/gpio/gpio-sifive.c @@ -223,7 +223,7 @@ static int sifive_gpio_probe(struct platform_device *pdev) NULL, chip->base + SIFIVE_GPIO_OUTPUT_EN, chip->base + SIFIVE_GPIO_INPUT_EN, - 0); + BGPIOF_READ_OUTPUT_REG_SET); if (ret) { dev_err(dev, "unable to init generic GPIO\n"); return ret; -- 2.34.1