From: Esben Haabendal <esben@geanix.com>
To: Tudor Ambarus <tudor.ambarus@linaro.org>
Cc: Pratyush Yadav <pratyush@kernel.org>,
Michael Walle <mwalle@kernel.org>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use
Date: Thu, 26 Sep 2024 13:35:20 +0200 [thread overview]
Message-ID: <877cayhclj.fsf@geanix.com> (raw)
In-Reply-To: <e079751d-e775-4dec-9959-c9c3fdcc8ecf@linaro.org> (Tudor Ambarus's message of "Thu, 26 Sep 2024 11:08:25 +0100")
Tudor Ambarus <tudor.ambarus@linaro.org> writes:
> Hiya, Esben,
>
> On 7/11/24 2:00 PM, Esben Haabendal wrote:
>> Following up to various discussions, this series have now been
>> modified so that it gets rid of the old deprecated approach
>> for detecting when to do optional SFDP parsing.
>>
>> Before these changes, spi-nor flashes were handled in 4 different
>> ways:
>>
>
> I'm adding a bit of extra context on each point you made. All your
> points contain static init, you missed spi_nor_init_default_params()
I might be even more confused now :) Let me try to understand...
> There's a 0/ case where we have indeed just SFDP initialized flashes,
> and that is the generic flash driver.
>
> 0/ SFDP only, generic flash driver
Ok. So this is when spi_nor_detect() falls back to
spi_nor_generic_flash, right?
>> (1) SFDP only [size==0]
>
> 1/ static + SFDP
So we have found a matching flash_info, and it has size==0. Right?
> spi_nor_init_default_params(nor);
I guess we can assume that flash_info in this case will always have
something set (other than .name and .size=0)?
> spi_nor_parse_sfdp();
>> (2a) static config only [size!=0 && no_sfdp_flags & SPI_NOR_SKIP_SFDP]
>
> 2a/ is
> spi_nor_init_default_params(nor);
> spi_nor_no_sfdp_init_params(nor);
Got it.
>> (2b) static config only
>> [size!=0 &&
>> !(no_sfdp_flags & (SPI_NOR_SKIP_SFDP |
>> SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
>> SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ))]
>
> 2b/ is
> spi_nor_init_default_params(nor);
> spi_nor_init_params_deprecated(nor); //where parse SFDP is not called
> spi_nor_no_sfdp_init_params(nor);
> spi_nor_manufacturer_init_params(nor);>
Got it.
>> (3) SFDP with fallback to static config
>> [size!=0 &&
>> !(no_sfdp_flags & SPI_NOR_SKIP_SFDP) &&
>> (no_sfdp_flags & SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
>> SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ))]
>>
>
> 3/ is 2b/ with parse SFDP called and rollback mechanism
> spi_nor_init_default_params(nor);
> spi_nor_init_params_deprecated(nor);
> spi_nor_no_sfdp_init_params(nor);
> spi_nor_manufacturer_init_params(nor);
> spi_nor_sfdp_init_params_deprecated(nor);
>
> All cases from above are followed by a call to spi_nor_late_init_params().
Got it.
Should I move your annotations to the cover letter? If I find it
helpful, I think it might also be helpful to somebody else :)
>> Cases (2a) and (2b) have been handled slightly different, with
>> manufacturer and flash_info ->default_init() hooks being called in
>> case (2b) but not in case (2a).
>
> default_init() was a mistake and we shall remove it and replace it with
> late_init(). The challenge is to do that without affecting backwards
> compatibility. But let's move this aside for the moment
>>
>> With this series, that is changed to this simpler approach instead:
>>
>> (1) SFDP only [size==0]
>>
>> (2) static config only
>> [size!=0 && !(no_sfdp_flags & SPI_NOR_TRY_SFDP)]
>>
>> (3) SFDP with fallback to static config
>> [size!=0 && (no_sfdp_flags & SPI_NOR_TRY_SFDP)]
>>
>> Existing struct flash_info entries are modified, so that all those
>> that was case (2a) or (2b) are now case (2), and those that were (1)
>> and (3) are still (1) and (3).
>
> We indeed want 2a/ and 2b/ to be squashed, ideally by removing the
> default_init() hook.
But you think we should not remove default_init() hook as part of this
series?
> And if we really want SFDP-only init, we shall not call
> spi_nor_init_default_params() in this case.
So move spi_nor_init_default_params() into the if (spi_nor_needs_sfdp())
else section?
I have pushed a fixup commit doing this to my branch. Should I amend
patch 1/15 with it?
/Esben
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: Esben Haabendal <esben@geanix.com>
To: Tudor Ambarus <tudor.ambarus@linaro.org>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
Michael Walle <mwalle@kernel.org>,
Vignesh Raghavendra <vigneshr@ti.com>,
Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
Richard Weinberger <richard@nod.at>,
linux-kernel@vger.kernel.org,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
linux-mtd@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
Miquel Raynal <miquel.raynal@bootlin.com>,
Pratyush Yadav <pratyush@kernel.org>
Subject: Re: [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use
Date: Thu, 26 Sep 2024 13:35:20 +0200 [thread overview]
Message-ID: <877cayhclj.fsf@geanix.com> (raw)
In-Reply-To: <e079751d-e775-4dec-9959-c9c3fdcc8ecf@linaro.org> (Tudor Ambarus's message of "Thu, 26 Sep 2024 11:08:25 +0100")
Tudor Ambarus <tudor.ambarus@linaro.org> writes:
> Hiya, Esben,
>
> On 7/11/24 2:00 PM, Esben Haabendal wrote:
>> Following up to various discussions, this series have now been
>> modified so that it gets rid of the old deprecated approach
>> for detecting when to do optional SFDP parsing.
>>
>> Before these changes, spi-nor flashes were handled in 4 different
>> ways:
>>
>
> I'm adding a bit of extra context on each point you made. All your
> points contain static init, you missed spi_nor_init_default_params()
I might be even more confused now :) Let me try to understand...
> There's a 0/ case where we have indeed just SFDP initialized flashes,
> and that is the generic flash driver.
>
> 0/ SFDP only, generic flash driver
Ok. So this is when spi_nor_detect() falls back to
spi_nor_generic_flash, right?
>> (1) SFDP only [size==0]
>
> 1/ static + SFDP
So we have found a matching flash_info, and it has size==0. Right?
> spi_nor_init_default_params(nor);
I guess we can assume that flash_info in this case will always have
something set (other than .name and .size=0)?
> spi_nor_parse_sfdp();
>> (2a) static config only [size!=0 && no_sfdp_flags & SPI_NOR_SKIP_SFDP]
>
> 2a/ is
> spi_nor_init_default_params(nor);
> spi_nor_no_sfdp_init_params(nor);
Got it.
>> (2b) static config only
>> [size!=0 &&
>> !(no_sfdp_flags & (SPI_NOR_SKIP_SFDP |
>> SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
>> SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ))]
>
> 2b/ is
> spi_nor_init_default_params(nor);
> spi_nor_init_params_deprecated(nor); //where parse SFDP is not called
> spi_nor_no_sfdp_init_params(nor);
> spi_nor_manufacturer_init_params(nor);>
Got it.
>> (3) SFDP with fallback to static config
>> [size!=0 &&
>> !(no_sfdp_flags & SPI_NOR_SKIP_SFDP) &&
>> (no_sfdp_flags & SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
>> SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ))]
>>
>
> 3/ is 2b/ with parse SFDP called and rollback mechanism
> spi_nor_init_default_params(nor);
> spi_nor_init_params_deprecated(nor);
> spi_nor_no_sfdp_init_params(nor);
> spi_nor_manufacturer_init_params(nor);
> spi_nor_sfdp_init_params_deprecated(nor);
>
> All cases from above are followed by a call to spi_nor_late_init_params().
Got it.
Should I move your annotations to the cover letter? If I find it
helpful, I think it might also be helpful to somebody else :)
>> Cases (2a) and (2b) have been handled slightly different, with
>> manufacturer and flash_info ->default_init() hooks being called in
>> case (2b) but not in case (2a).
>
> default_init() was a mistake and we shall remove it and replace it with
> late_init(). The challenge is to do that without affecting backwards
> compatibility. But let's move this aside for the moment
>>
>> With this series, that is changed to this simpler approach instead:
>>
>> (1) SFDP only [size==0]
>>
>> (2) static config only
>> [size!=0 && !(no_sfdp_flags & SPI_NOR_TRY_SFDP)]
>>
>> (3) SFDP with fallback to static config
>> [size!=0 && (no_sfdp_flags & SPI_NOR_TRY_SFDP)]
>>
>> Existing struct flash_info entries are modified, so that all those
>> that was case (2a) or (2b) are now case (2), and those that were (1)
>> and (3) are still (1) and (3).
>
> We indeed want 2a/ and 2b/ to be squashed, ideally by removing the
> default_init() hook.
But you think we should not remove default_init() hook as part of this
series?
> And if we really want SFDP-only init, we shall not call
> spi_nor_init_default_params() in this case.
So move spi_nor_init_default_params() into the if (spi_nor_needs_sfdp())
else section?
I have pushed a fixup commit doing this to my branch. Should I amend
patch 1/15 with it?
/Esben
WARNING: multiple messages have this Message-ID (diff)
From: Esben Haabendal <esben@geanix.com>
To: Tudor Ambarus <tudor.ambarus@linaro.org>
Cc: Pratyush Yadav <pratyush@kernel.org>,
Michael Walle <mwalle@kernel.org>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use
Date: Thu, 26 Sep 2024 13:35:20 +0200 [thread overview]
Message-ID: <877cayhclj.fsf@geanix.com> (raw)
In-Reply-To: <e079751d-e775-4dec-9959-c9c3fdcc8ecf@linaro.org> (Tudor Ambarus's message of "Thu, 26 Sep 2024 11:08:25 +0100")
Tudor Ambarus <tudor.ambarus@linaro.org> writes:
> Hiya, Esben,
>
> On 7/11/24 2:00 PM, Esben Haabendal wrote:
>> Following up to various discussions, this series have now been
>> modified so that it gets rid of the old deprecated approach
>> for detecting when to do optional SFDP parsing.
>>
>> Before these changes, spi-nor flashes were handled in 4 different
>> ways:
>>
>
> I'm adding a bit of extra context on each point you made. All your
> points contain static init, you missed spi_nor_init_default_params()
I might be even more confused now :) Let me try to understand...
> There's a 0/ case where we have indeed just SFDP initialized flashes,
> and that is the generic flash driver.
>
> 0/ SFDP only, generic flash driver
Ok. So this is when spi_nor_detect() falls back to
spi_nor_generic_flash, right?
>> (1) SFDP only [size==0]
>
> 1/ static + SFDP
So we have found a matching flash_info, and it has size==0. Right?
> spi_nor_init_default_params(nor);
I guess we can assume that flash_info in this case will always have
something set (other than .name and .size=0)?
> spi_nor_parse_sfdp();
>> (2a) static config only [size!=0 && no_sfdp_flags & SPI_NOR_SKIP_SFDP]
>
> 2a/ is
> spi_nor_init_default_params(nor);
> spi_nor_no_sfdp_init_params(nor);
Got it.
>> (2b) static config only
>> [size!=0 &&
>> !(no_sfdp_flags & (SPI_NOR_SKIP_SFDP |
>> SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
>> SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ))]
>
> 2b/ is
> spi_nor_init_default_params(nor);
> spi_nor_init_params_deprecated(nor); //where parse SFDP is not called
> spi_nor_no_sfdp_init_params(nor);
> spi_nor_manufacturer_init_params(nor);>
Got it.
>> (3) SFDP with fallback to static config
>> [size!=0 &&
>> !(no_sfdp_flags & SPI_NOR_SKIP_SFDP) &&
>> (no_sfdp_flags & SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
>> SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ))]
>>
>
> 3/ is 2b/ with parse SFDP called and rollback mechanism
> spi_nor_init_default_params(nor);
> spi_nor_init_params_deprecated(nor);
> spi_nor_no_sfdp_init_params(nor);
> spi_nor_manufacturer_init_params(nor);
> spi_nor_sfdp_init_params_deprecated(nor);
>
> All cases from above are followed by a call to spi_nor_late_init_params().
Got it.
Should I move your annotations to the cover letter? If I find it
helpful, I think it might also be helpful to somebody else :)
>> Cases (2a) and (2b) have been handled slightly different, with
>> manufacturer and flash_info ->default_init() hooks being called in
>> case (2b) but not in case (2a).
>
> default_init() was a mistake and we shall remove it and replace it with
> late_init(). The challenge is to do that without affecting backwards
> compatibility. But let's move this aside for the moment
>>
>> With this series, that is changed to this simpler approach instead:
>>
>> (1) SFDP only [size==0]
>>
>> (2) static config only
>> [size!=0 && !(no_sfdp_flags & SPI_NOR_TRY_SFDP)]
>>
>> (3) SFDP with fallback to static config
>> [size!=0 && (no_sfdp_flags & SPI_NOR_TRY_SFDP)]
>>
>> Existing struct flash_info entries are modified, so that all those
>> that was case (2a) or (2b) are now case (2), and those that were (1)
>> and (3) are still (1) and (3).
>
> We indeed want 2a/ and 2b/ to be squashed, ideally by removing the
> default_init() hook.
But you think we should not remove default_init() hook as part of this
series?
> And if we really want SFDP-only init, we shall not call
> spi_nor_init_default_params() in this case.
So move spi_nor_init_default_params() into the if (spi_nor_needs_sfdp())
else section?
I have pushed a fixup commit doing this to my branch. Should I amend
patch 1/15 with it?
/Esben
next prev parent reply other threads:[~2024-09-26 11:36 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 13:00 [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 01/15] mtd: spi-nor: core: add flag for doing optional SFDP parsing Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 02/15] mtd: spi-nor: macronix: enable quad/dual speed for mx25l3205d chips Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 03/15] mtd: spi-nor: Align default_init() handling for SPI_NOR_SKIP_SFDP Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 04/15] mtd: spi-nor: atmel: Use new SPI_NOR_TRY_SFDP flag Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 05/15] mtd: spi-nor: eon: " Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 06/15] mtd: spi-nor: gigadevice: " Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 07/15] mtd: spi-nor: issi: " Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 08/15] mtd: spi-nor: macronix: " Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 09/15] mtd: spi-nor: micron-st: " Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 10/15] mtd: spi-nor: spansion: " Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 11/15] mtd: spi-nor: sst: " Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 12/15] mtd: spi-nor: winbond: " Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 13/15] mtd: spi-nor: xmc: " Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-11 13:00 ` [PATCH v3 14/15] mtd: spi-nor: Drop deprecated mechanism for optional SFDP parsing Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-12 8:33 ` kernel test robot
2024-07-12 8:33 ` kernel test robot
2024-07-12 9:23 ` Esben Haabendal
2024-07-12 9:23 ` Esben Haabendal
2024-07-12 9:23 ` Esben Haabendal
2024-07-12 16:04 ` kernel test robot
2024-07-12 16:04 ` kernel test robot
2024-07-11 13:00 ` [PATCH v3 15/15] mtd: spi-nor: spansion: Drop redundant SPI_NOR_SKIP_SFDP flag Esben Haabendal
2024-07-11 13:00 ` Esben Haabendal
2024-07-12 9:26 ` Esben Haabendal
2024-07-12 9:26 ` Esben Haabendal
2024-07-12 9:26 ` Esben Haabendal
2024-07-12 9:55 ` [PATCH v3 00/15] mtd: spi-nor: macronix: workaround for device id re-use Michael Walle
2024-07-12 9:55 ` Michael Walle
2024-09-26 7:56 ` Esben Haabendal
2024-09-26 7:56 ` Esben Haabendal
2024-09-26 7:56 ` Esben Haabendal
2024-09-26 10:47 ` Tudor Ambarus
2024-09-26 10:47 ` Tudor Ambarus
2024-09-26 10:47 ` Tudor Ambarus
2024-09-26 10:52 ` Tudor Ambarus
2024-09-26 10:52 ` Tudor Ambarus
2024-09-26 10:52 ` Tudor Ambarus
2024-09-26 12:18 ` Esben Haabendal
2024-09-26 12:18 ` Esben Haabendal
2024-09-26 12:18 ` Esben Haabendal
2024-09-26 10:08 ` Tudor Ambarus
2024-09-26 10:08 ` Tudor Ambarus
2024-09-26 11:01 ` Esben Haabendal
2024-09-26 11:01 ` Esben Haabendal
2024-09-26 11:01 ` Esben Haabendal
2024-09-26 11:35 ` Esben Haabendal [this message]
2024-09-26 11:35 ` Esben Haabendal
2024-09-26 11:35 ` Esben Haabendal
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=877cayhclj.fsf@geanix.com \
--to=esben@geanix.com \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=mwalle@kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=pratyush@kernel.org \
--cc=rasmus.villemoes@prevas.dk \
--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 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.