From patchwork Fri Mar 11 08:01:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 12777588 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84883C433FE for ; Fri, 11 Mar 2022 08:02:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347205AbiCKIDJ (ORCPT ); Fri, 11 Mar 2022 03:03:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347291AbiCKIDI (ORCPT ); Fri, 11 Mar 2022 03:03:08 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 181851B757A; Fri, 11 Mar 2022 00:02:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1646985726; x=1678521726; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=03Y0LGNSh4nHd8tHQEheP0sJeffhKkrpkBLfPUYzZUE=; b=Ie1hkb1z/piSbRF0LaBdLuhGHRryQCaAp9qvg7viSwmq/27noFyYtHw/ rxvkm4kTc/ViJ6X0bI6NoJAKzIMjPPGgjitIUg5/3sEQ/gPdqbkFyp4wj yMCI9qI5w5rdsqD+rVAJtiA9PGGh5hlrXkfGdhlO8SsaqFTGubT/U4ZsN 3zCex2TWpXXONlm+jGu1AQIPiU68MJQEh0LC87KLlUOOQcoZaRFMwB833 Z5sjV3jLuEKOPRzvPCFiY+5kdOEIxQcxs+L+PYJIAGPPEspxS09nVKmUX kFhE110iCnlKiOkV+6WoqO3Nx9IEyNYb+Bs+cV68n9HNXsIRHx0qaSEVa A==; X-IronPort-AV: E=Sophos;i="5.90,173,1643698800"; d="scan'208";a="156090485" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 11 Mar 2022 01:02:04 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Fri, 11 Mar 2022 01:02:02 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Fri, 11 Mar 2022 01:01:59 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , Tudor Ambarus Subject: [PATCH v2 3/6] mtd: spi-nor: sfdp: Get the 8D-8D-8D byte order from BFPT Date: Fri, 11 Mar 2022 10:01:44 +0200 Message-ID: <20220311080147.453483-4-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220311080147.453483-1-tudor.ambarus@microchip.com> References: <20220311080147.453483-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Parse BFPT in order to retrieve the byte order in 8D-8D-8D mode. Signed-off-by: Tudor Ambarus Reviewed-by: Michael Walle Reviewed-by: Pratyush Yadav --- drivers/mtd/spi-nor/sfdp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c index f5432cbd3daf..e049851a57a7 100644 --- a/drivers/mtd/spi-nor/sfdp.c +++ b/drivers/mtd/spi-nor/sfdp.c @@ -579,6 +579,7 @@ int spi_nor_set_4byte_addr_mode_wren_en4b_ex4b(struct spi_nor *nor, bool enable) #define BFPT_DWORD18_CMD_EXT_INV (0x1UL << 29) /* Invert */ #define BFPT_DWORD18_CMD_EXT_RES (0x2UL << 29) /* Reserved */ #define BFPT_DWORD18_CMD_EXT_16B (0x3UL << 29) /* 16-bit opcode */ +#define BFPT_DWORD18_BYTE_ORDER_SWAPPED BIT(31) /** * spi_nor_parse_bfpt() - read and parse the Basic Flash Parameter Table. @@ -832,6 +833,9 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor, return -EOPNOTSUPP; } + if (bfpt.dwords[BFPT_DWORD(18)] & BFPT_DWORD18_BYTE_ORDER_SWAPPED) + nor->flags |= SNOR_F_DTR_SWAB16; + return spi_nor_post_bfpt_fixups(nor, bfpt_header, &bfpt); }