Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3554539ybk; Tue, 19 May 2020 07:29:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJ+8q1poyE4Yzt1KuJj9f81jZA8tBB6o+KZlzah8NnDe2l4SoVrBOkR/M+shwYYjtRZ/EY X-Received: by 2002:a17:906:f8d6:: with SMTP id lh22mr15412486ejb.132.1589898590652; Tue, 19 May 2020 07:29:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589898590; cv=none; d=google.com; s=arc-20160816; b=OtQxxJq4tn36gn84P5dh4nwWCckfX2TxACOHXw7xzUmSE++Zw0G3/s+i51mrG1l0F6 DxDej3Xw5JvqOq4PmLfODBQOnLrXtU3IsryAyJGJkqBX8r4vF6SU9Zm2OW47K8sMO2q1 yJ5+skL/aiObmDFjHSU3y1mx6gYxLJn2SFNrpdC+VtPOKFU55WpVLKN/Ha3jzPOzWTmI jf7osMlsG1U3vUNVE9BMJiuZo112lA+dzazWyKiB7rSHUTcFbYJ0PToZWZ0Cq4tdmfF2 NVsQjSNgFi+MGj7UMeiV4ltsKNtvT9OuWe5eFTG328DHLLruHJjaKMzw0JIWo8Ft6ijw xjfg== 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=qVEI4YqSpinXJJzMIo4+Ch+rlZfak9t3wtHZTvSLa/Y=; b=wT0TdbP0rGgsOMFyB4q1yFZqQ8ooEMb0+3WkoyAbkn5to/Qm78+QCjozSv1Ai0ENDO xG0L+878Jj6lc1oaaAqKLCzTD5Gzyl1FlBvE0Rb1jm/waiQsy8e2jHVBPobKG2zfkZmi dKkJcY/gpthgAtd8NwHUkgQabDTEFmfUO6XbLPGQ8UjQ43EaagepwNMLzCSsHSvw2rzM 0Emd933iy6x4i6bf/UcI6keWV8jWUMt1lW65qje474GRoezii88+cZzARHefKvPuP65a ZTVZ3oPJwGfU1Z6NIMK0ohPTvWIb8IqroU0FL7tMePLwkejDPmaltsreMmsSBtcEwnKz K3zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=OjLKvawv; 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 r17si8640494edl.11.2020.05.19.07.29.26; Tue, 19 May 2020 07:29:50 -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=OjLKvawv; 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 S1729160AbgESO1f (ORCPT + 99 others); Tue, 19 May 2020 10:27:35 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:36810 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728953AbgESO1b (ORCPT ); Tue, 19 May 2020 10:27:31 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 04JERIAr062629; Tue, 19 May 2020 09:27:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1589898438; bh=qVEI4YqSpinXJJzMIo4+Ch+rlZfak9t3wtHZTvSLa/Y=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=OjLKvawvpVSpCjuqsvlu97PyFMEsc9kEL+6lqoyTyPNDolhXceevYwwv7GSIzP8c2 fXRqcsM9s5HYeKxsjO3S7wvrqDLNx2gh7+BIWiggiMQisO9f0JxTAIcgNHqr2RXDth ArNVJ+m5uIv1U8XgjzKnI6rV5A/Lqmn625uJR1Ns= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 04JERIJv069589 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 19 May 2020 09:27:18 -0500 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 19 May 2020 09:27:18 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE102.ent.ti.com (157.170.170.32) 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; Tue, 19 May 2020 09:27:18 -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 04JEQgjO008313; Tue, 19 May 2020 09:27:13 -0500 From: Pratyush Yadav To: Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Mark Brown , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , Matthias Brugger , , , , , CC: Pratyush Yadav , Sekhar Nori , Boris Brezillon , Mason Yang Subject: [PATCH v5 06/19] mtd: spi-nor: sfdp: default to addr_width of 3 for configurable widths Date: Tue, 19 May 2020 19:56:28 +0530 Message-ID: <20200519142642.24131-7-p.yadav@ti.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200519142642.24131-1-p.yadav@ti.com> References: <20200519142642.24131-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.26.2