Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp775151ybt; Fri, 19 Jun 2020 13:26:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqPSy/NZntlKEPZf2kO2LB+uuzyGhdfzVH1v50mQ+VFQ3GDoBJ0YkbS7wM+ctNCEaoicxf X-Received: by 2002:a17:906:7a19:: with SMTP id d25mr5415775ejo.333.1592598399923; Fri, 19 Jun 2020 13:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592598399; cv=none; d=google.com; s=arc-20160816; b=up7d9KPdEDlVI+GCNJ9TrQzfy7E495angN5Owk5/6WPQeUwAZ4OAWLneMQqahtCP1m ucGVJtSW6lCQSjT9vnu5QBvPFCUEw7Mfj8PgiLx6wSNZgH5dWRfbX2LuwA7Hj44hHFQe Ktc3y0g/SdCF4ggydpihzqDIQ+cxt3HSvVejsMojw1Za/c98wqmrtP0b3XecAN8uQLiv CC5oofxCeK0DqVSe4X+xEeyRdl6BmJ9ix+vcTAWRJ5HhERiUw4ZJ0Mo62wOgpwvJcJDq 4aywksGZLTxmd7WyC5g3TMlfebsh2pgZIuZnjIlXHhlEG2Z0CBmNe8OY1BD1G19fM7c5 J1GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NY4nnfXy1tu/rmPADLDc7j6SeKrhNG8f9kvSPlI6j2g=; b=KAp9sHtdWHqKO8cqAKhK8ZSqoHHQmRwJ7J2KO2yPkMFbuAC+tj3z3gslyCD7L+TESP g0qWkqW2qYmvDrExvIdY/oEXSXEvSGDcsBJWsjws1U92fT80DQZ6PFFghDSmWWLyEFgN HdEdd9AI9nW/muOqNkGNM1Ll1GHsalJnO/X1BLmkx8VyeXMtQ5k3Tf0xgK7QJFyuvr2x EhtQtmqgdZGVpwYUlcBzMjA5tnLpEStPAvMQVcJciLdMTX4uwJFXWjZxdoij4g4JUabJ ZUpJO24s4FZKBHxzSWXhip5qn1UXW4S4kTUSWSUj8ai3O4WmAtAE3i/QYABvTJth0qoj wyUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aoYwnO35; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f24si4341579ejx.91.2020.06.19.13.26.17; Fri, 19 Jun 2020 13:26:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aoYwnO35; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390359AbgFSO6N (ORCPT + 99 others); Fri, 19 Jun 2020 10:58:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:53696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390321AbgFSO6G (ORCPT ); Fri, 19 Jun 2020 10:58:06 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2ED4A21919; Fri, 19 Jun 2020 14:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578686; bh=jYmhetrVkNgZTNo37SbeiWGjdac6A+k42aQczdxV2LA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aoYwnO35gd6pd+0BhF+JrxIkft1D+QyATeUrxVrur7aK+S2nIRShIdAynLL9+cGle MYo9U+p42EPm+q/xUJMSfBHDOswTUhLuMFzMw4L7+4xeYdXoDOBzGmK9l8uzyZtGos O42zFJ71lBguHHIXXnuOfrjI77v3g8lwSbtzJ7O0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Blumenstingl , Tobias Baumann <017623705678@o2online.de>, Ulf Hansson , Sasha Levin Subject: [PATCH 4.19 116/267] mmc: meson-mx-sdio: trigger a soft reset after a timeout or CRC error Date: Fri, 19 Jun 2020 16:31:41 +0200 Message-Id: <20200619141654.404095240@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141648.840376470@linuxfoundation.org> References: <20200619141648.840376470@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Blumenstingl [ Upstream commit 91995b904ec2e44b5c159ac6a5d3f154345a4de7 ] The vendor driver (from the 3.10 kernel) triggers a soft reset every time before starting a new command. While this fixes a problem where SDIO cards are not detected at all (because all commands simply timed out) this hurts SD card read performance a bit (in my tests between 10% to 20%). Trigger a soft reset after we got a CRC error or if the previous command timed out (just like the vendor driver from the same 3.10 kernel for the newer SDHC controller IP does). This fixes detection of SDIO cards and doesn't hurt SD card read performance at the same time. With this patch the initialization of an RTL8723BS SDIO card looks like this: req done (CMD52): -110: 00000000 00000000 00000000 00000000 clock 400000Hz busmode 2 powermode 2 cs 1 Vdd 21 width 1 timing 0 starting CMD0 arg 00000000 flags 000000c0 req done (CMD0): 0: 00000000 00000000 00000000 00000000 clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 0 starting CMD8 arg 000001aa flags 000002f5 req done (CMD8): -110: 00000000 00000000 00000000 00000000 starting CMD5 arg 00000000 flags 000002e1 req done (CMD5): 0: 90ff0000 00000000 00000000 00000000 starting CMD5 arg 00200000 flags 000002e1 req done (CMD5): 0: 90ff0000 00000000 00000000 00000000 starting CMD3 arg 00000000 flags 00000075 req done (CMD3): 0: 00010000 00000000 00000000 00000000 starting CMD7 arg 00010000 flags 00000015 req done (CMD7): 0: 00001e00 00000000 00000000 00000000 starting CMD52 arg 00000000 flags 00000195 req done (CMD52): 0: 00001032 00000000 00000000 00000000 [... more CMD52 omitted ...] clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 2 clock 50000000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 2 starting CMD52 arg 00000e00 flags 00000195 req done (CMD52): 0: 00001000 00000000 00000000 00000000 starting CMD52 arg 80000e02 flags 00000195 req done (CMD52): 0: 00001002 00000000 00000000 00000000 clock 50000000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 4 timing 2 starting CMD52 arg 00020000 flags 00000195 req done (CMD52): 0: 00001007 00000000 00000000 00000000 [... more CMD52 omitted ...] new high speed SDIO card at address 0001 Fixes: ed80a13bb4c4c9 ("mmc: meson-mx-sdio: Add a driver for the Amlogic Meson8 and Meson8b SoCs") Signed-off-by: Martin Blumenstingl Link: https://lore.kernel.org/r/20200503222805.2668941-1-martin.blumenstingl@googlemail.com Tested-by: Tobias Baumann <017623705678@o2online.de> Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/meson-mx-sdio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-sdio.c index 1c062473b1c2..27837a794e7b 100644 --- a/drivers/mmc/host/meson-mx-sdio.c +++ b/drivers/mmc/host/meson-mx-sdio.c @@ -249,6 +249,9 @@ static void meson_mx_mmc_request_done(struct meson_mx_mmc_host *host) mrq = host->mrq; + if (host->cmd->error) + meson_mx_mmc_soft_reset(host); + host->mrq = NULL; host->cmd = NULL; -- 2.25.1