Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1863412rwb; Fri, 19 Aug 2022 10:38:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR6jH/cGlk4Pjhu35dfqF+PqKIztDTSiFTcdxeD5JpDPGaz0pAVchItYtb1gQTdJ+KH7nu7A X-Received: by 2002:a17:90b:1189:b0:1f5:1311:cd89 with SMTP id gk9-20020a17090b118900b001f51311cd89mr15009154pjb.181.1660930702576; Fri, 19 Aug 2022 10:38:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930702; cv=none; d=google.com; s=arc-20160816; b=Gz1DmT2MzOlONt50W1Ktvky6ZmppTSGPoO1NC22ZOd/emAB7lBeS/XEuZd5B8KRR0j rSPZz0zIoWhi61HpcjftyaCcDEOkaLVAlmkJMqoe/cjJEjl2AMtbZ2I/8q6XtViFnCfZ tesde/WyD7NMysk3UmcA8FfQDKblUw8iC15XZ54McGKFFKwSbErcN+Xe6WofRo/p3GSM DsC2O7fr3CIt/f+SxxHelpObPtm1FGlC0LzHuO38X2JPE4MVeiffVffZq/M1zOlf0aJ6 F7I/hV6y8XPjTWpK1+9CY4mOyRcm3POa3ILDfjrAVQMrmyKVlqhgpbvKsPeD2xFO+hDq FALg== 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=igDY+Waqbwn3lyjO326YtIBUSldY9cz7/GstLQ8CWP/CUAk8dCxgxyAZCxmLspBE71 SNVjzaAG1X9HzDloqG0JZGos0T3ddpmqsuf1QRfgyBLxOQ4EPjmITcaSNmX4cL4CSNJN TN4/e3LZ3g/o4qw32RiPEi/+xoMb91p8fps3nS/MxGG/u+7ZMBKjoM5xFgjsFi8Wb4lr fHbb6qpfKK0x9qLTlDKNUepyGieGvqI5IYjbChNbO92CSMcWs76fp5bmFQ27hJmmvMEA 0Jvwi5DeACO66FQ4BK6KjNikIhpag/9ZHmYVMrV8zayoDKGUiTWzHziJfnZ/5HT1qLzu zhUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iEuRTZFw; 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 my10-20020a17090b4c8a00b001f768edcce3si8322775pjb.72.2022.08.19.10.38.11; Fri, 19 Aug 2022 10:38:22 -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=iEuRTZFw; 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 S1352787AbiHSQ1d (ORCPT + 99 others); Fri, 19 Aug 2022 12:27:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352615AbiHSQYH (ORCPT ); Fri, 19 Aug 2022 12:24:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88801118939; Fri, 19 Aug 2022 09:03:07 -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 7F7B9617A7; Fri, 19 Aug 2022 16:03:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D097C433C1; Fri, 19 Aug 2022 16:03:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924983; bh=Gz2Jr+pS+jA08IitzJi1AbwCWv5VZEhjC2YGN6UtlOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iEuRTZFwMorBPElul2lABd0CVrs39ShEuxILLVDDVst59Liv9UvxwX1RjtVpcQRAs AseB3WkEKSYmfr3oZaiU3qFZ3BQSSZp2TE99/EpEj8/IBqIvBjWv81/pziGnf1v94d GZgOs4fVzKrYoAJ2QvQupH3Y1BBRPj+CEGlNSlq4= 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.10 316/545] mmc: sdhci-of-at91: fix set_uhs_signaling rewriting of MC1R Date: Fri, 19 Aug 2022 17:41:26 +0200 Message-Id: <20220819153843.500723665@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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