Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1439816pxb; Fri, 18 Feb 2022 07:50:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxLzd2biMrqAZRzPoF/OUyiG2F5mjVp24P43Y15vs5DUzlGckFKo42R1VUu6M2X6IEtXKiG X-Received: by 2002:a17:902:be10:b0:14d:66b5:7065 with SMTP id r16-20020a170902be1000b0014d66b57065mr7953024pls.81.1645199455806; Fri, 18 Feb 2022 07:50:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645199455; cv=none; d=google.com; s=arc-20160816; b=CFoL8rDYQL27OnFz0ray++NhT+HLk1yJPqZqZBsvjauPHNqHOFsWVwBXJEI7CzeSy4 P1tnl0c3QP+ctYl5Slc1/kQ8Qa3gEYsby7XfOPISr3AEVkJRtcCem13tj2/WLld7qgnI 8OoCrcQRaz1n5Pn2yB7/yjjw9d5eSZ7pALMRTs5VmFoRdoZJjOCtiaQgaBPfWt70TGp9 QAbXEhb+VXpGISan/5ilWvtgUp0apXObqlYtybDPwKuYp9pL97qUKCT+OY6RL2iE2Q0W 8bHnIVLGQR6pUx68VeSCbVvj0w7kRiHGa+09HL+ValJinYEyX0pHjVI6ilHkGL+TxbjC LjWQ== 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=i1Yv7QshivaarmDsIkqR8UTusNCndVfjLy2PX7thDCM=; b=Y1oZm68tb3YoM3iY4ZCaj4rYScIvu9RDApGrsabIwUzahkGIjiF+1V+FJoZWTxuk/j hzQZ1wcFpxt7ini2cIucRDEMSOHfZfc6W6PegtDR6oRf9jVyKE7tU7uSzsHfHEafGCCs VxJT06BSc6u4lm+OFPgmQX2W67G6wmTPJ6Q2ZJP7AAF/WXiwAowqRlKPMJcOySLojqjW 97eNXx+5g0OzCJgs/U28FL2d4Fk3zV5rmjU6q5UckaLTNBs5BvfBooBAPcsDOl6lIrqU m9rchrOBZF3IMzyX+vV1YEyNxM600eQRBN5Vkzx3skZQzklB+QK78VnQ5k+YKc6gdIWj 7lMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=TuFOwg6Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d23si1485311pgg.461.2022.02.18.07.50.33; Fri, 18 Feb 2022 07:50:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=TuFOwg6Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236583AbiBRPAi (ORCPT + 99 others); Fri, 18 Feb 2022 10:00:38 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236810AbiBRPAZ (ORCPT ); Fri, 18 Feb 2022 10:00:25 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E9E7EAC9D; Fri, 18 Feb 2022 06:59:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1645196356; x=1676732356; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dvWZ47n0i84WPBOUsd+UoD28E/hVOOwEq0Yuclt9AKY=; b=TuFOwg6Zpb93noGrQfMVsMZ9qYh6ckkFNf8NJD4KrGWmpCqeZv6tcKJ1 aIbc5xDBZmB6qx8NbvV1EqscVKrrIssqzY2k15Fej0A4TSiUzHiHnWIav rysWvJnb+QDAYMDtCTPJih3T1/ssX15nL42pLCATzb4XRxqauFW1tlk3y SPWOGJSY+iHigp3ehhyHFmDYo2WtmBRvfZ13muZJyBUS0JCJKVFKp5amn ABWV7+vpn6sXDG85IjFyc1ktX07EUceYu5JQkETwXxF0vvnYRrcyweike DAqJb7BxMiHmYhiFIAI6b50AQLuSGz3REbchPoAMu5o6e3xlAqF0hPnKB w==; X-IronPort-AV: E=Sophos;i="5.88,379,1635231600"; d="scan'208";a="153582936" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 18 Feb 2022 07:59:16 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Fri, 18 Feb 2022 07:59:15 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Fri, 18 Feb 2022 07:59:12 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , , , Tudor Ambarus Subject: [PATCH 3/4] mtd: spi-nor: sfdp: Get the 8D-8D-8D byte order from BFPT Date: Fri, 18 Feb 2022 16:58:59 +0200 Message-ID: <20220218145900.1440045-4-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220218145900.1440045-1-tudor.ambarus@microchip.com> References: <20220218145900.1440045-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 --- drivers/mtd/spi-nor/sfdp.c | 3 +++ drivers/mtd/spi-nor/sfdp.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c index a5211543d30d..551edbb039f0 100644 --- a/drivers/mtd/spi-nor/sfdp.c +++ b/drivers/mtd/spi-nor/sfdp.c @@ -633,6 +633,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_BSWAP16; + return spi_nor_post_bfpt_fixups(nor, bfpt_header, &bfpt); } diff --git a/drivers/mtd/spi-nor/sfdp.h b/drivers/mtd/spi-nor/sfdp.h index bbf80d2990ab..9a834ea31c16 100644 --- a/drivers/mtd/spi-nor/sfdp.h +++ b/drivers/mtd/spi-nor/sfdp.h @@ -97,6 +97,7 @@ struct sfdp_bfpt { #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) struct sfdp_parameter_header { u8 id_lsb; -- 2.25.1