Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3412440rwa; Tue, 23 Aug 2022 04:28:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR7E8M1sZhZoUagYqtE1zSqfOTQ/acEoQ2gzGJV6zpLMuX/B55bwdITOo4UKBhABABovMhMj X-Received: by 2002:a17:907:2c62:b0:73d:6c37:2ae9 with SMTP id ib2-20020a1709072c6200b0073d6c372ae9mr9410348ejc.271.1661254119449; Tue, 23 Aug 2022 04:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254119; cv=none; d=google.com; s=arc-20160816; b=hdNkVGcUVU/C/g1dnP14HF0bVP0xRM4Ooybfn8MUKFukHJvs148Y4L65HJHC34n79p guGyXXnYtJEGZIARxaZR5DqQpXeG1YY0j1i5xcIureJYGJpmZ/MESVq0XSvYEIjkD4jl V/j2Hligwnw+OXSDZGBSUQCZI9GxF/EIfUlJq7adqBktbO3qEWqs7imx6tYdOgySniu4 FsRTmXqZ65EankE6K31J58zNDX+CvlzA5Sva1uFgs3pjoth7jsDBNRoEGGUv8iza2SeP Fqvdo84bXbgWhOy9RkWztE4FGJIhKkIf4mHc6sxroT4DAPZQCuNWdZshJE2U/cg69gjh oLEg== 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=dKRMP/+WQsJnO0Hm02QP8UJ+7hmF4668bMZXlsqkFnc=; b=u8lUYds3BUbWlVKHaJnuMoAWnAFEi8u6SbV6VRb6IEP+sfAJ3R8FgTqgYaQD3MUjmg U6pZpCnEq/dIVWcYMmBUzQe7rB37HNCx1WRWDkCMI/z1FzDsZLNtxCHvBMlzFaV9RTMS CbUpkIN/i7sxq30Qs8vDCe1MiG4r+emPvtePbQSMr4XcoM0YobS9PFJanV+9ILcYXNcE IAt2FH8sUBOs3zOzDWppu0KwG4VUEbSFDoRi7YZ/FwMm1ZE9ssZqXHWYG1h3VstnpASX T20RcmvjL8sYQMrStvmwjoZtGNFGQfUCQb5J7gN+MDSi9rlPpD7waI/0LB4XW3WJ2n9C txsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DoGhhFQ5; 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 m15-20020a50930f000000b0043e1e74a4e6si1708840eda.469.2022.08.23.04.28.12; Tue, 23 Aug 2022 04:28:39 -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=DoGhhFQ5; 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 S1355356AbiHWKnV (ORCPT + 99 others); Tue, 23 Aug 2022 06:43:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355574AbiHWKcm (ORCPT ); Tue, 23 Aug 2022 06:32:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B7F3A5985; Tue, 23 Aug 2022 02:06:45 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 246CD6155D; Tue, 23 Aug 2022 09:06:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3129EC433C1; Tue, 23 Aug 2022 09:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245604; bh=1VwcYKQjh+FqBxB9bypplF9vur1PhNErQ57grdAmqtQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DoGhhFQ5gD0zKSmbAZzzyyjzGDXbBvG7DI2rPAxXK6LcLrRQDPc+YoXiHh9OCL25R Cj4h6y7gstFhy+HSR6Wdkh52xx8fnv8TPLN2QUTxJuQ+5bTJYhYzbg1OTtJZuWPQ5Q EVqwgdXVdBqppcnwJ0FWxEY7XCw5Zz0+jcSSnFFM= 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 4.19 130/287] mmc: sdhci-of-at91: fix set_uhs_signaling rewriting of MC1R Date: Tue, 23 Aug 2022 10:24:59 +0200 Message-Id: <20220823080104.784447534@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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 8cd1794768ba..70ce977cfeec 100644 --- a/drivers/mmc/host/sdhci-of-at91.c +++ b/drivers/mmc/host/sdhci-of-at91.c @@ -117,8 +117,13 @@ static void sdhci_at91_set_power(struct sdhci_host *host, unsigned char mode, 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