linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: Jaime Liao <jaimeliao.tw@gmail.com>,
	linux-mtd@lists.infradead.org, pratyush@kernel.org,
	michael@walle.cc, miquel.raynal@bootlin.com
Cc: leoyu@mxic.com.tw, jaimeliao@mxic.com.tw
Subject: Re: [PATCH v4 4/6] spi: spi-mem: Allow specifying the byte order in DTR mode
Date: Wed, 20 Sep 2023 15:47:46 +0300	[thread overview]
Message-ID: <c5f7072e-d723-7c02-c37f-51ad0ace59e5@linaro.org> (raw)
In-Reply-To: <20230908064304.27757-5-jaimeliao.tw@gmail.com>



On 08.09.2023 09:43, Jaime Liao wrote:
> From: JaimeLiao <jaimeliao@mxic.com.tw>
> 
> There are NOR flashes (Macronix) that swap the bytes on a 16-bit
> boundary when configured in Octal DTR mode. The byte order of
> 16-bit words is swapped when read or written in Octal Double
> Transfer Rate (DTR) mode compared to Single Transfer Rate (STR)
> modes. 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. So we must swap the bytes
> back to have the same byte order as in STR modes. Fortunately there
> are controllers that could swap the bytes back at runtime,
> addressing the flash's endiannesses requirements. Provide a way for
> the upper layers to specify the byte order in Octal DTR mode.
> 

Jaime,

would you please remind me how this works? Does these flashes always
swap the bytes? Is there a flash configuration register where you can
specify whether to swap the bytes or not?

If it's not configurable I'm thinking of introducing a hook that allows
flashes to program the spi controller to swap the bytes and if the spi
controller does not support byte swapping, to just return an error and
fallback to 8-8-8/1-1-1 mode. We can't break the bootchain.

Cheers,
ta

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

  reply	other threads:[~2023-09-20 12:48 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08  6:42 [PATCH v4 0/6] Add octal DTR support for Macronix flash Jaime Liao
2023-09-08  6:42 ` [PATCH v4 1/6] mtd: spi-nor: Add manufacturer read id function Jaime Liao
2023-09-20 12:28   ` Tudor Ambarus
2023-10-05 11:02     ` Pratyush Yadav
2023-10-05 11:43       ` Michael Walle
     [not found]         ` <54e5662f-baf4-4660-9fc4-7959d2405120@linaro.org>
     [not found]           ` <29bb3d952b9f49961da5e01cf86f9c4f@walle.cc>
2023-10-05 14:11             ` Tudor Ambarus
2023-10-06  8:22               ` Michael Walle
2023-10-12  8:59                 ` liao jaime
2023-10-12  9:09                   ` Michael Walle
2023-10-12  9:50                     ` liao jaime
2023-10-13  8:06                       ` Michael Walle
2023-10-13  8:23                         ` liao jaime
2023-10-13  9:04                           ` Michael Walle
2023-10-13  9:14                             ` liao jaime
2023-10-13  9:32                               ` Michael Walle
2023-10-17 10:12                             ` Pratyush Yadav
2023-09-08  6:43 ` [PATCH v4 2/6] mtd: spi-nor: add Octal DTR support for Macronix flash Jaime Liao
2023-09-20 12:37   ` Tudor Ambarus
2023-10-05 10:18     ` Pratyush Yadav
2023-09-08  6:43 ` [PATCH v4 3/6] mtd: spi-nor: add support for Macronix Octal flash Jaime Liao
2023-09-20 12:41   ` Tudor Ambarus
2023-10-12  9:10     ` liao jaime
2023-09-08  6:43 ` [PATCH v4 4/6] spi: spi-mem: Allow specifying the byte order in DTR mode Jaime Liao
2023-09-20 12:47   ` Tudor Ambarus [this message]
2023-09-08  6:43 ` [PATCH v4 5/6] mtd: spi-nor: core: " Jaime Liao
2023-09-20 12:51   ` Tudor Ambarus
2023-09-08  6:43 ` [PATCH v4 6/6] mtd: spi-nor: sfdp: Get the 8D-8D-8D byte order from BFPT Jaime Liao
2023-09-20 12:52   ` 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=c5f7072e-d723-7c02-c37f-51ad0ace59e5@linaro.org \
    --to=tudor.ambarus@linaro.org \
    --cc=jaimeliao.tw@gmail.com \
    --cc=jaimeliao@mxic.com.tw \
    --cc=leoyu@mxic.com.tw \
    --cc=linux-mtd@lists.infradead.org \
    --cc=michael@walle.cc \
    --cc=miquel.raynal@bootlin.com \
    --cc=pratyush@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).