All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tudor Ambarus <tudor.ambarus@microchip.com>
To: <p.yadav@ti.com>, <michael@walle.cc>, <broonie@kernel.org>
Cc: <miquel.raynal@bootlin.com>, <richard@nod.at>, <vigneshr@ti.com>,
	<linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	<linux-spi@vger.kernel.org>, <nicolas.ferre@microchip.com>,
	<zhengxunli@mxic.com.tw>, <jaimeliao@mxic.com.tw>,
	Tudor Ambarus <tudor.ambarus@microchip.com>
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	[thread overview]
Message-ID: <20220218145900.1440045-4-tudor.ambarus@microchip.com> (raw)
In-Reply-To: <20220218145900.1440045-1-tudor.ambarus@microchip.com>

Parse BFPT in order to retrieve the byte order in 8D-8D-8D mode.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 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


WARNING: multiple messages have this Message-ID (diff)
From: Tudor Ambarus <tudor.ambarus@microchip.com>
To: <p.yadav@ti.com>, <michael@walle.cc>, <broonie@kernel.org>
Cc: <miquel.raynal@bootlin.com>, <richard@nod.at>, <vigneshr@ti.com>,
	<linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	<linux-spi@vger.kernel.org>, <nicolas.ferre@microchip.com>,
	<zhengxunli@mxic.com.tw>, <jaimeliao@mxic.com.tw>,
	Tudor Ambarus <tudor.ambarus@microchip.com>
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	[thread overview]
Message-ID: <20220218145900.1440045-4-tudor.ambarus@microchip.com> (raw)
In-Reply-To: <20220218145900.1440045-1-tudor.ambarus@microchip.com>

Parse BFPT in order to retrieve the byte order in 8D-8D-8D mode.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2022-02-18 15:00 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-18 14:58 [PATCH 0/4] spi-mem: Allow specifying the byte order in DTR mode Tudor Ambarus
2022-02-18 14:58 ` Tudor Ambarus
2022-02-18 14:58 ` [PATCH 1/4] spi: " Tudor Ambarus
2022-02-18 14:58   ` Tudor Ambarus
2022-03-02 10:02   ` Pratyush Yadav
2022-03-02 10:02     ` Pratyush Yadav
2022-03-10  5:31     ` Tudor.Ambarus
2022-03-10  5:31       ` Tudor.Ambarus
2022-03-11 17:47       ` Pratyush Yadav
2022-03-11 17:47         ` Pratyush Yadav
2022-02-18 14:58 ` [PATCH 2/4] mtd: spi-nor: core: " Tudor Ambarus
2022-02-18 14:58   ` Tudor Ambarus
2022-02-21  7:36   ` Michael Walle
2022-02-21  7:36     ` Michael Walle
2022-02-22 14:02     ` Tudor.Ambarus
2022-02-22 14:02       ` Tudor.Ambarus
2022-02-22 14:23       ` Michael Walle
2022-02-22 14:23         ` Michael Walle
2022-03-02 11:34   ` Pratyush Yadav
2022-03-02 11:34     ` Pratyush Yadav
2022-03-10  8:54     ` Tudor.Ambarus
2022-03-10  8:54       ` Tudor.Ambarus
2022-02-18 14:58 ` Tudor Ambarus [this message]
2022-02-18 14:58   ` [PATCH 3/4] mtd: spi-nor: sfdp: Get the 8D-8D-8D byte order from BFPT Tudor Ambarus
2022-02-21  7:40   ` Michael Walle
2022-02-21  7:40     ` Michael Walle
2022-03-02 12:28   ` Pratyush Yadav
2022-03-02 12:28     ` Pratyush Yadav
2022-02-18 14:59 ` [PATCH 4/4] mtd: spi-nor: core: Introduce SPI_NOR_DTR_BSWAP16 no_sfdp_flag Tudor Ambarus
2022-02-18 14:59   ` Tudor Ambarus
2022-02-21  7:41   ` Michael Walle
2022-02-21  7:41     ` Michael Walle
2022-03-02 12:30   ` Pratyush Yadav
2022-03-02 12:30     ` Pratyush Yadav
2022-03-10  4:42     ` Tudor.Ambarus
2022-03-10  4:42       ` Tudor.Ambarus
2022-02-21  7:44 ` [PATCH 0/4] spi-mem: Allow specifying the byte order in DTR mode Michael Walle
2022-02-21  7:44   ` Michael Walle
2022-02-22 13:54   ` Tudor.Ambarus
2022-02-22 13:54     ` Tudor.Ambarus
2022-02-22 14:13     ` Michael Walle
2022-02-22 14:13       ` Michael Walle
2022-02-22 14:23       ` Tudor.Ambarus
2022-02-22 14:23         ` Tudor.Ambarus
2022-02-22 14:27         ` Michael Walle
2022-02-22 14:27           ` Michael Walle
2022-02-22 14:43           ` Tudor.Ambarus
2022-02-22 14:43             ` Tudor.Ambarus
2022-02-23 18:38             ` Pratyush Yadav
2022-02-23 18:38               ` Pratyush Yadav
2022-02-24  6:08               ` Tudor.Ambarus
2022-02-24  6:08                 ` Tudor.Ambarus
2022-02-24  6:37                 ` Tudor.Ambarus
2022-02-24  6:37                   ` Tudor.Ambarus
2022-02-24  9:37                   ` Michael Walle
2022-02-24  9:37                     ` Michael Walle
2022-02-24 10:27                     ` Tudor.Ambarus
2022-02-24 10:27                       ` Tudor.Ambarus
2022-02-25  7:35                       ` zhengxunli
2022-02-25  7:35                         ` zhengxunli
2022-02-24 13:24                     ` Pratyush Yadav
2022-02-24 13:24                       ` Pratyush Yadav
2022-02-24 14:02                       ` Michael Walle
2022-02-24 14:02                         ` Michael Walle
2022-02-24 14:33                         ` Tudor.Ambarus
2022-02-24 14:33                           ` Tudor.Ambarus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220218145900.1440045-4-tudor.ambarus@microchip.com \
    --to=tudor.ambarus@microchip.com \
    --cc=broonie@kernel.org \
    --cc=jaimeliao@mxic.com.tw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=michael@walle.cc \
    --cc=miquel.raynal@bootlin.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=p.yadav@ti.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    --cc=zhengxunli@mxic.com.tw \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.