Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2909500iog; Mon, 27 Jun 2022 05:34:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uEWW+pyDPWpCWI46HHDDkSXg3j6nYoWlo/DnUv7Hbg7G9Wu9+CFhnh6yvxHH20NTR8kU9q X-Received: by 2002:a05:6402:498:b0:435:daf0:915b with SMTP id k24-20020a056402049800b00435daf0915bmr15926890edv.322.1656333251801; Mon, 27 Jun 2022 05:34:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333251; cv=none; d=google.com; s=arc-20160816; b=dQKgcdjkW+xClYCb5K7kJ9MZc9MbDjyw1YLnRwRiZz9fF4RZ9hTmcLHtz5nd0R3gOS T/XJsujmst+sQbFO+2HGkvU8L1w+0ZxGQOy1yttcDTFMpuYAAx7Z0Nkt8IzDYCN8Ztit pnggDNj+cFy3xKwsm7q/b8XaU6lMz1JoRoTB/BPu/Jgus+MzKfr35eCMgi5WgCWuwR2p U7QeeviG3GxmrZ8H/Rj7qP1dD6ND2J2D7o47tCHYFC6eUfKXYlaGnDMzgyhTJWXmMUyh lfEwGYV6VVJ02VGYycR0uu3l+3ELl5V+oOePAD7GNJcTOmMhZ2hiQYepBpESRddj8Rmj 579g== 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=DM1++e17GPrvJT5Td27iAlpKM0/IkHjRJxLVdEKormM=; b=wtX5NhNqT7vzV7Ke4ENcbd/j6WsD+uehl1jlpmS7y+e4KQoheH24COBetvHg6mBeNc iePAAnrXaNJq54NHFkkJ6cH0IM9dVyQvvPQhRMOIalGmc9l+jncIqRkyFknm7j0FA2bD GH4dbkUcDXE9wAllm/6OWTrQT58ixuIZxBd/RNxLYixVtmdv1B4rNPAbFC9pq5Z+KLbg ret3WSVBsWN1QpbzvcJpfaFtTSXesnqfjNLCGb7fpJf9yQQqsY+p4znaFIyZ5D9V2YJo kwNBzUitjTtv4VT54aI1vjUZNAF1jmid0Uu294Pu1NalbwNJaf73VxKOCqhR8odENhLa eOGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YWDrUMew; 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 c17-20020aa7d611000000b004357d877a6esi11294038edr.382.2022.06.27.05.33.47; Mon, 27 Jun 2022 05:34:11 -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=YWDrUMew; 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 S235852AbiF0Lei (ORCPT + 99 others); Mon, 27 Jun 2022 07:34:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236036AbiF0LdF (ORCPT ); Mon, 27 Jun 2022 07:33:05 -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 D852DBCB8; Mon, 27 Jun 2022 04:30:08 -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 71C82B8112E; Mon, 27 Jun 2022 11:30:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF970C3411D; Mon, 27 Jun 2022 11:30:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656329406; bh=MbXe0ur52wnHNXV65jswXkfskRWW47XRp/QkLCJo9nw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YWDrUMewBj33EMio+vKdrPp1whs5ybk4j6TjjYULN6MjnAh3F+ZWktjcO7FTJXLQS yTsDbrq9+qm2ARDn0djMcDQdqoq6GNEO/qePH371wq7oao5tRbajQekF1TkGcsJWGu CEzJfP2TqrbzmlnW3qYbc9y6jTei83C8KN5wpBDc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chevron Li , Ulf Hansson Subject: [PATCH 5.4 08/60] mmc: sdhci-pci-o2micro: Fix card detect by dealing with debouncing Date: Mon, 27 Jun 2022 13:21:19 +0200 Message-Id: <20220627111927.896346056@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111927.641837068@linuxfoundation.org> References: <20220627111927.641837068@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=-7.5 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: Chevron Li commit e591fcf6b4e39335c9b128b17738fcd2fdd278ae upstream. The result from ->get_cd() may be incorrect as the card detect debouncing isn't managed correctly. Let's fix it. Signed-off-by: Chevron Li Fixes: 7d44061704dd ("mmc: sdhci-pci-o2micro: Fix O2 Host data read/write DLL Lock phase shift issue") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220602132543.596-1-chevron.li@bayhubtech.com [Ulf: Updated the commit message] Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/sdhci-pci-o2micro.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/mmc/host/sdhci-pci-o2micro.c +++ b/drivers/mmc/host/sdhci-pci-o2micro.c @@ -145,6 +145,8 @@ static int sdhci_o2_get_cd(struct mmc_ho if (!(sdhci_readw(host, O2_PLL_DLL_WDT_CONTROL1) & O2_PLL_LOCK_STATUS)) sdhci_o2_enable_internal_clock(host); + else + sdhci_o2_wait_card_detect_stable(host); return !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT); }