linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: <Tudor.Ambarus@microchip.com>
To: <p.yadav@ti.com>
Cc: macromorgan@hotmail.com, vigneshr@ti.com, jaimeliao@mxic.com.tw,
	richard@nod.at, esben@geanix.com, linux@rasmusvillemoes.dk,
	knaerzche@gmail.com, Nicolas.Ferre@microchip.com,
	michael@walle.cc, linux-mtd@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, code@reto-schneider.ch,
	miquel.raynal@bootlin.com, heiko.thiery@gmail.com, sr@denx.de,
	mail@david-bauer.net, zhengxunli@mxic.com.tw
Subject: Re: [PATCH v4 01/13] mtd: spi-nor: core: Don't use mtd_info in the NOR's probe sequence of calls
Date: Fri, 3 Dec 2021 12:03:10 +0000	[thread overview]
Message-ID: <944be3b4-2560-49f7-c574-a50f1cbf2b2d@microchip.com> (raw)
In-Reply-To: <20211130095624.wrnn67ajd3egjpwo@ti.com>

On 11/30/21 11:56 AM, Pratyush Yadav wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 22/11/21 11:50AM, Tudor Ambarus wrote:
>> Use NOR parameters in the probe's sequence of calls, thus
>> nor->params->size instead of nor->mtd.size and let the mtd_info
>> fields be used by the mtd calls (mtd->_erase, mtd->_read, mtd->_write).
>> mtd_info fields should not be used during probe because we haven't
>> registered mtd yet.
> 
> These changes look good to me, but there is one thing this seems to be
> missing. In xlinx.c, I see that xilinx_setup() sets nor->mtd.size. I
> think it should be updated to set nor->params->size instead otherwise

thanks, you're correct. But I should better do it as a separate patch
that fixes:
Fixes: 641edddb4f43 ("mtd: spi-nor: Add s3an_post_sfdp_fixups()")
because mtd->size is overwritten in that patch with
mtd->size = params->size;
while it should have kept its s3an specific value.

Will respin the entire series with this change as the first patch.

