[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220218145900.1440045-1-tudor.ambarus@microchip.com>
Date: Fri, 18 Feb 2022 16:58:56 +0200
From: Tudor Ambarus <tudor.ambarus@...rochip.com>
To: <p.yadav@...com>, <michael@...le.cc>, <broonie@...nel.org>
CC: <miquel.raynal@...tlin.com>, <richard@....at>, <vigneshr@...com>,
<linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<linux-spi@...r.kernel.org>, <nicolas.ferre@...rochip.com>,
<zhengxunli@...c.com.tw>, <jaimeliao@...c.com.tw>,
Tudor Ambarus <tudor.ambarus@...rochip.com>
Subject: [PATCH 0/4] spi-mem: Allow specifying the byte order in DTR mode
There are NOR flashes (Macronix) that swap the bytes on a 16-bit boundary
when configured in DTR mode. The byte order of 16-bit words is swapped
when read or written in Double Transfer Rate (DTR) mode compared to
Single Transfer Rate (STR) mode. If one writes D0 D1 D2 D3 bytes using
1-1-1 mode, and uses 8D-8D-8D SPI mode for reading, it will read back
D1 D0 D3 D2. Swapping the bytes may introduce some endianness problems.
It can affect the boot sequence if the entire boot sequence is not handled
in either 8D-8D-8D mode or 1-1-1 mode. Fortunately there are controllers
that can swap back the bytes at runtime, fixing the endiannesses. Provide
a way for the upper layers to specify the byte order in DTR mode.
Tested with atmel-quadspi and mx66lm1g45g.
Tudor Ambarus (4):
spi: spi-mem: Allow specifying the byte order in DTR mode
mtd: spi-nor: core: Allow specifying the byte order in DTR mode
mtd: spi-nor: sfdp: Get the 8D-8D-8D byte order from BFPT
mtd: spi-nor: core: Introduce SPI_NOR_DTR_BSWAP16 no_sfdp_flag
drivers/mtd/spi-nor/core.c | 36 +++++++++++++++++++++++++++++-------
drivers/mtd/spi-nor/core.h | 6 +++++-
drivers/mtd/spi-nor/sfdp.c | 3 +++
drivers/mtd/spi-nor/sfdp.h | 1 +
include/linux/mtd/spi-nor.h | 17 +++++++++++++++++
include/linux/spi/spi-mem.h | 3 +++
6 files changed, 58 insertions(+), 8 deletions(-)
--
2.25.1
Powered by blists - more mailing lists