From patchwork Mon Nov 21 01:51:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 9438667 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A2C3460469 for ; Mon, 21 Nov 2016 01:51:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9355628943 for ; Mon, 21 Nov 2016 01:51:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 878402894D; Mon, 21 Nov 2016 01:51:54 +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=-6.9 required=2.0 tests=BAYES_00,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 4E70728943 for ; Mon, 21 Nov 2016 01:51:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752228AbcKUBvw (ORCPT ); Sun, 20 Nov 2016 20:51:52 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:35008 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751713AbcKUBvw (ORCPT ); Sun, 20 Nov 2016 20:51:52 -0500 Received: from epcpsbgm1new.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OGY01ZA1YI6JO80@mailout2.samsung.com> for linux-mmc@vger.kernel.org; Mon, 21 Nov 2016 10:51:49 +0900 (KST) X-AuditID: cbfee61a-f79916d0000062de-5a-58325335afd7 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id F5.C5.25310.53352385; Mon, 21 Nov 2016 10:51:49 +0900 (KST) Received: from localhost.localdomain ([10.113.62.216]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OGY0060JYID6410@mmp1.samsung.com>; Mon, 21 Nov 2016 10:51:49 +0900 (KST) From: Jaehoon Chung To: linux-mmc@vger.kernel.org Cc: ulf.hansson@linaro.org, shawn.lin@rock-chips.com, m.szyprowski@samsung.com, Jaehoon Chung Subject: [RESEND PATCHv2] mmc: dw_mmc: fix the error handling for dma operation Date: Mon, 21 Nov 2016 10:51:48 +0900 Message-id: <20161121015148.5699-1-jh80.chung@samsung.com> X-Mailer: git-send-email 2.10.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCLMWRmVeSWpSXmKPExsVy+t9jAV3TYKMIg93PDC1u/GpjtTjyv5/R Yu2Ru+wWd56sZ7U4vjbcgdXjzrU9bB5/Z+1n8ejbsorR4/MmuQCWKDebjNTElNQihdS85PyU zLx0W6XQEDddCyWFvMTcVFulCF3fkCAlhbLEnFIgz8gADTg4B7gHK+nbJbhlrL1tX/CFs+LM pyUsDYyzOLoYOTkkBEwkTm9cxA5hi0lcuLeerYuRi0NIYCmjxNMTzewQzg9GiZbOt6wgVWwC OhLbvx1nArFFBGQlfv65wAZiMwtUSPw68A+sRljAX6L7/w2wOIuAqsTWm9tYQGxeASuJJfNv M0Jsk5e4cPUUywRG7gWMDKsYJVILkguKk9JzDfNSy/WKE3OLS/PS9ZLzczcxgkPwmdQOxoO7 3A8xCnAwKvHwHthqGCHEmlhWXJl7iFGCg1lJhHeip1GEEG9KYmVValF+fFFpTmrxIUZToAMm MkuJJucD4yOvJN7QxNzE3NjAwtzS0sRISZy3cfazcCGB9MSS1OzU1ILUIpg+Jg5OqQbGKOXr cWeczXW6Xj64suagzKZNhtcmFmhVCRXN/eN9Xm+/hPrGj9eCwliqPValM7LN1NmjpX6x1OGT 3GLepOkbV+hOkjL4+MBjWTCPxE7ONSv6mjvWyrZIRl0IWTN32V/Zy37+aZqbYg8/6Yucfk5w 6yJF3vxuI+F/d0/2mj/s8/O52Hs+zvi5EktxRqKhFnNRcSIAmMmNCVcCAAA= X-MTR: 20000000000000000@CPGS 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 When dma->start is failed,then it has to fall back to PIO mode for current transfer. But Host controller was already set to bits relevant to DMA operation. If needs to use the PIO mode, Host controller has to stop the DMA operation. (It's more stable than now.) When it occurred error, it's not running any request. Fixes: 3fc7eaef44db ("mmc: dw_mmc: Add external dma interface support") Reported-by: Marek Szyprowski Signed-off-by: Jaehoon Chung Reviewed-by: Shawn Lin --- Changelog on V2 - Change the Fixes Commit Id - Added the Marek's Reported-by tags drivers/mmc/host/dw_mmc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 50a674b..df478ae 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1058,6 +1058,7 @@ static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data) spin_unlock_irqrestore(&host->irq_lock, irqflags); if (host->dma_ops->start(host, sg_len)) { + host->dma_ops->stop(host); /* We can't do DMA, try PIO for this one */ dev_dbg(host->dev, "%s: fall back to PIO mode for current transfer\n",