Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2039483imm; Mon, 16 Jul 2018 00:40:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfvXNkUdwEtjHoUK60YuhiN2teLH+JIsFbpOPGDPT2qlHtBsccIrP1dgX2sWiIUl1TUaTwT X-Received: by 2002:a62:b0c:: with SMTP id t12-v6mr17015386pfi.36.1531726827157; Mon, 16 Jul 2018 00:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531726827; cv=none; d=google.com; s=arc-20160816; b=Qq6qqu0pvjedOPdiNmasHOXNYgBT1msdG2pUMb2llfdzfAeyIUo4tozC+H1bRFV1s1 4068grYF7tugXv40/FpQh/p29K3FAeBOMn7VIh9BKHtMANUQDl5F5l0+ikhPBoBwySXk UBrQ6xYigIxOqPiYt4Fvt3C5jpaEN/6qA/M0H8ytnZeg0ap0PTSvbe3kZrHSuI4m1ljX TQaMqBbfEoPdx9V8oS2PZzcOjgrQP3io8HxFdB7z3xdECZe0O+Zw8eHlD/vhcIXIP0Kp XUBwUJGlNDLPMIxMYweqfN/BULSXOWMfmGGBpf7LnWjsaERRjs9koaV0sjkWCQfzG0Eg IsTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Qd3k9hwstE2r96Vmcy0a0kghN+fR+MTwtvYOUitTuxo=; b=ZbxcePihuso41G9iT7b9KmMIjB0FCxAvOUZF3PDs/4ckvglaGp3th4Xd8tbPlO52X3 OMAMjaA8MIM727zw5KVU/XVtYPXy5KyTwUXWLagThTi/AHTfNLWZrrFTOIuA89sUbNY5 wDWMTVX63n9UEuu4Tc7smdCGE3YfX8YO4t2t/FH5Op3IpU+DuDOTt8dqwIMSVj7mX8sP CrsP8LTe1McEN0AiLrULry3kO+SYExhfB5oW9X68vNQkpODZIh1PrHvVTyJjs6Eshq7o ui2V2/Z4iGk3ux9w8ZGW6fFxQX+7Yffi2oUGiVARPnqNP93pM+07crEDk5wAlKHKo8jE YWyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5-v6si2679154pgk.533.2018.07.16.00.40.12; Mon, 16 Jul 2018 00:40:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731945AbeGPIDo (ORCPT + 99 others); Mon, 16 Jul 2018 04:03:44 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46754 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728460AbeGPIDo (ORCPT ); Mon, 16 Jul 2018 04:03:44 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1E0EFC03; Mon, 16 Jul 2018 07:37:42 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vignesh R , Marek Vasut , Boris Brezillon Subject: [PATCH 4.17 18/67] mtd: spi-nor: cadence-quadspi: Fix direct mode write timeouts Date: Mon, 16 Jul 2018 09:34:47 +0200 Message-Id: <20180716073445.972850964@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180716073443.294323458@linuxfoundation.org> References: <20180716073443.294323458@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vignesh R commit aa7eee8a143a7e8b530eb1e75fb86cae793d1e21 upstream. Sometimes when writing large size files to flash in direct/memory mapped mode, it is seen that flash write enable command times out with error: [ 503.146293] cadence-qspi 47040000.ospi: Flash command execution timed out. This is because, we need to make sure previous direct write operation is complete by polling for IDLE bit in CONFIG_REG before starting the next operation. Fix this by polling for IDLE bit after memory mapped write. Fixes: a27f2eaf2b27 ("mtd: spi-nor: cadence-quadspi: Add support for direct access mode") Cc: stable@vger.kernel.org Signed-off-by: Vignesh R Reviewed-by: Marek Vasut Signed-off-by: Boris Brezillon Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/spi-nor/cadence-quadspi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/mtd/spi-nor/cadence-quadspi.c +++ b/drivers/mtd/spi-nor/cadence-quadspi.c @@ -920,10 +920,12 @@ static ssize_t cqspi_write(struct spi_no if (ret) return ret; - if (f_pdata->use_direct_mode) + if (f_pdata->use_direct_mode) { memcpy_toio(cqspi->ahb_base + to, buf, len); - else + ret = cqspi_wait_idle(cqspi); + } else { ret = cqspi_indirect_write_execute(nor, to, buf, len); + } if (ret) return ret;