Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2840181rwb; Mon, 15 Aug 2022 12:22:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR4UHF3eXSCpwLvLNjCw8tngLggYETgMy5ooYhUazdKb8PhFLt+zLXOS5SBpjlQG4UkGB4R9 X-Received: by 2002:aa7:d49a:0:b0:43c:fed4:c656 with SMTP id b26-20020aa7d49a000000b0043cfed4c656mr15416010edr.312.1660591328889; Mon, 15 Aug 2022 12:22:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660591328; cv=none; d=google.com; s=arc-20160816; b=JQ6GKbuGCkR0Pi+kG0ADnt3e1T8TAQJNfo71VoZ24LSrmqt/v/qV7icRxv3uJND/mJ 3jFMMiHFuGZ6KuSsO0g6lwB0RCttnfgxKTB1P9EJLXCj68ODNeIwotY6I36GKWKPif/U NlM1CTOjp9i8yexIBw5uH+0ZFwNTSjvjX73hwFJPw/nMuIz/MTAm+D/mvp0ZUCK1R7e7 duoFGFeq4limx/PAotiWbAFflijCUT+l7EZ2MBpbuBCUAF1VDWBQTJ8lWh3W2wbfP7Jp Sbh1kskPTv2cJL4Lo7lVirC+0i+kGDICKsBsz4vLis24isE3pR9491Ikwoeyqhk9Lf5P LhAA== 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=FHsTjaRu8y7QEW9txKrasUiJ1vNE4nf6ZoxuOESiQpg=; b=i4qGIHZ9+FMfIPkDF6bxPIVLHqgXiSuFAtWl0xY7ALeBaQaIUXviGljKdd+wZDD0p0 YHj0yhC5Rkk08ozeneRbbMG/9HWtqS37sekKIz0fZ6w2QguYXKQ9wwZXsydTOpPKMCsf pUS8YGlACZUA43sWAG0VWA3UcS4XQ7zHDaypsVtTN+WboEnyfc79r8B+CULfC20Oz3Xt HHl3O2FJvrg9Vrrc7PUWvlvOn1WY5Mp9g6idW7wy4QU58yNTQFBnLtNvuZT1qppmiBYn tZPl0O45BZfYp16+7DOPa8zlQXz1oyTDru+LPOTAJdrCzIokVTuE4f99P+LUbgK/QWEH zX9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="EnjMv/B6"; 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 i32-20020a0564020f2000b004418d8e5ae4si7256952eda.597.2022.08.15.12.21.42; Mon, 15 Aug 2022 12:22:08 -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="EnjMv/B6"; 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 S1344107AbiHOTTL (ORCPT + 99 others); Mon, 15 Aug 2022 15:19:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344332AbiHOTQZ (ORCPT ); Mon, 15 Aug 2022 15:16:25 -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 EFF3752FC1; Mon, 15 Aug 2022 11:38:04 -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 52D34B8108B; Mon, 15 Aug 2022 18:38:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93F63C433B5; Mon, 15 Aug 2022 18:38:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588682; bh=Gz2Jr+pS+jA08IitzJi1AbwCWv5VZEhjC2YGN6UtlOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EnjMv/B60cdFrhJ4MVeoiZrPcIyRxcpJ1mHewJJoj/ab8HRSh+hwjKMsYudBTF0ZN 25fnz5uyIqU0N+WnbXGA+35dR8wlBoFVRlRz/0ZhXgpVtXnShs9Vk2tqTdEiiMYKXD 3jPH/yJKGxStEiO3V4+6czkzL46b7YApLtLujph0= 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.15 481/779] mmc: sdhci-of-at91: fix set_uhs_signaling rewriting of MC1R Date: Mon, 15 Aug 2022 20:02:05 +0200 Message-Id: <20220815180357.816841310@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 d1a1c548c515..0452c312b65e 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