From patchwork Thu Sep 13 05:58:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 146600 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp206019ljw; Wed, 12 Sep 2018 23:00:03 -0700 (PDT) X-Google-Smtp-Source: ANB0VdatSsfSVJgTLWjti6DCq3iKIFz4EafqgV+p5nawkhmkD90BwlQGq0nTpadKxapNGDknGXtG X-Received: by 2002:a62:1544:: with SMTP id 65-v6mr5702048pfv.178.1536818403284; Wed, 12 Sep 2018 23:00:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536818403; cv=none; d=google.com; s=arc-20160816; b=wK+yqTtntIfeukBqTIb9JwCg042WjRrWaE99tRJ06ylsFuBJGyG0JsTKUa6VZ9n1XK 1tRNaL+AD7F0yznoet2UF8EF3pIokCsJH3TFfvMJd5jNxUWJZK6xz/2JwusuK0DnVPrd NTIpMTJDK8BvSshsXhnpaUQS5Yqx0TQhXjJSLLCs6VzmnxFBb6qrhLV6+S6H+ZYWoC/Q wrz6qbRT4WUawq/EOx+AYT5cF9+VfvF3dl+F3RiLYmYn0hujCAHuf2fQm99O67h2UI09 1jpM25Sn234bALBgnKmgZ8drY0Ax2fFgZMlA6drkSGg9/5JG3Usiry5vUAwy6GP0VbZb 8ILQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:message-id:date:subject:to:from:dkim-signature :dkim-filter:dkim-signature; bh=6OzWmj3IwaCR8/PHE2mNStTXK/XwaZeoqucu5/zmxCs=; b=txNU/y0pqBAC6aJ8/e7JZlSLVjwnTfyR1vVVrvZ8wbzjL5+0cTDXsLcWy6pucQFi6S wop2QrE6UCzIhlmJMldUZDREbq/xt0Rlk6Z14LVSiVJZm/LPVLHK3ChOSw3xe03uK1nd UvYH/Jdf/ezvt+HUq6iKigLufV7xcYo64zVM9+nxpiS8TxLEQeI6cVZJCR8xIyOnSv/I kmzMsepv0XGLTZTH1jWRsvjIF3+Q5eYFoUdekVqB9R16vYBQsvM9UIfKbNLNHNkD3nV7 VgIAYSimLSOG8+NULBwwIG9DceNsTITcby96/J344Xo1nfWp0yPuO1S6z0uUOhe14sYL 6p+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=NVMk8Nt6; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=edS5DDnB; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id y3-v6si3148866pgg.266.2018.09.12.23.00.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Sep 2018 23:00:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=NVMk8Nt6; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=edS5DDnB; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=6OzWmj3IwaCR8/PHE2mNStTXK/XwaZeoqucu5/zmxCs=; b=NVM k8Nt6gZxXokdg3QFOz9zvBjCrosU/CTG2o7gOYrW7gJnffGSbZ+NDQGwoEZUYUOP+NYRBRc5gKsAO MhGgKe5HF5svgf4pegTByhCXQD/pMgy8l6OG6YVi/x+PnPcHuv8X3sNL6qLUvqGcm0UwUeyfHDfqq XISnFOC5rug7QqXkrbJGB2IpfUkDCI/2N72Dd5uYGb7G9AAt9DIyqQNDX6d5tuAhuEw5pAy9ZoxtL AXkp92DSIZ08ctvjDYLxPiC6N9H7aWwsfrIg8QiNtCme5CufGO5EKFx0jemxKgHNinhCBNuL3AqDA buQUDMKeoWs5mWxs+GPmN//3VhA2j6w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g0KfM-0007bK-S9; Thu, 13 Sep 2018 05:59:48 +0000 Received: from conuserg-11.nifty.com ([210.131.2.78]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g0KfJ-0007aM-6N for linux-mtd@lists.infradead.org; Thu, 13 Sep 2018 05:59:47 +0000 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id w8D5wsjd002858; Thu, 13 Sep 2018 14:58:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com w8D5wsjd002858 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1536818335; bh=Zzz6TfVv4KOjT4SlS07cnGQiDxiJTQwq6CquERnGz1Y=; h=From:To:Cc:Subject:Date:From; b=edS5DDnBL8jPnK/UBkiK82hNjaZ8uEmzPtUArvhnKXF/6aPLzehcTql3eGBXpIFwM FiL4a+1MBNs4M0uVx0RrxmPjkYHdCY0VCQrhaqWSTDw+Txj7HdcpV5YgHy+vzG+Rdf WjNVrpjlkfjjonpxarD3YOto6FxiVMne7npQoj6TS/phh6vBY9kINpurK5YZusxaxl AvyLfPr46jZQBvth97R1bwjGnYO2nq6Y2JoUpITBj93GquWLkv+twtEUBA1Cttl1AA ZGTdErOqbRrbz3SMoI8Eu4ocfyHsBnXbSGoj1fCv3iAUVObULDeOPsFiHpmr5UET3O 7vUd1a5cucXYw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org, Boris Brezillon , Miquel Raynal Subject: [PATCH] mtd: rawnand: denali: fix a race condition when DMA is kicked Date: Thu, 13 Sep 2018 14:58:49 +0900 Message-Id: <1536818329-11068-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_225945_572948_8E668981 X-CRM114-Status: UNSURE ( 9.60 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [210.131.2.78 listed in list.dnswl.org] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Steffen Trumtrar , Marek Vasut , Richard Weinberger , linux-kernel@vger.kernel.org, Masahiro Yamada , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org I thought the read-back of the DMA_ENABLE register was unnecessary (at least it is working on my boards), then deleted it in commit 586a2c52909d ("mtd: nand: denali: squash denali_enable_dma() helper into caller"). Sorry, I was wrong - it caused a timing issue on Cyclone5 SoCFPGAs. Revive the register read-back, commenting why this is necessary. Fixes: 586a2c52909d ("mtd: nand: denali: squash denali_enable_dma() helper into caller") Reported-by: Steffen Trumtrar Signed-off-by: Masahiro Yamada --- drivers/mtd/nand/raw/denali.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index 67b2065..b864b93 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -596,6 +596,12 @@ static int denali_dma_xfer(struct denali_nand_info *denali, void *buf, } iowrite32(DMA_ENABLE__FLAG, denali->reg + DMA_ENABLE); + /* + * The ->setup_dma() hook kicks DMA by using the data/command + * interface, which belongs to a different AXI port from the + * register interface. Read back the register to avoid a race. + */ + ioread32(denali->reg + DMA_ENABLE); denali_reset_irq(denali); denali->setup_dma(denali, dma_addr, page, write);