Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp395118pxb; Wed, 3 Mar 2021 06:07:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLSlEv0f5tubPemu0SLGk49XUeQ6iaiJfoBpd8oC4ptnFI3Y7nZUom+vgkpRi0BmMPw9AJ X-Received: by 2002:a05:6512:22c9:: with SMTP id g9mr16261067lfu.325.1614780461843; Wed, 03 Mar 2021 06:07:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614780461; cv=none; d=google.com; s=arc-20160816; b=OVursMvRIHwhE8UWNjsIF+aIM/UiTNHU9ZR3vo0ZG5wPO6nkkh2X+goLxttDprsdK7 89xa6yGrC0pG8v1VpToRb7C6yg5Nb9D5HKr79/+ioa4GciXZGv8ETXEliTATnBoLyNxX UWLvDTaEiQ1VCALDbGyaj2HDo1W3UemwcJx5msNNLQBWxEddeBbK2JPtuixEyXH2Oe3i 1hcebjvjpkfGA5+PUcYuNtIktsK46I91sO73b+EaX06qaxPgkBrlJepc6tYwtMqjQx9y oIy0wJBDhhi/Bkbly3zR0LWiLgjtH66x8QMXbrBjom26wii/VLiAzQvkWqvrPIhNbEfm lQKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mVmjxfABf1IehQUGx9McgzrIKpgjUsO8bg6roK12RaI=; b=GaYjIAWV/27JiXlf9tjzmE/YIThsfENJHz8CnSeqBgrIchDbVPEAC6vD4I/IqO2828 KEmBCSO8RLfktEvPiEp42XQ0Vab6deKnQ/WMqBJDn8ZXESYJoegcSzZVVo70Wxn60tqU 3/sQSP4GUYOd3/j9h9sadFmvyZq5rPBYsZec3I98sxbXqES+3/CTAAs8aIaY5sXf4Yfs Yzf+/a6kqwR3HWK3D57TMi7zCVmDmemRgUWoQ99V/SBos4IcL+OSMx3wMaSvpyZ/hdui DMd3RSsMIec6txAx05hIgJ+wtsHRN/vIRdHQAT4piRikRJb0CmnU+JpmypbTc98zFdJq GuGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xphbUNaO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m22si4121276ejr.463.2021.03.03.06.07.01; Wed, 03 Mar 2021 06:07:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xphbUNaO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243466AbhCAUaM (ORCPT + 99 others); Mon, 1 Mar 2021 15:30:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:35316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237077AbhCARGv (ORCPT ); Mon, 1 Mar 2021 12:06:51 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 27B3564DE5; Mon, 1 Mar 2021 16:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614616831; bh=hakvJ8htAmjsi2o0vJ+3ZQFomtNyR+XAhxeZdkw5i0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xphbUNaOlU9qegmQnfvnw31FAexNPhTPikzh/hR9/lfFWeWz5IOsyelEgR/34Bs8F hbcpTkGSBrVCgBux/vtHywKWEsWsewGscAeNgFbJv71pEalCFkk63bxTgK4fPBPVx9 mJjW3c3LBNb8qRoZxF3GMGQiyxADSiN4egp7fHWk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pratyush Yadav , Mark Brown , Sasha Levin Subject: [PATCH 4.19 110/247] spi: cadence-quadspi: Abort read if dummy cycles required are too many Date: Mon, 1 Mar 2021 17:12:10 +0100 Message-Id: <20210301161037.055643852@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pratyush Yadav [ Upstream commit ceeda328edeeeeac7579e9dbf0610785a3b83d39 ] The controller can only support up to 31 dummy cycles. If the command requires more it falls back to using 31. This command is likely to fail because the correct number of cycles are not waited upon. Rather than silently issuing an incorrect command, fail loudly so the caller can get a chance to find out the command can't be supported by the controller. Fixes: 140623410536 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller") Signed-off-by: Pratyush Yadav Link: https://lore.kernel.org/r/20201222184425.7028-3-p.yadav@ti.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/mtd/spi-nor/cadence-quadspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c index 04cedd3a2bf66..a92f531ad23a3 100644 --- a/drivers/mtd/spi-nor/cadence-quadspi.c +++ b/drivers/mtd/spi-nor/cadence-quadspi.c @@ -473,7 +473,7 @@ static int cqspi_read_setup(struct spi_nor *nor) /* Setup dummy clock cycles */ dummy_clk = nor->read_dummy; if (dummy_clk > CQSPI_DUMMY_CLKS_MAX) - dummy_clk = CQSPI_DUMMY_CLKS_MAX; + return -EOPNOTSUPP; if (dummy_clk / 8) { reg |= (1 << CQSPI_REG_RD_INSTR_MODE_EN_LSB); -- 2.27.0