public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Takahiro Kuwano <tkuw584924@gmail.com>
To: Pratyush Yadav <pratyush@kernel.org>
Cc: linux-mtd@lists.infradead.org, tudor.ambarus@linaro.org,
	mwalle@kernel.org, miquel.raynal@bootlin.com, richard@nod.at,
	vigneshr@ti.com, Bacem.Daassi@infineon.com,
	Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Subject: Re: [PATCH] mtd: spi-nor: spansion: Use nor->addr_nbytes in octal DTR mode in RD_ANY_REG_OP
Date: Thu, 17 Oct 2024 13:33:05 +0900	[thread overview]
Message-ID: <909a6720-188c-4261-8411-a7d87c746f5b@gmail.com> (raw)
In-Reply-To: <mafs0y12ocl7n.fsf@kernel.org>

Hi Pratyush,

On 10/16/2024 8:59 PM, Pratyush Yadav wrote:
> On Wed, Oct 16 2024, tkuw584924@gmail.com wrote:
> 
>> From: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
>>
>> In octal DTR mode, RD_ANY_REG_OP needs to use 4-byte address regardless
>> of flash's internal address mode. Use nor->addr_nbytes which is set to 4
>> during setup.
> 
> If the flash is in Octal DTR mode, shouldn't addr_mode_nbytes also be 4?
> IIUC addr_mode_nbytes is supposed to track the flash's internal address
> mode. If the flash goes into Octal DTR mode then its internal address
> mode switches to 4, and we should update params->addr_mode_nbytes as
> well. We do that in spi_nor_set_4byte_addr_mode() for example.
> 
The flash's internal address mode is represented by CFR2[7] (ADRBYT) and
addr_mode_nbytes tracks the state of this bit. If the flash goes into Octal
DTR mode, this configuration bit is unchanged and referred after exit from
Octal DTR mode. We need to remember addr_mode_nbytes for MTD suspend/resume
event that exits/enter Octal DTR mode.

> I suppose the best place to do it for Octal DTR would be
> spi_nor_set_octal_dtr().
> 
> Side note: honestly, this whole thing with params->addr_nbytes,
> params->addr_mode_nbytes, and nor->addr_nbytes is quite confusing. I
> hope to find some time to clean it up some day.
> 
Agree. This is because flash's behavior itself is confusing:(

>>
>> Fixes: eff9604390d6 ("mtd: spi-nor: spansion: add octal DTR support in RD_ANY_REG_OP")
>> Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
>> ---
>>  drivers/mtd/spi-nor/spansion.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c
>> index d6c92595f6bc..5a88a6096ca8 100644
>> --- a/drivers/mtd/spi-nor/spansion.c
>> +++ b/drivers/mtd/spi-nor/spansion.c
>> @@ -106,6 +106,7 @@ static int cypress_nor_sr_ready_and_clear_reg(struct spi_nor *nor, u64 addr)
>>  	int ret;
>>  
>>  	if (nor->reg_proto == SNOR_PROTO_8_8_8_DTR) {
>> +		op.addr.nbytes = nor->addr_nbytes;
>>  		op.dummy.nbytes = params->rdsr_dummy;
>>  		op.data.nbytes = 2;
>>  	}
> 

Thanks,
Takahiro


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

  parent reply	other threads:[~2024-10-17  4:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16  0:08 [PATCH] mtd: spi-nor: spansion: Use nor->addr_nbytes in octal DTR mode in RD_ANY_REG_OP tkuw584924
2024-10-16 11:59 ` Pratyush Yadav
2024-10-16 12:39   ` Miquel Raynal
2024-10-16 16:31     ` Pratyush Yadav
2024-10-17  4:33   ` Takahiro Kuwano [this message]
2024-10-29  9:07 ` 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=909a6720-188c-4261-8411-a7d87c746f5b@gmail.com \
    --to=tkuw584924@gmail.com \
    --cc=Bacem.Daassi@infineon.com \
    --cc=Takahiro.Kuwano@infineon.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=mwalle@kernel.org \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=tudor.ambarus@linaro.org \
    --cc=vigneshr@ti.com \
    /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