Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp774634pxp; Fri, 11 Mar 2022 14:48:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyH/1RoNZDhVfNmme6ZF2AUQSd69BAczd0Iew2JZllYiTu0R+Eyh9RInSqkqxHEB6RXHk+C X-Received: by 2002:a17:90a:ab08:b0:1b9:c59:82c3 with SMTP id m8-20020a17090aab0800b001b90c5982c3mr23839278pjq.95.1647038898869; Fri, 11 Mar 2022 14:48:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647038898; cv=none; d=google.com; s=arc-20160816; b=lPPfwWFRs42N+u0jm2C2k96RDrXnjfNdFzOeGRFsvtVGUHsJaKzXtzn6G+v6k6RcyA KeLNAxwFL9OELqh1/NW7I1oI7mtAFmL1rUfeT09KaUrOSg7839ClxAtqo+Swt3IajCQL nO14COwYVBVubHQkrwePhE6M8dvA7bpdofp5vWFMabtFewxD4D7L2wsoxgBJgZI2LlQC FYj0wC6Hora349Dki2MnKSIwfv4Po1dfq6ZmLZN/DNk8BUMh3HDGUL/1z74jFCvaWf4a MYovpNVyp3MwPM65rOQl4tf/hHY4TItJeXOtlixDuX1RcccaVUR6hzR0a2w201Y2dtSH gVxg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LWMhRE9d4TtmTlGjSbje2N2xRbgwASQXzExrDkkv6BQ=; b=qlmyXKuCAg2VxN3zHkkidVskxrvKiEnw6vRDFtEzXyerNK3KrDHIVnLB0hbL3BQr5n Ja6R3bu9DwKkrCiUXcWjCeibZRPMEn5lsvauESHcrkpAbdlnuWWW2j4axhvR/S3sC4Qo JaCKE22rKdToRbeqresK45nzgSjUOo1rPhllmobAqyTCPzLGCPApdzGAgSzWpoNNcqnC gp40TqaxUehKcFc8r++wQGJ0WdOHS3KSJ5QkuB6RU+1VChn40qtEjS91H05qp9Na1XVm DWmqG338IyBkGjbj2CXA+e6UWSuqJrpJhihvuSuxdMOSbKyunSfn2wPk4wKab7lZeIDt 7CgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=Ie1hkb1z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id v9-20020a170902e8c900b0014da7608dacsi9679957plg.618.2022.03.11.14.48.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 14:48:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=Ie1hkb1z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 11F52311790; Fri, 11 Mar 2022 13:48:09 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347325AbiCKIDJ (ORCPT + 99 others); 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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); } -- 2.25.1