Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp59030ybz; Fri, 24 Apr 2020 11:46:46 -0700 (PDT) X-Google-Smtp-Source: APiQypLFIvIU7LfOw9dvWLko6i0C8p7ne1hhy36EGKgpyPSDxf/1r77iBCOyfSNNMuPt4+l5VFs8 X-Received: by 2002:aa7:d311:: with SMTP id p17mr8846877edq.73.1587754006798; Fri, 24 Apr 2020 11:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587754006; cv=none; d=google.com; s=arc-20160816; b=gOhTxZTRo6Bv0iujoSWbh6Rq1HWAshW5GGgqRH2r1nlU9jx+JMCqzwGRELyzc/mHje yKpjlEfBWeIYmX13hHXo9xDoHF0fglKajzmrtE2u/NHPOZMGpJ+uNnWR94bp2I6VstMz AkQT2V1wp/APRXoq9gIYGSUQh0l8qYZrRCYKiF9mLZf3msvDXAWZxfBLW9b973fiJD4e rirupuxwMRH7BlF2/LCFKSP5V4+IpGCTmgAuhm/PX1visl0z+yPfOCS/H01vVzWqrYjd 4klHNvsu70worGJn37OUsT0571hYt/6MIlsenRgYF+Y9lCc/qvM7kcshyUN16ZRch5ZI OTIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AmgJS/+Rj4TLh0nHUX1yf4w64mP27rFO9sqoBW7OysQ=; b=yueUyO82/Ef1DHeUISXPge5JjRPk6kYZFdqToyNBV3Rsy7I+PtYatOYT7IW6oIcug+ 8c1Ig8hc2fBNlvcO31+AtAcv7WdTjlLnIprwFb6DYgD1yRiQeveByYELZmkP+fAJfkNm FoiUdtCvmFJ0WE8SO8jitB+DDEiR7xX14mcK70pkkYjB4VbNDqGa6kaXWy4zEeWDQccO sBHCDG/SyWcvvu9pvhjyb2KTNr5fpjyRCGMA656yiyqGv7RTCUvj9CfuSQEPES/F+zKi P45PJnuxqYDv0vXrtaCzOh30f52hbL5Q8WDBpJ6uBSpniZckv8X1rrfc/q/MlTzzUPam UKrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=TMJ9DwhX; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m29si3631681eda.592.2020.04.24.11.46.23; Fri, 24 Apr 2020 11:46:46 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=TMJ9DwhX; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729295AbgDXSo4 (ORCPT + 99 others); Fri, 24 Apr 2020 14:44:56 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:47774 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729228AbgDXSoy (ORCPT ); Fri, 24 Apr 2020 14:44:54 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 03OIiZdf022849; Fri, 24 Apr 2020 13:44:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1587753875; bh=AmgJS/+Rj4TLh0nHUX1yf4w64mP27rFO9sqoBW7OysQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=TMJ9DwhXDAwf3f776IHVMxe4+fFbxtYbkYG/s3LPNE6lLALGRi9jo8ch04UbMTwHz i0M1zHNKUapwEN/ujI5vCSE06iVXVy4ymT2JvyeqXBsPJvAhg5GNTrdtlJg+UGOGfe sQ565P89YPMJH8okePFT7JZ0B5jSEit2Y3Mv3H8c= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 03OIiZKq021045 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 24 Apr 2020 13:44:35 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 24 Apr 2020 13:44:35 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Fri, 24 Apr 2020 13:44:35 -0500 Received: from pratyush-OptiPlex-790.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 03OIiAaB047967; Fri, 24 Apr 2020 13:44:31 -0500 From: Pratyush Yadav To: Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Mark Brown , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , , , , CC: Pratyush Yadav , Sekhar Nori Subject: [PATCH v4 05/16] mtd: spi-nor: default to address width of 3 for configurable widths Date: Sat, 25 Apr 2020 00:13:59 +0530 Message-ID: <20200424184410.8578-6-p.yadav@ti.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200424184410.8578-1-p.yadav@ti.com> References: <20200424184410.8578-1-p.yadav@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org JESD216D.01 says that when the address width can be 3 or 4, it defaults to 3 and enters 4-byte mode when given the appropriate command. So, when we see a configurable width, default to 3 and let flash that default to 4 change it in a post-bfpt fixup. This fixes SMPT parsing for flashes with configurable address width. If the SMPT descriptor advertises variable address width, we use nor->addr_width as the address width. But since it was not set to any value from the SFDP table, the read command uses an address width of 0, resulting in an incorrect read being issued. Signed-off-by: Pratyush Yadav --- drivers/mtd/spi-nor/sfdp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c index f917631c8110..5cecc4ba2141 100644 --- a/drivers/mtd/spi-nor/sfdp.c +++ b/drivers/mtd/spi-nor/sfdp.c @@ -460,6 +460,7 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor, /* Number of address bytes. */ switch (bfpt.dwords[BFPT_DWORD(1)] & BFPT_DWORD1_ADDRESS_BYTES_MASK) { case BFPT_DWORD1_ADDRESS_BYTES_3_ONLY: + case BFPT_DWORD1_ADDRESS_BYTES_3_OR_4: nor->addr_width = 3; break; -- 2.25.0