From patchwork Tue May 13 09:28:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 30009 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 996BF20369 for ; Tue, 13 May 2014 09:31:49 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id kq14sf350836pab.2 for ; Tue, 13 May 2014 02:31:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=cQ9aEnfDDXWzV29QRXxG6x4trFHaKsDU19bux4mKOV0=; b=RpEdHWnCS9tyOuWObnAevxBt3G9FDjxDoFAq3+ihPCNdR+7EIIUo8CwiE048H7q5Z4 5v9STnVCyIMusNRGcvkR7KFkHm00ajmFal8BYfOa/8K0dbAhWcbYuJ/A/Pp+em43rWhn jL/fk0lSisF1FA+oo0I9yqpoNnIPnEEMq44wW4a3Gc+APX5egi/0ik8L6ONhVX91z2kB R/1skQgvaHCZ5zcMp0blW9NCo/EOa4LOz70q9Z2+kmAq9zpEfJ9+7zoUiaY+6QBNM64T xMlViTGEwYijoMaObUDhRg6L1DtLI/p1u+srEf8fEeDUkojC1QA0CgqKhkqr+JwUyNSr Cuvw== X-Gm-Message-State: ALoCoQmrBUM/vIrk97lwcd/q0VoC+pIeLtZutz+WSe7n+Jiq1QCk8nTuqaMbEyUEPiD6aUXRmuQL X-Received: by 10.66.121.195 with SMTP id lm3mr14490901pab.24.1399973508933; Tue, 13 May 2014 02:31:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.107.97 with SMTP id g88ls1702506qgf.40.gmail; Tue, 13 May 2014 02:31:48 -0700 (PDT) X-Received: by 10.221.37.1 with SMTP id tc1mr1179842vcb.32.1399973508843; Tue, 13 May 2014 02:31:48 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id gu9si2537824vdc.160.2014.05.13.02.31.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 02:31:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id hu19so87946vcb.6 for ; Tue, 13 May 2014 02:31:48 -0700 (PDT) X-Received: by 10.52.99.168 with SMTP id er8mr23728562vdb.26.1399973508734; Tue, 13 May 2014 02:31:48 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp136293vcb; Tue, 13 May 2014 02:31:48 -0700 (PDT) X-Received: by 10.68.191.39 with SMTP id gv7mr3907904pbc.90.1399973507618; Tue, 13 May 2014 02:31:47 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yg6si12698342pab.98.2014.05.13.02.31.46; Tue, 13 May 2014 02:31:46 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760301AbaEMJae (ORCPT + 27 others); Tue, 13 May 2014 05:30:34 -0400 Received: from ip4-83-240-18-248.cust.nbox.cz ([83.240.18.248]:33217 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760155AbaEMJ3E (ORCPT ); Tue, 13 May 2014 05:29:04 -0400 Received: from ku by ip4-83-240-18-248.cust.nbox.cz with local (Exim 4.80.1) (envelope-from ) id 1Wk91D-0003EH-Qj; Tue, 13 May 2014 11:29:03 +0200 From: Jiri Slaby To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Sekhar Nori , Joel Fernandes , Vinod Koul , Jiri Slaby Subject: [PATCH 3.12 175/182] dma: edma: fix incorrect SG list handling Date: Tue, 13 May 2014 11:28:47 +0200 Message-Id: X-Mailer: git-send-email 1.9.3 In-Reply-To: <7aa1bde8f6143b2db33e6567a8c3a4debaa246f4.1399973152.git.jslaby@suse.cz> References: <7aa1bde8f6143b2db33e6567a8c3a4debaa246f4.1399973152.git.jslaby@suse.cz> In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linux-kernel-owner@vger.kernel.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Sekhar Nori 3.12-stable review patch. If anyone has any objections, please let me know. =============== commit 5fc68a6cad658e45dca3e0a6607df3a8e5df4ef9 upstream. The code to handle any length SG lists calls edma_resume() even before edma_start() is called. This is incorrect because edma_resume() enables edma events on the channel after which CPU (in edma_start) cannot clear posted events by writing to ECR (per the EDMA user's guide). Because of this EDMA transfers fail to start if due to some reason there is a pending EDMA event registered even before EDMA transfers are started. This can happen if an EDMA event is a byproduct of device initialization. Fix this by calling edma_resume() only if it is not the first batch of MAX_NR_SG elements. Without this patch, MMC/SD fails to function on DA850 EVM with DMA. The behaviour is triggered by specific IP and this can explain why the issue was not reported before (example with MMC/SD on AM335x). Tested on DA850 EVM and AM335x EVM-SK using MMC/SD card. Cc: Joel Fernandes Acked-by: Joel Fernandes Tested-by: Jon Ringle Tested-by: Alexander Holler Reported-by: Jon Ringle Signed-off-by: Sekhar Nori Signed-off-by: Vinod Koul Signed-off-by: Jiri Slaby --- drivers/dma/edma.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index 10b577fcf48d..0ad40e4a7ae0 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c @@ -170,11 +170,13 @@ static void edma_execute(struct edma_chan *echan) if (edesc->processed == edesc->pset_nr) edma_link(echan->slot[nslots-1], echan->ecc->dummy_slot); - edma_resume(echan->ch_num); - if (edesc->processed <= MAX_NR_SG) { dev_dbg(dev, "first transfer starting %d\n", echan->ch_num); edma_start(echan->ch_num); + } else { + dev_dbg(dev, "chan: %d: completed %d elements, resuming\n", + echan->ch_num, edesc->processed); + edma_resume(echan->ch_num); } /*