> functions like spi_nor_set_addr_width() might end up using the wrong
> value.
> 
>>
>> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> 
>> ---
>> v4: new patch
>>
>>  drivers/mtd/spi-nor/core.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
>> index 88dd0908d172..5b9c827d411c 100644
>> --- a/drivers/mtd/spi-nor/core.c
>> +++ b/drivers/mtd/spi-nor/core.c
>> @@ -2115,7 +2115,7 @@ static int spi_nor_spimem_check_op(struct spi_nor *nor,
>>        */
>>       op->addr.nbytes = 4;
>>       if (!spi_mem_supports_op(nor->spimem, op)) {
>> -             if (nor->mtd.size > SZ_16M)
>> +             if (nor->params->size > SZ_16M)
>>                       return -EOPNOTSUPP;
>>
>>               /* If flash size <= 16MB, 3 address bytes are sufficient */
>> @@ -3011,7 +3011,7 @@ static int spi_nor_set_addr_width(struct spi_nor *nor)
>>               nor->addr_width = 3;
>>       }
>>
>> -     if (nor->addr_width == 3 && nor->mtd.size > 0x1000000) {
>> +     if (nor->addr_width == 3 && nor->params->size > 0x1000000) {
>>               /* enable 4-byte addressing if the device exceeds 16MiB */
>>               nor->addr_width = 4;
>>       }
>> @@ -3245,7 +3245,7 @@ static int spi_nor_create_read_dirmap(struct spi_nor *nor)
>>                                     SPI_MEM_OP_DUMMY(nor->read_dummy, 0),
>>                                     SPI_MEM_OP_DATA_IN(0, NULL, 0)),
>>               .offset = 0,
>> -             .length = nor->mtd.size,
>> +             .length = nor->params->size,
>>       };
>>       struct spi_mem_op *op = &info.op_tmpl;
>>
>> @@ -3276,7 +3276,7 @@ static int spi_nor_create_write_dirmap(struct spi_nor *nor)
>>                                     SPI_MEM_OP_NO_DUMMY,
>>                                     SPI_MEM_OP_DATA_OUT(0, NULL, 0)),
>>               .offset = 0,
>> -             .length = nor->mtd.size,
>> +             .length = nor->params->size,
>>       };
>>       struct spi_mem_op *op = &info.op_tmpl;
>>
>> --
>> 2.25.1
>>
> 
> --
> Regards,
> Pratyush Yadav
> Texas Instruments Inc.
> 

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

  reply	other threads:[~2021-12-03 12:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22  9:50 [PATCH v4 00/13] mtd: spi-nor: Clean params init Tudor Ambarus
2021-11-22  9:50 ` [PATCH v4 01/13] mtd: spi-nor: core: Don't use mtd_info in the NOR's probe sequence of calls Tudor Ambarus
2021-11-22 18:28   ` Michael Walle
2021-11-30  9:56   ` Pratyush Yadav
2021-12-03 12:03     ` Tudor.Ambarus [this message]
2021-11-22  9:50 ` [PATCH v4 02/13] mtd: spi-nor: Introduce spi_nor_set_mtd_info() Tudor Ambarus
2021-12-02  9:19   ` Pratyush Yadav
2021-12-03 12:03     ` Tudor.Ambarus
2021-11-22  9:50 ` [PATCH v4 03/13] mtd: spi-nor: core: Call spi_nor_post_sfdp_fixups() only when SFDP is defined Tudor Ambarus
2021-12-02  9:31   ` Pratyush Yadav
2021-11-22  9:50 ` [PATCH v4 04/13] mtd: spi-nor: core: Introduce flash_info mfr_flags Tudor Ambarus
2021-11-22 18:34   ` Michael Walle
2021-11-23  6:43     ` Tudor.Ambarus
2021-12-02  9:32   ` Pratyush Yadav
2021-11-22  9:50 ` [PATCH v4 05/13] mtd: spi-nor: Rework the flash_info flags Tudor Ambarus
2021-12-02 10:01   ` Pratyush Yadav
2021-11-22  9:50 ` [PATCH v4 06/13] mtd: spi-nor: Introduce spi_nor_init_flags() Tudor Ambarus
2021-11-22  9:50 ` [PATCH v4 07/13] mtd: spi-nor: Introduce spi_nor_init_fixup_flags() Tudor Ambarus
2021-11-22  9:50 ` [PATCH v4 08/13] mtd: spi-nor: core: Init all flash parameters based on SFDP where possible Tudor Ambarus
2021-11-22  9:50 ` [PATCH v4 09/13] mtd: spi-nor: core: Move spi_nor_set_addr_width() in spi_nor_setup() Tudor Ambarus
2021-11-22  9:50 ` [PATCH v4 10/13] mtd: spi-nor: winbond: w25q256jvm: Init flash based on SFDP Tudor Ambarus
2021-11-22  9:50 ` [PATCH v4 11/13] mtd: spi-nor: spansion: s25fl256s0: Skip SFDP parsing Tudor Ambarus
2021-11-22  9:50 ` [PATCH v4 12/13] mtd: spi-nor: gigadevice: gd25q256: Init flash based on SFDP Tudor Ambarus
2021-11-22 18:19   ` Michael Walle
2021-11-22  9:50 ` [PATCH v4 13/13] mtd: spi-nor: issi: is25lp256: " 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=944be3b4-2560-49f7-c574-a50f1cbf2b2d@microchip.com \
    --to=tudor.ambarus@microchip.com \
    --cc=Nicolas.Ferre@microchip.com \
    --cc=code@reto-schneider.ch \
    --cc=esben@geanix.com \
    --cc=heiko.thiery@gmail.com \
    --cc=jaimeliao@mxic.com.tw \
    --cc=knaerzche@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=macromorgan@hotmail.com \
    --cc=mail@david-bauer.net \
    --cc=michael@walle.cc \
    --cc=miquel.raynal@bootlin.com \
    --cc=p.yadav@ti.com \
    --cc=richard@nod.at \
    --cc=sr@denx.de \
    --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 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).