From patchwork Sun Nov 11 20:23:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 10677837 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5450A1759 for ; Sun, 11 Nov 2018 20:24:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4827A29858 for ; Sun, 11 Nov 2018 20:24:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CD31296FF; Sun, 11 Nov 2018 20:24:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F7072969C for ; Sun, 11 Nov 2018 20:24:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731110AbeKLGO0 (ORCPT ); Mon, 12 Nov 2018 01:14:26 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:51671 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731118AbeKLGOZ (ORCPT ); Mon, 12 Nov 2018 01:14:25 -0500 Received: from localhost.localdomain ([37.4.249.153]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MFsAJ-1gHIdF11od-00HRC9; Sun, 11 Nov 2018 21:24:30 +0100 From: Stefan Wahren To: Eric Anholt , Florian Fainelli , Ulf Hansson Cc: Phil Elwell , Michal Suchanek , linux-rpi-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Stefan Wahren Subject: [PATCH V2 1/7] mmc: bcm2835: reset host on timeout Date: Sun, 11 Nov 2018 21:23:53 +0100 Message-Id: <1541967839-2847-2-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1541967839-2847-1-git-send-email-stefan.wahren@i2se.com> References: <1541967839-2847-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K1:9dCj+NxEXMy8FYSWT087C0qWiWpuXnUKaE9LFDImT+erQJJaYfQ afhviGlaCUee+hC7LRqA9GKull3648mAUgO52xY3aMreroZB/2XIIIzronlCdQd6pYX6dOA KBBYxlcz7woae/QQ5I2sTNZuW3qu9oJaiBC6nL0tpFXoKyJYwAy5XGSV5rVZdzeGjDCjR2K nxD304MaNXMWrp5ReQQLQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:pUQrv0nromk=:j9gizncvy8GfWdNJFcRfWj bO9nPfr7BSmAouq0vikpqgHvHFC76FvoBIZwzQ/6yPYaNN+0VVLe4ogV1CmSqE1oolnskVJb/ CpMr3K21XVMuHQfpFYZLrW+KpeNZt2e/2vL/C4C70Frij1Zywt9HHJA5FyrBT5ojnRDA1+dJb v077BsWViC1w/SJLN11CJO4UBehS1Xa8564+HwJDDs5PZV1JcXa2inYx5xQxTbqBY7scOI5mJ YunT0hSlKj172nnKPxqkgktSfCOZ01/yeqQocznS2MLZ8T4O8bd4GXx5qSzImnO/gRmgFu5Pu OfLaxtJU3IcQwSZ7/3uCx/DveeXMCspaHm1rq8G/rOnIvHfiApbIilUoBuGon784I2Gqz5WEP zjMA3kHnGgA/H1C7hm+eba4xbkjT7jCqGbmRY4TnE+cKRX9i3op9MstsCW3VAKBMUg7klCeSW Z8WO+/kYY3jKJ8K7C8kQygOdcz64E8wSyHGyp3FtukWLuEw+j4MLyxBaPKJ/4/bBnnvKgbKnn dh0aCOnrEkoFygCYevcFi3FF3Z4aCqSmZ9uK8PX6rvZck2xP0t/Yamo1HhwE6e/R//TTq/3pw motW+JR8+YF514cM6Cm0P+TZAAdmsFlrS2n0jLKn6+8yhlC3zgZMfhk/HTQaieFkPEn2rWPZn 9mHVsTHprDsVqzVIsKnlA1Nud+0HEv1lwGc3NsX354n3uokuoUOkLaNcGYxOuIiMcgd4dpgTB 81uR39eHejOKAz7Edmkt/pXsynsTZ4RHZnIk+0cNaEGMnwTvk5mkyzLinlOujzRDHhQuPxvHl EVobjFm/bi0KjZwfqDn7hi51gnWnA== Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Michal Suchanek The bcm2835 mmc host tends to lock up for unknown reason so reset it on timeout. The upper mmc block layer tries retransimitting with single blocks which tends to work out after a long wait. This is better than giving up and leaving the machine broken for no obvious reason. Fixes: 660fc733bd74 ("mmc: bcm2835: Add new driver for the sdhost controller.") Signed-off-by: Michal Suchanek Signed-off-by: Stefan Wahren --- drivers/mmc/host/bcm2835.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c index 768972a..f1712df 100644 --- a/drivers/mmc/host/bcm2835.c +++ b/drivers/mmc/host/bcm2835.c @@ -286,6 +286,7 @@ static void bcm2835_reset(struct mmc_host *mmc) if (host->dma_chan) dmaengine_terminate_sync(host->dma_chan); + host->dma_chan = NULL; bcm2835_reset_internal(host); } @@ -837,6 +838,8 @@ static void bcm2835_timeout(struct work_struct *work) dev_err(dev, "timeout waiting for hardware interrupt.\n"); bcm2835_dumpregs(host); + bcm2835_reset(host->mmc); + if (host->data) { host->data->error = -ETIMEDOUT; bcm2835_finish_data(host);