From patchwork Tue Apr 14 03:40:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Mao X-Patchwork-Id: 211023 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_BASE64_TEXT, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF173C352B6 for ; Tue, 14 Apr 2020 03:41:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CDAFE2075E for ; Tue, 14 Apr 2020 03:41:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="hkvI7C/d" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404895AbgDNDlB (ORCPT ); Mon, 13 Apr 2020 23:41:01 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:16151 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2404877AbgDNDlA (ORCPT ); Mon, 13 Apr 2020 23:41:00 -0400 X-UUID: aaf2067a1a0a453a9baad549a1a15e3e-20200414 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=SkuybeaYmadFxyJ4GbnzpSoKVqrqaPzUzjiC/dZm8Jw=; b=hkvI7C/dlEUsEq1OtfZDTkkdZYWqJRrvmDlVyaNOzUUgfMFRs3x87M9ol+nyAEx207mmqnfjd8XdDA5P5g1wneraCwvjb7gQnhQyyfXkNQ8AAz4qJphyricLL4AY2mrD6ZySm0KKvesrFlKCLpctnN3ZGCnENaAduj2cP4HmkMo=; X-UUID: aaf2067a1a0a453a9baad549a1a15e3e-20200414 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 925647458; Tue, 14 Apr 2020 11:40:57 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 14 Apr 2020 11:40:55 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 14 Apr 2020 11:40:50 +0800 From: Yong Mao To: Ulf Hansson CC: Chaotian Jing , Matthias Brugger , , , , , , yong mao Subject: [PATCH 3/3] mmc: core: fix mmc_sdio_reinit_card fail issue Date: Tue, 14 Apr 2020 11:40:11 +0800 Message-ID: <1586835611-13857-4-git-send-email-yong.mao@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1586835611-13857-1-git-send-email-yong.mao@mediatek.com> References: <1586835611-13857-1-git-send-email-yong.mao@mediatek.com> MIME-Version: 1.0 X-MTK: N Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: yong mao If SDIO device is initialized by UHS mode, it will run with 1.8v power. In this mode, mmc_go_idle may not make SDIO device go idle successfully in some special SDIO device. And then it can't be re-initialized successfully. According to the logic in sdio_reset_comm and mmc_sdio_sw_reset, invoking mmc_set_clock(host, host->f_min) before mmc_send_io_op_cond can make this SDIO device back to right state. Signed-off-by: Yong Mao --- drivers/mmc/core/sdio.c | 1 + 1 file changed, 1 insertion(+) -- 1.9.1 diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index f173cad..dc4dc63 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -850,6 +850,7 @@ static int mmc_sdio_reinit_card(struct mmc_host *host) sdio_reset(host); mmc_go_idle(host); + mmc_set_clock(host, host->f_min); mmc_send_if_cond(host, host->card->ocr); ret = mmc_send_io_op_cond(host, 0, NULL);