Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3092514rwb; Mon, 15 Aug 2022 17:56:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR5XcFNzL4iMj+USXbKTza6AuWayPWxSakknvXwNyesiCTGogP3Hy0UczIyEoAvqom69lN6+ X-Received: by 2002:a17:906:84f0:b0:731:8572:80ab with SMTP id zp16-20020a17090684f000b00731857280abmr11790388ejb.254.1660611284923; Mon, 15 Aug 2022 17:54:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611284; cv=none; d=google.com; s=arc-20160816; b=atLIEBKVa3FxfDls1XYikRMxni9ZA6+HQlUcQOTAN1r5umV+tBFr3S1nRyMWaUsGRm 161hxtoBL+6hBD27U6JJXU5STgbbWzdOCvp41CamEGmSqkG4JsYU0KAGUO3sVQtEU1N2 k+UHfmZUxJ7edcGdZqOPrysozikWsKqQTG70uBY8dl5yyjkjy13t0U1DJUA62k7AzzHe TFLLLbczlcS8IhY0DmET5H4BYwY3WfAjbrEQ6VXyzkglZOdeS7kO3wbCX/VYFM1uGz9X DE87g84UXEpV7IKab4xClCr3JQhU9P08rvIXccN9jwNDHO15/jHM+eSRI2Hj4wqIdqJ/ IhXw== 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=+EBCNLWHC2KC14kMf0GWxNWlFeYRdoySWYh+u6uOHwk=; b=GHdAW5hJTKtBfQCziSFLH1kkbFhwUZAkVIRbdn3SnV0J3PQ4zdl++Zh6nHx0MtyAFX AGqmuqleu+X8A9wz4SkKzIX9e+jCVAIy4msY9tA+AqJ91XA2cgA8Ykq/wDMVcTakJzrz Bj5av5YdeA6eWw6l/P3lO5XJmj8uZ1OAcoYW72OZsq2CbOziQj98ZOpO1ifb3nCfRqt5 kBhm1VHestOUrek1rZn2bSTbs0t1stl1UqKokoEiE8xT77DhzYQT/DijrTBHJZo10syQ GGDhBzwliiw+TEU05ZqoknSEPy3AP7s5AE7PpicdmquoJm+zO245o6pc2GPvP/MrhsOi 1I1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dA+FzUUa; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw11-20020a170906478b00b0073053b85cf8si8881528ejc.364.2022.08.15.17.54.19; Mon, 15 Aug 2022 17:54:44 -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=pass header.i=@linuxfoundation.org header.s=korg header.b=dA+FzUUa; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350874AbiHPAZ3 (ORCPT + 99 others); Mon, 15 Aug 2022 20:25:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351718AbiHPAXV (ORCPT ); Mon, 15 Aug 2022 20:23:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C541D2937; Mon, 15 Aug 2022 13:34:21 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 93A82B81197; Mon, 15 Aug 2022 20:34:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8A15C433D6; Mon, 15 Aug 2022 20:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595650; bh=AQlbLQG1Rst+iVGp1L5JuWGaw0Df5Bq56jooUFeZpOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dA+FzUUaP7pUSQaVVwwxO5YS/CuH8BX6IhlxPveD3KODGqLSiJs9iq1tbY3qHm1dZ PFjLJaEKCPq6ha7CdvGICgHtUJ5RAgv9HaK2gNv/3bOr+WwKB05BQedQz/I7v6hwqR wUOgmcg81f4+B1UrYqOqNMKs3g8ElA+zJT/uMJWI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eugen Hristev , Karl Olsen , Adrian Hunter , Ulf Hansson , Sasha Levin Subject: [PATCH 5.19 0799/1157] mmc: sdhci-of-at91: fix set_uhs_signaling rewriting of MC1R Date: Mon, 15 Aug 2022 20:02:35 +0200 Message-Id: <20220815180511.446476740@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 From: Eugen Hristev [ Upstream commit 5987e6ded29d52e42fc7b06aa575c60a25eee38e ] In set_uhs_signaling, the DDR bit is being set by fully writing the MC1R register. This can lead to accidental erase of certain bits in this register. Avoid this by doing a read-modify-write operation. Fixes: d0918764c17b ("mmc: sdhci-of-at91: fix MMC_DDR_52 timing selection") Signed-off-by: Eugen Hristev Tested-by: Karl Olsen Acked-by: Adrian Hunter Link: https://lore.kernel.org/r/20220630090926.15061-1-eugen.hristev@microchip.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/sdhci-of-at91.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c index 10fb4cb2c731..cd0134580a90 100644 --- a/drivers/mmc/host/sdhci-of-at91.c +++ b/drivers/mmc/host/sdhci-of-at91.c @@ -100,8 +100,13 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock) static void sdhci_at91_set_uhs_signaling(struct sdhci_host *host, unsigned int timing) { - if (timing == MMC_TIMING_MMC_DDR52) - sdhci_writeb(host, SDMMC_MC1R_DDR, SDMMC_MC1R); + u8 mc1r; + + if (timing == MMC_TIMING_MMC_DDR52) { + mc1r = sdhci_readb(host, SDMMC_MC1R); + mc1r |= SDMMC_MC1R_DDR; + sdhci_writeb(host, mc1r, SDMMC_MC1R); + } sdhci_set_uhs_signaling(host, timing); } -- 2.35.1